Search completed in 0.99 seconds.
1585 results for "index":
Your results are loading. Please wait...
Index - Web APIs
Web › API › Index
cssstyledeclaration.getpropertyvalue() api, cssom, method, reference the cssstyledeclaration.getpropertyvalue() method interface returns a domstring containing the value of a specified css property. 460 cssstyledeclaration.item() api, cssom, method, reference the cssstyledeclaration.item() method interface returns a css property name from a cssstyledeclaration by index 461 cssstyledeclaration.length api, cssom, property, reference the read-only property returns an integer that represents the number of style declarations in this css declaration block. 462 cssstyledeclaration.parentrule api, cssom, property, reference the cssstyledeclaration.parentrule read-only property returns a cssrule that is the parent of this style ...
... the cssunparsedvalue.foreach() method executes a provided function once for each element of the cssunparsedvalue. 489 cssunparsedvalue.keys() api, css typed object model api, cssunparsedvalue, constructor, experimental, houdini, method, needsexample, reference, keys() the cssunparsedvalue.keys() method returns a new array iterator object that contains the keys for each index in the array. 490 cssunparsedvalue.length api, css typed object model api, cssunparsedvalue, constructor, experimental, houdini, needsexample, property, reference, length the length read-only property of the cssunparsedvalue interface returns the number of items in the object. 491 cssunparsedvalue.values() api, css typed object model api, cssunparsedvalue, cons...
... the length read-only property of the cssunparsedvalue interface returns the number of items in the object. 491 cssunparsedvalue.values() api, css typed object model api, cssunparsedvalue, constructor, experimental, houdini, method, needsexample, reference, values() the cssunparsedvalue.values() method returns a new array iterator object that contains the values for each index in the cssunparsedvalue object. 492 cssvalue api, cssvalue, dom, interface, needsexample, reference the cssvalue interface represents the current computed value of a css property. 493 cssvalue.csstext api, cssvalue, property, reference, csstext the csstext property of the cssvalue interface represents the current computed css property value. 494 ...
...And 150 more matches
Using IndexedDB - Web APIs
indexeddb is a way for you to persistently store data inside a user's browser. because it lets you create web applications with rich query abilities regardless of network availability, your applications can work both online and offline. about this document this tutorial walks you through using the asynchronous api of indexeddb. if you are not familiar with indexeddb, you should first read basic concepts about indexeddb. for the reference documentation on the indexeddb api, see the indexeddb article and its subpages. this article documents the types of objects used by indexeddb, as well as the methods of the asynchronous api (the synchronous api was removed from spec). basic pattern the basic pattern that indexeddb encourages is the following: open a database. create an object sto...
...ion and make a request to do some database operation, like adding or retrieving data. wait for the operation to complete by listening to the right kind of dom event. do something with the results (which can be found on the request object). with these big concepts under our belts, we can get to more concrete stuff. creating and structuring the store using an experimental version of indexeddb in case you want to test your code in browsers that still use a prefix, you can use the following code: // in the following line, you should include the prefixes of implementations you want to test. window.indexeddb = window.indexeddb || window.mozindexeddb || window.webkitindexeddb || window.msindexeddb; // don't use "var indexeddb = ..." if you're not in a function. // moreover, you may...
...bkeyrange || window.msidbkeyrange; // (mozilla has never prefixed these objects, so we don't need window.mozidb*) beware that implementations that use a prefix may be buggy, or incomplete, or following an old version of the specification. therefore, it is not recommended to use it in production code. it may be preferable to not support a browser than to claim to support it and fail: if (!window.indexeddb) { console.log("your browser doesn't support a stable version of indexeddb. such and such feature will not be available."); } opening a database we start the whole process like this: // let us open our database var request = window.indexeddb.open("mytestdatabase", 3); see that? opening a database is just like any other operation — you have to "request" it. the open request doesn'...
...And 49 more matches
String.prototype.indexOf() - JavaScript
the indexof() method returns the index within the calling string object of the first occurrence of the specified value, starting the search at fromindex. returns -1 if the value is not found. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: for the array method, see array.prototype.indexof(). syntax str.indexof(searchvalue [, fromindex]) parameters searchvalue the string value to search for. if no string is explicitly provided, searchvalue will be coerced to "undefined", and this value will be searched for in str. ...
...ttps://github.com/mdn/interactive-examples and send us a pull request. note: for the array method, see array.prototype.indexof(). syntax str.indexof(searchvalue [, fromindex]) parameters searchvalue the string value to search for. if no string is explicitly provided, searchvalue will be coerced to "undefined", and this value will be searched for in str. so, for example: 'undefined'.indexof() will return 0, as undefined is found at position 0 in the string undefined. 'undefine'.indexof() however will return -1, as undefined is not found in the string undefine. fromindex optional an integer representing the index at which to start the search. defaults to 0. ...
...ll be coerced to "undefined", and this value will be searched for in str. so, for example: 'undefined'.indexof() will return 0, as undefined is found at position 0 in the string undefined. 'undefine'.indexof() however will return -1, as undefined is not found in the string undefine. fromindex optional an integer representing the index at which to start the search. defaults to 0. for fromindex values lower than 0, or greater than str.length, the search starts at index 0 and str.length, respectively. for example, 'hello world'.indexof('o', -5) will return 4, as it starts at position 0, and o is found at position 4. ...
...And 24 more matches
Index - Archive of obsolete content
no summary! 43 clipboard add-on sdk interact with the system clipboard, setting and getting its contents. 44 context-menu add-on sdk, add-ons, extensions, firefox, sdk adds items, submenus, and menu separators to the page's context menu. 45 hotkeys add-on sdk assign hotkey combinations to functions in your add-on. 46 indexed-db add-on sdk exposes the indexeddb api to add-ons. 47 l10n add-on sdk localize strings appearing in the add-on's javascript code. 48 notifications add-on sdk, notifications display transient, toaster-style desktop messages to the user. 49 page-mod add-on sdk run scripts in the context of web pages whose url matches a give...
...olor xul attributes, xul reference no summary! 811 colorpicker.type xul attributes, xul reference no summary! 812 cols xul attributes, xul reference no summary! 813 command xul attributes, xul reference no summary! 814 commandupdater xul attributes, xul reference no summary! 815 completedefaultindex xul attributes, xul reference no summary! 816 completeselectedindex no summary! 817 container xul attributes, xul reference no summary! 818 containment xul attributes, xul reference no summary! 819 contentcontextmenu xul attributes, xul reference no summary! 820 contenttooltip xul attribu...
... 823 control xul attributes, xul reference no summary! 824 crop xul attributes, xul reference no summary! 825 curpos xul attributes, xul reference no summary! 826 current xul attributes, xul reference no summary! 827 currentset needshelp, xul attributes, xul reference no summary! 828 customindex xul attributes, xul reference no summary! 829 customizable xul attributes, xul reference no summary! 830 cycler xul attributes, xul reference no summary! 831 datasources xul attributes, xul reference no summary! 832 datepicker.type xul attributes, xul reference no summary! 833 datepicker.value...
...And 23 more matches
Index
Mozilla › Tech › XPCOM › Index
ding xpcom objects in c++ using visual studio. xpcom is mozilla’s cross platform component object model, similar to microsoft’s com technology. xpcom components can be implemented in c, c++, and javascript, and can be used from c, c++, and javascript. that means you can call javascript methods from c++ and vice versa. for more information on the workings of xpcom look elsewhere. 12 index found 1275 pages: 13 interfacing with the xpcom cycle collector firefox 3, xpcom this is a quick overview of the cycle collector introduced into xpcom for firefox 3, including a description of the steps involved in modifying an existing c++ class to participate in xpcom cycle collection. if you have a class that you think is involved in a cyclical-ownership leak, t...
...n the error console if not caught than simply throwing an nsresult's value will. 19 components.id xpcom:language bindings, xpconnect components.id is a constructor that creates native objects that conform to the nsijsid interface. 20 components.classes xpcom:language bindings, xpconnect components.classes is a read-only object whose properties are classes indexed by contractid. 21 components.classesbyid xpcom:language bindings, xpconnect components.classesbyid is a read-only object whose properties are classes indexed by cid. 22 components.interfaces xpcom:language bindings, xpconnect components.interfaces is a read-only object whose properties are interfaces indexed by their names. 23 components.inte...
... 24 components.issuccesscode xpcom, xpcom:language bindings, xpconnect determines whether a given xpcom return code (that is, an nsresult value) indicates the success or failure of an operation, returning true or false respectively. ...
...And 21 more matches
Array.prototype.indexOf() - JavaScript
the indexof() method returns the first index at which a given element can be found in the array, or -1 if it is not present. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.indexof(searchelement[, fromindex]) parameters searchelement element to locate in the array. fromindex optional the index to start the search at. if the index is greater than or equal to the array's length, -1 is returned, which means the array will not be searched. if the provided index value is a negative number, it is taken as the offset from the end of the array. ...
....indexof(searchelement[, fromindex]) parameters searchelement element to locate in the array. fromindex optional the index to start the search at. if the index is greater than or equal to the array's length, -1 is returned, which means the array will not be searched. if the provided index value is a negative number, it is taken as the offset from the end of the array. note: if the provided index is negative, the array is still searched from front to back. if the provided index is 0, then the whole array will be searched. default: 0 (entire array is searched). return value the first index of the element in the array; -1 if not found. ...
...searched. if the provided index value is a negative number, it is taken as the offset from the end of the array. note: if the provided index is negative, the array is still searched from front to back. if the provided index is 0, then the whole array will be searched. default: 0 (entire array is searched). return value the first index of the element in the array; -1 if not found. description indexof() compares searchelement to elements of the array using strict equality (the same method used by the === or triple-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...
...And 20 more matches
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
color xul attributes, xul reference no summary! 64 colorpicker.type xul attributes, xul reference no summary! 65 cols xul attributes, xul reference no summary! 66 command xul attributes, xul reference no summary! 67 commandupdater xul attributes, xul reference no summary! 68 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 contenttooltip xul attributes, ...
... 76 control xul attributes, xul reference no summary! 77 crop xul attributes, xul reference no summary! 78 curpos xul attributes, xul reference no summary! 79 current xul attributes, xul reference no summary! 80 currentset needshelp, xul attributes, xul reference no summary! 81 customindex xul attributes, xul reference no summary! 82 customizable xul attributes, xul reference no summary! 83 cycler xul attributes, xul reference no summary! 84 datasources xul attributes, xul reference no summary! 85 datepicker.type xul attributes, xul reference no summary! 86 datepicker.value ...
... no summary! 154 ignorekeys xul attributes, xul reference no summary! 155 image xul attributes, xul reference no summary! 156 image.onload no summary! 157 inactivetitlebarcolor xul attributes, xul reference no summary! 158 increment xul attributes, xul reference no summary! 159 index xul attributes, xul reference no summary! 160 inputtooltiptext xul attributes, xul reference no summary! 161 insertafter xul attributes, xul reference no summary! 162 insertbefore xul attributes, xul reference no summary! 163 instantapply xul attributes, xul reference no summary! 164 inverted ...
...And 18 more matches
Content Index API - Web APIs
the content index api allows developers to register their offline enabled content with the browser. concepts and usage as it stands, offline web content is not easily discoverable by users. content indexing allows developers to tell the browser about their specific offline content. this allows users to discover and view what is available, whilst giving developers the ability to add and manage this content. examples could be a news website prefetching the latest articles in the background, or a content streaming app registering downloaded content. the content index api is an extension to service workers, which allows developers to add urls and metadata of already cached pages, under the scope of the current service worker. the browser can then use these entries to display offline r...
...ground, or a content streaming app registering downloaded content. the content index api is an extension to service workers, which allows developers to add urls and metadata of already cached pages, under the scope of the current service worker. the browser can then use these entries to display offline reading to a user. as a developer you can also display these entries within your application. indexed entries do not automatically expire. it's good practice to present an interface for clearing out entries, or periodically remove older entries. the api supports indexing urls corresponding to html documents. a url for a cached media file, for example, can't be indexed directly. instead, you need to provide a url for a page that displays media, and which works offline. interfaces conte...
... entries do not automatically expire. it's good practice to present an interface for clearing out entries, or periodically remove older entries. the api supports indexing urls corresponding to html documents. a url for a cached media file, for example, can't be indexed directly. instead, you need to provide a url for a page that displays media, and which works offline. interfaces contentindex the contentindex interface provides functionality to register content available offline. contentindexevent the contentindexevent interface of the content index api defines the object used to represent the contentdelete event. ...
...And 18 more matches
IDBIndex - Web APIs
Web › API › IDBIndex
idbindex interface of the indexeddb api provides asynchronous access to an index in a database. an index is a kind of object store for looking up records in another object store, called the referenced object store. you use this interface to retrieve data. you can retrieve records in an object store through the primary key or by using an index. an index lets you look up records in an object store using properties of the values in the object stores records other than the primary key the index is a persistent key-value storage where the value part of its records is the key part of a record in the referenced object store. the records in an index are automatically populated whenever records in the referenced object store are inserted, updated, or deleted. ...
...in an object store using properties of the values in the object stores records other than the primary key the index is a persistent key-value storage where the value part of its records is the key part of a record in the referenced object store. the records in an index are automatically populated whenever records in the referenced object store are inserted, updated, or deleted. each record in an index can point to only one record in its referenced object store, but several indexes can reference the same object store. when the object store changes, all indexes that refers to the object store are automatically updated. you can grab a set of keys within a range. ...
... or deleted. each record in an index can point to only one record in its referenced object store, but several indexes can reference the same object store. when the object store changes, all indexes that refers to the object store are automatically updated. you can grab a set of keys within a range. to learn more, see idbkeyrange. note: this feature is available in web workers. properties idbindex.isautolocale read only returns a boolean indicating whether the index had a locale value of auto specified upon its creation (see createindex()'s optionalparameters.) idbindex.locale read only returns the locale of the index (for example en-us, or pl) if it had a locale value specified upon its creation (see createindex()'s optionalparameters.) idbindex.name the name of this index. id...
...And 17 more matches
IDBIndex.getKey() - Web APIs
Web › API › IDBIndex › getKey
if this value is null or missing, the browser will use an unbound key range. return value an idbrequest object on which subsequent events related to this operation are fired. ...
...if this value is null or missing, the browser will use an unbound key range. return value an idbrequest object on which subsequent events related to this operation are fired. ...
...if this value is null or missing, the browser will use an unbound key range. return value an idbrequest object on which subsequent events related to this operation are fired. ...
...And 13 more matches
IndexedDB API - Web APIs
indexeddb is a low-level api for client-side storage of significant amounts of structured data, including files/blobs. this api uses indexes to enable high-performance searches of this data. while web storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. indexeddb provides a solution. this is the main landing page for mdn's indexeddb coverage — here we provide links to the full api reference and usage guides, browser support details, and some explanation of key concepts. note: this feature is available in web workers. note: indexeddb api is powerful, but may seem too complicated for simple cases. if you'd prefer a simple api, try libraries such as localforage, dexie.js, zangodb, pouchdb, idb, idb-keyval, jsstore and lovefie...
...re we provide links to the full api reference and usage guides, browser support details, and some explanation of key concepts. note: this feature is available in web workers. note: indexeddb api is powerful, but may seem too complicated for simple cases. if you'd prefer a simple api, try libraries such as localforage, dexie.js, zangodb, pouchdb, idb, idb-keyval, jsstore and lovefield that make indexeddb more programmer-friendly. key concepts and usage indexeddb is a transactional database system, like an sql-based rdbms. however, unlike sql-based rdbmses, which use fixed-column tables, indexeddb is a javascript-based object-oriented database. indexeddb lets you store and retrieve objects that are indexed with a key; any objects supported by the structured clone algorithm can be stored. yo...
...lumn tables, indexeddb is a javascript-based object-oriented database. indexeddb lets you store and retrieve objects that are indexed with a key; any objects supported by the structured clone algorithm can be stored. you need to specify the database schema, open a connection to your database, and then retrieve and update data within a series of transactions. read more about the concepts behind indexeddb. learn to use indexeddb asynchronously from first principles with our using indexeddb guide. combine indexeddb for storing data offline with service workers for storing assets offline, as outlined in making pwas work offline with service workers. note: like most web storage solutions, indexeddb follows a same-origin policy. so while you can access stored data within a domain, you cannot ...
...And 12 more matches
Array.prototype.findIndex() - JavaScript
the findindex() method returns the index of the first element in the array that satisfies the provided testing function. otherwise, it returns -1, indicating that no element passed the test. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see also the find() method, which returns the value of an array element, instead of its index. syntax arr.findindex(callback( element[, index[, array]] )[, thisarg]) parameters callback a function to execute on each value in the array until the function returns true, indicating that the satisfying element was found. it takes three arguments: element the current el...
...hod, which returns the value of an array element, instead of its index. syntax arr.findindex(callback( element[, index[, array]] )[, thisarg]) parameters callback a function to execute on each value in the array until the function returns true, indicating that the satisfying element was found. it takes three arguments: element the current element being processed in the array. index optional the index 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. ...
... 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. description the findindex() method executes the callback function once for every index in the array until it finds the one where callback returns a truthy value. if such an element is found, findindex() immediately returns the element's index. if callback never returns a truthy value (or the array's length is 0), findindex() returns -1. edge case alert: unlike other array methods such as array.some(), callback is run e...
...And 12 more matches
Indexed collections - JavaScript
so emp[0] would be employee number zero, emp[1] employee number one, and so on. javascript does not have an explicit array data type. however, you can use the predefined array object and its methods to work with arrays in your applications. ...
...so emp[0] would be employee number zero, emp[1] employee number one, and so on. javascript does not have an explicit array data type. however, you can use the predefined array object and its methods to work with arrays in your applications. ...
...so emp[0] would be employee number zero, emp[1] employee number one, and so on. javascript does not have an explicit array data type. however, you can use the predefined array object and its methods to work with arrays in your applications. ...
...And 11 more matches
IDBIndex.get() - Web APIs
Web › API › IDBIndex › get
if this value is null or missing, the browser will use an unbound key range. ...
...e thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is set to an idbkeyrange. if a value is found, then a structured clone of it is created and set as the result of the request object: this returns the record the key is associated with. note: this feature is available in web workers. syntax var request = myindex.get(key); parameters key optional a key or idbkeyrange that identifies the record to be retrieved. if this value is null or missing, the browser will use an unbound key range. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description ...
... idbkeyrange that identifies the record to be retrieved. if this value is null or missing, the browser will use an unbound key range. return value an idbrequest object on which subsequent events related to this operation are fired. ...
...And 10 more matches
IDBObjectStore.createIndex() - Web APIs
the createindex() method of the idbobjectstore interface creates and returns a new idbindex object in the connected database. it creates a new field/column defining a new data point for each database record to contain. bear in mind that indexeddb indexes can contain any javascript data type; indexeddb uses the structured clone algorithm to serialize stored objects, which allows for storage of simple and complex objects. note that this method must be called only from a versionchange transaction mode callback. note: this feature is available in web workers. syntax var myidbindex = objectstore.createindex(indexname, keypath); var myidbindex = objectstore.createindex(indexname, keypath, objectparameters); parameters indexname the name of the index to create. note that it is possible t...
... objects. note that this method must be called only from a versionchange transaction mode callback. note: this feature is available in web workers. syntax var myidbindex = objectstore.createindex(indexname, keypath); var myidbindex = objectstore.createindex(indexname, keypath, objectparameters); parameters indexname the name of the index to create. note that it is possible to create an index with an empty name. keypath the key path for the index to use. note that it is possible to create an index with an empty keypath, and also to pass in a sequence (array) as a keypath. ...
...yidbindex = objectstore.createindex(indexname, keypath, objectparameters); parameters indexname the name of the index to create. note that it is possible to create an index with an empty name. keypath the key path for the index to use. note that it is possible to create an index with an empty keypath, and also to pass in a sequence (array) as a keypath. objectparameters optional an idbindexparameters object, which can include the following properties: attribute description unique if true, the index will not allow duplicate values for a single key. multientry if true, the index will add an entry in the index for each array element when the keypath resolves to an array. if false, it will add one single entry containing the array.
...And 10 more matches
IDBObjectStore.deleteIndex() - Web APIs
return value undefined exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction mode callback. ...
... return value undefined exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction mode callback. ...
... return value undefined exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction mode callback. ...
...And 10 more matches
Index
ne section related to debugging and another section related to drafting optimizations. many of these tips only apply to debug builds of the js shell; they will not function in a release build. 10 how to embed the javascript engine embedding mozilla, javascript, 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 javascript shell spidermonkey to get the spidermonkey javascript shell, see the spidermonkey build documentation or download a compiled binary for your platform from the nightly builds. 13 jit optimization outcomes beginner, firefox, intro, needscontent, spidermonkey spidermon...
...erence, reference, référence(2), spidermonkey js_addfinalizecallback add 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 pointer to the callback function to add. 188 js_aliaselement jsapi reference, obsolete, spidermonkey js_aliaselement assigns an alternate index number for an element or numeric property associated with a native object. obj is the object to which the element belongs. name is the element's current index in the object, and alias is the alternate index to assign to the element. 189 js_aliasproperty jsapi reference, obsolete, spidermonkey js_aliasproperty assigns an alternate name for a property associated with a native o...
... 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. 237 js_deleteelement jsapi reference, spidermonkey js_deleteelement 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_deleteelement returns true. otherwise it returns false. 238 js_deleteelement2 jsapi reference, obsolete, spidermonkey js_deleteelement2 removes a specified numeric propert...
...And 9 more matches
IDBIndex.count() - Web APIs
Web › API › IDBIndex › count
the count() method of the idbindex interface returns an idbrequest object, and in a separate thread, returns the number of records within a key range. note: this feature is available in web workers. syntax var request = myindex.count(); var request = myindex.count(key); parameters key optional the key or key range that identifies the record to be counted. return value a idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. dataerror the key or key range provided contains an invalid key. ...
...request object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. dataerror the key or key range provided contains an invalid key. invalidstateerror the idbindex has been deleted or removed. ...
...one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. dataerror the key or key range provided contains an invalid key. invalidstateerror the idbindex has been deleted or removed. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. ...
...And 9 more matches
String.prototype.lastIndexOf() - JavaScript
the lastindexof() method returns the index within the calling string object of the last occurrence of the specified value, searching backwards from fromindex. returns -1 if the value is not found. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.lastindexof(searchvalue[, fromindex]) parameters searchvalue a string representing the value to search for. if searchvalue is an empty string, then fromindex is returned. fromindex optional the index of the last character in the string to be considered as the beginning of a match. the default value is +infinity. ...
...b.com/mdn/interactive-examples and send us a pull request. syntax str.lastindexof(searchvalue[, fromindex]) parameters searchvalue a string representing the value to search for. if searchvalue is an empty string, then fromindex is returned. fromindex optional the index of the last character in the string to be considered as the beginning of a match. the default value is +infinity. if fromindex >= str.length, the whole string is searched. if fromindex < 0, the behavior will be the same as if it would be 0. return value the index of the last occurrence of searchvalue; -1 if not found. description characters in a string are indexed from left to right. ...
...ex of the last character in the string to be considered as the beginning of a match. the default value is +infinity. if fromindex >= str.length, the whole string is searched. if fromindex < 0, the behavior will be the same as if it would be 0. return value the index of the last occurrence of searchvalue; -1 if not found. description characters in a string are indexed from left to right. the index of the first character is 0, and the index of the last character is str.length - 1. ...
...And 9 more matches
ContentIndex - Web APIs
the contentindex interface of the content index api allows developers to register their offline enabled content with the browser. properties there are no properties of this interface. methods contentindex.add registers an item with the content index. contentindex.delete unregisters an item from the currently indexed content. contentindex.getall returns a promise that resolves with an iterable list of content index entries. examples feature detection and interface access here we get a reference to the serviceworkerregistration, then check for the index property, which gives us access to the content index interface. ...
...etall returns a promise that resolves with an iterable list of content index entries. examples feature detection and interface access here we get a reference to the serviceworkerregistration, then check for the index property, which gives us access to the content index interface. // reference registration const registration = await navigator.serviceworker.ready; // feature detection if ('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. // our content const item = { id: 'post-1', url: '/posts/amet.html', title: 'amet consectetur adipisi...
...method to register it with the content index. ...
...And 8 more matches
IDBIndex.openCursor() - Web APIs
the method sets the position of the cursor to the appropriate record, based on the specified direction. if the key range is not specified or is null, then the range includes all the records. a success event is always fired on the result object. if at least one record matches the key range, then the result property of the event is set to the new idbcursorwithvalue object; the value of the cursor object is set to a structured clone of the referenced value. if no records match the key range then then the result property of the event is set to null. ...
...ct. if at least one record matches the key range, then the result property of the event is set to the new idbcursorwithvalue object; the value of the cursor object is set to a structured clone of the referenced value. if no records match the key range then then the result property of the event is set to null. note: this feature is available in web workers. syntax var request = myindex.opencursor(); var request = myindex.opencursor(range); var request = myindex.opencursor(range, direction); parameters range optional a key or idbkeyrange to use as the cursor's range. if nothing is passed, this will default to a key range that selects all the records in this object store. direction optional the cursor's direction. see idbcursor constants for possible values. return value...
...lects all the records in this object store. direction optional the cursor's direction. see idbcursor constants for possible values. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. typeerror the value for the direction parameter is invalid. dataerror the key or key range provided contains an invalid key. invalidstateerror the idbindex has been deleted or removed. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. ...
...And 8 more matches
<isindex> - HTML: Hypertext Markup Language
Web › HTML › Element › isindex
summary <isindex> was an obsolete html element that put a text field in a page for querying the document. <isindex> provided a single line text input for entering a query string. when sent, the server would return a list of pages matching the query. its support depended on both the browser and the server to react to the query. <isindex> is removed html standard. it was deprecated in html 4.01. the same behaviour can be achieved with an html form. all major browsers have now removed <isindex>. attributes like all other html elements, this element accepted the global attributes. prompt this attribute added its value as a prompt for text field. action this attribute determined the server url to which the query was sent. ...
...ndard. it was deprecated in html 4.01. the same behaviour can be achieved with an html form. all major browsers have now removed <isindex>. attributes like all other html elements, this element accepted the global attributes. prompt this attribute added its value as a prompt for text field. action this attribute determined the server url to which the query was sent. example <head> <isindex prompt="search document..." action="/search"> </head> in past browsers, this would generate, at parse time, a dom tree equivalent to the following html: <form action="/search"> <hr> <label> search document... ...
...attribute added its value as a prompt for text field. action this attribute determined the server url to which the query was sent. example <head> <isindex prompt="search document..." action="/search"> </head> in past browsers, this would generate, at parse time, a dom tree equivalent to the following html: <form action="/search"> <hr> <label> search document... <input name="isindex"> </label> <hr> </form> history on june 1992, dan connolly would prefer a different anchor type instead of isindex. on november 1992, indexes as links rather than documents started by dan connolly who is pushing the idea that indexes are more links than documents. in this thread, different type of solutions are proposed. the question of forms for making queries is mentioned in reference t...
...And 8 more matches
Array.prototype.lastIndexOf() - JavaScript
the lastindexof() method returns the last index at which a given element can be found in the array, or -1 if it is not present. the array is searched backwards, starting at fromindex. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.lastindexof(searchelement[, fromindex]) parameters searchelement element to locate in the array. fromindex optional the index at which to start searching backwards. defaults to the array's length minus one (arr.length - 1), i.e. the whole array will be searched. if the index is greater than or equal to the length of the array, the whole array will be searched. if negati...
...helement element to locate in the array. fromindex optional the index at which to start searching backwards. defaults to the array's length minus one (arr.length - 1), i.e. the whole array will be searched. if the index is greater than or equal to the length of the array, the whole array will be searched. if negative, it is taken as the offset from the end of the array. note that even when the index is negative, the array is still searched from back to front. if the calculated index is less than 0, -1 is returned, i.e. the array will not be searched. return value the last index of the element in the array; -1 if not found. description lastindexof compares searchelement to elements of the array using strict equality (the same method used by the ===, or triple-equals, operator). polyfil...
...ative, the array is still searched from back to front. if the calculated index is less than 0, -1 is returned, i.e. the array will not be searched. return value the last index of the element in the array; -1 if not found. description lastindexof compares searchelement to elements of the array using strict equality (the same method used by the ===, or triple-equals, operator). polyfill lastindexof was added to the ecma-262 standard in the 5th edition; as such it may not be present in other implementations of the standard. you can work around this by inserting the following code at the beginning of your scripts, allowing use of lastindexof in implementations which do not natively support it. this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object, typeerror, ...
...And 8 more matches
TypedArray.prototype.findIndex() - JavaScript
the findindex() method returns an index in the typed array, if an element in the typed array satisfies the provided testing function. otherwise -1 is returned. see also the find() method, which returns the value of a found element in the typed array instead of its index. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.findindex(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array. index the index of the current element being processed in the typed array. ...
...://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.findindex(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array findindex was called upon. thisarg optional. object to use as this when executing callback. return value an index in the array if an element passes the test; otherwise, -1. ...
...ing three arguments: element the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array findindex was called upon. thisarg optional. object to use as this when executing callback. return value an index in the array if an element passes the test; otherwise, -1. description the findindex method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value. if such an element is found, findindex immediately returns the index of that element. otherwise, findindex returns -1. ...
...And 8 more matches
indexed-db - Archive of obsolete content
experimental exposes the indexeddb api to add-ons. usage scripts running in web pages can access indexeddb via the window object. for example: window.indexeddb = window.indexeddb || window.webkitindexeddb || window.mozindexeddb || window.msindexeddb; var request = window.indexeddb.open("mydatabase"); request.onerror = function(event) { console.log("failure"); }; request.onsuccess = function(event) { console.log("success"); }; because your main add-on code can't access the dom, you can't do this. ...
...t. for example: window.indexeddb = window.indexeddb || window.webkitindexeddb || window.mozindexeddb || window.msindexeddb; var request = window.indexeddb.open("mydatabase"); request.onerror = function(event) { console.log("failure"); }; request.onsuccess = function(event) { console.log("success"); }; because your main add-on code can't access the dom, you can't do this. ...
...ddb || window.webkitindexeddb || window.mozindexeddb || window.msindexeddb; var request = window.indexeddb.open("mydatabase"); request.onerror = function(event) { console.log("failure"); }; request.onsuccess = function(event) { console.log("success"); }; because your main add-on code can't access the dom, you can't do this. so you can use the indexed-db module to access the same api: var { indexeddb } = require('sdk/indexed-db'); var request = indexeddb.open('mydatabase'); request.onerror = function(event) { console.log("failure"); }; request.onsuccess = function(event) { console.log("success"); }; most of the objects that implement the indexeddb api, such as idbtransaction, idbopendbrequest, and idbobjectstore, are accessible through the indexeddb object itself. the api exposed b...
...And 7 more matches
PR_NewThreadPrivateIndex
this function can be specified as null. returns the function returns one of the following values: if successful, pr_success. if the total number of indices exceeds 128, pr_failure. ...
...this function can be specified as null. returns the function returns one of the following values: if successful, pr_success. if the total number of indices exceeds 128, pr_failure. ...
...this function can be specified as null. returns the function returns one of the following values: if successful, pr_success. if the total number of indices exceeds 128, pr_failure. ...
...And 7 more matches
HTMLSelectElement.selectedIndex - Web APIs
the htmlselectelement.selectedindex is a long that reflects the index of the first or last selected <option> element, depending on the value of multiple. the value -1 indicates that no element is selected. ...
... the htmlselectelement.selectedindex is a long that reflects the index of the first or last selected <option> element, depending on the value of multiple. the value -1 indicates that no element is selected. ...
... the htmlselectelement.selectedindex is a long that reflects the index of the first or last selected <option> element, depending on the value of multiple. the value -1 indicates that no element is selected. ...
...And 7 more matches
IDBIndex.multiEntry - Web APIs
the multientry read-only property of the idbindex interface returns a boolean value that affects how the index behaves when the result of evaluating the index's key path yields an array. this is decided when the index is created, using the idbobjectstore.createindex method. this method takes an optional options parameter whose multientry property is set to true/false. note: this feature is available in web workers. syntax var ismultientry = myindex.multientry; value a boolean: value effect true there is one record in the index for each item in an array of keys. false there is one record for each key that is an array. ...
...alse. note: this feature is available in web workers. syntax var ismultientry = myindex.multientry; value a boolean: value effect true there is one record in the index for each item in an array of keys. false there is one record for each key that is an array. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the multi-entry status of the index is logged to the console: it should be returned as false. finally, ...
... works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the multi-entry status of the index is logged to the console: it should be returned as false. finally, we iterate through each record, and insert the data into an html table. ...
...And 7 more matches
IDBIndex.name - Web APIs
Web › API › IDBIndex › name
the name property of the idbindex interface contains a string which names the index. note: this feature is available in web workers. syntax var indexname = idbindex.name; idbindex.name = indexname; value a domstring specifying a name for the index. exceptions there are a several exceptions which can occur when you attempt to change an index's name. invalidstateerror the index, or its object store, has been deleted; or the current transaction is not an upgrade transaction. you can only rename indexes during upgrade transactions; that is, when the mode is "versionchange". transactioninactiveerror the current transaction is not active. constrainterror an index is already using the specified name. example in the following example we open a transaction and an object store, then ...
..., has been deleted; or the current transaction is not an upgrade transaction. you can only rename indexes during upgrade transactions; that is, when the mode is "versionchange". transactioninactiveerror the current transaction is not active. constrainterror an index is already using the specified name. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor() — this works the same as opening a cursor directly on an idbobjectstore using opencursor() except that the returned records are sorted based on the index, not the primary key. the name of the index is logged to the console: it should be returned as lname. finally, we iterate through eac...
...dex.opencursor() — this works the same as opening a cursor directly on an idbobjectstore using opencursor() except that the returned records are sorted based on the index, not the primary key. the name of the index is logged to the console: it should be returned as lname. finally, we iterate through each record, inserting the data into an html table. for a complete working example, see our idbindex-example demo repo (view the example live). ...
...And 7 more matches
IDBIndex.objectStore - Web APIs
the objectstore property of the idbindex interface returns the name of the object store referenced by the current index. note: this feature is available in web workers. syntax var myidbobjectstore = myindex.objectstore; value an idbobjectstore. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor. this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. ...
... then open a basic cursor on the index using idbindex.opencursor. this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the current object store is logged to the console: it should be returned something like this: idbobjectstore { name: "contactslist", keypath: "id", indexnames: domstringlist[7], transaction: idbtransaction, autoincrement: false } finally, we iterate through each record, and insert the data into an html table. ...
...d based on the index, not the primary key. the current object store is logged to the console: it should be returned something like this: idbobjectstore { name: "contactslist", keypath: "id", indexnames: domstringlist[7], transaction: idbtransaction, autoincrement: false } finally, we iterate through each record, and insert the data into an html table. ...
...And 7 more matches
IDBIndex.openKeyCursor() - Web APIs
the method sets the position of the cursor to the appropriate key, based on the specified direction. if the key range is not specified or is null, then the range includes all the keys. a success event is always fired on the result object. if at least one key matches the key range, then the result property of the event is set to the new idbcursor object; the key property of the cursor object is set to the found key and the primarykey property is set to the the corresponding primary key of the found record. ...
...y of the event is set to the new idbcursor object; the key property of the cursor object is set to the found key and the primarykey property is set to the the corresponding primary key of the found record. if no keys match the key range, then then the result property of the event is set to null. note: cursors returned by openkeycursor() do not make the referenced value available as idbindex.opencursor does. this makes obtaining a list of keys much more efficient. note: this feature is available in web workers. syntax var request = myindex.openkeycursor(); var request = myindex.openkeycursor(range); var request = myindex.openkeycursor(range, direction); parameters range optional a key or idbkeyrange to use as the cursor's range. if nothing is passed, this will default to a k...
...lects all the records in this object store. direction optional the cursor's direction. see idbcursor constants for possible values. return value an idbrequest object on which subsequent events related to this operation are fired. ...
...And 7 more matches
IDBIndex.unique - Web APIs
Web › API › IDBIndex › unique
the unique read-only property returns a boolean that states whether the index allows duplicate keys. this is decided when the index is created, using the idbobjectstore.createindex method. this method takes an optional parameter, unique, which if set to true means that the index will not be able to accept duplicate entries. note: this feature is available in web workers. syntax var isunique = idbindex.unique; value a boolean: value effect true the current index does not allow duplicate values for a key. false the current index allows duplicate key values. ...
...duplicate entries. note: this feature is available in web workers. syntax var isunique = idbindex.unique; value a boolean: value effect true the current index does not allow duplicate values for a key. false the current index allows duplicate key values. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the unique status of the index is logged to the console: it should be returned as false. finally, we it...
... this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the unique status of the index is logged to the console: it should be returned as false. finally, we iterate through each record, and insert the data into an html table. ...
...And 7 more matches
IDBObjectStore.index() - Web APIs
the index() method of the idbobjectstore interface opens a named index in the current object store, after which it can be used to, for example, return a series of records sorted by that index using a cursor. note: this feature is available in web workers. syntax var index = objectstore.index(name); parameters name the name of the index to open. return value an idbindex object for accessing the index. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror the source object store has been deleted, or the transaction for the object store has finished. notfounderror there is no index with the given name (case-sensitive) in the database. example in the following exa...
...on of one of the following types: exception description invalidstateerror the source object store has been deleted, or the transaction for the object store has finished. notfounderror there is no index with the given name (case-sensitive) in the database. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. finally, we iterate through each record, and insert the data into an html table. for a complete working ...
... contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. finally, we iterate through each record, and insert the data into an html table. ...
...And 7 more matches
IDBIndex.keyPath - Web APIs
Web › API › IDBIndex › keyPath
the keypath property of the idbindex interface returns the key path of the current index. if null, this index is not auto-populated. note: this feature is available in web workers. syntax var mykeypath = myindex.keypath; value any data type that can be used as a key path. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the key path of the current index is logged to the console: it should be returned as lname. finally, we iterate through each record...
...is works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the key path of the current index is logged to the console: it should be returned as lname. finally, we iterate through each record, and insert the data into an html table. ...
...dbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the key path of the current index is logged to the console: it should be returned as lname. finally, we iterate through each record, and insert the data into an html table. ...
...And 6 more matches
IDBIndexSync - 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 idbindexsync interface of the indexeddb api provides synchronous access to an index in a database. method overview any add (in any value, in optional any key) raises (idbdatabaseexception); any get (in any key) raises (idbdatabaseexception); any getobject (in any key) raises (idbdatabaseexception); void opencursor (in optional idbkeyrange range, in optional unsigned short direction) raises (idbdatabaseexception); void openobjectcursor (in optional idbkeyrange range...
...void openobjectcursor (in optional idbkeyrange range, in optional unsigned short direction) raises (idbdatabaseexception); any put (in any value, in optional any key) raises (idbdatabaseexception); void remove (in any key) raises (idbdatabaseexception); attributes attribute type description keypath readonly domstring the key path of this index. if this attribute is null, this index is not auto-populated. name readonly domstring the name of this index. storename readonly domstring this index's referenced object store. unique readonly boolean if true, a key can have only one value within the index; if false, a key can have duplicate values. methods add() stores the given value into th...
...f this attribute is null, this index is not auto-populated. name readonly domstring the name of this index. storename readonly domstring this index's referenced object store. unique readonly boolean if true, a key can have only one value within the index; if false, a key can have duplicate values. methods add() stores the given value into this index, optionally with the specified key. if a record already exists with the given key, an exception is raised. any add( in any value, in optional any key ) raises (idbdatabaseexception); parameters returns exceptions this method can raise a idbdatabaseexception with the following code: value the value to store into the index. key a key to use for identifying the record. any the key ...
...And 6 more matches
Using z-index - CSS: Cascading Style Sheets
the first part of this article, stacking without the z-index property, explains how stacking is arranged by default. if you want to create a custom stacking order, you can use the z-index property on a positioned element. the z-index property can be specified with an integer value (positive, zero, or negative), which represents the position of the element along the z-axis. if you are not familiar with the z-axis, imagine the page as a stack of layers, each one having a number. layers are rendered in numerical order, with larger numbers above smaller numbers. bottom layer (farthest from the observer) ... layer -3 layer -2 layer -1 layer 0 (default rendering layer) layer 1 layer 2 layer 3 ... ...
...is. if you are not familiar with the z-axis, imagine the page as a stack of layers, each one having a number. layers are rendered in numerical order, with larger numbers above smaller numbers. bottom layer (farthest from the observer) ... layer -3 layer -2 layer -1 layer 0 (default rendering layer) layer 1 layer 2 layer 3 ... ...
...in numerical order, with larger numbers above smaller numbers. bottom layer (farthest from the observer) ... layer -3 layer -2 layer -1 layer 0 (default rendering layer) layer 1 layer 2 layer 3 ... top layer (closest to the observer) notes: when no z-index property is specified, elements are rendered on the default rendering layer 0 (zero). if several elements share the same z-index value (i.e., they are placed on the same layer), stacking rules explained in the section stacking without the z-index property apply. in the following example, the layers' stacking order is rearranged using z-index. the z-index of element #5 has no effect since it is not a positioned element. source code for the example html <div id="abs1"> <b>div #1</b> <br />position: absolute; <b...
...And 6 more matches
HTMLOrForeignElement.tabIndex - Web APIs
the tabindex property of the htmlorforeignelement interface represents the tab order of the current element. tab order is as follows: elements with a positive tabindex. elements that have identical tabindex values should be navigated in the order they appear. navigation proceeds from the lowest tabindex to the highest tabindex. elements that do not support the tabindex attribute or support it and assign tabindex to 0, in the order they appear. elements that are disabled do not participate in the tabbing order. values don't need to be sequential, nor must they begin with any particular value. they may even be negative, though each browser trims very large values. ...
... 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. ...
...And 5 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
this glossary provides definitions of words and abbreviations you need to know to successfully understand and build for the web. 2 404 glossary, http errors, infrastructure, navigation a 404 is a standard response code meaning that the server cannot find the requested resource. ...
...les of copyleft licenses are the gnu gpl (for software) and the creative commons sa (share alike) licenses (for works of art). 93 crawler browser, crawler, glossary, infrastructure a web crawler is a program, often called a bot or robot, which systematically browses the web to collect data from webpages. typically search engines (e.g. google, bing, etc.) use crawlers to build indexes. 94 cross axis css, glossary, cross axis, flexbox the cross axis in flexbox runs perpendicular to the main axis, therefore if your flex-direction is either row or row-reverse then the cross axis runs down the columns. 95 cross-site scripting cross site scripting, dom, glossary, security, xss, exploit cross-site scripting (xss) is a security exploit whic...
... most common web app vulnerability in 2017. 96 cryptanalysis cryptography, glossary, privacy, security cryptanalysis is the branch of cryptography that studies how to break codes and cryptosystems. cryptanalysis creates techniques to break ciphers, in particular by methods more efficient than a brute-force search. in addition to traditional methods like frequency analysis and index of coincidence, cryptanalysis includes more recent methods, like linear cryptanalysis or differential cryptanalysis, that can break more advanced ciphers. 97 cryptographic hash function cryptography, glossary, security a cryptographic hash function, also sometimes called a digest function, is a cryptographic primitive transforming a message of arbitrary size into a message of...
...And 4 more matches
ContentIndex.add() - Web APIs
Web › API › ContentIndex › add
title: a string title for the item. used in user-visible lists of content. title: a string title of the item. used in user-visible lists of content. description: a string description of the item. 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. ...
...ror if the service worker's registration is not present or the service worker does not contain a fetchevent. if the id, title, description or url are missing, not of type string, or an empty string. if icons images are not of image type. examples here we're declaring an item in the correct format and creating an asynchronous function which uses the add method to register it with the content index. ...
...method to register it with the content index. ...
...And 4 more matches
IDBIndex.getAllKeys() - Web APIs
if this value is null or missing, the browser will use an unbound key range. count optional the number records to return. if this value exceeds the number of records in the query, the browser will only retrieve the first item. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. ...
... the query, the browser will only retrieve the first item. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. ...
...wer than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. invalidstateerror the idbindex has been deleted or removed. ...
...And 4 more matches
IDBIndex.locale - Web APIs
Web › API › IDBIndex › locale
the locale read-only property of the idbindex interface returns the locale of the index (for example en-us, or pl) if it had a locale value specified upon its creation (see createindex()'s optionalparameters.) note that this property always returns the current locale being used in this index, in other words, it never returns "auto". syntax var myindex = objectstore.index('index'); console.log(myindex.locale); value a domstring. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. ...
....) note that this property always returns the current locale being used in this index, in other words, it never returns "auto". syntax var myindex = objectstore.index('index'); console.log(myindex.locale); value a domstring. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the locale value is logged to the console. ...
...nd an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the locale value is logged to the console. ...
...And 4 more matches
tabindex - HTML: Hypertext Markup Language
it's mostly useful to create accessible widgets with javascript. ...
...ion (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. ...
...lly tabindex="-1") means that the element is not reachable via sequential keyboard navigation, but could be focused with javascript or visually by clicking with the mouse. it's mostly useful to create accessible widgets with javascript. a negative value is useful when you have off-screen content that appears on a specific event. the user won't be able to focus any element with a negative tabindex using the keyboard, but a script can do so by calling the focus() method. tabindex="0" means that the element should be focusable in sequential keyboard navigation, after any positive tabindex values and its order is defined by the document's source order. a positive value means the element should be focusable in sequential keyboard navigation, with its order defined by the value of the nu...
...And 4 more matches
HTMLIsIndexElement - Web APIs
methods no specific method; inherits methods from its parent, htmlelement. ...
... methods no specific method; inherits methods from its parent, htmlelement. ...
... methods no specific method; inherits methods from its parent, htmlelement. ...
...And 3 more matches
IDBIndex.isAutoLocale - Web APIs
the isautolocale read-only property of the idbindex interface returns a boolean indicating whether the index had a locale value of auto specified upon its creation (see createindex()'s optionalparameters.) syntax var myindex = objectstore.index('index'); console.log(myindex.isautolocale); value a boolean. example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. ...
...object store, then get the index lname from a simple contacts database. we then open a basic cursor on the index using idbindex.opencursor — this works the same as opening a cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the isautolocale value is logged to the console. ...
... cursor directly on an objectstore using idbobjectstore.opencursor except that the returned records are sorted based on the index, not the primary key. the isautolocale value is logged to the console. ...
...And 3 more matches
IDBObjectStore.indexNames - Web APIs
the indexnames read-only property of the idbobjectstore interface returns a list of the names of indexes on objects in this object store. note: this feature is available in web workers. syntax var myindexnames = objectstore.indexnames; value a domstringlist. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). after the object store has been created, we log objectstore.indexnames to the console. ...
...ndexnames; value a domstringlist. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). after the object store has been created, we log objectstore.indexnames to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = this.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into the idb ...
...ything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error. ...
...And 3 more matches
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. all lines must be terminated by a carriage return followed by a line feed. number codes 100 a human readable comment line. ...
...his data should be presented to the user when they are viewing data drawn from the file. 102 a human readable information line in html format. this data is intended for the end user of the file format data if there is one. this data should be presented to the user when they are viewing 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 multiple 200 lines override previous 200 lines. 201 data whose definition stems from a prior 200 line. a valid 201 line con...
...0 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. any illegal characters must be escaped via the url escaping syntax defined by rfc 1738. note that a 201 line encountered before a 200 line should be ignored. 300 a url pointing to the directory represented by the index if there is one. a valid path token must be url escaped. valid 200 tokens note that all tokens are case insensitive. filename the name of file that can be used to retrieve the file when combined with the full path provided by the 300 line. white space and 8 bit characters must be url encoded. content-length base 10 digits representing the size of the file in bytes. only digits are legal.
...And 2 more matches
Index - Learn web development
this set of articles aims to provide complete beginners to web development with all that they need to start coding websites. 2 accessibility aria, accessibility, articles, beginner, css, codingscripting, html, javascript, landing, learn, module learning some html, css, and javascript is useful if you want to become a web developer. ...
...tor a website consists mostly of text files, so for a fun, pleasant development experience you should choose your text editor wisely. 35 front-end web developer beginner, css, front-end, html, javascript, learn, tools, web standards welcome to our front-end web developer learning pathway! 36 getting started with the web beginner, css, design, guide, html, index, l10n:priority, publishing, theory it's a lot of work to create a professional website, so if you're new to web development, we encourage you to start small. you won't build another facebook right away, but it's not hard to get your own simple website online, so we'll start there. 37 css basics beginner, css, codingscripting, learn, styling, web, l10n:priority like html...
... paragraphs. 46 how to contribute to the learning area on mdn beginner, contribute, documentation, guide, learn, mdn meta, l10n:priority on this page, you'll find everything you need to start helping improve mdn's learning content. there are many things you can do, depending on how much time you have and whether you are a beginner, a web developer, or a teacher. 47 index index, learn, mdn meta found 348 pages: 48 javascript — dynamic client-side scripting beginner, codingscripting, javascript, javascripting beginner, landing, module, topic, l10n:priority javascript 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 f...
...And 2 more matches
Index
he interface that must be implemented by new filelink providers. 27 folder pane interfaces this page contains a list of the interfaces that you'll will most likely use when writing extensions that affect the folder pane. see working with the folder pane for examples and code snippets. 28 gloda thunderbird 3, thunderbird thunderbird includes a new message indexing and search system (gloda) that improves search performance, provides sophisticated full-text search capabilities and categorized search results. "gloda" is short for the thunderbird "global database". 29 gloda debugging the gloda code has log4moz logging statements spread throughout. the following preferences are supported to control how this gets logged: 30 ...
...hunderbird "global database". 29 gloda debugging the gloda code has log4moz logging statements spread throughout. the following preferences are supported to control how this gets logged: 30 gloda examples thunderbird 3, thunderbird this page provides some examples for using gloda. see creating a gloda message query for more examples. ...
...e gloda code has log4moz logging statements spread throughout. the following preferences are supported to control how this gets logged: 30 gloda examples thunderbird 3, thunderbird this page provides some examples for using gloda. see creating a gloda message query for more examples. ...
...And 2 more matches
ContentIndex.getAll() - Web APIs
return value returns a promise that resolves with an array of contentdescription items. contentdescription each item returned is an object containing the following data: id: a unique string identifier. title: a string title for the item. used in user-visible lists of content. title: a string title of the item. used in user-visible lists of content. description: a string description of the item. used in user-visible lists of content. ...
... default. homepage article video audio icons: optional an array of image resources, defined as an object with the following data: src: a url string of the source image. sizes: optional a string representation of the image size. type: optional the mime type of the image. exceptions no exceptions are thrown. ...
...the following data: src: a url string of the source image. sizes: optional a string representation of the image size. type: optional the mime type of the image. exceptions no exceptions are thrown. if there are no items in the content index, an empty array is returned. examples the below example shows an asynchronous function that retrieves items within the content index and iterates over each entry, building a list for the interface. ...
...And 2 more matches
HTMLTableRowElement.rowIndex - Web APIs
example this example uses javascript to label all the row numbers in a table. ...
... example this example uses javascript to label all the row numbers in a table. ...
... example this example uses javascript to label all the row numbers in a table. ...
...And 2 more matches
SourceBufferList: indexed property getter - Web APIs
example tbd. specifications specification status comment media source extensionsthe definition of 'sourcebuffer() getter' in that specification. ...
... example tbd. specifications specification status comment media source extensionsthe definition of 'sourcebuffer() getter' in that specification. ...
... example tbd. specifications specification status comment media source extensionsthe definition of 'sourcebuffer() getter' in that specification. ...
...And 2 more matches
z-index - CSS: Cascading Style Sheets
Web › CSS › z-index
the z-index css property sets the z-order of a positioned element and its descendants or flex items. overlapping elements with a larger z-index cover those with a smaller one. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. for a positioned box (that is, one with any position other than static), the z-index property specifies: the stack level of the box in the current stacking context. whether the box establishes a local stacking context. ...
...'d like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. for a positioned box (that is, one with any position other than static), the z-index property specifies: the stack level of the box in the current stacking context. whether the box establishes a local stacking context. syntax /* keyword value */ z-index: auto; /* <integer> values */ z-index: 0; z-index: 3; z-index: 289; z-index: -1; /* negative values to lower the priority */ /* global values */ z-index: inherit; z-index: initial; z-index: unset; the z-index property is specified as either the keyword auto or an <integer>. values auto the box does not establish a new local stacking context. the stack level of the generated box in the cu...
...uto or an <integer>. values auto the box does not establish a new local stacking context. the stack level of the generated box in the current stacking context is the same as its parent's box. <integer> this <integer> is the stack level of the generated box in the current stacking context. the box also establishes a local stacking context in which its stack level is 0. this means that the z-indexes of descendants are not compared to the z-indexes of elements outside this element. formal definition initial valueautoapplies topositioned elementsinheritednocomputed valueas specifiedanimation typean integercreates stacking contextyes formal syntax auto | <integer> examples visually layering elements html <div class="dashed-box">dashed box <span class="gold-box">gold box</span> <s...
...And 2 more matches
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
spelling errors. 30 style global attributes, html, reference the style global attribute contains css styling declarations to be applied to the element. note that it is recommended for styles to be defined in a separate file or files. this attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. 31 tabindex global attributes, html, reference the tabindex global attribute indicates that its element can be focused, and where it participates in sequential keyboard navigation (usually with the tab key, hence the name). 32 title global attributes, html, reference, title the title global attribute contains text representing advisory information related to the element it belo...
...he browser as to the type of information expected in the field. 52 disabled attribute, attributes, constraint validation, forms, required 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. 53 html documentation index html, index, mdn meta a comprehensive index list of all the available html documentation. 54 html elements reference basic, element, html, reference, web, l10n:priority this page lists all the html elements, which are created using tags. 55 <a>: the anchor element content, element, html, html text-level semantics, html:flow content, html:interactive c...
...t types, reference, week, weeks <input> elements of type week create input fields allowing easy entry of a year plus the iso 8601 week number during that year (i.e., week 1 to 52 or 53). 142 <ins> element, html, html edits, inserted text, insertion, reference, web, ins the html <ins> element represents a range of text that has been added to a document. 143 <isindex> deprecated, element, html, reference, web <isindex> was an obsolete html element that put a text field in a page for querying the document. 144 <kbd>: the keyboard input element displaying input, displaying keys, displaying keystrokes, displaying user input, element, html, html text-level semantics, keyboard input, keystroke, reference, web, keyboard, user input th...
...And 2 more matches
RegExpInstance.lastIndex - JavaScript
the lastindex is a read/write integer property of regular expression instances that specifies the index at which to start the next match. property attributes of regexpinstance.lastindex writable yes enumerable no configurable no description this property is set only if the regular expression instance used the g flag to indicate a global search, or the y flag to indicate a sticky search. the following rules apply: if lastindex is greater than the length of the string, test() and exec() fail, then lastindex is set to 0. ...
... yes enumerable no configurable no description this property is set only if the regular expression instance used the g flag to indicate a global search, or the y flag to indicate a sticky search. the following rules apply: if lastindex is greater than the length of the string, test() and exec() fail, then lastindex is set to 0. ...
...the g flag to indicate a global search, or the y flag to indicate a sticky search. the following rules apply: if lastindex is greater than the length of the string, test() and exec() fail, then lastindex is set to 0. if lastindex is equal to or less than the length of the string and if the regular expression matches the empty string, then the regular expression matches input starting from lastindex. if lastindex is equal to the length of the string and if the regular expression does not match the empty string, then the regular expression mismatches input, and lastindex is reset to 0. otherwise, lastindex is set to the next position following the most recent match. examples using lastindex consider the following sequence of statements: var re = /(hi)?/g; matches the empty string. c...
...And 2 more matches
TypedArray.prototype.lastIndexOf() - JavaScript
the lastindexof() method returns the last index at which a given element can be found in the typed array, or -1 if it is not present. the typed array is searched backwards, starting at fromindex. this method has the same algorithm as array.prototype.lastindexof(). typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.lastindexof(searchelement[, fromindex = typedarray.length]) parameters searchelement element to locate in the typed array. fromindex optional. the index at which to start searching backwards. defaults to the typed array's length, i.e. t...
...ject, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.lastindexof(searchelement[, fromindex = typedarray.length]) parameters searchelement element to locate in the typed array. fromindex optional. the index at which to start searching backwards. defaults to the typed array's length, i.e. the whole typed array will be searched. if the index is greater than or equal to the length of the typed array, the whole typed array will be searched. if negative, it is taken as the offset from the end of the typed array. note that even when the index is negative, the typed array is still searched from back to front. ...
...rching backwards. defaults to the typed array's length, i.e. the whole typed array will be searched. if the index is greater than or equal to the length of the typed array, the whole typed array will be searched. if negative, it is taken as the offset from the end of the typed array. note that even when the index is negative, the typed array is still searched from back to front. if the calculated index is less than 0, -1 is returned, i.e. the typed array will not be searched. return value the last index of the element in the array; -1 if not found. ...
...And 2 more matches
Using IndexedDB in chrome
the indexeddb api is typically used to store data in the user's browser from content javascript. (see using indexeddb for an overview.) however, the apis can also be accessed from system-privileged javascript using the components.utils.importglobalproperties() function: components.utils.importglobalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
... content javascript. (see using indexeddb for an overview.) however, the apis can also be accessed from system-privileged javascript using the components.utils.importglobalproperties() function: components.utils.importglobalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
...he components.utils.importglobalproperties() function: components.utils.importglobalproperties(["indexeddb"]); // from here on, it's like using indexeddb from content var req = indexeddb.open("my-database"); // ... ...
...y-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 principal = cc["@mozilla.org/systemprincipal;1"].createinstance(ci.nsiprincipal); var sandbox = components.utils.sandbox(principal, options); // the sandbox will have access to indexeddb var sandboxscript = 'var req = indexeddb.open("my-database");'; components.utils.evalinsandbox(sandboxscript, sandbox); before firefox 33, you would access indexeddb from chrome code using the initwindowless method of the nsiindexeddatabasemanager service. this method was removed in firefox 33. ...
IndexedDB - Firefox Developer Tools
when you select an origin inside the indexed db storage type in the storage tree of the storage inspector, a table lists the details of all the databases present for that origin. note: the data shown in an indexeddb database is a snapshot of the data as it was when you opened the storage inspector tool. databases have the following details: database name — the name of the database. storage — the storage type specified for the database. origin — the origin of the database. version — the database version. object stores — the number of object stores in the database. when an indexeddb database is selected in the storage tree, details about all the object stores are listed in the table. any object store has the following details: object store name — the name of the objec...
... stores — the number of object stores in the database. when an indexeddb database is selected in the storage tree, details about all the object stores are listed in the table. any object store has the following details: object store name — the name of the object store. key — the keypath property of the object store. auto increment — is automatic incrementation of the keys enabled? ...
...r of object stores in the database. when an indexeddb database is selected in the storage tree, details about all the object stores are listed in the table. any object store has the following details: object store name — the name of the object store. key — the keypath property of the object store. auto increment — is automatic incrementation of the keys enabled? ...
...object store. key — the keypath property of the object store. auto increment — is automatic incrementation of the keys enabled? ...
IDBIndex.getAll() - Web APIs
Web › API › IDBIndex › getAll
the getall() method of the idbindex interface retrieves all objects that are inside the index. there is a performance cost associated with looking at the value property of a cursor, because the object is created lazily. to use a feature like getall(), the browser has to create all the objects at once. if you are just interested in looking at each of the keys, for instance, it is more efficient to use a cursor. if you are trying to get an array of all the objects in an object store, though, you should use getall(). syntax var getallkeysrequest = idbindex.getall(); var getallkeysrequest = idbindex.getall(query); var getallkeysrequest = idbindex.getall(query, count); parameters query optional a key or an idbkeyrange identifying the records to retrieve. if this value is null or missing, ...
... the query, the browser will only retrieve the first item. if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. ...
...wer than 0 or greater than 232-1 a typeerror exception will be thrown. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. invalidstateerror the idbindex has been deleted or removed. ...
... operation are fired. exceptions this method may raise a domexception of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive. invalidstateerror the idbindex has been deleted or removed. a typeerror exception is thrown if the count parameter is not between 0 and 232-1 included. example var myindex = objectstore.index('index'); var getallrequest = myindex.getall(); getallrequest.onsuccess = function() { console.log(getallrequest.result); } specification specification status comment indexed database api draftthe definition of 'getall()' in that specification. recommendation initial definition. ...
color-index - CSS: Cascading Style Sheets
the color-index css media feature can be used to test the number of entries in the output device's color lookup table. syntax the color-index feature is specified as an <integer> value representing the number of entries in the output device's color lookup table. (this value is zero if the device does not use such a table.) it is a range feature, meaning that you can also use the prefixed min-color-index and max-color-index variants to query minimum and maximum values, respectively. ...
...epresenting the number of entries in the output device's color lookup table. (this value is zero if the device does not use such a table.) it is a range feature, meaning that you can also use the prefixed min-color-index and max-color-index variants to query minimum and maximum values, respectively. ...
... color lookup table. (this value is zero if the device does not use such a table.) it is a range feature, meaning that you can also use the prefixed min-color-index and max-color-index variants to query minimum and maximum values, respectively. examples basic example html <p>this is a test.</p> css p { color: black; } @media (color-index) { p { color: red; } } @media (min-color-index: 15000) { p { color: #1475ef; } } result custom stylesheet this html will apply a special stylesheet for devices that have at least 256 colors. ...
...l <p>this is a test.</p> css p { color: black; } @media (color-index) { p { color: red; } } @media (min-color-index: 15000) { p { color: #1475ef; } } result custom stylesheet this html will apply a special stylesheet for devices that have at least 256 colors. <link rel="stylesheet" href="http://foo.bar.com/base.css" /> <link rel="stylesheet" media="all and (min-color-index: 256)" href="http://foo.bar.com/color-stylesheet.css" /> specifications specification status comment media queries level 4the definition of 'color-index' in that specification. candidate recommendation the value can now be negative, in which case it computes to false. media queriesthe definition of 'color-index' in that specification. recommendation...
Understanding CSS z-index - CSS: Cascading Style Sheets
in css 2.1, each box has a position in three dimensions. ...
... when boxes overlap visually. (from css 2.1 section 9.9.1 - layered presentation) this means that css style rules allow you to position boxes on layers in addition to the normal rendering layer (layer 0). the z position of each layer is expressed as an integer representing the stacking order for rendering. greater numbers mean closer to the observer. z position can be controlled with the css z-index property. using z-index appears extremely easy: a single property, assigned a single integer number, with an easy-to-understand behaviour. however, when z-index is applied to complex hierarchies of html elements, its behaviour can be hard to understand or predict. this is due to complex stacking rules. in fact a dedicated section has been reserved in the css specification css-2.1 appendix e to e...
...r, when z-index is applied to complex hierarchies of html elements, its behaviour can be hard to understand or predict. this is due to complex stacking rules. in fact a dedicated section has been reserved in the css specification css-2.1 appendix e to explain these rules better. this article will try to explain those rules, with some simplification and several examples. stacking without the z-index property: the stacking rules that apply when z-index is not used. stacking with floated blocks: how floating elements are handled with stacking. using z-index: how to use z-index to change default stacking. the stacking context: notes on the stacking context. ...
...s, with some simplification and several examples. stacking without the z-index property: the stacking rules that apply when z-index is not used. stacking with floated blocks: how floating elements are handled with stacking. using z-index: how to use z-index to change default stacking. the stacking context: notes on the stacking context. stacking context example 1: 2-level html hierarchy, z-index on the last level stacking context example 2: 2-level html hierarchy, z-index on all levels stacking context example 3: 3-level html hierarchy, z-index on the second level original document information author(s): paolo lombardi this article is the english translation of an article i wrote in italian for yappy. i grant the right to share all the content under the creative commons: attribu...
TypedArray.prototype.indexOf() - JavaScript
the indexof() method returns the first index at which a given element can be found in the typed array, or -1 if it is not present. this method has the same algorithm as array.prototype.indexof(). typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.indexof(searchelement[, fromindex = 0]) parameters searchelement element to locate in the typed array. fromindex the index to start the search at. if the index is greater than or equal to the typed array's length, -1 is returned, which means the typed array will not be searched. ...
...lone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.indexof(searchelement[, fromindex = 0]) parameters searchelement element to locate in the typed array. fromindex the index to start the search at. if the index is greater than or equal to the typed array's length, -1 is returned, which means the typed array will not be searched. if the provided index value is a negative number, it is taken as the offset from the end of the typed array. note: if the provided index is negative, the typed array is still searched from front to back. if the calculated index is less than 0, then the whole typed array will be searched. default: 0 (entire typed array is searched). return value the first index of the element in the array; -1 if not found. descript...
...e is a negative number, it is taken as the offset from the end of the typed array. note: if the provided index is negative, the typed array is still searched from front to back. if the calculated index is less than 0, then the whole typed array will be searched. default: 0 (entire typed array is searched). return value the first index of the element in the array; -1 if not found. description indexof compares searchelement to elements of the typed array using strict equality (the same method used by the ===, or triple-equals, operator). ...
...ront to back. if the calculated index is less than 0, then the whole typed array will be searched. default: 0 (entire typed array is searched). return value the first index of the element in the array; -1 if not found. description indexof compares searchelement to elements of the typed array using strict equality (the same method used by the ===, or triple-equals, operator). examples using indexof var uint8 = new uint8array([2, 5, 9]); uint8.indexof(2); // 0 uint8.indexof(7); // -1 uint8.indexof(9, 2); // 2 uint8.indexof(2, -1); // -1 uint8.indexof(2, -3); // 0 specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.indexof' in that specification. ...
Index of archived content - Archive of obsolete content
ecycle sdk and xul comparison testing the add-on sdk two types of scripts working with events xul migration guide high-level apis addon-page base64 clipboard context-menu hotkeys indexed-db l10n notifications page-mod page-worker panel passwords private-browsing querystring request selection self simple-prefs simple-storage system tabs timers u...
... xulrunner 2.0 release notes xulrunner faq xulrunner hall of fame xulrunner tips xulrunner/old releases toolkit.defaultchromefeatures toolkit.defaultchromeuri toolkit.singletonwindowtype xulauncher ant script to assemble an extension application/http-index-format specification calicalendarview calicalendarviewcontroller califiletype mozilla.dev.platform faq reftest opportunities files symsrv_convert xbdesignmode.js archived open web documentation browser detection and cross browser support browser feature detectio...
... underscores in class and id names xml data xul user interfaces case sensitivity in class and id names creating a dynamic status bar extension creating a status bar extension element title gecko compatibility handbook getting the page url in npapi plugin index index of archived content inner-browsing extending the browser navigation paradigm install.js jxon list of former mozilla-based applications list of mozilla-based applications localizing an extension mmgc makefile - .mk files misc top level bypassing security restrictions and signing code...
getBrowserAtIndex - Archive of obsolete content
...
... ...
... ...
getItemAtIndex - Archive of obsolete content
...
... ...
... ...
currentIndex - Archive of obsolete content
for trees with focus, the caret's position is indicated by the focus ring, but unfocused trees won't show a focus ring, naturally. for unfocused trees, the (undrawn) caret's position can still be obtained by this property. if the caret isn't present for any row (for example, because the tree has never been focused), the value will be -1. you cannot rely on this property to change or determine a tree selection, except for trees with seltype="single". ...
....) 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. ...
... </treecols> <treechildren> <treeitem> <treerow> <treecell label="joe@somewhere.com"/> <treecell label="top secret plans"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="mel@whereever.com"/> <treecell label="let's do lunch"/> </treerow> </treeitem> </treechildren> </tree> see also listbox.currentindex ...
selectedIndex - Archive of obsolete content
by assigning -1 to this property, all items will be deselected. ...
...by assigning -1 to this property, all items will be deselected. ...
...by assigning -1 to this property, all items will be deselected. ...
IndexedDB - MDN Web Docs Glossary: Definitions of Web-related terms
indexeddb is a web api for storing large data structures within browsers and indexing them for high-performance searching. like an sql-based rdbms, indexeddb is a transactional database system. however, it uses javascript objects rather than fixed columns tables to store data. ...
... indexeddb is a web api for storing large data structures within browsers and indexing them for high-performance searching. like an sql-based rdbms, indexeddb is a transactional database system. however, it uses javascript objects rather than fixed columns tables to store data. ...
... indexeddb is a web api for storing large data structures within browsers and indexing them for high-performance searching. like an sql-based rdbms, indexeddb is a transactional database system. however, it uses javascript objects rather than fixed columns tables to store data. ...
nsIDirIndex
netwerk/streamconv/public/nsidirindex.idlscriptable a class holding information about a directory index. because this has no reference back to their original source, changing these attributes won't affect the directory. inherits from: nsisupports last changed in gecko 1.7 attributes attribute type description contenttype string the content type; may be null if it is unknown. unspecified for directories. description wstring a description for the filename, which should be displayed by a viewer. lastmodified prtime last-modified time in seconds-since-epoch. if the last modified time is unknown, this value is -1. location string the fully qualified filename, expressed as a uri. this is encoded with the encoding specified in the nsidirindexparser, and is also escaped. si...
...ile size; if the size is unknown, this value is -1. ...
...e is unknown, this value is -1. ...
Index - Firefox Developer Tools
eyedropper firefox, tools, web development:tools the eyedropper tool enables you to select colors in the current page. it works like a magnifying glass over the page, enabling you to select with pixel precision. underneath the magnifying glass it shows the color value for the current pixel using whichever scheme you've selected in settings > inspector > default color unit: 34 index tools found 158 pages: 35 json viewer firefox includes a json viewer. if you open a json file in the browser, or view a remote url with the content-type set to application/json, it is parsed and given syntax highlighting. arrays and objects are shown collapsed, and you can expand them using the "+" icons. 36 measure a portion of the page design, devt...
... settings beginning with firefox 62, the icon to open developer tools settings has been moved into a menu accessed by clicking/touching ... (the elipsis) on the right of the tab. 104 shader editor the shader editor enables you to see and edit the vertex and fragment shaders used by webgl. 105 storage inspector cookies, dev tools, firefox, guide, indexeddb, local storage, session storage, storage, tools the storage inspector enables you to inspect various types of storage that a web page can use. currently it can be used to inspect the following storage types: 106 cache storage cache storage, devtools, firefox, guide, storage, storage inspector, tools, l10n:priority under the cache storage type within the storage insp...
... extension storage dev tools, extension storage, firefox, guide, storage, storage inspector, tools, l10n:priority this storage type is only shown when debugging extensions. when selecting an extension id in the storage tree of the storage inspector, a table lists the details of all the extension storage present for the extension. this table contains the following columns: 109 indexeddb dev tools, firefox, guide, indexeddb, storage, storage inspector, tools, l10n:priority when you select an origin inside the indexed db storage type in the storage tree of the storage inspector, a table lists the details of all the databases present for that origin. 110 local storage / session storage dev tools, firefox, guide, local storage, session storage, storage, ...
ContentIndexEvent - Web APIs
the contentindexevent interface of the content index api defines the object used to represent the contentdelete event. this event is sent to the global scope of a serviceworker. it contains the id of the indexed content to be removed. the contentdelete event is only fired when the deletion happens due to interaction with the browser's built-in user interface. it is not fired when the contentindex.delete method is called. constructor contentindexevent() creates and returns a new contentindexevent object whose type and other options are configured as specified. properties in addition to the properties listed below, this interface inherits the properties of its parent interface, extendableevent. ...
...when the contentindex.delete method is called. constructor contentindexevent() creates and returns a new contentindexevent object whose type and other options are configured as specified. properties in addition to the properties listed below, this interface inherits the properties of its parent interface, extendableevent. id read only a string which identifies the deleted content index via it's id. methods while contentindexevent offers no methods of its own, it inherits any specified by its parent interface, extendableevent. examples this example shows the sevice worker script listening for the contentdelete event and logs the removed content index id. ...
...deleted content index via it's id. methods while contentindexevent offers no methods of its own, it inherits any specified by its parent interface, extendableevent. examples this example shows the sevice worker script listening for the contentdelete event and logs the removed content index id. self.addeventlistener('contentdelete', (event) => { console.log(event.id); // logs content index id, which can then be used to determine what content to delete from your cache }); specifications specification status comment unknownthe definition of 'contentindexevent' in that specification. unknown initial definition. ...
MathML documentation index - MathML
Web › MathML › Index
this is an alphabetical list of mathml attributes. more details for each attribute are available on particular element pages. 7 values guide, mathml, mathml reference several mathml presentation elements have attributes that accept length values used for size or spacing. mathml accepts different units and constants for specifying lengths. 8 mathml documentation index index, mathml found 40 pages: 9 mathml element reference mathml, mathml reference this is an alphabetical list of mathml presentation elements. 10 <maction> mathml, mathml reference, mathml:element, mathml:enlivening expressions the following example uses the "toggle" actiontype: 11 <math> mathml, mathml reference, mathml:element ...
... <mphantom> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mphantom> element is rendered invisibly, but dimensions (such as height, width, and baseline position) are still kept. 25 <mroot> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mroot> element is used to display roots with an explicit index. two arguments are accepted, which leads to the syntax: <mroot> base index </mroot>. 26 <mrow> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mrow> element is used to group sub-expressions, which usually contain one or more operators with their respective operands (such as <mi> and <mn>). this element renders as a horizontal row containin...
...<mglyph> and <malignmark> elements. 28 <mspace> mathml, mathml reference, mathml:element, mathml:token elements the mathml <mspace> element is used to display a blank space, whose size is set by its attributes. 29 <msqrt> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <msqrt> element is used to display square roots (no index is displayed). the square root accepts only one argument, which leads to the following syntax: <msqrt> base </msqrt>. 30 <mstyle> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mstyle> element is used change the style of its children. it accepts all attributes of all mathml presentation elements with some exceptions and additional attribu...
completeDefaultIndex - Archive of obsolete content
...
... ...
pageIndex - Archive of obsolete content
you can change the selected page by modifying this property. ...
...you can change the selected page by modifying this property. ...
tabIndex - Archive of obsolete content
...
... ...
IndexInParent
« nsiaccessible page summary the 0-based index of this accessible in its parent's list of children, or -1 if this accessible does not have a parent. ...
... « nsiaccessible page summary the 0-based index of this accessible in its parent's list of children, or -1 if this accessible does not have a parent. ...
ContentIndex.delete() - Web APIs
the delete() method of the contentindex interface unregisters an item from the currently indexed content. calling delete() only affects the index. it does not delete anything from the cache. syntax contentindex.delete(id).then(...); parameters this method receives no parameters. return value returns a promise that resolves with undefined exceptions no exceptions are thrown. examples below is an asynchronous function, that removes an item from the content index. we receive a reference to the current serviceworkerregistration, which allows us to access the index property and thus access the delete method. ...
... examples below is an asynchronous function, that removes an item from the content index. we receive a reference to the current serviceworkerregistration, which allows us to access the index property and thus access the delete method. async function unregistercontent(article) { // reference registration const registration = await navigator.serviceworker.ready; // feature detect content index if (!registration.index) return; // unregister content from index await registration.index.delete(article.id); } the delete method can also be used within the service worker scope. self.registration.index.delete('my-id'); specifications specification status comment unknownthe definition of 'delete' in that specification. unknown initial definition. ...
ContentIndexEvent() - Web APIs
the contentindexevent() constructor creates a new contentindexevent object whose type and other options are configured as specified. syntax var contentindexevent = new contentindexevent(type, contentindexeventinit); parameters type a domstring indicating the event which occurred. for contentindexevent, this is always delete. eventinitdict optional an options object containing any initialization data you want to populate the contentindexevent object with. the options are: id: the id of the indexed content you want the contentindexevent to remove. return value a contentindexevent object configured using the given inputs. examples this examples constructs a new contentindexevent with the relevant id. var removedata = { id : 'unique-content-id' } var cievent = n...
...on data you want to populate the contentindexevent object with. the options are: id: the id of the indexed content you want the contentindexevent to remove. return value a contentindexevent object configured using the given inputs. examples this examples constructs a new contentindexevent with the relevant id. var removedata = { id : 'unique-content-id' } var cievent = new contentindexevent('contentdelete', removedata); cievent.id; // should return 'unique-content-id' specifications specification status comment unknownthe definition of 'contentindexevent' in that specification. unknown initial definition. ...
OES_element_index_uint - Web APIs
the oes_element_index_uint extension is part of the webgl api and adds support for gl.unsigned_int types to webglrenderingcontext.drawelements(). 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. extended methods this extension extends webglrenderingcontext.drawelements(): the type parameter now accepts gl.unsigned_int. ...
...ion, 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. extended methods this extension extends webglrenderingcontext.drawelements(): the type parameter now accepts gl.unsigned_int. examples var ext = gl.getextension('oes_element_index_uint'); gl.drawelements(gl.points, 8, gl.unsigned_int, 0); specifications specification status comment oes_element_index_uintthe definition of 'oes_element_index_uint' in that specification. recommendation initial definition. ...
RTCIceCandidate.sdpMLineIndex - Web APIs
the read-only sdpmlineindex property on the rtcicecandidate interface is a zero-based index of the m-line describing the media associated with the candidate. this value is specified when creating the rtcicecandidate by setting the corresponding sdpmlineindex value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate(). if you instead call rtcicecandidate() with a string parameter containing the candidate m-line text, the value of sdpmlineindex is extracted from the m-line. syntax var sdpmlineindex = rtcicecandidate.sdpmlineindex; value a number containing a 0-based index into the set of m-lines providing media descriptions, indicating which media source is associated with the candidate, or null if no such association is available. note: attempting to...
...om the m-line. syntax var sdpmlineindex = rtcicecandidate.sdpmlineindex; value a number containing a 0-based index into the set of m-lines providing media descriptions, indicating which media source is associated with the candidate, or null if no such association is available. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.sdpmlineindex' in that specification. candidate recommendation initial definition. ...
ServiceWorkerRegistration.index - Web APIs
the index read-only property of the serviceworkerregistration interface returns a reference to the contentindex interface, which allows for indexing of offline content. syntax var a contentindex object = serviceworkerregistration.index; value a contentindex object examples you can access the property from either your main script or the registered service worker. ...
...ich allows for indexing of offline content. syntax var a contentindex object = serviceworkerregistration.index; value a contentindex object examples you can access the property from either your main script or the registered service worker. here is an example from the main script: // reference registration const registration = await navigator.serviceworker.ready; // feature detection if ('index' in registration) { // content index api functionality const contentindex = registration.index; } from the service worker: // service worker script const contentindex = self.registration.index; specifications specification status comment unknownthe definition of 'index' in that specification. unknown initial definition. ...
WebGL2RenderingContext.getIndexedParameter() - Web APIs
the webgl2renderingcontext.getindexedparameter() method of the webgl 2 api returns indexed information about a given target. syntax any gl.getindexedparameter(target, index); parameters target a glenum specifying the target for which to return information. possible values: gl.transform_feedback_buffer_binding: returns a webglbuffer. gl.transform_feedback_buffer_size: returns a glsizeiptr. gl.transform_feedback_buffer_start: returns a glintptr. gl.uniform_buffer_binding: returns a webglbuffer. gl.uniform_buffer_size: returns a glsizeiptr. gl.uniform_buffer_start: returns a glintptr. index a gluint specifying the index of the target that is queried. return value depends on the requested information (as specified with target). examples var binding = gl.ge...
...sizeiptr. gl.transform_feedback_buffer_start: returns a glintptr. gl.uniform_buffer_binding: returns a webglbuffer. gl.uniform_buffer_size: returns a glsizeiptr. gl.uniform_buffer_start: returns a glintptr. index a gluint specifying the index of the target that is queried. return value depends on the requested information (as specified with target). examples var binding = gl.getindexedparameter(gl.transform_feedback_buffer_binding, 0); specifications specification status comment webgl 2.0the definition of 'getindexedparameter' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glget' in that specification. standard man page of the (similar) opengl api. ...
WebGL2RenderingContext.getUniformBlockIndex() - Web APIs
the webgl2renderingcontext.getuniformblockindex() method of the webgl 2 api retrieves the index of a uniform block within a webglprogram. syntax gluint gl.getuniformblockindex(program, uniformblockname); parameters program a webglprogram containing the uniform block. uniformname a domstring specifying the name of the uniform block to whose index to retrieve. return value a gluint indicating the uniform block index. ...
... parameters program a webglprogram containing the uniform block. uniformname a domstring specifying the name of the uniform block to whose index to retrieve. return value a gluint indicating the uniform block index. examples // assuming a shader with the following declaration: // uniform ubodata { // mat4 foo; // } instancename; // use the block name, not the instance name: var blockindex = gl.getuniformblockindex(program, 'ubodata'); specifications specification status comment webgl 2.0the definition of 'getuniformblockindex' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glgetuniformblockindex' in that specification. standard man page of the (similar) opengl api. ...
WindowOrWorkerGlobalScope.indexedDB - Web APIs
the indexeddb read-only property of the windoworworkerglobalscope mixin provides a mechanism for applications to asynchronously access the capabilities of indexed databases. syntax var idbfactory = self.indexeddb; value an idbfactory object. example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open('todolist'); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; } } specifications specification status comment indexed database api draftthe definition of 'indexeddb' in that specification. recommendation defined in a windoworworkerglobalscope partial in the n...
...; function opendb() { var dbopenrequest = window.indexeddb.open('todolist'); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; } } specifications specification status comment indexed database api draftthe definition of 'indexeddb' in that specification. recommendation defined in a windoworworkerglobalscope partial in the newest spec. indexed database api 2.0the definition of 'indexeddb' in that specification. recommendation initial definition. ...
Index - Event reference
Web › Events › Index
sent to notify code of interesting things that have taken place. ...
...otify code of interesting things that have taken place. ...
HTTP Index - HTTP
Web › HTTP › Index
r feature policy allows you to control which origins can use which features, both in the top-level page and in embedded frames. essentially, you write a policy, which is an allowed list of origins for each feature. for every feature controlled by feature policy, the feature is only enabled in the current document or frame if its origin matches the allowed list of origins. 39 http index http, index this page lists all mdn http pages along with their summary and tags. 40 http messages guide, http, webmechanics http messages are how data is exchanged between a server and a client. there are two types of messages: requests sent by the client to trigger an action on the server, and responses, the answer from the server. 41 http public key pi...
...ce, request header the if-unmodified-since request http header makes the request conditional: the server will send back the requested resource, or accept it in the case of a post or another non-safe method, only if it has not been last modified after the given date. if the resource has been modified after the given date, the response will be a 412 (precondition failed) error. 161 index http, http header, index found 122 pages: 162 keep-alive general header, http, http header, reference the keep-alive general header allows the sender to hint about how the connection may be used to set a timeout and a maximum amount of requests. 163 large-allocation http, http header, non-standard, reference, response header, header the non-stan...
tabindex - SVG: Scalable Vector Graphics
the tabindex attribute allows you to control whether an element is focusable and to define the relative order of the element for the purposes of sequential focus navigation. all elements are using this attribute. html, body, svg { height: 100%; } <?xml version="1.0"?> <svg viewbox="0 0 260 260" xmlns="http://www.w3.org/2000/svg"> <circle cx="60" cy="60" r="15" tabindex="1" /> <circle cx="60" cy="160" r="30" tabindex="3" /> <circle cx="160" cy="60" r="30" tabindex="2" /> <circle cx="160" cy="160" r="60" tabindex="4" /> </svg> usage notes value valid integer default value none animatable no valid integer relative order of the element for the purposes of sequential focus navigation. specifications specificatio...
...> <circle cx="160" cy="160" r="60" tabindex="4" /> </svg> usage notes value valid integer default value none animatable no valid integer relative order of the element for the purposes of sequential focus navigation. specifications specification status comment scalable vector graphics (svg) 2the definition of 'tabindex' in that specification. candidate recommendation initial definition ...
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
211 surfacescale filters, needscompattable, svg, svg attribute the surfacescale attribute represents the height of the surface for a light filter primitive. 212 systemlanguage svg, svg attribute the systemlanguage attribute represents a list of supported language tags. this list is matched against the language defined in the user preferences. 213 tabindex svg, svg attribute the tabindex attribute allows you to control whether an element is focusable and to define the relative order of the element for the purposes of sequential focus navigation. 214 tablevalues svg, svg attribute the tablevalues attribute defines a list of numbers defining a lookup table of values for a for a color component transfer function. ...
...h smil animation, firefox 4, gecko 2.0, svg, svg animation firefox 4 introduced support for animating svg using synchronized multimedia integration language (smil). smil allows you to: 291 svg as an image images, needscontent, svg svg images can be used as an image format, in a number of contexts. many browsers support svg images in: 292 svg documentation index svg found 383 pages: 293 svg element reference drawing, elements, responsive design, svg, svg reference, vector graphics, l10n:priority 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. ...
XML Index - XML: Extensible Markup Language
Web › XML › Index
it stands for extensible markup language and is a w3c recommended specification as a general purpose markup language. ...
...it stands for extensible markup language and is a w3c recommended specification as a general purpose markup language. ...
Index - WebAssembly
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 javascript, allowing both to work together. 2 caching compiled webassembly modules caching, indexeddb, javascript, 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, emscripten, webassembly, was...
...and how to use available tools to covert text format files to the .wasm assembly format. 7 exported webassembly functions guide, javascript, webassembly, export, exported functions, exported wasm functions, wasm exported webassembly functions are how webassembly functions are represented in javascript. this article describes what they are in a little more detail. 8 index index, webassembly found 12 pages: 9 loading and running webassembly code fetch, javascript, webassembly, xmlhttprequest, bytecode to use webassembly in javascript, 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 ...
completedefaultindex - Archive of obsolete content
« xul reference home completedefaultindex new in thunderbird 3 requires seamonkey 2.0 type: boolean if true, the best match value will be filled into the textbox as the user types. if set to false or omitted, the value must be selected from the list. ...
completeselectedindex - Archive of obsolete content
...
customindex - Archive of obsolete content
« xul reference home customindex not in seamonkey 1.x type: integer this value is the index of the toolbar in the list of the custom toolbars. the value is updated automatically by the toolbar customization dialog. ...
index - Archive of obsolete content
« xul reference home index type: integer the index within the sql statement of the parameter. ...
selectedIndex - Archive of obsolete content
« xul reference home selectedindex type: integer gets and sets the index of the currently selected panel. the first item is at index 0. ...
tabindex - Archive of obsolete content
« xul reference home 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. ...
ensureIndexIsVisible - Archive of obsolete content
« xul reference home ensureindexisvisible( index ) return type: no return value if the item at the specified index is not currently visible to the user the displayed items are scrolled so that it is. if the item is already visible, no scrolling occurs. ...
getBrowserIndexForDocument - Archive of obsolete content
« xul reference home getbrowserindexfordocument( document ) return type: integer returns the index of the browser for the specified document in the tabbrowser the method was invoked on. the returned index is dependent on the tabs in the tabbrowser and is invalidated when the tab ordering changes. it should not be used to track per-tab data during a session; the use of linkedpanel on the corresponding tab is preferred instead. ...
getIndexOfFirstVisibleRow - Archive of obsolete content
« xul reference home getindexoffirstvisiblerow() return type: integer returns the index of the first displayed row. note that this is not the same as the first row -- if the displayed items have been scrolled down, this function will retrieve the index of the first row that the user can see. ...
getIndexOfItem - Archive of obsolete content
« xul reference home getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. ...
gotoIndex - Archive of obsolete content
« xul reference home gotoindex( index ) return type: no return value navigate to the page in the history with the given index. use a positive number to go forward and a negative number to go back. ...
scrollByIndex - Archive of obsolete content
a line is a single element. ...
scrollToIndex - Archive of obsolete content
« xul reference home scrolltoindex( index ) return type: no return value scrolls the element to the specified index. this is different than ensureindexisvisible because the view is always scrolled. ...
selectTabAtIndex - Archive of obsolete content
« xul reference home selecttabatindex( index, event ) return type: no return value selects the tab at the given index. index values may be positive or negative. if the event argument is supplied, the default event handling will be prevented and propagation stopped. ...
listbox.currentIndex - Archive of obsolete content
« xul reference currentindex type: integer set to the index of the currently focused item in the list. if no item is focused, the value will be -1. (or, on some platforms, typeof(listboxcurrentindex) will be undefined) in a single selection list, the current index will always be the same as the selected index. in a multiple selection list, the currently focused row may be modified by the user without changing the selection by pressing the control key and pressing the cursor keys to navigate. ...
Index - Game development
r 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 javascript, 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 firefox os, games, guide, mobile no summary!
Speed index - MDN Web Docs Glossary: Definitions of Web-related terms
it is the average time at which visible parts of the page are displayed. expressed in milliseconds, and dependent on the size of the viewport, the lower the score, the better. the calculation calculates what percent of the page is visually complete at every 100ms interval until the page is visually complete. ...
Index
age, 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 descriptions, 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, signing add-ons need to be signed before they can be installed into release and beta versions of firefox. this signing process takes place through addons.mozilla.org (amo), whether you choose to distribute ...
Index
l as potentially some sites that have been pinned to always appear in that space. 11 firefox and the "about" protocol firefox, guide, mozilla, protocols there is a lot of useful information about firefox hidden away behind the about: url protocol. the most useful is the url about:config, which displays preferences and settings that can be inspected and changed. 141 index firefox, index, mozilla found 168 pages: 142 linux compatibility matrix the following table lists the available library versions for the mozilla.org-distributed firefox builds dependencies, and/or to build firefox. 143 multiple firefox profiles beginner, firefox, guide, intro, profiles, qa a profile in firefox is the collection of settings, cus...
Index
3 bootstrapping a new locale localization, mercurial, translate, bit bucket (see also https://developer.mozilla.org/en/create_a_new_localization) 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 script 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 xcod...
Index
found 1 pages: # page tags and summary 1 index found 1 pages: ...
Index
15 http delegation advanced, guide, nss up to version 3.11, nss connects directly over http to an ocsp responder to make the request and fetch the response. it does so in a blocking fashion, and also directly to the responder, ignoring any proxy the application may wish to use. this causes ocsp requests to fail if the network environment requires the use of a proxy. 16 index found 353 pages: 17 introduction to network security services introduction, mozilla, nss network security services (nss) is a set of libraries designed to support cross-platform development of communications applications that support ssl, s/mime, and other internet security standards. for a general overview of nss and the standards it supports, see overview of nss.
GetLinkIndex
...
nsIDirIndexListener
netwerk/streamconv/public/nsidirindexlistener.idlscriptable this interface is used to receive contents of directory index listings from a protocol. they can then be transformed into an output format (such as rdf, html and so on) inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void onindexavailable(in nsirequest arequest, in nsisupports actxt, in nsidirindex aindex); void oninformationavailable(in nsirequest arequest, in nsisupports actxt, in astring ainfo); methods onindexavailable() called for each directory entry. void onindexavailable( in nsirequest arequest, in nsisupports actxt, in nsidirindex aindex ); parameters arequest the request. actxt opaque parameter aindex new index to add. oninfo...
nsIDirIndexParser
netwerk/streamconv/public/nsidirindexlistener.idlscriptable a parser for 'application/http-index-format' directories. inherits from: nsistreamlistener last changed in gecko 1.7 called for each directory entry. attributes attribute type description comment string the comment given, if any. this result is only valid after onstoprequest has occurred, because it can occur anywhere in the datastream. read only. encoding string the encoding to use. listener nsidirindexlistener the interface to use as a callback for new entries. ...
ContentIndexEvent.id - Web APIs
the read-only id property of the contentindexevent interface is a string which identifies the deleted content index via it's id. syntax var id = contentindexevent.id; value a string representation of the deleted content index id. examples this example listens for the contentdelete event and logs the removed content index id. the contentindexevent is only available to the {domxref('serviceworkerglobalscope','global scope')}} of a serviceworker. self.addeventlistener('contentdelete', (event) => { console.log(event.id); // logs content index id, which can then be used to determine what content to delete from your cache }); specifications specification status comment unknownthe definition of 'id' in that specification. unknown initial defini...
Gamepad.index - Web APIs
Web › API › Gamepad › index
the gamepad.index property of the gamepad interface returns an integer that is auto-incremented to be unique for each device currently connected to the system. this can be used to distinguish multiple controllers; a gamepad that is disconnected and reconnected will retain the same index. syntax readonly attribute long index; example window.addeventlistener("gamepadconnected", function() { var gp = navigator.getgamepads()[0]; gamepadinfo.innerhtml = "gamepad connected at index " + gp.index + ": " + gp.id + "."; }); value a number. specifications specification status comment gamepadthe definition of 'gamepad.index' in that specification. working draft initial definition ...
RTCIceCandidateInit.sdpMLineIndex - Web APIs
the optional property sdpmlineindex in the rtcicecandidateinit dictionary specifies the value of the rtcicecandidate object's sdpmlineindex property. value a number containing a 0-based index into the set of m-lines providing media descriptions, indicating which media source is associated with the candidate, or null if no such association is available. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit.sdpmlineindex' in that specification. candidate recommendation initial specification. ...
SpeechRecognitionEvent.resultIndex - Web APIs
the resultindex read-only property of the speechrecognitionevent interface returns the lowest index value result in the speechrecognitionresultlist "array" that has actually changed. the speechrecognitionresultlist object is not an array, but it has a getter that allows it to be accessed by array syntax. syntax var myresultindex = event.resultindex; value a number. examples recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.resultindex); // returns 0 if there is only one result } specifications specification status comment web speech apithe definition of 'resultindex' in that specification. draft...
SpeechSynthesisEvent.charIndex - Web APIs
the charindex read-only property of the speechsynthesisutterance interface returns the index position of the character in the speechsynthesisutterance.text that was being spoken when the event was triggered. syntax event.charindex; value a number. examples utterthis.onpause = function(event) { var char = event.utterance.text.charat(event.charindex); console.log('speech paused at character ' + event.charindex + ' of "' + event.utterance.text + '", which is "' + char + '".'); } specifications specification status comment web speech apithe definition of 'charindex' in that specification. draft ...
VideoTrackList.selectedIndex - Web APIs
the read-only videotracklist property selectedindex returns the index of the currently selected track, if any, or -1 otherwise. syntax var index = videotracklist.selectedindex; value a number indicating the index of the currently selected track, if any, or -1 otherwise. specifications specification status comment html living standardthe definition of 'videotracklist: selectedindex' in that specification. living standard ...
Accessibility documentation index - Accessibility
html. 83 accessibility and spacial patterns accessibility, braille, patterns, photosensitive seizures nasa conducted research on the perception of color, and found that luminance contrast mattered greatly as to how they were perceived. the two images below are from nasa research, specifically, from the article, "designing with blue" 84 accessibility documentation index accessibility, index this document provides a list of links to all accessibility articles on the mozilla developer network. 85 accessibility: what users can do to browse more safely color, epilepsy, photosensitivity, prefers-reduced-motion, reflex epilepsy, saturation, seizure disorders, seizures, user settings, web animation this article discusses making web conten...
Stacking without the z-index property - CSS: Cascading Style Sheets
in the example below, elements #1 through #4 are positioned elements. element #5 is static, and so is drawn below the other four elements, even though it comes later in the html markup. ...
Index - Developer guides
Web › Guide › Index
28 guide to web apis api, guide, landing, web the web includes a wide array of apis that can be used from javascript to build increasingly more powerful and capable applications, running either on the web, locally, or through technology such as node.js, on a server. on this page you'll find a complete list of all of the apis provided by the full web technology stack. 29 index guide, index found 31 pages: 30 introduction to web development beginner, css, codingscripting, development, html, javascript, web whether you're just getting started with web development, or are just expanding your horizons into new realms of web awesomeness, the links here should help you get started. 31 localizations and character encodings charact...
Index - HTTP
Web › HTTP › Headers › Index
nce, request header the if-unmodified-since request http header makes the request conditional: the server will send back the requested resource, or accept it in the case of a post or another non-safe method, only if it has not been last modified after the given date. if the resource has been modified after the given date, the response will be a 412 (precondition failed) error. 82 index http, http header, index found 115 pages: 83 keep-alive general header, http, http header, reference the keep-alive general header allows the sender to hint about how the connection may be used to set a timeout and a maximum amount of requests. 84 large-allocation http, http header, non-standard, reference, response header, header the non-standa...
Index - XPath
Web › XPath › Index
cters to translate and returns the translated string. 53 true xslt, xslt_reference the true function returns a boolean value of true. 54 unparsed-entity-url xslt, xslt_reference the unparsed-entity-url() function returns the uri of the unparsed entity with the given name. this is non-xml data referenced in the dtd of the source document. 55 index index, reference, xpath, xslt found 57 pages: 56 introduction to using xpath in javascript add-ons, dom, extensions, javascript, transforming_xml_with_xslt, web development, xml, xpath, xslt this document describes the interface for using xpath in javascript internally, in extensions, and from websites. mozilla implements a fair amount of the dom 3 xpath, which mean...
Index - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Index
junction with specialized processing software, for the transformation of xml documents. 2 common xslt errors xslt your 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. 3 index index, reference, xslt found 54 pages: 4 pi parameters xslt no summary! 5 the xslt/javascript 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 multiple times, alternating between ascending and descending order. ...
Bytecode Descriptions
l push the uint16_t immediate operand as an int32value. 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 script->getbigint(bigintindex). string operands: (uint32_t atomindex) stack: ⇒ string push the string constant script->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 operat...
...ns topropertykey stack: propertynamevalue ⇒ propertykey convert a value to a property key. implements: topropertykey, except that if the result would be the string representation of some integer in the range 0..2^31, we push the corresponding int32 value instead. this is because the spec insists that array indices are strings, whereas for us they are integers. this is used for code like ++obj[index], which must do both a jsop::getelem and a jsop::setelem with the same property key. both instructions would convert index to a property key for us, but the spec says to convert it only once. the conversion can call .tostring()/.valueof() methods and can throw. format: jof_ic tonumeric, tostring stack: val ⇒ tonumeric(val) convert a value to a numeric value (a number or bigint). implements: ...
...promise dynamic import of the module specified by the string value on the top of the stack. implements: import calls. importmeta stack: ⇒ import.meta push the import.meta object. this must be used only in module code. objects creating objects newinit stack: ⇒ obj create and push a new object with no properties. format: jof_ic newobject, newobjectwithgroup operands: (uint32_t baseobjindex) stack: ⇒ obj create and push a new object of a predetermined shape. the new object has the shape of the template object script->getobject(baseobjindex). subsequent initprop instructions must fill in all slots of the new object before it is used in any other way. for jsop::newobject, the new object has a group based on the allocation site (or a new group if the template's group is a singleton).
...And 61 more matches
IAccessibleTable
other-licenses/ia2/accessibletable.idlnot scriptable this interface gives access to a two-dimensional table. 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. when the table cells are not direct children of a table, the object representing the cell can define a "table-cell-index" object attribute identifying the 0 based table cell index. this object attribute is obtained by parsing the att...
...the range of valid coordinates for this interface are implementation dependent. ...
... that kind of implementation will not be possible. when the table cells are not direct children of a table, the object representing the cell can define a "table-cell-index" object attribute identifying the 0 based table cell index. this object attribute is obtained by parsing the attribute string returned by iaccessible2.attributes(). the "table-cell-index" attribute can be used just like a child index of the typical case. ats should first test for the presence of the "table-cell-index" attribute and if it is not present then iaccessible2.indexinparent() can be used as in the typical case where cells are direct children of the table. the range of valid coordinates for this interface are implementation dependent. however, that range includes at least the intervals from the from the first row or ...
...And 39 more matches
JavaScript Daemons Management - Archive of obsolete content
*/ daemon.prototype; daemon.context.constructor = object; /* these properties can be manually reconfigured after the cr...
... of the daemon */ daemon.prototype.owner = daemon.context; daemon.prototype.task = null; daemon.prototype.rate = 100; daemon.prototype.length = infinity; daemon.prototype.reversals = 0; daemon.prototype.onstart = null; daemon.prototype.onstop = null; /* these properties should be read-only after the creation of the daemon */ daemon.prototype.session = -1; daemon.prototype.index = 0; daemon.prototype.paused = true; daemon.prototype.backw = true; /* system required daemon global object methods */ daemon.forcecall = function (odmn) { odmn.index += odmn.backw ? -1 : 1; var bbreak = odmn.task.call(odmn.owner, odmn.index, odmn.length, odmn.backw) === false, bend = odmn.isatend(), binvert = odmn.reversals > 0; if (bend && !binvert || bbreak)...
...corporate(@func) will modify the @func.prototype property! ...
...And 34 more matches
nsINavBookmarksService
ts.interfaces.nsinavbookmarksservice); method overview void addobserver(in nsinavbookmarkobserver observer, in boolean ownsweak); void beginupdatebatch(); obsolete since gecko 1.9 void changebookmarkuri(in long long aitemid, in nsiuri anewuri); long long createdynamiccontainer(in long long aparentfolder, in autf8string aname, in astring acontractid, in long aindex); note: renamed from createcontainer in gecko 1.9 obsolete since gecko 13.0 long long createfolder(in long long aparentfolder, in autf8string name, in long index); void endupdatebatch(); obsolete since gecko 1.9 void exportbookmarkshtml(in nsifile file); obsolete since gecko 1.9 nsiuri getbookmarkedurifor(in nsiuri auri); void getbookmarkfolderstarray(...
...ong afolder, in astring asubfolder); obsolete since gecko 2.0 long long getfolderidforitem(in long long aitemid); boolean getfolderreadonly(in long long aitemid); astring getfoldertitle(in print64 folder); obsolete since gecko 1.9 nsiuri getfolderuri(in print64 folder); obsolete since gecko 1.9 long long getidforitemat(in long long aparentid, in long aindex); prtime getitemdateadded(in long long aitemid); astring getitemguid(in long long aitemid); obsolete since gecko 14.0 long long getitemidforguid(in astring aguid); obsolete since gecko 14.0 long getitemindex(in long long aitemid); prtime getitemlastmodified(in long long aitemid); autf8string getitemtitle(in long long aitemid); u...
...rdforuri(in nsiuri auri); obsolete since gecko 40.0 nsitransaction getremovefoldertransaction(in long long aitemid); nsiuri geturiforkeyword(in astring keyword); obsolete since gecko 40.0 void importbookmarkshtml(in nsiuri url); obsolete since gecko 1.9 void importbookmarkshtmltofolder(in nsiuri url, in print64 folder); obsolete since gecko 1.9 print32 indexoffolder(in print64 parent, in print64 folder); obsolete since gecko 1.9 print32 indexofitem(in print64 folder, in nsiuri uri); obsolete since gecko 1.9 long long insertbookmark(in long long aparentid, in nsiuri auri, in long aindex, in autf8string atitle); void insertitem(in print64 folder, in nsiuri item, in print32 index); obsolete since gecko 1.9 long long ...
...And 34 more matches
Basic concepts - Web APIs
indexeddb is a way for you to persistently store data inside a user's browser. because it lets you create web applications with rich query abilities regardless of network availability, these applications can work both online and offline. indexeddb is useful for applications that store a large amount of data (for example, a catalog of dvds in a lending library) and applications that don't need persistent internet connectivity to work (for example, mail clients, to-do lists, and notepads). about this document this introduction discusses essential concepts and terminology in indexeddb. it gives you the big picture and explains key concepts. you'll find the following useful: for an overview of the design and structure of indexeddb, see big concepts. ...
... don't need persistent internet connectivity to work (for example, mail clients, to-do lists, and notepads). about this document this introduction discusses essential concepts and terminology in indexeddb. it gives you the big picture and explains key concepts. you'll find the following useful: for an overview of the design and structure of indexeddb, see big concepts. to learn more about indexeddb terms, see the definitions section. for a detailed tutorial on how to use the api, see using indexeddb. for the reference documentation on the indexeddb api, refer back to the main indexeddb api article and its subpages, which document the types of objects used by indexeddb. for more information on how the browser handles storing your data in the background, read browser storage limits and...
...ction. for a detailed tutorial on how to use the api, see using indexeddb. for the reference documentation on the indexeddb api, refer back to the main indexeddb api article and its subpages, which document the types of objects used by indexeddb. for more information on how the browser handles storing your data in the background, read browser storage limits and eviction criteria. overview of indexeddb indexeddb lets you store and retrieve objects that are indexed with a "key." all changes that you make to the database happen within transactions. like most web storage solutions, indexeddb follows a same-origin policy. so while you can access stored data within a domain, you cannot access data across different domains. ...
...And 31 more matches
mozIStorageBindingParams
ng mozistoragestatement.executeasync(). storage/public/mozistoragebindingparams.idlscriptable please add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports you can only create mozistoragebindingparams objects by calling the mozistoragebindingparamsarray.newbindingparams(). ...
...executeasync(). storage/public/mozistoragebindingparams.idlscriptable please add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports you can only create mozistoragebindingparams objects by calling the mozistoragebindingparamsarray.newbindingparams(). ...
...ams.idlscriptable please add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports you can only create mozistoragebindingparams objects by calling the mozistoragebindingparamsarray.newbindingparams(). ...
...And 27 more matches
StringView - Archive of obsolete content
/* ...or...: ntranscrtype ^= number(this.encoding !== "utf-32") << 1; */ nstartidx = ncharstart = noffset ? math.max((noutptlen + noffset) % noutptlen, 0) : 0; nendidx = ncharend = (number.isinteger(nlength) ? math.min(math.max(nlength, 0) + nstartidx, noutptlen) : noutptlen) - 1; } else { /* input is stringview */ vsource = vinput.rawdata; ninptlen = vinput.makeindex(); nstartidx = ncharstart = noffset ? math.max((ninptlen + noffset) % ninptlen, 0) : 0; noutptlen = number.isinteger(nlength) ? math.min(math.max(nlength, 0), ninptlen - ncharstart) : ninptlen; nendidx = ncharend = noutptlen + ncharstart; if (vinput.encoding === "utf-8") { fgetinptchrsize = stringview.getutf8charlength; fgetinptchrcode = stringview.loadutf...
...coding, nbyteoffset, nlength) { return new stringview(sencoding === "utf-16" || sencoding === "utf-32" ? stringview.base64tobytes(sb64inpt, sencoding === "utf-16" ? 2 : 4).buffer : stringview.base64tobytes(sb64inpt), sencoding, nbyteoffset, nlength); }; /* default values */ stringview.prototype.encoding = "utf-8"; /* default encoding... ...
...-8"; /* default encoding... ...
...And 26 more matches
nsITreeView
ast 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. ...
... 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. ...
...ed to make changes to the tree manually when changes to the database occur. further information about creating treeviews is given in the xul tutorial. ...
...And 25 more matches
IAccessibleText
[propget] hresult ncharacters([out] long ncharacters ); [propget] hresult newtext([out] ia2textsegment newtext ); [propget] hresult nselections([out] long nselections ); [propget] hresult offsetatpoint([in] long x, [in] long y, [in] enum ia2coordinatetype coordtype, [out] long offset ); [propget] hresult oldtext([out] ia2textsegment oldtext ); hresult removeselection([in] long selectionindex ); hresult scrollsubstringto([in] long startindex, [in] long endindex, [in] enum ia2scrolltype scrolltype ); hresult scrollsubstringtopoint([in] long startindex, [in] long endindex, [in] enum ia2coordinatetype coordinatetype, [in] long x, [in] long y ); [propget] hresult selection([in] long selectionindex, [out] long startoffset, [out] long endoffset ); hresult setcaretoffset([in] long of...
...ex, [in] long endindex, [in] enum ia2scrolltype scrolltype ); hresult scrollsubstringtopoint([in] long startindex, [in] long endindex, [in] enum ia2coordinatetype coordinatetype, [in] long x, [in] long y ); [propget] hresult selection([in] long selectionindex, [out] long startoffset, [out] long endoffset ); hresult setcaretoffset([in] long offset ); hresult setselection([in] long selectionindex, [in] long startoffset, [in] long endoffset ); [propget] hresult text([in] long startoffset, [in] long endoffset, [out] bstr text ); [propget] hresult textafteroffset([in] long offset, [in] enum ia2textboundarytype boundarytype, [out] long startoffset, [out] long endoffset, [out] bstr text ); [propget] hresult textatoffset([in] long offset, [in] enum ia2textboundarytype boundarytype, [out] ...
...t(). its height typically being the maximal height of all the characters in the text() or the height of the preceding character, its width being at least one pixel so that the bounding box is not degenerate. [propget] hresult characterextents( [in] long offset, [in] enum ia2coordinatetype coordtype, [out] long x, [out] long y, [out] long width, [out] long height ); parameters offset index of the character for which to return its bounding box. the valid range is 0..length. coordtype specifies if the coordinates are relative to the screen or to the parent window. x x coordinate of the top left corner of the bounding box of the referenced character. y y coordinate of the top left corner of the bounding box of the referenced character. width width of the bounding box of the referenced...
...And 24 more matches
How to implement a custom autocomplete search component
re/modules/xpcomutils.jsm'); const 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} errordescription * @param {array.<string>} results * @param {array.<string>|null=} comments */ function providerautocompleteresult(searchstring, searchresult, defaultindex, errordescription, results, comments) { this._searchstring = searchstring; this._searchresult = searchresult; this._defaultindex = defaultindex; this._errordescription = errordescription; this.
...eteresult(searchstring, searchresult, defaultindex, errordescription, results, comments) { this._searchstring = searchstring; this._searchresult = searchresult; this._defaultindex = defaultindex; this._errordescription = errordescription; this._results = results; this._comments = comments; } providerautocompleteresult.prototype = { _searchstring: "", _searchresult: 0, _defaultindex: 0, _errordescription: "", _results: [], _comments: [], /** * @return {string} the original search string */ get searchstring() { return this._searchstring; }, /** * @return {number} the result code of this result object, either: * result_ignored (invalid searchstring) * result_failure (failure) * result_nomatch (no matches found) * result_su...
...*/ get searchstring() { return this._searchstring; }, /** * @return {number} the result code of this result object, either: * result_ignored (invalid searchstring) * result_failure (failure) * result_nomatch (no matches found) * result_success (matches found) */ get searchresult() { return this._searchresult; }, /** * @return {number} the index of the default item that should be entered if * none is selected */ get defaultindex() { return this._defaultindex; }, /** * @return {string} description of the cause of a search failure */ get errordescription() { return this._errordescription; }, /** * @return {number} the number of matches */ get matchcount() { return this._results.length; }, ...
...And 20 more matches
Keyboard-navigable JavaScript widgets - Accessibility
overview web applications often use javascript 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 javascript widgets accessible with the keyboard. using tabindex by default, when people use the tab key to browse a webpage, only interactive elements (like links, form controls) get focused. with the tabindex global attribute, authors can make other elements focusable, too. when set to 0, the element becomes focusable by keyboard and script. when set to -1, the element becomes focusable by script, but it does not become part of the keyboard focus order. th...
...ents focusable, too. when set to 0, the element becomes focusable by keyboard and script. when set to -1, the element becomes focusable by script, but it does not become part of the keyboard focus order. the order in which elements gain focus when using a keyboard, is the source order by default. in exceptional circumstances, authors may want to redefine the order. ...
...d and script. when set to -1, the element becomes focusable by script, but it does not become part of the keyboard focus order. the order in which elements gain focus when using a keyboard, is the source order by default. in exceptional circumstances, authors may want to redefine the order. to do this, authors can set tabindex to any positive number. warning: avoid using positive values for tabindex. ...
...And 20 more matches
Box-shadow generator - CSS: Cascading Style Sheets
es" class="category"> <div class="title"> class element properties </div> <div class="group"> <div class="group property"> <div class="ui-slider-name"> border </div> <div class="ui-checkbox" data-topic='border-state' data-state="true"></div> </div> <div id="z-index" class="slidergroup"> <div class="ui-slider-name"> z-index </div> <div class="ui-slider-btn-set" data-topic="z-index" data-type="sub"></div> <div class="ui-slider" data-topic="z-index" data-min="-10" data-max="10" data-step="1"></div> <div class="ui-slider-btn-set" data-topi...
...ss="slidergroup"> <div class="ui-slider-name"> z-index </div> <div class="ui-slider-btn-set" data-topic="z-index" data-type="sub"></div> <div class="ui-slider" data-topic="z-index" data-min="-10" data-max="10" data-step="1"></div> <div class="ui-slider-btn-set" data-topic="z-index" data-type="add"></div> <div class="ui-slider-input" data-topic="z-index"></div> </div> <div class="slidergroup"> <div class="ui-slider-name"> top </div> <div class="ui-slider-btn-set" data-topic="top" data-type="sub"></div> <div class="ui-slider" data-topic="top...
...0;"> <div class="output" data-topic="element" data-name="element" data-prop="width height background-color position=[relative] box-shadow"> </div> <div class="output" data-topic="before" data-name="element:before" data-prop="content=[&quot;&quot;] position=[absolute] width height top left z-index background-color box-shadow transform -webkit-transform -ms-transform"> </div> <div class="output" data-topic="after" data-name="element:after" data-prop="content=[&quot;&quot;] position=[absolute] width height top left z-index background-color box-shadow transform -webkit-transform -ms-transform"> </div> ...
...And 20 more matches
nsIAccessibleTable
accessible/public/nsiaccessibletable.idlscriptable please add a summary to this article. ...
... accessible/public/nsiaccessibletable.idlscriptable please add a summary to this article. ...
... accessible/public/nsiaccessibletable.idlscriptable please add a summary to this article. ...
...And 19 more matches
Client-side storage - Learn web development
toring client-side data, therefore we won't be teaching you how to use cookies in this article. however, this does not mean cookies are completely useless on the modern-day web — they are still used commonly to store data related to user personalization and state, e.g. session ids and access tokens. for more information on cookies see our using http cookies article. ...
...this can be used for things from complete sets of customer records to even complex data types like audio or video files. you'll learn more about these apis below. the future: cache api some modern browsers support the new cache api. ...
... you can find the example html at personal-greeting.html — this contains a simple website with a header, content, and footer, and a form for entering your name. let's build up the example, so you can understand how it works. first, make a local copy of our personal-greeting.html file in a new directory on your computer. next, note how our html references a javascript file called index.js (see line 40). we need to create this and write our javascript code into it. create an index.js file in the same directory as your html file. we'll start off by creating references to all the html features we need to manipulate in this example — we'll create them all as constants, as these references do not need to change in the lifecycle of the app. add the following lines to your ja...
...And 18 more matches
nsIMsgDBView
void docommand(in nsmsgviewcommandtypevalue command); void docommandwithfolder(in nsmsgviewcommandtypevalue command, in nsimsgfolder destfolder); void getcommandstatus(in nsmsgviewcommandtypevalue command, out boolean selectable_p, out nsmsgviewcommandcheckstatevalue selected_p); void viewnavigate(in nsmsgnavigationtypevalue motion, out nsmsgkey resultid, out nsmsgviewindex resultindex, out nsmsgviewindex threadindex, in boolean wrap); boolean navigatestatus(in nsmsgnavigationtypevalue motion); nsmsgkey getkeyat(in nsmsgviewindex index); nsimsgdbhdr getmsghdrat(in nsmsgviewindex index); nsimsgfolder getfolderforviewindex(in nsmsgviewindex index); acstring geturiforviewindex(in nsmsgviewindex index); nsimsgdbview ...
...ewindex index); acstring geturiforviewindex(in nsmsgviewindex index); nsimsgdbview clonedbview(in nsimessenger amessengerinstance, in nsimsgwindow amsgwindow, in nsimsgdbviewcommandupdater acommandupdater); void geturisforselection([array, size_is(count)] out string uris, out unsigned long count); void getindicesforselection([array, size_is(count)] out nsmsgviewindex indices, out unsigned long count); void loadmessagebymsgkey(in nsmsgkey amsgkey); void loadmessagebyviewindex(in nsmsgviewindex aindex); void loadmessagebyurl(in string aurl); void reloadmessage(); void reloadmessagewithallparts(); void selectmsgbykey(in nsmsgkey key); void selectfoldermsgbykey(in nsimsgfolder afolder, in nsmsgkey ake...
...gkey amsgkey); void loadmessagebyviewindex(in nsmsgviewindex aindex); void loadmessagebyurl(in string aurl); void reloadmessage(); void reloadmessagewithallparts(); void selectmsgbykey(in nsmsgkey key); void selectfoldermsgbykey(in nsimsgfolder afolder, in nsmsgkey akey); void ondeletecompleted(in boolean succeeded); nsmsgviewindex findindexfromkey(in nsmsgkey amsgkey, in boolean aexpand); void expandandselectthreadbyindex(in nsmsgviewindex aindex, in boolean aaugment); void addcolumnhandler(in astring acolumn, in nsimsgcustomcolumnhandler ahandler); void removecolumnhandler(in astring acolumn); nsimsgcustomcolumnhandler getcolumnhandler(in astring acolumn); attributes at...
...And 17 more matches
The stacking context - CSS: Cascading Style Sheets
the stacking context is a three-dimensional conceptualization of html elements along an imaginary z-axis relative to the user, who is assumed to be facing the viewport or the webpage. html elements occupy this space in priority order based on element attributes. the stacking context in the previous part of this article, using z-index, the rendering order of certain elements is influenced by their z-index value. this occurs because these elements have special properties which cause them to form a stacking context. a stacking context is formed, anywhere in the document, by any element in the following scenarios: root element of the document (<html>). element with a position value absolute or relative and z-index value other than auto. element with a position value fixed or sticky (sticky...
... element with a opacity value less than 1 (see the specification for opacity). ...
... element with a opacity value less than 1 (see the specification for opacity). element with a mix-blend-mode value other than normal. ...
...And 17 more matches
Eclipse CDT
introduction eclipse 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 eclipse 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 eclipse regarding llvm4eclipsecdt, 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...
...ipse/ on mac). (while package managers like snap sometimes provide an eclipse 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 eclipse this way.) increase eclipse's memory limits! make sure you do this! before you use eclipse with the mozilla source you must increase its memory limits. when eclipse's indexer tries to process the mozilla source, eclipse will need considerably more memory than the limits imposed by its default configuration. you can increase eclipse's memory limits using the eclipse.ini that lives alongside the eclipse binary. set an initial heap space of 1 gb and max heap space of 5 gb, say, by modifying the values of the following two lines in eclipse.ini: -xms1g -xmx5g if you f...
...imposed by its default configuration. you can increase eclipse's memory limits using the eclipse.ini that lives alongside the eclipse binary. set an initial heap space of 1 gb and max heap space of 5 gb, say, by modifying the values of the following two lines in eclipse.ini: -xms1g -xmx5g if you fail to increase these limits, then you will likely find that eclipse either hangs when it tries to index the mozilla source or else that the code intelligence is very broken after the indexing "completes". express setup for the eclipse indexer to work well you must first build mozilla, so that it includes headers from the objdir etc. these can be found and processed by eclipse. note: your moz_objdir must be outside the mozilla source directory. once your build is complete, mach can then genera...
...And 16 more matches
nsITreeSelection
layout/xul/base/src/tree/public/nsitreeselection.idlscriptable this interface is used by the tree widget to get information about what is selected. ...
... layout/xul/base/src/tree/public/nsitreeselection.idlscriptable this interface is used by the tree widget to get information about what is selected. ...
... layout/xul/base/src/tree/public/nsitreeselection.idlscriptable this interface is used by the tree widget to get information about what is selected. ...
...And 16 more matches
Color picker tool - CSS: Cascading Style Sheets
-topic="picker" data-mode="hsl"></div> <div id="picker-samples" sample-id="master"></div> <div id="controls"> <div id="delete"> <div id="trash-can"></div> </div> <div id="void-sample" class="icon"></div> </div> </div> <div id="canvas" data-tutorial="drop"> <div id="zindex" class="ui-input-slider" data-topic="z-index" data-info="z-index" data-max="20" data-sensivity="10"></div> </div> </div> css /* * color picker tool */ .ui-color-picker { width: 420px; margin: 0; border: 1px solid #ddd; background-color: #fff; display: table; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } ...
...-box; } /* preview color */ .ui-color-picker .preview { width: 95px; height: 53px; margin: 5px; margin-top: 10px; border: 1px solid #ddd; background-image: url("https://mdn.mozillademos.org/files/5705/alpha.png"); float: left; position: relative; } .ui-color-picker .preview:before { height: 100%; width: 50%; left: 50%; top: 0; content: ""; background: #fff; position: absolute; z-index: 1; } .ui-color-picker .preview-color { width: 100%; height: 100%; background-color: rgba(255, 0, 0, 0.5); position: absolute; z-index: 1; } .ui-color-picker .switch_mode { width: 10px; height: 20px; position: relative; border-radius: 5px 0 0 5px; border: 1px solid #ddd; background-color: #eee; left: -12px; top: -1px; z-index: 1; transition: all 0.5s; } .ui-color-picker .switch_...
...mples .sample:hover { cursor: pointer; border-color: #bbb; transform: scale(1.15); border-radius: 3px; } #picker-samples .sample[data-active='true'] { border-color: #999; } #picker-samples .sample[data-active='true']:after { content: ""; position: absolute; background: url('https://mdn.mozillademos.org/files/6065/arrow.png') center no-repeat; width: 100%; height: 12px; top: -12px; z-index: 2; } #picker-samples #add-icon { width: 100%; height: 100%; position: relative; box-shadow: inset 0px 0px 2px 0px #ddd; } #picker-samples #add-icon:hover { cursor: pointer; border-color: #ddd; box-shadow: inset 0px 0px 5px 0px #ccc; } #picker-samples #add-icon:before, #picker-samples #add-icon:after { content: ""; position: absolute; background-color: #eee; box-shadow: 0 0 1px 0 #e...
...And 16 more matches
mozIStorageStatement
(firefox 3.6 / thunderbird 3.1 / fennec 1.0) for an introduction on how to use this interface, see the storage overview document. ...
...) for an introduction on how to use this interface, see the storage overview document. ...
... method overview void initialize(in mozistorageconnection adbconnection, in autf8string asqlstatement); obsolete since gecko 1.9.1 void finalize(); mozistoragestatement clone(); autf8string getparametername(in unsigned long aparamindex); unsigned long getparameterindex(in autf8string aname); autf8string getcolumnname(in unsigned long acolumnindex); unsigned long getcolumnindex(in autf8string aname); void reset(); astring escapestringforlike(in astring avalue, in wchar aescapechar); void bindparameters(in mozistoragebindingparamsarray aparameters); mozistoragebindingparamsarray newbindingparamsarray(); void bindutf8stringparameter(in unsigned long aparamindex, in autf8string avalue); ...
...And 15 more matches
Array - JavaScript
ray's length can change at any time, and data can be stored at non-contiguous locations in the array, javascript arrays are not guaranteed to be dense; this depends on how the programmer chooses to use them. in general, these are convenient characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays. arrays cannot use strings as element indexes (as in an associative array) but must use integers. setting or accessing via non-integers using bracket notation (or dot notation) will not set or retrieve an element from the array list itself, but will set or access a variable associated with that array's object property collection. the array's object properties and list of array elements are separate, and the array's traversal and mutation o...
...tself, but will set or access a variable associated with that array's object property collection. the array's object properties and list of array elements are separate, and the array's traversal and mutation operations cannot be applied to these named properties. ...
...lements are separate, and the array's traversal and mutation operations cannot be applied to these named properties. ...
...And 15 more matches
RegExp - JavaScript
ties have both long and short (perl-like) names. both names always refer to the same value. (perl is the programming language from which javascript modeled its regular expressions.). see also deprecated regexp properties. constructor regexp() creates a new regexp object. static properties get regexp[@@species] the constructor function that is used to create derived objects. regexp.lastindex the index at which to start the next match. instance properties regexp.prototype.flags a string that contains the flags of the regexp object. regexp.prototype.dotall whether . matches newlines or not. regexp.prototype.global whether to test the regular expression against all possible matches in a string, or only against the first. regexp.prototype.ignorecase whether to ignore case wh...
...verrides the object.prototype.tostring() method. regexp.prototype[@@match]() performs match to given string and returns match result. regexp.prototype[@@matchall]() returns all matches of the regular expression against a string. regexp.prototype[@@replace]() replaces matches in given string with new substring. regexp.prototype[@@search]() searches the match in given string and returns the index the pattern found in the string. regexp.prototype[@@split]() splits given string into an array by separating the string into substrings. examples using a regular expression to change data format the following script 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 script uses $1 a...
...xpression matters. using regular expression on multiple lines let s = 'please yes\nmake my day!' s.match(/yes.*day/); // returns null s.match(/yes[^]*day/); // returns ["yes\nmake my day"] using a regular expression with the sticky flag the sticky flag indicates that the regular expression performs sticky matching in the target string by attempting to match starting at regexp.prototype.lastindex. ...
...And 15 more matches
Creating a Help Content Pack - Archive of obsolete content
tation 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 descriptor 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 description 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 descriptor file outlines the ...
...the glossary file is written in rdf and consists of a simple list of terms with corresponding urls to the term definition. ...
...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 descriptor file as mentioned earlier, the content pack descriptor file is written using rdf. ...
...And 14 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
plete functionality is handled through one of more session objects, each of which can return a set of results given the current value of the textbox. the sessions can be set using the searchsessions attribute or by calling the addsession method. ...
...forcecomplete, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, ignoreblurwhilesearching, inputtooltiptext, label, maxlength, maxrows, minresultsforpopup, minresultsforpopup, nomatch, onchange, onerrorcommand, oninput, onsearchcomplete, ontextcommand, ontextentered, ontextrevert, ontextreverted, open, readonly, searchsessions, showcommentcolumn, showcommentcolumn, showpopup, size, tabindex, tabscrolling, tabscrolling, timeout, type, useraction, value properties accessible, alwaysopenpopup, autofill, autofillaftermatch, completedefaultindex, crop, disableautocomplete, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, issearching, iswaiting, label, maxlength, maxrows, minresultsforpopup, nomatch, open, popup, popupo...
...tch, completedefaultindex, crop, disableautocomplete, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, issearching, iswaiting, label, maxlength, maxrows, minresultsforpopup, nomatch, open, popup, popupopen, resultspopup, searchcount, searchparam, searchsessions, selectionend, selectionstart, sessioncount, showcommentcolumn, showpopup, size, tabindex, tabscrolling, textlength, textvalue, timeout, type, useraction, value methods addsession, clearresults, getdefaultsession, getresultat, getresultcount, getresultvalueat, getsession, getsessionbyname, getsessionresultat, getsessionstatusat, getsessionvalueat, removesession, select, setselectionrange, syncsessions examples (example needed) attributes accesskey type: chara...
...And 14 more matches
listbox - Archive of obsolete content
d to contain listitem elements. all the rows in the listbox are the same height, which is the height of the tallest item in the list. if you wish to create a list with variable height rows, or with non-text content, you should instead use the richlistbox element. see list controls for more information. ...
...listbox are the same height, which is the height of the tallest item in the list. if you wish to create a list with variable height rows, or with non-text content, you should instead use the richlistbox element. see list controls for more information. ...
...te a list with variable height rows, or with non-text content, you should instead use the richlistbox element. see list controls for more information. ...
...And 14 more matches
richlistbox - Archive of obsolete content
s used to create a list of listitems (richlistitems), similar to a listbox, but is designed to be used when the items do not contain simple text content. note: in versions of firefox prior to firefox 3, rich list boxes support only single selection. firefox 3 introduced multiple selection to rich list boxes. ...
..., similar to a listbox, but is designed to be used when the items do not contain simple text content. note: in versions of firefox prior to firefox 3, rich list boxes support only single selection. firefox 3 introduced multiple selection to rich list boxes. ...
...note: in versions of firefox prior to firefox 3, rich list boxes support only single selection. firefox 3 introduced multiple selection to rich list boxes. ...
...And 14 more matches
How to build custom form controls - Learn web development
m has already been implemented for the click event. defining the html structure and (some) semantics now that the control'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 javascript. --> <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 s...
...te-space : nowrap; text-overflow: ellipsis; vertical-align: top; } we don't need an extra element to design the down arrow; instead, we're using the :after pseudo-element. it could also be implemented using a simple background image on the select class. ...
.../* this will be important to keep the arrow from overlapping the list of options */ top : 0; right : 0; box-sizing : border-box; height : 100%; width : 2em; padding-top : .1em; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; text-align : center; } next, let's style the list of options: .select .optlist { z-index : 2; /* we explicitly said the list of options will always be on top of the down arrow */ /* this will reset the default style of the ul element */ list-style: none; margin : 0; padding: 0; box-sizing : border-box; /* if the values are smaller than the control, the list of options will be as wide as the control itself */ min-width : 100%; /* in case the list is too long, ...
...And 14 more matches
nsINavBookmarkObserver
1.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 folder, in print64 oldparent, in print32 oldindex, in print64 newparent, in print32 newindex); obsolete since gecko 1.9 void onfolderremoved(in print64 folder, in print64 parent, in print32 index); obsolete since gecko 1.9 ...
...in acstring property); obsolete since gecko 1.9 void onfoldermoved(in print64 folder, in print64 oldparent, in print32 oldindex, in print64 newparent, in print32 newindex); obsolete since gecko 1.9 void onfolderremoved(in print64 folder, in print64 parent, in print32 index); obsolete since gecko 1.9 void onitemadded(in long long aitemid, in long long aparentid, in long aindex, in unsigned short aitemtype, in nsiuri auri, in autf8string atitle, in prtime adateadded, in acstring aguid, in acstring aparentguid); void onitemchanged(in long long aitemid, in acstring aproperty, in boolean aisannotationproperty, in autf8string anewvalue, in prtime alastmodified, in unsigned short aitemtype, in long long aparentid, in acstring aguid, in acstring aparentguid); ...
...adateadded, in acstring aguid, in acstring aparentguid); void onitemchanged(in long long aitemid, in acstring aproperty, in boolean aisannotationproperty, in autf8string anewvalue, in prtime alastmodified, in unsigned short aitemtype, in long long aparentid, in acstring aguid, in acstring aparentguid); void onitemmoved(in long long aitemid, in long long aoldparentid, in long aoldindex, in long long anewparentid, in long anewindex, in unsigned short aitemtype, in acstring aguid, in acstring aoldparentguid, in acstring anewparentguid); void onitemremoved(in long long aitemid, in long long aparentid, in long aindex, in unsigned short aitemtype, in nsiuri auri, in acstring aguid, in acstring aparentguid); void onitemreplaced(in print64 folder, in nsiuri item, in...
...And 14 more matches
IDBObjectStore - Web APIs
idbobjectstore.keypath read only the key path of this object store. if this attribute is null, the application must provide a key for each modification operation. idbobjectstore.name the name of this object store. idbobjectstore.transaction read only the idbtransaction object to which this object store belongs. ...
... idbobjectstore.keypath read only the key path of this object store. if this attribute is null, the application must provide a key for each modification operation. idbobjectstore.name the name of this object store. idbobjectstore.transaction read only the idbtransaction object to which this object store belongs. ...
...brequest object, and clears this object store in a separate thread. this is for deleting all current records out of an object store. idbobjectstore.count() returns an idbrequest object, and, in a separate thread, returns the total number of records that match the provided key or idbkeyrange. if no arguments are provided, it returns the total number of records in the store. ...
...And 14 more matches
IDBObjectStoreSync - 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 idbobjectstoresync interface of the indexeddb api provides synchronous access to an object store of a database. ...
...and was eventually removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbobjectstoresync interface of the indexeddb api provides synchronous access to an object store of a database. ...
...ly removed from the spec because its need was questionable. it may however be reintroduced in the future if there is enough demand from web developers. the idbobjectstoresync interface of the indexeddb api provides synchronous access to an object store of a database. ...
...And 14 more matches
Image file type and format guide - Web media technologies
f bits used to represent each pixel in memory. apng (animated portable network graphics) apng is a file format first introduced by mozilla which extends the png standard to add support for animated images. conceptually similar to the animated gif format which has been in use for decades, apng is more capable in that it supports a variety of color depths, whereas animated gif supports only 8-bit indexed color. apng is ideal for basic animations that do not need to synchronize to other activities or to a sound track, such as progress indicators, activity throbbers, and other animated sequences. for example, apng is one of the formats supported when creating animated stickers for apple's imessage application (and the messages application on ios). they're also commonly used for the animated port...
...s per component (d) description greyscale 1, 2, 4, 8, and 16 each pixel consists of a single d-bit value indicating the brightness of the greyscale pixel. true color 8 and 16 each pixel is represented by three d-bit values indicating the level of the red, green, and blue color components. indexed color 1, 2, 4, and 8 each pixel is a d-bit value indicating an index into a color palette which is contained within a plte chunk in the apng file; the colors in the palette all use an 8-bit depth. greyscale with alpha 8 and 16 each pixel is represented by two d-bit values: the intensity of the greyscale pixel and an alpha sample, indicating how o...
...monly 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 multiple 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 bottom). theoretically, several compression algorithms are supported, and the image data can also be stored in jpeg or png format within the bmp file. mime type image/bmp file extension(s)...
...And 13 more matches
Understanding WebAssembly text format - WebAssembly
r type, for example (local i32). parameters are basically just locals that are initialized with the value of the corresponding argument passed by the caller. getting and setting locals and parameters locals/parameters can be read and written by the body of the function with the local.get and local.set instructions. the local.get/local.set commands refer to the item to be got/set by its numeric index: parameters are referred to first, in order of their declaration, followed by locals in order of their declaration. so given the following function: (func (param i32) (param f32) (local f64) local.get 0 local.get 1 local.get 2) the instruction local.get 0 would get the i32 parameter, local.get 1 would get the f32 parameter, and local.get 2 would get the f64 local. there is another issue...
... a lot more examples as you go along. for a full list of the available opcodes, consult the webassembly.org semantics reference. calling the function our function won’t do very much on its own — now we need to call it. how do we do that? like in an es2015 module, wasm functions must be explicitly exported by an export statement inside the 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 javascript whereas $add picks out which webassembly function ins...
...te: you can find this example in github as add.html (see it live also). also see webassembly.instantiatestreaming() for more details about the instantiate function. exploring fundamentals now we’ve covered the real basics, let’s move on to look at some more advanced features. calling functions from other functions in the same module the call instruction calls a single function, given its index or name. for example, the following module contains two functions — one just returns the value 42, the other returns the result of calling the first plus one: (module (func $getanswer (result i32) i32.const 42) (func (export "getanswerplus1") (result i32) call $getanswer i32.const 1 i32.add)) note: i32.const just defines a 32-bit integer and pushes it onto the stack. you ...
...And 13 more matches
Using the Gamepad API - Web APIs
ads are only exposed to a page when the user interacts with one with the page visible. this helps prevent gamepads being used for fingerprinting the user. once one gamepad has been interacted with, other gamepads that are connected will automatically be visible. you can use gamepadconnected like this: window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.length, e.gamepad.axes.length); }); each gamepad has a unique id associated with it, which is available on the event's gamepad property. disconnecting a gamepad when a gamepad is disconnected, and if a page has previously received data for that gamepad (e.g. gamepadconnected), a second event is dispatched ...
...nique id associated with it, which is available on the event's gamepad property. disconnecting a gamepad when a gamepad is disconnected, and if a page has previously received data for that gamepad (e.g. gamepadconnected), a second event is dispatched to the focused window, gamepaddisconnected: window.addeventlistener("gamepaddisconnected", 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 multiple 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: // g...
...); }); the gamepad's index property will be unique per-device connected to the system, even if multiple controllers of the same type are used. the index property also functions as the index into the array returned by navigator.getgamepads(). ...
...And 12 more matches
ARIA: grid role - Accessibility
s of cells. the position of each cell is significant and can be focused using keyboard input. ...
...is significant and can be focused using keyboard input. ...
... input. ...
...And 12 more matches
Array.prototype.reduce() - JavaScript
you provide) on each element of the array, resulting in single output value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... it takes four arguments: accumulator the accumulator accumulates callback's return values. ...
...execute on each element in the array (except for the first, if no initialvalue is supplied). it takes four arguments: accumulator the accumulator accumulates callback's return values. it is the accumulated value previously returned in the last invocation of the callback—or initialvalue, if it was supplied (see below). currentvalue the current element being processed in the array. index optional the index of the current 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. if no initialvalue is supplied, the first element in the array will be used as the ...
...And 12 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
ox with a popup containing a list of possible completions for what the user has started to type. toolkit applications (such as firefox) use a different autocomplete mechanism than the mozilla suite. the example below will create an autocomplete textbox that will search the user's history. ...
...ing a list of possible completions for what the user has started to type. toolkit applications (such as firefox) use a different autocomplete mechanism than the mozilla suite. the example below will create an autocomplete textbox that will search the user's history. ...
...chparam, completedefaultindex, completeselectedindex,crop, disableautocomplete, disabled, disablekeynavigation, enablehistory, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputtooltiptext, label, maxlength, maxrows, minresultsforpopup, nomatch, onchange, oninput, onsearchcomplete, ontextentered, ontextreverted, open, readonly,showcommentcolumn, showimagecolumn, size, tabindex, tabscrolling, timeout, type, value properties accessibletype, completedefaultindex, controller, crop, disableautocomplete, disablekeynavigation, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, label, maxlength, maxrows, minresultsforpopup, open, popup, popupopen, searchcount, searchparam, selectionend, selectionstart, showcommentco...
...And 11 more matches
Manipulating Lists - Archive of obsolete content
ch you might wish to use in a script. similarly, there is also an insertitemat() and a removeitemat() function which inserts a new item and removes an existing item respectively. the syntax is as follows: list.insertitemat(3, "thursday", "thu"); list.removeitemat(3); the insertitemat() function takes an additional argument, the position to insert the new item. the new item is inserted at this index, so, in the example, the new item will be added at position 3 while the item previously at that position will now be at position 4. remember that the first item is 0. the removeitemat() function will remove the item at a specific index. these three methods are also available for several other xul elements and work in the same manner. in fact, these methods are part of the nsidomxulselectcontrole...
...nt interface so any xul elements which implement this interface have these methods. this includes the menulist, radiogroup and tabs elements. for example, to add a new item to a menulist, you can use the same syntax as for a listbox. the right kind of element will be appended in each situation. list selection the nsidomxulselectcontrolelement interface provides two additonal properties, selectedindex and selecteditem. the former returns the index of the selected item while the latter returns the selected element. for instance the selecteditem of a menulist will be the menuitem that is selected. if no item is selected, selectedindex will return -1, while selecteditem will return null. getting the selected item these two properties are commonly inspected during a select event, as in the follo...
...null before continuing. the select event is also fired when a radio button in a radiogroup is selected and when a tab is selected in a tabs element. however, menulists do not fire the select event; instead you can listen to the command event to handle when an item is selected. for the tabs element, it is often more convenient to use functions of the tabbox element instead. it also has a selectedindex function which will return the index of the selected tab. however, to get the selected item, use the tabbox's selectedtab property instead. or, use the selectedpanel property to get the selected panel, that is, return the content associated with the tab. changing the selection all of the selection related properties described above may also be assigned a new value to change the selection. in th...
...And 11 more matches
Creating hyperlinks - Learn web development
rg/. urls use paths to find files. paths specify where the file you're interested in is located in the filesystem. let's look at an example of a directory structure, see the creating-hyperlinks directory. the root of this directory structure is called creating-hyperlinks. when working locally with a web site, you'll have one directory that contains the entire site. inside the root, we have an index.html file and a contacts.html. in a real website, index.html would be our home page or landing page (a web page that serves as the entry point for a website or a particular section of a website.). there are also two directories inside our root — pdfs and projects. these each have a single file inside them — a pdf (project-brief.pdf) and an index.html file, respectively. note that you can hav...
...file and a contacts.html. in a real website, index.html would be our home page or landing page (a web page that serves as the entry point for a website or a particular section of a website.). there are also two directories inside our root — pdfs and projects. these each have a single file inside them — a pdf (project-brief.pdf) and an index.html file, respectively. note that you can have two index.html files in one project, as long as they're in different filesystem locations. the second index.html would perhaps be the main landing page for project-related information. ...
...s and projects. these each have a single file inside them — a pdf (project-brief.pdf) and an index.html file, respectively. note that you can have two index.html files in one project, as long as they're in different filesystem locations. the second index.html would perhaps be the main landing page for project-related information. same directory: if you wanted to include a hyperlink inside index.html (the top level index.html) pointing to contacts.html, you would specify the filename that you want to link to, because it's in the same directory as the current file. the url you would use is contacts.html: <p>want to contact a specific staff member? find details on our <a href="contacts.html">contacts page</a>.</p> moving down into subdirectories: if you wanted to include a hyperli...
...And 11 more matches
Displaying Places information using views
ntainer. you can queryinterface acontainer to an nsinavhistorycontainerresultnode. showroot boolean if true the root nsinavhistorycontainerresultnode is shown as the first row in the tree. at least one of showroot and flatlist must be false. ...
...rycontainerresultnode. showroot boolean if true the root nsinavhistorycontainerresultnode is shown as the first row in the tree. at least one of showroot and flatlist must be false. ...
...erresultnode. showroot boolean if true the root nsinavhistorycontainerresultnode is shown as the first row in the tree. at least one of showroot and flatlist must be false. ...
...And 11 more matches
IAccessibleTable2
rence to it is returned, else a null pointer is returned. return value s_false if there is nothing to return, [out] value is null. s_ok. cellat() returns the accessible object at the specified row and column in the table. this object could be an iaccessible or an iaccessible2. [propget] hresult cellat( [in] long row, [in] long column, [out] iunknown cell ); parameters row the 0 based row index for which to retrieve the cell. column the 0 based column index for which to retrieve the cell. cell if both row and column index are valid then the corresponding accessible object is returned that represents the requested cell regardless of whether the cell is currently visible (on the screen). return value e_invalidarg if bad [in] passed, [out] value is null. s_ok. columndescription() returns ...
...bject is returned that represents the requested cell regardless of whether the cell is currently visible (on the screen). return value e_invalidarg if bad [in] passed, [out] value is null. s_ok. columndescription() returns the description text of the specified column in the table. [propget] hresult columndescription( [in] long column, [out] bstr description ); parameters column the 0 based index of the column for which to retrieve the description. description returns the description text of the specified column in the table if such a description exists. otherwise a null pointer is returned. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. iscolumnselected() returns a boolean value indicating whether the ...
...xists. otherwise a null pointer is returned. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. iscolumnselected() returns a boolean value indicating whether the specified column is completely selected. [propget] hresult iscolumnselected( [in] long column, [out] boolean isselected ); parameters column 0 based index of the column for which to determine whether it is selected. isselected returns true if the specified column is selected completely and false otherwise. return value e_invalidarg if bad [in] passed, [out] value is false. s_ok. isrowselected() returns a boolean value indicating whether the specified row is completely selected. [propget] hresult isrowselected( [in] long row, [out] boolean isse...
...And 11 more matches
nsISupportsArray
xpcom/ds/nsisupportsarray.idlscriptable please add a summary to this article. ...
...please add a summary to this article. ...
...ng 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); violates the xpcom interface guidelines long getindexof(in nsisupports apossibleelement); long getindexofstartingat(in nsisupports apossibleelement, in unsigned long astartindex); long getlastindexof(in nsisupports apossibleelement); long indexof([const] in nsisupports apossibleelement); violates the xpcom interface guidelines long indexofstartingat([const] in nsisupports apossibleelement, in unsigned long astartindex); violates the xpcom in...
...And 11 more matches
ARIA: cell role - Accessibility
grid, table or treegrid. if a cell contains column or row header information, use the colheader or rowheader roles, respecitively. if the cell does not contain header information and is nested in a grid or treegrid, the role of gridcell may be more appropriate. a cell can contain a number of property attributes clarifying the cell's position within the tabular data structure, including aria-colindex, aria-colspan, aria-rowindex, and aria-rowspan. using the native html table element (<table>) along with the table row element (<tr>) and table cell element (<td>) whenever possible is strongly encouraged. associated wai-aria roles, states, and properties context roles role="row" an element with role="row" is a row of cells within a tabular structure. a row contains one or more cells, ...
...ope. unlike a plain cell, the rowheader role establishes a relationship between it and all cells in the corresponding row. states and properties aria-colspan similar to the html <th> and <td> colspan attribute, it defines the number of columns spanned by the cell. aria-rowspan similar to the html <th> and <td> rowspan attribute, it defines the number of rows spanned by the cell. aria-colindex attribute the aria-colindex attribute is only needed if columns are hidden from the dom. the attribute takes as its value an integer between 1 and the total number of columns within the table, grid or treegrid. the aria-colindex defines an element's column index or position with respect to the total number of columns within a row. if all the columns are in the dom, this attribute is not necess...
...e aria-colindex attribute is only needed if columns are hidden from the dom. the attribute takes as its value an integer between 1 and the total number of columns within the table, grid or treegrid. the aria-colindex defines an element's column index or position with respect to the total number of columns within a row. if all the columns are in the dom, this attribute is not necessary. aria-rowindex attribute the aria-rowindex attribute is only needed if rows are hidden from the dom, to indicate which row, in the list of total rows, the current cell is in. the attribute, takes as its value an integer between 1 and the total number of rows within the table, grid, or treegrid, indicating the position, or index, of the cell. for example, a cell in the first row of the first header would lik...
...And 11 more matches
XBL Example - Archive of obsolete content
e 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 id="slideshow"> <content> <xul:vbox flex="1"> <xul:deck xbl:inherits="selectedindex" selectedindex="0" flex="1"> <children/> </xul:deck> <xul:hbox> <xul:button xbl:inherits="label=previoustext"/> <xul:label flex="1"/> <xul:button xbl:inherits="label=nexttext"/> </xul:hbox> </xul:vbox> </content> </binding> this binding creates the slideshow structure that we want. the flex attribute has been added to a number of elements ...
...attribute has been added to a number of elements so that it stretches in the right way. the label attributes on the two buttons inherit their values from the bound element. here, they inherit from two custom attributes, previoustext and nexttext. this makes it easy to change the labels on the buttons. the children of the element that the xbl is bound to will be placed inside the deck. the selectedindex is inherited by the deck, so we may set the initial page in the xul. the following xul file produces the result in the image. <box class="slideshow" previoustext="previous" nexttext="next" flex="1"> <button label="button 1"/> <checkbox label="checkbox 2"/> <textbox/> </box> the style sheet used here is: .slideshow { -moz-binding: url("slideshow.xml#slideshow"); } the first button...
..."slideshow.xml#slideshow"); } the first button, button 1 has been used as the first page of the deck. the label widget has not appeared as no value has been specified for it. we could set a value, but instead it will calculated later. page property next, a property that holds the current page will be added. when getting this custom property, it will need to retrieve the value of the selectedindex attribute of the deck, which holds the number of the currently displayed page. similarly, when setting this property, it will need to change the selectedindex attribute of the deck. in addition, the text widget will need to be updated to display which page is the current one. <property name="page" onget="return parseint(document.getanonymousnodes(this)[0].childnodes[0].getattribute('selected...
...And 10 more matches
mozIStorageValueArray
interface obtains provides methods to obtain data from a given result. for an introduction on how to use this interface, see the storage overview document. storage/public/mozistoragevaluearray.idlscriptable please add a summary to this article. ...
...des methods to obtain data from a given result. for an introduction on how to use this interface, see the storage overview document. storage/public/mozistoragevaluearray.idlscriptable please add a summary to this article. ...
...for an introduction on how to use this interface, see the storage overview document. storage/public/mozistoragevaluearray.idlscriptable please add a summary to this article. ...
...And 10 more matches
nsITreeBoxObject
d 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); void scrollbylines(in long numlines); void scrollbypages(in long numpages); void scrolltocell(in long row, in nsitreecolumn col); void scrolltocolumn(in nsitreecolumn col); void scrolltohorizontalposition(in long horizontalposition); ...
...); void scrollbylines(in long numlines); void scrollbypages(in long numpages); void scrolltocell(in long row, in nsitreecolumn col); void scrolltocolumn(in nsitreecolumn col); void scrolltohorizontalposition(in long horizontalposition); void invalidate(); void invalidatecolumn(in nsitreecolumn col); void invalidaterow(in long index); void invalidatecell(in long row, in nsitreecolumn col); void invalidaterange(in long startindex, in long endindex); void invalidatecolumnrange(in long startindex, in long endindex, in nsitreecolumn col); long getrowat(in long x, in long y); void getcellat(in long x, in long y, out long row, out nsitreecolumn col, out acstring childelt); void...
... view nsitreeview the view that backs the tree and that supplies it with its data. it is dynamically settable, either using a view at...
...And 10 more matches
jspage - Archive of obsolete content
++){d[b].implement(c);}};native.typize=function(a,b){if(!a.type){a.type=function(c){return($type(c)===b); };}};(function(){var a={array:array,date:date,function:function,number:number,regexp:regexp,string:string};for(var h in a){new native({name:h,initialize:a[h],protect:true}); }var d={"boolean":boolean,"native":native,object:object};for(var c in d){native.typize(d[c],c);}var f={array:["concat","indexof","join","lastindexof","pop","push","reverse","shift","slice","sort","splice","tostring","unshift","valueof"],string:["charat","charcodeat","concat","indexof","lastindexof","match","replace","search","slice","split","substr","substring","tolowercase","touppercase","valueof"]}; for(var e in f){for(var b=f[e].length;b--;){native.genericize(a[e],f[e][b],true);}}})();var hash=new native({name:"hash"...
...ument.prototype[b]=a;}});document.prototype={$family:{name:"document"}}; new document(document);array.implement({every:function(c,d){for(var b=0,a=this.length;b<a;b++){if(!c.call(d,this[b],b,this)){return false;}}return true; },filter:function(d,e){var c=[];for(var b=0,a=this.length;b<a;b++){if(d.call(e,this[b],b,this)){c.push(this[b]);}}return c;},clean:function(){return this.filter($defined); },indexof:function(c,d){var a=this.length;for(var b=(d<0)?math.max(0,a+d):d||0;b<a;b++){if(this[b]===c){return b;}}return -1;},map:function(d,e){var c=[]; for(var b=0,a=this.length;b<a;b++){c[b]=d.call(e,this[b],b,this);}return c;},some:function(c,d){for(var b=0,a=this.length;b<a;b++){if(c.call(d,this[b],b,this)){return true; }}return false;},associate:function(c){var d={},b=math.min(this.length,c.length...
...me:function(c,d){for(var b=0,a=this.length;b<a;b++){if(c.call(d,this[b],b,this)){return true; }}return false;},associate:function(c){var d={},b=math.min(this.length,c.length);for(var a=0;a<b;a++){d[c[a]]=this[a];}return d;},link:function(c){var a={}; for(var e=0,b=this.length;e<b;e++){for(var d in c){if(c[d](this[e])){a[d]=this[e];delete c[d];break;}}}return a;},contains:function(a,b){return this.indexof(a,b)!=-1; },extend:function(c){for(var b=0,a=c.length;b<a;b++){this.push(c[b]);}return this;},getlast:function(){return(this.length)?this[this.length-1]:null;},getrandom:function(){return(this.length)?this[$random(0,this.length-1)]:null; },include:function(a){if(!this.contains(a)){this.push(a);}return this;},combine:function(c){for(var b=0,a=c.length;b<a;b++){this.include(c[b]);}return this; },...
...And 9 more matches
tabs - Archive of obsolete content
Archive › Mozilla › XUL › tabs
« xul reference home [ examples | attributes | properties | methods | related ] a row of tabs. a tabs element should be placed inside a tabbox and should contain tab elements. nb: you can add some other elements to tabs such as button, but they will receive an index. activating them will not change the selectedindex. more information is available in the xul tutorial. ...
...d ] a row of tabs. a tabs element should be placed inside a tabbox and should contain tab elements. nb: you can add some other elements to tabs such as button, but they will receive an index. activating them will not change the selectedindex. more information is available in the xul tutorial. ...
...s. a tabs element should be placed inside a tabbox and should contain tab elements. nb: you can add some other elements to tabs such as button, but they will receive an index. activating them will not change the selectedindex. more information is available in the xul tutorial. ...
...And 9 more matches
Package management basics - Learn web development
ess return to accept the default parcel-experiment. version: the starting version number for the app: again, just press return to accept the default 1.0.0. description: a quick description of the app's purpose. type in something really simple, like "a simple npm package to learn about using npm", then press return. entry point: this will be the top-level javascript file of the app. the default index.js is fine for now — press return. test command, git repository, and keywords: press return to leave each of these blank for now. author: the author of the project. type your own name, and press return. license: the license to publish the package under: press return to accept the default for now. press return one more time to accept these settings. go into your parcel-experiment directory...
...the package under: press return to accept the default for now. press return one more time to accept these settings. go into your parcel-experiment directory and you should now find you've got a package.json file. open it up and it should look something like this: { "name": "parcel-experiment", "version": "1.0.0", "description": "a simple npm package to learn about using npm", "main": "index.js", "scripts": { "test": "echo \"error: no test specified\" && exit 1" }, "author": "chris mills", "license": "isc" } so this is the config file that defines your package. this is good for now, so let's move on. installing parcel run the following command to install parcel locally: npm install parcel-bundler once that's done all the things, we're now ready for some "modern clien...
...hine, you can recreate the same set up by running the command npm install, and npm will look at the dependencies and install them for you. one disadvantage is that parcel is only available inside our parcel-experiment app; you won't be able to run it in a different directory. but the advantages outweigh the disadvantages. setting up our example app anyway, on with the setup. ...
...And 9 more matches
IAccessibleHyperlink
s an image map. linked objects and anchors are implementation dependent. this interface is derived from iaccessibleaction. iaccessibleaction.nactions() is one greater than the maximum value for the indices used with the methods of this interface. furthermore, the object that implements this interface has to be connected implicitly or explicitly with an object that implements iaccessibletext. startindex() and endindex() are indices with respect to the text exposed by iaccessibletext. this interface provides access to a single object which can have multiple actions. an example is an image map which is an image with multiple 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 multiple actions such ...
...t and their anchortargets would reference urls or the objects that would be activated. this use case demonstrates that in some cases there is no need for iaccessiblehyperlink to derive from iaccessibleaction. as a result it may be removed in a later version of the idl and it is suggested that implementations should not rely on the inheritance. method overview [propget] hresult anchor([in] long index, [out] variant anchor ); [propget] hresult anchortarget([in] long index, [out] variant anchortarget ); [propget] hresult endindex([out] long index ); [propget] hresult startindex([out] long index ); [propget] hresult valid([out] boolean valid ); methods anchor() returns an object that represents the link anchor, as appropriate for the link at the specified index. [propget] hresult anch...
...anchor this is an implementation dependent value. ...
...And 9 more matches
Stacking context example 2 - CSS: Cascading Style Sheets
the reason is that they do not belong to the same stacking context. ...
...the reason is that they do not belong to the same stacking context. ...
...the reason is that they do not belong to the same stacking context. ...
...And 9 more matches
Iteration protocols - JavaScript
le's @@iterator method doesn't return an iterator object, then it's considered a non-well-formed iterable. ...
...n it's considered a non-well-formed iterable. ...
...ng one is likely to result in runtime errors or buggy behavior: let nonwellformediterable = {}; nonwellformediterable[symbol.iterator] = () => 1; [...nonwellformediterable]; // typeerror: [] is not a function iterator examples simple iterator function makeiterator(array) { let nextindex = 0 return { next: function() { return nextindex < array.length ? ...
...And 9 more matches
menulist - Archive of obsolete content
element. to create the drop-down, put a menupopup inside the menulist containing the choices as menuitem elements. the command event may be used to execute code when the menulist selection changes. more information is available in the xul tutorial. ...
...n changes. more information is available in the xul tutorial. ...
...tion is available in the xul tutorial. ...
...And 8 more matches
tree - Archive of obsolete content
Archive › Mozilla › XUL › tree
utorial. also tree widget changes. relevant accessbility guidelines provide alternative access (for example, via menus) to column picker and for header behaviors like sorting (these have no default keyboard access). ...
...rovide alternative access (for example, via menus) to column picker and for header behaviors like sorting (these have no default keyboard access). ...
...access). ...
...And 8 more matches
Debugging Table Reflow
ell 3</td> <td>cell 4</td> </tr> </table> rendering: <colgroup><col><col width="50%"><col width="1*"><col></colgroup>cell 1cell 2cell 3cell 4 it will produce the following log at the entrance of assignnonpctcolwidths: assignnonpctcolwidths en max=4500 count=0 ***start table dump*** mcolwidths=-1 -1 -1 -1 col frame cache -> 0=00b93138 1=00b931f0 2=024dd728 3=024dd780 **start col dump** colindex=0 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **end col dump** **start col dump** colindex=1 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **end col dump** **start col dump** colindex=2 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **end col dump** **start col dump** colindex=3 isanonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -...
...rance (ex for leaving a routine). the first line of the data dump shows that no width has yet been assigned to the columns mcolwidths=-1 -1 -1 -1, -1 stands for: #define width_not_set -1 this is followed by a reference to the column frame pointers: col frame cache -> 0=00b93138 1=00b931f0 2=024dd728 3=024dd780 this is followed by the information which width has been set for each column. the index of the column, whether it is anonymous and what kind of constrained has been appliedcolindex=0 isanonymous=0 constraint=0. the following constraint types are known: enoconstraint = 0, epixelconstraint = 1, // pixel width epercentconstraint = 2, // percent width eproportionconstraint = 3, // 1*, 2*, etc. cols attribute assigns 1* e0proportionconstraint = 4 ...
... width after the table has been balanced, considering all of the others in the last log snippet none of these width's has been set. ...
...And 8 more matches
Eclipse CDT Manual Setup
hat the eclipse cdt page isn't hugely cluttered with mostly redundant information, make setting up eclipse 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 configuration is not done automatically yet). some of it like the section on building the index and usage tips are still relevant, and other parts still may provide useful background information to understand it in more detail on how eclipse works. you can expect it to take an hour or so to work through these instructions if you're doing so for the first time. (this assumes that you already have a copy of the mozilla source, and that you have also built the source so that you have a pre-...
...essary), this section provides some background on what ides need in order to provide advanced code assistance, and what eclipse cdt needs in particular. to be able to provide really good code assistance for a project's source code, ides like eclipse need to carry out a thorough static analysis of the project's source files, to build up a picture of the code (what eclipse is trying to do when it "indexes" the source.) static analysis involves parsing the source files, so naturally it can only produce good results if it has a sensible set of preprocessor defines, include paths and pre-include files for each source file. since eclipse doesn't initially have any of this information, the code assistance that it's able to provide out of the box is pretty broken. for projects the size and complexi...
... these requirements aren't a very good fit with the typical mozilla developer's wish to minimize build times, implying parallelized, silenced builds. the consequences of the above observations are this: it is strongly recommended that you invoke your normal (re)builds from the command line, externally of eclipse. below we will configure eclipse's build step so that you use it on...
...And 8 more matches
IAccessibleAction
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. ...
... 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. ...
...he 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 8 more matches
nsINavHistoryResultObserver
annoname); void nodedateaddedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodehistorydetailschanged(in nsinavhistoryresultnode anode, in prtime anewvisitdate, in unsigned long anewaccesscount); void nodeiconchanged(in nsinavhistoryresultnode anode); void nodeinserted(in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode anode, in unsigned long anewindex); void nodekeywordchanged(in nsinavhistoryresultnode anode, in autf8string anewkeyword); void nodelastmodifiedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodemoved(in nsinavhistoryresultnode anode, in nsinavhistorycontainerresultnode aoldparent, in unsigned long aoldindex, in nsinavhistorycontainerresultnode anewparent, in unsigned long anewindex); void noderemove...
...elastmodifiedchanged(in nsinavhistoryresultnode anode, in prtime anewvalue); void nodemoved(in nsinavhistoryresultnode anode, in nsinavhistorycontainerresultnode aoldparent, in unsigned long aoldindex, in nsinavhistorycontainerresultnode anewparent, in unsigned long anewindex); void noderemoved(in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode aitem, in unsigned long aoldindex); void nodereplaced(in nsinavhistorycontainerresultnode aparentnode, in nsinavhistoryresultnode aoldnode, in nsinavhistoryresultnode anewnode, in unsigned long aindex); void nodetagschanged(in nsinavhistoryresultnode anode); void nodetitlechanged(in nsinavhistoryresultnode anode, in autf8string anewtitle); void nodeurichanged(in nsinavhistoryresultnode anode, in autf8string anewuri); vo...
... value for the last visit date and time for the node. anewaccesscount the new access count value for the node. nodeiconchanged() called right after a node's icon property has changed. void nodeiconchanged( in nsinavhistoryresultnode anode ); parameters anode the node whose icon has changed. nodeinserted() called when an item is inserted into a container. ...
...And 8 more matches
Dragging and Dropping Multiple Items - Web APIs
th 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 multiple items using some additional non-standard methods. these are methods that mirror the types property as well as the getdata(), setdata() and cleardata() methods, however, they take an additional argument that specifies the index of the item to retrieve, modify or remove. the drag processing described in this document use the datatransfer interface. this processing does not use the datatransferitem interface nor the datatransferitemlist interface. setting and getting with indices the mozsetdataat() method allows you to add multiple items during a dragstart event. this function similarly to setdata() var dt = event.dat...
...atransferitemlist interface. setting and getting with indices the mozsetdataat() method allows you to add multiple items during a dragstart event. this function similarly to setdata() var dt = event.datatransfer; dt.mozsetdataat("text/plain", "data to drag", 0); dt.mozsetdataat("text/plain", "second data to drag", 1); this example adds two items to be dragged. the last argument specifies the index of the item to add. you should add them in order starting with 0 as you cannot add items at positions farther than the last item, however you can replace existing items by using indices you have already added. using 0 as the index is equivalent to calling setdata(). you can clear an item using the mozcleardataat() method. event.datatransfer.mozcleardataat("text/plain", 1); caution: removing t...
...add them in order starting with 0 as you cannot add items at positions farther than the last item, however you can replace existing items by using indices you have already added. using 0 as the index is equivalent to calling setdata(). you can clear an item using the mozcleardataat() method. event.datatransfer.mozcleardataat("text/plain", 1); caution: removing the last format for a particular index will remove that item entirely, shifting the remaining items down, so the later items will have different indices. for example: var dt = event.datatransfer; dt.mozsetdataat("text/uri-list", "url1", 0); dt.mozsetdataat("text/plain", "url1", 0); dt.mozsetdataat("text/uri-list", "url2", 1); dt.mozsetdataat("text/plain", "url2", 1); dt.mozsetdataat("text/uri-list", "url3", 2); dt.mozsetdataat(...
...And 8 more matches
SVGLengthList - Web APIs
svg length list interface the svglengthlist defines a list of svglength objects. an svglengthlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...ted as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...in an exception being thrown. ...
...And 8 more matches
SVGNumberList - Web APIs
svg number list interface the svgnumberlist defines a list of svgnumber objects. an svgnumberlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. note: starting in gecko 5.0,the svgnumberlist dom interface is now indexable and can be accessed like arrays. ...
...s read only, which means that attempts to modify the object will result in an exception being thrown. note: starting in gecko 5.0,the svgnumberlist dom interface is now indexable and can be accessed like arrays. ...
...exception being thrown. note: starting in gecko 5.0,the svgnumberlist dom interface is now indexable and can be accessed like arrays. ...
...And 8 more matches
SVGStringList - Web APIs
st interface the svgstringlist defines a list of domstring objects. an svgstringlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...ringlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
... to modify the object will result in an exception being thrown. ...
...And 8 more matches
SVGTransformList - Web APIs
svg transform list interface the svgtransformlist defines a list of svgtransform objects. an svgtransformlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
..., which means that attempts to modify the object will result in an exception being thrown. ...
...hrown. ...
...And 8 more matches
ARIA: tab role - Accessibility
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 enclosing our group of content in a div, with our tablist having an aria-label to label it for assistive technology. each tab is a button with the attributes previously mentioned. ...
...nts with tabpanel to create an interactive group of tabbed content. here we are enclosing our group of content in a div, with our 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 javascript. 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"> ...
...ere 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. ...
...And 8 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
: border-box; box-sizing: border-box; } /* preview color */ .ui-color-picker .preview { width: 95px; height: 53px; margin: 5px; margin-top: 10px; border: 1px solid #ddd; background-image: url("images/alpha.png"); float: left; position: relative; } .ui-color-picker .preview:before { height: 100%; width: 50%; left: 50%; top: 0; content: ""; background: #fff; position: absolute; z-index: 1; } .ui-color-picker .preview-color { width: 100%; height: 100%; background-color: rgba(255, 0, 0, 0.5); position: absolute; z-index: 1; } .ui-color-picker .switch_mode { width: 10px; height: 20px; position: relative; border-radius: 5px 0 0 5px; border: 1px solid #ddd; background-color: #eee; left: -12px; top: -1px; z-index: 1; transition: all 0.5s; } .ui-color-picker .switch_...
...8b20; } /* dropdown select button */ .ui-dropdown-select { padding: 0 0.75em; color: #fff; line-height: 2em; } /* dropdown list */ .ui-dropdown-list { width: 100%; height: 150px; max-height: 150px; margin: 0; padding: 0 0.3em; border: 1px solid #3490d2; border-color: #208b20; background: #666; background-color: #eef1f5; color: #000; position: absolute; top: 100%; left: 0; z-index: 100; overflow: hidden; transition: all 0.3s; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-dropdown-list:hover { overflow: auto; } .ui-dropdown-list[data-hidden='true'] { height: 0 !important; opacity: 0; visibility: hidden; } .ui-dropdown[data-position='left'] .ui-dropdown-list { left: -100%; top: 0; } .ui-dropdown[data-position='rig...
...container { width: 1000px; height: 100%; display: table; margin: 0 auto; } #gradient-container { width: 450px; height: 250px; min-width: 8px; min-height: 8px; margin: 100px auto; border: 1px solid #ddd; position: relative; } #gradient-container[data-alpha="true"]:after { content: ""; width: 100%; height: 100%; background: url('images/canvas-pattern.png'); position: absolute; z-index: -1; } /** * gradient axis */ .gradient-axis { width: 125%; height: 4px; margin: -3px 0 0 0; border: 1px solid #ccc; position: absolute; top: 50%; left: 0; opacity: 0.5; } .gradient-axis[data-active='true'] { opacity: 1; z-index: 1; } .gradient-axis:after { content: ""; width: 25px; height: 100%; background-color: #ccc; position: absolute; left: 0; top: 0; } .gradient-axi...
...And 8 more matches
Routing in Ember - Learn web development
ed to reorganize it a bit to handle a different view for the "active" and "completed" todos. an ember application has a default "application" route, which is tied to the app/templates/application.hbs template. because that application template is the entry point to our todo app, we'll need to make some changes to allow for routing. creating the routes let's start by creating three new routes: "index", "active" and "completed". to do this you’ll need to enter the following commands into your terminal, inside the root directory of your app: ember generate route index ember generate route completed ember generate route active the second and third commands should have not only generated new files, but also updated an existing file, app/router.js. it contains the following contents: import e...
...ckly see how the entire app is structured. it also tells ember how to interact with your route, such as when loading arbitrary data, handling errors while loading that data, or interpreting dynamic segments of the url. since our data is static, we won't get to any of those fancy features, but we'll still make sure that the route provides the minimally required data to view a page. creating the "index" route did not add a route definition line to router.js, because like with url navigation and javascript module loading, "index" is a special word that indicates the default route to render, load, etc. to adjust our old way of rendering the todolist app, we'll first need to replace the todolist component invocation from the application template with an {{outlet}} call, which means "any sub-route...
...d that indicates the default route to render, load, etc. to adjust our old way of rendering the todolist app, we'll first need to replace the todolist component invocation from the application template with an {{outlet}} call, which means "any sub-route will be rendered in place here". go to the todomvc/app/templates/application.hbs file and replace <todolist /> with {{outlet}} next, in our index.hbs, completed.hbs, and active.hbs templates (also found in the templates directory) we can for now just enter the todolist component invocation. in each case, replace {{outlet}} with <todolist /> so at this point, if you try the app again and visit any of the three routes localhost:4200 localhost:4200/active localhost:4200/completed you'll see exactly the same thing. at each url, the te...
...And 7 more matches
Getting started with React - Learn web development
browser tab. your browser will display something like this: application structure create-react-app gives us everything we need to develop a react application. its initial file structure looks like this: moz-todo-react ├── readme.md ├── node_modules ├── package.json ├── package-lock.json ├── .gitignore ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json └── src ├── app.css ├── app.js ├── app.test.js ├── index.css ├── index.js ├── logo.svg └── serviceworker.js the src directory is where we'll spend most of our time, as it's where the source code for our application lives. the public directory contains files that will be read by your br...
...react injects your code into this file so that your browser can run it. there's some other markup that helps create-react-app function, so take care not to edit it unless you know what you're doing. you very much should change the text inside the <title> element in this file to reflect the title of your application. ...
...: function app() { return ( <div classname="app"> <header classname="app-header"> <img src={logo} classname="app-logo" alt="logo" /> <p> hello, world! </p> </header> </div> ); } export statements at the very bottom of the app.js file, the statement export default app makes our app component available to other modules. ...
...And 7 more matches
source-editor.jsm
back); void removeeventlistener(string aeventtype, function acallback); undo stack operations boolean canredo(); boolean canundo(); void endcompoundchange(); boolean redo(); void resetundo(); void startcompoundchange(); boolean undo(); display management operations void focus(); number gettopindex(); boolean hasfocus(); void settopindex(number atopindex); content management operations number getcharcount(); string getindentationstring(); string getlinedelimiter(); number getlinecount(); number getlineend(number alineindex, boolean aincludedelimiter); number getlinestart(number alineindex); string ge...
...you can then use this value to detect when the contents of the text are ...
...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. ...
...And 7 more matches
Places Developer Guide
kmarked. var bookmarkuri = cc["@mozilla.org/network/io-service;1"] .getservice(ci.nsiioservice) .newuri("http://www.mozilla.com", null, null); var bookmarkid = bookmarks.insertbookmark( bookmarks.toolbarfolder, // the id of the folder the bookmark will be placed in. bookmarkuri, // the uri of the bookmark - an nsiuri object. ...
...uri of the bookmark - an nsiuri object. bookmarks.default_index, // the position of the bookmark in its parent folder. "my bookmark title"); // the title of the bookmark. creating a folder var folderid = bookmarks.createfolder( bookmarks.toolbarfolder, // the id of the folder the new folder will be placed in. "my folder title", // the title of the new folder. bookmarks.default_index); // the position of the new folder in its parent folder. creating a separator var separatorid = bookmarks.insertseparator( bookmarks.toolbarfolder, // the id of the folder the separator will be placed in. bookmarks.default_index); // the position of the separator in its parent folder. creating a livemark var ioservice = cc["@mozilla.org/network/io-service;1"] .getserv...
...k-service;2"] .getservice(ci.nsilivemarkservice); livemarks.createlivemark(bookmarks.toolbarfolder, // the id of the folder the livemark will be placed in "my livemark title", // the title of the livemark siteuri, // the uri of the site. a nsiuri object. feeduri, // the uri of the actual feed. a nsiuri object. ...
...And 7 more matches
nsIAccessibleText
if set < 0 then caret will be placed a...
...if set < 0 then caret will be placed at the end of the t...
...if set < 0 then caret will be placed at the end of the text. charactercount long read only. defaulttextattributes nsipersistentproper...
...And 7 more matches
nsIDOMXULSelectControlElement
dom/interfaces/xul/nsidomxulselectcntrlel.idlscriptable please add a summary to this article. ...
... dom/interfaces/xul/nsidomxulselectcntrlel.idlscriptable please add a summary to this article. ...
...rfaces/xul/nsidomxulselectcntrlel.idlscriptable please add a summary to this article. ...
...And 7 more matches
nsINavHistoryResultViewer
detailschanged(in nsinavhistoryresultnode anode, in prtime anewvisitdate, in unsigned long anewaccesscount); void nodeiconchanged(in nsinavhistoryresultnode anode); void nodekeywordchanged(in nsinavhistoryresultnode anode, in autf8string anewkeyword); void nodemoved(in nsinavhistoryresultnode anode, in nsinavhistorycontainerresultnode aoldparent, in unsigned long aoldindex, in nsinavhistorycontainerresultnode anewparent, in unsigned long anewindex); void nodetitlechanged(in nsinavhistoryresultnode anode, in autf8string anewtitle); void noderemoved(in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode anode, in unsigned long aoldindex); void nodetagschanged(in nsinavhistoryresultnode anode); void nodeurichanged...
...although this attribute is read-write, you should n...
...although this attribute is read-write, you should not alter it directly; instead, use the nsinavhistoryresult.viewer attribute to set the viewer. methods containerclosed() called...
...And 7 more matches
Add to iPhoto
tead of a typed pointer. that's not really the ideal way to do things but saved some time for this simple example. some of this may change as i refine the example in the future; i'll update the article if and when that happens. some global types there are a few global data types used by all of our frameworks. these are declared near the top of the code: const osstatus = ctypes.int32_t; const cfindex = ctypes.long; const optionbits = ctypes.uint32_t; osstatus used to represent the status code resulting from an operation. cfindex a core foundation long integer type used to represent indexes into lists. i debated including this in the corefoundation object, and probably would have if i were being more formal, but opted against it for clarity's sake. optionbits a 32-bit bit field data t...
...the shutdown() method comes in: shutdown: function() { this.lib.close(); } select api declarations let's take a look at a few of the key apis we declare for core foundation, to see how it's done. cfrange cfrange is a structure that identifies a range; that is, it identifies an offset to an item in a list and a number of items. in c, the declaration looks like this: typedef struct { cfindex location; cfindex length; } cfrange; to declare this for use with js-ctypes, we use the following code: this.cfrange = new ctypes.structtype("cfrange", [ {'location': ctypes.int32_t}, {'length': ctypes.int32_t}]); this defines corefoundation.cfrange to represent this data type, comprised of two 32-bit integer fields called location and length. g...
...the interesting things to note about the declaration of corefoundation.cfurlcreatefromfilesystemrepresentation() are: it returns a cfurlref, which is an opaque pointer similar to the cfstringref we noted above. ...
...And 7 more matches
Using Fetch - Web APIs
sumes the text is utf-8, and doesn't handle fetch errors). ...
... await fetch(fileurl); const reader = response.body.getreader(); let { value: chunk, done: readerdone } = await reader.read(); chunk = chunk ? utf8decoder.decode(chunk) : ''; const re = /\n|\r|\r\n/gm; let startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(startindex); ({ value: chunk, done: readerdone } = await reader.read()); chunk = remainder + (chunk ? ...
...decoder.decode(chunk) : ''; const re = /\n|\r|\r\n/gm; let startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(startindex); ({ value: chunk, done: readerdone } = await reader.read()); chunk = remainder + (chunk ? ...
...And 7 more matches
ReadableStreamDefaultReader.read() - Web APIs
ding on line boundaries and converting from uint8array to strings. ...
...onse = await fetch(fileurl); let reader = response.body.getreader(); let {value: chunk, done: readerdone} = await reader.read(); chunk = chunk ? utf8decoder.decode(chunk) : ""; let re = /\r\n|\n|\r/gm; let startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(startindex); ({value: chunk, done: readerdone} = await reader.read()); chunk = remainder + (chunk ? ...
...utf8decoder.decode(chunk) : ""; let re = /\r\n|\n|\r/gm; let startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(startindex); ({value: chunk, done: readerdone} = await reader.read()); chunk = remainder + (chunk ? ...
...And 7 more matches
SVGPathSegList - Web APIs
svg path segment list interface this interface defines a list of svgpathseg objects. ...
...ist of svgpathseg objects. ...
... also implement none methods void clear() svgpathseg initialize(in svgpathseg newitem) svgpathseg getitem(in unsigned long index) svgpathseg insertitembefore(in svgpathseg newitem, in unsigned long index) svgpathseg replaceitem(in svgpathseg newitem, in unsigned long index) svgpathseg removeitem(in unsigned long index) svgpathseg appenditem(in svgpathseg newitem) properties readonly unsigned long numberofitems normative document svg 1.1 (2nd edition) properti...
...And 7 more matches
SVGPointList - Web APIs
pointlist object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...ify the object will result in an exception being thrown. ...
...erview also implement none methods void clear() svgpoint initialize(in svgpoint newitem) svgpoint getitem(in unsigned long index) svgpoint insertitembefore(in svgpoint newitem, in unsigned long index) svgpoint replaceitem(in svgpoint newitem, in unsigned long index) svgpoint removeitem(in unsigned long index) svgpoint appenditem(in svgpoint newitem) properties readonly unsigned long numberofitems normative document svg 1.1 (2nd edition) properties ...
...And 7 more matches
WebGLRenderingContext.vertexAttrib[1234]f[v]() - Web APIs
v0, v1, v2, v3 a floating point number for the vertex attribute value. ...
... v0, v1, v2, v3 a floating point number for the vertex attribute value. ...
... v0, v1, v2, v3 a floating point number for the vertex attribute value. ...
...And 7 more matches
Tree Selection - Archive of obsolete content
e items, the event handler is not called until the user stops. this results in a performance improvement. this also means that the highlight will appear on several items even though the select event is never fired for those items. the syntax of the onselect() event handler is shown below. <tree id="treeset" onselect="alert('you selected something!');"> tree indices the tree has a property currentindex, which can be used to get the currently selected item, where the first row is 0. child items are included in the count just after their parents. this means that if there are 3 top-level items and each has two child items, there will be a total of 9 items. the first item (at index 0) will be the first top-level item. the next item at index 1 will be its first child. the second child will be at ind...
...multiple selection for trees that allow multiple selection, getting the list of selected rows is a bit more complicated. ...
...multiple selection for trees that allow multiple 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. ...
...And 6 more matches
Tree View Details - Archive of obsolete content
st rows and higher values for inner rows. the tree will use this information to determine the hierarchical structure of the rows. in addition to the getlevel method, there is a hasnextsibling function which, given a row, should return true if there is another row afterwards at the same level. this function is used, specifically, to draw the nesting lines along the side of the tree. the getparentindex method is expected to return the parent row of a given row, that is, the row before it with a lower nesting value. all of these methods must be implemented by the view for children to be handled properly. containers there are also three functions, iscontainer, iscontainerempty and iscontaineropen that are used to handle a parent item in the tree. the iscontainer method should return true if ...
...ill be treated like a container. when the user clicks the twisty to open a row, the tree will call the view's toggleopenstate method. the view should then perform any necessary operations to retrieve the child rows and then update the tree with the new rows. ...
... tree with the new rows. note: as of this writing (gecko 2.0), custom nsitreeview implementations must be prepared to handle a call to toggleopenstate for any row index which returns true for a call to iscontainer, regardless of whether the container is empty. review of the methods here is a review of the methods needed to implement hierarchical views: getlevel(row) hasnextsibling(row, afterindex) getparentindex(row) iscontainer(row) iscontainerempty(row) iscontaineropen(row) toggleopenstate(row) the afterindex argument to hasnextsibling function is used as optimization to only start looking for the next sibling after that point. for instance, the caller might already know where the next sibling might possibly be. imagine a situation where a row had subrows and those subrows had child r...
...And 6 more matches
Setting up CDT to work on SpiderMonkey
rested in getting code hints, autocompletion, function, and field usage information and general ide goodness for c/c++. there is a guide for setting up cdt to work with the mozilla codebase, but it does not cover setting things up for just spidermonkey instead of the whole mozilla codebase. hence, here is a short-ish guide for doing just that. step 1 - preparing a spidermonkey build for cdt to index all code, spidermonkey has to be built with debug information. the full process of and requisites for doing so are described here. please follow those instructions up until the point of invoking configure. the initial build was in clang, so the modified build commands look like this: mkdir _dbg.obj cd _dbg.obj cc='clang -qunused-arguments -fcolor-diagnostics' cxx='clang++ -qunused-arguments -fc...
...ate a workspace somewhere. select "new > makefile project with existing code" from the "file" menu. give the project a name that you like ("spidermonkey" has a nice ring to it) and use the "browser…" button to select your checkout's js/src folder for the "existing code location". choose the correct toolchain for your platform (i.e. macos x gcc on mac) and click "finish". ...
...ith existing code" from the "file" menu. give the project a name that you like ("spidermonkey" has a nice ring to it) and use the "browser…" button to select your checkout's js/src folder for the "existing code location". choose the correct toolchain for your platform (i.e. macos x gcc on mac) and click "finish". at this point, the indexer starts running and already produces a pretty decent index of much of spidermonkey. ...
...And 6 more matches
nsISessionStore
ls to be successful. starting in firefox 3.5, this preference is no longer used. ...
...o 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 astr...
...And 6 more matches
Element.classList - Web APIs
Web › API › Element › classList
early compliant behavior for ie 6-9. check it out: // 1. ...
...implement the barebones domtokenlist livelyness polyfill if (typeof domtokenlist !== "function") (function(window){ var document = window.document, object = window.object, hasownprop ...
...reason}).prototype = new error; var wsre = /[\11\12\14\15\40]/, wsindex = 0, checkifvalidclasslistentry = function(o, v) { if (v === "") throw new domexception( "failed to execute '" + o + "' on 'domtokenlist': the token provided must not be empty." ); if((wsindex=v.search(wsre))!==-1) throw new domexception("failed to execute '"+o+"' on 'domtokenlist': " + "the token provided ('"+v[wsindex]+"') contains html space characters, which are not valid in tokens."); } // 2. implement the barebones domtokenlist livelyness polyfill if (typeof domtokenlist !== "function") (function(window){ var document = window.document, object = window.object, hasownprop = object.prototype.hasownproperty; var defineproperty = object.defineproperty, allowtokenlistconstruction = 0, skippropchange = 0...
...And 6 more matches
IDBDatabase - Web APIs
thus, you cannot execute commands, access data, or open anything outside of a transaction. ...
...thus, you cannot execute commands, access data, or open anything outside of a transaction. ...
... object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. the interface provides the only way to get and manage versions of the database. note: this feature is available in web workers. note: everything you do in indexeddb always happens in the context of a transaction, representing interactions with data in the database. all objects in indexeddb — including object stores, indexes, and cursors — are tied to a particular transaction. thus, you cannot execute commands, access data, or open anything outside of a transaction. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; p...
...And 6 more matches
IDBOpenDBRequest.onupgradeneeded - Web APIs
rkers. syntax idbopendbrequest.onupgradeneeded = function(event) { ... }; example in the following example you can see the onupgradeneeded handler being used to update the database structure if a database with a higher version number is loaded. for a full working example, see our to-do notifications app (view example live.) var db; // request version 3 of the database. var request = window.indexeddb.open("library", 3); // this event handles the event whereby a new version of the // database needs to be created. either one has not been created // before, or a new version number has been submitted via the // window.indexeddb.open line above. request.onupgradeneeded = function(event) { db = request.result; db.onerror = function(errorevent) { note.innerhtml += '<li>error loading da...
...r has been submitted via the // window.indexeddb.open line above. request.onupgradeneeded = function(event) { db = request.result; db.onerror = function(errorevent) { note.innerhtml += '<li>error loading database.</li>'; }; if (event.oldversion < 1) { // version 1 is the first version of the database. var store = db.createobjectstore("books", {keypath: "isbn"}); var titleindex = store.createindex("by_title", "title", {unique: true}); var authorindex = store.createindex("by_author", "author"); } if (event.oldversion < 2) { // version 2 introduces a new index of books by year. ...
...t version of the database. var store = db.createobjectstore("books", {keypath: "isbn"}); var titleindex = store.createindex("by_title", "title", {unique: true}); var authorindex = store.createindex("by_author", "author"); } if (event.oldversion < 2) { // version 2 introduces a new index of books by year. var bookstore = request.transaction.objectstore("books"); var yearindex = bookstore.createindex("by_year", "year"); } if (event.oldversion < 3) { // version 3 introduces a new object store for magazines with two indexes. ...
...And 6 more matches
WebGLRenderingContext.vertexAttribPointer() - Web APIs
size a glint specifying the number of components per vertex attribute. must be 1, 2, 3, or 4. ...
... size a glint specifying the number of components per vertex attribute. must be 1, 2, 3, or 4. ...
... size a glint specifying the number of components per vertex attribute. must be 1, 2, 3, or 4. ...
...And 6 more matches
ARIA: row role - Accessibility
nested within a grid, table or treegrid. a group of rows can be nested within a grid, table or treegrid directly, or within a rowgroup in one of those containers. each row contains child cells. these cells can be of different types, depending on whether they are column or row headers, or grid or regular cells. a row can contain a number of attributes clarifying the row's role, including aria-colindex, aria-level, aria-rowindex, and aria-selected. if the row is within a treegrid, rows can include the aria-expanded attribute, using the attribute to indicate the present status. this is not the case for an ordinary table or grid, in which the aria-expanded attribute is not present. to create an interactive widget that has a tabular structure, use the grid pattern instead. if the interaction pro...
...elevant if the row is in an interactive container, such as a grid or treegrid, but not relevant if the row is in a table. the aria-selected attribute can take one of three values, or be omitted: aria-selected="true: row is currently selected aria-selected="false": row is not currently selected. aria-selected="undefined" or the attribute is missing: the row is not selectable. aria-colindex attribute the aria-colindex attribute is only needed if columns are hidden from the dom. it is generally placed on row children, rather than on the row itself. if the columns displayed are contiguous, then it can be placed on the row. the attribute takes as its value an integer between 1 and the total number of columns within the table, grid or treegrid. when placed on the row, the aria-c...
...ttribute the aria-colindex attribute is only needed if columns are hidden from the dom. it is generally placed on row children, rather than on the row itself. if the columns displayed are contiguous, then it can be placed on the row. the attribute takes as its value an integer between 1 and the total number of columns within the table, grid or treegrid. when placed on the row, the aria-colindex defines an element's column index or position with respect to the total number of columns within a row. for example, in a table with 15 columns, and columns 4, 5, and 6 are in the dom, aria-colindex="4" could be set on every row. ...
...And 6 more matches
Border-image generator - CSS: Cascading Style Sheets
own select button */ .ui-dropdown-select { height: inherit; padding: 0 0.75em; color: #fff; line-height: 2em; } /* dropdown list */ .ui-dropdown-list { width: 100%; height: 150px; max-height: 150px; margin: 0; padding: 0 0.3em; border: 3px solid #3490d2; border-color: #208b20; background: #666; background-color: #eef1f5; color: #000; position: absolute; top: 2em; left: 0; z-index: 100; overflow: hidden; transition: all 0.3s; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-dropdown-list:hover { overflow: auto; } .ui-dropdown-list[data-hidden='true'] { height: 0 !important; opacity: 0; visibility: hidden; } .ui-dropdown[data-position='left'] .ui-dropdown-list { left: -100%; top: 0; } .ui-dropdown[data-position='rig...
...l:focus { box-shadow: 0px 0px 3px -1px #379b4a; /*#68ace8; */ border-color: rgba(55, 155, 74, 0.5); width: 450px; } /* * visible area */ #preview_section { position: relative; min-height: 400px; } /* image control */ #subject { width: 300px; height: 300px; background-repeat: no-repeat; background-size: 100%; background-color: #fff; border: 1px solid #ccc; position: absolute; z-index: 10; top: 15%; left: 10%; box-shadow: 0 0 3px 0 #bababa; transition-property: width, height; transition-duration: 0.1s; } #subject .guideline { background-color: rgba(255, 255, 255, 0.7); border: 1px solid rgba(0, 0, 0, 0.3); position: absolute; } #subject .guideline:hover { background-color: #f00; } #subject .guideline[data-active] { background-color: #f00; z-index: 10; } #subjec...
...fo='top'] { top: -10px; left: -50px; } #subject .tooltip2[data-info='right'] { top: -30px; right: -20px; } #subject .tooltip2[data-info='bottom'] { top: -10px; right: -50px; } #subject .tooltip2[data-info='left'] { bottom: -30px; right: -20px; } /* preview */ #preview { width: 30%; height: 50%; background-color: #fff; text-align: center; overflow: hidden; position: absolute; z-index: 10; left: 60%; top: 15%; border-radius: 2px; border-image-width: 20px; border-image-repeat: round; border-style: solid; box-shadow: 0 0 3px 0 #bababa; } #preview .resize-handle { width: 10px; height: 10px; background: url("https://mdn.mozillademos.org/files/6027/resize.png") center center no-repeat; position: absolute; bottom: 0; right: 0; } #preview .resize-handle:hover { c...
...And 6 more matches
Stacking context example 1 - CSS: Cascading Style Sheets
« css « understanding css z-index stacking context example 1 let's start with a basic example. in the root stacking context we have two divs (div #1 and div #3), both relatively positioned, but without z-index properties. inside div #1 there is an absolutely positioned div #2, while in div #3 there is an absolutely positioned div #4, both without z-index properties. the only stacking context is the root context. without z-indexes, elements are stacked in order of occurrence. if div #2 is assigned a positive (non-zero and non-auto) z-index value, it is rendered above all the other divs. then if div #4 is also assigned a positive z-index greater than div #2's z-index, it is rendered above all the other divs including div #2. in this last example you can see that div #2 and div #4 a...
...this means that all their content, including div #2 and div #4, belongs to the same root stacking context. ...
...e z-index greater than div #2's z-index, it is rendered above all the other divs including div #2. in this last example you can see that div #2 and div #4 are not siblings, because they belong to different parents in the html elements' hierarchy. even so, stacking of div #4 with respect of div #2 can be controlled through z-index. it happens that, since div #1 and div #3 are not assigned any z-index value, they do not create a stacking context. this means that all their content, including div #2 and div #4, belongs to the same root stacking context. ...
...And 6 more matches
Array.prototype.filter() - JavaScript
the filter() method creates a new array with all elements that pass the test implemented by the provided 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 let newarray = arr.filter(callback(element[, index, [array]])[, thisarg]) parameters callback function is a predicate, to test each element of the array. return true to keep the element, false otherwise. it accepts three arguments: element the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array filter was called upon. thisargo...
... value to use as this when executing callback. return value a new array with the elements that pass the test. if no elements pass the test, an empty array will be returned. description filter() calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a value that coerces to true. ...
...ray with the elements that pass the test. if no elements pass the test, an empty array will be returned. description filter() calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a value that coerces to true. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. ...
...And 6 more matches
BigInt64Array - JavaScript
constructor bigint64array() creates a new bigint64array object. ...
....prototype.length returns the number of elements hold in the bigint64array. this is fixed at construction time and thus read only. instance methods bigint64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). bigint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). bigint64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). bigint64array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). bigint64array.prototype.filter() creates a n...
...ay.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). bigint64array.prototype.find() returns the found value in the array if an element in the array satisfies the provided testing function, or undefined if not found. see also array.prototype.find(). bigint64array.prototype.findindex() returns the found index in the array if an element in the array satisfies the provided testing function, or -1 if not found. see also array.prototype.findindex(). bigint64array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). bigint64array.prototype.includes() determines whether a typed array includes a certain element, returning true ...
...And 6 more matches
BigUint64Array - JavaScript
constructor biguint64array() creates a new biguint64array object. ...
...ototype.length returns the number of elements hold in the biguint64array. this is fixed at construction time and thus read only. instance methods biguint64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). biguint64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). biguint64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). biguint64array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). biguint64array.prototype.filter() creates ...
....prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). biguint64array.prototype.find() returns the found value in the array if an element in the array satisfies the provided testing function, or undefined if not found. see also array.prototype.find(). biguint64array.prototype.findindex() returns the found index in the array if an element in the array satisfies the provided testing function, or -1 if not found. see also array.prototype.findindex(). biguint64array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). biguint64array.prototype.includes() determines whether a typed array includes a certain element, returning tru...
...And 6 more matches
Float32Array - JavaScript
the float32array typed array represents an array of 32-bit floating point numbers (corresponding to the c float data type) in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor float32array() creates a new float32array object. static properties float32array.bytes_per_element returns a number value of the element size. 4 in the case of an float32array. float32array.name returns the string value of the constructor name. in the case of the float32array type: "float32array". static methods float32array.from() creates a new float32array from an ...
...loat32array.prototype.length returns the number of elements hold in the float32array. fixed at construction time and thus read only. instance methods float32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). float32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). float32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). float32array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). float32array.prototype.filter() creates a new ...
...rray.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). float32array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. see also array.prototype.find(). float32array.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). float32array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). float32array.prototype.includes() determines whether a typed array includes a certain element, returning true or...
...And 6 more matches
Float64Array - JavaScript
the float64array typed array represents an array of 64-bit floating point numbers (corresponding to the c double data type) in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor float64array() creates a new float64array object. static properties float64array.bytes_per_element returns a number value of the element size. 8 in the case of an float64array. float64array.name returns the string value of the constructor name. in the case of the float64array type: "float64array". static methods float64array.from() creates a new float64array from an...
...loat64array.prototype.length returns the number of elements hold in the float64array. fixed at construction time and thus read only. instance methods float64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). float64array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). float64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). float64array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). float64array.prototype.filter() creates a new ...
...rray.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). float64array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. see also array.prototype.find(). float64array.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). float64array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). float64array.prototype.includes() determines whether a typed array includes a certain element, returning true or...
...And 6 more matches
Uint16Array - JavaScript
constructor uint16array() creates a new uint16array object. ...
.... uint16array.prototype.length returns the number of elements hold in the uint16array. fixed at construction time and thus read only. instance methods uint16array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint16array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint16array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint16array.prototype.filter() creates a new arr...
...6array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). uint16array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. see also array.prototype.find(). uint16array.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). uint16array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). uint16array.prototype.includes() determines whether a typed array includes a certain element, returning true or f...
...And 6 more matches
Uint32Array - JavaScript
constructor uint32array() creates a new uint32array object. ...
.... uint32array.prototype.length returns the number of elements hold in the uint32array. fixed at construction time and thus read only. instance methods uint32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint32array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint32array.prototype.filter() creates a new arr...
...2array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). uint32array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. see also array.prototype.find(). uint32array.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). uint32array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). uint32array.prototype.includes() determines whether a typed array includes a certain element, returning true or f...
...And 6 more matches
Uint8ClampedArray - JavaScript
the uint8clampedarray typed array represents an array of 8-bit unsigned integers clamped to 0-255; if you specified a value that is out of the range of [0,255], 0 or 255 will be set instead; if you specify a non-integer, the nearest integer will be set. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). constructor uint8clampedarray() creates a new uint8clampedarray object. static properties uint8clampedarray.bytes_per_element returns a number value of the element size. 1 in the case of an uint8clampedarray. uint8clampedarray.name returns the string value of the constructor name. in the case of the uint8clampedarray type: "uint8clampedarray"...
...totype.length returns the number of elements hold in the uintclamped8array. fixed at construction time and thus read only. instance methods uint8clampedarray.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint8clampedarray.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint8clampedarray.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint8clampedarray.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint8clampedarray.prototype.filter() ...
...type.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). uint8clampedarray.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. see also array.prototype.find(). uint8clampedarray.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). uint8clampedarray.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). uint8clampedarray.prototype.includes() determines whether a typed array includes a certain element, returni...
...And 6 more matches
places/bookmarks - Archive of obsolete content
roup: group }) ]; // save `bookmarks` array -- notice we don't have `group` in the array, // although it needs to be saved since all bookmarks are children // of `group`. this will be saved implicitly. save(bookmarks).on("data", function (saved, input) { // a data event is called once for each item saved, as well // as implicit items, like `group` console.log(input === group || ~bookmarks.indexof(input)); // true }).on("end", function (saves, inputs) { // like the previous example, the "end" event returns an // array of all of our updated saves. only explicitly saved // items are returned in this array -- the `group` won't be // present here. console.log(saves[0].title); // "ran" console.log(saves[2].group.title); // "guitars" }); searching for bookmarks bookmarks can be q...
...s : object required options: name type title string the title for the bookmark. required. url string the url for the bookmark. required. optional options: name type group group the parent group that the bookmark lives under. defaults to the bookmarks.unsorted group. index number the index of the bookmark within its group. last item within the group by default. tags set a set of tags to be applied to the bookmark. group(options) creates an unsaved bookmark group instance. parameters options : object required options: name type title string the title for the group. required. ...
...ns) creates an unsaved bookmark group instance. parameters options : object required options: name type title string the title for the group. required. optional options: name type group group the parent group that the bookmark group lives under. defaults to the bookmarks.unsorted group. index number the index of the bookmark group within its parent group. last item within the group by default. separator(options) creates an unsaved bookmark separator instance. parameters options : object optional options: name type group group the parent group that the bookmark group lives under. defaults to the bookmarks.unsorted grou...
...And 5 more matches
radiogroup - Archive of obsolete content
dio buttons. only one radio button inside the group can be selected at a time. the radio buttons may either direct children of the radiogroup or descendants. place the radiogroup inside a groupbox if you would like a border or caption for the group. the radiogroup defaults to vertical orientation. more information is available in the xul tutorial. ...
...o buttons may either direct children of the radiogroup or descendants. place the radiogroup inside a groupbox if you would like a border or caption for the group. the radiogroup defaults to vertical orientation. more information is available in the xul tutorial. attributes disabled, focused, preference, tabindex, value properties accessibletype, disabled, focuseditem, itemcount, selectedindex, selecteditem, tabindex, value methods appenditem, checkadjacentelement, getindexofitem, getitematindex, insertitemat, removeitemat examples <radiogroup> <radio id="orange" label="red"/> <radio id="violet" label="green" selected="true"/> <radio id="yellow" label="blue"/> </radiogroup> attributes disabled type: boolean indicates whether the element is disabled or not. if...
...ems, is normally preferred to use of the attribute, as it may need to update additional state. focused type: boolean this attribute is true if the element is focused. preference type: id connects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. 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 script for your own use. ...
...And 5 more matches
Useful string methods - Learn web development
browsertype[browsertype.length-1]; the length of "mozilla" is 7, but because the count starts at 0, the character position is 6; using length-1 gets us the last character. finding a substring inside a string and extracting it sometimes you'll want to find if a smaller string is present inside a larger one (we generally say if a substring is present inside a string). ...
...ing a substring inside a string and extracting it sometimes you'll want to find if a smaller string is present inside a larger one (we generally say if a substring is present inside a string). this can be done using the indexof() method, which takes a single parameter — the substring you want to search for. if the substring is found inside the main string, it returns a number representing the index position of the substring — which character number of the main string the substring starts at. if the substring is not found inside the main string, it returns a value of -1. try this: browsertype.indexof('zilla'); this gives us a result of 2, because the substring "zilla" starts at position 2 (0, 1, 2 — so 3 characters in) inside "mozilla". such code could be used to filter strings. ...
...a'); this gives us a result of 2, because the substring "zilla" starts at position 2 (0, 1, 2 — so 3 characters in) inside "mozilla". such code could be used to filter strings. for example, we may have a list of web addresses and only want to print out the ones that contain "mozilla". this can be done in another way, which is possibly even more effective. ...
...And 5 more matches
XPCOM array guide
Mozilla › Tech › XPCOM › Guide › Arrays
the standard array classes are: nsiarray - a scriptable container for scriptable xpcom objects. ...
...g and removing members. nsimutablearray - a scriptable container for scriptable 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 for objects or primitive types (pointers, integers, and so on). the objects must define a default constructor and a copy constructor. to use indexof without providing a comparator, they must also define an operator==. for sorting without providing a comparator they must define an operator<. note that this class differs from the other array types by using unsigned indices. nscomarray<t> - a c++ class which provides a typesafe, reference-counted container for pointers to a single type of com object. nsautotarray<t, n> - a version of nstarra...
...ence counted, strong (*) note: concrete c++ arrays can be made read-only by declaring them const. for example: // handlelist cannot modify the array because of const void handlelist(const nstarray<t>&); in-place enumeration most of the arrays presented here provide callback-style means to enumerate members of an array. instead of incrementally accessing each element of the array by its index, the arrays provide a way to pass in a callback function that will be called for each element in the array. for most concrete c++ classes like nstarray<t> and nscomarray<t>, indexing should be faster than the callback-style enumeration, because accessing an indexed member of such an array is usually very fast, while enumeration has slight function call overhead. in the case of scriptable arrays ...
...And 5 more matches
IAccessibleEditableText
] long startoffset, [in] long endoffset, [in] bstr text ); hresult setattributes([in] long startoffset, [in] long endoffset, [in] bstr attributes ); methods copytext() copies the text range into the clipboard. the specified text between the two given indices is copied into the system clipboard. hresult copytext( [in] long startoffset, [in] long endoffset ); parameters startoffset start index of the text to moved into the clipboard. the valid range is 0..length. endoffset end index of the text to moved into the clipboard. the valid range is 0..length. return value e_invalidarg if bad [in] passed. s_ok. cuttext() deletes a range of text and copies it to the clipboard. the text between the two given indices is deleted from the text represented by this object and copied to the clipboard...
...ext to moved into the clipboard. the valid range is 0..length. return value e_invalidarg if bad [in] passed. s_ok. cuttext() deletes a range of text and copies it to the clipboard. the text between the two given indices is deleted from the text represented by this object and copied to the clipboard. hresult cuttext( [in] long startoffset, [in] long endoffset ); parameters startoffset start index of the text to be deleted. the valid range is 0..length. endoffset end index of the text to be deleted. the valid range is 0..length. return value e_invalidarg if bad [in] passed. s_ok. deletetext() deletes a range of text. the text between and including the two given indices is deleted from the text represented by this object. hresult deletetext( [in] long startoffset, [in] long endoffset )...
...alid range is 0..length. endoffset end index of the text to be deleted. the valid range is 0..length. return value e_invalidarg if bad [in] passed. s_ok. deletetext() deletes a range of text. the text between and including the two given indices is deleted from the text represented by this object. hresult deletetext( [in] long startoffset, [in] long endoffset ); parameters startoffset start index of the text to be deleted. the valid range is 0..length. endoffset end index of the text to be deleted. the valid range is 0..length. return value e_invalidarg if bad [in] passed. s_ok. inserttext() inserts text at the specified position. the specified string is inserted at the given index into the text represented by this object. hresult inserttext( [in] long offset, [in] bstr text ); para...
...And 5 more matches
IAccessibleHypertext
rits from: iaccessibletext last changed in gecko 1.9 (firefox 3) the iaccessiblehypertext interface is the main interface to expose hyperlinks in a document, typically a text document, that are used to reference other documents. a typical implementation is to implement this interface on the smallest text object such as a paragraph of text. method overview [propget] hresult hyperlink([in] long index, [out] iaccessiblehyperlink hyperlink ); [propget] hresult hyperlinkindex([in] long charindex, [out] long hyperlinkindex ); [propget] hresult nhyperlinks([out] long hyperlinkcount ); methods hyperlink() returns the specified link. the returned iaccessiblehyperlink object encapsulates the hyperlink and provides several kinds of information describing it. [propget] hresult hyperlink( [in] ...
...t] iaccessiblehyperlink hyperlink ); [propget] hresult hyperlinkindex([in] long charindex, [out] long hyperlinkindex ); [propget] hresult nhyperlinks([out] long hyperlinkcount ); methods hyperlink() returns the specified link. the returned iaccessiblehyperlink object encapsulates the hyperlink and provides several kinds of information describing it. [propget] hresult hyperlink( [in] long index, [out] iaccessiblehyperlink hyperlink ); parameters index this 0 based index specifies the hyperlink to return. hyperlink if the given index is valid, that is it lies in the interval from 0 to the number of links minus one, a reference to the specified hyperlink object is returned. if the index is invalid then a null pointer is returned. return value e_invalidarg if bad [in] passed, [out] va...
...nk hyperlink ); parameters index this 0 based index specifies the hyperlink to return. hyperlink if the given index is valid, that is it lies in the interval from 0 to the number of links minus one, a reference to the specified hyperlink object is returned. if the index is invalid then a null pointer is returned. return value e_invalidarg if bad [in] passed, [out] value is null. s_ok. hyperlinkindex() returns the index of the hyperlink that is associated with this character index. this is the case when a link spans the given character index. [propget] hresult hyperlinkindex( [in] long charindex, [out] long hyperlinkindex ); parameters charindex a 0 based index of the character for which to return the link index. if iaccessibletext is used to represent the text containing the link, then...
...And 5 more matches
nsIControllers
nstance, as you normally need to alter the window or element's existing list of controllers. ...
...void appendcontroller( in nsicontroller controller ); parameter...
...void appendcontroller( in nsicontroller controller ); parameters controller a controller to be added to the list of controllers. exceptions thrown ns_error_out_of_memory getcontrollerat() returns the co...
...And 5 more matches
nsIMsgThread
the nsimsgfolder interface is used to interact with threads in thunderbird. ...
... the nsimsgfolder interface is used to interact with threads in thunderbird. ...
... with threads in thunderbird. ...
...And 5 more matches
nsIRadioInterfaceLayer
@mozilla.org/telephony/system-worker-manager;1. ...
...ce(components.interfaces.nsiradiointerfacelayer); method overview void answercall(in unsigned long callindex); void deactivatedatacall(in domstring cid, in domstring reason); void dial(in domstring number); void enumeratecalls(in nsiriltelephonycallback callback); void getdatacalllist(); unsigned short getnumberofmessagesfortext(in domstring text); void hangup(in unsigned long callindex); void registercallback(in nsiriltelephonycallback callback); void registerdatacallcallback(in nsirildatacallback callback); void rejectcall(in unsigned long callindex); void sendsms(in domstring number, in domstring message, in long requestid, in unsigned long long processid); void setupdatacall(in long radiotech, in domstring apn, in domstring user, in domstring passwd, in long chappa...
...void dial( in domstr...
...And 5 more matches
IDBTransaction - Web APIs
all reading and writing of data is done within transactions. you use idbdatabase to start transactions, idbtransaction to set the mode of the transaction (e.g. is it readonly or readwrite), and you access an idbobjectstore to make a request. you can also use an idbtransaction object to abort transactions. note: this feature is available in web workers. ...
...", "key"); objectstore1.put("1", "key"); after the code is executed the object store should contain the value "2", since trans2 should run after trans1. transaction failures transactions can fail for a fixed number of reasons, all of which (except the user agent crash) will trigger an abort callback: abort due to bad requests, e.g. trying to add() the same key twice, or put() with the same index key with a uniqueness constraint. this causes an error on the request, which can bubble up to an error on the transaction, which aborts the transaction. this can be prevented by using preventdefault() on the error event on the request. an explicit abort() call from script. an uncaught exception in the request's success/error handler. an i/o error (e.g. an actual failure to write to disk, or ot...
...hich aborts the transaction. this can be prevented by using preventdefault() on the error event on the request. an explicit abort() call from script. an uncaught exception in the request's success/error handler. an i/o error (e.g. an actual failure to write to disk, or other os/hardware failure). quota exceeded. a user agent crash. firefox durability guarantees note that as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702.) previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. in firefox 40+ the complete event is fired after the os has been told to write the data but potentially before that data has actually been flushed to disk. the comple...
...And 5 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
wner; } this.task = ftask; if (isfinite(nrate) && nrate > 0) { this.rate = math.floor(nrate); } if (nlen > 0) { this.length = math.floor(nlen); } } minidaemon.prototype.owner = null; minidaemon.prototype.task = null; minidaemon.prototype.rate = 100; minidaemon.prototype.length = infinity; /* these properties should be read-only */ minidaemon.prototype.session = -1; minidaemon.prototype.index = 0; minidaemon.prototype.paused = true; minidaemon.prototype.backw = true; /* global methods */ minidaemon.forcecall = function (odmn) { odmn.index += odmn.backw ? -1 : 1; if (odmn.task.call(odmn.owner, odmn.index, odmn.length, odmn.backw) === false || odmn.isatend()) { odmn.pause(); return false; } return true; }; /* instances methods */ minidaemon.prototype.isatend = function () ...
...rototype.backw = true; /* global methods */ minidaemon.forcecall = function (odmn) { odmn.index += odmn.backw ? -1 : 1; if (odmn.task.call(odmn.owner, odmn.index, odmn.length, odmn.backw) === false || odmn.isatend()) { odmn.pause(); return false; } return true; }; /* instances methods */ minidaemon.prototype.isatend = function () { return this.backw ? ...
...true; /* global methods */ minidaemon.forcecall = function (odmn) { odmn.index += odmn.backw ? -1 : 1; if (odmn.task.call(odmn.owner, odmn.index, odmn.length, odmn.backw) === false || odmn.isatend()) { odmn.pause(); return false; } return true; }; /* instances methods */ minidaemon.prototype.isatend = function () { return this.backw ? ...
...And 5 more matches
Standard metadata names - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name
etadata names that have not been formally accepted yet; however, some of the names included there are already used quite commonly in practice — including the following: creator: the name of the creator of the document, such as an organization or institution. if there are more than one, several <meta> elements should be used. googlebot, a synonym of robots, is only followed by googlebot (the indexing crawler for google). publisher: the name of the document's publisher. robots: the behaviour that cooperative crawlers, or "robots", should use with the page. it is a comma-separated list of the values below: values for the content of <meta name="robots"> value description used by index allows the robot to index the page (default). ...
.... publisher: the name of the document's publisher. robots: the behaviour that cooperative crawlers, or "robots", should use with the page. it is a comma-separated list of the values below: values for the content of <meta name="robots"> value description used by index allows the robot to index the page (default). all noindex requests the robot to not index the page. ...
... by index allows the robot to index the page (default). all noindex requests the robot to not index the page. all follow allows the robot to follow the links on the page (default). all nofollow requests the robot to not follow the links on the page. all all equivalent to index, follow google none equivalent to noindex, nofollow google noarchive requests the search engine not to cache the page content. google, yahoo, bing nosnippet prevents displaying any description of the page in search engine results. ...
...And 5 more matches
Array.prototype.reduceRight() - JavaScript
ray (from right-to-left) to reduce it to a single value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see also array.prototype.reduce() for left-to-right. ...
... arrayoptional the array reduceright() was called upon. initialvalueoptional value to use as accumulator to the first call of the callback. if no initial value is supplied, the last element in the array will be used and skipped. ...
... arrayoptional the array reduceright() was called upon. initialvalueoptional value to use as accumulator to the first call of the callback. if no initial value is supplied, the last element in the array will be used and skipped. ...
...And 5 more matches
Array.prototype.every() - JavaScript
every() method tests whether all elements in the array pass the test implemented by the provided function. it returns a boolean value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.every(callback(element[, index[, array]])[, thisarg]) parameters callback a function to test for each element, taking three arguments: element the current element being processed in the array. index optional the index of the current element being processed in the array. array optional the array every was called upon. thisarg optional a value to use as this when executing callback. return value true ...
...allback function once for each element present in the array until it finds the one where callback returns a falsy value. if such an element is found, the every method immediately returns false. otherwise, if callback returns a truthy value for all elements, every returns true. caution: calling this method on an empty array will return true for any condition! callback is invoked only for array indexes which have assigned values. it is not invoked for indexes which have been deleted, or which have never been assigned values. callback is invoked with three arguments: the value of the element, the index of the element, and the array object being traversed. if a thisarg parameter is provided to every, it will be used as callback's this value. otherwise, the value undefined will be used as its ...
...value, k, o); else testresult = callbackfn(kvalue,k,o) // iii. if toboolean(testresult) is false, return false. if (!testresult) { return false; } } k++; } return true; }; } examples testing size of all array elements the following example tests whether all elements in the array are bigger than 10. function isbigenough(element, index, array) { return element >= 10; } [12, 5, 8, 130, 44].every(isbigenough); // false [12, 54, 18, 130, 44].every(isbigenough); // true using arrow functions arrow functions provide a shorter syntax for the same test. [12, 5, 8, 130, 44].every(x => x >= 10); // false [12, 54, 18, 130, 44].every(x => x >= 10); // true​ affecting initial array (modifying, appending, and deleting) the fol...
...And 5 more matches
Array.prototype.find() - JavaScript
the find() method returns the value of the first element in the provided array that satisfies the provided testing function. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if you need the index of the found element in the array, use findindex(). if you need to find the index of a value, use array.prototype.indexof(). (it’s similar to findindex(), but checks each element for equality with the value instead of using a testing function.) if you need to find if a value exists in an array, use array.prototype.includes(). again, it checks each element for equality with the value instead of using a testing function. ...
...ach element for equality with the value instead of using a testing function.) if you need to find if a value exists in an array, use array.prototype.includes(). again, it checks each element for equality with the value instead of using a testing function. if you need to find if any element satisfies the provided testing function, use array.prototype.some(). syntax arr.find(callback(element[, index[, array]])[, thisarg]) parameters callback function to execute on each value in the array, taking 3 arguments: element the current element in the array. index optional the index (position) of the current element in the array. array optional the array that find was called on. thisarg optional object to use as this inside callback. return value the value of the first ele...
...this means it may be less efficient for sparse arrays, compared to methods that only visit assigned values. ...
...And 5 more matches
Array.prototype.includes() - JavaScript
he includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...his interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.includes(valuetofind[, fromindex]) parameters valuetofind the value to search for. note: when comparing strings and characters, includes() is case-sensitive. fromindex optional the position in this array at which to begin searching for valuetofind. the first element to be searched is found at fromindex for positive values of fromindex, or at arr.length + fromindex for negative values of fromindex (using the absolute value of fromindex as the number of elements from the end of the array at which to start the search). defaults to 0. return value a boolean w...
... values of zero are all considered to be equal, regardless of sign. (that is, -0 is considered to be equal to both 0 and +0), but false is not considered to be the same as 0. note: technically speaking, includes() uses the samevaluezero algorithm to determine whether the given element is found. ...
...And 5 more matches
Array.prototype.map() - JavaScript
ew array populated with the results of calling a provided function on every element in the calling array. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... 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. ...
... 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 5 more matches
Array.prototype.splice() - JavaScript
existing elements and/or adding new elements in place. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... deletecount optional an integer indicating the number of elements in the array to remove from start. ...
...than the length of the array, start will be set to the length of the array. in this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided. if negative, it will begin that many elements from the end of the array. (in this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) if array.length + start is less than 0, it will begin from index 0. deletecount optional an integer indicating the number of elements in the array to remove from start. if deletecount is omitted, or if its value is equal to or larger than array.length - start (that is, if it is equal to or greater than the number of elements left in the array, starting at start), then all...
...And 5 more matches
RegExp.prototype.sticky - JavaScript
sticky is a read-only property of an individual regular expression 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. ...
...ub.com/mdn/interactive-examples and send us a pull request. property attributes of regexp.prototype.sticky writable no enumerable no configurable yes description the value of sticky is a boolean and true if the "y" flag was used; otherwise, false. ...
...ples and send us a pull request. property attributes of regexp.prototype.sticky writable no enumerable no configurable yes description the value of sticky is a boolean and true if the "y" flag was used; otherwise, false. ...
...And 5 more matches
String.prototype.charAt() - JavaScript
object's charat() method returns a new string consisting of the single utf-16 code unit located at the specified offset into the string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax let character = str.charat(index) parameters index an integer between 0 and str.length - 1. if the index cannot be converted to the integer or no index is provided, the default is 0, so the first character of str is returned. return value a string representing the character (exactly one utf-16 code unit) at the specified index. if index is out of range, charat() returns an empty string. description characters in a stri...
...meters index an integer between 0 and str.length - 1. if the index cannot be converted to the integer or no index is provided, the default is 0, so the first character of str is returned. return value a string representing the character (exactly one utf-16 code unit) at the specified index. if index is out of range, charat() returns an empty string. description characters in a string are indexed from left to right. the index of the first character is 0, and the index of the last character—in a string called stringname—is stringname.length - 1. if the index you supply is out of this range, javascript returns an empty string. if no index is provided to charat(), the default is 0. examples displaying characters at different locations in a string the following example displays char...
...—is stringname.length - 1. if the index you supply is out of this range, javascript returns an empty string. if no index is provided to charat(), the default is 0. ...
...And 5 more matches
String.prototype.slice() - JavaScript
the slice() method extracts a section of a string and returns it as a new string, without modifying the original string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the slice() method extracts a section of a string and returns it as a new string, without modifying the original 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. ...
... method extracts a section of a string and returns it as a new string, without modifying the original string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.slice(beginindex[, endindex]) parameters beginindex the zero-based index at which to begin extraction. if negative, it is treated as str.length + beginindex. (for example, if beginindex is -3 it is treated as str.length - 3.) if beginindex is greater than or equal to str.length, slice() returns an empty string. endindex optional the zero-based index before which to end extraction. the character at this index will not be included. if e...
...And 5 more matches
TypedArray - JavaScript
nly. typedarray.prototype.length returns the number of elements held in the typed array. fixed at construction time and thus read only. instance methods typedarray.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). typedarray.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). typedarray.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). typedarray.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). typedarray.prototype.filter() creates a new array ...
...edarray.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). typedarray.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function, or undefined if not found. see also array.prototype.find(). typedarray.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). typedarray.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). typedarray.prototype.includes() determines whether a typed array includes a certain element, returning true or fal...
... the provided testing function or -1 if not found. see also array.prototype.findindex(). typedarray.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). typedarray.prototype.includes() determines whether a typed array includes a certain element, returning true or false as appropriate. see also array.prototype.includes(). typedarray.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). typedarray.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). typedarray.prototype.keys() returns a new array iterator that contains the keys for each index in the array. see also array.protot...
...And 5 more matches
Creating Event Targets - Archive of obsolete content
s places api. it will emit events when the user adds and visits bookmarks, enabling users of the module to listen for these events using the sdk's standard event api. using the places api first, let's write some code using places api that logs the uris of bookmarks the user adds. create a new directory called "bookmarks", navigate to it, and run jpm init, accepting all the defaults. ...
...pm init, accepting all the defaults. ...
... and add the following code: var { emit, on, once, off } = require("sdk/event/core"); var {cc, ci} = require("chrome"); var { xpcomutils }= require("resource://gre/modules/xpcomutils.jsm"); var bookmarkservice = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); var bookmarkobserver = { onitemadded: function(aitemid, afolder, aindex) { emit(exports, "added", bookmarkservice.getbookmarkuri(aitemid).spec); }, onitemvisited: function(aitemid, avisitid, time) { emit(exports, "visited", bookmarkservice.getbookmarkuri(aitemid).spec); }, queryinterface: xpcomutils.generateqi([ci.nsinavbookmarkobserver]) }; bookmarkservice.addobserver(bookmarkobserver, false); exports.on = on.bind(null, exports); exports.once = onc...
...And 4 more matches
Bookmarks - Archive of obsolete content
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 manipulating bookmarks and bookmark folders. this article offers examples for how to perform common bookm...
... .getservice(components.interfaces.nsinavbookmarksservice); creating a bookmark folder creating a new bookmark folder is done using the nsinavbookmarksservice.createfolder() method. for example, to create a new folder in the bookmarks menu: var menufolder = bmsvc.bookmarksmenufolder; // bookmarks menu folder var newfolderid = bmsvc.createfolder(menufolder, "folder name here", bmsvc.default_index); this code locates the bookmarks menu's folder, then creates a new folder named "folder name here" in it. specifying default_index as the index at which to insert the new folder places it at the end of the list. you can easily change this code to insert the new folder into the bookmarks toolbar by changing bookmarksmenufolder to another folder attribute. creating a new bookmark to create a ...
...w bookmark, use the nsinavbookmarksservice.insertbookmark() method. the uri for the bookmark needs to be specified using an nsiuri object. var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://google.com/", null, null); var newbkmkid = bmsvc.insertbookmark(newfolderid, uri, bmsvc.default_index, ""); this example instantiates the nsiioservice and uses it to create an nsiuri referring to the google web site, then calls nsinavbookmarksservice.insertbookmark() to create a new bookmark to google, placing it at the end of the bookmarks folder referenced by newbkmkid. finding bookmark items if you know the uri of a site and wish to find all bookmarks that link to it, you can use the nsina...
...And 4 more matches
arrowscrollbox - Archive of obsolete content
provides scroll arrows along its edges for scrolling through the contents of the box. the user only needs to hover the mouse over the arrows to scroll the box. this element is typically used for large popup menus. hovering the mouse over one of the (active) arrows triggers a scroll event. more information is available in the xul tutorial. ...
...x. the user only needs to hover the mouse over the arrows to scroll the box. this element is typically used for large popup menus. hovering the mouse over one of the (active) arrows triggers a scroll event. more information is available in the xul tutorial. ...
...arrows to scroll the box. this element is typically used for large popup menus. hovering the mouse over one of the (active) arrows triggers a scroll event. more information is available in the xul tutorial. ...
...And 4 more matches
menu - Archive of obsolete content
Archive › Mozilla › XUL › menu
s | methods | related ] an element, much like a button, that is placed on a menubar. when the user clicks the menu element, the child menupopup of the menu will be displayed. this element is also used to create submenus. more information is available in the xul tutorial. ...
...d. this element is also used to create submenus. more information is available in the xul tutorial. ...
...bmenus. more information is available in the xul tutorial. ...
...And 4 more matches
tabbrowser - Archive of obsolete content
ack, cangoforward, contentdocument, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, securityui, selectedbrowser, selectedtab, sessionhistory, tabcontainer, tabs, visibletabs, webbrowserfind, webnavigation, webprogress methods addprogresslistener, addtab, addtabsprogresslistener,appendgroup, getbrowseratindex, getbrowserindexfordocument, getbrowserfordocument, getbrowserfortab, geticon, getnotificationbox, gettabforbrowser, gettabmodalpromptbox, goback, gobackgroup, goforward, goforwardgroup, gohome, gotoindex, loadgroup, loadonetab, loadtabs, loaduri, loaduriwithflags, movetabto, pintab, reload, reloadalltabs, reloadtab, reloadwithflags, removealltabsbut, removecurrenttab, removeprogresslistener, rem...
...serfortab, geticon, getnotificationbox, gettabforbrowser, gettabmodalpromptbox, goback, gobackgroup, goforward, goforwardgroup, gohome, gotoindex, loadgroup, loadonetab, loadtabs, loaduri, loaduriwithflags, movetabto, pintab, reload, reloadalltabs, reloadtab, reloadwithflags, removealltabsbut, removecurrenttab, removeprogresslistener, removetab, removetabsprogresslistener,replacegroup, selecttabatindex, seticon, showonlythesetabs, stop, unpintab attributes autocompleteenabled type: boolean set to true to enable autocomplete of fields. autocompletepopup type: id the id of a popup element used to hold autocomplete results for the element. autoscroll type: boolean set to false to disable autoscroll for this browser. if this attribute is set to true or om...
...for details. appendgroup( group ) return type: no return value not in firefox add several new tabs to the end of the existing tabs. the argument should be an array of objects, one for each document to load. the objects may be defined in script and contain a uri property for the url of the page to load. a referreruri property may also be optionally used to set the referrer page. getbrowseratindex( index ) return type: browser element returns a browser at the specified tab index. getbrowserindexfordocument( document ) return type: integer returns the index of the browser for the specified document in the tabbrowser the method was invoked on. the returned index is dependent on the tabs in the tabbrowser and is invalidated when the tab ordering changes. it should not be used to track p...
...And 4 more matches
WAI-ARIA basics - Learn web development
a xmlhttprequest, or dom apis. enhancing keyboard accessibility: there are built-in html elements that have native keyboard accessibility; when other elements are used along with javascript to simulate similar interactions, keyboard accessibility and screenreader reporting suffers as a result. where this is unavoidable, wai-aria provides a means to allow other elements to receive focus (using tabindex). accessibility of non-semantic controls: when a series of nested <div>s along with css/javascript is used to create a complex ui-feature, or a native control is greatly enhanced/changed via javascript, accessibility can suffer — screenreader users will find it difficult to work out what the feature does if there are no semantics or other clues. in these situations, aria can help to provide wh...
...rks menu or treated like a notable landmark, beyond the actual input being called out as a search input (<input type="search">). in addition, some older browsers (most notably ie8) don't recognise the semantics of the html5 elements. let's improve it by the use of some aria features. first, we'll add some role attributes to our html structure. ...
... however, sometimes you will end up having to write code that either uses non-semantic elements as buttons (or other types of control), or uses focusable controls for not quite the right purpose. you might be trying to fix some bad code you've inherited, or you might be building some kind of complex widget that requires it. in terms of making non-focusable code focusable, wai-aria extends the tabindex attribute with some new values: tabindex="0" — as indicated above, this value allows elements that are not normally tabbable to become tabbable. this is the most useful value of tabindex. tabindex="-1" — this allows not normally tabbable elements to receive focus programmatically, e.g. via javascript, or as the target of links. we discussed this in more detail and showed a typical impl...
...And 4 more matches
Practical positioning examples - Learn web development
and left of their <div> container — this part is absolutely key to this whole layout feature, as it makes the panels sit on top of one another. the rule also gives the panels the same set height as the container, and gives the content some padding, a text color, and a background-color. ...
... makes the panels sit on top of one another. the rule also gives the panels the same set height as the container, and gives the content some padding, a text color, and a background-color. the second rule we'll add here makes it so that a panel with a class of active-panel set on it will have a z-index of 1 applied to it, which will make it sit above the other panels (positioned elements have a z-index of 0 by default, which would put them below). ...
...index of 1 applied to it, which will make it sit above the other panels (positioned elements have a z-index of 0 by default, which would put them below). again, we'll add this class using javascript at the appropriate time. .info-box article { position: absolute; top: 0; left: 0; height: 352px; padding: 10px; color: white; background-color: #a60000; } .info-box .active-panel { z-index: 1; } adding our javascript the final step to getting this feature working is to add some javascript. put the following block of code, exactly as written in between your opening and closing <script> tags (you'll find these below the html content): var tabs = document.queryselectorall('.info-box li a'); var panels = document.queryselectorall('.info-box article'); for(i = 0; i < tabs.length; i+...
...And 4 more matches
MathML Accessibility in Mozilla
__________ the square root of the quantity a b c end root __________ square root of a, end of root. see webkit's bug 146452 square root of a b c. root end. a b c square root a2 __________ the second root of a __________ square root of a, end of root square root of a. root end. ...
... of a b c. root end. a b c square root a2 __________ the second root of a __________ square root of a, end of root square root of a. root end. a base root index root a3 __________ the third root of a __________ cube root of a, end of root cube root of a. root end. a base 3 root index root a3+4 __________ the 3 plus 4 root of a __________ 3 + 4 root of a, end of root 3 plus 4 root of a. root end. a base 3+4 root index root a34 __________ the 3 over 4 root of a __________ fraction start, 3 over 4, end of fraction root of a, end of root fraction start. 3 over...
... a __________ 3 + 4 root of a, end of root 3 plus 4 root of a. root end. a base 3+4 root index root a34 __________ the 3 over 4 root of a __________ fraction start, 3 over 4, end of fraction root of a, end of root fraction start. 3 over 4. fraction end. root of a. root end. a base 3 numerator 4 denominator root-index fraction ab __________ the the square root of b root of a __________ square root of b, end of root root of a, end of root square root of b. root end. root of a. root end. ...
...And 4 more matches
JS_DefineElement
creates a numeric property on a specified object. ...
... a numeric property on a specified object. ...
... unsigned attrs, jsnative getter = nullptr, jsnative setter = nullptr); bool js_defineelement(jscontext *cx, js::handleobject obj, uint32_t index, js::handleobject value, unsigned attrs, jsnative getter = nullptr, jsnative setter = nullptr); bool js_defineelement(jscontext *cx, js::handleobject obj, uint32_t index, js::handlestring value, unsigned attrs, jsnative getter = nullptr, jsnative setter = nullptr); bool js_defineelement(jscontext *cx, js::handleobject obj, uint32_t index, int32_t value, unsigned attrs, jsnative getter = nullptr, jsnative setter = nullptr); bool js_defineelement(jscontext *cx, js::handleobject o...
...And 4 more matches
JS_SetElement
assign a value to a numeric property of an object. ...
... assign a value to a numeric property of an object. ...
... assign a value to a numeric property of an object. ...
...And 4 more matches
IAccessibleTableCell
l table. ...
... 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 ); [pr...
...the result is greater than 1 if the specified cell spans multiple columns. [propget] hresult columnextent( [out] long ncolumnsspanned ); parameters ncolumnsspanned returns the 1 based column extent of the specified cell. return val...
...And 4 more matches
GetChildAt
exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ...
...exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ...
...exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ...
...And 4 more matches
nsIArray
for an array which can be modified, see nsimutablearray. neither interface makes any attempt to protect the individual elements from modification. the convention is that the elements of the array should not be modified. ...
...for an array which can be modified, see nsimutablearray. neither interface makes any attempt to protect the individual elements from modification. the convention is that the elements of the array should not be modified. ...
...for an array which can be modified, see nsimutablearray. neither interface makes any attempt to protect the individual elements from modification. the convention is that the elements of the array should not be modified. ...
...And 4 more matches
nsIDialogParamBlock
embedding/components/windowwatcher/public/nsidialogparamblock.idlscriptable an interface to pass strings, integers and nsisupports to a dialog. ...
... embedding/components/windowwatcher/public/nsidialogparamblock.idlscriptable an interface to pass strings, integers and nsisupports to a dialog. ...
... embedding/components/windowwatcher/public/nsidialogparamblock.idlscriptable an interface to pass strings, integers and nsisupports to a dialog. ...
...And 4 more matches
nsISHistory
ust create a instance of it and set it in the nsiwebnavigation object. implemented by: @mozilla.org/browser/shistory;1. ...
...nstance of it and set it in the nsiwebnavigation object. implemented by: @mozilla.org/browser/shistory;1. ...
... in the nsiwebnavigation object. implemented by: @mozilla.org/browser/shistory;1. ...
...And 4 more matches
WebIDL bindings
the webidl bindings are generated at build time based on two things: the actual webidl file and a configuration file that lists some metadata about how the webidl should be reflected into gecko-internal code. all webidl files should be placed in dom/webidl and added to the list in the moz.build file in that directory. note that if you're adding new interfaces, then the test at dom/tests/mochitest/general/test_interfaces.html will most likely fail. this is a signal that you need to get a review from a dom peer. ...
... the interface is left up to the developer. with that in mind, the generated iterable bindings expect the wrapper object to provide certain methods for the interface to access. iterable interfaces have different requirements, based on if they are single or pair value iterators. example interface for a single value iterator: interface longiterable { iterable<long>; getter long(unsigned long index); readonly attribute unsigned long length; }; for single value iterator interfaces, we treat the interface as an indexed getter, as required by the spec. see the indexed getter implementation section for more information on building this kind of structure. example interface for a pair value iterator: interface stringandlongiterable { iterable<domstring, long>; }; the bindings for this pai...
... of structure. example interface for a pair value iterator: interface stringandlongiterable { iterable<domstring, long>; }; the bindings for this pair value iterator interface require the following methods be implemented in the c++ object: class stringandlongiterable { public: // returns the number of items in the iterable storage size_t getiterablelength(); // returns key of pair at aindex in iterable storage nsastring& getkeyatindex(uint32_t aindex); // returns value of pair at aindex in iterable storage uint32_t& getvalueatindex(uint32_t aindex); } stringifiers named stringifiers operations in webidl will just invoke the corresponding c++ method. anonymous stringifiers in webidl will invoke the c++ method called stringify. so, for example, given this idl: interface fir...
...And 4 more matches
Working with ArrayBuffers
so, for the size of 640,000 it takes about 98ms. ...
...size of 640,000 it takes about 98ms. ...
... about 98ms. ...
...And 4 more matches
Checking when a deadline is due - Web APIs
in this article we look at a complex example involving checking the current time and date against a deadline stored via indexeddb. the main complication here is checking the stored deadline info (month, hour, day, etc.) against the current time and date taken from a date object. the main example application we will be referring to in this article is to-do list notifications, a simple to-do list application that stores task titles and deadline times and dates via indexeddb, and then provides users with notifications when deadline dates are reached, via the notification, and vibration apis. you can download the to-do list notifications app from github and play around with the source code, or view the app running live. the basic problem in the to-do app, we wanted to first record ti...
...o the database. the next few lines open the database transaction and provide messages to notify the user if this was successful or failed.then an objectstore is created into which the new item is added. the notified property of the data object indicates that the to-do list item's deadline has not yet come up and been notified - more on this later! note: the db variable stores a reference to the indexeddb database instance; we can then use various properties of this variable to manipulate the data. request.onsuccess = function(event) { note.innerhtml += '<li>new item added to database.</li>'; title.value = ''; hours.value = null; minutes.value = null; day.value = 01; month.value = 'january'; year.value = 2020; }; } this next section cre...
...we then loop through all the items in the cursor for as long as there is a valid item left in the cursor. switch(cursor.value.month) { case "january": var monthnumber = 0; break; case "february": ...
...And 4 more matches
Using Service Workers - Web APIs
e; this is basically a special kind of worker context, running off the main script execution thread, with no dom access. the service worker is now ready to process events. installation of the worker is attempted when service worker-controlled pages are accessed subsequently. an install event is always the first one sent to a service worker (this can be used to start the process of populating an indexeddb, and caching site assets). this is really the 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 ...
...e browser’s standard cache, but it is specific to your domain. it persists until you tell it not to — again, you have full control. note: the cache api is not supported in every browser. ...
... a polyfill like the one available in google's topeka demo, or perhaps store your assets in indexeddb. ...
...And 4 more matches
ARIA: gridcell role - Accessibility
able attribute: <td>potato</td> <td>cabbage</td> <td>onion</td> description 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. ...
...tion 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-rowindex to describe a gridcell's order in the list of rows. ...
...a-colindex to describe a gridcell's order in the list of columns, and aria-rowindex to describe a gridcell's order in the list of rows. use aria-colcount and aria-rowcount on the parent element with role="grid" applied to it to set the total number of columns or rows. this sample code demonstrates a table-style grouping of information where the third and fourth columns have been removed. ...
...And 4 more matches
Architecture - Accessibility
tation that's appropriate. if it has text siblings, then it gets exposed as the unicode char for an embedded object, which is '\xfffc' within the parent nshypertextaccessible. in addition, nsiaccessiblehyperlink is implemented on any non-text child inside a container that also has text. this allows at's to find its position within that text, because the hyperlink interface exposes a start and end index. in fact, the end index will always be 1 larger than the start index, because the object is always represented by a single '\xfffc' character. if you want to know that something is really a link, check to see if it is role_link. html containers are implemented by nshypertextaccessible. they support the nsiaccessiblehypertext is implemented on any container element that has both text and embedde...
...t is used by nshypertextaccessible to collect information about itself it is still exposed in msaa for backward compatibility by old windows assistive technologies. those at's don't yet know about any iaccessibletext yet, and want to see the hierarchy how they always did -- with text in leaf nodes. ...
...ssible to collect information about itself it is still exposed in msaa for backward compatibility by old windows assistive technologies. those at's don't yet know about any iaccessibletext yet, and want to see the hierarchy how they always did -- with text in leaf nodes. how does an at deal with text (a) to get the embedded object for an embedded object char: linkindex = iahypertext::getlinkindex(offset) iahyperlink*object = iahypertext::getlink(linkindex) iaccessible* accessible = qi/qs(object) (b) to get the offset in the parent text for a given embedded object: qi/qa to iahyperlink if not successful, then it is not embedded in text, so it's position in parent should be determined just by ia2::indexinparent, which will return its child offset within the parent. examples of obj...
...And 4 more matches
Keyboard - Accessibility
mportant exception to this rule is if the element has role="document" applied to it, inside an interactive context (such as role="application"). in such a case, focusing the nested document is the only way of returning assistive technology to a non-interactive state (often called "browse mode"). ...
...ument" applied to it, inside an interactive context (such as role="application"). in such a case, focusing the nested document is the only way of returning assistive technology to a non-interactive state (often called "browse mode"). most interactive elements are focusable by default; you can make an element focusable by adding a tabindex=0 attribute value to it. however, you should only add tabindex if you have also made the element interactive, for example, by defining appropriate event handlers keyboard events. see also tabindex global html attribute global event handlers: onkeydown global event handlers: onkeyup avoid using tabindex attribute greater than zero the tabindex attribute indicates that an element is focusable using the keyboard. a value of zero indicates that the elem...
...dex attribute greater than zero the tabindex attribute indicates that an element is focusable using the keyboard. a value of zero indicates that the element is part of the default focus order, which is based on the ordering of elements in the html document. a positive value puts the element ahead of those in the default ordering; elements with positive values are focused in the order of their tabindex values (1, then 2, then 3, etc.). this creates confusion for keyboard-only users when the focus order differs from the logical order of the page. a better strategy is to structure the html document so that focusable elements are in a logical order, without the need to re-order them with positive tabindex values. ...
...And 4 more matches
Border-radius generator - CSS: Cascading Style Sheets
osition: relative; } #preview .content { width: 100%; height: 100%; display: block; } #preview input { color: #333; border: 1px solid #ccc; border-radius: 3px; } #subject { width: 400px; height: 150px; margin: 0 auto; border: 3px solid #c60; background: #fff; position: relative; } .radius { width: 50%; height: 50%; border: 1px solid #ccc; display: none; position: absolute; z-index: 1; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .handle { width: 16px; height: 16px; position: absolute; z-index: 2; } .handle-top-left { top: -12px; left: -12px; cursor: se-resize; background: url("https://mdn.mozillademos.org/files/5677/resize-handle.png") top left no-repeat; } .handle-top-right { top: -12px; right: -12px; cursor: sw-r...
...ht { bottom: -12px; right: -12px; cursor: nw-resize; background: url("https://mdn.mozillademos.org/files/5677/resize-handle.png") bottom right no-repeat; } .handle-bottom-left { bottom: -12px; left: -12px; cursor: ne-resize; background: url("https://mdn.mozillademos.org/files/5677/resize-handle.png") bottom left no-repeat; } .radius-container { position: absolute; display : block; z-index: 1; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /* top left */ #top-left { top: 0; left: 0; } #top-left .radius { border-top-left-radius: 100%; top: 0; left: 0; } /* top right */ #top-right { top: 0; right: 0; } #top-right .radius { border-top-right-radius: 100%; top: 0; right: 0; } /* bottom right */ #bottom-right { bottom: 0; righ...
...adius: 100%; top: 0; right: 0; } /* bottom right */ #bottom-right { bottom: 0; right: 0; } #bottom-right .radius { border-bottom-right-radius: 100%; bottom: 0; right: 0; } /* bottom left */ #bottom-left { bottom: 0; left: 0; } #bottom-left .radius { border-bottom-left-radius: 100%; bottom: 0; } /* input sliders */ #preview .ui-input-slider { margin: 10px; position: absolute; z-index: 10; } #radius-ui-sliders { width: 100%; height: 100%; min-height: 75px; min-width: 150px; padding: 20px 50px; top: -20px; left: -50px; position: relative; } #tlr { top: -30px; left: -50px; display: none; } #tlw { top: -30px; left: 30px; } #tlh { top: 20px; left: -50px; } #trr { top: -30px; right: -50px; display: none; } #trw { top: -30px; right: 30px; } #trh { top: 20...
...And 4 more matches
Stacking context example 3 - CSS: Cascading Style Sheets
let's take as an example a three-level hierarchical menu made from several positioned divs. second-level and third-level divs appear when hovering or clicking on their parents. usually this kind of menu is script-generated either client-side or server-side, so style rules are assigned with a class selector instead of the id selector. if the three menu levels partially overlap, then managing stacking could become a problem. the first-level menu is only relatively positioned, so no stacking context is created. ...
...server-side, so style rules are assigned with a class selector instead of the id selector. if the three menu levels partially overlap, then managing stacking could become a problem. the first-level menu is only relatively positioned, so no stacking context is created. the second-level menu is absolutely positioned inside the parent element. in order to put it above all first-level menus, a z-index is used. the problem is that for each second-level menu, a stacking context is created and each third-level menu belongs to the context of its parent. so a third-level menu will be stacked under the following second-level menus, because all second-level menus share the same z-index value and the default stacking rules apply. to better understand the situation, here is the stacking context hiera...
... context is created and each third-level menu belongs to the context of its parent. so a third-level menu will be stacked under the following second-level menus, because all second-level menus share the same z-index value and the default stacking rules apply. to better understand the situation, here is the stacking context hierarchy: root stacking context level #1 level #2 (z-index: 1) level #3 ... level #3 level #2 (z-index: 1) ... level #2 (z-index: 1) level #1 ... ...
...And 4 more matches
Event reference
th each event) as well as a link to the specification or specifications that define the event. event name event type specification fired when... abort uievent dom l3 the loading of a resource has been aborted. abort progressevent progress and xmlhttprequest progression has been terminated (not due to an error). abort event indexeddb a transaction has been aborted. afterprint event html5 the associated document has started printing or the print preview has been closed. animationcancel animationevent css animations a css animation has aborted. animationend animationevent css animations a css animation has completed. animationiteration animationevent ...
... agent has started to capture audio for speech recognition. beforeprint event html5 the associated document is about to be printed or previewed for printing. beforeunload beforeunloadevent html5 the window, the document and its resources are about to be unloaded. beginevent timeevent svg a smil animation element begins. blocked indexeddb an open connection to a database is blocking a versionchange transaction on the same database. blur focusevent dom l3 an element has lost focus (does not bubble). boundary speechsynthesisevent web speech api the spoken utterance reaches a word or sentence boundary canplay event html5 media the user agent can play the media, but esti...
...rgingchange event battery status the battery begins or stops charging. chargingtimechange event battery status the chargingtime attribute has been updated. click mouseevent dom l3 a pointing device button has been pressed and released on an element. close event websocket a websocket connection has been closed. complete indexeddb a transaction successfully completed. complete offlineaudiocompletionevent web audio apithe definition of 'offlineaudiocompletionevent' in that specification. the rendering of an offlineaudiocontext is terminated. compositionend compositionevent dom l3 the composition of a passage of text has been completed or canceled. compositionstart com...
...And 4 more matches
Int16Array - JavaScript
constructor int16array() creates a new int16array object. ...
...only. int16array.prototype.length returns the number of elements hold in the int16array. fixed at construction time and thus read only. instance methods int16array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int16array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). int16array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int16array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). int16array.prototype.filter() creates a new array ...
...t16array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). int16array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. see also array.prototype.find(). int16array.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). int16array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). int16array.prototype.includes() determines whether a typed array includes a certain element, returning true or fal...
...And 4 more matches
Int32Array - JavaScript
constructor int32array() creates a new int32array object. ...
...only. int32array.prototype.length returns the number of elements hold in the int32array. fixed at construction time and thus read only. instance methods int32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int32array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). int32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int32array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). int32array.prototype.filter() creates a new array ...
...t32array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). int32array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. see also array.prototype.find(). int32array.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). int32array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). int32array.prototype.includes() determines whether a typed array includes a certain element, returning true or fal...
...And 4 more matches
Int8Array - JavaScript
constructor int8array() creates a new int8array object. static properties int8array.bytes_per_element returns a number value of the element size. 1 in the case of an int8array. int8array.name returns the string value of the constructor name. ...
...ead only. int8array.prototype.length returns the number of elements hold in the int8array. fixed at construction time and thus read only. instance methods int8array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). int8array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int8array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). int8array.prototype.filter() creates a new array wit...
... int8array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). int8array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. see also array.prototype.find(). int8array.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). int8array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). int8array.prototype.includes() determines whether a typed array includes a certain element, returning true or false...
...And 4 more matches
RegExp.prototype.exec() - JavaScript
using this internally, exec() can be used to iterate over multiple matches in a string of text (with capture groups), as opposed to getting just the matching strings with string.prototype.match(). ...
...tive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax regexobj.exec(str) parameters str the string against which to match the regular expression. return value if the match succeeds, the exec() method returns an array (with extra properties index and input; see below) and updates the lastindex property of the regular expression object. the returned array has the matched text as the first item, and then one item for each parenthetical capture group of the matched text. if the match fails, the exec() method returns null, and sets lastindex to 0. description consider the following example: // match "quick brown" followed by "jumps", igno...
...turns null, and sets lastindex to 0. description consider the following example: // match "quick brown" followed by "jumps", ignoring characters in between // remember "brown" and "jumps" // ignore case let re = /quick\s(brown).+?(jumps)/ig; let result = re.exec('the quick brown fox jumps over the lazy dog'); the following table shows the results for this script: object property/index description example result [0] the full string of characters matched "quick brown fox jumps" [1], ...[n] the parenthesized substring matches, if any. the number of possible parenthesized substrings is unlimited. result[1] === "brown" result[2] === "jumps" index the 0-based index of the match in the string. ...
...And 4 more matches
Uint8Array - JavaScript
constructor uint8array() creates a new uint8array object. static properties uint8array.bytes_per_element returns a number value of the element size. 1 in the case of an uint8array. uint8array.name returns the string value of the constructor name. in the case of the uint8array type: "uint8array". ...
...only. uint8array.prototype.length returns the number of elements held in the uint8array. fixed at construction time and thus read only. instance methods uint8array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint8array.prototype.entries() returns a new array iterator object that contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint8array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint8array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint8array.prototype.filter() creates a new array ...
...nt8array.prototype.filter() creates a new array with all of the elements of this array for which the provided filtering function returns true. see also array.prototype.filter(). uint8array.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. see also array.prototype.find(). uint8array.prototype.findindex() returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. see also array.prototype.findindex(). uint8array.prototype.foreach() calls a function for each element in the array. see also array.prototype.foreach(). uint8array.prototype.includes() determines whether a typed array includes a certain element, returning true or fal...
...And 4 more matches
Modules - Archive of obsolete content
erfaces: ci } = components; var instance = cc["@mozilla.org/moz/jssubscript-loader;1"]; var loader = instance.getservice(ci.mozijssubscriptloader); function loadscript(url) { loader.loadsubscript(url); } when a script is loaded, it is evaluated in the scope of the global object of the script that loaded it. any property defined on the global object will be accessible from both scripts: // index.js: loadscript("www.foo.com/a.js"); foo; // => 3 // a.js: foo = 3; exporting names the script loader we obtained from the components object allows us load scripts from other locations, but its api is rather limited. for instance, it does not know how to handle relative urls, which is cumbersome if you want to organize your project hierarchically. a more serious problem with the loadscript func...
...s from other locations, but its api is rather limited. for instance, it does not know how to handle relative urls, which is cumbersome if you want to organize your project hierarchically. a more serious problem with the loadscript function, however, is that it evaluates all scripts in the scope of the same global object. this becomes a problem when two scripts try to define the same property: // index.js: loadscript("www.foo.com/a.js"); loadscript("www.foo.com/b.js"); foo; // => 5 // a.js: foo = 3; // b.js: foo = 5; in the above example, the value of foo depends on the order in which the subscripts are loaded: there is no way to access the property foo defined by "a.js", since it is overwritten by "b.js". to prevent scripts from interfering with each other, loadscript should evaluate each s...
...ading script. the script loader we obtained from components allows us to do just that: function loadscript(url) { let global = {}; loader.loadsubscript(url, global); return global; } if present, the loadsubscript function evaluates the script to be loaded in the scope of the second argument. ...
...And 3 more matches
Tabbox - Archive of obsolete content
owsers, its use is discouraged since it could be removed at any time. try to avoid using it. ...
...ouraged since it could be removed at any time. try to avoid using it. ...
...d be removed at any time. try to avoid using it. ...
...And 3 more matches
enumKeys - Archive of obsolete content
returns the name if it succeeded; null if the referenced value does not exist. description enumkeys can be used to iterate through the subkeys at a given key location. ...
... returns the name if it succeeded; null if the referenced value does not exist. description enumkeys can be used to iterate through the subkeys at a given key location. ...
... returns the name if it succeeded; null if the referenced value does not exist. description enumkeys can be used to iterate through the subkeys at a given key location. ...
...And 3 more matches
Building accessible custom components in XUL - Archive of obsolete content
and assign the appropriate role attributes, and firefox handles exposing the elements properly to the underlying assistive technology. further reading table of supported roles and states in firefox focus issues download stage-3.zip install stage-3.xpi the next step on the road to an accessible spreadsheet is the focus problem. in html documents, you can make any element focusable with the tabindex attribute. in xul, there is no tabindex attribute; to make a xul element focusable, you need to use a mozilla-specific css property, -moz-user-focus: normal. <code> grid.spreadsheet { border: thin solid; -moz-user-focus: normal; } </code> in html documents, firefox draws a focus rectangle around the currently focused element. in xul, we will need to handle this ourselves, again with css rules...
...null : arsiblings[row - 1]; } function f...
... function spreadsheet_right(current) { var next = find_cell_right(current); if (next) { next.focus(); } } function get_index_within_parent(current) { var arsiblings = current.parentnode.childnodes; for (var i = 0; i < arsiblings.length; i++) { if (arsiblings[i] == current) { return i; } } return -1; } function find_cell_up(current) { var row = get_index_within_parent(current); var arsiblings = current.parentnode.childnodes; return row == 0 ? ...
...And 3 more matches
textbox - Archive of obsolete content
displayed by default. the multiline attribute can be specified to display a field with multiple rows. more information is available in the xul tutorial. ...
... decimalplaces ty...
... type="text" spellcheck="false" /><br /> <textarea spellcheck="false"></textarea> <div contenteditable="true" spellcheck="false">i am some content</div> you can use spellcheck on input, textarea, and contenteditable elements. thespellcheck attribute works well paired with the autocomplete, autocapitalize, and autocorrect attributes too! added from david walsh's article on spell check. 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. timeout type: integer for autocomplete textboxes, the number of milliseconds before the textbox starts searching for completions. the default is 50 milliseconds. for search textboxes, the nu...
...And 3 more matches
Positioning - Learn web development
und: aqua; border: 3px solid blue; padding: 10px; margin: 10px; } span { background: red; border: 1px solid black; } .positioned { position: absolute; background: yellow; top: 30px; left: 30px; } the positioned element now sits relative to the <body> element. note: you can see the example at this point live at 4_positioning-context.html (see source code). introducing z-index all this absolute positioning is good fun, but there is another thing we haven't considered yet — when elements start to overlap, what determines which elements appear on top of which other elements? in the example we've seen so far, we only have one positioned element in the positioning context, and it appears on the top, since positioned elements win over non-positioned elements. what about ...
...nd positioned a bit above from where it originally was. it is also stacked below the original .positioned paragraph, where the two overlap. this is because the .positioned paragraph is the second paragraph in the source order, and positioned elements later in the source order win over positioned elements earlier in the source order. can you change the stacking order? yes, you can, by using the z-index property. "z-index" is a reference to the z-axis. you may recall from previous points in the course where we discussed web pages using horizontal (x-axis) and vertical (y-axis) coordinates to work out positioning for things like background images and drop shadow offsets. (0,0) is at the top left of the page (or element), and the x- and y-axes run across to the right and down the page (for left to...
...ut positioning for things like background images and drop shadow offsets. (0,0) is at the top left of the page (or element), and the x- and y-axes run across to the right and down the page (for left to right languages, anyway.) web pages also have a z-axis: an imaginary line that runs from the surface of your screen, towards your face (or whatever else you like to have in front of the screen). ...
...And 3 more matches
JS_GetReservedSlot
v js::value (in js_setreservedslot) the value to store. ...
... v js::value (in js_setreservedslot) the value to store. ...
... v js::value (in js_setreservedslot) the value to store. ...
...And 3 more matches
Secure Development Guidelines
unsigned int 0 - +4294967295 64 signed long long -9223372036854775808 - +9223372036854775807 unsigned long long 0 - +18446744073709551615 int vuln_funct(int size) { char buf[1024]; if (size > sizeof(buf) - 1) return -1; } signedness issues: don’t mix signed and unsigned integers use unsigned integers for sizes, offsets, and indexes casting and truncation example: void vuln_funct() { u_int32_t size1 = 0xffffffff; u_int16_t size2 = size1; void *ptr = malloc(size2); if (!ptr) exit(exit_failure); memcpy(ptr, user_data, size1); } casting issues: sign extension example: int main() { int32_t new_size = 0; int8_t size = 0xff; new_size = size; printf("0x%08x\r\n", ne...
...a/b : 0; }...
...ar c[12]; strcpy(c, bar); } int main(int argc, char **argv) { foo(argv[1]); } bbv: stack overflow before the stack overflow bbv: stack overflow after the stack overflow bbv: heap overflow dynamic memory malloc() calloc() heapalloc() mmap() not on the stack segment! ...
...And 3 more matches
Manipulating bookmarks using Places
.getservice(components.interfaces.nsinavbookmarksservice); creating a bookmark folder creating a new bookmark folder is done using the nsinavbookmarksservice.createfolder() method. for example, to create a new folder in the bookmarks menu: var menufolder = bmsvc.bookmarksmenufolder; // bookmarks menu folder var newfolderid = bmsvc.createfolder(menufolder, "folder name here", bmsvc.default_index); this code locates the bookmarks menu's folder, then creates a new folder named "folder name here" in it. specifying default_index as the index at which to insert the new folder places it at the end of the list. you can easily change this code to insert the new folder into the bookmarks toolbar by changing bookmarksmenufolder to another folder attribute. creating a new bookmark to create a ...
...w bookmark, use the nsinavbookmarksservice.insertbookmark() method. the uri for the bookmark needs to be specified using an nsiuri object. var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://google.com/", null, null); var newbkmkid = bmsvc.insertbookmark(newfolderid, uri, bmsvc.default_index, ""); this example instantiates the nsiioservice and uses it to create an nsiuri referring to the google web site, then calls nsinavbookmarksservice.insertbookmark() to create a new bookmark to google, placing it at the end of the bookmarks folder referenced by newbkmkid. finding bookmark items if you know the uri of a site and wish to find all bookmarks that link to it, you can use the nsina...
... bookmark for a site that's already bookmarked -- you can use the nsinavbookmarksservice.isbookmarked() method. var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://mozilla.com/", null, null); if (!bmsvc.isbookmarked(uri)) { bmsvc.insertbookmark(bmsvc.toolbarfolder, uri, bmsvc.default_index, "mozilla"); } this example looks to see if the user already has a bookmark for the mozilla web site, and, if not, creates one, adding it to the user's bookmarks toolbar. finding the folder containing an item if you need to know what folder contains an item (this can be especially handy after using nsinavbookmarksservice.getbookmarkidsforuri() to find bookmarks for a given uri), you can use t...
...And 3 more matches
IAccessible2
] 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([out] bstr localizedextendedrole ); [propget] hresult localizedextendedstates([in] long maxlocalizedextendedstates, [out, size_is(,maxlocalizedextendedstates), length_is(, nlocalizedextendedstates)] bstr localizedextendedstates, [out] long nlocalizedextendedstates )...
...propget] hresult localizedextendedstates([in] long maxlocalizedextendedstates, [out, size_is(,maxlocalizedextendedstates), length_is(, nlocalizedextendedstates)] bstr localizedextendedstates, [out] long nlocalizedextendedstates ); [propget] hresult nextendedstates([out] long nextendedstates ); [propget] hresult nrelations([out] long nrelations ); [propget] hresult relation([in] long relationindex, [out] iaccessiblerelation relation ); [propget] hresult relations([in] long maxrelations, [out, size_is(maxrelations), length_is( nrelations)] iaccessiblerelation relations, [out] long nrelations ); hresult role([out] long role ); hresult scrollto([in] enum ia2scrolltype scrolltype ); hresult scrolltopoint([in] enum ia2coordinatetype coordinatetype, [in] long x, [in] long y ); [propget...
...for collections of non-text objects. [propget] hresult groupposition( [out] long grouplevel, [out] long similaritemsingroup, [out] long positioningroup ); parameters grouplevel 1 based, 0 indicates that this value is not applicable. similaritemsingroup 1 based, 0 indicates that this value is not applicable. positioningroup 1 based, 0 indicates that this value is not applicable. ...
...And 3 more matches
GetRelation
refer to relations documentation for more info. ...
...refer to relations documentation for more info. ...
...refer to relations documentation for more info. ...
...And 3 more matches
nsIAccessibleSelectable
accessible/public/nsiaccessibleselectable.idlscriptable 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 description selectioncount long the number of accessible children currently selected. read only. constants constant value description eselection_add 0 eselection_remove 1 eselection_getstate ...
...t long the number of accessible children currently selected. read only. constants constant value description eselection_add 0 eselection_remove 1 eselection_getstate 2 methods addchildtoselection() adds the specified accessible child of the object to the object's selection. if the specified object is already selected, then it does nothing. void addchildtoselection( in long index ); parameters index the zero-based accessible child index. exceptions thrown ns_error_failure if the specified object is not selectable. clearselection() clears the selection in the object so that no children in the object are selected. void clearselection(); parameters none. getselectedchildren() returns an nsiarray of the selected nsiaccessible children. nsiarray getselectedchildren(); p...
...on() clears the selection in the object so that no children in the object are selected. void clearselection(); parameters none. getselectedchildren() returns an nsiarray of the selected nsiaccessible children. nsiarray getselectedchildren(); parameters none. return value an nsiarray. ischildselected() determines if the current child of this object is selected. boolean ischildselected( in long index ); parameters index the zero-based accessible child index. return value true if the child is selected, false if not. refselection() returns a reference to the accessible object representing the specified selected child of the object. nsiaccessible refselection( in long index ); parameters index zero-based selected accessible child index. return value the selected accessible child. removec...
...And 3 more matches
nsIAutoCompleteInput
toolkit/components/autocomplete/public/nsiautocompleteinput.idlscriptable this interface monitors the input in a text field and displays an autocomplete panel at the appropriate time. ...
...ocomplete panel at the appropriate time. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview acstring getsearchat(in unsigned long index); void onsearchbegin(); void onsearchcomplete(); boolean ontextentered(); boolean ontextreverted(); void selecttextrange(in long startindex, in long endindex); attributes attribute type description completedefaultindex boolean if a search result has its defaultindex set, this will optionally try to complete the text in the textbox to the entire text of the result at the default index as the user types. this means that auto-fill is enabled. completeselecte...
... consumerollupevent boolean if true, the event that rolls up the popup should be consumed by the popup itself. if false, the rollup event will be dispatched. read only. ...
...And 3 more matches
nsICollection
represents a list of nsisupports items. it provides basic operations on those items like: getting, setting, appending, removing, and so on. inherits from: nsiserializable last changed in gecko 1.7 method overview void appendelement(in nsisupports item); void clear(); pruint32 count(); nsienumerator enumerate(); nsisupports getelementat(in pruint32 index); void queryelementat(in pruint32 index, in nsiidref uuid, [iid_is(uuid),retval] out nsqiresult result); void removeelement(in nsisupports item); void setelementat(in pruint32 index, in nsisupports item); methods appendelement() appends a new item to the collection. void appendelement( in nsisupports item ) parameters item nsisupports item to be append...
...e collection. void clear(); parameters none. count() returns the number of items in the collection. pruint32 count(); parameters none. return value number of items in the list. enumerate() returns an nsienumerator that lets you iterate over the items in the collection. nsienumerator enumerate(); parameters none. return value an nsienumerator. ...
...umber of items in the collection. pruint32 count(); parameters none. return value number of items in the list. enumerate() returns an nsienumerator that lets you iterate over the items in the collection. nsienumerator enumerate(); parameters none. return value an nsienumerator. getelementat() returns the element at the specified index into the collection. ...
...And 3 more matches
nsIDOMWindowUtils
a dom utility interface that provides useful dom methods and attributes. 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. ...
...sshell(in nsidomnode atarget, in nsidomevent aevent, in boolean atrusted); nsidomelement elementfrompoint(in float ax, in float ay, in boolean aignorerootscrollframe, in boolean aflushlayout); void entermodalstate(); nsidomelement findelementwithviewid(in nsviewid aid); 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 getpccountscriptcount(); astring getpccountscriptsummary(in long ascript); astring getpccountscrip...
...a possible type of a style sheet loaded/removed with loadsheet()/removesheet(). see css2 specification for details. methods activatenativemenuitemat() see nsiwidget.activatenativemenuitemat(). cannot be accessed from unprivileged context (not content-accessible) will throw a dom security error if called without universalxpconnect privileges. void activatenativemenuitemat( in astring indexstring ); parameters indexstring clearmozafterpaintevents() void clearmozafterpaintevents(); parameters none. comparecanvases() compare the two canvases, returning the number of differing pixels and the maximum difference in a channel. this will throw an error if the dimensions of the two canvases are different. this method requires universalxpconnect privileges. pruint32 compare...
...And 3 more matches
nsILivemarkService
ace is obsolete. implemented by: @mozilla.org/browser/livemark-service;2. ...
...lasses["@mozilla.org/browser/livemark-service;2"] .getservice(components.interfaces.nsilivemarkservice); method overview long long createlivemark(in long long folder, in astring name, in nsiuri siteuri, in nsiuri feeduri, in long index); long long createlivemarkfolderonly(in long long folder, in astring name, in nsiuri siteuri, in nsiuri feeduri, in long index); nsiuri getfeeduri(in long long container); long long getlivemarkidforfeeduri(in nsiuri afeeduri); nsiuri getsiteuri(in long long container); boolean islivemark(in long long folder); void reloadalllivemarks(); void reloadlivemarkfolder(in long long folderid); void setfeeduri(in long long container, in nsiuri feeduri); void...
...long long folderid); void setfeeduri(in long long container, in nsiuri feeduri); void setsiteuri(in long long container, in nsiuri siteuri); void start(); void stopupdatelivemarks(); methods createlivemark() creates a new livemark. long long createlivemark( in long long folder, in astring name, in nsiuri siteuri, in nsiuri feeduri, in long index ); parameters folder the id of the parent folder. name the name to show when displaying the livemark. siteuri the uri of the site from which the livemark was created. feeduri the uri of the actual rss feed. index the index to insert at, or -1 to append to the end of the list. return value the id of the folder for the livemark. createlivemarkfolderonly() this method also creates...
...And 3 more matches
nsIMutableArray
array, then it is guaranteed that nsiarray.queryelementat() will never return a null value. any of these methods may throw ns_error_out_of_memory when the array must grow to complete the call, but the allocation fails. method overview void appendelement(in nsisupports element, in boolean weak); void clear(); void insertelementat(in nsisupports element, in unsigned long index, in boolean weak); void removeelementat(in unsigned long index); void replaceelementat(in nsisupports element, in unsigned long index, in boolean weak); methods appendelement() append an element at the end of the array. void appendelement( in nsisupports element, in boolean weak ); parameters element the element to append. weak whether or not to stor...
... reference is requested, but the element does not support nsiweakreference. clear() clear the entire array, releasing all stored objects. void clear(); parameters none. insertelementat() insert an element at the given position, moving the element currently located in that position, and all elements in higher position, up by one. ...
... clear the entire array, releasing all stored objects. void clear(); parameters none. insertelementat() insert an element at the given position, moving the element currently located in that position, and all elements in higher position, up by one. void insertelementat( in nsisupports element, in unsigned long index, in boolean weak ); parameters element the element to insert. index the position in the array: if the position is lower than the current length of the array, the elements at that position and onwards are bumped one position up. if the position is equal to the current length of the array, the new element is appended. an index lower than 0 or higher than the current length of the array is invalid and will be ignored. weak whether or not to store the ele...
...And 3 more matches
DataTransferItemList.DataTransferItem() - Web APIs
the returned value is never null. example this example shows how to use drag and drop. ...
...the returned value is never null. example this example shows how to use drag and drop. ...
...the returned value is never null. example this example shows how to use drag and drop. ...
...And 3 more matches
HTMLSelectElement.item() - Web APIs
return value item is a htmloptionelement. ...
... return value item is a htmloptionelement. ...
... return value item is a htmloptionelement. ...
...And 3 more matches
IDBDatabase.createObjectStore() - Web APIs
the method takes the name of the store as well as a parameter object that lets you define important optional properties. you can use the property to uniquely identify individual objects in the store. as the property is an identifier, it should be unique to every object, and every object should have that property. this method can be called only within a versionchange transaction. note: this feature is available in web workers. ...
...eading; this has now been fixed (see bug 1176165.) constrainterror an object store with the given name (based on case-sensitive comparison) already exists in the connected database. invalidaccesserror if autoincrement is set to true and keypath is either an empty string or an array containing an empty string. example // let us open our database var request = window.indexeddb.open("todolist", 4); // this handler is called when a new version of the database // is created, either when one has not been created before // or when a new version number is submitted by calling // window.indexeddb.open(). // this handler is only supported in recent browsers. request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) { n...
... in recent browsers. ...
...And 3 more matches
IDBFactory.deleteDatabase() - Web APIs
od, with its result set to undefined. if an error occurs while the database is being deleted, then an error event is fired on the request object that is returned from this method. when deletedatabase() is called, any other open connections to this particular database will get a versionchange event. note: this feature is available in web workers. syntax for the current standard: var request = indexeddb.deletedatabase(name); for the experimental version with options (see below): var request = indexeddb.deletedatabase(name, options); parameters name the name of the database you want to delete. note that attempting to delete a database that doesn't exist does not throw an exception, in contrast to idbdatabase.deleteobjectstore(), which does throw an exception if the named object store d...
...delete. note that attempting to delete a database that doesn't exist does not throw an exception, in contrast to idbdatabase.deleteobjectstore(), which does throw an exception if the named object store does not exist. ...
... attempting to delete a database that doesn't exist does not throw an exception, in contrast to idbdatabase.deleteobjectstore(), which does throw an exception if the named object store does not exist. ...
...And 3 more matches
IDBLocaleAwareKeyRange - Web APIs
methods this interface inherits all the methods of its parent interface, idbkeyrange. properties this interface inherits all the properties of its parent interface, idbkeyrange. bear in mind however that idblocaleawarekeyrange has its own implementation of idbkeyrange.bound. ...
... methods this interface inherits all the methods of its parent interface, idbkeyrange. properties this interface inherits all the properties of its parent interface, idbkeyrange. bear in mind however that idblocaleawarekeyrange has its own implementation of idbkeyrange.bound. ...
...herits all the methods of its parent interface, idbkeyrange. properties this interface inherits all the properties of its parent interface, idbkeyrange. bear in mind however that idblocaleawarekeyrange has its own implementation of idbkeyrange.bound. this is because when you use bound(), it checks if lower bound < upper bound, and throws an exception if that’s not the case. with locale-aware indexes, the meaning of < depends on the locale, so for example in lithuanian y is sorted between i and k. the only difference between idbkeyrange and idblocaleawarekeyrange is that the latter doesn’t do the aforementioned check. developers should always use idblocaleawarekeyrange when dealing with locale-aware indexes. examples function displaydata() { var keyrangevalue = idblocaleawarekeyrange...
...And 3 more matches
IDBTransaction.oncomplete - Web APIs
previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. in firefox 40+ the complete event is fired after the os has been told to write the data but potentially before that data has actually been flushed to disk. ...
...previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. in firefox 40+ the complete event is fired after the os has been told to write the data but potentially before that data has actually been flushed to disk. ...
.... note: in firefox, if you wish to ensure durability for some reason (e.g. you're storing critical data that cannot be recomputed later) you can force a transaction to flush to disk before delivering the complete event by creating a transaction using the experimental (non-standard) readwriteflush mode (see idbdatabase.transaction.) this is currently experimental, and can only be used if the dom.indexeddb.experimental pref is set to true in about:config. syntax transaction.oncomplete = function(event) { ... }; example in the following code snippet, we open a read/write transaction on our database and add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. note t...
...And 3 more matches
Using Pointer Events - Web APIs
delivered, resulting in our handlemove() function being called. its responsibility in this example is to update the cached touch information and to draw a line from the previous position to the current position of each touch. ...
...terup event is sent. we handle this event by calling the handleend() function below. its job is to draw the last line segment for the touch that ended and remove the touch point from the ongoing touch list. ...
...t, without adding in the updated information. the result is that we stop tracking that touch point. handling canceled touches if the user's finger wanders into browser ui, or the touch otherwise needs to be canceled, the pointercancel event is sent, and we call the handlecancel() function below. function handlecancel(evt) { log("pointercancel: id = " + evt.pointerid); var idx = ongoingtouchindexbyid(evt.pointerid); ongoingtouches.splice(idx, 1); // remove it; we're done } since the idea is to immediately abort the touch, we simply remove it from the ongoing touch list without drawing a final line segment. convenience functions this example uses two convenience functions that should be looked at briefly to help make the rest of the code more clear. selecting a color for each touch...
...And 3 more matches
TouchList.item() - Web APIs
Web › API › TouchList › item
example this code example illustrates the use of the touchlist interface's item method and the length property. ...
... example this code example illustrates the use of the touchlist interface's item method and the length property. ...
... example this code example illustrates the use of the touchlist interface's item method and the length property. ...
...And 3 more matches
Touch events - Web APIs
ate the cached touch information and to draw a line from the previous position to the current position of each touch. ...
... last line segment for each touch that ended and remove the touchpoint from the ongoing touch list. ...
...uchpoint. handling canceled touches if the user's finger wanders into browser ui, or the touch otherwise needs to be canceled, the touchcancel event is sent, and we call the handlecancel() function below. function handlecancel(evt) { evt.preventdefault(); console.log("touchcancel."); var touches = evt.changedtouches; for (var i = 0; i < touches.length; i++) { var idx = ongoingtouchindexbyid(touches[i].identifier); ongoingtouches.splice(idx, 1); // remove it; we're done } } since the idea is to immediately abort the touch, we simply remove it from the ongoing touch list without drawing a final line segment. convenience functions this example uses two convenience functions that should be looked at briefly to help make the rest of the code more clear. selecting a color ...
...And 3 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
ny columns that will fit into a container” are included. alignment control grid contains alignment features so we can control how the items align once placed into a grid area, and how the entire grid is aligned. control of overlapping content more than one item can be placed into a grid cell or area and, they can partially overlap each other. this layering may then be controlled with the z-index property. grid is a powerful specification that, when combined with other parts of css such as flexbox, can help you create layouts that were previously impossible to build in css. it all starts by creating a grid in your grid container. the grid container we create a grid container by declaring display: grid or display: inline-grid on an element. as soon as we do this, all direct children of ...
...tion, we would edit the above nested grid example to change the track definition of grid-template-columns: repeat(3, 1fr), to grid-template-columns: subgrid. the nested grid will then use the parent grid tracks to layout items. .box1 { grid-column-start: 1; grid-column-end: 4; grid-row-start: 1; grid-row-end: 3; display: grid; grid-template-columns: subgrid; } layering items with z-index grid items can occupy the same cell. if we return to our example with items positioned by line number, we can change this to make two items overlap. <div class="wrapper"> <div class="box box1">one</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> .wrapper { display: grid; grid-templat...
... { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .box { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } the item box2 is now overlapping box1, it displays on top as it comes later in the source order. ...
...And 3 more matches
Regular expressions - JavaScript
ation or null on a mismatch. test() tests for a match in a string. it returns true or false. match() returns an array containing all of the matches, including capturing groups, or null if no match is found. matchall() returns an iterator containing all of the matches, including capturing groups. search() tests for a match in a string. it returns the index of the match, or -1 if the search fails. replace() executes a search for a match in a string, and replaces the matched substring with a replacement substring. replaceall() executes a search for all matches in a string, and replaces the matched substrings with a replacement substring. split() uses a regular expression or a fixed string to break a string into an ...
... (see different behaviors for further info about the different behaviors.) if you want to construct the regular expression from a string, yet another alternative is this script: var myre = new regexp('d(b+)d', 'g'); var myarray = myre.exec('cdbbdbsbz'); with these scripts, the match succeeds and returns the array and updates the properties shown in the following tab...
...he different behaviors.) if you want to construct the regular expression from a string, yet another alternative is this script: var myre = new regexp('d(b+)d', 'g'); var myarray = myre.exec('cdbbdbsbz'); with these scripts, the match succeeds and returns the array and updates the properties shown in the following table. results of regular expression execution. ...
...And 3 more matches
String - JavaScript
the string object is used to represent and manipulate a sequence of characters. description strings are useful for holding data that can be represented in text form. some of the most-used operations on strings are to check their length, to build and concatenate them using the + and += string operators, checking for the existence or location of substrings with the indexof() method, or extracting substrings with the substring() method. creating strings strings can be created as primitives, from string literals, or as objects, using the string() constructor: const string1 = "a string primitive"; const string2 = 'also a string primitive'; const string3 = `yet another string primitive`; const string4 = new string("a string object"); string primitives and string objects can be used interchan...
.... 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 ecmascript 5) is to treat the string as an array-like object, where individual characters correspond to a numerical index: return 'cat'[1] // returns "a" when using bracket notation for character access, attempting to delete or assign a value to these properties will not succeed. the properties involved are neither writable nor configurable. (see object.defineproperty() for more information.) comparing strings in c, the strcmp() function is used for comparing strings. in javascript, you just use the less-than a...
...turns a string created by using the specified sequence of unicode values. string.fromcodepoint(num1 [, ...[, numn) returns a string created by using the specified sequence of code points. string.raw() returns a string created from a raw template string. instance properties string.prototype.length reflects the length of the string. read-only. instance methods string.prototype.charat(index) returns the character (exactly one utf-16 code unit) at the specified index. string.prototype.charcodeat(index) returns a number that is the utf-16 code unit value at the given index. string.prototype.codepointat(pos) returns a nonnegative integer number that is the code point value of the utf-16 encoded code point starting at the specified pos. string.prototype.concat(str [, ...strn ]) c...
...And 3 more matches
WebAssembly.Table.prototype.set() - JavaScript
if value is not an exported webassembly function or null, a typeerror is thrown. ...
... if value is not an exported webassembly function or null, a typeerror is thrown. ...
... if value is not an exported webassembly function or null, a typeerror is thrown. ...
...And 3 more matches
Forms related code snippets - Archive of obsolete content
dchild(odecrmonth); ocapt.appendchild(oincryear); ocapt.appendchild(oincrmonth); ocapt.appendchild(this.display); this.container.appendchild(ocapt); this.container.appendchild(othead); this.current.setdate(1); this.writedays(); otarget.onclick = function () { if (otable.parentnode) { otable.parentnode.removechild(otable); return; } otable.style.zindex = nzindex++; otable.style.position = "absolute"; otable.style.left = otarget.offsetleft + "px"; otable.style.top = (otarget.offsettop + otarget.offsetheight) + "px"; otarget.parentnode.insertbefore(otable, otarget); }; ainstances.push(this); } datepicker.prototype.writedays = function () { const nendblanks = (this.current.getday() + bzeroismonday...
...-1 : 1, othiscal = ainstances[this.id.replace(rbgnnan, "")]; othiscal.current[bismonth ? "setmonth" : "setyear"](othiscal.current[bismonth ? "getmonth" : "getfullyear"]() + ndelta); othiscal.writedays(); return false; } function ondayclick () { const oth...
...-1 : 1, othiscal = ainstances[this.id.replace(rbgnnan, "")]; othiscal.current[bismonth ? "setmonth" : "setyear"](othiscal.current[bismonth ? "getmonth" : "getfullyear"]() + ndelta); othiscal.writedays(); return false; } function ondayclick () { const othiscal = ai...
...And 2 more matches
Tabbed browser - Archive of obsolete content
.org/browser/sessionstore;1", "nsisessionstore"); // create new tab, but don't load the content. var url = "https://developer.mozilla.org"; var tab = gbrowser.addtab(null, {relatedtocurrent: true}); gsessionstore.settabstate(tab, json.stringify({ entries: [ { title: url } ], usertypedvalue: url, usertypedclear: 2, lastaccessed: tab.lastaccessed, index: 1, hidden: false, attributes: {}, image: null })); reusing tabs rather than open a new browser or new tab each and every time one is needed, it is good practice to try to re-use an existing tab which already displays the desired url--if one is already open. following this practice minimizes the proliferation of tabs and browsers created by your extension. reusing by url/uri a common f...
...mediator); var browserenumerator = wm.getenumerator("navigator:browser"); // check each browser instance for our url var found = false; while (!found && browserenumerator.hasmoreelements()) { var browserwin = browserenumerator.getnext(); var tabbrowser = browserwin.gbrowser; // check each tab of this browser instance var numtabs = tabbrowser.browsers.length; for (var index = 0; index < numtabs; index++) { var currentbrowser = tabbrowser.getbrowseratindex(index); if (url == currentbrowser.currenturi.spec) { // the url is already opened. select this tab. tabbrowser.selectedtab = tabbrowser.tabcontainer.childnodes[index]; // focus *this* browser-window browserwin.focus(); found = true; break; } }...
...rl/uri and focus/select it. if no such tab exists (perhaps the user closed it or we never opened it in the first place), we create a new tab with our custom attribute. function openandreuseonetabperattribute(attrname, url) { var wm = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); for (var found = false, index = 0, tabbrowser = wm.getenumerator('navigator:browser').getnext().gbrowser; index < tabbrowser.tabcontainer.childnodes.length && !found; index++) { // get the next tab var currenttab = tabbrowser.tabcontainer.childnodes[index]; // does this tab contain our custom attribute? if (currenttab.hasattribute(attrname)) { // yes--select and focus it. tabbrowse...
...And 2 more matches
Tamarin build documentation - Archive of obsolete content
nal flags: --enable-debugger - debugger build --enable-debug - debug build for verbose build of tamarin, you can pass cppflags to make. $ make cppflags=-davmplus_verbose additional instructions for non-android cross-platform tamarin-redux build on osx 10.6 (snow leopard) (to build tamarin-central on mac please see previous cross-platform instructions here: https://developer.mozilla.org/index.php?title=en/tamarin/tamarin_build_documentation&revision=21 the bug when building on snow leopard (bug 537817) has been fixed in the tamarin-redux repo. the work for that fix also included some changes to the configure.py default behavior to decouple the --target switch from sdk choice: there is a new switch, --mac-sdk, that selects the 10.4u, 10.5 or 10.6 sdk. its options are '104u', '105'...
...dk 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 zip file from http://developer.android.com/sdk/index.html. unzip to your sdk/ndk top folder. make sure it's named 'android-sdk-mac_86'. - download the r5b mac ndk zip file from http://developer.android.com/sdk/ndk/index.html. unzip 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 sdk platform-tools (to get adb), sdk platform andro...
...ive open the 'c/c++ projects' view (window >> show view >> c/c++ projects) add view filter 'non-c elements' (in the top-right of the 'c/c++ projects' view, click the down-arrow, click 'filters...', check 'non-c elements') increase the threshold for 'editor scalability mode' to 20000 lines. as some tamarin source files have more than the eclipse standard threshold of 5000, they do not appear as indexed. the threshold can be adjusted in eclipse preferences >> c/c++ >> editor >> scalability. *important* project-specific settings for the cdt indexer do not appear to work (it looks like a bug in eclipse), so you have to set these manually/globally. what we want is to have the indexer track the currently selected build config (so the correct conditional compiles are highlighted in the editor). t...
...And 2 more matches
Tree Widget Changes - Archive of obsolete content
there you can get specific columns, the current sort column, and position and size info about the columns. for the most part these objects are readonly; you can modify the columns by just adjusting the treecol attributes directly. the tree and view methods no longer take ids as arguments when columns are used. instead, they use nsitreecolumns. ...
...ition and size info about the columns. for the most part these objects are readonly; you can modify the columns by just adjusting the treecol attributes directly. the tree and view methods no longer take ids as arguments when columns are used. instead, they use nsitreecolumns. for example, nsitreeview.getcellvalue() takes a row index and a nsitreecolumn as arguments, whereas before it took a row index and a column id. ...
...the tree and view methods no longer take ids as arguments when columns are used. instead, they use nsitreecolumns. for example, nsitreeview.getcellvalue() takes a row index and a nsitreecolumn as arguments, whereas before it took a row index and a column id. ...
...And 2 more matches
wizard - Archive of obsolete content
a manner suitable for the user's selected theme and platform. in newer versions of mozilla, a statusbar may be placed directly inside the wizard element which will be shared among all pages. more information is available in the xul tutorial. ...
...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. lastpage type: boolean true if the wizard is on the last page. use the cancancel property to indicate to the user (by disabling the cancel button) that they cannot can pagestep type: integer the index of the current page. title type: string the text to appear in the title bar of the window. windowtype type: string set to a string which can be used to identify the type of window. this might be used, for example, to distinguish between a browser window and an editor window. some of mozilla's window handling functions use this attribute to group windows of the same type together. ...
...llow moving to the previous page. this has the effect of enabling or disabling the back button. currentpage type: wizardpage element this property returns the wizardpage element that is currently displayed. you can modify this value to change the current page. onfirstpage type: boolean this property is set to true if the user is on the first page, which may or may not be the first index. onlastpage type: boolean this property is set to true if the user is on the last page of the wizard. pagecount type: integer this property holds the number of pages in the wizard. pageindex type: integer this property returns the index of the currently selected page. you can change the selected page by modifying this property. pagestep type: integer this property ...
...And 2 more matches
Implementation Status - Archive of obsolete content
the sections are marked with their current status: supported, partial support, in progress, and not currently supported. ...
... 292333; 3.4 extension module unsupported 300760; 3.5 mustunderstand module unsupported 300757; 4. processing model (events) section title status notes bugs 4 processing model (events) partial ...
... 7.6.2 is-card-number() unsupported 7.7.1 avg() supported 7.7.2 min() supported 7.7.3 max() supported 7.7.4 count-non-empty() supported 7.7.5 index() partial binds using index() are not working 292333; 7.7.6 power() supported 7.7.7 random() supported 7.7.8 compare() supported 7.8.1 if() supported 7.8.2 property() partial ...
...And 2 more matches
XForms Repeat Element - Archive of obsolete content
ch node in the nodeset, the contents of the repeat element will be displayed in the form. that node will serve as the context node for any relative xpath expressions in that set of repeated markup. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. node set binding special startindex - optional 1-based initial value of the repeat index. the default value is 1. number - isn't supported type restrictions the repeat element can be bound to a nodeset. representations the repeat element doesn't have a visual representation. however, it can influence the layout of generated controls depending on its appearance attribute. default layout each generated control set is place...
...visual representation. however, it can influence the layout of generated controls depending on its appearance attribute. default layout each generated control set is placed vertically. compact layout each generated control set is placed horizontally. occurs when the repeat element's appearance attribute has a value of compact. behaviour focusing a generated control may change the current index of the containing repeat element. the index is equal to the index of the control set that the focused control belongs to. actions you can use xforms action module elements to modify the nodeset that the repeat element is bound to. the most useful actions for altering the contents of a repeat are the insert (see the spec), delete (see the spec) and setindex (see the spec) elements. example <...
....25</my:price> </my:line> </my:lines> </instance> </model> <repeat id="lineset" nodeset="/my:lines/my:line"> <input ref="my:price"> <label>line item</label> </input> <input ref="@name"> <label>name</label> </input> </repeat> <trigger> <label>insert a new item after the current one</label> <action ev:event="domactivate"> <insert nodeset="/my:lines/my:line" at="index('lineset')" position="after"/> <setvalue ref="/my:lines/my:line[index('lineset')]/@name"/> <setvalue ref="/my:lines/my:line[index('lineset')]/price">0.00</setvalue> </action> </trigger> <trigger> <label>remove current item</label> <delete ev:event="domactivate" nodeset="/my:lines/my:line" at="index('lineset')"/> </trigger> attribute based repeat when using...
...And 2 more matches
Example 4 - Learn web development
background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "â–¼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background:...
...tive'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.optlist'); optlist.classlist.toggle('hidden'); } function highlightoption(select, option) { var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.classlist.remove('highlight'); }); option.classlist.add('highlight'); }; function updatevalue(select, index) { var nativewidget = select.previouselementsibling; var value = select.queryselector('.value'); var optionlist = select.queryselectorall('.option'); nativewidget.selectedindex = index; value.innerhtml = optionlist[index].innerhtml; highlightoption(select, optionlist[index]); }; function getindex(select) { var nativewidget = select.previouselementsibling; return nativewidget.se...
...var nativewidget = select.previouselementsibling; var value = select.queryselector('.value'); var optionlist = select.queryselectorall('.option'); nativewidget.selectedindex = index; value.innerhtml = optionlist[index].innerhtml; highlightoption(select, optionlist[index]); }; function getindex(select) { var nativewidget = select.previouselementsibling; return nativewidget.selectedindex; }; // ------------- // // event binding // // ------------- // window.addeventlistener("load", function () { var form = document.queryselector('form'); form.classlist.remove("no-widget"); form.classlist.add("widget"); }); window.addeventlistener('load', function () { var selectlist = document.queryselectorall('.select'); selectlist.foreach(function (select) { var optionlist = ...
...And 2 more matches
Example 5 - Learn web development
background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "â–¼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background:...
...tive'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.optlist'); optlist.classlist.toggle('hidden'); } function highlightoption(select, option) { var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.classlist.remove('highlight'); }); option.classlist.add('highlight'); }; function updatevalue(select, index) { var nativewidget = select.previouselementsibling; var value = select.queryselector('.value'); var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.setattribute('aria-selected', 'false'); }); optionlist[index].setattribute('aria-selected', 'true'); nativewidget.selectedindex = index; value.innerhtml = optionlist[index].innerhtml...
...selementsibling; var value = select.queryselector('.value'); var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.setattribute('aria-selected', 'false'); }); optionlist[index].setattribute('aria-selected', 'true'); nativewidget.selectedindex = index; value.innerhtml = optionlist[index].innerhtml; highlightoption(select, optionlist[index]); }; function getindex(select) { var nativewidget = select.previouselementsibling; return nativewidget.selectedindex; }; // ------------- // // event binding // // ------------- // window.addeventlistener("load", function () { var form = document.queryselector('form'); form.classlist.remove("no-widget"); form.classlist.add("widget"); }); window.addeventlistener('load', function (...
...And 2 more matches
Accessibility in React - Learn web development
them both below: import react, { usestate, useref, useeffect } 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. ...
...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 javascript. ...
...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 javascript. 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={listheadingref}> {headingtext} </h2> note: the tabindex attribute is great for accessibility edge-cases, but you should take great care to not overuse it. only app...
...And 2 more matches
Deploying our app - Learn web development
tically trigger the entire build routine. if all is well, we get a live change deployed automatically. the only action we need to perform is that initial "push". however, we do have to set these steps up, and we'll look at that now. the build process again, because we're using parcel for development, the build option is extremely simple to add. instead of running the server with npx parcel src/index.html, we can run it with npx parcel build src/index.html and parcel will build everything ready for production instead of just running it for development and testing purposes. this includes doing minification and tree-shaking of code, and cache-busting on filenames. the newly-created production code is placed in a new directory called dist, which contains all the files required to run the websit...
...y 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 scripts property. we'll add a build command that we can run to build our code. add the following line to your project now: "scripts": { ... "build": "parcel build src/index.html" } note: if the scripts 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 directory to run the production build step (first quit the running process with ctrl + c if you need to): npm run build this should give you an output like the following, showi...
...our next step is to push the project to github. committing changes to github this section will get you over the line to storing your code in a git repository, but it is a far cry from a git tutorial. there’s many gr...
...And 2 more matches
Gecko info for Windows accessibility vendors
containers along with the event_focus as selection/focus move together in that case. event_selectionwithin is fired on multi selection containers when the current selection changes within. in addition, event_selectionadd and event_selectionremove are fired on the the child who's selection changed. how to track where the event happened, within your own offscreen model ordinary zero-indexed child ids are not practical for representing events. the problem is that the child id system that is used by msaa doesn't work well when you have a deep tree of objects in a window. it would be impractical to number all of the nodes in a document starting at 0, because whenever a node is inserted or removed it would be computationally very expensive to renumber things. so, the firefox childid h...
...this only applies if the node is html. hresult get_innerhtml([out, retval] bstr *innerhtml); finally we provide a method for getting the current iso 639 language code, such as "en" for english or even possible "en-cockney" for the british cockney di...
...ed to check for this interface if the current node has any msaa or dom children. text nodes always support isimpledomnode as well as isimpledomtext. ...
...And 2 more matches
Multiprocess on Windows
{ // first arraydata definition }, { // second arraydata definition } }; mozilla::mscom::registerarraydata(kmyarraydata); each arraydata struct corresponds to one function; with length_is and/or size_is annotations. if your interface contains two functions with those annotations, then you will need to add two arraydata entries. arraydata contains seven fields: iid miid; ulong mmethodindex; ulong marrayparamindex; vartype marrayparamtype; iid marrayparamiid; ulong mlengthparamindex; flag mflag; miid is the uuid of the interface owning the function. mmethodindex is the vtable index of the function within its interface. this index must take into account the vtable(s) of parent interfaces. for example, if interface ifoo inherits from iunknown, the lowest possible mmeth...
... marrayparamtype is the expected variant type of the outparam. ...
... marrayparamtype is the expected variant type of the outparam. this should usually be set to vt_unknown | vt_byref, which is telling the interceptor that the outparam is an iunknown**. marrayparamiid is the uuid of the interface that the outparam array uses. ...
...And 2 more matches
Performance best practices for Firefox front-end engineers
investigate and try to remove those as best you can. sometimes, our graphics layer invalidates regions in ways that might not be clear to you, and a section outside of the thing that just repainted will also repaint. sometimes this can be addressed by ensuring that the thing changing is on its own layer (though this comes at a memory cost). you can put something on its own layer by setting its z-index, or by setting the will-change on the node, though this should be used sparingly. if you’re unsure why something is repainting, consider talking to our always helpful graphics team in the gfx room on matrix, and they can probably advise you. note that a significant number of the graphics team members are in the us eastern time zone (utc-5 or utc-4 during daylight saving time), so let that info...
...n code of gecko are based on an expectation that the from (0%) and the to (100%) values will be explicitly defined in the @keyframes definition. even though these values may be inferred through the use of initial values or the cascade, the offscreen animation optimizations are dependent on the explicit definition. see this comment and a few previous comments on that bug for more information. ...
...h these values may be inferred through the use of initial values or the cascade, the offscreen animation optimizations are dependent on the explicit definition. see this comment and a few previous comments on that bug for more information. use indexeddb for storage appcache and localstorage are synchronous storage apis that will block the main thread when you use them. avoid them at all costs! indexeddb is preferable, as the api is asynchronous (all disk operations occur off of the main thread), and can be accessed from web workers. ...
...And 2 more matches
JIT Optimization Outcomes
hat suggest they are hashtables are turned into dictionary objects and their types marked as such. noprotofound a prototype object was not found for all the object used by this operation. multiprotopaths objects used in this operation had differing prototypes. nonwritableproperty the property being assigned to is not writable for some types of objects which are used in this operation. ...
...nto dictionary objects and their types marked as such. noprotofound a prototype object was not found for all the object used by this operation. multiprotopaths objects used in this operation had differing prototypes. nonwritableproperty the property being assigned to is not writable for some types of objects which are used in this operation. protoindexedprops the object being accessed has indexed properties that are exotic (for example, defined as a property on a prototype object and left as a hole in the underlying object). arraybadflags the array being accessed may have flags that the optimization strategy cannot handle. for example, if the array has sparse indexes, or has indexes that overflow the array's length, the optimization strategy may fail. arraydoubleconversion the type-...
... typedobjectneutered the typed object being accessed at this location may have been neutered (a neutered typed object is one where the underlying byte buffer has been removed or transferred to a worker). typedobjectarrayrange failed to do range check of element access on a typed object. ...
...And 2 more matches
JS_ValueToId
convert a js::value to type jsid. syntax bool js_valuetoid(jscontext *cx, js::handlevalue v, js::mutablehandleid idp); bool js_stringtoid(jscontext *cx, js::handlestring s, js::mutablehandleid idp); // added in spidermonkey 38 bool js_indextoid(jscontext *cx, uint32_t index, js::mutablehandleid idp); // added in spidermonkey 17 bool js_charstoid(jscontext* cx, js::twobytechars chars, js::mutablehandleid idp); // added in spidermonkey 24 void js::protokeytoid(jscontext *cx, jsprotokey key, js::mutablehandleid idp); // added in spidermonkey 38 name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the js value to convert. s j...
...protokeytoid(jscontext *cx, jsprotokey key, js::mutablehandleid idp); // added in spidermonkey 38 name type description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the js value to convert. s js::handlestring the js string to convert. index uint32_t an unsigned integer index of array to convert. chars js::twobytechars the string to convert. key jsprotokey the prototype key to convert. idp js::mutablehandleid out parameter. on success, *idp receives the converted jsid. description js_valuetoid converts a specified js::value, v, to a jsid. if v is an integer, *idp receives an ...
...ied js::value, v, to a jsid. if v is an integer, *idp receives an integer jsid. otherwise, if e4x support is enabled and v is an object, *idp receives an object jsid. otherwise, *idp receives an interned string jsid based on the value of v. if v is not a string, it is converted to a string as if by calling js_valuetostring. js_stringtoid and js_charstoid convert a specified string to a jsid. js_indextoid converts a specified integer index to an integer jsid. js::protokeytoid converts a specified prototype key to a jsid. on success, js_valuetoid stores the converted value in *idp and returns true. otherwise it returns false. the inverse of js_valuetoid is js_idtovalue. mxr id search for js_valuetoid see also mxr id search for js_idtovalue mxr id search for js_stringtoid mxr id search...
...And 2 more matches
nsIAccessible
ough the accessible tree by the following methods and attributes. nsiaccessible.parent to get the parent accessible nsiaccessible.nextsibling, nsiaccessible.previoussibling to get sibling accessibles nsiaccessible.firstchild, nsiaccessible.lastchild to get first and last child nsiaccessible.children, nsiaccessible.getchildat(), nsiaccessible.childcount to navigate through the children by index accessible position you can use nsiaccessible.indexinparent to get accessible index in its parent. use nsiaccessible.groupposition() to get information about this accessible in its group. relations many accessibles are linked with each other, for example, if one accessible gives the accessible name for another accessible (for example, html:label and html control) then these accessibles are relat...
... getstate provides a bit fields of accessible states which describe boolean properties of accessible. groupposition this method returns grouping information. used for tree items, list items, tab panel labels, radio buttons, etc. also used for collectons of non-text objects. getchildatpoint this method returns an accessible c...
... groupposition this method returns grouping information. used for tree items, list items, tab panel labels, radio buttons, etc. also used for collectons of non-text objects. getchildatpoint this method returns an accessible child which contains the coordinate at (x, y) in screen pixels. getchildat this method returns nth accessible child using zero-based index or last child if index than less than zero. getaccessibletoright this method returns an accessible node geometrically to the right of this one. getaccessibletoleft this method returns an accessible node geometrically to the left of this one. getaccessibleabove this method returns an accessible node geometrically above this one. getaccessibl...
...And 2 more matches
nsIAccessibleHyperLink
accessible/public/nsiaccessiblehyperlink.idlscriptable a cross-platform interface that supports hyperlink-specific properties 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 description 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 a...
... 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 the accessible tree. endindex long the end offset of the hyperlink accessible within the parent accessible. the returned value is related to the nsiaccessiblehyperlink interface of the object that owns this hyperlink. read only. note: the link itself is represented by one embedded character within the parent text, so the endindex should be startindex + 1. exceptions thrown ns_error_failure ...
..., so the endindex should be startindex + 1. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. selected boolean determines whether the element currently has the focus, for example after returning from the destination page. read only. note: aria links can only be focused if they have the tabindex attribute set. also, state_focused should then be set on the accessible for this link. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. startindex long the offset of the hyperlink accessible within the parent accessible. the returned value is related to the nsiaccessiblehyperlink interface of...
...And 2 more matches
nsIAccessibleHyperText
able this interface is the main interface to expose hyperlinks in a document, typically a text document, that are used to reference other documents. a typical implementation 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 description 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 lin...
... long getlinkindex(in long charindex); long getselectedlinkindex(); obsolete since gecko 1.9 attributes attribute type description 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 via getlinkindex(). return value an nsiaccessiblehyperlink object. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ns_error_invalid_arg the link index is invalid. getlin...
... nsiaccessiblehyperlink getlink( in long linkindex ); parameters linkindex 0-based index of the link that is to be retrieved. this can be retrieved via getlinkindex(). return value an nsiaccessiblehyperlink object. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ns_error_invalid_arg the link index is invalid. getlinkindex() the link index at the given offset (character index). long getlinkindex( in long charindex ); parameters charindex the 0-based character index. return value the index of the link if it's presented on the given character index, otherwise -1. ...
...And 2 more matches
nsINavHistoryContainerResultNode
cluding bookmark folders). 1.0 66 introduced gecko 1.9 inherits from: nsinavhistoryresultnode last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsinavhistoryresultnode findnodebydetails(in autf8string auristring, in prtime atime, in long long aitemid, in boolean arecursive); nsinavhistoryresultnode getchild(in unsigned long aindex); unsigned long getchildindex(in nsinavhistoryresultnode anode); attributes attribute type description childcount unsigned long the number of child nodes; accessing this throws an ns_error_not_available exception of containeropen is false. read only. childrenreadonly boolean false if the node's list of children can be modified (by adding or removing children, or rearranging them), or ...
...h on. arecursive if true, the search will recurse through all child containers of the current container; if false, only direct children of the container are searched. return value an nsinavhistoryresultnode of a node matching the specified details or null if no match is found. exceptions thrown ns_error_not_available the container is not open. getchild() returns the child node at the specified index. nsinavhistoryresultnode getchild( in unsigned long aindex ); parameters aindex the index into the child list of the node to fetch. returns the node located at the specified index. exceptions thrown ns_error_not_available the containeropen attribute is currently false, indicating that the node isn't open for access. getchildindex() returns the index of a direct child of this container. ...
...exceptions thrown ns_error_not_available the container isn't open (that is, containeropen is false). ...
...And 2 more matches
nsINavHistoryResultTreeViewer
sult 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. method overview nsinavhistoryresultnode nodefortreeindex(in unsigned long aindex); unsigned long treeindexfornode(in nsinavhistoryresultnode anode); attributes attribute type description collapseduplicates boolean controls whether duplicate adjacent elements are collapsed into a single item in the tree. this prevents you from seeing multiple entries for things when you have selected to get visits. when you sort by date, the multiple entries ...
....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. ...
...how many items are in the flattened list of results, that is how many rows are in this tree right now. the tree adaptor will also qi to nsitreeview, and this will be the same as nsitreeview.rowcount. this is only valid when a tree is attached, the result will be 0 otherwise. read only. obsolete since gecko 1.9 constants constant value description index_invisible 0xffffffff returned by treeindexfornode() when the requested node isn't visible (such as when its parent is collapsed). also returned if there is no tree attached. methods nodefortreeindex() returns the node for a given row index. this is only valid when a tree is attached. nsinavhistoryresultnode nodefortreeindex( in unsigned long aindex ); parameters aindex the row index of the note to return. return value the node loc...
...And 2 more matches
nsITransactionList
editor/txmgr/idl/nsitransactionlist.idlscriptable please add a summary to this article. inherits from: nsisupports last changed in gecko 1.7 method overview nsitransactionlist getchildlistforitem(in long aindex); nsitransaction getitem(in long aindex); long getnumchildrenforitem(in long aindex); boolean itemisbatch(in long aindex); attributes attribute type description numitems long the number of transactions contained in this 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. the list returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransactionlist getchildlistforitem( in long ...
...umitems long the number of transactions contained in this 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. the list returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransactionlist getchildlistforitem( in long aindex ); parameters aindex the index of the item in the list. return value the nsitransactionlist of children associated with the item at aindex. getitem() returns the transaction at the given index in the list. note that a null can be returned here if the item is a batch. the transaction returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransaction getite...
...s aindex the index of the item in the list. return value the nsitransactionlist of children associated with the item at aindex. getitem() returns the transaction at the given index in the list. note that a null can be returned here if the item is a batch. the transaction returned is addref'd so it is up to the caller to release the transaction when it is done. nsitransaction getitem( in long aindex ); parameters aindex the index of the item in the list. return value missing description getnumchildrenforitem() returns the number of child (auto-aggreated) transactions the item at aindex has. long getnumchildrenforitem( in long aindex ); parameters aindex the index of the item in the list. return value the number of child (auto-aggreated) transactions the item at aindex has. itemisbatc...
...And 2 more matches
Storage Inspector - Firefox Developer Tools
spect various types of storage that a web page can use. currently it can be used to inspect the following storage types: cache storage — any dom caches created using the cache api. cookies — all the cookies created by the page or any iframes inside of the page. cookies created as a part of response of network calls are also listed, but only for calls that happened while the tool is open. indexeddb — all indexeddb databases created by the page or any iframes inside the page, their object stores and the items stored in these object stores. local storage — all local storage items created by the page or any iframes inside the page. session storage — all session storage items created by the page or any iframes inside the page. for the time being, the storage inspector only gives y...
...lled "storage" in the developer toolbox. storage inspector user interface the storage inspector ui is split into three main components: storage tree table widget sidebar storage tree the storage tree lists all the storage types that the storage inspector can inspect: under each type, objects are organized by origin. for cookies, the protocol does not differentiate the origin. ...
... organized by origin. for cookies, the protocol does not differentiate the origin. for indexed db or local storage an origin is a combination of protocol + hostname. for example, "http://mozilla.org" and "https://mozilla.org" are two different origins so local storage items cannot be shared between them. under "cache storage", objects are organized by origin and then by the name of the cache: indexeddb objects are organized by origin, then by database name, then by object store name: with the cookies, local storage, and session storage types, there's only one level in the hierarchy, so stored items are listed directly under each origin: you can click on each item in the tree to expand or collapse its children. the tree is live, so if a new origin gets added (by adding an iframe, for e...
...And 2 more matches
DataTransfer.mozGetDataAt() - Web APIs
return value nsivariant the data item requested. ...
... return value nsivariant the data item requested. ...
... return value nsivariant the data item requested. ...
...And 2 more matches
DataTransferItemList.remove() - Web APIs
return value undefined. exceptions invalidstateerror the drag data store is not in read/write mode, so the item can't be removed. example this example shows the use of the remove() method. ...
... return value undefined. exceptions invalidstateerror the drag data store is not in read/write mode, so the item can't be removed. example this example shows the use of the remove() method. ...
... return value undefined. exceptions invalidstateerror the drag data store is not in read/write mode, so the item can't be removed. example this example shows the use of the remove() method. ...
...And 2 more matches
HTMLSelectElement - Web APIs
control used by servers and dom search functions. htmlselectelement.optionsread only an htmloptionscollection representing the set of <option> (htmloptionelement) elements contained by this element. htmlselectelement.required a boolean reflecting the required html attribute, which indicates whether the user is required to select a value before submitting the form. htmlselectelement.selectedindex a long reflecting the index of the first selected <option> element. the value -1 indicates no element is selected. htmlselectelement.selectedoptionsread only an htmlcollection representing the set of <option> elements that are selected. htmlselectelement.size a long reflecting the size html attribute, which contains the number of visible items in the control. the default is 1, unless multip...
...d whether it satisfies them. if the element fails its constraints, the browser fires a cancelable invalid event at the element (and returns false). htmlselectelement.focus() gives input focus to this element. this method is now implemented on htmlelement. htmlselectelement.item() gets an item from the options collection for this <select> element. you can also access an item by specifying the index in array-style brackets or parentheses, without calling this method explicitly. htmlselectelement.nameditem() gets the item in the options collection with the specified name. the name string can match either the id or the name attribute of an option node. you can also access an item by specifying the name in array-style brackets or parentheses, without calling this method explicitly. htmlselec...
... this method explicitly. htmlselectelement.nameditem() gets the item in the options collection with the specified name. the name string can match either the id or the name attribute of an option node. you can also access an item by specifying the name in array-style brackets or parentheses, without calling this method explicitly. htmlselectelement.remove() removes the element at the specified index from the options collection for this select element. htmlselectelement.reportvalidity() this method reports the problems with the constraints on the element, if any, to the user. if there are problems, it fires a cancelable invalid event at the element, and returns false; if there are no problems, it returns true. htmlselectelement.setcustomvalidity() sets the custom validity message for the ...
...And 2 more matches
IDBCursor.source - Web APIs
Web › API › IDBCursor › source
example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. ...
... example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. ...
...ndex that the cursor is iterating over. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. within each iteration we log the source of the cursor, which will log our idbobjectstore object to the console, something like this: idbobjectstore {autoincrement: false, transaction: idbtransaction, indexnames: domstringlist, keypath: "albumtitle", name: "rushalbumlist"…} the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) function displayda...
...And 2 more matches
IDBCursor - Web APIs
Web › API › IDBCursor
note: not to be confused with idbcursorwithvalue which is just an idbcursor interface with an additional value property. the idbcursor interface of the indexeddb api represents a cursor for traversing or iterating over multiple records in a database. the cursor has a source that indicates which index or object store it is iterating over. it has a position within the range, and moves in a direction that is increasing or decreasing in the order of record keys. the cursor enables an application to asynchronously process all the records in the cursor's range. you can have an unlimited number of cursors at the same time. you always get the same idbcursor object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web...
...this function never returns null or throws an exception, even if the cursor is currently being iterated, has iterated past its end, or its transaction is not active. ...
...e. idbcursor.request read only returns the idbrequest that was used to obtain the cursor. methods idbcursor.advance() sets the number of times a cursor should move its position forward. idbcursor.continue() advances the cursor to the next position along its direction, to the item whose key matches the optional key parameter. idbcursor.continueprimarykey() sets the cursor to the given index key and primary key given as arguments. idbcursor.delete() returns an idbrequest object, and, in a separate thread, deletes the record at the cursor's position, without changing the cursor's position. this can be used to delete specific records. idbcursor.update() returns an idbrequest object, and, in a separate thread, updates the value at the current position of the cursor in the object ...
...And 2 more matches
IDBCursorSync - Web APIs
it enables an application to synchronously process all the records in the cursor's range. ...
...it enables an application to synchronously process all the records in the cursor's range. ...
...it enables an application to synchronously process all the records in the cursor's range. ...
...And 2 more matches
IDBDatabase: abort event - Web APIs
he connection object. bubbles yes cancelable no interface event event handler property onabort examples this example opens a database (creating the database if it does not exist), then opens a transaction, adds a listener to the abort event, then aborts the transaction to trigger the event. ...
...ansaction to trigger the event. ...
...enrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const db = dbopenrequest.result; db.addeventlistener('abort', () => { console.log('transaction aborted'); }); // o...
...And 2 more matches
IDBFactory.open() - Web APIs
Web › API › IDBFactory › open
hod, with its result attribute set to the new idbdatabase object for the connection. if an error occurs while the database connection is being opened, then an error event is fired on the request object returned from this method. may trigger upgradeneeded, blocked or versionchange events. note: this feature is available in web workers. syntax for the current standard: var idbopendbrequest = indexeddb.open(name); var idbopendbrequest = indexeddb.open(name, version); parameters name the name of the database. version optional optional. the version to open the database with. if the version is not provided and the database exists, then a connection to the database will be opened without changing its version. if the version is not provided and the database does not exist, then it will b...
...bopendbrequest object on which subsequent events related to this request are fired. exceptions this method may raise a domexception of the following types: exception description typeerror the value of version is zero or a negative number or not a number. ...
...equest = window.indexeddb.open("todolist", 4); in the following code snippet, we make a request to open a database, and include handlers for the success and error cases. for a full working example, see our to-do notifications app (view example live.) var note = document.queryselector("ul"); // in the following line, you should include the prefixes // of implementations you want to test. window.indexeddb = window.indexeddb || window.mozindexeddb || window.webkitindexeddb || window.msindexeddb; // don't use "var indexeddb = ..." if you're not in a function. // moreover, you may need references to some window.idb* objects: window.idbtransaction = window.idbtransaction || window.webkitidbtransaction || window.msidbtransaction; window.idbkeyrange = window.idbkeyrange || window.webkitidbkeyrange |...
...And 2 more matches
IDBOpenDBRequest: blocked event - Web APIs
the blocked handler is executed when an open connection to a database is blocking a versionchange transaction on the same database. ...
...st = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { // let's try to open the same database with a higher revision ...
...ique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { // let's try to open the same database with a higher revision version const req2 = indexeddb.open('todolist', 5); // in this case the onblocked handler will be executed req2.addeventlistener('blocked', () => { console.log('request was blocked'); }); }; using the onblocked property: // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; db.onerror = () => { co...
...And 2 more matches
IDBOpenDBRequest - Web APIs
note: this feature is available in web workers. ...
...gher than its current version. also available via the onupgradeneeded property. example in the following example you can see the onupgradeneeded handler being used to update the database structure if a database with a higher version number is loaded. for a full working example, see our to-do notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these event handlers act on the database being opened. dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db // variable. this is used a lot below db = dbopenreque...
...// variable. ...
...And 2 more matches
IDBRequest - Web APIs
each reading and writing operation on a database is done using a request. the request object does not initially contain any information about the result of the operation, but once information becomes available, an event is fired on the request, and the information becomes available through the properties of the idbrequest instance. all asynchronous operations immediately return an idbrequest instance. each request has a readystate that is set to the 'pending' state; this changes to 'done' when the request is completed or fails. ...
...its properties from eventtarget. idbrequest.error read only returns a domexception in the event of an unsuccessful request, indicating what went wrong. idbrequest.result read only returns the result of the request. if the the request failed and the result is not available, an invalidstateerror exception is thrown. idbrequest.source read only the source of the request, such as an idbindex or an idbobjectstore. if no source exists (such as when calling idbfactory.open), it returns null. idbrequest.readystate read only the state of the request. every request starts in the pending state. the state changes to done when the request completes successfully or when an error occurs. idbrequest.transaction read only the transaction for the request. this property can be null for certai...
... when an idbrequest succeeds. also available via the onsuccess property. example in the following code snippet, we open a database asynchronously and make a request; onerror and onsuccess functions are included to handle the success and error cases. for a full working example, see our to-do notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being // opened successfully, or not dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database. db = dbopenrequest.result; }; specifi...
...And 2 more matches
IDBTransaction: abort event - Web APIs
the abort event is fired when an indexeddb transaction is aborted. bubbles yes cancelable no interface event event handler property onabort this can happen for any of the following reasons: bad requests, (for example, trying to add the same key twice, or put the same index key when the key has a uniqueness constraint), an explicit abort() call an uncaught exception in the request's success/error handler, an i/o error (an actual failure to write to disk, for example disk detached, or other os/hardware failure) quota exceeded. examples this example opens a database (creating the database if it does not exist), then opens a transaction, adds a listener to the abort event, then aborts the transaction to trigger the event. // open t...
... success/error handler, an i/o error (an actual failure to write to disk, for example disk detached, or other os/hardware failure) quota exceeded. examples this example opens a database (creating the database if it does not exist), then opens a transaction, adds a listener to the abort event, then aborts the transaction to trigger the event. ...
...uest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = event => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = event => { const db = dbopenrequest.result; // open a read/write db tran...
...And 2 more matches
Microdata DOM API - Web APIs
items of a particular type given in the document: var cats = document.getitems("http://example.com/feline"); once an element representing an item has been obtained, its properties can be extracted using the properties idl attribute. this attribute returns an htmlpropertiescollection, which can be enumerated to go through each element that adds one or more properties to the item. it can also be indexed by name, which will return an object with a list of the elements that add properties with that name. each element that adds a property also has an itemvalue idl attribute that returns its value. code example this sample gets the first item of type "http://example.net/user" and then pops up an alert using the "name" property from that item. var user = document.getitems('http://example.net/us...
...ent that adds a property also has an itemvalue idl attribute that returns its value. code example this sample gets the first item of type "http://example.net/user" and then pops up an alert using the "name" property from that item. var user = document.getitems('http://example.net/user')[0]; alert('hello ' + user.properties['name'][0].itemvalue + '!'); the htmlpropertiescollection object, when indexed by name in this way, actually returns a propertynodelist object with all the matching properties. the propertynodelist object can be used to obtain all the values at once usingits getvalues method, which returns an array of all the values. code example in an earlier example, a "http://example.org/animals#cat" item had two "http://example.com/color" values. this script looks up the first such ...
...lcollection { // inherits length and item() getter propertynodelist? nameditem(domstring name); // shadows inherited nameditem() readonly attribute domstring[] names; }; typedef sequence<any> propertyvaluearray; interface propertynodelist : nodelist { propertyvaluearray getvalues(); }; collection . length returns the number of elements in the collection. element = collection . ...
...And 2 more matches
StyleSheet.media - Web APIs
Web › API › StyleSheet › media
style information. it is a read-only, array-like medialist object and can be removed with deletemedium() and added with appendmedium(). ...
...n. it is a read-only, array-like medialist object and can be removed with deletemedium() and added with appendmedium(). ...
...object and can be removed with deletemedium() and added with appendmedium(). ...
...And 2 more matches
WebGL2RenderingContext.vertexAttribI4[u]i[v]() - Web APIs
v0, v1, v2, v3 an integer number for the vertex attribute value. value a uint32array/int32array or sequences of gluint/ glint for integer vector vertex attribute values. return value none. ...
... v0, v1, v2, v3 an integer number for the vertex attribute value. value a uint32array/int32array or sequences of gluint/ glint for integer vector vertex attribute values. return value none. ...
... v0, v1, v2, v3 an integer number for the vertex attribute value. value a uint32array/int32array or sequences of gluint/ glint for integer vector vertex attribute values. return value none. ...
...And 2 more matches
WebGLRenderingContext.bindAttribLocation() - Web APIs
this name cannot start with "webgl_" or "_webgl_", as these are reserved for use by webgl. return value none. ...
...this name cannot start with "webgl_" or "_webgl_", as these are reserved for use by webgl. return value none. ...
...this name cannot start with "webgl_" or "_webgl_", as these are reserved for use by webgl. return value none. ...
...And 2 more matches
WebGLRenderingContext.getVertexAttrib() - Web APIs
otherwise false. ...
...otherwise false. ...
...otherwise false. ...
...And 2 more matches
Window.navigator - Web APIs
Web › API › Window › navigator
ndow.navigator read-only property returns a reference to the navigator object, which has methods and properties about the application running the script. 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. ...
... 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. ...
...1) { sbrowser = "mozilla firefox"; // "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:61.0) gecko/20100101 firefox/61.0" } else if (susrag.indexof("samsungbrowser") > -1) { sbrowser = "samsung internet"; // "mozilla/5.0 (linux; android 9; samsung sm-g955f build/ppr1.180610.011) applewebkit/537.36 (khtml, like gecko) samsungbrowser/9.4 chrome/67.0.3396.87 mobile safari/537.36 } else if (susrag.indexof("opera") > -1 || susrag.indexof("opr") > -1) { sbrowser = "opera"; // "mozilla/5.0 (macintosh; intel mac os x 10_14_0) applewebkit/537.36 (khtml, like gecko) chrome/70.0.3538.102 safari/537.36 opr/57.0.3098.106" } else if (susrag.indexof("trident") > -1) { sbrowser = "microsoft internet explorer"; // "mozilla/5.0 (windows nt 10.0; wow64; trident/7.0; .net4.0c; .net4.0e; zoom 3.6.0; wbx ...
...And 2 more matches
Web APIs
Web › API
ent light eventsbbackground tasksbattery api beaconbluetooth apibroadcast channel apiccss counter stylescss font loading api cssomcanvas apichannel messaging apiconsole apicredential management apiddomeencoding apiencrypted 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 apipayment request apiperformance apiperformance timeline apipermissions apipointer eventspointer lock apiproximity events push api rresize observer apiresource timing apisserver ...
...e cache cachestorage canvascapturemediastreamtrack canvasgradient canvasimagesource canvaspattern canvasrenderingcontext2d caretposition channelmergernode channelsplitternode characterdata childnode client clients clipboard clipboardevent clipboarditem closeevent comment compositionevent constantsourcenode constrainboolean constraindomstring constraindouble constrainulong contentindex contentindexevent convolvernode countqueuingstrategy crashreportbody credential credentialscontainer crypto cryptokey cryptokeypair customelementregistry customevent d domconfiguration domerror domexception domhighrestimestamp domimplementation domimplementationlist domlocator dommatrix dommatrixreadonly domobject domparser dompoint dompointinit dompointreadonly domquad d...
...ldlistelement htmldataelement htmldatalistelement htmldetailselement htmldialogelement htmldivelement htmldocument htmlelement htmlembedelement htmlfieldsetelement htmlfontelement htmlformcontrolscollection htmlformelement htmlframesetelement htmlhrelement htmlheadelement htmlheadingelement htmlhtmlelement htmlhyperlinkelementutils htmliframeelement htmlimageelement htmlinputelement htmlisindexelement htmlkeygenelement htmllielement htmllabelelement htmllegendelement htmllinkelement htmlmapelement htmlmarqueeelement htmlmediaelement htmlmenuelement htmlmenuitemelement htmlmetaelement htmlmeterelement htmlmodelement htmlolistelement htmlobjectelement htmloptgroupelement htmloptionelement htmloptionscollection htmlorforeignelement htmloutputelement htmlparagraphelement htmlparamel...
...And 2 more matches
Using the group role - Accessibility
screen magnifiers may enlarge the group. 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: using the group role with a html tree view the snippet below shows how the group role is added directly into the html source code. ...
...ed above is one of those opinions and therefore not normative. examples example 1: using the group role with a html tree view the snippet below shows how the group role is added directly into the html source code. ...
... example 1: using the group role with a html tree view the snippet below shows how the group role is added directly into the html source code. ...
...And 2 more matches
ARIA: button role - Accessibility
the button role should be used for clickable elements that trigger a response when activated by the user. adding role="button" will make an element appear as a button control to a screen reader. this role can be used in combination with the aria-pressed attribute to create toggle buttons. ...
...he enter or space key on the keyboard. (note not the deprecated onkeypress) changing attribute values aria-pressed the value of aria-pressed defines the state of a toggle button. this attribute has one of four possible values: true, false, mixed, undefined examples basic button example in this example, a span element has been given the button role. because a <span> element is used, the tabindex attribute is required to make the button focusable and part of the page's tab order. the included css style is provided to make the <span> element look like a button, and to provide visual cues when the button has focus. the handlebtnclick and handlebtnkeydown event handlers perform the button's action when activated using a mouse click or the space or enter key. in this case, the action is to a...
...ng a mouse click or the space or enter key. in this case, the action is to add a new name to the list of names. try the example by adding a name to the text box. the button will cause the name to be added to a list. ...
...And 2 more matches
Atomics - JavaScript
finished before the next operation starts and that operations are not interrupted. wait and notify the wait() and notify() methods are modeled on linux futexes ("fast user-space mutex") and provide ways for waiting until a certain condition becomes true and are typically used as blocking constructs. static methods atomics.add() adds the provided value to the existing value at the specified index of the array. returns the old value at that index. atomics.and() computes a bitwise and on the value at the specified index of the array with the provided value. returns the old value at that index. atomics.compareexchange() stores a value at the specified index of the array, if it equals a value. returns the old value. atomics.exchange() stores a value at the specified index of the array. ...
... the specified index of the array. returns the old value. atomics.islockfree(size) an optimization primitive that can be used to determine whether to use locks or atomic operations. returns true if an atomic operation on arrays of the given element size will be implemented using a hardware atomic operation (as opposed to a lock). experts only. atomics.load() returns the value at the specified index of the array. atomics.notify() notifies agents that are waiting on the specified index of the array. returns the number of agents that were notified. atomics.or() computes a bitwise or on the value at the specified index of the array with the provided value. returns the old value at that index. atomics.store() stores a value at the specified index of the array. returns the value. atomics.s...
...returns either "ok", "not-equal", or "timed-out". if waiting is not allowed in the calling agent then it throws an error exception. ...
...And 2 more matches
String.prototype.charCodeAt() - JavaScript
the charcodeat() method returns an integer between 0 and 65535 representing the utf-16 code unit at the given index. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the utf-16 code unit matches the unicode code point for code points which can be represented in a single utf-16 code unit. if the unicode code point cannot be represented in a single utf-16 code unit (because its value is greater than 0xffff) then the code unit returned will be the first part of a surrogate pair for the code point. ...
...it matches the unicode code point for code points which can be represented in a single utf-16 code unit. if the unicode code point cannot be represented in a single utf-16 code unit (because its value is greater than 0xffff) then the code unit returned will be the first part of a surrogate pair for the code point. if you want the entire code point value, use codepointat(). syntax str.charcodeat(index) parameters index an integer greater than or equal to 0 and less than the length of the string. if index is not a number, it defaults to 0. return value a number representing the utf-16 code unit value of the character at the given index. if index is out of range, charcodeat() returns nan. description unicode code points range from 0 to 1114111 (0x10ffff). the first 128 unicode code poi...
...rise the real character. because of this, in order to examine (or reproduce) the full character for individual character values of 65536 or greater, for such characters, it is necessary to retrieve not only charcodeat(i), but also charcodeat(i+1) (as if manipulating a string with two letters), or to use codepointat(i) instead. see examples 2 and 3 (below). charcodeat() returns nan if the given index is less than 0, or if it is equal to or greater than the length of the string. backward compatibility: in historic versions (like javascript 1.2) the charcodeat() method returns a number indicating the iso-latin-1 codeset value of the character at the given index. the iso-latin-1 codeset ranges from 0 to 255. the first 0 to 127 are a direct match of the ascii character set. examples using char...
...And 2 more matches
String.prototype.matchAll() - JavaScript
iterable). examples regexp.exec() and matchall() prior to the addition of matchall to javascript, it was possible to use calls to regexp.exec (and regexes with the /g flag) in a loop to obtain all the matches: const regexp = regexp('foo[a-z]*','g'); const str = 'table football, foosball'; let match; while ((match = regexp.exec(str)) !== null) { console.log(`found ${match[0]} start=${match.index} end=${regexp.lastindex}.`); // expected output: "found football start=6 end=14." // expected output: "found foosball start=16 end=24." } with matchall available, you can avoid the while loop and exec with g. instead, by using matchall, you get an iterator to use with the more convenient for...of, array spread, or array.from() constructs: const regexp = regexp('foo[a-z]*','g'); const str ...
...h matchall available, you can avoid the while loop and exec with g. ...
...e, you can avoid the while loop and exec with g. instead, by using matchall, you get an iterator to use with the more convenient for...of, array spread, or array.from() constructs: const regexp = regexp('foo[a-z]*','g'); const str = 'table football, foosball'; const matches = str.matchall(regexp); for (const match of matches) { console.log(`found ${match[0]} start=${match.index} end=${match.index + match[0].length}.`); } // expected output: "found football start=6 end=14." // expected output: "found foosball start=16 end=24." // matches iterator is exhausted after the for..of iteration // call matchall again to create a new iterator array.from(str.matchall(regexp), m => m[0]); // array [ "football", "foosball" ] matchall will throw an exception if the g flag is missing. const regexp = ...
...And 2 more matches
String.prototype.substr() - JavaScript
the substr() method returns a portion of the string, starting at the specified index and extending for a given number of characters afterwards. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.substr(start[, length]) parameters start the index of the first character to include in the returned substring. length optional. the number of characters to extract. return value a new string containing the specified part of the given string. ...
...its value is capped at -str.length. ...
...its value is capped at -str.length. note: in microsoft jscript, negative values of the start argument are not considered to refer to the end of the string. ...
...And 2 more matches
String.prototype.substring() - JavaScript
the substring() method returns the part of the string between the start and end indexes, or to the end of the string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax 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. ...
...es and send us a pull request. syntax str.substring(indexstart[, indexend]) parameters indexstart the index of the first character to include in the returned substring. indexend optional the index of the first character to exclude from the returned substring. return value a new string containing the specified part of the given string. description substring() extracts characters from indexstart up to but not including indexend. in particular: if indexend is omitted, substring() extracts characters to the end of the string. if indexstart is equal to indexend, substring() returns an empty string. if indexstart is greater than indexend, then the effect of substring() is as if the two arguments were swapped; see example below. any argument value that is less than 0 or greater th...
...tring4) // displays 'zilla' the last 5 characters let anystring = 'mozilla' let anystring5 = anystring.substring(anystring.length - 5) console.log(anystring5) the difference between substring() and substr() there's a subtle difference between the substring() and substr() methods, so you should be careful not to get them confused. the arguments of substring() represent the starting and ending indexes, while the arguments of substr() represent the starting index and the number of characters to include in the returned string. furthermore, substr() is considered a legacy feature in ecmascript 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" ...
...And 2 more matches
TypedArray.prototype.filter() - JavaScript
rray types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.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. description the filter() method calls a provided callback function once for each element in a typed array, and constructs a new typed array of all the values for which callback returns a true valu...
...ep the element, false otherwise. thisarg optional value to use as this when executing callback. return value a new typed array with the elements that pass the test. description the filter() method calls a provided callback function once for each element in a typed array, and constructs a new typed array of all the values for which callback returns a true value. ...
...executing callback. return value a new typed array with the elements that pass the test. description the filter() method calls a provided callback function once for each element in a typed array, and constructs a new typed array of all the values for which callback returns a true value. callback is invoked only for indexes of the typed array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. ...
...And 2 more matches
TypedArray.prototype.find() - JavaScript
the find() method returns a value in the typed array, if an element satisfies the provided testing function. otherwise undefined is returned. typedarray is one of the typed array types here. see also the findindex() method, which returns the index of a found element in the typed array instead of its value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.find(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the array find was called upon. thisarg optional. object to use as this when executing callback. return value a value in the array if an element passes the test; otherwise, undefined. description the find method executes the callback function once for each element present in the typed array until it finds ...
... return value a value in the array if an element passes the test; otherwise, undefined. description the find method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value. if such an element is found, find immediately returns the value of that element. otherwise, find returns undefined. callback is invoked only for indexes of the typed array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. callback is invoked with three arguments: the value of the element, the index of the element, and the typed array object being traversed. if a thisarg parameter is provided to find, it will be used as the this for each invocation of the callback. if it...
...And 2 more matches
Caching compiled WebAssembly modules - WebAssembly
warning: experimental webassembly.module indexeddb serialization support is being removed from browsers; see bug 1469395 and this spec issue. 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. 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. this includes compiled wasm modules (webassembly.module javascript objects). ...
...hing 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. this includes compiled wasm modules (webassembly.module javascript 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 script, 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...
...= 'wasm-cache'; setting up the database the first helper function contained inside instantiatecachedurl() — opendatabase() — creates an object store for storing wasm modules, and also handles clearing out the database if the dbversion is updated; it returns a promise resolving to the new database. ...
...And 2 more matches
panel - Archive of obsolete content
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.wikipedia.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("sdk/self").data.u...
... and the add-on script receives them using panel.port.on(). var myscript = "window.addeventlistener('click', function(event) {" + " var t = event.target;" + " if (t.nodename == 'a')" + " self.port.emit('click-link', t.tostring());" + "}, false);" var mypanel = require("sdk/panel").panel({ contenturl: "http://www.bbc.co.uk/mobile/index.html", contentscript: myscript }); mypanel.port.on("click-link", function(url) { console.log(url); }); mypanel.show(); this example uses contentscript to supply the script as a string. it's usually better practice to use contentscriptfile, which is a url pointing to a script file saved under your add-on's data directory. warning: unless your content script is extremely simple and consist...
...k href="panel-style.css" type="text/css" rel="stylesheet"> </head> <body> my panel content </body> </html> from firefox 31 onwards, you can style panel content using the contentstyle or contentstylefile options. ...
... panel limitations although panels can host html documents, they are not implemented as browser tabs, ...
ui/sidebar - Archive of obsolete content
probably listen to detach, and in its handler, remove your reference to the worker. ...
...etach, and in its handler, remove your reference to the worker. ...
...ler, remove your reference to the worker. ...
...er. ...
Creating annotations - Archive of obsolete content
r for messages from this worker. if the message is show we will just log the content for the time being. if the message is detach we remove the worker from the selectors array. ...
...this worker. if the message is show we will just log the content for the time being. if the message is detach we remove the worker from the selectors array. ...
...ssage is show we will just log the content for the time being. if the message is detach we remove the worker from the selectors array. ...
...tent for the time being. if the message is detach we remove the worker from the selectors array. at the top of the file import the page-mod module and declare an array for the workers: var pagemod = require('sdk/page-mod'); var selectors = []; add detachworker(): function detachworker(worker, workerarray) { var index = workerarray.indexof(worker); if(index != -1) { workerarray.splice(index, 1); } } edit toggleactivation() to notify the workers of a change in activation state: function activateselectors() { selectors.foreach( function (selector) { selector.postmessage(annotatorison); }); } function toggleactivation() { annotatorison = !annotatorison; activateselectors(); return annotatorison; } we'll be using this url in all our screenshots. because cfx run...
Creating Reusable Modules - Archive of obsolete content
you can split your code into separate modules with clearly defined interfaces between them. you then import and use these modules from other parts of your add-on using the require() statement, in exactly that same way that you import core sdk modules like page-mod or panel. it can often make sense to structure a larger or more complex add-on as a collection of modules. ...
...as string. note that you usually won't // need to work with the string paths. var path = fp.file.path; // work with returned nsilocalfile... } return path; } require("sdk/ui/button/action").actionbutton({ id: "show-panel", label: "show panel", icon: { "16": "./icon-16.png" }, onclick: function() { console.log(md5file(promptforfile())); } }); this works , but index.js is now getting longer and its logic is harder to understand. let's factor the file picker and hashing code into separate modules. creating separate modules filepicker.js first create a new file in "lib" called "filepicker.js". copy the file picker code into this new file, and add the following line at the end: exports.promptforfile = promptforfile; this defines the public interface of th...
...; // this tells updatefromstream to read the entire file const pr_uint32_max = 0xffffffff; ch.updatefromstream(istream, pr_uint32_max); // pass false here to get binary data back var hash = ch.finish(false); // convert the binary hash data to a hex string. ...
...omstream to read the entire file const pr_uint32_max = 0xffffffff; ch.updatefromstream(istream, pr_uint32_max); // pass false here to get binary data back var hash = ch.finish(false); // convert the binary hash data to a hex string. ...
Display a Popup - Archive of obsolete content
is tutorial we'll create an add-on that adds an action button to the toolbar that displays a panel when clicked. the panel just contains a <textarea> element: when the user presses the return key, the contents of the <textarea> is sent to the main add-on code. the main add-on code logs the message to the console. ...
...ge to the console. the add-on consists of seven files: package.json: created when you run jpm init index.js: the main add-on code, that creates the button and panel get-text.js: the content script that interacts with the panel content text-entry.html: the panel content itself, specified as html icon-16.png, icon-32.png, and icon-64.png: icons for the button in three different sizes the "index.js" looks like this: var data = require("sdk/self").data; // construct a panel, loading its content from the "text-entry.html" // file in the "data" directory, and loading the "get-text.js" script // into it. var text_entry = require("sdk/panel").panel({ contenturl: data.url("text-entry.html"), contentscriptfile: data.url("get-text.js") }); // create a button require("sdk/ui/button/action")...
...type some text and press "return" and you should see the output in the console. if you use a toggle bu...
...type some text and press "return" and you should see the output in the console. if you use a toggle button, you can attach the panel to the button. ...
Creating a Microsummary - Archive of obsolete content
ing the same tools and languages you already use to generate pages. for example, if you use php scripts 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, it loads the url in the href attribute. if the url points to a generator, it uses the generator to generate the microsummary for the page. otherwise, if the url returns plain text content (or html content that can be converted to plain text), firefox uses the content as the microsummary for the page. b...
... making the generator available for download now that the generator applies to the spread firefox home page, the only thing left to do is to make it downloadable. to do so, we need to put it up on the web and then ...
...o, we need to put it up on the web and then create a javascript link on some web page that calls firefox's window.sidebar.addmicrosummarygenerator() method to download and install the generator. ...
...a javascript link on some web page that calls firefox's window.sidebar.addmicrosummarygenerator() method to download and install the generator. ...
insertItemAt - Archive of obsolete content
« xul reference home insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. ...
... « xul reference home insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. ...
... to insert an item at the end with element.getrowcount() + 1 example <!-- this example inserts at the selected item or appends, then selects the newly created item --> <script language="javascript"> function insertitemtolist(){ var mylistbox = document.getelementbyid('mylistbox'); // create a date to get some labels and values var somedate = new date(); if(mylistbox.selectedindex == -1){ // no item was selected in list so append to the end mylistbox.appenditem( somedate.tolocaletimestring(), somedate.gettime() ); var newindex = mylistbox.getrowcount() -1 }else{ // item was selected so insert at the selected item var newindex = mylistbox.selectedindex; mylistbox.insertitemat(newindex, somedate.tolocaletimestring(), some...
...tbox.appenditem( somedate.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; } </script> <button label="insert item at selected" oncommand="insertitemtolist()"/> <listbox id="mylistbox"> <listitem label="foo"/> </listbox> see also appenditem() removeitemat() ...
Template and Tree Listeners - Archive of obsolete content
is removed, and didrebuild method will be called when the content has been regenerated. this listener will also work for tree builders, and will call the appropriate methods before and after the tree has been generated. to assign a builder listener to a builder, use the addlistener method. var somelistener = { item: null, willrebuild : function(builder) { this.item = builder.getresourceatindex(builder.root.currentindex); }, didrebuild : function(builder) { if (this.item) { var idx = builder.getindexofresource(this.item) if (idx != -1) builder.root.view.selection.select(idx); } } }; tree.builder.addlistener(somelistener); this example is very simple and just saves and restores the selected index after a rebuild. since the content goes away during a rebuild, t...
...t, so it is restored here during the didrebuild method. the firefox bookmarks window uses this technique. if you try an example using the code above, you will notice that the first tree will maintain the selection when the rebuild button is pressed, whereas in the second tree does not. this is because the listener is only attached to the first tree. ...
...estored here during the didrebuild method. the firefox bookmarks window uses this technique. if you try an example using the code above, you will notice that the first tree will maintain the selection when the rebuild button is pressed, whereas in the second tree does not. this is because the listener is only attached to the first tree. the example above makes use of the getresourceatindex and getindexofresource methods. these two methods are available for tree builders and will convert between an index in the tree and the associated member resource for the item at the index. naturally, we can't store the index as the item may have moved its position. or, the resource may no longer be part of the results, which is why we need to check the return value of the getindexofresource method. (as this ...
...function checks the orientation and returns the opposite. this works as the 'on' value is 0 and the 'between' values are -1 and 1. obviously, this code is much simpler than what we would really want to use -- we should be checking what is being dragged to make sure that it is compatible with the tree. or, we might want to allow dropping on specific rows only; the drop methods are supplied with an index argument so we can check for this. « previousnext » ...
Focus and Selection - Archive of obsolete content
ne element per window has the focus at a time. the user can change the focus by clicking an element with the mouse or by pressing the tab key. when the tab key is pressed, the next element is given the focus. to step backwards, the shift key and tab key can be pressed. rearranging the tab order you can change the order in which elements are focused when the user presses the tab key by adding a tabindex attribute to an element. this attribute should be set to a number. when the user presses tab, the focus will shift to the element with the next highest tab index. that means that you can order the elements by setting indices on elements in sequence. usually, however, you would not set the tabindex attribute. if you do not, pressing tab will set the focus to the next displayed element. you only ne...
...the blur event 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. ...
...the blur event is used to respond when the focus is removed from an element. ...
...the blur event 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. ...
Modifying a XUL Interface - Archive of obsolete content
.) example 6 : source view <button label="change" oncommand="this.nextsibling.checked = !this.nextsibling.checked;"/> <checkbox label="check for messages"/> radio buttons may be selected as well using properties, however since only one in a group may be selected at a time, the others must all be unchecked when one is checked. you don't have to do this manually of course. the radiogroup's selectedindex property may be used to do this. the selectedindex property may be used to retrieve the index of the selected radio button in the group and well as change it. changing a element disabled or enabled it is common to disable particular fields that don't apply in a given situation. for example, in a preferences dialog, one might have the choice of several possibilities, but one choice allows addition...
...or enabled it is common to disable particular fields that don't apply in a given situation. for example, in a preferences dialog, one might have the choice of several possibilities, but one choice allows additional customization. here is an example of how to create this type of interface. ...
...lds that don't apply in a given situation. for example, in a preferences dialog, one might have the choice of several possibilities, but one choice allows additional customization. here is an example of how to create this type of interface. example 7 : source view <script> function updatestate(){ var name = document.getelementbyid("name"); var sindex = document.getelementbyid("group").selectedindex; name.disabled = sindex == 0; } </script> <radiogroup id="group" onselect="updatestate();"> <radio label="random name" selected="true"/> <hbox> <radio label="specify a name:"/> <textbox id="name" value="jim" disabled="true"/> </hbox> </radiogroup> in this example a function updatestate() is called whenever a select event is fired on the radio group. this will happen whenever a r...
...el="random name" selected="true"/> <hbox> <radio label="specify a name:"/> <textbox id="name" value="jim" disabled="true"/> </hbox> </radiogroup> in this example a function updatestate() is called whenever a select event is fired on the radio group. this will happen whenever a radio button is selected. this function will retrieve the currently selected radio element using the selectedindex property. note that even though one of the radio buttons is inside an hbox, it is still part of the radio group. if the first radio button is selected (index of 0), the textbox is enabled by setting its disabled property to true. if the second radio button is selected, the textbox is enabled. the next section will provide more details about manipulating radio groups as well as manipulating lists.
Stacks and Decks - Archive of obsolete content
ed in sequence. rather than create separate windows and add navigation buttons to each of them, you would create one window and use a deck where the content changes. like stacks, the direct children of the deck element form the pages of the deck. if there are three children of the deck element, the deck will have three children. ...
...te windows and add navigation buttons to each of them, you would create one window and use a deck where the content changes. like stacks, the direct children of the deck element form the pages of the deck. if there are three children of the deck element, the deck will have three children. the displayed page of the deck can be changed by setting an selectedindex attribute on the deck element. ...
...here are three children of the deck element, the deck will have three children. the displayed page of the deck can be changed by setting an selectedindex attribute on the deck element. the index is a number that identifies which page to display. pages are numbered starting from zero. so, the first child of the deck is page 0, the second is page 1 and so on. example 3 : source view <deck selectedindex="2"> <description value="this is the first page"/> <button label="this is the second page"/> <box> <description value="this is the third page"/> <button label="this is also the third page"/> </box> </deck> three pages exist here, the default being the third one. the third page is a box with two elements inside it. both the box and the elements inside it make up the page. the dec...
...e third page"/> <button label="this is also the third page"/> </box> </deck> three pages exist here, the default being the third one. the third page is a box with two elements inside it. both the box and the elements inside it make up the page. the deck will be as large as the largest child, which here should be the third page. you can switch pages by using a script to modify the selectedindex attribute. more on this in the section on events and the dom. the next section describes how stacks can be used to position child elements. « previousnext » ...
colorpicker - Archive of obsolete content
if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. ...
...if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. ...
... do something cool here or just say the below */ alert(e.target.nodename); } </script> <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 is available in the preferences system article. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. type type: string if this attribute is not present, the colorpicker is displayed inside the window. if this is set to the text button, the colorpicker is displayed as a button. when the use...
...d when the user selects a color. you can assign a string of the form #rrggbb to this property to change the selected color. disabled type: boolean gets and sets the value of the disabled attribute. open type: boolean returns true if the popup for a button-type colorpicker is open. set this property to true to open the popup or false to close the popup. tabindex type: integer gets and sets the value of the tabindex attribute. value property gets and sets color attribute methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), ge...
listitem - Archive of obsolete content
the text of the listitem is specified either using listcell elements, or by placing a label attribute directly on the listitem element. by default it contains a single listcell element of type and class appropriate to that of the listitem. more information is available in the xul tutorial. ...
...lement. by default it contains a single listcell element of type and class appropriate to that of the listitem. more information is available in the xul tutorial. attributes accesskey, checked, command, crop, current, disabled, image, label, preference, selected, tabindex, type, value properties accesskey, accessible, checked, control, crop, current, disabled, image, label, selected, tabindex, value style classes listitem-iconic examples <listbox id="thelist"> <listitem label="ruby"/> <listitem label="emerald"/> <listitem label="sapphire" selected="true"/> <listitem label="diamond"/> </listbox> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the lab...
... user selection of the menuitem. preference type: id connects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. selected type: boolean indicates whether the element is selected or not. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. 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. type type: string you can make an item in a listbox a checkbox by setting this attribute to the value checkbox. val...
... url gets and sets the value of the image attribute. label type: string gets and sets the value of the label attribute. selected type: boolean this property's value is true if this element is selected, or false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. methods inherited methods addeventlistener(), appendchild(), blur, click, c...
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. ...
... it is rendered on a menu. more information is available in the xul tutorial. ...
...is attribute is copied to the menulist.value property upon user selection of the menuitem. name type: string name radio menuitems with the same name as put into a group. only one menuitem in each radio group can be checked at a time. selected type: boolean indicates whether the element is selected or not. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. 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. type type: one of the values below can be used to create checkable menuitems or for radio button menuitems. checkbo...
...trol. parentcontainer type: menu element read only property that returns the containing menu element, or null if there isn't a containing menu. selected type: boolean this property's value is true if this element is selected, or false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. inherited properties align, , allowevents, , boxobject, builder, , , , classn...
menuseparator - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] used to create a separator between menu items. typically drawn as a thin line. more information is available in the xul tutorial. ...
...ods | related ] used to create a separator between menu items. typically drawn as a thin line. more information is available in the xul tutorial. attributes acceltext, accesskey, allowevents, command, crop, disabled, image, label, selected, tabindex, value properties accessibletype, accesskey, command, control, crop, disabled, image, label, labelelement, parentcontainer, selected, tabindex, value examples <menu label="menu"> <menupopup> <menuitem label="item1"/> <menuseparator/> <menuitem label="item2"/> <menuitem label="item3"/> </menupopup> </menu> attributes acceltext type: string text that appears beside the menu label to indicate the shortcut key (accelerator key) to use to invoke the command. if this value is set, it overri...
... 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. selected type: boolean indicates whether the element is selected or not. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. 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 sp...
...l. parentcontainer type: menu element read only property that returns the containing menu element, or null if there isn't a containing menu. selected type: boolean this property's value is true if this element is selected, or false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. methods inherited methods addeventlistener(), appendchild(), blur, click, ...
radio - Archive of obsolete content
Archive › Mozilla › XUL › radio
e selected at a time. the user can switch which radio button is turned on by selecting it with the mouse or keyboard. other radio buttons in the same group are turned off. a label, specified with the label attribute may be added beside the radio button. more information is available in the xul tutorial. ...
...her radio buttons in the same group are turned off. a label, specified with the label attribute may be added beside the radio button. more information is available in the xul tutorial. attributes accesskey, command, crop, disabled, focused, group, image, label, selected, tabindex, value properties accesskey, accessibletype, control, crop, disabled, image, label, radiogroup, selected, tabindex, value examples <radiogroup> <radio id="orange" label="red" accesskey="r"/> <radio id="violet" label="green" accesskey="g" selected="true"/> <radio id="yellow" label="blue" accesskey="b" disabled="true"/> </radiogroup> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears i...
... 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. selected type: boolean indicates whether the element is selected or not. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. 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 sp...
... type: string gets and sets the value of the label attribute. radiogroup type: radiogroup element equivalent to the control property. selected type: boolean this property's value is true if this element is selected, or false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. methods inherited methods addeventlistener(), appendchild(), blur, click, ...
richlistitem - Archive of obsolete content
if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. ...
...if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. ...
...: string text used for 'find-as-you-type' (fayt) searching. in situations where the search text is ambiguous or missing, searchlabel can be used to give context to fayt. if searchlabel is not present, fayt falls back to use the label property. selected type: boolean indicates whether the element is selected or not. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. 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 sp...
...el values. use the child elements directly to set label text. searchlabel type: string gets and sets the value of the searchlabel attribute. selected type: boolean this property's value is true if this element is selected, or false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. methods inherited methods addeventlistener(), appendchild(), blur, click, ...
tab - Archive of obsolete content
Archive › Mozilla › XUL › tab
roperties | methods | related ] a single tab which should be placed inside a tabs element. the user may click a tab to bring the associated page of the tabbox to the front. more information is available in the xul tutorial. attributes accesskey, afterselected, beforeselected, command, crop, disabled, first-tab, image, label, last-tab, linkedpanel, oncommand, pending, pinned, selected, tabindex, unread, validate, value properties accesskey, accessibletype, command, control, crop, disabled, image, label, linkedpanel, selected, tabindex, value examples (example needed) attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. ...
...last-tab type: boolean this attribute will be set to true for the last tab. this attribute should not be set manually, but is useful in a theme if the last tab should be styled differently. linkedpanel type: id the id of the linked tabpanel element that will be displayed when the tab is selected. if this attribute is not used, the tab will be connected 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: script code this event handler is called whe...
...until selected" preference, the pending attribute is set on tabs until they get loaded. pinned type: boolean this attribute is set to true if the tab has been pinned (that is, if it's an app tab). the tabbrowser element's pintab and unpintab methods handle pinning and unpinning tabs. selected type: boolean this attribute is set to true if the tab is selected by default. 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. unread type: boolean this attribute is set to true if the tab is unread; that is, either it has not yet been selected during the current session, or has changed since the last time it was ...
... and sets the value of the label attribute. linkedpanel type: id of a tabpanel element gets and sets the value of the linkedpanel attribute. selected type: boolean this property's value is true if this element is selected, or false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in firefox 3. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. methods inherited methods addeventlistener(), appendchild(), blur, click, ...
toolbarbutton - Archive of obsolete content
where possible, provide keyboard alternatives. where possible, duplicate functionality in a menu item or context menu. where not possible, make all toolbarbuttons focusable by -moz-user-focus: normal. ...
...usable by -moz-user-focus: normal. ...
...ontally or vertically. the default value depends on the element. you can also use the -moz-box-orient style property. horizontal child elements of the element are placed next to each other in a row in the order that they appear in the xul source. vertical child elements of the element are placed under each other in a column in the order that they appear in the xul source. 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. title type: string this functionality only applies when toolbarbutton is used in the customize toolbar dialog. the text that is displayed as a button's label when it's in the customize toolbar...
... the group attribute. image type: image url gets and sets the value of the image attribute. label type: string gets and sets the value of the label attribute. open type: boolean gets and sets the value of the open attribute. orient type: string gets and sets the value of the orient attribute. tabindex type: integer gets and sets the value of the tabindex attribute. type type: string gets and sets the value of the type attribute. methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), get...
HTML: A good basis for accessibility - Learn web development
used <button> elements, plus you don't get any of the default css styling that buttons get. building keyboard accessibility back in adding such advantages back in takes a bit of work (you can see an example in our fake-div-buttons.html example — also see the source code). ...
...s styling that buttons get. building keyboard accessibility back in adding such advantages back in takes a bit of work (you can see an example in our fake-div-buttons.html example — also see the source code). ...
...h advantages back in takes a bit of work (you can see an example in our fake-div-buttons.html example — also see the source code). here we've given our fake <div> buttons the ability to be focused (including via tab) by giving each one the attribute tabindex="0": <div data-message="this is from the first button" tabindex="0">click me!</div> <div data-message="this is from the second button" tabindex="0">click me too!</div> <div data-message="this is from the third button" tabindex="0">and me!</div> basically, the tabindex attribute is primarily intended to allow tabbable elements to have a custom tab order (specified in positive numerical order), instead of just being tabbed through in their default source order. this is nearly always a bad idea, as it can cause major confusion. use it only...
...m tab order (specified in positive numerical order), instead of just being tabbed through in their default source order. this is nearly always a bad idea, as it can cause major confusion. use it only if you really need to, for example, if the layout shows things in a very different visual order to the source code, and you want to make things work more logically. there are two other options for tabindex: tabindex="0" — as indicated above, this value allows elements that are not normally tabbable to become tabbable. this is the most useful value of tabindex. tabindex="-1" — this allows not normally tabbable elements to receive focus programmatically, e.g., via javascript, or as the target of links. whilst the above addition allows us to tab to the buttons, it does not allow us to activ...
HTML: A good basis for accessibility - Learn web development
used <button> elements, plus you don't get any of the default css styling that buttons get. building keyboard accessibility back in adding such advantages back in takes a bit of work (you can see an example in our fake-div-buttons.html example — also see the source code). ...
...s styling that buttons get. building keyboard accessibility back in adding such advantages back in takes a bit of work (you can see an example in our fake-div-buttons.html example — also see the source code). ...
...h advantages back in takes a bit of work (you can see an example in our fake-div-buttons.html example — also see the source code). here we've given our fake <div> buttons the ability to be focused (including via tab) by giving each one the attribute tabindex="0": <div data-message="this is from the first button" tabindex="0">click me!</div> <div data-message="this is from the second button" tabindex="0">click me too!</div> <div data-message="this is from the third button" tabindex="0">and me!</div> basically, the tabindex attribute is primarily intended to allow tabbable elements to have a custom tab order (specified in positive numerical order), instead of just being tabbed through in their default source order. this is nearly always a bad idea, as it can cause major confusion. use it only...
...m tab order (specified in positive numerical order), instead of just being tabbed through in their default source order. this is nearly always a bad idea, as it can cause major confusion. use it only if you really need to, for example, if the layout shows things in a very different visual order to the source code, and you want to make things work more logically. there are two other options for tabindex: tabindex="0" — as indicated above, this value allows elements that are not normally tabbable to become tabbable. this is the most useful value of tabindex. tabindex="-1" — this allows not normally tabbable elements to receive focus programmatically, e.g., via javascript, or as the target of links. whilst the above addition allows us to tab to the buttons, it does not allow us to activ...
Dealing with files - Learn web development
t into the habit of writing your folder and file names lowercase with 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 script 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 th...
...on, unchecking the hide extensions for known file types check box, then clicking ok. for more specific information covering your version of windows, you can search on the web. file paths to make files talk to one another, you have to provide a file path between them — basically a route, so one file knows where another one is. to demonstrate this, we will insert a little bit of html into our index.html file, and make it display the image you chose in the article "what will your website look like?" copy the image you chose earlier into your images folder. open up your index.html file, and insert the following code into the file exactly as shown. don't worry about what it all means for now — we'll look at the structures in more detail later in the series. <!doctype html> <html> <he...
...the series. <!doctype html> <html> <head> <meta charset="utf-8"> <title>my test page</title> </head> <body> <img src="" alt="my test image"> </body> </html> the line <img src="" alt="my test image"> is the html code that inserts an image into the page. we need to tell the html where the image is. the image is inside the images directory, which is in the same directory as index.html. to walk down the file structure from index.html to our image, the file path we'd need is images/your-image-filename. for example, our image is called firefox-icon.png, so the file path is images/firefox-icon.png. insert the file path into your html code between the double quote marks of the src="" code. save your html file, then load it in your web browser (double-click the file). you sho...
...e general rules for file paths: to link to a target file in the same directory as the invoking html file, just use the filename, e.g. my-image.jpg. to reference a file in a subdirectory, write the directory name in front of the path, plus a forward slash, e.g. subdirectory/my-image.jpg. to link to a target file in the directory above the invoking html file, write two dots. so for example, if index.html was inside a subfolder of test-site and my-image.jpg was inside test-site, you could reference my-image.jpg from index.html using ../my-image.jpg. you can combine these as much as you like, for example ../subdirectory/another-subdirectory/my-image.jpg. for now, this is about all you need to know. note: the windows file system tends to use backslashes, not forward slashes, e.g. c:\window...
JavaScript basics - Learn web development
our page for creating a hello world! example. (hello world! is the standard for introductory programming examples.) important: if you haven't been following along with the rest of our course, download this example code and use it as a starting point. go to your test site and create a new folder named scripts. within the scripts folder, create a new file called main.js, and save it. in your index.html file, enter this code on a new line, just before the closing </body> tag: <script src="scripts/main.js"></script> this is doing the same job as the <link> element for css. it applies the javascript to the page, so it can have an effect on the html (along with the css, and anything else on the page). add this code to the main.js file: const myheading = document.queryselector('h1'); my...
.../main.js"></script> this is doing the same job as the <link> element for css. it applies the javascript to the page, so it can have an effect on the html (along with the css, and anything else on the page). add this code to the main.js file: const myheading = document.queryselector('h1'); myheading.textcontent = 'hello world!'; make sure the html and javascript files are saved. then load index.html in your browser. you should see something like this: note: the reason the instructions (above) place the <script> element near the bottom of the html file is that the browser reads code in the order it appears in the file. if the javascript loads first and it is supposed to affect the html that hasn't loaded yet, there could be problems. placing javascript near the bottom of an html page...
...now when you click the image, it should change to the other one. this is what happened. you stored a reference to your <img> element in the myimage variable. next, you made this variable's onclick event handler property equal to a function with no name (an "anonymous" function). so every time this element is clicked: the code retrieves the value of the image's src attrib...
...the original state. adding a personalized welcome message next, let's change the page title to a personalized welcome message when the user first visits the site. this welcome message will persist. should the user leave the site and return later, we will save the message using the web storage api. we will also include an option to change the user, and therefore, the welcome message. in index.html, add the following line just before the <script> element: <button>change user</button> in main.js, place the following code at the bottom of the file, exactly as it is written. this takes references to the new button and the heading, storing each inside variables: let mybutton = document.queryselector('button'); let myheading = document.queryselector('h1'); add the function below ...
Video and Audio APIs - Learn web development
ing: getting started to get started with this example, download our media-player-start.zip and unzip it into a new directory on your hard drive. if you downloaded our examples repo, you'll find it in javascript/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 controls: <div class="player"> <video controls> <source src="video/sintel-short.mp4" type="video/mp4"> <source src="video/sintel-short.webm" type="video/webm"> <!-- fallback content here --> </video> <div class="controls"> <button class="play" data-icon="p" aria-label="play pause toggle...
...es to style them — like color and text-shadow. last but not least, let's look at the css for the timer: .timer { line-height: 38px; font-size: 10px; font-family: monospace; text-shadow: 1px 1px 0px black; color: white; flex: 5; position: relative; } .timer div { position: absolute; background-color: rgba(255,255,255,0.2); left: 0; top: 0; width: 0; height: 38px; z-index: 2; } .timer span { position: absolute; z-index: 3; left: 19px; } we set the outer .timer <div> to have flex: 5, so it takes up most of the width of the controls bar. we also give it position: relative, so that we can position elements inside it conveniently according to it's boundaries, and not the boundaries of the <body> element. the inner <div> is absolutely positioned to sit direc...
...lement. the inner <div> is absolutely positioned to sit directly on top of the outer <div>. it is also given an initial width of 0, so you can't see it at all. as the video plays, the width will be increased via javascript as the video elapses. the <span> is also absolutely positioned to sit near the left hand side of the timer bar. we also give our inner <div> and <span> the right amount of z-index so that the timer will be displayed on top, and the inner <div> below that. this way, we make sure we can see all the information — one box is not obscuring another. implementing the javascript we've got a fairly complete html and css interface already; now we just need to wire up all the buttons to get the controls working. create a new javascript file in the same directory level as y...
...that the timer will be displayed on top, and the inner <div> below that. this way, we make sure we can see all the information — one box is not obscuring another. implementing the javascript we've got a fairly complete html and css interface already; now we just need to wire up all the buttons to get the controls working. create a new javascript file in the same directory level as your index.html file. call it custom-player.js. at the top of this file, insert the following code: const media = document.queryselector('video'); const controls = document.queryselector('.controls'); const play = document.queryselector('.play'); const stop = document.queryselector('.stop'); const rwd = document.queryselector('.rwd'); const fwd = document.queryselector('.fwd'); const timerwrapper...
Server-side web frameworks - Learn web development
ode rather than lower level networking primitives. the example below shows how this works in the django (python) web framework. every "view" function (a request handler) receives an httprequest object containing request information, and is required to return an httpresponse object with the formatted output (in this case a string). # django view function from django.http import httpresponse def index(request): # get an httprequest (request) # perform operations using information from the request. # return httpresponse return httpresponse('output string to return') route requests to the appropriate handler most sites will provide a number of different resources, accessible through distinct urls. handling these all in one function would be hard to maintain, so web frameworks ...
...having to change the underlying code. different frameworks use different mechanisms for the mapping. for example, the flask (python) web framework adds routes to view functions using a decorator. @app.route("/") def hello(): return "hello world!" while django expects developers to define a list of url mappings between a url pattern and a view function. urlpatterns = [ url(r'^$', views.index), # example: /best/myteamname/5/ url(r'^best/(?p<team_name>\w.+?)/(?p<team_number>[0-9]+)/$', views.best), ] make it easy to access data in the request data can be encoded in an http request in a number of ways. an http get request to get files or data from the server may encode what data is required in url parameters or within the url structure. an http post request to update a resour...
...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.shortcuts import render from .models import team def youngest(request): list_teams = team.objects.filter(team_level__exact="u09") context = {'youngest_teams': list_teams} return render(request, 'best/index.html', context) rendering data web frameworks often provide templating systems. these allow you to specify the structure of an output document, using placeholders for data that will be added when a page is generated. templates are often used to create html, but can also create other types of document. web frameworks often provide a mechanism to make it easy to generate other formats from s...
...is works. continuing the "youngest team" example from the previous section, the html template is passed a list variable called youngest_teams by the view. inside the html skeleton we have an expression that first checks if the youngest_teams variable exists, and then iterates it in a for loop. on each iteration the template displays the team's team_name value in a list item. ...
Getting started with Svelte - Learn web development
or you when changes are made to the source files. your browser will display something like this: application structure the starter template comes with the following structure: moz-todo-svelte ├── readme.md ├── package.json ├── package-lock.json ├── rollup.config.js ├── .gitignore ├── node_modules ├── public │ ├── favicon.ico │ ├── index.html │ ├── global.css │ └── build │ ├── bundle.css │ ├── bundle.css.map │ ├── bundle.js │ └── bundle.js.map └── src ├── app.svelte └── main.js the contents are as follows: package.json and package-lock.json: contains information about the project that node.js/npm uses to keep it organized. yo...
...is the top-level component of your app. so far it just renders the 'hello world!' message. main.js: the entry point to our application. it just instantiates the app component and binds it to the body of our html page. public: this directory contains all the files that will be published in production. favicon.png: this is the favicon for your app. currently, it's the svelte logo. index.html: this is the main page of your app. initially it's just an empty html5 page that loads the css files and js bundles generated by svelte. global.css: this file contains unscoped styles. it's a regular css file that will be applied to the whole application. build: this folder contains the generated css and javascript source code. bundle.css: the css file that svelte generated f...
...e to make all these files work together nicely? the svelte compiler processes the <style> section of every component and compiles them into the public/build/bundle.css file. it also compiles the markup and <script> section of every component and stores the result in public/build/bundle.js. it also adds the code in src/main.js to reference the features of each component. ...
...' href='/global.css'> <link rel='stylesheet' href='/build/bundle.css'> <script defer src='/build/bundle.js'></script> </head> <body> </body> </html> the minified version of bundle.js weighs a little more than 3kb, which includes the "svelte runtime" (just 300 lines of javascript code) and the app.svelte compiled component. as you can see, bundle.js is the only javascript file referenced by index.html. there are no other libraries loaded into the web page. this is a much smaller footprint than compiled bundles from other frameworks. take into account that, in the case of code bundles, it's not just the size of the files you have to download that matter. this is executable code that needs to be parsed, executed, and kept in memory. so this really makes a difference, especially in low-powe...
Introduction to automated testing - Learn web development
questions have been asked, it will ask you if the information entered is ok. type yes and press enter/return and npm will generate a package.json file in your directory. this file is basically a config file for the project. you can customize it later, but for now it'll look something like this: { "name": "node-test", "version": "1.0.0", "description": "test for npm projects", "main": "index.js", "scripts": { "test": "test" }, "author": "chris mills", "license": "mit" } with this, you are ready to move on. setting up gulp automation let's look at setting up gulp and using it to automate some testing tools. to begin with, create a test npm project using the procedure detailed at the bottom of the previous section. next, you'll need some sample html, css and javascri...
...mills", "license": "mit" } with this, you are ready to move on. setting up gulp automation let's look at setting up gulp and using it to automate some testing tools. to begin with, create a test npm project using the procedure detailed at the bottom of the previous section. next, you'll need some sample html, css and javascript content to test your system on — make copies of our sample index.html, main.js, and style.css files in a subfolder with the name src inside your project folder. you can try your own test content if you like, but bear in mind that such tools won't work on internal js/css — you need external files. first, install gulp globally (meaning, it will be available across all projects) using the following command: npm install --global gulp-cli next, run the foll...
...e-dev gulp-htmltidy note: --save-dev adds the package as a dependency to your project. if you look in your project's package.json file, you'll see an entry for it in the devdependencies property. add the following dependency to gulpfile.js: const htmltidy = require('gulp-htmltidy'); add the following test to the bottom of gulpfile.js: function html(cb) { return gulp.src('src/index.html') .pipe(htmltidy()) .pipe(gulp.dest('build')); cb(); } here we are grabbing our development index.html file with gulp.src(), which allows us to grab a source file to do something with. we next use the pipe() function to pass that source to another command to do something else with. we can chain as many of these together as we want. we first run htmltidy() on the sou...
... if you get errors, check that you've added all the dependencies and the tests as shown above; also try commenting out the html/css/javascript code sections and then rerunning gulp to see if you can isolate what the problem is. gulp comes with a watch() function that you can use to watch your files and run tests whenever you save a file. for example, try adding the foll...
Accessibility API cross-reference
a n/a a dialog or message box. dialog dialog dialog dialog <dialog> a list of references to members of a group, such as a static table of contents. directory see <nav> if it really is a table of contents, use <toc> containing <toci> elements (which are wrappers for internal hyperlinks in such a table). for an index, use <index> with a <l>(list) inside. no default semantics in html, but semantics and other accessibility features may be provided with aria. see also span n/a n/a n/a <div> <div> but if you need custom semantic structure, use <nonstruct> instead window that corresponds to an mdi document. in aria, used to nest browsable rich text content inside in...
...e.g., tooltips may be drawn on the glass pane layer. glass_pane glass_pane n/a multiple adjacent panes that can be sized relative to each other by dragging a grippy on their border split_pane split_pane n/a an object that can be drawn into and is used to trap events. n/a n/a ...
...sy busy busy aria-busy indicates the current "checked" state of checkboxes, radio buttons, and other widgets. checked checked checked aria-checked checked (boolean attribute) defines the total number of columns in a table, grid, or treegrid. n/a n/a aria-colcount defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. n/a n/a aria-colindex defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. n/a n/a aria-colspan identifies the element (or elements) whose contents or presence are controlled by the current ...
...niques available n/a n/a aria-flowto indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. supported for anything that's not a menu is poor n/a n/a aria-haspopup the item can get the keyboard focus focusable focusable focusable tabindex attribute with value of 0 or more the item has focus for text input. for other kinds of keyboard operation, e.g. ui controls, see armed focused focused focused available to javascript as document.activeelement appearance has changed for mouseover hottracked n/a n/a especially used for sliders, scrollbars, ...
PR_EnumerateHostEnt
to begin an enumeration, this argument is set to zero. to continue an enumeration (thereby getting successive addresses from the host entry structure), the value should be set to the function's last returned value. ...
...to begin an enumeration, this argument is set to zero. to continue an enumeration (thereby getting successive addresses from the host entry structure), the value should be set to the function's last returned value. ...
...to begin an enumeration, this argument is set to zero. to continue an enumeration (thereby getting successive addresses from the host entry structure), the value should be set to the function's last returned value. ...
...rt number to be assigned as part of the prnetaddr structure. this parameter is not checked for validity. address on input, a pointer to a prnetaddr structure. on output, this structure is filled in by the runtime if the result of the call is greater than 0. returns the function returns one of the following values: if successful, the function returns the value you should specify in the enumindex parameter for the next call of the enumerator. if the function returns 0, the enumeration is ended. if unsuccessful, the function returns -1. you can retrieve the reason for the failure by calling pr_geterror. description pr_enumeratehostent is a stateless enumerator. the principle input, the prhostent structure, is not modified. ...
Python binding for NSS
ble via the numerous python documentation extraction tools. also see the generated html documentation provided with each release. nss/nspr structs are exposed as python objects. nss/nspr functions which operate on a nss/nspr object (i.e. struct) become methods of that object. nss/nspr objects which are collections support the python iteration protocol. in other words they can be iterated over, indexed by position, or used as slices. nss/nspr objects whose collection elements can be referenced by name support associative indexing. nss/nspr objects which have "get" and "set" api function calls are exposed as python properties. all nss/nspr python objects can print their current value by evaluting the python object in a string context or by using the python str() function. support threading...
...ckets if a port is appended to it, the bracketed hex address with appended with a port is unappropriate in some circumstances, hence the new address property to permit either the address string with a port or without a port. fix the implementation of the networkaddress.family property, it was returning bogus data due to wrong native data size. hostentry objects now support iteration and indexing of their networkaddress members. add io.addr_family_name() function to return string representation of pr_af_* constants. modify example and test code to utilize addrinfo instead of deprecated networkaddress functionality. add address family command argument to ssl_example. fix pty import statement in test/setup_certs.py deprecated functionality networkaddre...
...ess objects can support both ipv4 and ipv6, but a hostentry object can only support ipv4. plus the implementation depdended on being able to perform a reverse dns lookup which is not always possible. hostentry.get_network_addresses() and hostentry.get_network_address() are now deprecated. in addition their port parameter is now no longer respected. hostentry objects now support iteration and indexing of their networkaddress and that should be used to access their networkaddress objects instead. internal changes utilize pr_netaddrfamily() access macro instead of explict access. add prnetaddr_port() utility to hide host vs. network byte order requirements when accessing the port inside a prnetaddr and simplify accessing the ipv4 vs. ipv6 port variants. replace ...
...() nss.nss.sec_oid_tag_name() nss.nss.sec_oid_tag_str() the following files were added: doc/examples/cert_dump.py test/test_cert_components.py release 0.8.0 release date 2009-09-21 scm tag pynss_release_0_8_0 source download change log general modifications: secitem's now support indexing and slicing on their data clean up parsing and parameter validation of variable arg functions the following were added: secitem.type secitem.len secitem.data pk11symkey.key_data pk11symkey.key_length pk11symkey.slot create_context_by_sym_key param_from_iv generate_new_param get_iv_length get_block_size get_pad_mechanis...
Property cache
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 follow the prototype chain. there are two different types of property cache entry. non-adding cache entries {.kpc=pc, .kshape=kshape, .vshape()=vshape, .scopeindex()=scopeindex, .protoindex()=protoindex, .vword=vword} this type of entry is created for all instructions that use the property cache. when the operand to the instruction at pc is an object obj with shape kshape, let pobj = the object found by walking scopeindex steps up the parent chain and then protoindex steps up the prototype chain. if pobj exists (that is, both the parent chain an...
...dowed. the two shadowing guarantees ensure that if this happens, the shape of pobj changes, invalidating the entry. setting. for jof_set instructions, this makes two additional guarantees: first, vword.issprop(); second, the correct behavior is to set the property described by vword.tosprop(), rather than to shadow it with a new own property. teleportation. the jit handles situations where scopeindex ≠ 0 or protoindex > 1 specially. it walks the scope chain and prototype chain as described above only once, at compile time, and emits code containing the pointer to the object that contains the property. the emitted code guards on the identity of the object to search. then it guards on the shape of the object containing the property. if both guards pass, there is no need to walk the chain. the...
...ing the pointer to the object that contains the property. the emitted code guards on the identity of the object to search. then it guards on the shape of the object containing the property. if both guards pass, there is no need to walk the chain. the jit code "teleports" directly to the appropriate object. adding cache entries {.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 skipped. it is guaranteed that obj does not have an own property with the desired...
...applies. a cache hit of this type saves a property lookup, but the interpreter still has to examine vword.toshape() to determine what to do next. vword.isslot() the property has a slot which the interpreter can read directly. this special kind of entry is used only for jof_get instructions and only when the property has a stub getter and has a slot (i.e. it is not jsprop_shared). the slot index is vword.toslot(). vword.isobject() the property has a stub getter and its value is vword.toobject(). this special kind of entry is used only for jof_call instructions and only when the result is a function. it helps the jit avoid extra loads and guards when calling methods. branded scopes exist to support this case. when a property cache entry of this type is created, the scope of the ...
JS_ExecuteRegExp
execute a new regexp object to given input string. syntax bool js_executeregexp(jscontext *cx, js::handleobject obj, js::handleobject reobj, char16_t *chars, size_t length, size_t *indexp, bool test, js::mutablehandlevalue rval); bool js_executeregexpnostatics(jscontext *cx, js::handleobject reobj, char16_t *chars, size_t length, size_t *indexp, bool test, js::mutablehandlevalue rval); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a global object. reobj js::handleobject ...
...uires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a global object. reobj js::handleobject a pointer to a regexp object. chars const char16_t * a pointer to the string contains a input string. length size_t the length of bytes or chars, in characters. indexp size_t * in/out parameter. a pointer to the lastindex for the execution, and received the updated lastindex. test bool pass true to avoid creating match result array and store boolean value to rval. rval js::mutablehandlevalue out parameter. receives the result match result array or boolean value. description js_executeregexp and js_newregexpobjectnostat...
... if test is false, js_executeregexp and js_newregexpobjectnostatics store the match result array to *rval if matches, otherwise stores null to *rval. if test is true, js_executeregexp and js_newregexpobjectnostatics store the boolean value true to *rval if matches, otherwise stores null to *rval. js_executeregexp updates the built-in regexp object's properties. ...
... if test is false, js_executeregexp and js_newregexpobjectnostatics store the match result array to *rval if matches, otherwise stores null to *rval. if test is true, js_executeregexp and js_newregexpobjectnostatics store the boolean value true to *rval if matches, otherwise stores null to *rval. js_executeregexp updates the built-in regexp object's properties. ...
Parser API
functions interface function <: node { id: identifier | null; params: [ pattern ]; defaults: [ expression ]; rest: identifier | null; body: blocksta...
... functions interface function <: node { id: identifier | null; params: [ pattern ]; defaults: [ expression ]; rest: identifier | null; body: blockstatement | expression; generat...
...k | comprehensionif ]; filter: expression | null; } a generator expression. as with array comprehensions, the blocks array corresponds to the sequence of for and for each blocks, and the optional filter expression corresponds to the final if clause, if present. note: generator expressions are spidermonkey-specific. interface graphexpression <: expression { type: "graphexpression"; index: uint32; expression: literal; } a graph expression, aka "sharp literal," such as #1={ self: #1# }. note: graph expressions are spidermonkey-specific. interface graphindexexpression <: expression { type: "graphindexexpression"; index: uint32; } a graph index expression, aka "sharp variable," such as #1#. note: graph index expressions are spidermonkey-specific. interface letexpr...
...celocation returns: customexpression callback to produce a custom array expression node. objectexpression(props[, loc]) props: [ customobjectproperty ] loc: sourcelocation returns: customexpression callback to produce a custom object expression node. thisexpression([loc]) loc: sourcelocation returns: customexpression callback to produce a custom this expression node. graphexpression(index, expr[, loc]) index: uint32 >= 1 expr: customexpression loc: sourcelocation returns: customexpression callback to produce a custom graph expression node. graphindexexpression(index[, loc]) index: uint32 >= 1 loc: sourcelocation returns: customexpression callback to produce a custom graph index expression node. comprehensionexpression(body, blocks, filter[, loc]) body: customexpression ...
imgIContainer
flags); native code only! void frameupdated(in unsigned long framenum, in nsintrect anewrect); native code only! obsolete since gecko 2.0 void getcurrentframerect(in nsintrect aframerect); native code only! obsolete since gecko 2.0 gfxasurface getframe(in pruint32 awhichframe, in pruint32 aflags); native code only! gfxiimageframe getframeat(in unsigned long index); obsolete since gecko 1.9.2 void getframecolormap(in unsigned long framenumber, [array, size_is(palettelength)] out pruint32 palettedata, out unsigned long palettelength); obsolete since gecko 2.0 unsigned long getframeimagedatalength(in unsigned long framenumber); obsolete since gecko 2.0 imagecontainer getimagecontainer(); native code only! nsiframe getro...
...ons thrown ns_error_not_available if the animated state cannot be determined. animationmode unsigned short currentframe gfxasurface get a surface for the current frame. this may be a platform-native, optimized frame, so you cannot inspect its pixel data. read only. native code only! obsolete since gecko 2.0 currentframeindex unsigned long the index of the current frame that would be drawn if the image was to be drawn now. read only. obsolete since gecko 2.0 currentframeisopaque boolean whether the current frame is opaque; that is, needs the background painted behind it. read only. height print32 the height of the container rectangle. in the case of any error, zero is returned, an...
...s framenumber missing description exceptions thrown missing exception missing description native code only!ensurecleanframe obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. create or reuse a frame at index aframenum. it is an error to call this with aframenum not in the range [0, numframes]. void ensurecleanframe( in unsigned long aframenum, in print32 ax, in print32 ay, in print32 awidth, in print32 aheight, in gfximageformat aformat, [array, size_is(imagelength)] out pruint8 imagedata, out unsigned long imagelength ); parameters aframenum missing description ax m...
..., in pruint32 aflags ); parameters awhichframe frame specifier of the frame_* variety. aflags flags of the flag_* variety. return value missing description exceptions thrown missing exception missing description getframeat() obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) gfxiimageframe getframeat( in unsigned long index ); parameters index missing description return value missing description exceptions thrown missing exception missing description getframecolormap() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. vo...
nsICommandLine
linehandler interface to add custom command line handling behavior. definitions arguments any values found on the command line. switches flags. in normalized form, these are preceded by a single dash. some flags may take parameters; for example: "-url <param>" or "-install-xpi <param>". method overview long findflag(in astring aflag, in boolean acasesensitive); astring getargument(in long aindex); boolean handleflag(in astring aflag, in boolean acasesensitive); astring handleflagwithparam(in astring aflag, in boolean acasesensitive); void removearguments(in long astart, in long aend); nsifile resolvefile(in astring aargument); nsiuri resolveuri(in astring aargument); attributes attribute type description length long number of arguments in the command line. the applicati...
...command line. long findflag( in astring aflag, in boolean acasesensitive ); parameters aflag the flag name to locate. do not include the initial hyphen. acasesensitive whether to do case-sensitive comparisons. ...
...) gets the value an argument from the array of command-line arguments, given the index into the argument list. on windows, flags of the form /flag are normalized to -flag. /flag:param are normalized to -flag param. on unix/linux and mac os x, flags of the form --flag are normalized to -flag, and flags of the form --flag=param are normalized to the form -flag param. astring getargument( in long aindex ); parameters aindex the argument to retrieve. this index is 0-based, and does not include the application name. return value the value of the specified argument. this is the full text of that argument, so if the argument is a flag, the returned value is "-flag [<flagvalue>]". exceptions thrown ns_error_invalid_arg the specified index is out of bounds. handleflag() finds the specified flag, ...
...lag, an empty string if the flag's value is the empty string, or null if the specified parameter wasn't found. exceptions thrown ns_error_invalid_arg the specified flag has no value. removearguments() removes a range of arguments from the command line; this is typically done once those arguments have been handled. void removearguments( in long astart, in long aend ); parameters astart the index to the first argument to remove from the command line; this is 0-based, and the name of the application is not included. aend the index to the last argument to remove from the command line. resolvefile() resolves a file-path argument into an nsifile object. this method gracefully handles relative or absolute file paths, according to the working directory of this command line. nsifile resolvefile...
nsIDOMHTMLTimeRanges
the nsidomhtmltimeranges interface represents a set of time ranges in media; it's primarily used by the nsidomhtmlmediaelement interface, and implements the dom timeranges interface. each time range represented by an nsidomhtmltimeranges object has an index number; you call the start() and end() methods to obtain the start and end times of each range, specifying the index number of the range to look up. dom/interfaces/html/nsidomhtmltimeranges.idlscriptable please add a summary to this article. ...
...x number; you call the start() and end() methods to obtain the start and end times of each range, specifying the index number of the range to look up. dom/interfaces/html/nsidomhtmltimeranges.idlscriptable please add a summary to this article. last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports method overview float start(in unsigned long index); float end(in unsigned long index); attributes attribute type description length unsigned long the number of ranges represented by the nsidomhtmltimeranges object. read only. methods end() returns the time offset to the end of the specified time range. float end( in unsigned long index ); parameters index the index to the time range whose end time is to be returned. return ...
...sidomhtmltimeranges object. read only. methods end() returns the time offset to the end of the specified time range. float end( in unsigned long index ); parameters index the index to the time range whose end time is to be returned. return value the time at which the specified range ends, in seconds measured from the beginning of the timeline represented by the object. exceptions thrown index_size_err the specified index is not valid. start() returns the time offset to the start of the specified time range. float start( in unsigned long index ); parameters index the index to the time range whose start time is to be returned. return value the time at which the specified range starts, in seconds measured from the beginning of the timeline represented by the object. exceptions thro...
...e_err the specified index is not valid. start() returns the time offset to the start of the specified time range. float start( in unsigned long index ); parameters index the index to the time range whose start time is to be returned. return value the time at which the specified range starts, in seconds measured from the beginning of the timeline represented by the object. exceptions thrown index_size_err the specified index is not valid. ...
nsINavHistoryResultViewObserver
toolkit/components/places/public/nsinavhistoryservice.idlscriptable this interface is used by clients of the history results to define domain-specific handling of specific nsitreeview methods that the history result doesn't implement. ...
...his interface is used by clients of the history results to define domain-specific handling of specific nsitreeview methods that the history result doesn't implement. ...
... candrop() implement this method to report whether or not a drop is permitted onto the specified location. to provide behavior similar to the folder pane in thunderbird, where drops are only permitted on items themselves instead of on the pane as a whole, always return false when the orientation isn't drop_on. warning: do not change the content of the observer list. boolean candrop( in long index, in long orientation ); parameters index the item over which the drag is currently located. orientation whether the drag target is before, after, or on the indicated row. return value return true if the drop is permitted or false if it isn't. ondrop() called when the user drops something onto the view being observed. void ondrop( in long row, in long orientation ); ...
... drops something onto the view being observed. void ondrop( in long row, in long orientation ); parameters row the row at which the drop occurred. orientation drop_before, drop_on, or drop_after, indicating whether the drop destination is before, on, or after the target row. ontoggleopenstate() called when an item is opened or closed. void ontoggleopenstate( in long index ); parameters index the item being toggled. oncycleheader() called when a header is clicked. void oncycleheader( in nsitreecolumn column ); parameters column the column whose header was clicked. oncyclecell() called when a cell in a non-selectable cycling column (such as unread or flagged in thunderbird) is clicked. void oncyclecell( in long row, in nsitreecolum...
nsIPromptService
sg text to appear with the checkbox. null if no checkbox is displayed. acheckstate contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns. if you call this method from javascript you need to wrap this argument in an object with its 'value' property set to a boolean (or use an empty object). return value index of the button pressed prompt() shows a dialog with an edit field and an optional, labeled checkbox. see also the prompt_example. boolean prompt( in nsidomwindow aparent, in wstring adialogtitle, in wstring atext, inout wstring avalue, in wstring acheckmsg, inout boolean acheckstate ); parameters aparent the parent window for the dialog. if set to null the parent window will...
...utselection ); aparent the parent window for the dialog. if set to null the parent window will be nsiwindowwatcher.activewindow. adialogtitle text to appear in the title of the dialog. atext text to appear in the body of the dialog. acount length of the aselectlist array parameter. aselectlist list of strings to display. aoutselection contains the index of the selected item in the list when this method returns true. if you call this method from javascript, this argument is wrapped in an object with an attribute named 'value' which holds the selected index. return value true for ok, false for cancel example code alert example alert displays a simple dialog. var prompts = components.classes["@mozilla.org/embedcomp/prompt-service;1"] ...
...pts.button_title_cancel; // this value of flags will create 3 buttons. the first will be "save", the // second will be the value of abuttontitle1, and the third will be "cancel" var button = prompts.confirmex(null, "title of this dialog", "what do you want to do?", flags, "", "button 1", "", null, check); // the checkbox will be hidden, and button will contain the index of the button pressed, // 0, 1, or 2. prompt example prompt displays a dialog with an edit field. var prompts = components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.nsipromptservice); var check = {value: false}; // default the checkbox to false var input = {value: "bob"}; // default the edit fi...
...get the item using items[selected.value]. see also nsiprompt working with out parameters ...
Xptcall Porting Guide
ee to create subdirectories under the base md directory for their given platforms and to integrate into the build system as appropriate for their platform. theory of operation there are really two pieces of functionality: invoke and stubs... ...
...se md directory for their given platforms and to integrate into the build system as appropriate for their platform. theory of operation there are really two pieces of functionality: invoke and stubs... the invoke functionality requires the implementation of the following on each platform (from xptcall/public/xptcall.h): xptc_public_api(nsresult) ns_invokebyindex(nsisupports* that, pruint32 methodindex, pruint32 paramcount, nsxptcvariant* params); calling code is expected to supply an array of nsxptcvariant structs. these are discriminated unions describing the type and value of each parameter of the target function. the platform specific code then builds a call frame and invokes the method indicated by the index methodindex on the xpcom interface that. here are examples of ...
... this class.. #include "xptcstubsdecl.inc" // the following methods must be provided by inheritor of this class. ...
...nt than speed optimizations. this code is primarily used to connect xpcom components with javascript; 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 yet been done. a full 'test' at this point requires building the client and running the xpconnect test called testxpc in mozilla/js/src/xpconnect/tests. getting these ports done is very important. please let me know if you are interested in doing one. i'll answer any questions as i get them. porting statu...
Gloda examples
age query for more examples. ...
...t assuming that you have a message (glodamessage) in the conversation already, this is straight forward using glodamessage.conversation.getmessagescollection() alistener = { /* called when new items are returned by the database query or freshly indexed */ onitemsadded: function _onitemsadded(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function _onitemsmodified(aitems, acollection) { }, /* called when items that are in our collection are purged from the system */ onitemsremoved: function _onitemsremoved(aitems, acollection) { }, /* called when our database query completes */ onquerycompleted: function _onquerycompleted(conversation_coll) { try { for (var conv...
...{}); query.tags(...tagarray); let collection = query.getcollection(mylistener); search messages by daterange searches for all messages within a date range id_q=gloda.newquery(gloda.noun_message); // define a date range form yesterday to now id_q.daterange([new date() - 86400000, new date()]); var mylistener = { /* called when new items are returned by the database query or freshly indexed */ onitemsadded: function _onitemsadded(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function _onitemsmodified(aitems, acollection) { }, /* called when items that are in our collection are purged from the system */ onitemsremoved: function _onitemsremoved(aitems, acollection) { }, /* call...
... id = id_coll.items[0]; //now we use the identity to find all messages that person was involved with msg_q=gloda.newquery(gloda.noun_message) msg_q.involves(id) msg_q.getcollection({ /* called when new items are returned by the database query or freshly indexed */ onitemsadded: function _onitemsadded(aitems, acollection) { }, /* called when items that are already in our collection get re-indexed */ onitemsmodified: function _onitemsmodified(aitems, acollection) { }, /* called when items...
DataTransfer - Web APIs
ame position. datatransfer.setdragimage() set the image to be used for dragging if a custom one is desired. gecko methods note: all of the methods in this section are gecko-specific. datatransfer.addelement() sets the drag source to the given element. deprecated methods datatransfer.mozcleardataat() removes the data associated with the given format for an item at the specified index. the index is in the range from zero to the number of items minus one. removed in firefox 71. datatransfer.mozgetdataat() retrieves the data associated with the given format for an item at the specified index, or null if it does not exist. the index should be in the range from zero to the number of items minus one. removed in firefox 71. datatransfer.mozsetdataat() a data transfer may sto...
...umber of items minus one. removed in firefox 71. datatransfer.mozgetdataat() retrieves the data associated with the given format for an item at the specified index, or null if it does not exist. the index should be in the range from zero to the number of items minus one. removed in firefox 71. datatransfer.mozsetdataat() a data transfer may store multiple items, each at a given zero-based index. mozsetdataat() may only be called with an index argument less than mozitemcount in which case an existing item is modified, or equal to mozitemcount in which case a new item is added, and the mozitemcount is incremented by one. ...
...removed in firefox 71. examples every method and property listed in this document has its own reference page and each reference page either directly includes an example of the interface or has a link to an example. ...
...removed in firefox 71. examples every method and property listed in this document has its own reference page and each reference page either directly includes an example of the interface or has a link to an example. ...
Introduction to the DOM - Web APIs
an html document, elements are further enhanced by the html dom api's htmlelement interface as well as other interfaces describing capabilities of specific kinds of elements (for instance, htmltableelement for <table> elements). nodelist a nodelist is an array of elements, like the kind that is returned by the method document.getelementsbytagname(). items in a nodelist are accessed by index in either of two ways: list.item(1) list[1] these two are equivalent. in the first, item() is the single method on the nodelist object. the latter uses the typical array syntax to fetch the second item in the list. attribute when an attribute is returned by a member (e.g., by the createattribute() method), it is an object reference that exposes a special (albei...
...in the list. attribute when an attribute is returned by a member (e.g., by the createattribute() method), it is an object reference that exposes a special (albeit small) interface for attributes. attributes are nodes in the dom just like elements are, though you may rarely use them as such. namednodemap a namednodemap is like an array, but the items are accessed by name or index, though this latter case is merely a convenience for enumeration, as they are in no particular order in the list. a namednodemap has an item() method for this purpose, and you can also add and remove items from a namednodemap. there are also some common terminology considerations to keep in mind. it's common to refer to any attribute node as simply an attribute, for example, and to refer t...
... necessary. ...
...div style="margin: .5in; height: 400px;"> <p><b><tt>text</tt></b></p> <form> <select onchange="setbodyattr('text', this.options[this.selectedindex].value);"> <option value="black">black</option> <option value="red">red</option> </select> <p><b><tt>bgcolor</tt></b></p> <select onchange="setbodyattr('bgcolor', this.options[this.selectedindex].value);"> <option value="white">white</option> <option value="lightgrey">gray</option> </select> <p><b><tt>link</tt></b></p> <select onchange="setbodyattr('link', this.options[this.selectedindex].value);"> <option value="blue">blue</option> <option value="green">green</option> </select> <small> <a href="http://some.web...
FileHandle API - Web APIs
api overview this api is based on the following interfaces: idbdatabase.mozcreatefilehandle (was called idbdatabase.mozcreatefilehandle.) idbmutablefile (was previously filehandle.) lockedfile filerequest it also has connections with the file api, especially the file and blob interfaces. ...
...erfaces: idbdatabase.mozcreatefilehandle (was called idbdatabase.mozcreatefilehandle.) idbmutablefile (was previously filehandle.) lockedfile filerequest it also has connections with the file api, especially the file and blob interfaces. basic operations create a filehandle because the intent is to allow the storage of files through indexeddb, creating a filehandle instance requires an indexeddb database. var idbreq = indexeddb.open("myfilestoragedatabase"); idbreq.onsuccess = function(){ var db = this.result; var buildhandle = db.mozcreatefilehandle("test.txt", "plain/text"); buildhandle.onsuccess = function(){ var myfilehandle = this.result; console.log('handle', myfilehandle); }; }; mozcreatefilehandle() takes two arguments: a name and an optional type. both...
...formation (as well as the date of its last modification) can be retrieved through the lockedfile.getmetadata() method. ...
...function () { console.log('oups :( unable to read a 1gb file') } file storage when a file handle is created, the associated file only exists as a "temporary file" as long as you hold the filehandle instance. if you want a file to survive a page refresh/app relaunch, you need to store the handle in a database (not necessarily the one used to create the filehandle object). ...
HTMLTableElement - Web APIs
the element. if none is found, a new one is created and inserted in the tree as the first child of the <table> element. htmltableelement.deletecaption() removes the first <caption> that is a child of the element. htmltableelement.insertrow() returns an htmltablerowelement representing a new row of the table. ...
...serted in the tree as the first child of the <table> element. htmltableelement.deletecaption() removes the first <caption> that is a child of the element. htmltableelement.insertrow() returns an htmltablerowelement representing a new row of the table. it inserts it in the rows collection immediately before the <tr> element at the given index position. if necessary a <tbody> is created. if the index is -1, the new row is appended to the collection. ...
...htmltableelement.deletecaption() removes the first <caption> that is a child of the element. htmltableelement.insertrow() returns an htmltablerowelement representing a new row of the table. it inserts it in the rows collection immediately before the <tr> element at the given index position. if necessary a <tbody> is created. if the index is -1, the new row is appended to the collection. ...
...nt.insertrow() returns an htmltablerowelement representing a new row of the table. it inserts it in the rows collection immediately before the <tr> element at the given index position. if necessary a <tbody> is created. if the index is -1, the new row is appended to the collection. if the index is smaller than -1 or greater than the number of rows in the collection, a domexception with the value indexsizeerror is raised. htmltableelement.deleterow() removes the row corresponding to the index given in parameter. if the index value is -1 the last row is removed; if it smaller than -1 or greater than the amount of rows in the collection, a domexception with the value indexsizeerror is raised. specifications specification status comment html living standardthe defi...
HTMLTextAreaElement - Web APIs
the number of visible text lines for the control. selectiondirection string: returns / sets the direction in which selection occurred. this is "forward" if selection was performed in the start-to-end direction of the current locale, or "backward" for the opposite direction. this can also be "none" if the direction is unknown. selectionend unsigned long: returns / sets the index of the end of selected text. if no text is selected, contains the index of the character that follows the input cursor. on being set, the control behaves as if setselectionrange() had been called with this as the second argument, and selectionstart as the first argument. selectionstart unsigned long: returns / sets the index of the beginning of selected text. if no text is selected, c...
...of selected text. if no text is selected, contains the index of the character that follows the input cursor. on being set, the control behaves as if setselectionrange() had been called with this as the second argument, and selectionstart as the first argument. selectionstart unsigned long: returns / sets the index of the beginning of selected text. if no text is selected, contains the index of the character that follows the input cursor. on being set, the control behaves as if setselectionrange() had been called with this as the first argument, and selectionend as the second argument. tabindex long: returns / sets the position of the element in the tabbing navigation order for the current document. textlength read only long: returns the codepoint length of t...
... for constraint validation. false if any conditions bar it from constraint validation, including its readonly or disabled property is true. wrap string: returns / sets the wrap html attribute, indicating how the control wraps text. htmltextareaelement.labelsread only nodelist: returns a list of label elements associated with this element. the two properties tabindex and accesskey are inherited from htmlelement from html5 on, but were defined on htmltextareaelement in dom level 2 html and earlier specifications. methods blur() removes focus from the control; keystrokes will subsequently go nowhere. focus() gives focus to the control; keystrokes will subsequently go to this element. select() selects the contents of the con...
...ss="return checkrows(this, event);" onpaste="return false;"></textarea> </p> </form> specifications specification status comment html living standardthe definition of 'htmltextareaelement' in that specification. living standard html5the definition of 'htmltextareaelement' in that specification. recommendation the attributes tabindex and accesskey, as well as the methods blur() and focus() are now defined on htmlelement. the following attributes have been added: autofocus, placeholder, dirname, wrap, maxlength, required, textlength, labels, selectionstart, selectionend, selectiondirection, validity, validationmessage, and willvalidate. the following methods have been added: checkvalidity(), setcustomvalidity(), and se...
IDBCursor.delete() - Web APIs
Web › API › IDBCursor › delete
the delete() method of the idbcursor interface returns an idbrequest object, and, in a separate thread, deletes the record at the cursor's position, without changing the cursor's position. once the record is deleted, the cursor's value is set to null. be aware that you can't call delete() (or idbcursor.update()) on cursors obtained from idbindex.openkeycursor(). for such needs, you have to use idbindex.opencursor() instead. note: this feature is available in web workers. syntax myidbcursor.delete(); returns an idbrequest object on which subsequent events related to this operation are fired. the result attribute is set to undefined. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror t...
...elated to this operation are fired. the result attribute is set to undefined. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive. readonlyerror the transaction mode is read-only. invalidstateerror the cursor was created using idbindex.openkeycursor, is currently being iterated, or has iterated past its end. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. if the albumtitle of the current cursor is "grace under pressure", we delete that entire record using var request = cursor.delete();. the cursor does not requi...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compa...
...nnerhtml = '<strong>' + cursor.value.albumtitle + '</strong>, ' + cursor.value.year; list.appendchild(listitem); } cursor.continue(); } else { console.log('entries displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'delete()' in that specification. recommendation indexed database api draftthe definition of 'delete()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvie...
IDBCursor.update() - Web APIs
Web › API › IDBCursor › update
the update() method of the idbcursor interface returns an idbrequest object, and, in a separate thread, updates the value at the current position of the cursor in the object store. if the cursor points to a record that has just been deleted, a new record is created. be aware that you can't call update() (or idbcursor.delete()) on cursors obtained from idbindex.openkeycursor(). for such needs, you have to use idbindex.opencursor() instead. note: this feature is available in web workers. syntax var anidbrequest = myidbcursor.update(value); parameters value the new value to be stored at the current position. return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: ...
...equest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive. readonlyerror the transaction mode is read only. invalidstateerror the cursor was created using idbindex.openkeycursor, is currently being iterated, or has iterated past its end. dataerror the underlying object store uses in-line keys and the property in the value at the object store's key path does not match the key in this cursor's position. datacloneerror the data being stored could not be cloned by the internal structured cloning algorithm. example in thi...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-com...
...listitem.innerhtml = '<strong>' + cursor.value.albumtitle + '</strong>, ' + cursor.value.year; list.appendchild(listitem); cursor.continue(); } else { console.log('entries displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'update()' in that specification. recommendation indexed database api draftthe definition of 'update()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webv...
IDBDatabase: close event - Web APIs
database in the browser's history preferences. note that it is not fired if the database connection is closed normally using idbdatabase.close(). ...
...nd listens for the close event: // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const db = dbopenrequest.result; db.addeventlistener('close...
...th', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const db = dbopenrequest.result; db.addeventlistener('close', () => { console.log('database connection closed'); }); }; the same example, using the onclose property instead of addeventlistener(): // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minute...
...pgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const db = dbopenrequest.result; db.onclose = () => { console.log('database connection closed'); }; }; ...
IDBDatabase.deleteObjectStore() - Web APIs
as with idbdatabase.createobjectstore, this method can be called only within a versionchange transaction. note: this feature is available in web workers. syntax dbinstance.deleteobjectstore(name); parameters name the name of the object store you want to delete. ...
...se 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, which was misleading; this has now been fixed (see bug 1176165.) notfounderror you are trying to delete an object store that does not exist. names are case sensitive. ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. ...
...esult; if (e.oldversion < 1) { db.createobjectstore("store1"); } if (e.oldversion < 2) { db.deleteobjectstore("store1"); db.createobjectstore("store2"); } // etc. for version < 3, 4... }; specification specification status comment indexed database api 2.0the definition of 'deleteobjectstore()' in that specification. recommendation indexed database api draftthe definition of 'deleteobjectstore()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafarian...
IDBDatabase: error event - Web APIs
ction object. ...
...iven tasktitle already exists): // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const newitem = { tasktitle: 'my task', hours: 10, minutes: 10...
...em.tasktitle}`); }); // open a read/write db transaction, ready for adding the data const transaction = db.transaction(['todolist'], 'readwrite'); const objectstore = transaction.objectstore('todolist'); const objectstorerequest = objectstore.add(newitem); }; the same example, using the onerror property instead of addeventlistener(): // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minute...
...pgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const newitem = { tasktitle: 'my task', hours: 10, minutes: 10, day: 10, month: 'january', year: 2020 }; const db = dbopenrequest.result; db.onerror = () => { console.log(`error adding ...
IDBDatabase.transaction() - Web APIs
n't be specified here. if you don't provide the parameter, the default access mode is readonly. to avoid slowing things down, don't open a readwrite transaction unless you actually need to write into the database. if you need to open the object store in readwrite mode to change data, you would use the following: var transaction = db.transaction('my-store-name', "readwrite"); as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702), which is the same behaviour as other indexeddb-supporting browsers. previously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. in firefox 40+ the complete event is fired after the os has been told to write the data but potent...
... note: in firefox, if you wish to ensure durability for some reason (e.g. you're storing critical data that cannot be recomputed later) you can force a transaction to flush to disk before delivering the complete event by creating a transaction using the experimental (non-standard) readwriteflush mode (see idbdatabase.transaction.) this is currently experimental, and can only be used if the dom.indexeddb.experimental pref is set to true in about:config. details optional dictionary of other settings, supported only by chrome: return value an idbtransaction object. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror the close() method has previously been called on this idbdatabase ins...
...e for the mode parameter is invalid. invalidaccesserror the function was called with an empty list of store names. example in this example we open a database connection, then use transaction() to open a transaction on the database. for a complete example, see our to-do notifications app (view example live.) var db; // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the displaydata() function to populate the task list with // all the to-do list data already in the idb displaydata(); }; // open a r...
...d: database modification finished.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error. duplicate items not allowed.</li>'; }; // you would then go on to do something to this database // via an object store var objectstore = transaction.objectstore("todolist"); // etc. specification specification status comment indexed database api 2.0the definition of 'transaction()' in that specification. recommendation indexed database api draftthe definition of 'transaction()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/brow...
IDBDatabase: versionchange event - Web APIs
red when a database structure change (idbopendbrequest.onupgradeneeded event or idbfactory.deletedatabase) was requested. ...
...ds a listener to versionchange: // open the database const dbopenrequest = window.indexeddb.open('nonexistent', 4); dbopenrequest.onupgradeneeded = event => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.addeventlistener('success', event => { const db = event.target.result; db.addeventlis...
... }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.addeventlistener('success', event => { const db = event.target.result; db.addeventlistener('versionchange', event => { console.log('the version of this database has changed'); }); }); the same example, using the onversionchange event handler property: // open the database const dbopenrequest = window.indexeddb.open('nonexistent', 4); dbopenrequest.onupgradeneeded = event => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minute...
...onupgradeneeded = event => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = event => { const db = event.target.result; db.onversionchange = event => { console.log('the version of this database has changed'); }; }; ...
IDBFactory - Web APIs
you open — that is, create and access — and delete a database with this object, and not directly with idbfactory. note: this feature is available in web workers. methods idbfactory.open the current method to request opening a connection to a database. idbfactory.deletedatabase a method to request the deletion of a database. idbfactory.cmp a method that compares two keys and returns a result indicating which one is greater in value. idbfactory.databases a method that returns a list of all available databases, including their names and versions. ...
...at returns a list of all available databases, including their names and versions. example in the following code snippet, we make a request to open a database, and include handlers for the success and error cases. for a full working example, see our to-do notifications app (view example live.) // in the following line, you should include the prefixes of implementations you want to test. window.indexeddb = window.indexeddb || window.mozindexeddb || window.webkitindexeddb || window.msindexeddb; // don't use "var indexeddb = ..." if you're not in a function. // moreover, you may need references to some window.idb* objects: window.idbtransaction = window.idbtransaction || window.webkitidbtransaction || window.msidbtransaction; window.idbkeyrange = window.idbkeyrange || window.webkitidbkeyrange |...
...this is used a lot later on, for opening tra...
...ror = function(event) { console.error("error loading database."); }; dbopenrequest.onsuccess = function(event) { console.info("database initialised."); // store the result of opening the database in the db variable. this is used a lot later on, for opening transactions and suchlike. db = dbopenrequest.result; }; specifications specification status comment indexed database api 2.0the definition of 'idbfactory' in that specification. recommendation indexed database api draftthe definition of 'idbfactory' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-co...
IDBObjectStore.clear() - Web APIs
the clear() method of the idbobjectstore interface creates and immediately returns an idbrequest object, and clears this object store in a separate thread. this is for deleting all the current data out of an object store. clearing an object store consists of removing all records from the object store and removing all records in indexes that reference the object store. to remove only some of the records in a store, use idbobjectstore.delete passing a key or idbkeyrange. note: this feature is available in web workers. syntax var request = objectstore.clear(); returns an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description readonlyer...
... mode. transactioninactiveerror this idbobjectstore's transaction is inactive. example in the following code snippet, we open a read/write transaction on our database and clear all the current data out of the object store using clear(). for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // clear all the data form the object store cleardata(); }; function cleardata() { // open a read/write db transaction, ready for clearing th...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat...
... of the object store var objectstorerequest = objectstore.clear(); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'clear()' in that specification. recommendation indexed database api draftthe definition of 'clear()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvie...
IDBObjectStore.name - Web APIs
s. syntax idbobjectstore.name = mynewname; var myobjectstorename = idbobjectstore.name; value a domstring containing the object store's name. exceptions there are a several exceptions which can occur when you attempt to change an object store's name. invalidstateerror either the object store has been deleted or the current transaction is not an upgrade transaction; you can only rename indexes during upgrade transactions; that is, when the mode is "versionchange". transactioninactiveerror the current transaction is not active. constrainterror an object store is already using the specified name. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). after the object store has been created, we log...
...ore is already using the specified name. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). after the object store has been created, we log objectstore.name to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data ...
...he object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'name' in that specification. recommendation indexed database api draftthe definition of 'name' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewch...
IDBOpenDBRequest: upgradeneeded event - Web APIs
n attempt was made to open a database with a version number higher than its current version. bubbles no cancelable no interface event event handler onupgradeneeded examples this example opens a database and handles the upgradeneeded event by making any necessary updates to the object store. ...
...nrequest = window.indexeddb.open('todolist', 4); dbopenrequest.addeventlistener('upgradeneeded', event => { const db = event.target.result; console.log(`upgrading to version ${db.version}`); // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }); this is the same example, but uses the onupgradeneeded event handler property. // open the database c...
... false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }); this is the same example, but uses the onupgradeneeded event handler property. ...
...base const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = event => { const db = event.target.result; console.log(`upgrading to version ${db.version}`); // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; ...
IDBRequest: error event - Web APIs
uest to fail. ...
...dexeddb.open('todolist', 4); dbopenrequest.addeventlistener('upgradeneeded', event => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }); dbopenrequest.addeventlistener('success', event => { const db = dbopenrequest.result; // open a r...
...asktitle: 'my task', hours: 10, minutes: 10, day: 10, month: 'january', year: 2020 }; const objectstorerequest = objectstore.add(newitem); objectstorerequest.addeventlistener('error', () => { console.log(`error adding new item: ${newitem.tasktitle}`); }); }); the same example, using the onerror property instead of addeventlistener(): // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = event => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hou...
...gradeneeded = event => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = event => { const db = dbopenrequest.result; // open a read/write db transaction, ready for adding the data const transaction = db.tran...
IDBRequest: success event - Web APIs
the success event is fired when an idbrequest succeeds. ...
...uest = window.indexeddb.open('todolist', 4); openrequest.onupgradeneeded = (event) => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; openrequest.addeventlistener('success', (event) => { console.log('database opened successfully!'); })...
....createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; openrequest.addeventlistener('success', (event) => { console.log('database opened successfully!'); }); the same example, but using the onsuccess event handler property: // open the database const openrequest = window.indexeddb.open('todolist', 4); openrequest.onupgradeneeded = (event) => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hou...
...adeneeded = (event) => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; openrequest.onsuccess = (event) => { console.log('database opened successfully!'); }; ...
IDBRequest.transaction - Web APIs
in transactions, such as for requests returned from idbfactory.open — in this case you're just connecting to a database, so there is no transaction to return. if a version upgrade is needed when opening a database then during the upgradeneeded event handler the transaction property will be an idbtransaction with mode equal to "versionchange", and can be used to access existing object stores and indexes, or abort the the upgrade. following the upgrade, the transaction ​property will again be null. note: this feature is available in web workers. syntax var mytransaction = request.transaction; value an idbtransaction. example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.resul...
... openrequest.onupgradeneeded = function(event) { console.log(openrequest.transaction.mode); // will log "versionchange". var db = openrequest.result; if (event.oldversion < 1) { // new database, create "books" object store. db.createobjectstore('books'); } if (event.oldversion < 2) { // upgrading fr...
...console.log(openrequest.transaction); // will log "null". openrequest.onupgradeneeded = function(event) { console.log(openrequest.transaction.mode); // will log "versionchange". var db = openrequest.result; if (event.oldversion < 1) { // new database, create "books" object store. ...
...openrequest.transaction.mode); // will log "versionchange". var db = openrequest.result; if (event.oldversion < 1) { // new database, create "books" object store. db.createobjectstore('books'); } if (event.oldversion < 2) { // upgrading from v1 database: add index on "title" to "books" store. var bookstore = openrequest.transaction.objectstore('books'); bookstore.createindex('by_title', 'title'); } }; openrequest.onsuccess = function() { console.log(openrequest.transaction); // will log "null". }; specifications specification status comment indexed database api 2.0the definition of 'transaction' in that specification. recommendation indexed database api draftthe definition of 'transaction' in that specification. rec...
IDBTransaction: complete event - Web APIs
the complete handler is executed when a transaction successfully completed. ...
...uest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = event => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = event => { const db = dbopenrequest.result; // open a read/write db tran...
...ddeventlistener('complete', event => { console.log('transaction was competed'); }); const objectstore = transaction.objectstore('todolist'); const newitem = { tasktitle: 'my task', hours: 10, minutes: 10, day: 10, month: 'january', year: 2019 }; const objectstorerequest = objectstore.add(newitem); }; using the oncomplete property: // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = event => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hou...
...gradeneeded = event => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this database var objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = event => { const db = dbopenrequest.result; // open a read/write db transaction, ready for adding the data const transaction = db.tran...
IDBTransaction: error event - Web APIs
ction object. ...
...iven tasktitle already exists): // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const db = dbopenrequest.result; // open a read/write db tr...
...ding new item: ${newitem.tasktitle}`); }); const objectstore = transaction.objectstore('todolist'); const newitem = { tasktitle: 'my task', hours: 10, minutes: 10, day: 10, month: 'january', year: 2020 }; const objectstorerequest = objectstore.add(newitem); }; the same example, using the onerror property instead of addeventlistener(): // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minute...
...pgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('todolist', { keypath: 'tasktitle' }); // define what data items the objectstore will contain objectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const db = dbopenrequest.result; // open a read/write db transaction, ready for adding the data const transaction = db.transaction(['todolist'], 'readwrite'); transaction.onerror = () =>...
IDBTransaction.mode - Web APIs
ode object defining the mode for isolating access to data in the current object stores: value explanation readonly allows data to be read but not changed. readwrite allows reading and writing of data in existing data stores to be changed. versionchange allows any operation to be performed, including ones that delete and create object stores and indexes. this mode is for updating the version number of transactions that were started using idbdatabase.setversion(). transactions of this mode cannot run concurrently with other transactions. transactions in this mode are known as "upgrade transactions." example in the following code snippet, we open a read/write transaction on our database and add some data to an object store. note also the...
...and add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. at the end, we simply log the mode of the current transaction using mode. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inser...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data ...
...the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; // return the mode this transaction has been opened in (should be "readwrite" in this case) transaction.mode; }; specification specification status comment indexed database api 2.0the definition of 'mode' in that specification. recommendation indexed database api draftthe definition of 'mode' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewch...
IDBVersionChangeEvent - Web APIs
note: this feature is available in web workers. properties also inherits properties from its parent, method. idbversionchangeevent.oldversion read only returns the old version of the database. idbversionchangeevent.newversion read only returns the new version of the database. deprecated properties idbversionchangeevent.version read only the new version of the database in a versionchange transaction. ...
...nclude handlers for the success and error cases. upon a version change (after an upgradedneeded event), the success event will implement the idbversionchangeevent interface. for a full working example, see our to-do notifications app (view example live.) var note = document.queryselector("ul"); // in the following line, you should include the prefixes of implementations you want to test. window.indexeddb = window.indexeddb || window.mozindexeddb || window.webkitindexeddb || window.msindexeddb; // don't use "var indexeddb = ..." if you're not in a function. // moreover, you may need references to some window.idb* objects: window.idbtransaction = window.idbtransaction || window.webkitidbtransaction || window.msidbtransaction; window.idbkeyrange = window.idbkeyrange || window.webkitidbkeyrange |...
...this is used a lot ...
... note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. this is used a lot later on, for opening transactions and suchlike. db = dbopenrequest.result; }; specifications specification status comment indexed database api 2.0the definition of 'idbversionchangeevent' in that specification. recommendation initial definition. indexed database api draftthe definition of 'idbversionchangeevent' in that specification. recommendation ...
WebGL2RenderingContext.bindBufferBase() - Web APIs
buffer a webglbuffer which to bind to the binding point (target). return value none. ...
... buffer a webglbuffer which to bind to the binding point (target). return value none. ...
... buffer a webglbuffer which to bind to the binding point (target). return value none. ...
... buffer a webglbuffer which to bind to the binding point (target). return value none. ...
WebGL2RenderingContext.bindBufferRange() - Web APIs
buffer a webglbuffer which to bind to the binding point (target). offset a glintptr specifying the starting offset. ...
... buffer a webglbuffer which to bind to the binding point (target). offset a glintptr specifying the starting offset. ...
... buffer a webglbuffer which to bind to the binding point (target). offset a glintptr specifying the starting offset. ...
... buffer a webglbuffer which to bind to the binding point (target). offset a glintptr specifying the starting offset. size a glsizeiptr specifying the amount of data that can be read from the buffer. return value none. ...
WebGL2RenderingContext.getActiveUniformBlockName() - Web APIs
return value a domstring indicating the active uniform block name. ...
... return value a domstring indicating the active uniform block name. ...
... return value a domstring indicating the active uniform block name. ...
... return value a domstring indicating the active uniform block name. ...
WebGL2RenderingContext.getActiveUniformBlockParameter() - Web APIs
pname a glenum specifying which information to query. ...
... pname a glenum specifying which information to query. ...
... pname a glenum specifying which information to query. ...
...ferenced by the vertex shader. gl.uniform_block_referenced_by_fragment_shader: returns a glboolean indicating whether the uniform block is referenced by the fragment shader. return value depends on which information is requested using the pname parameter. if an error occurs, null is returned. examples var blocksize = gl.getactiveuniformblockparameter(program, blockindex, gl.uniform_block_data_size); specifications specification status comment webgl 2.0the definition of 'getactiveuniformblockparameter' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'glgetactiveuniformblockiv' in that specification. standard man page of the (similar) opengl api. ...
WebGLRenderingContext.enableVertexAttribArray() - Web APIs
some vertex attribute indices may have predefined purposes, depending on the platform and/or 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. ...
...eate the attributes. either way, since attributes cannot be used unless enabled, and are disabled by default, you need to call enablevertexattribarray() to enable individual attributes so that they can be used. once that's been done, other methods can be used to access the attribute, including vertexattribpointer(), vertexattrib*(), and getvertexattrib(). syntax void gl.enablevertexattribarray(index); parameters index a gluint specifying the index number that uniquely identifies the vertex attribute to enable. if you know the name of the attribute but not its index, you can get the index by calling getattriblocation(). return value undefined. errors to check for errors after calling enablevertexattribarray(), call geterror(). webglrenderingcontext.invalid_value the specified i...
... false, 0, 0); gl.drawarrays(gl.triangles, 0, vertexcount); this code snippet is taken from the function animatescene() in "a basic 2d webgl animation example." see that article for the full sample and to see the resulting animation in action. 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(). with the index of the vertex position attribute now available in avertexposition, we call enablevertexattribarray() to enable the position attribute so it can be used by the shader program (in particular, by the vertex shader). then the vertex buffer is bound to the avertexposition attribute by calling vertexattribpointer(). th...
WebGL constants - Web APIs
t 0x8df3 medium_int 0x8df4 high_int 0x8df5 framebuffers and renderbuffers constant name value description framebuffer 0x8d40 renderbuffer 0x8d41 rgba4 0x8056 rgb5_a1 0x8057 rgb565 0x8d62 depth_component16 0x81a5 stencil_index8 0x8d48 depth_stencil 0x84f9 renderbuffer_width 0x8d42 renderbuffer_height 0x8d43 renderbuffer_internal_format 0x8d44 renderbuffer_red_size 0x8d50 renderbuffer_green_size 0x8d51 renderbuffer_blue_size 0x8d52 renderbuffer_alpha_size 0x8d53 renderb...
... constant name value description red 0x1903 rgb8 0x8051 rgba8 0x8058 rgb10_a2 0x8059 tex...
..._bindings 0x8a2f max_uniform_block_size 0x8a30 max_combined_vertex_uniform_components 0x8a31 max_combined_fragment_uniform_components 0x8a33 uniform_buffer_offset_alignment 0x8a34 active_uniform_blocks 0x8a36 uniform_type 0x8a37 uniform_size 0x8a38 uniform_block_index 0x8a3a uniform_offset 0x8a3b uniform_array_stride 0x8a3c uniform_matrix_stride 0x8a3d uniform_is_row_major 0x8a3e uniform_block_binding 0x8a3f uniform_block_data_size 0x8a40 uniform_block_active_uniforms 0x8a42 uniform_block_active_uniform_indices 0x8a43 ...
... webgl_debug_renderer_info constant...
Creating 3D objects using WebGL - Web APIs
rawarrays() method to using the vertex array as a table, and referencing individual vertices in that table to define the positions of each face's vertices, by calling gl.drawelements(). consider: each face requires four vertices to define it, but each vertex is shared by three faces. we can pass a lot fewer data around by building an array of all 24 vertices, then referring to each vertex by its index into that array instead of moving entire sets of coordinates around. if you wonder why we need 24 vertices, and not just 8, it is because each corner belongs to three faces of different colors, and a single vertex needs to have a single specific color; therefore we will create three copies of each vertex in three different colors, one for each face. this example uses the glmatrix library to per...
...lors[j]; // repeat each color four times for the four vertices of the face colors = colors.concat(c, c, c, c); } const colorbuffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, colorbuffer); gl.bufferdata(gl.array_buffer, new float32array(colors), gl.static_draw); define the element array once the vertex arrays are generated, we need to build the element array. const indexbuffer = gl.createbuffer(); gl.bindbuffer(gl.element_array_buffer, indexbuffer); // this array defines each face as two triangles, using the // indices into the vertex array to specify each triangle's // position. const indices = [ 0, 1, 2, 0, 2, 3, // front 4, 5, 6, 4, 6, 7, // back 8, 9, 10, 8, 10, 11, // top 12, 13, 14, 12, 14, 15...
... 7, // back 8, 9, 10, 8, 10, 11, // top 12, 13, 14, 12, 14, 15, // bottom 16, 17, 18, 16, 18, 19, // right 20, 21, 22, 20, 22, 23, // left ]; // now send the element array to gl gl.bufferdata(gl.element_array_buffer, new uint16array(indices), gl.static_draw); return { position: positionbuffer, color: colorbuffer, indices: indexbuffer, }; } the indices array defines each face like a pair of triangles, specifying each triangle's vertices as an index into the cube's vertex arrays. thus the cube is described as a collection of 12 triangles. drawing the cube next we need to add code to our drawscene() function to draw using the cube's index buffer, adding new gl.bindbuffer() and gl.drawelements() calls: // tell we...
...s array defines each face like a pair of triangles, specifying each triangle's vertices as an index into the cube's vertex arrays. thus the cube is described as a collection of 12 triangles. drawing the cube next we need to add code to our drawscene() function to draw using the cube's index buffer, adding new gl.bindbuffer() and gl.drawelements() calls: // tell webgl which indices to use to index the vertices gl.bindbuffer(gl.element_array_buffer, buffers.indices); ... { const vertexcount = 36; const type = gl.unsigned_short; const offset = 0; gl.drawelements(gl.triangles, vertexcount, type, offset); } since each face of our cube is comprised of two triangles, there are 6 vertices per side, or 36 total vertices in the cube, even though many of them are duplicate...
ARIA: document role - Accessibility
generally used in complex composite widgets or applications, the document role can inform assistive technologies to switch context to a reading mode: the document role tells assistive technologies with reading or browse modes to use the 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. description 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 thro...
...ex composit widget that an assistive technology user should read using its browse or virtual reading mode, if available. because ats with reading mode default to that mode for all elements except for those with a widget or application role set, document role is only useful for focusable elements within a widget or application that should be read as static rich text. adding role="document" and tabindex="0" to the element containing the text within a widget enables the screen reader user to press the tab key to place focus on the document element and read the text with the screen reader's reading cursor. assistive 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 ...
...as a relationship to the containing composit widget. an article can have associated articles. associated wai-aria roles, states, and properties aria-expanded include with a value of true or false if the document element is collapsible, to indicate if the document is currently expanded or collapsed. other values include the default undefined which means the document is not collapsible. tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. keyboard interactions the element should be made focusable by setting the tabindex="0" attribute / value pair on it. this way, the user can tab to it, reading mode is invoked automatically, and the content can be read right away. required javascript features none, except as required ...
...ssages, expand or collapse them, and manipulate them. once focus returns to the message list either by activating the back button or pressing an asociated keystroke, direct application interaction mode is invoked again, and the user can move to a different conversation in the list with the arrow keys. best practices always make sure an item with the document role is focusable, by setting the tabindex attribute with a value of 0. that will also include it in the tab order. added benefits the document role is an easy way to indirectly control assistive technology behavior by unambiguously stating that this is content the user should read with standard screen reader commands. specifications specification status accessible rich internet applications (wai-aria) 1.1the defi...
ARIA: rowgroup role - Accessibility
_elements_table_desc" aria-rowcount="81"> <div id="semantic_elements_table_desc">semantic elements to use instead of aria's roles</div> <div role="rowgroup"> <div role="row"> <span role="columnheader" aria-sort="none">aria role</span> <span role="columnheader" aria-sort="none">semantic element</span> </div> </div> <div role="rowgroup"> <div role="row" aria-rowindex="11"> <span role="cell">header</span> <span role="cell">h1</span> </div> <div role="row" aria-rowindex="16"> <span role="cell">header</span> <span role="cell">h6</span> </div> <div role="row" aria-rowindex="18"> <span role="cell">rowgroup</span> <span role="cell">thead</span> </div> <div role="row" aria-rowindex="24"> <span ro...
...e of 81 rows present in the dom: one within a table header and four rows within the table body. the header row, alone in a header rowgroup, has two column headers. the columns are sortable, but not currently sorted, as indicated by the aria-sort property. the table body is a separate rowgroup, with four rows currently in the dom. because not all the rows are in the dom, we've included the aria-rowindex property on every row. best practices only use table, tbody, thead, tr, th, td, and so on for data table structure. you can add these aria roles to ensure accessibility should the native semantics of the table be removed, such as with css. a relevant use case for the aria table role is when the css's display property overrides the native semantics of a table, such as by display: grid. in this c...
...the aria roles are only necessary if the native semantics of the table, and therefore the table rows, are obliterated, such...
...the aria roles are only necessary if the native semantics of the table, and therefore the table rows, are obliterated, such as by setting the display property to flex or grid. added benefits none specifications specification status...
ARIA: checkbox role - Accessibility
the checkbox role is used for checkable interactive controls. elements containing role="checkbox" must also include the aria-checked attribute to expose the checkbox's state to assistive technology. <span role="checkbox" aria-checked="false" tabindex="0" aria-labelledby="chk1-label"> </span> <label id="chk1-label">remember my preferences</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> description the native html checkbox form control can only have tw...
...rol can only have two checked states ("checked" or "not checked"), with an indeterminate state settable via javascript. 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 applied to a non-focusable element, use the tabindex attribute to change this. the expected keyboard shortcut for activating a checkbox is the space key. the developer is required to change the value of the aria-checked attribute dynamically when the checkbox is activated. associated wai-aria roles, states, and properties aria-checked the value of aria-checked defines the state of a checkbox. this attribute has one of three possible valu...
... aria-checked attribute dynamically when the checkbox is activated. associated wai-aria roles, states, and properties aria-checked the value of aria-checked defines the state of a checkbox. this attribute has one of three possible values: true the checkbox is checked false the checkbox is not checked mixed the checkbox is partially checked, or indeterminate tabindex="0" used to make it focusable so the assistive technology user can tab to it and start reading right away. keyboard interactions key function space activates the checkbox required javascript required event handlers onclick handle mouse clicks that will change the state of the checkbox by changing the value of the aria-checked attribute and the appearance of...
...of the aria-checked attribute and the appearance of the checkbox so it appears checked or unchecked to the sighted user examples the following example creates a simple checkbox element using css and javascript to handle the checked or unchecked status of the element. ...
CSS reference - CSS: Cascading Style Sheets
Web › CSS › Reference
the syntax for each specified value depends on the data type defined for each specified property. ...
...browse key css concepts and a list of selectors organized by type. also included is a brief dom-css / cssom reference. basic rule syntax style rule syntax style-rule ::= selectors-list { properties-list } ... where : selectors-list ::= selector[:pseudo-class] [::pseudo-element] [, selectors-list] properties-list ::= [property : value] [; properties-list] see the index of selectors, pseudo-classes, and pseudo-elements below. the syntax for each specified value depends on the data type defined for each specified property. style rule examples strong { color: red; } div.menu-bar li:hover > ul { display: block; } for a beginner-level introduction to the syntax of selectors, see our guide on css selectors. be aware that any syntax error in a rule definition...
...ors. be aware that any syntax error in a rule definition invalidates the 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 javascript 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-name...
... basic selectors basic selectors are fundamental selectors; these are the most basic selectors that are frequently combined to create other, more complex selectors. universal selector *, ns|*, *|*, |* type selector elementna...
animation - CSS: Cascading Style Sheets
Web › CSS › animation
sslist.contains('pause')) { anim.style.animationplaystate = 'paused'; togglebutton(btn, 'play'); } else { anim.classlist.remove('a' + (i + 1)); settimeout(function () { togglebutton(btn, i === 0 ? ...
... constitue...
... constituent properties this property is a shorthand for the following css properties: animation-delay anim...
... anim.style.animationplaystate = ''; anim.classlist.add('a' + (i + 1)); }, 100) } } animation.foreach(function (node, index) { node.addeventlistener('animationstart', function () { togglebutton(button[index], 'pause'); }); node.addeventlistener('animationend', function () { togglebutton(button[index], 'restart'); }); }); button.foreach(function (btn, index) { btn.addeventlistener('click', function () { playpause(index); }); }); }) a description of which properties are animatable is available; it's worth noting that this description is also valid for css transitions. constituent properties this property is a shorthand for the following css properties: animation-delay animation-direction animation-duration animation-fill-mode anima...
Setting up adaptive streaming media sources - Developer guides
ondemand profile this profile will allow switching between streams 'on demand' - that is to say that you only need provide a set of contiguous files and specify the bandwidth for each one and the appropriate file will be chosen automatically.
...s. apple provides tools to convert media files to the appropriate format. hls encoding tools ther are a number of useful tools available for hls encoding for hls live stream encoding adobe provide a media encoder for mac. ...
...s available for hls encoding for hls live stream encoding adobe provide a media encoder for mac. the stream segmenter — provided by apple for mac platforms — takes a media stream from a local network and splits media into equally sized media files together with an index file. apple also provides a file segmenter for mac — which takes a suitably encoded file, splits it up and produces a index file, in a similar fashion to the stream segmenter. note: you can find more details about these tools at using http live streaming. index files (playlists) the hls index file (much like mpeg-dash's .mpd file) contains the information on where all the media segments reside, as well as other meta data such as bandwidth application. apple uses the .m3u8 format (an extension of its .m3u playlis...
...milar fashion to the stream segmenter. note: you can find more details about these tools at using http live streaming. index files (playlists) the hls index file (much like mpeg-dash's .mpd file) contains the information on where all the media segments reside, as well as other meta data such as bandwidth application. apple uses the .m3u8 format (an extension of its .m3u playlist format) for index files — see below for an example: #ext-x-version:3 #extm3u #ext-x-targetduration:10 #ext-x-media-sequence:1 # old-style integer duration; avoid for newer clients. #extinf:10, http://media.example.com/segment0.ts # new-style floating-point duration; use for modern clients. #extinf:10.0, http://media.example.com/segment1.ts #extinf:9.5, http://media.example.com/segment2.ts #ext-x-endlist not...
Global attributes - HTML: Hypertext Markup Language
ked for spelling errors; false, which indicates that the element should not be checked for spelling errors. style contains css styling declarations to be applied to the element. note that it is recommended for styles to be defined in a separate file or files. this attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. tabindex an integer attribute indicating if the element can take input focus (is focusable), if it should participate to sequential keyboard navigation, and if so, at what position. it can take several values: a negative value means that the element should be focusable, but should not be reachable via sequential keyboard navigation; 0 means that the element should be focusable and reachable via seq...
...t be reachable via sequential keyboard navigation; 0 means that the element should be focusable and reachable via sequential keyboard navigation, but its relative order is defined by the platform convention; a positive value means that the element should be focusable and reachable via sequential keyboard navigation; the order in which the elements are focused is the increasing value of the tabindex. if several elements share the same tabindex, their relative order follows their relative positions in the document. title contains a text representing advisory information related to the element it belongs to. such information can typically, but not necessarily, be presented to the user as a tooltip. translate an enumerated attribute that is used to specify whether an element's attribu...
...that specification. recommendation snapshot of html living standard. from html5, contextmenu, draggable, dropzone, and spellcheck have been added. html5the definition of 'global attributes' in that specification. recommendation snapshot of html living standard. from html 4.01 specification, the concept of global attributes is introduced and the dir, lang, style, id, class, tabindex, accesskey, and title are now true global attributes. xml:lang which was initially part of xhtml, is now also part of html. hidden, data-*, contenteditable, and translate have been added. html 4.01 specification recommendation there are no global attributes defined. several attributes that will become global attributes in subsequent specifications are defined on a subset of...
...yle>, and <title>. dir is supported on all elements but <applet>, <base>, <basefont>, <bdo>, <br>, <frame>, <frameset>, <iframe>, <param>, and <script>. id is supported on all elements but <base>, <head>, <html>, <meta>, <script>, <style>, and <title>. lang is supported on all elements but <applet>, <base>, <basefont>, <br>, <frame>, <frameset>, <iframe>, <param>, and <script>. tabindex is only supported on <a>, <area>, <button>, <object>, <select>, and <textarea>. accesskey is only supported on <a>, <area>, <button>, <input>, <label>, <legend> and <textarea>. title is supported on all elements but <base>, <basefont>, <head>, <html>, <meta>, <param>, <script>, and <title>. ...
SameSite cookies - HTTP
rather specify it explicitly to clearly communicate your intent which samesite policy applies to your cookie. this will also improve the experience across browsers as not all of them default to lax yet. ...
...ent which samesite policy applies to your cookie. this will also improve the experience across browsers as not all of them default to lax yet. ...
...t to lax yet. ...
... "^example\.org$" [nc] rewriterule "^(.*)" "https://www.example.org/index.html" [r=301,l,qsa] rewriterule "^(.*)\.ht$" "index.php?nav=$1 [nc,l,qsa,co=rewriterule;01;https://www.example.org;30/;samesite=none;secure] rewriterule "^(.*)\.htm$" "index.php?nav=$1 [nc,l,qsa,co=rewriterule;02;https://www.example.org;30/;samesite=none;secure] rewriterule "^(.*)\.html$" "index.php?nav=$1 [nc,l,qsa,co=rewriterule;03;https://www.example.org;30/;samesite=none;secure] [...] rewriterule "^admin/(.*)\.html$" "admin/index.php?nav=$1 [nc,l,qsa,co=rewriterule;09;https://www.example.org:30/;samesite=strict;secure] specifications specification title rfc 6265, section 4.1: set-cookie http state management mechanism draft-ietf-httpbis-rfc6265...
A re-introduction to JavaScript (JS tutorial) - JavaScript
notation upon being created. {[phonetype]: 12345} is possible instead of just var userphone = {}; userphone[phonetype] = 12345. arrays arrays in javascript are actually a special type of object. they work very much like regular objects (numerical properties can naturally be accessed only using [] syntax) but they have one magic property called 'length'. this is always one more than the highest index in the array. one way of creating arrays is as follows: var a = new array(); a[0] = 'dog'; a[1] = 'cat'; a[2] = 'hen'; a.length; // 3 a more convenient notation is to use an array literal: var a = ['dog', 'cat', 'hen']; a.length; // 3 note that array.length isn't necessarily the number of items in the array. consider the following: var a = ['dog', 'cat', 'hen']; a[100] = 'fox'; a.length; ...
...y(); a[0] = 'dog'; a[1] = 'cat'; a[2] = 'hen'; a.length; // 3 a more convenient notation is to use an array literal: var a = ['dog', 'cat', 'hen']; a.length; // 3 note that array.length isn't necessarily the number of items in the array. consider the following: var a = ['dog', 'cat', 'hen']; a[100] = 'fox'; a.length; // 101 remember — the length of the array is one more than the highest index. ...
...en'; a.length; // 3 a more convenient notation is to use an array literal: var a = ['dog', 'cat', 'hen']; a.length; // 3 note that array.length isn't necessarily the number of items in the array. consider the following: var a = ['dog', 'cat', 'hen']; a[100] = 'fox'; a.length; // 101 remember — the length of the array is one more than the highest index. ...
.....in loop, however this does not iterate over the array elements, but the array indices. furthermore, if someone added new properties to array.prototype, they would also be iterated over by such a loop. therefore this loop type is not recommended for arrays. another way of iterating over an array that was added with ecmascript 5 is foreach(): ['dog', 'cat', 'hen'].foreach(function(currentvalue, index, array) { // do something with currentvalue or array[index] }); if you want to append an item to an array simply do it like this: a.push(item); arrays come with a number of methods. see also the full documentation for array methods. method name description a.tostring() returns a string with the tostring() of each element separated by commas. a.tolocales...
Expressions and operators - JavaScript
returns false (cannot delete non-configurable properties) delete myobj.h; // returns true (can delete user-defined properties) deleting array elements since arrays are just objects, it's technically possible to delete elements from them. this is however regarded as a bad practice, try to avoid it. when you delete an array property, the array length is not affected and other elements are no re-indexed. to achieve that behavior, it is much better to just overwrite the element with the value undefined. to actually manipulate the array, use the various array methods such as splice. typeof the typeof operator is used in either of the following ways: typeof operand typeof (operand) the typeof operator returns a string indicating the type of the unevaluated operand. operand is the string, var...
...ood style to use them. relational operators a relational operator compares its operands and returns a boolean value based on whether the comparison is true. in the in operator returns true if the specified property is in the specified object. ...
..., or symbol expression representing a property name or array index, and objectname is the name of an object. the following examples show some uses of the in operator. ...
...ay index, and objectname is the name of an object. the following examples show some uses of the in operator. ...
Iterators and generators - JavaScript
egers between 0 and infinity. here is an example which can do just that. it allows creation of a simple range iterator which defines a sequence of integers from start (inclusive) to end (exclusive) spaced step apart. its final return value is the size of the sequence it created, tracked by the variable iterationcount. ...
...ence of integers from start (inclusive) to end (exclusive) spaced step apart. its final return value is the size of the sequence it created, tracked by the variable iterationcount. ...
...usive) spaced step apart. its final return value is the size of the sequence it created, tracked by the variable iterationcount. ...
...rn value is the size of the sequence it created, tracked by the variable iterationcount. ...
Text formatting - JavaScript
the length of a string is the number of elements in it. ...
...the length of a string is the number of elements in it. ...
...tat(). a string object has a variety of methods: for example those that return a variation on the string itself, such as substring and touppercase. the following table summarizes the methods of string objects. methods of string method description charat, charcodeat, codepointat return the character or character code at the specified position in string. indexof, lastindexof return the position of specified substring in the string or last position of specified substring, respectively. startswith, endswith, includes returns whether or not the string starts, ends or contains a specified string. concat combines the text of two strings and returns a new string. fromcharcode, fromcodepoint constructs a string from the ...
...m the specified sequence of unicode values. this is a method of the string class, not a string instance. split splits a string object into an array of strings by separating the string into substrings. slice extracts a section of a string and returns a new string. substring, substr return the specified subset of the string, either by specifying the start and end indexes or the start index and a length. match, matchall, replace, replaceall, search work with regular expressions. tolowercase, touppercase return the string in all lowercase or all uppercase, respectively. normalize returns the unicode normalization form of the calling string value. repeat returns a string consisting of the elements of the obj...
Array.prototype.forEach() - JavaScript
the foreach() method executes a provided function once for each array element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.foreach(callback(currentvalue [, index [, array]])[, thisarg]) parameters callback function to execute on each element. it accepts between one and three arguments: currentvalue the current element being processed in the array. index optional the index currentvalue in the array. array optional the array foreach() was called upon. thisarg optional value to use as this when executing callback. return value undefined. description foreach() calls a provi...
...alue the current element being processed in the array. index optional the index currentvalue in the array. array optional the array foreach() was called upon. thisarg optional value to use as this when executing callback. return value undefined. description foreach() calls a provided callback function once for each element in an array in ascending order. it is not invoked for index properties that have been deleted or are uninitialized. (for sparse arrays, see example below.) callback is invoked with three arguments: the value of the element the index of the element the array object being traversed if a thisarg parameter is provided to foreach(), it will be used as callback's this value. the thisarg value ultimately observable by callback is determined according to ...
...y on which it is called. (however, callback may do so) there is no way to stop or break a foreach() loop other than by throwing an exception. if you need such behavior, the foreach() method is the wrong tool. early termination may be accomplished with: a simple for loop a for...of / for...in loops array.prototype.every() array.prototype.some() array.prototype.find() array.prototype.findindex() array methods: every(), some(), find(), and findindex() test the array elements with a predicate returning a truthy value to determine if further iteration is required. foreach expects a synchronous function foreach does not wait for promises. kindly make sure you are aware of the implications while using promises(or async functions) as foreach callback. example code let ratings = [5, 4,...
...h(function(item){ copyitems.push(item) }) printing the contents of an array note: in order to display the content of an array in the console, you can use console.table(), which prints a formatted version of the array. the following example illustrates an alternative approach, using foreach(). the following code logs a line for each element in an array: function logarrayelements(element, index, array) { console.log('a[' + index + '] = ' + element) } // notice that index 2 is skipped, since there is no item at // that position in the array... [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 ...
Array.prototype.some() - JavaScript
thod tests whether at least one element in the array passes the test implemented by the provided function. it returns a boolean value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.some(callback(element[, index[, array]])[, thisarg]) parameters callback a function to test for each element, taking three arguments: element the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array some() was called upon. thisargoptional a value to use as this when executing callback. return value true...
...t least one element in the array. otherwise, false. description the some() method executes the callback function once for each element present in the array until it finds the one where callback returns a truthy value (a value that becomes true when converted to a boolean). if such an element is found, some() immediately returns true. otherwise, some() returns false. callback is invoked only for indexes of the array with assigned values. it is not invoked for indexes which have been deleted or which have never been assigned values. callback is invoked with three arguments: the value of the element, the index of the element, and the array object being traversed. if a thisarg parameter is provided to some(), it will be used as the callback's this value. otherwise, the value undefined will be u...
...te the array on which it is called. the range of elements processed by some() is set before the first invocation of callback. elements appended to the array after the call to some() begins will not be visited by callback. if an existing, unvisited element of the array is changed by callback, its value passed to the visiting callback will be the value at 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 scripts, allowing use of some() in implementations ...
... throw new typeerror(); } var t = object(this); var len = t.length >>> 0; for (var i = 0; i < len; i++) { if (i in t && fun.call(thisarg, t[i], i, t)) { return true; } } return false; }; } examples testing value of array elements the following example tests whether any element in the array is bigger than 10. function isbiggerthan10(element, index, array) { return element > 10; } [2, 5, 8, 1, 4].some(isbiggerthan10); // false [12, 5, 8, 1, 4].some(isbiggerthan10); // true testing array elements using arrow functions arrow functions provide a shorter syntax for the same test. [2, 5, 8, 1, 4].some(x => x > 10); // false [12, 5, 8, 1, 4].some(x => x > 10); // true checking whether a value exists in an array to mimic the function of ...
Array.prototype.sort() - JavaScript
pair \ud655\ude55 will be sorted before the character \uff3a. if comparefunction is supplied, all non-undefined array elements are sorted according to the return value of the compare function (all undefined elements are sorted to the end of the array, with no call to comparefunction). ...
...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 returned, then the sort order is undefined. ...
...rting. 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 temporary array to achieve the right order. ...
...ition and sort-value var mapped = list.map(function(el, i) { return { index: i, value: el.tolowercase() }; }) // sorting the mapped array containing the reduced values mapped.sort(function(a, b) { if (a.value > b.value) { return 1; } if (a.value < b.value) { return -1; } return 0; }); // container for the resulting order var result = mapped.map(function(el){ return list[el.index]; }); there is an open source library available called mapsort which applies this approach. specifications specification ecmascript (ecma-262)the definition of 'array.prototype.sort' in that specification. ...
ArrayBuffer.prototype.slice() - JavaScript
contents are a copy of this arraybuffer's bytes from begin, inclusive, up to end, exclusive. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...gin, inclusive, up to end, exclusive. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arraybuffer.slice(begin[, end]) parameters begin zero-based byte index at which to begin slicing. end optional byte index before which to end slicing. ...
...if the computed length of the new arraybuffer would be negative, it is clamped to zero. ...
...s all bytes from begin to the end of this arraybuffer. return value a new arraybuffer object. description the slice() method copies up to, but not including, the byte indicated by the end parameter. if either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. the range specified by the begin and end parameters is clamped to the valid index range for the current array. if the computed length of the new arraybuffer would be negative, it is clamped to zero. examples copying an arraybuffer const buf1 = new arraybuffer(8); const buf2 = buf1.slice(0); specifications specification ecmascript (ecma-262)the definition of 'arraybuffer.prototype.slice' in that specification. ...
RegExp.prototype.test() - JavaScript
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. description 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() called multiple times on the same global regular expression instance will advance past the previous match. examples using test() simple example that tests if "hello" is contain...
... when test() returns false, the calling regex's lastind...
...s of the test: function testinput(re, str) { let midstring; if (re.test(str)) { midstring = 'contains'; } else { midstring = 'does not contain'; } console.log(`${str} ${midstring} ${re.source}`); } using test() on a regex with the "global" flag when a regex has the global flag set, test() will advance the lastindex of the regex. (regexp.prototype.exec() also advances the lastindex property.) further calls to test(str) will resume searching str starting from lastindex. the lastindex property will continue to increase each time test() returns true. note: as long as test() returns true, lastindex will not reset—even when testing a different string! when test() returns false, the calling regex's lastindex property will reset to 0. the following example demonstrates th...
... lastindex. the lastindex property will continue to increase each time test() returns true. note: as long as test() returns true, lastindex will not reset—even when testing a different string! when test() returns false, the calling regex's lastindex property will reset to 0. the following example demonstrates this behaviour: const regex = /foo/g; // the "global" flag is set // regex.lastindex is at 0 regex.test('foo') // true // regex.lastindex is now at 3 regex.test('foo') // false // regex.lastindex is at 0 regex.test('barfoo') // true // regex.lastindex is at 6 regex.test('foobar') //false // regex.lastindex is at 0 // (...and so on) specifications specification ecmascript (ecma-262)the definition of 'regexp.test' in that specification. ...
SharedArrayBuffer.prototype.slice() - JavaScript
the sharedarraybuffer.prototype.slice() method returns a new sharedarraybuffer whose contents are a copy of this sharedarraybuffer's bytes from begin, inclusive, up to end, exclusive. if either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. this method has the same algorithm as array.prototype.slice(). the source for this interactive example is stored in a github repository. ...
...inning. this method has the same algorithm as array.prototype.slice(). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax sab.slice() sab.slice(begin) sab.slice(begin, end) parameters begin optional zero-based index at which to begin extraction. a negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. if begin is undefined, slice begins from index 0. end optional zero-based index before which to end extraction. slice extracts up to but not including end. for example, slice(1,4) extracts the second element through the fourt...
...slice(2,-1) extracts the third element through the second-to-last element in the sequence. if end is omitted, slice extracts through the end of the sequence (sab.bytelength). return value a new sharedarraybuffer containing the extracted elements. ...
...slice(2,-1) extracts the third element through the second-to-last element in the sequence. if end is omitted, slice extracts through the end of the sequence (sab.bytelength). ...
String.fromCodePoint() - JavaScript
her than as a method of a string object you created. polyfill the string.fromcodepoint() method has been added to ecmascript 2015 and may not be supported in all web browsers or environments yet. ...
...object you created. polyfill the string.fromcodepoint() method has been added to ecmascript 2015 and may not be supported in all web browsers or environments yet. ...
...d. polyfill the string.fromcodepoint() method has been added to ecmascript 2015 and may not be supported in all web browsers or environments yet. ...
...thod has been added to ecmascript 2015 and may not be supported in all web browsers or environments yet. ...
TypedArray.prototype.forEach() - JavaScript
executes a provided function once per array element. this method has the same algorithm as array.prototype.foreach(). typedarray is one of the typed array types here. syntax typedarray.foreach(callback[, thisarg]) parameters callback function that produces an element of the new typed array, taking three arguments: currentvalue the current element being processed in the typed array. ...
...rovided function once per array element. this method has the same algorithm as array.prototype.foreach(). typedarray is one of the typed array types here. syntax typedarray.foreach(callback[, thisarg]) parameters callback function that produces an element of the new typed array, taking three arguments: currentvalue the current element being processed in the typed array. index the index of the current element being processed in the array. array the array foreach() was called upon. thisarg optional. value to use as this when executing callback. return value undefined. description the foreach() method executes the provided callback once for each element present in the typed array in ascending order. it is not invoked for indexes that have been deleted or elided. how...
...ng callback. return value undefined. description the foreach() method executes the provided callback once for each element present in the typed array in ascending order. it is not invoked for indexes that have been deleted or elided. however, it is executed for elements that are present and have the value undefined. callback is invoked with three arguments: the element value the element index the typed array being traversed if a thisarg parameter is provided to foreach(), it will be passed to callback when invoked, for use as its this value. otherwise, the value undefined will be passed for use as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. the range of elements processed ...
...value at the time foreach() visits them; elements that are deleted before being visited are not visited. foreach() executes the callback function once for each typed array element; unlike every() and some() it, always returns the value undefined. examples logging the contents of a typed array the following code logs a line for each element in a typed array: function logarrayelements(element, index, array) { console.log('a[' + index + '] = ' + element); } new uint8array([0, 1, 2, 3]).foreach(logarrayelements); // logs: // a[0] = 0 // a[1] = 1 // a[2] = 2 // a[3] = 3 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.foreach' in that specification. ...
in operator - JavaScript
specified property is in the specified object or its prototype chain. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax prop in object parameters prop a string or symbol representing a property name or array index (non-symbols will be coerced to strings). object object to check if it (or its prototype chain) contains the property with specified name (prop). examples basic usage the following examples show some uses of the in operator. // arrays let trees = ['redwood', 'bay', 'cedar', 'oak', 'maple'] 0 in trees // returns true 3 in trees // returns true 6 in trees // returns f...
...to check if it (or its prototype chain) contains the property with specified name (prop). examples basic usage the following examples show some uses of the in operator. ...
...in) contains the property with specified name (prop). examples basic usage the following examples show some uses of the in operator. ...
...es = new array('redwood', 'bay', 'cedar', 'oak', 'maple') trees[3] = undefined 3 in trees // returns true the in operator will return false for empty array slots. even if accessing it directly returns undefined. let empties = new array(3) empties[2] // returns undefined 2 in empties // returns false to avoid this, make sure a new array is always filled with non-empty values or not write to indexes past the end of array. let empties = new array(3).fill(undefined) 2 in empties // returns true inherited properties the in operator returns true for properties in the prototype chain. (if you want to check for only non-inherited properties, use object.prototype.hasownproperty() instead.) 'tostring' in {} // returns true specifications specification ecmascript (ecma-2...
import.meta - JavaScript
it returns an object with a url property indicating the base url of the module. this will either be the url from which the script was obtained, for external scripts, or the document base url of the containing document, for inline scripts. note that this will include query parameters and/or hash (i.e., following the ? or #). ...
...om which the script was obtained, for external scripts, or the document base url of the containing document, for inline scripts. note that this will include query parameters and/or hash (i.e., following the ? or #). ...
...pts. note that this will include query parameters and/or hash (i.e., following the ? or #). ...
... will include query parameters and/or hash (i.e., following the ? or #). for example, with the following html: <script type="module"> import './index.mjs?someurlinfo=5'; </script> ..the following javascript 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: // index.mjs import './index2.mjs?someurlinfo=5'; // index2.mjs new url(import.meta.url).searchparams.get('someurlinfo'); // 5 note that while node.js will pass on query parameters (or the hash) as in the latter example, as of node 14.1.0, a url with query parameters will err when loading in the form node --experimental-modules index.mjs?someurlinfo=5 (it is treated as a file rather than a url in this context). such file-...
Add to Home screen - Progressive web apps (PWAs)
ent places. name provides the full app name, and short_name provides a shortened name to be used when there is insufficient space to display the full name. you are advised to provide both if your app's name is particularly long. start_url: provides a path to the asset that should be loaded when 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", "description": "shows random fox pictures. hey, at least it isn't cats.", "display": "fullscreen", "icons": [ ...
... the manifest for our sample app looks like this: { "background_color": "purple", "description": "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 192 px icon for use in our app. you can include more sizes if you want; android will choose the most appropriate size for each different use case. you could also decide to include different types of icons so devices can use the best one they are able to (e.g., chrome already supports the webp format). not...
...lace. what does a2hs not give you? bear in mind that when you add an app to your home screen, it just makes the app easily accessible — it doesn't download the app's assets and data to your device and make the app available offline, or anything like that. to make your app work offline, you have to use the service worker api to handle storing the assets offline, and if required, web storage or indexeddb to store its data. in our example app, we've just used a service worker to store all necessary files. the service worker is registered against the site with the final code block in the index.js file. we then cache all the site's assets using the cache api, and serve them from the cache instead of the network using the code in the sw.js file. a2hs on desktop while originally intended to imp...
...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 fo...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
used to remind the user about something, or let them know about new content being available in the app. push example push needs the server part to work, so we're not able to include it in the js13kpwa example hosted on github pages, as it offers hosting of static files only. it is all explained in the service worker cookbook — see the push payload demo. ...
...ted on github pages, as it offers hosting of static files only. it is all explained in the service worker cookbook — see the push payload demo. this demo consists of three files: index.js, which 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. ...
...pages, as it offers hosting of static files only. it is all explained in the service worker cookbook — see the push payload demo. this demo consists of three files: index.js, which 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. ...
...you can use the following ones:"); console.log(webpush.generatevapidkeys()); return; } webpush.setvapiddetails( 'https://serviceworke.rs/', process.env.vapid_public_key, process.env.vapid_private_key ); next, a module defines and exports all the routes an app needs to handle: getting the vapid public key, registering, and then sending notifications. you can see the variables from the index.js file being used: payload, delay and ttl. module.exports = function(app, route) { app.get(route + 'vapidpublickey', function(req, res) { res.send(process.env.vapid_public_key); }); app.post(route + 'register', function(req, res) { res.sendstatus(201); }); app.post(route + 'sendnotification', function(req, res) { const subscription = req.body.subscription; const pay...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
svg 2 is the next major version of the svg standard, which is a complete rework of the svg 1.2 draft. version 2 contains a lot of changes regarding the last stable version svg 1.1. those changes are listed below including their support status within mozilla applications. ...
...ver implemented svgelement.viewportelement and svgelement.ownersvgelement nullable implementation status unknown svgelement.getpresentationattribute() removed never implemented (prototype removed in bug 921456) svgcolor and svgicccolor removed never implemented svgelement.focus(), svgelement.blur() not implemented (bug 778654) svgelement.tabindex implemented (bug 778654) document.activeelement implementation status unknown globaleventhandlers on svgelement implementation status unknown options dictionary attribute for svggraphicselement.getbbox() implemented behind the preference svg.new-getbbox.enabled (bug 999964, bug 1019326) allow leading and trailing whitespace in <length>, <angle>, <nu...
...upported (bug 528332 (firefox 15 / thunderbird 15 / seamonkey 2.12), bug 1318208) arcs value for stroke-linejoin not implemented (bug 1239142) auto-start-reverse value for <marker>'s orient attribute implemented (bug 879659) svgpaint removed implementation status unknown fill and stroke taking multiple paints implementation status unknown z-index not implemented (bug 360148 child(<integer>) paint value implementation status unknown display of zero-length subpaths depends on stroke-linecap attribute implementation status unknown markers on all shapes implementation status unknown <marker> element display defined in ua style sheet implementation status unknown only single paints fo...
...<hatchpath> (renamed hatchpath) not implemented (bug 1239147) display behavior of paint server elements defined by ua style sheet not implemented clipping, masking, and compositing change notes overflow respected on outermost <svg> elements inline in html implementation status unknown interactivity change notes tabindex attribute implemented (bug 778654) bounding-box on pointer-events not implemented (bug 945187) load, abort, error, and unload instead of svgload, svgabort, svgerror, and svgunload not implemented (bug 620002) only structurally external elements and outermost <svg> element fire load events implementation status unknown resize and scroll instead of sv...
Compiling from Rust to WebAssembly - WebAssembly
{ "hello-wasm": "^0.1.0" }, "devdependencies": { "webpack": "^4.25.1", "webpack-cli": "^3.1.2", "webpack-dev-server": "^3.1.10" } } note that you need to fill in your own username, after the @, in the dependencies section. next, we need to configure webpack. ...
...", "webpack-cli": "^3.1.2", "webpack-dev-server": "^3.1.10" } } note that you need to fill in your own username, after the @, in the dependencies section. next, we need to configure webpack. ...
...note that you need to fill in your own username, after the @, in the dependencies section. next, we need to configure webpack. ...
...const path = require('path'); module.exports = { entry: "./index.js", output: { path: path.resolve(__dirname, "dist"), filename: "index.js", }, mode: "development" }; now we need an html file; create index.html and give it the following contents: <!doctype html> <html> <head> <meta charset="utf-8"> <title>hello-wasm example</title> </head> <body> <script src="./index.js"></script> </body> </html> finally, create the index.js referenced in the html file and give it these contents: const js = import("./node_modules/hello-wasm/hello_wasm.js"); js.then(js => { js.greet("webassembly"); }); note that you need to fill in your npm username again. this imports the new module from the node_modules folder. this isn't considered a best practice, but this is a dem...
SDK API Lifecycle - Archive of obsolete content
can trust that a given api will not change in future releases. at the same time, developers maintaining and extending the sdk's apis need to be able to introduce new apis that aren't yet fully proven, and to retire old apis when they're no longer optimal or supported by the underlying platform. the api lifecycle aims to balance these competing demands. it has two main components: a stability index that defines how stable each module is a deprecation process that defines when and how stable sdk apis can be changed or removed from future versions of the sdk while giving developers enough time to update their code. stability index the stability index is adopted from node.js. the sdk uses only four of the six values defined by node.js: experimental the module is not yet stabil...
... sdk. we will avoid breaking backwards compatibility unless absolutely necessary. if we do have to make backwards-incompatible changes, we will go through the formal deprecation process. deprecated we plan to change this module, and backwards compatibility should not be expected. don’t start using it, and plan to migrate away from this module to its replacement. ...
...the deprecation notice should point developers at a migration guide. ...
Getting Started (jpm) - Archive of obsolete content
default for each property. for more information on jpm init, see the jpm command reference. once you've supplied a value or accepted the default for these properties, you'll be shown the complete contents of "package.json" and asked to accept it. implementing the add-on now you can write the add-on's code. unless you've changed the value of "entry point" ("main" in package.json), this goes in "index.js" file in the root of your add-on. this file was created for you in the previous step. open it and add the following code: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: han...
... in cfx, the entry point defaults to "main.js", and is located in the "lib" directory under the add-on's root. save the file. next, create a directory called "data" in your add-on's root, mkdir data and save these three icon files to the "data" directory: icon-16.png ...
... in cfx, the entry point defaults to "main.js", and is located in the "lib" directory under the add-on's root. save the file. next, create a directory called "data" in your add-on's root, mkdir data and save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png b...
Unit Testing - Archive of obsolete content
create a new directory, navigate to it, and run jpm init. now create a new file called "base64.js", and give it the following contents: const { atob, btoa } = require("resource://gre/modules/services.jsm"); exports.atob = a => atob(a); exports.btoa = b => btoa(b); this code exports two functions, which just call the platform's btoa() and atob() functions. ...
...on/action").actionbutton({ id: "base64", label: "base64", icon: "./icon-16.png", onclick: function() { encoded = base64.btoa("hello"); console.log(encoded); decoded = base64.atob(encoded); console.log(decoded); } }); to run this example you'll also have to have an icon file named "icon-16.png" saved in your add-ons "data" directory. you could download this icon: . now "index.js" imports the base64 module and calls its two exported functions. if we run the add-on and click the button, we should see the following logging output: info: agvsbg8= info: hello testing the base64 module navigate to the add-on's test directory and delete the test-index.js file. in its place create a file called test-base64.js with the following contents: var base64 = require("../base64")...
...l atob() and btoa() and use assert.ok() to check that the output is as expected. the second function tests the module's error-handling code by passing an empty string into atob() and using assert.throws() to check that the expected exception is raised. at this point your add-on ought to look like this: /base64 /data icon-16.png package.json readme.md index.js base64.js /test test-base64.js now execute jpm --verbose test from the add-on's root directory. you should see something like this: console.info: jpm-utest: executing './test/test-base64.test atob' console.info: jpm-utest: pass: atob works console.info: jpm-utest: executing './test/test-base64.test btoa' console.info: jpm-utest: pass: btoa works console.info: jpm-utest...
Tree - Archive of obsolete content
(var i = 0; i < treeview.rowcount; i++) { if (treeview.iscontainer(i) && treeview.iscontaineropen(i)) treeview.toggleopenstate(i); } getting the text from the selected row assuming the given <tree>: <tree id="my-tree" seltype="single" onselect="ontreeselected()"> use the following javascript: function ontreeselected(){ var tree = document.getelementbyid("my-tree"); var cellindex = 0; var celltext = tree.view.getcelltext(tree.currentindex, tree.columns.getcolumnat(cellindex)); alert(celltext); } getting the tree item from the focused row assuming <tree id="my-tree">, you can use the following to get the tree item: var view = document.getelementbyid("my-tree").view; var sel = view.selection.currentindex; //returns -1 if the tree is not focused var treeitem = vie...
... getting the cell from a mouse click your first choice is likely to try <treecell onclick="yourfunc();"/> or something similar. but this will not work. you can't add event handlers to <treecell>. instead, you can add the event handler to the <tree> element. ...
... getting the cell from a mouse click your first choice is likely to try <treecell onclick="yourfunc();"/> or something similar. but this will not work. you can't add event handlers to <treecell>. instead, you can add the event handler to the <tree> element. you can then use the event and some utility methods to find the <treecell>. ...
xml:base support in old browsers - Archive of obsolete content
; } else if (xmlbase.match(/\/$/) && xlink.match(/\/$/)) { xmlbase = xmlbase.substring(0, xmlbase.length-2); // strip off last slash to join with xlink path with slash } // alert(xmlbase + '::' + xlink); } var link = xmlbase + xlink; if (!link.match(scheme)) { // if there is no domain, we'll need to use the current domain var loc = window.location; if (link.indexof('/') === 0 ) { // if link is an absolute url, it should be from the host only link = loc.protocol + '//' + loc.host + link; } else { // if link is relative, it should be from full path, minus the file var dirpath = loc.pathname.substring(0, loc.pathname.lastindexof('/')-1); if (link.lastindexof('/') !== link.length-1) { link += '/'; } link = loc.protocol + '//' + loc.host...
... !thisitem.nodename) { return xmlbase; } // check present element and higher up for xml:base // now check for the next matching local 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 skipfile = (att.indexof('///') === protocolpos) ? 3 : 2; // if the file protocol has an extra slashe, prepare to also skip it in the separator search var att2 = att.indexof('/', protocolpos+skipfile); // find first path separator ('/') after protocol if (att2 !
...null : xmlbase; return xmlbase...
CSS3 - Archive of obsolete content
k: due to insufficient browser support, standardization of the padding-box value may be postponed to the next iteration of this module. allow the styling of forms according their content using the css :indeterminate, :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only, and :read-write pseudo-classes and the ::value, ::choices, ::repeat-item, and ::repeat-index pseudo-elements. at risk: due to insufficient browser support, standardization of the pseudo-elements ::value, ::choices, ::repeat-item, and ::repeat-index may be postponed to the next iteration of this module . support for icons, defined by the css icon property simultaneously with the new icon value of the css content property. at risk: due to insufficient browser support, sta...
...the next iteration of this module. the ability to define the hotspot of a cursor as well as the new none, context-menu, cell, vertical-text, alias, copy, no-drop, not-allowed, nesw-resize, nwse-resize, col-resize, row-resize, all-scroll, zoom-in, zoom-out, extending the cursor property. the ability to specify the sequential navigation order (that is the tabbing order ) using the css nav-index, nav-up, nav-right, nav-left, nav-down properties. at risk: due to insufficient browser support, standardization of the navigation properties may be postponed to the next iteration of this module. the ability to control the usage of an ime editor, using the css ime-mode property. at risk: due to insufficient browser support, standardization of the ime-mode property may be postpon...
...m to define exclusion regions in any positioning scheme. adds the notion of shapes, in which content must flows. filter effects module level 1 working draft css generated content for paged media module working draft adds the ability to tailor printed version of a document by allowing to control header, footer but also references tables like indexes or tables of content. css page floats working draft css grid layout unknown css line grid module level 1 working draft css positioned layout module level 3 working draft css regions module level 1 working draft defines a new mechanism allowing content t...
Running Tamarin performance tests - Archive of obsolete content
ersion of avm2 --vmargs2 args to pass to avm2, if not specified --vmargs will be used --nooptimize do not optimize files when compiling --perfm parse the perfm results from avm --csv= also output to csv file, filename required --csvappend append to csv file instead of overwriting --score compute and print geometric mean of scores --index= index file to use (must end with .py) --saveindex= save results to given index file name option details indexing: there are two command line flags that control indexing: --index and —saveindex both require an index filename to be specified after the flag. "--index index.py" will load index.py and run all of the tests in that index and report results normalized to the index val...
...d with .py) --saveindex= save results to given index file name option details indexing: there are two command line flags that control indexing: --index and —saveindex both require an index filename to be specified after the flag. "--index index.py" will load index.py and run all of the tests in that index and report results normalized to the index values. a subset of the tests in the index can be run by passing what tests you want to run after specifying the index file. "--saveindex indexname.py" will run the specified tests and save the values to the give index file. specifying both --index and --saveindex will merge the values specified in --index to the new saved indexfile. cumulative score: new option of --score will display a cumulative score for every metric. really mos...
...ssing what tests you want to run after specifying the index file. "--saveindex indexname.py" will run the specified tests and save the values to the give index file. specifying both --index and --saveindex will merge the values specified in --index to the new saved indexfile. cumulative score: new option of --score will display a cumulative score for every metric. really most useful with an index file (or v8 tests), since running with raw time values will skew the results towards longer running tests csv output: "--csv filename" will save run results to a csv file that can be analyzed using excel pivottables. use --csvappend if you want to append the results to the csv file support files testconfig.txt this file contains instructions for how the harness should handle performance test...
enumValueNames - Archive of obsolete content
returns the value of the key as a string if it succeeded; null if the referenced subkey does not exist. description enumvaluenames can be used to iterate through the values for a given key. ...
... returns the value of the key as a string if it succeeded; null if the referenced subkey does not exist. description enumvaluenames can be used to iterate through the values for a given key. ...
... returns the value of the key as a string if it succeeded; null if the referenced subkey does not exist. description enumvaluenames can be used to iterate through the values for a given key. ...
Attribute (XUL) - Archive of obsolete content
naccesskeyextra2 buttonaccesskeyhelp buttonalign buttondir 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 contenttooltip context contextmenu control crop curpos current currentset customindex customizable cycler datasources decimalplaces default defaultbutton defaultset description dir disableautocomplete disableautoselect disableclose disabled disablehistory disablekeynavigation disablesecurity dlgtype dragging editable editort...
...pr firstdayofweek firstpage first-tab fixed flags flex focused forcecomplete grippyhidden grippytooltiptext group handlectrltab height helpuri hidden hidechrome hidecolumnpicker hideheader hideseconds hidespinbuttons highlightnonmatches homepage href icon id ignoreblurwhilesearching ignorecase ignoreincolumnpicker ignorekeys image inactivetitlebarcolor increment index inputtooltiptext insertafter insertbefore instantapply inverted iscontainer isempty key keycode keytext label lastpage lastselected last-tab left linkedpanel max maxheight maxlength maxpos maxrows maxwidth member menu menuactive min minheight minresultsforpopup minwidth mode modifiers mousethrough movetoclick multiline multiple name negate newlines next noa...
...dnext open ordinal orient pack pageid pageincrement pagestep parent parsetype persist persistence phase pickertooltiptext placeholder popup position predicate preference preference-editable primary priority properties querytype readonly ref rel removeelement resizeafter resizebefore rows screenx screeny searchbutton searchsessions searchlabel selected selectedindex seltype setfocus showcaret showcommentcolumn showpopup size sizemode sizetopopup smoothscroll sort sortactive sortdirection sortresource sortresource2 spellcheck src state statedatasource statusbar statustext style subject substate suppressonselect tabindex tabscrolling targets template timeout title toolbarname tooltip tooltiptext tooltiptextnew top type uri ...
Introduction to XUL - Archive of obsolete content
taining main toolbar (and its contents) application-specific content area below toolbar area structure of a xul file our language of choice is xml, flavoured with css stylistic information. having said that, the details of a particular application of xml; say, the syntax for specifying a toolbar, are left to separate documents describing those particular applications. check the xptoolkit index for the most recent list. since xul is a language for describing window layout, there is some overlap in the topics covered by this document and a separate document describing xul windows. the task of writing a xul window description is basically the same as the task of writing an html content description, with these exceptions: the syntax is xml (not that different from html 4), and there are s...
... element in the html namespace. <html:script type="application/javascript"> // dialog initialization code function initwindow() { var checkbox = document.getelementbyid("remember"); if (checkbox) checkbox.checked = true; } </html:script> javascript can be referenced as in html documents: as onclick handlers and the like. see individual widget documentation referenced at the index for a list of attributes accepting javascript values. javascript is most safely kept in a separate file and included in the xul file <html:script language="javascript" src="our.js"/> or relegated to the contents of a cdata section, to prevent the xml parser from choking on javascript which may look like xml content (a < character, for instance.) <html:script type="application/javascript"> ...
...es, tree controls and the like. a window can just as easily contain html form elements (using the html namespace) like any html content (though there is no need to put them within a form element). in fact, xul largely uses extant widgets from html, with a few extensions and additions. each widget will define a unique xml syntax for describing itself; see the widget documentation referenced at the index for details. other infrastructure widgets may have javascript event handlers just as in html, and are tied together using javascript and broadcaster nodes. broadcaster nodes are declared as <broadcaster> elements in the xul description, and are involved with the communication of changes of state between widgets. a widget or several widgets can arrange to have the value of one of their attribute...
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. ...
... return type: element removes the child item in the element at the specified index. the method returns the removed item. ...
Methods - Archive of obsolete content
ane addprogresslistener addsession addtab addtabsprogresslistener advance advanceselectedtab appendcustomtoolbar appendgroup appenditem appendnotification blur cancel canceldialog centerwindowonscreen checkadjacentelement clearresults clearselection click close collapsetoolbar contains decrease decreasepage docommand ensureelementisvisible ensureindexisvisible ensureselectedelementisvisible expandtoolbar extra1 extra2 focus getbrowseratindex getbrowserfordocument getbrowserfortab getbrowserindexfordocument getbutton getdefaultsession geteditor getelementsbyattribute getelementsbyattributens getformattedstring gethtmleditor getindexoffirstvisiblerow getindexofitem getitematindex getnextitem getnotificat...
...tnextitem getnotificationbox getnotificationwithvalue getnumberofvisiblerows getpagebyid getpreviousitem getresultat getresultcount getresultvalueat getrowcount getsearchat getselecteditem getsession getsessionbyname getsessionresultat getsessionstatusat getsessionvalueat getstring goback gobackgroup godown goforward goforwardgroup gohome goto gotoindex goup hidepopup increase increasepage insertitem insertitemat invertselection loadgroup loadonetab loadtabs loaduri loaduriwithflags makeeditable movebyoffset moveto movetoalertposition onsearchcomplete ontextentered ontextreverted openpopup openpopupatscreen opensubdialog openwindow preferenceforelement reload reloadalltabs reloadtab reloadw...
...referenceforelement reload reloadalltabs reloadtab reloadwithflags removeallitems removeallnotifications removealltabsbut removecurrentnotification removecurrenttab removeitemat removeitemfromselection removenotification removeprogresslistener removesession removetab removetabsprogresslistener removetransientnotifications replacegroup reset rewind scrollbyindex scrollbypixels scrolltoindex select selectall selectitem selectitemrange selecttabatindex setselectionrange showpane showpopup sizeto startediting stop stopediting swapdocshells syncsessions timedselect toggleitemselection related dom element methods dom:element.addeventlistener dom:element.appendchild dom:element.comparedocumentposition dom:element.d...
Property - Archive of obsolete content
tifications allowevents alwaysopenpopup amindicator 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 contentprincipal contenttitle contentview contentvieweredit contentviewerfile contentwindow contextmenu control controller controllers crop current currentindex currentitem currentnotification currentpage currentpane currentset currenturi customtoolbarcount database datasources date dateleadingzero datevalue decimal...
... locked markupdocumentviewer max maxheight maxlength maxrows maxwidth menu menuboxobject menupopup min minheight minresultsforpopup minwidth minute minuteleadingzero mode month monthleadingzero name next nomatch notificationshidden object observes onfirstpage onlastpage open ordinal orient pack pagecount pageid pageincrement pageindex pagestep parentcontainer palette persist persistence placeholder pmindicator popup popupboxobject popupopen position predicate preferenceelements preferencepanes preferences priority radiogroup readonly readonly ref resource resultspopup scrollboxobject scrollincrement scrollheight scrollwidth searchbutton searchcount searchlabel sear...
...pupopen position predicate preferenceelements preferencepanes preferences priority radiogroup readonly readonly ref resource resultspopup scrollboxobject scrollincrement scrollheight scrollwidth searchbutton searchcount searchlabel searchparam searchsessions second secondleadingzero securityui selected selectedbrowser selectedcount selectedindex selecteditem selecteditems selectedpanel selectedtab selectionend selectionstart selstyle seltype sessioncount sessionhistory showcommentcolumn showpopup size smoothscroll spinbuttons src state statusbar statustext stringbundle strings style subject suppressonselect tabcontainer tabindex tabs tabscrolling tabpanels tag textlength tex...
button - Archive of obsolete content
used to trap mouse, keyboard and other events. it is typically rendered as a grey outset rectangle. you can specify the label of the button using the label attribute or by placing content inside the button. more information is available in the xul tutorial. attributes accesskey, autocheck, checkstate, checked, command, crop, dir, disabled, dlgtype, group, icon, image, label, open, orient, tabindex, type properties accesskey, accessibletype, autocheck, checkstate, checked, command, crop, dir, disabled, dlgtype, group, image, label, open, orient, tabindex, type examples <button label="press me" oncommand="alert('you pressed me!');"/> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the ...
...ntally or vertically. the default value depends on the element. you can also use the -moz-box-orient style property. horizontal child elements of the element are placed next to each other in a row in the order that they appear in the xul source. vertical child elements of the element are placed under each other in a column in the order that they appear in the xul source. 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. type type: one of the values below the type of button. if this attribute is not present, a normal button is created. leave the attribute out for a normal button. checkbox this type ...
...group attribute. image type: image url gets and sets the value of the image attribute. label type: string gets and sets the value of the label attribute. open type: boolean gets and sets the value of the open attribute. orient type: string gets and sets the value of the orient attribute. tabindex type: integer gets and sets the value of the tabindex attribute. type type: string gets and sets the value of the type attribute. methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), ...
caption - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a header for a groupbox. it may contain either a text label, using the label attribute, or child elements for a more complex caption. more information is available in the xul tutorial. attributes accesskey, crop, image, label, tabindex properties accesskey, crop, image, label, tabindex examples <groupbox> <caption label="my groupbox"/> </groupbox> <groupbox flex="1"> <caption> <checkbox label="a checked groupbox"/> </caption> </groupbox> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. ...
...ent. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. properties accesskey type: character gets and sets the value of the accesskey attribute. crop type: string gets and sets the value of the crop attri...
...roperties accesskey type: character gets and sets the value of the accesskey attribute. crop type: string gets and sets the value of the crop attribute. image type: image url gets and sets the value of the image attribute. label type: string gets and sets the value of the label attribute. tabindex type: integer gets and sets the value of the tabindex attribute. methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens,...
checkbox - Archive of obsolete content
ost commonly rendered as a box when the element is off and a box with a check when the element is on. the user can switch the state of the check box by selecting it with the mouse. a label, specified with the label attribute, may be added beside the check box. more information is available in the xul tutorial. attributes accesskey, checked, command, crop, disabled, src, label, preference, tabindex properties accesskey, accessibletype, checked, command, crop, disabled, src, label, tabindex examples <checkbox label="enable javascript" checked="true"/> <checkbox label="enable java" checked="false"/> attributes accesskey type: character this should be set to a character that is used as a shortcut key. this should be one of the characters that appears in the label attrib...
...f 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. preference type: id connects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. properties accesskey type: character gets and sets the value of the accesskey attribute. accessibletype type: integer a value indicating the type...
...ets the value of the command attribute. crop type: string gets and sets the value of the crop attribute. disabled type: boolean gets and sets the value of the disabled attribute. src type: url gets and sets the value of the src attribute. label type: string gets and sets the value of the label attribute. tabindex type: integer gets and sets the value of the tabindex attribute. methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributen...
datepicker - Archive of obsolete content
the mouse. to avoid this, you can use the workaround described here, i.e., use window.settimeout(actual-event-handler-function, 0); to queue up your event handler to run after the rest of the picker's change event handlers. a monthchange event is fired for the grid and popup datepickers whenever a new month is navigated to or displayed. attributes disabled, firstdayofweek, readonly, type, tabindex, value properties date, dateleadingzero, datevalue, disabled, month, monthleadingzero, open, readonly, tabindex, value, year, yearleadingzero examples <datepicker type="grid" value="2007-03-26"/> attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed...
... which day of the week to display as the first day in the grid. the values range from 0 to 6, where 0 is sunday and 6 is saturday. the default value is determined by the locale, so only use this attribute if you want to override it. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. 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. type type: one of the values below you can set the type attribute to one of the values below to specify the type of datepicker to use normal ...
...ld be displayed before the month when it is less than 10. open type: boolean for popup type datepickers, specifies whether the popup is open. set this property to open or close the popup. for non-popup datepickers, this property is always false. readonly type: boolean if set to true, then the user cannot modify the value of the element. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string the currently selected date in the form yyyy-mm-dd. unlike the month property, months in this value range from 01 to 12. set this property to change the selected date. year type: integer the currently selected year from 1 to 9999. set this property to c...
deck - Archive of obsolete content
Archive › Mozilla › XUL › deck
« xul reference home [ examples | attributes | properties | methods | related ] an element that displays only one of its children at a time. the selectedindex attribute determines which child is displayed. more information is available in the xul tutorial. attributes selectedindex properties selectedindex, selectedpanel examples <deck selectedindex="2"> <description value="this is the first page"/> <button label="this is the second page"/> <box> <description value="this is the third page"/> <button label="this is also the third page"/> </box> </deck> attributes selectedindex type: integer gets and sets the index of the currently selected panel. the first item is at index 0. inherited from xul element align, allowevents, allownega...
...by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected do not hide panels; the deck element only understands visible panels. selectedpanel type: element holds a reference to the current...
..., insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected do not hide panels; the deck element only understands visible panels. selectedpanel type: element holds a reference to the currently selected panel within a deck element. assig...
description - Archive of obsolete content
set either with the value attribute or by placing text inside the open and close description tags. the value attribute is used to set text that appears in a single line. if text appears as a child of the description, it will wrap to multiple lines. it may contain arbitrary markup, which can be styled as needed. more information is available in the xul tutorial. attributes crop, disabled, tabindex value properties accessibletype, crop, disabled, tabindex, value style classes header, indent, monospace, plain, small-margin examples this is a long section of text that will word wrap when displayed <description> this is a long section of text that will word wrap when displayed. </description> this is a long section of text that will not word wrap <description value="this is a l...
...llowed only for form controls. using it with an anchor tag (an <a> link) will have no effect. the element will, however, still respond to mouse events. to enable the element, leave this attribute out entirely. visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. 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 script for your own use. ...
...not access or affect the contents displayed to the user. properties accessibletype type: integer a value indicating the type of accessibility object for the element. crop type: string gets and sets the value of the crop attribute. disabled type: boolean gets and sets the value of the disabled attribute. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. methods inherited methods addeventlistener(), appendchild(), blur, click, ...
param - Archive of obsolete content
Archive › Mozilla › XUL › param
name type: string the name of a parameter within the sql statement. ...
... name type: string the name of a parameter within the sql statement. ...
... name type: string the name of a parameter within the sql statement. ...
preference - Archive of obsolete content
ences element. each preference element corresponds to a preference which is stored in the user's preferences file. you can connect a user interface element such as a checkbox to a preference element using the user interface element's preference attribute. more information is available in the preferences system article. attributes disabled, instantapply, inverted, name, onchange, readonly, tabindex, type properties defaultvalue, disabled, hasuservalue, inverted, locked, name, preferences, readonly, tabindex, type, value, valuefrompreferences methods reset examples <preferences> <preference id="pref_id" name="preference.name" type="int"/> </preferences> see preferences system for a complete example. attributes disabled type: boolean indicates whether the element is disab...
...ype="text/javascript"> function myfunction(e){ /* do something cool here or just say the below */ alert(e.target.nodename); } </script> <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 script. 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. type type: one of the values below the preference type which should be one of the following values. bool a boolean set to either true or false. usually a checkbox would be connected...
...ead-only. 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. preferences type: element reference to the containing preferences element. readonly type: boolean if set to true, then the user cannot modify the value of the element. tabindex type: integer gets and sets the value of the tabindex attribute. type type: string gets and sets the value of the type attribute. value gets and sets the value of the user preference specified in name. in pref dialogs with instantapply == true (default on mac os x) this value is kept in sync with the actual value stored in the preferences (see valuefrom...
scale - Archive of obsolete content
Archive › Mozilla › XUL › scale
the value by one unit, or the page up and page down keys to increment and decrement the value by one page, as specified by the pageincrement attribute. the home and end keys set the scale's value to the minimum and maximum values, respectively. a scale will fire a change event whenever the scale's value is modified. attributes dir, disabled, increment, max, min, movetoclick, pageincrement, tabindex, value properties disabled, max, min, increment, pageincrement, tabindex, value, methods decrease, decreasepage, increase, increasepage, examples horizontal scale: <scale min="1" max="10"/> vertical scale: <scale min="1" max="10" orient="vertical"/> attributes dir type: one of the values below the direction in which the child elements of the element are placed. n...
...only one increment in that direction. if not specified, the default value is used, which varies for each platform. pageincrement type: integer the amount by which the value of the curpos or value attribute changes when the tray of the scroll bar (the area in which the scroll bar thumb moves) is clicked, or when the page up or page down keys are pressed. the default value is 10. 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 script for your own use. ...
.... increment type: integer gets and sets the value of the increment attribute. min type: integer gets and sets the value of the min attribute. max type: integer gets and sets the value of the max attribute. pageincrement type: integer gets and sets the value of the pageincrement attribute. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. methods inherited methods addeventlistener(), appendchild(), blur, click, ...
tabbox - Archive of obsolete content
ed to switch between each page. the tabbox should contain two children, the first a tabs element which contains the tabs and the second a tabpanels element which contains the contents of the pages. more information is available in the xul tutorial. ...
...nt which contains the tabs and the second a tabpanels element which contains the contents of the pages. more information is available in the xul tutorial. ...
...ode type: eventtarget indicates the node where keyboard navigation events listener is set up. the initial value for this property is determined by the value of the eventnode attribute. handlectrlpageupdown type: boolean gets and sets the value of the handlectrlpageupdown attribute. handlectrltab type: boolean gets and sets the value of the handlectrltab attibute. selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected selectedpanel type: element holds a reference to the currently selected panel within a <tabbox> element. assigning a value to this property will modif...
timepicker - Archive of obsolete content
9, a change event handler may encounter erratic behavior when the time is changed using the keyboard instead of the mouse. to avoid this, you can use the workaround described here, i.e., use window.settimeout(actual-event-handler-function, 0); to queue up your event handler to run after the rest of the picker's change event handlers. attributes disabled, hideseconds, increment, readonly, tabindex, value properties amindicator, datevalue, disabled, hideseconds, hour, hourleadingzero, increment, is24hourclock, ispm, minute, minuteleadingzero, pmindicator, readonly, second, secondleadingzero, tabindex, value examples <timepicker value="12:05"/> attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the elem...
...cates whether to show the seconds field. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. increment type: integer indicates the number of minutes to skip each time the arrows are pressed. this should be used in combination with setting hideseconds to true. tabindex type: integer the tab order of the element. the tab order is the order in which the focus is moved when the user presses the "tab" key. elements with a higher tabindex are later in the tab sequence. value type: string the initial value of the timepicker in either the form hh:mm:ss or hh:mm. properties amindicator type: string the string valu...
... if set to true, then the user cannot modify the value of the element. second type: integer the currently selected second from 0 to 59. set this property to change the selected second. secondleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the second when it is less than 10. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string the currently entered time of the form hh:mm:ss. set this property to change the time. methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), ...
Browser Detection and Cross Browser Support - Archive of obsolete content
o which was built on november 8, 2000. if you must detect gecko using the user agent string, gecko/ccyymmdd is the most appropriate string to search for. the third vendor/version (netscape6/6.0) identifies this particular instance of a gecko browser as netscape 6.0. many sites keyed off of the existence of the string netscape6 in the user agent and used tests similar to: if (navigator.useragent.indexof('netscape6') != -1) { // netscape 6 code } note how this type of detection misses any other gecko based browser. unfortunately, the netscape 6 user agent string was not sufficiently generalizable due to it's use of the string netscape6 as a description of the vendor. netscape 7 corrects this error and introduces another chance for user agent string based detection to fail. mozilla/5.0 (...
...ach portion of // the rv value delimited by . // will be treated as value out of 100. // e.g. ...
...alue delimited by . // will be treated as value out of 100. // e.g. ...
Array.observe() - Archive of obsolete content
s an array of objects each representing a change. the properties of these change objects are: name: the name of the property which was changed. object: the changed array after the change was made. type: a string indicating the type of change taking place. one of "add", "update", "delete", or "splice". oldvalue: only for "update" and "delete" types. the value before the change. index: only for the "splice" type. the index at which the change occurred. removed: only for the "splice" type. an array of the removed elements. addedcount: only for the "splice" type. the number of elements added. description the callback function is called each time a change is made to arr, with an array of all changes in the order in which they occurred. changes done via array ...
...ved: only for the "splice" type. an array of the removed elements. addedcount: only for the "splice" type. the number of elements added. description the callback function is called each time a change is made to arr, with an array of all changes in the order in which they occurred. changes done via array methods, such as array.prototype.pop() will be reported as "splice" changes. ...
...rted as "splice" changes. index assignment changes which do not change the length of the array may be reported as "update" changes. examples logging different change types var arr = ['a', 'b', 'c']; array.observe(arr, function(changes) { console.log(changes); }); arr[1] = 'b'; // [{type: 'update', object: <arr>, name: '1', oldvalue: 'b'}] arr[3] = 'd'; // [{type: 'splice', object: <arr>, index: 3, removed: [], addedcount: 1}] arr.splice(1, 2, 'beta', 'gamma', 'delta'); // [{type: 'splice', object: <arr>, index: 1, removed: ['b', 'c'], addedcount: 3}] specifications strawman proposal specification. ...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
completely covered up by the image. the text of the h3 was basically touching the right side of the floated image... ...or it would have been, except in some browsers the heading was drawn over the floated image, in contradiction to the css specification. ...
... heading turned out to be a matter of relatively positioning the floated image, and then giving it a z-index value. in order to create visual appeal, i decided to offset the top let corners of the fish image and fish name. with just a few simple margin and padding changes, this was possible. div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} div.card img {float: left; position: relative; z-index: 10; margin: 4px 0 0 0; border: 1px solid #339;} div.card h3 {margin: 0 0 0 4px; padding: 0.2em 0 1px 150px; border: 1px solid #339; border-left: 5px double #339; background: #eec url(body-bg-tan.jpg) bottom left no-repeat fixed; color: #339;} note how the image is pushed downward four pixels, while the h3 is pushed rightward four pixels. at the same time, the heading's padding was set t...
...ns on card paragraphs, and then changed the left margin to be 160px, which makes sure the text in the paragraphs won't wrap under the floated images. this is desirable for the cases where only one word would wrap under an image. it's better to keep the text as if it's in a column of its own. div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} div.card img {float: left; position: relative; z-index: 10; margin: 4px 0 0 0; border: 1px solid #339;} div.card h3 {margin: 0 0 0 4px; padding: 0.2em 0 1px 150px; border: 1px solid #339; border-left: 5px double #339; background: #eec url(body-bg-tan.jpg) bottom left no-repeat fixed; color: #339;} div.card p {margin: 0.5em 0.5em 0.5em 160px;} and voila! the cards are done. conclusion redesigning a classic is something like being asked to r...
The Business Benefits of Web Standards - Archive of obsolete content
d. the payload might be slightly higher for the first page. but for accessing multiple 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 additional effort, time or thought. all their documents are properly marked up at the outset. the number of sites which do not include proper titles and descriptions in the meta is surprising. a lot of other sites would greatly increase their seo by simply using proper tags for the content. adding h1, h2, and h3, tags and so ...
...t, time or thought. all their documents are properly marked up at the outset. the number of sites which do not include proper titles and descriptions in the meta is surprising. a lot of other sites would greatly increase their seo by simply using proper tags for the content. adding h1, h2, and h3, tags and so on gives proper structure to hypertext documents. search engine agents crawl the web to index it, but for ranking and indexing purposes they can only process text. dynamic effects such as those created by javascript are not taken into account, and text rendered with graphics cannot be read and parsed either. 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...
...tion/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. there are very significant differences in how search engines operate. instead of worrying about each engine and attempting to artificially manipulate the results, web standards pages index and rank properly (where they deserve to) across all search engines. in the same way that standards hugely reduce the concern we need to have for browser differences, they also reduce the differences between the way search engines rank pages. there should be little need to plunge into the increasing costs and uncertain quality and integrity of proprietary pay per click campaigns. increase websi...
Using the Right Markup to Invoke Plugins - Archive of obsolete content
/> <param name="backgroundcolor" value="0xc0c0c0" /> <param name="endimage" value="10" /> <param name="soundsource" value="audio"> <param name="soundtrack" value="spacemusic.au" /> <param name="sounds" value="1.au|2.au|3.au|4.au|5.au|6.au|7.au|8.au|9.au|0.au" /> <param name="pause" value="200" /> <p>you need the java plugin. get it from <a href="http://java.sun.com/products/plugin/index.html">here.</a></p> </object> the above code mentions a version specific mime type, and if the mozilla-based browser such as netscape 7 doesn't have jre 1.4.1_01 installed, the alternate text is displayed. it isn't always necessary to give such a version specific mime type. if you aren't taking advantage of any version specific features, a more generic mime type such as application/x-java-vm wi...
...s such as netscape 7 also allow for a special classid attribute that can also be used. this is the special "java:" classid. here is an example using this invocation method: <object classid="java:nervoustext.class" width="534" height="50"> <param name="text" value="java 2 sdk, standard edition v1.4" /> <p>you need the java plugin. get it from <a href="http://java.sun.com/products/plugin/index.html">here. </a> </p> </object> the "java:" classid allows you to reference the class that provides the primary entry point. the rest of the configuration parameters work via the param elements. applet -- the popular choice the applet element is still very much supported, and is the most popular way currently to invoke java applets. in netscape 7 and compuserve 7, the applet element dire...
...pe. if the preference is unchecked, the plugin finder service will be consulted only if the web page authordoes not specify either of these attributes. original document information author(s): arun k. ranganathan, netscape communications last updated date: 14. nov 2002 copyright information: copyright © 2001-2003 netscape. all rights reserved. ...
Implementing controls using the Gamepad API - Game development
te gamepadapi.controller; console.log('gamepad disconnected.'); }, the disconnect function sets the gamepad.turbo property to false and removes the variable containing the gamepad object. gamepad object there's lots of useful information contained in the gamepad object, with the states of buttons and axes being the most important: id: a string containing information about the controller. index: a unique indentifier for the connected device. connected: a boolean variable, true if the device is connected. mapping: the layout type of the buttons; standard is the only available option for now. axes: the state of each axis, represented by an array of floating-point values. buttons : the state of each button, represented by an array of gamepadbutton objects containing pressed and value p...
...ifier for the connected device. connected: a boolean variable, true if the device is connected. mapping: the layout type of the buttons; standard is the only available option for now. axes: the state of each axis, represented by an array of floating-point values. buttons : the state of each button, represented by an array of gamepadbutton objects containing pressed and value properties. the index variable is useful if we're connecting more than one controller and want to identify them to act accordingly — for example when we have a two-player game requiring two devices to be connected. querying the gamepad object beside connect() and disconnect(), there are two more methods in the gamepadapi object: update() and buttonpressed(). update() is executed on every frame inside the game loop...
...updated (see the latest.) it hasn't changed much, but it's good to know whats going on — the updates are as follows. getting the gamepads the navigator.getgamepads() method has been updated with a longer explanation and an example piece of code. now the length of the array of gamepads has to be n+1 where n is the number of connected devices — when there's one device connected and it has the index of 1, the array's length is 2 and it will look like this: [null, [object gamepad]]. if the device is disconnected or unavailable, the value for it is set to null. mapping standard the mapping type is now an enumerable object instead of a string: enum gamepadmappingtype { "", "standard" }; this enum defines the set of known mappings for a gamepad. for now, there's only the standard lay...
Square tilemaps implementation: Static maps - Game development
re that map data, we can use a plain object or a custom class. for the sake of simplicity, in the example code a plain object has been used. it contains the basic map properties: cols: the width of the map, in columns. rows: the height of the map, in rows. tsize: the tile size, in pixels. tiles: a 1-dimensional array containing the visual grid. gettile(): a helper method that gets the tile index in a certain position. tiles contains the actual visual map data. we are representing the tiles with indices, assigned to the tiles dependant on their position in the atlas (e.g. 0 for the left-most tile.) however, we must account for empty tiles, since they are crucial for implementing layers — empty tiles are usually assigned a negative index value, 0, or a null value. in these examples, em...
...ontains the actual visual map data. we are representing the tiles with indices, assigned to the tiles dependant on their position in the atlas (e.g. 0 for the left-most tile.) however, we must account for empty tiles, since they are crucial for implementing layers — empty tiles are usually assigned a negative index value, 0, or a null value. in these examples, empty tiles will be represented by index 0, so we will shift the indices of the atlases by one (and thus the first tile of the atlas will be assigned index 1, the second index 2, etc.) the gettile() helper method returns the tile contained at the specified column and row. if tiles were a 2d matrix, then the returned value would just be tiles[column][row]. however, it's usually more common to represent the grid with a 1-dimensional arra...
...s the first tile of the atlas will be assigned index 1, the second index 2, etc.) the gettile() helper method returns the tile contained at the specified column and row. if tiles were a 2d matrix, then the returned value would just be tiles[column][row]. however, it's usually more common to represent the grid with a 1-dimensional array. in this case, we need to map the column and row to an array index: var index = row * map.cols + column; wrapping up, an example of a tilemap object could look like the following. this features an 8 x 8 map with tiles 64 x 64 pixels in size: var map = { cols: 8, rows: 8, tsize: 64, tiles: [ 1, 3, 3, 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1...
SEO - MDN Web Docs Glossary: Definitions of Web-related terms
crawlers follow rules. if you follow those rules closely when doing seo for a website, you give the site the best chances of showing up among the first results, increasing traffic and possibly revenue (for ecommerce and ads). ...
...crawlers follow rules. if you follow those rules closely when doing seo for a website, you give the site the best chances of showing up among the first results, increasing traffic and possibly revenue (for ecommerce and ads). ...
...ch engines give some guidelines for seo, but big search engines keep result ranking as a trade secret. seo combines official search engine guidelines, empirical knowledge, and theoretical knowledge from science papers or patents. seo methods fall into three broad classes: technical tag the content using semantic html. when exploring the website, crawlers should only find the content you want indexed. copywriting write content using your visitors' vocabulary. use text as well as images so that crawlers can understand the subject. popularity you get most traffic when other established sites link to your site. learn more general knowledge seo on wikipedia learn seo google webmasters learning resources ...
Example 1 - Learn web development
em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "â–¼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background:...
...em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "â–¼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background:...
... /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0, 0, 0, .45); /* 0 1px 2px */ background : #f0f0f0; background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "â–¼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; 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; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #...
Example 3 - Learn web development
this is the third example that explain how to build custom form widgets. ...
... this is the third example that explain how to build custom form widgets. ...
... background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "â–¼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background:...
Using data attributes - Learn web development
andard attributes, extra properties on dom, or node.setuserdata(). 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> javascript access reading the values of these attributes out in javascript is also very simple. you could use getattribute() with their full html name to read them, but the standard defines a simpler way: a domstringmap you can read out via a dataset property. to get a data attribute through the dataset object, get the property by the part of...
...heir full html name to read them, but the standard defines a simpler way: a domstringmap you can read out via a dataset property. to get a data attribute through the dataset object, get the property by the part of the attribute name after data- (note that dashes are converted to camelcase). const article = document.queryselector('#electric-cars'); article.dataset.columns // "3" article.dataset.indexnumber // "12314" article.dataset.parent // "cars" each property is a string and can be read and written. in the above case setting article.dataset.columns = 5 would change that attribute to "5". css access note that, as data attributes are plain html attributes, you can even access them from css. for example to show the parent data on the article you can use generated content in css with the a...
...our own display routines. see this screencast for an example using generated content and css transitions (jsbin example). data values are strings. number values must be quoted in the selector for the styling to take effect. issues do not store content that should be visible and accessible in data attributes, because assistive technology may not access them. in addition, search crawlers may not index data attributes' values. the main issues to consider are internet explorer support and performance. internet explorer 11+ provides support for the standard, but all earlier versions do not support dataset. to support ie 10 and under you need to access data attributes with getattribute() instead. also, the performance of reading data-attributes compared to storing this data in a regular js object...
Client-Server Overview - Learn web development
rate. it also has benefits in terms of maintenance, because you can change the url used to deliver a particular feature in one place, without having to change the handler function. for example, consider the following django (python) code that maps two url patterns to two view functions. ...
...r'^junior/$') because they use a pattern matching technique called "regular expressions" (regex, or re). ...
...ch to use (in this case exact). there are many other types of matches and we can daisy chain them. we can also control the order and the number of results returned. #best/views.py from django.shortcuts import render from .models import team def junior(request): list_teams = team.objects.filter(team_type__exact="junior") context = {'list': list_teams} return render(request, 'best/index.html', context) after the junior() function gets the list of junior teams, it calls the render() function, passing the original httprequest, an html template, and a "context" object defining the information to be included in the template. the render() function is a convenience function that generates html using a context and an html template, and returns it in an httpresponse object. obviousl...
Beginning our React todo list - Learn web development
this way, it will match the <h1> at the top of our app. <title>todomatic</title> when your browser refreshes, you should see something like this: it's ugly, and doesn’t function yet, but that's okay — we'll style it in a moment. first, consider the jsx we have, and how it corresponds to our user stories: we have a <form> eleme...
...se them in curly braces. if you write defaultchecked="true", the value of defaultchecked will be "true" — a string literal. remember — this is actually javascript, not html! the aria-pressed attribute used in our earlier code snippet has a value of true because aria-pressed is not a true boolean attribute in the way checked is. ...
... font-size: 1.6rem; line-height: 1.25; display: block; position: relative; min-height: 44px; padding-left: 40px; clear: left; } .c-cb > label::before, .c-cb > input[type="checkbox"] { box-sizing: border-box; top: -2px; left: -2px; width: 44px; height: 44px; } .c-cb > input[type="checkbox"] { -webkit-font-smoothing: antialiased; cursor: pointer; position: absolute; z-index: 1; margin: 0; opacity: 0; } .c-cb > label { font-size: inherit; font-family: inherit; line-height: inherit; display: inline-block; margin-bottom: 0; padding: 8px 15px 5px; cursor: pointer; touch-action: manipulation; } .c-cb > label::before { content: ""; position: absolute; border: 2px solid currentcolor; background: transparent; } .c-cb > input[type="checkbox"]:focu...
TypeScript support in Svelte - Learn web development
'completed' : 'active'}` todos[i] = { ...todos[i], ...todo } } let filter: filter = filter.all const filtertodos = (filter: filter, todo...
...f the <script> section with the following: import type { todotype } from '../types/todo.type' export let todos: todotype[] we will also specify the headingel, which we used to bind to the heading tag, as an htmlelement. update the let headingel line with the following: let headingel: htmlelement finally, you'll notice the following error reported, related to where we set the tabindex attribute. that's because typescript is type-checking the <h2> element and expects tabindex to be of type number. to fix it, replace tabindex="-1" with tabindex={-1}, like this: <h2 id="list-heading" bind:this={headingel} tabindex={-1}>{completedtodos} out of {totaltodos} items completed</h2> this way typescript can prevent us from incorrectly assigning it to a string variable. n...
...iagnostics... ==================================== ./svelte-todo-typescript/src/app.svelte:8:12 error: argument of type '{ handler: () => void; }' is not assignable to parameter of type 'jsonvalue'. types of property 'handler' are incompatible. type '() => void' is not assignable to type 'jsonvalue'. type '() => void' is not assignable to type '{ [key: string]: jsonvalue; }'. index signature is missing in type '() => void'. (ts) $todos = { handler: () => {} } this is another example of how specifying types can make our code more robust, and help us catch more bugs before they get into production. and that's it. we've converted our whole application to use typescript. bulletproofing our stores with generics our stores have already been ported to typescript but we can do...
Focus management with Vue refs - Learn web development
ed a way to provide assistive technology users with information that confirms that an element was deleted. 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 javascript), 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 tab...
...="-1" to it — this makes the element programmatically focusable (i.e. it can be focused via javascript), 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 should also almost never use tabindex > = 0, as it can cause problems for users since it can make the dom flow and the tab-order mismatch, and/or add non-interactive elements to the tab order. this can be confusing to users, especially those using screen readers and other assistive technology. now that...
...r assistive technology. now that we have a ref and have let browsers know that we can programmatically focus the <h2>, we need to set focus on it. at the end of deletetodo(), use the listsummary ref to set focus on the <h2>. since the <h2> is always rendered in the app, you do not need to worry about using $nexttick of lifecycle methods to handle focusing it. deletetodo(todoid) { const itemindex = this.todoitems.findindex(item => item.id === todoid); this.todoitems.splice(itemindex, 1); this.$refs.listsummary.focus(); } now, when you delete an item from your list, focus should be moved up to the list heading. this should provide a reasonable focus experience for all of our users. summary so that's it for focus management, and for our app! congratulations for working your way ...
Handling common JavaScript problems - Learn web development
browsers (see strict mode in browsers). typed arrays allow javascript code to access and manipulate raw binary data, which is necessary as browser apis for example start to manipulate streams of raw video and audio data. these are available in ie10 and above, and all modern browsers. there are also many new apis appearing in recent browsers, which don't work in older browsers, for example: indexeddb api, web storage api, and others for storing website data on the client-side. web workers api for running javascript in a separate thread, helping to improve performance. webgl api for real 3d graphics. web audio api for advanced audio manipulation. webrtc api for multi-person, real-time video/audio connectivity (e.g. video conferencing). there are a few strategies for handling incompat...
...ry about cross browser differences. the library will manipulate appropriate apis in the background so the functionality will work whatever the browser (in theory). for example, localforage is a library for client-side data storage, which provides a simple syntax for storing and retrieving data. in the background, it uses the best api the browser has available for storing the data, whether that is indexeddb, web storage, or even websql (which is now deprecated, but is still supported in some older versions of safari/ie). as another example, jquery when choosing a library to use, make sure that it works across the set of browsers you want to support, and test your implementation thoroughly. also make sure that the library is popular and well-supported, and isn't likely to just become obsolete n...
...he browser is (version, name, os, etc.) in the bad only days when pretty much everyone used netscape or internet explorer, developers used to use so-called browser sniffing code to detect which browser the user was using, and give them appropriate code to work on that browser. the code used to look something like this (although this is a simplified example): let ua = navigator.useragent; if(ua.indexof('firefox') !== -1) { // run firefox-specific code } else if(ua.indexof('chrome') !== -1) { // run chrome-specific code } the idea was fairly good — detect what browser is viewing the site, and run code as appropriate to make sure the browser will be able to use your site ok. note: try opening up your javascript console now and running navigator.useragent, to see what you get returned. ...
Command line crash course - Learn web development
age information, even if it is long. it'll help you to understand better how the tool is intended to be used. playing with prettier let’s have a quick play with prettier, so you can see how it works. first of all, create a new directory somewhere on your file system that is easy to find. maybe a directory called prettier-test on your desktop. ...
...forgot to run prettier? so there's some code styles that can be fixed. no problem. ...
...the following code in a new file called index.js, inside your test directory: const myobj = { a:1,b:{c:2}} function printme(obj){console.log(obj.b.c)} printme(myobj) we can run prettier against a codebase to just check if our code wants adjusting. cd into your directory, and try running this command: prettier --check index.js you should get on output along the lines of checking formatting... index.js code style issues found in the above file(s). forgot to run prettier? so there's some code styles that can be fixed. no problem. adding the --write option to the prettier command will fix those up, leaving us to focus on actually writing useful code. now try running this version of the command: prettier --write index.js you’ll get an output like this checking formatting... index.js code...
Introducing a complete toolchain - Learn web development
, you'll get a version number returned like 2.0.2; if not, it'll return something along the lines of "command not found". if this is the case, install it using the following command: npm install prettier -g now that prettier is installed, running and tidying your code can be done on the command line on an individual file basis from anywhere on your computer, for example: prettier --write ./src/index.html note: in the command above, i use prettier with the --write flag. prettier understands this to mean "if there's problems in my code format, go ahead and fix them, then save my file". this is fine for our development process, but we can also use prettier without the flag and it will only check the file. checking the file (and not saving it) is useful for purposes like checks that run before...
...wever, bear in mind that if you want to refine and enforce a rule about how your code looks (or validates), it's very likely that it can be done with the right eslint configuration. a little later in this chapter, we'll provide the eslint config. once a working configuration is in place, running the command can generate some useful information. here is an example eslint output: ./my-project/src/index.js 2:8 error 'react' is defined but never used no-unused-vars 22:20 error 'body' is defined but never used no-unused-vars 96:19 error 'b' is defined but never used no-unused-vars ✖ 3 problems (3 errors, 0 warnings) note: we'll install eslint in the next section; don't worry about this for now. as with other tools, code editor integration support is typically good for eslint, a...
...o start working with our project, we’ll run the parcel server on the command line. in its default mode it will watch for changes in your code and automatically install your dependencies. this is nice because we don't have to flit back and forth between the code and the command line. to start parcel off in the background, go to your terminal and run the following command: npx parcel src/index.html you should see an output like this (once the dependencies have been installed): server running at http://localhost:1234 ✨ built in 129ms. parcel also installs the dependencies that we will use in our code, including react, react-dom, react-async-hook, date-fns, and format-number. this first run will therefore be longer than a typical run of parcel. note: if you run parcel o...
Debugging on Mac OS X
e # attach to an already running app). the breakpoint runs some commands to # figure out the object directory path from the attached target and then # sources the .lldbinit from there. # # note: this scripts actions take a few seconds to complete, so the custom # formatters, commands etc. that are added may not be immediately available. # breakpoint set --name nsthread::processnextevent --thread-index 1 --auto-continue true --one-shot true breakpoint command add -s python # this script that we run does not work if we try to use the global 'lldb' # object, since it is out of date at the time that the script runs (for # example, `lldb.target.executable.fullpath` is empty). therefore we must # get the following objects from the 'frame' object. target = frame.getthread().getpr...
...lete our breakpoint (not actually necessary with `--one-shot true`): target.breakpointdelete(bp_loc.getbreakpoint().getid()) # for completeness, find and delete the dummy breakpoint (the breakpoint # lldb creates when it can't initially find the method to set the # breakpoint on): # bug workaround! ...
... set the # breakpoint on): # bug workaround! getid() on the *dummy* breakpoint appears to be returning # the breakpoint index instead of its id. we have to add 1 to correct for # that! :-( dummy_bp_list = lldb.sbbreakpointlist(target) debugger.getdummytarget().findbreakpointsbyname("nsthread::processnextevent", dummy_bp_list) dummy_bp_id = dummy_bp_list.getbreakpointatindex(0).getid() + 1 debugger.getdummytarget().breakpointdelete(dummy_bp_id) # "source" the mozilla project .lldbinit: os.chdir(target.executable.fullpath.split("/dist/")[0]) debugger.handlecommand("command source -s true " + os.path.join(os.getcwd(), ".lldbinit")) done see debugging mozilla with lldb for more information. having a profile for debugging purposes it is recommended...
Message manager overview
n tab: three times, in the diagram above. similarly, if you send a message using the global frame message manager, it's received by all content tabs, and is then delivered to any frame scripts that are listening for it. ...
...frame script using the window message manager it gets loaded separately into each tab open in that particular window. if you send a message using the window message manager, it gets sent to all content tabs in that window. ...
...is global to the parent process. messages sent using the gppmm get sent to all cpmms in all child processes. process scripts loaded using the gppmm get loaded in all child processes. ...
PR_GetThreadPrivate
returns null if the data has not been set. description pr_getthreadprivate may be called at any time during a thread's execution. ...
... returns null if the data has not been set. description pr_getthreadprivate may be called at any time during a thread's execution. ...
... returns null if the data has not been set. description pr_getthreadprivate may be called at any time during a thread's execution. ...
PR_SetThreadPrivate
sets per-thread private data. syntax #include <prthread.h> prstatus pr_setthreadprivate(pruintn index, void *priv); parameters pr_setthreadprivate has the following parameters: index an index into the per-thread private data table. priv the per-thread private data, or more likely, a pointer to the data. returns the function returns one of the following values: if successful, pr_success. if the index is invalid, pr_failure. description if the thread already has non-null private data associated with it, and if the destructor function for the index is known (not null), nspr calls the destructor function associated with the index before setting the new data value. the pointer at the index is swapped with null. if the swapped out value is not null, the destructor function is c...
... if the thread already has non-null private data associated with it, and if the destructor function for the index is known (not null), nspr calls the destructor function associated with the index before setting the new data value. the pointer at the index is swapped with null. if the swapped out value is not null, the destructor function is called. on return, the private data associated with the index is reassigned the new private data's value, even if it is null. the runtime provides no protection for the private data. the destructor is called with the runtime holding no locks. synchronization is the client's responsibility. ...
...apped out value is not null, the destructor function is called. on return, the private data associated with the index is reassigned the new private data's value, even if it is null. the runtime provides no protection for the private data. the destructor is called with the runtime holding no locks. synchronization is the client's responsibility. the only way to eliminate thread private data at an index prior to the thread's termination is to call pr_setthreadprivate with a null argument. this causes the index's destructor function to be called, and afterwards assigns a null in the table. a client must not delete the referant object of a non-null private data without first eliminating it from the table. ...
64-bit Compatibility
nctions in lirwriter: ins_i2p() - on 32-bit platforms, does nothing. on 64-bit platforms, performs a lir_i2q. ins_u2p() - on 32-bit platforms, does nothing. on 64-bit platforms, performs a lir_u2q. ins_p2i() - on 32-bit platforms, does nothing. on 64-bit platforms, performs a lir_qlo. a common use for extending values is to perform advanced addressing. for example, this code tries to load an index from an integer array, but it is not portable: lir->insload(lir_ldp, lir->ins2(lir_piadd, arrayins, lir->ins2i(lir_mul, indexins, sizeof(int)) ), 0); the sanityfilter will assert on a 64-bit platform because lir_piadd (which will be lir_qiadd) needs both operands to be 64-bit. the correct code is, assu...
...integer array, but it is not portable: lir->insload(lir_ldp, lir->ins2(lir_piadd, arrayins, lir->ins2i(lir_mul, indexins, sizeof(int)) ), 0); the sanityfilter will assert on a 64-bit platform because lir_piadd (which will be lir_qiadd) needs both operands to be 64-bit. ...
...r_mul, indexins, sizeof(int)) ), 0); the sanityfilter will assert on a 64-bit platform because lir_piadd (which will be lir_qiadd) needs both operands to be 64-bit. ...
JS_AliasElement
syntax jsbool js_aliaselement(jscontext *cx, jsobject *obj, const char *name, jsint alias); name type description cx jscontext * the context in which to create the alias. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ...
...ion cx jscontext * the context in which to create the alias. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object for which to create the alias. name const char * name of the element for which to create an alias. this name corresponds to a string representation of the element's current index number. alias jsint alias number to assign to the element. description js_aliaselement assigns an alternate index number for an element or numeric property associated with a native object. obj is the object to which the element belongs. name is the element's current index in the object, and alias is the alternate index to assign to the element. this feature is deprecated, mea...
...if the alias is successfully created and associated with the property, js_aliaselement returns js_true. adding an alias element does not change the element array length. ...
JS_LookupElement
obsolete since jsapi 37this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. determine if a specified numeric property exists. syntax bool js_lookupelement(jscontext *cx, js::handleobject obj, uint32_t index, js::mutablehandlevalue vp); name type description cx jscontext * the context in which to look up the property. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search. index uint32_t the numeric id of the property to look up. vp js::mutablehandlevalue out parameter. on success, *vp receives the stored value of...
... cx jscontext * the context in which to look up the property. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search. index uint32_t the numeric id of the property to look up. vp js::mutablehandlevalue out parameter. on success, *vp receives the stored value of obj[index], or undefined if the element does not exist. description js_lookupelement examines a specified javascript object, obj, for a numeric property numbered index. note: in the javascript language, numeric properties (also called "elements") are just ordinary properties whose names are numeric strings. for example, obj[6] is always exactly the same as obj["6"]. the ecmascript standard also sp...
...language, numeric properties (also called "elements") are just ordinary properties whose names are numeric strings. for example, obj[6] is always exactly the same as obj["6"]. the ecmascript standard also specifies this behavior: see ecma 262-3 §11.2.1, step 6. so any call to js_lookupelement is equivalent to a call to js_lookupproperty passing a numeric string for the name. if the property obj[index] exists, js_lookupelement sets *vp to the property's stored value and returns true. if no such property exists, js_lookupelement sets *vp to undefined and returns true (to indicate that no error occurred). on error or exception, js_lookupelement returns false, and the value left in *vp is undefined. js_lookupelement does not distinguish between a property with a value of undefined and a property...
JS_SET_TRACING_DETAILS
callback syntax typedef void (*jstracenameprinter)(jstracer *trc, char *buf, size_t bufsize); name type description trc jstracer * the tracer. ...
... callback syntax typedef void (*jstracenameprinter)(jstracer *trc, char *buf, size_t bufsize); name type description trc jstracer * the tracer. buf char * out parameter. ...
...iption trc jstracer * the tracer. buf char * out parameter. the callback stores a string describing the reference traced in buf. bufsize size_t the size of buf, in chars. description set debugging information about a reference to a traceable thing to prepare for the following call to js_calltracer. when printer is null, arg must be const char * or char * c string naming the reference and index must be either (size_t)-1 indicating that the name alone describes the reference or it must be an index into some array vector that stores the reference. when printer is not null, the arg and index arguments are available to the callback as the debugprinterarg and debugprintindex fields of trc. the storage for name or callback's arguments needs to live only until the following call to js_calltrac...
Property attributes
otype, creates a new own data property on obj; the prototype's .x is not shared with its children. if the inherited property is shared, the setter is called instead. if the property is also jsprop_permanent, then certain aspects of inheriting the property via the prototype chain are affected. do not depend on this. see bug 575997. ...
...some objects like function/object have self-hosted functions that can only be defined after the initialization is already finished. ...
...prop_ignore_value see also bug 575997 - for jsprop_shared bug 1088002 - added jsprop_propop_accessors bug 825199 - added jsprop_define_late bug 365851 - added jsfun_stub_gsops bug 581263 - added jsfun_constructor bug 1101123 - added jsprop_redefine_nonconfigurable bug 1037770 - added jsop_ignore_* bug 1105518 - for jsprop_redefine_nonconfigurable bug 1138489 - removed jsprop_index bug 1140482 - added jsprop_resolving ...
JSAPI reference
ed in spidermonkey 1.8 obsolete since jsapi 31 jsval_trace_kind added in spidermonkey 1.8 obsolete since jsapi 31 js_tracer_init added in spidermonkey 1.8 obsolete since jsapi 12 js_tracerinit added in spidermonkey 12 obsolete since jsapi 31 js_calltracer added in spidermonkey 1.8 obsolete since jsapi 22 js_set_tracing_details added in spidermonkey 1.8 obsolete since jsapi 26 js_set_tracing_index added in spidermonkey 1.8 obsolete since jsapi 26 js_set_tracing_name added in spidermonkey 1.8 obsolete since jsapi 26 js_call_tracer added in spidermonkey 1.8 obsolete since jsapi 23 js_call_value_tracer added in spidermonkey 1.8 obsolete since jsapi 23 js_call_object_tracer added in spidermonkey 1.8 obsolete since jsapi 23 js_call_string_tracer added in spidermonkey 1.8 obsolete since jsa...
...tra settings and does not call setters. similarly, "lookup" is a lower-level version of "get" that offers extra options and does not call getters. ...
...olete since jsapi 23 a spidermonkey extension allows a native function to return an lvalue—that is, a reference to a property of an object: js_setcallreturnvalue2 obsolete since javascript 1.8.5 id a jsid is an identifier for a property or method of an object. ...
History Service Design
the old long searches through tree views. this is possible through a relevance algorithm that assigns a param called frecency to every page in history, see the places frecency algorithm for major informations. history service provides the basics to create such adaptive search paths, allowing for a better browsing experience through a common interface. long term objectives include the ability to index more informations from the visited pages, through fulltext indexes, and the possibility to generalize the frecency algorithm to allow for its use in user's queries. might be also nice to provide a hook for third-party products so they can provide text searching capabilities to the places system. places core history service (nsinavhistoryservice.idl) is the core of places, every other places ser...
...rdingly (maybe restoring a backup). once the database connection has been set-up the schema version of the database is checked. schema version is upgraded every time a change is made to the database schema, history service will eventually upgrade the database, moving and fixing its datas accordingly. in case the database has been created for the first time history service will create all tables, indexes and triggers, calling related inittables static methods of other dependant services. finally temporary tables, indexes and triggers are created, this happens at every run since those entities are removed when closing the connection. temporary storage is used to avoid too frequent writes to the disk, since those are most likely to cause fsyncs (to ensure data integrity) on the target filesystem...
... up locking the ui till the database i/o to save data is complete. for this reason visits and favicons are added lazily on a timer. in future this will probably change in favour of storage asynchronous statements, so that the inserts will be queued-up by mozstorage itself in a separate thread. sql queries are built with performance in mind, and constantly tested against large databases. database indexes are quite important, and a good query can make the difference between minutes or seconds. many queries are especially optimized, for example limited history queries, often used to build menus, allowing for good performances even in presence of a really large history. storing pages and visits pages (intended as uris) are stored into a table shared by both history and bookmarks, every url is un...
Places utilities for JavaScript
nodeiscontainer(nsinavhistoryresultnode anode); boolean nodeisdynamiccontainer(nsinavhistoryresultnode anode); boolean nodeislivemarkcontainer(nsinavhistoryresultnode anode); obsolete since gecko 21 boolean nodeislivemarkitem(nsinavhistoryresultnode anode); obsolete since gecko 21 boolean isreadonlyfolder(nsinavhistoryresultnode anode); int getindexofnode(nsinavhistoryresultnode anode); string wrapnode(nsinavhistoryresultnode anode, string 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, bo...
...vice. boolean nodeislivemarkitem(anode) determines whether a result node is a live-bookmark item parameters anode the node to check. return type returns a boolean. isreadonlyfolder() determines whether or not a node is a readonly folder. boolean isreadonlyfolder(anode) parameters anode the node to check. return type return true if the node is a folder, false otherwise. getindexofnode() gets the index of a node within its parent container int getindexofnode(anode) parameters anode the node to look up return type returns the index of the node within its parent container, or -1 if the node was not found or the node specified has no parent. wrapnode() string-wraps a result node according to the rules of the specified content type. string wrapnode(anode, ...
...b a blob (string) of data, in some format we potentially know how to parse. type the content type of the blob. return type returns an array of objects representing each item contained by the source. maketransaction() constructs a transaction for the drop or paste of a blob of data into a container. maketransaction(data, type, container, index, copy) parameters data the unwrapped data blob of dropped or pasted data. type the content type of the data container the container the data was dropped or pasted into index the index within the container the item was dropped or pasted at copy the drag action was copy, so don't move folders or links. return type returns an object implementing nsitransaction that ...
NS_ConvertASCIItoUTF16
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...ruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(prunichar, prunichar) - so...
NS_ConvertUTF16toUTF8
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...int32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(char, char) - source swa...
NS_ConvertUTF8toUTF16
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...ruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(prunichar, prunichar) - so...
NS_LossyConvertUTF16toASCII
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...int32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(char, char) - source swa...
nsAdoptingCString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...int32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(char, char) - source swa...
nsAdoptingString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...ruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(prunichar, prunichar) - so...
nsAutoString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...ruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(prunichar, prunichar) - so...
nsCAutoString
@param aset -- characters to b...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void...
...g&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(char, c...
nsCString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...int32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(char, char) - source swa...
nsDependentCString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...int32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(char, char) - source swa...
nsDependentString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...ruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(prunichar, prunichar) - so...
nsFixedCString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...int32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(char, char) - source swa...
nsFixedString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...ruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(prunichar, prunichar) - so...
nsPromiseFlatCString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...int32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(char, char) - source swa...
nsPromiseFlatString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...ruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(prunichar, prunichar) - so...
nsString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...ruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(prunichar, prunichar) - so...
nsXPIDLCString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...int32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(char, char) - source swa...
nsXPIDLString
@param aset -- characters to be cut from th...
... @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - so...
...ruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char inside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string. @param aset -- characters to be cut from this parameters char* aset stripwhitespace void stripwhitespace() - source this method strips whitespace throughout the string. replacechar void replacechar(prunichar, prunichar) - so...
inIDOMUtils
ing apseudo); nsidomnode getparentfornode(in nsidomnode anode, in boolean ashowinganonymouscontent); unsigned long getruleline(in nsidomcssstylerule arule); unsigned long getrulecolumn(in nsidomcssstylerule arule); unsigned long getselectorcount(in nsidomcssstylerule arule); astring getselectortext(in nsidomcssstylerule arule, in unsigned long aselectorindex); unsigned long long getspecificity(in nsidomcssstylerule arule, in unsigned long aselectorindex); nsidomfontfacelist getusedfontfaces(in nsidomrange arange); bool haspseudoclasslock(in nsidomelement aelement, in domstring apseudoclass); boolean isignorablewhitespace(in nsidomcharacterdata adatanode); bool isinheritedproperty(in astring apropertyname)...
... value state 1 :active 2 ...
...state ); parameters aelement the element to set the content state of. astate the content state to set. this must be one (and only one) of the values listed in content state flags. selectormatcheselement() checks if a given selector from a style rule matches an element. bool selectormatcheselement ( in nsidomelement aelement, in nsidomcssstylerule arule, in unsigned long aselectorindex, in domstring apseudo optional ) parameters aelement the element to check the selector against. arule the style rule containing the selector. aselectorindex the index of the selector. apseudo optional a string specifying the pseudo-element to match. may be omitted when checking the regular elements. addpseudoclasslock() makes the element take on style properties that would apply...
nsIAccessibleEvent
event_hyperlink_number_of_anchors_changed 0x0052 0x004e the number of anchors associated with this hyperlink object has changed. event_hyperlink_selected_link_changed 0x0053 0x004f the hyperlink selected state changed from selected to unselected or from unselected to selected. event_hypertext...
... event_hyperlink_number_of_anchors_changed 0x0052 0x004e the number of anchors associated with this hyperlink object has changed. event_hyperlink_selected_link_changed 0x0053 0x004f the hyperlink selected state changed from selected to unselected or from unselected to selected. event_hypertext_link_activated 0x0054 0x0050 one of th...
...ected_link_changed 0x0053 0x004f the hyperlink selected state changed from selected to unselected or from unselected to selected. event_hypertext_link_activated 0x0054 0x0050 one of the links associated with the hypertext object has been activated. event_hypertext_link_selected 0x0055 0x0051 one of the links associated with the hypertext object has been selected. event_hyperlink_start_index_changed 0x0056 0x0052 the starting index of this link within the containing string has changed. event_hypertext_changed 0x0057 0x0053 focus has changed from one hypertext object to another, or focus moved from a non-hypertext object to a hypertext object, or focus moved from a hypertext object to a non-hypertext object. event_hypertext_nlinks_changed 0x0058 0x0054 the number of hyperlin...
nsIHttpServer
unction callback optional callback */ listen: function(port, opt, callback) { if (arguments.length == 2 && "function" == typeof opt) { callback = opt; } if (callback) { this.registerprefixhandler("/", callback); } let host = "localhost"; if (typeof port === "string" && port.indexof(':') != -1){ [host, port] = port.split(':'); port = parseint(port); server.identity.add('http', host, port); } server.wrappedjsobject._start(port, host); return true; }, registerfile: function(path, filepath) { var file = components.classes['@mozilla.org/file/local;1'] ...
...t match the production, such as for cgi functionality. * @note * implementations may treat type as a trusted argument; users who fail to * generate this string from trusted data risk security vulnerabilities. */ void registercontenttype(in string extension, in string type); /** * sets the handler used to display the contents of a directory if * the directory contains no index page. * * @param handler * an object which will handle any requests for directories which * do not contain index pages, or null to reset to the default * index handler; if while the server is running the handler * throws an exception while responding to a request, an http 500 * response will be returned. an nsifile corresponding to the * directory is available...
...*/ readonly attribute nsihttpserveridentity identity; /** * retrieves the string associated with the given key in this, for the given * path's saved state. all keys are initially associated with the empty * string. ...
nsITreeContentView
the nsitreecontentview interface is implemented by tree views that are backed by dom content. it is typically reached by calling queryinterface on a nsitreeview. layout/xul/base/src/tree/public/nsitreecontentview.idlscriptable please add a summary to this article. ...
...iew interface is implemented by tree views that are backed by dom content. it is typically reached by calling queryinterface on a nsitreeview. layout/xul/base/src/tree/public/nsitreecontentview.idlscriptable please add a summary to this article. last changed in gecko 1.8.0 inherits from: nsisupports method overview long getindexofitem(in nsidomelement item); nsidomelement getitematindex(in long index); attributes attribute type description root nsidomelement the element in the dom which this view uses as root content. read only. obsolete since gecko 1.8 methods getindexofitem() retrieve the index associated with the specified content item. long getindexofitem( in nsidomelement item ); parameters item a tree row for which to find the row index. return value a non-...
...ttributes attribute type description root nsidomelement the element in the dom which this view uses as root content. read only. obsolete since gecko 1.8 methods getindexofitem() retrieve the index associated with the specified content item. long getindexofitem( in nsidomelement item ); parameters item a tree row for which to find the row index. return value a non-negative integer row index if the row was found within the tree. returns -1 if the item was not found. getitematindex() retrieve the content item associated with the specified index. nsidomelement getitematindex( in long index ); parameters index the row index for which to get the item return value the nsidomelement item. remarks the nsitreecontentview interface only applies to trees with dom element children, and doe...
nsIUpdateManager
t/mozapps/update/nsiupdateservice.idlscriptable this interface describes a global application service that maintains a list of previously installed updates, as well as the currently in use update. ...
...saveupdates() saves all updates to disk. void saveupdates(); parameters none. ...
...pe description activeupdate nsiupdate an nsiupdate object describing the currently in use update. this update is not in the history list. read only. updatecount long the number of updates in the history list; the updates can be fetched by calling getupdateat(). read only. methods getupdateat() returns the update at the specified index into the history list. nsiupdate getupdateat( in long index ); parameters index an index into the history list for the nsiupdate to retrieve. return value the nsiupdate at the specified index into the history list. saveupdates() saves all updates to disk. void saveupdates(); parameters none. see also nsiupdate nsiupdatechecklistener nsiupdatechecker nsiupdatepatch nsiapplicationupdateservice nsiupdateprompt nsiupdatetimermanager ...
nsIWebNavigation
s: * @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. ...
....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. ...
...nt is loaded from the cache (if available) and page state (such as form values and scroll position) is restored. void goback( ); goforward() tells the object to navigate to the next session history item. when a page is loaded from session history, all content is loaded from the cache (if available) and page state (such as form values and scroll position) is restored. void goforward( ); gotoindex() tells the object to navigate to the session history item at a given index. void gotoindex( in long index ); parameters index the index of the session history item to go to. loaduri() loads a given uri. this will give priority to loading the requested uri in the object implementing this interface. if it can't be loaded here however, the uri dispatcher will go through its normal proc...
nsIWindowsRegKey
efox 1.5 / thunderbird 1.5 / seamonkey 1.0) the interface represents a single key in the registry. this interface is highly win32 specific. ...
...ace represents a single key in the registry. this interface is highly win32 specific. ...
...alues defined above. createchild() this method opens or creates a subkey relative to this key. nsiwindowsregkey createchild( in astring relpath, in unsigned long mode ); parameters relpath mode return value nsiwindowsregkey for the newly opened or created subkey. getchildname() this method returns the name of the n'th child key. astring getchildname( in unsigned long index ); parameters index the index of the requested child key. return value the name of the n'th child key. getvaluename() this method returns the name of the n'th value under this key. astring getvaluename( in unsigned long index ); parameters index the index of the requested value. return value the name of the n'th value under this key. getvaluetype() this method returns the ...
Performance
, explain select * from moz_history; the results are hard to understand, but you should be able to see whether it is using indices. a command that will give you a higher level overview is "explain query plan". for example sqlite> explain query plan select * from moz_historyvisit v join moz_history h on v.page_id = h.id where v.visit_date > 1000000000; 0|0|table moz_historyvisit as v with index moz_historyvisit_dateindex 1|1|table moz_history as h using primary key this tells us that it will first look up in moz_historyvisit using an index, and will then look up in moz_history using the primary key. both of these are "good" because they use indices and primary keys, which are fast. sqlite> explain query plan select * from moz_historyvisit where session = 12; 0|0|table moz_historyvisit ...
...you can download the command line tool from the sqlite download page. be sure you have a version of the command line tool that is at least as recent as what mozilla uses. ...
... a percentage of memory in nsnavhistory::initdb in toolkit/components/places/src/nsnavhistory.cpp. sharding the cache between connections by default, storage enables the sqlite shared-cache mode which makes multiple connections to the same database share the same cache. the cache is threadsafe. all you need to do is use services.storage.opendatabase(file). some features (virtual tables, full text indexes) are not compatible with shared cache - then you need to use services.storage.openunshareddatabase(file), which doesn't share the cache. see mozistorageservice.opendatabase(). disk writes sqlite provides the basic acid rules of database theory: atomicity: each transaction is atomic and cannot be "partially" committed. consistency: the database won't get corrupted. isolation: multiple tra...
Warnings
storage sometimes warns about things to stderr. this page is designed to help explain the cause and possible solutions for these warnings. sort operations this warning message will say something about the number of sort operations that have occurred for a sql statement. this happens when you have an order by clause that does not use an index. ...
... storage sometimes warns about things to stderr. this page is designed to help explain the cause and possible solutions for these warnings. sort operations this warning message will say something about the number of sort operations that have occurred for a sql statement. this happens when you have an order by clause that does not use an index. ...
...e cause and possible solutions for these warnings. sort operations this warning message will say something about the number of sort operations that have occurred for a sql statement. this happens when you have an order by clause that does not use an index. when you do not use an index, all the results from the query have to first be fetched, and then those results are sorted. however, when the index is used, the data can be obtained row by row from the database, which will be much faster. if, for some reason you cannot use an index in your order by clause, you can suppress this warning by including a sql comment in your query that contains this text: /* do not warn (bug [everything in these brackets does not matter] */ the bug mentioned should explain why the query cannot use an index. ...
Creating a gloda message query
ns/demo_addon, demo3, it seems that the attributename given in these files is the constraintname to be used (e.g. query.subjectmatches(searchstring) for message subject (compare fundattr.js line 145 ). create a collection from the query your listener is notified as messages are added to the collection as the database query completes. ...
...atches(searchstring) for message subject (compare fundattr.js line 145 ). create a collection from the query your listener is notified as messages are added to the collection as the database query completes. you may also see new messages show up if new messages are indexed that meet the constraints. ...
...are added to the collection as the database query completes. you may also see new messages show up if new messages are indexed that meet the constraints. ...
Using js-ctypes
it os x carbon is not available in 64bit versions of os x, therefore core foundation must be used. the below will do the same as standardalert from above, it will use the core foundation function of cfusernotificationdisplaynotice. ...
...tor.ptr; var unichar = ctypes.jschar; // uint16 with automatic conversion // define constants var kcfusernotificationstopalertlevel = 0; var kcfusernotificationnotealertlevel = 1; var kcfusernotificationcautionalertlevel = 2; var kcfusernotificationplainalertlevel = 3; // declare functions /* https://developer.apple.com/library/mac/documentation/corefoundation/reference/cfusernotificationref/index.html#//apple_ref/c/func/cfusernotificationdisplaynotice * sint32 cfusernotificationdisplaynotice ( * cftimeinterval timeout, * cfoptionflags flags, * cfurlref iconurl, * cfurlref soundurl, * cfurlref localizationurl, * cfstringref alertheader, * cfstringref alertmessage, * cfstringref defaultbuttontitle * ); */ var cfusernotificationdisplaynotice = libcf.declare("cfuser...
... * void cfrelease ( * cftyperef cf * ); */ var cfrelease = libcf.declare('cfrelease', ctypes.default_abi, void, // return cftyperef // cf ); /* https://developer.apple.com/library/mac/documentation/corefoundation/reference/cfstringref/#//apple_ref/c/func/cfstringcreatewithcharacters * cfstringref cfstringcreatewithcharacters ( * cfallocatorref alloc, * const unichar *chars, * cfindex numchars * ); */ var cfstringcreatewithcharacters = libcf.declare('cfstringcreatewithcharacters', ctypes.default_abi, cfstringref, // return cfallocatorref, // alloc unichar.ptr, // *chars cfindex // numchars ); // helper functions function makecfstr(jsstr) { // js str is just a string // returns a cfstr that must be released with cfrelease when done return cfstringcreatewithchara...
Intensive JavaScript - Firefox Developer Tools
wser to run the given function in each frame, just before it performs a repaint. as long as each function is reasonably small, the browser should be able to keep inside its frame budget. ...
..., just before it performs a repaint. as long as each function is reasonably small, the browser should be able to keep inside its frame budget. ...
...split up calculateprimes(): we will just calculate primality for each number in a separate function: function dopointlesscomputationswithrequestanimationframe() { function testcandidate(index) { // finishing condition if (index == iterations) { console.log(primes); pointlesscomputationsbutton.disabled = false; return; } // test this number var candidate = index * (multiplier * math.random()); var isprime = true; for (var c = 2; c <= math.sqrt(candidate); ++c) { if (candidate % c === 0) { // not prime isprime = false; break; } } if (isprime) { primes.push(candidate); } // schedule the next var testfunction = testcandidate.bind(this, index + 1); window.requestanimationframe(t...
AudioNode.connect() - Web APIs
Web › API › AudioNode › connect
the connect() method of the audionode interface lets you connect one of the node's outputs to a target, which may be either another audionode (thereby directing the sound data to the specified node) or an audioparam, so that the node's output data is automatically used to change the value of that parameter over time. syntax var destinationnode = audionode.connect(destination, outputindex, inputindex); audionode.connect(destination, outputindex); parameters destination the audionode or audioparam to which to connect. outputindex optional an index specifying which output of the current audionode to connect to the destination. the index numbers are defined according to the number of output channels (see audio channels). while you can only connect a given output to a given input once ...
...g which output of the current audionode to connect to the destination. the index numbers are defined according to the number of output channels (see audio channels). while you can only connect a given output to a given input once (repeated attempts are ignored), you can connect an output to multiple inputs by calling connect() repeatedly. this makes fan-out possible. the default value is 0. inputindex optional an index describing which input of the destination you want to connect the current audionode to; the default is 0. the index numbers are defined according to the number of input channels (see audio channels). it is possible to connect an audionode to another audionode, which in turn connects back to the first audionode, creating a cycle. this is allowed only if there is at least one del...
...on 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 multiple 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. notsupportederror the specified connection would create a cycle (in which the audio loops back through the same nodes repeatedly) and there are no delaynodes in the cycle to prevent the r...
AudioNode.disconnect() - Web APIs
l, parameters (output and/or input) further limiting which inputs and/or outputs should be disconnected. if this value is an audioparam, then the connection to that audioparam is terminated, and the node's contributions to that computed parameter become 0 going forward once the change takes effect. if no matching connection is found, an invalidaccesserror exception is thrown. ...
...uld be disconnected. if this value is an audioparam, then the connection to that audioparam is terminated, and the node's contributions to that computed parameter become 0 going forward once the change takes effect. if no matching connection is found, an invalidaccesserror exception is thrown. output optional an index describing which output from the current audionode is to be disconnected. the index numbers are defined according to the number of output channels (see audio channels). if this parameter is out-of-bound, an indexsizeerror exception is thrown. input optional an index describing which input into the specified destination audionode is to be disconnected. the index numbers are defined according to the number of input channels (see audio channels). if this parameter is out-of-boun...
...rs are defined according to the number of output channels (see audio channels). if this parameter is out-of-bound, an indexsizeerror exception is thrown. input optional an index describing which input into the specified destination audionode is to be disconnected. the index numbers are defined according to the number of input channels (see audio channels). if this parameter is out-of-bound, an indexsizeerror exception is thrown. exceptions indexsizeerror a value specified for input or output is invalid, referring to a node which doesn't exist or outside the permitted range. invalidaccesserror the node on which disconnect() was called isn't connected to the specified destination node. example var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new a...
CSSRuleList - Web APIs
the number of rules in the list is rules.length. note that being indirect-modify (changeable but only having read-methods), rules are not added or removed from the list directly, but instead here, only via its parent stylesheet. ...
...the number of rules in the list is rules.length. note that being indirect-modify (changeable but only having read-methods), rules are not added or removed from the list directly, but instead here, only via its parent stylesheet. ...
...the number of rules in the list is rules.length. note that being indirect-modify (changeable but only having read-methods), rules are not added or removed from the list directly, but instead here, only via its parent stylesheet. ...
CSSStyleSheet.deleteRule() - Web APIs
return value undefined example this example removes the first rule from the stylesheet mystyles. ...
... return value undefined example this example removes the first rule from the stylesheet mystyles. ...
... return value undefined example this example removes the first rule from the stylesheet mystyles. ...
CSSStyleSheet.insertRule() - Web APIs
the cssstylesheet.insertrule() method inserts a new css rule into the current style sheet, with some restrictions. note: although insertrule() is exclusively a method of cssstylesheet, it actually inserts the rule into cssstylesheet.cssrules — its internal cssrulelist. syntax stylesheet.insertrule(rule [, index]) parameters rule a domstring containing the rule to be inserted. what the inserted rule must contain depends on its type: for rule-sets, both a selector and a style declaration. for at-rules, both an at-identifier and the rule content. index optional a positive integer less than or equal to stylesheet.cssrules.length, representing the newly inserted rule's position in cssstylesheet.cssrules. the default is 0. (in older implementations, this was required. see ...
...tor and a style declaration. for at-rules, both an at-identifier and the rule content. index optional a positive integer less than or equal to stylesheet.cssrules.length, representing the newly inserted rule's position in cssstylesheet.cssrules. the default is 0. (in older implementations, this was required. see browser compatibility for details.) return value the newly inserted rule's index within the stylesheet's rule-list. restrictions css has some intuitive and not-so-intuitive restrictions affecting where rules can be inserted. violating them will likely raise a domexception. if index > cssrulelist.length, the method aborts with an indexsizeerror. if rule cannot be inserted at index 0 due to some css constraint, the method aborts with a hierarchyrequesterror. if more than...
... // 92 = "\\".charcodeat(0) } if (closebracketpos === -1) break a; // no closing bracket was found! ...
CSSUnparsedValue.forEach() - Web APIs
arrayoptional the cssunparsedvalue that foreach() is being called on. ...
... arrayoptional the cssunparsedvalue that foreach() is being called on. ...
... arrayoptional the cssunparsedvalue that foreach() is being called on. thisarg optional value to use as this (i.e the reference object) when executing callback. ...
Pixel manipulation with canvas - Web APIs
in the rgba order, with integer values between 0 and 255 (included). the data property returns a uint8clampedarray which can be accessed to look at the raw pixel data; each pixel is represented by four one-byte values (red, green, blue, and alpha, in that order; that is, "rgba" format). each color component is represented by an integer between 0 and 255. each component is assigned a consecutive index within the array, with the top left pixel's red component being at index 0 within the array. pixels then proceed from left to right, then downward, throughout the array. the uint8clampedarray contains height × width × 4 bytes of data, with index values ranging from 0 to (height×width×4)-1. for example, to read the blue component's value from the pixel at column 200, row 50 in the image, you...
... (imagedata.width * 4)) + (200 * 4)) + 2]; if given a set of coordinates (x and y), you may end up doing something like this: var xcoord = 50; var ycoord = 100; var canvaswidth = 1024; function getcolorindicesforcoord(x, y, width) { var red = y * (width * 4) + x * 4; return [red, red + 1, red + 2, red + 3]; } var colorindices = getcolorindicesforcoord(xcoord, ycoord, canvaswidth); var redindex = colorindices[0]; var greenindex = colorindices[1]; var blueindex = colorindices[2]; var alphaindex = colorindices[3]; var redforcoord = imagedata.data[redindex]; var greenforcoord = imagedata.data[greenindex]; var blueforcoord = imagedata.data[blueindex]; var alphaforcoord = imagedata.data[alphaindex]; or, if es2015 is appropriate: const xcoord = 50; const ycoord = 100; const canvaswidth = ...
... = imagedata.data[blueindex]; var alphaforcoord = imagedata.data[alphaindex]; or, if es2015 is appropriate: const xcoord = 50; const ycoord = 100; const canvaswidth = 1024; const getcolorindicesforcoord = (x, y, width) => { const red = y * (width * 4) + x * 4; return [red, red + 1, red + 2, red + 3]; }; const colorindices = getcolorindicesforcoord(xcoord, ycoord, canvaswidth); const [redindex, greenindex, blueindex, alphaindex] = colorindices; you may also access the size of the pixel array in bytes by reading the uint8clampedarray.length attribute: var numbytes = imagedata.data.length; creating an imagedata object to create a new, blank imagedata object, you should use the createimagedata() method. there are two versions of the createimagedata() method: var myimagedata = ctx.c...
DataTransfer.mozClearDataAt() - Web APIs
the datatransfer.mozcleardataat() method removes the data associated with the given format for an item at the specified index. the index must be in the range from zero to the number of items minus one. if the format argument is not provided, then the data associated with all formats is removed. if the format is not found, then this method has no effect. if the last format for the item is removed, the entire item is removed, reducing mozitemcount by one. removing the last format for a particular index removes that item entirely, shifting the remaining items down and changing their indices. note: this method is gecko-specific. syntax void datatransfer.mozcleardataat([type], index); arguments type a string representing the type of the drag data to remove from the drag data object. ...
... return value void example this example shows the use of the mozcleardataat() method in a dragend event handler. ...
... return value void example this example shows the use of the mozcleardataat() method in a dragend event handler. ...
DataTransfer.mozSetDataAt() - Web APIs
data should be added in order of preference, with the most specific format added first and the least specific format added last. if data of the given format already exists, it is replaced in the same position as the old data. ...
... data should be added in order of preference, with the most specific format added first and the least specific format added last. if data of the given format already exists, it is replaced in the same position as the old data. ...
...ence, with the most specific format added first and the least specific format added last. if data of the given format already exists, it is replaced in the same position as the old data. the data should be either a string, a boolean or number type (which will be converted into a string) or an nsisupports. note: this method is gecko-specific. syntax void datatransfer.mozsetdataat([type], data, index); arguments type a string representing the type of the drag data to add to the drag data object. data a nsivariant representing the data to add to the drag data object. index a unsigned long representing the index of the data to add. return value void example this example shows the use of the mozsetdataat() method in a dragstart handler. function dragstart_handler(event) { ...
GamepadEvent - Web APIs
e to. constructor gamepadevent() returns a new gamepadevent object. properties gamepadevent.gamepad read only returns a gamepad object, providing access to the associated gamepad data for the event fired. examples the gamepad property being called on a fired window.gamepadconnected event. ...
...ew gamepadevent object. properties gamepadevent.gamepad read only returns a gamepad object, providing access to the associated gamepad data for the event fired. examples the gamepad property being called on a fired window.gamepadconnected event. window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. ...
... window.gamepadconnected event. window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.length, e.gamepad.axes.length); }); and on a window.gamepaddisconnected event. window.addeventlistener("gamepaddisconnected", function(e) { console.log("gamepad disconnected from index %d: %s", e.gamepad.index, e.gamepad.id); }); specifications specification status comment gamepadthe definition of 'gamepadevent' in that specification. working draft initial definition browser compatibility desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung in...
HTMLFormElement.elements - Web APIs
prior to html 5, the returned object was an htmlcollection, on which htmlformcontrolscollection is based. ...
...any whose type is "image" are omitted for historical reasons) <object> <output> <select> <textarea> no other elements are included in the list returned by elements, which makes it an excellent way to get at the elements most important when processing forms. ...
...en processing forms. example quick syntax example in this example, we see how to obtain the list of form controls as well as how to access its members by index and by name or id. <form id="my-form"> <input type="text" name="username"> <input type="text" name="full-name"> <input type="password" name="password"> </form> var inputs = document.getelementbyid("my-form").elements; var inputbyindex = inputs[0]; var inputbyname = inputs["username"]; accessing form controls this example gets the form's element list, then iterates over the list, looking for <input> elements of type "text" so that some form of processing can be performed on them. var inputs = document.getelementbyid("my-form").elements; // iterate over the form controls for (i = 0; i < inputs.length; i++) { if (inputs[i]...
HTMLTableElement.insertRow() - Web APIs
the htmltableelement.insertrow() method inserts a new row (<tr>) in a given <table>, and returns a reference to the new row. if a table has multiple <tbody> elements, by default, the new row is inserted into the last <tbody>. to insert the row into a specific <tbody>: let specific_tbody = document.getelementbyid(tbody_id); let row = specific_tbody.insertrow(index) note: insertrow() inserts the row directly into the table. ...
.... to insert the row into a specific <tbody>: let specific_tbody = document.getelementbyid(tbody_id); let row = specific_tbody.insertrow(index) note: insertrow() inserts the row directly into the table. the row does not need to be appended separately as would be the case if document.createelement() had been used to create the new <tr> element. syntax var newrow = htmltableelement.insertrow(index); htmltableelement is a reference to an html <table> element. parameters index optional the row index of the new row. if index is -1 or equal to the number of rows, the row is appended as the last row. if index is greater than the number of rows, an indexsizeerror exception will result. if index is omitted it defaults to -1. return value newrow is an htmltablerowelement that references t...
...t.createtextnode() and node.appendchild(). ...
HTMLTableRowElement - Web APIs
or french. this property was optional and was not very well supported. htmltablerowelement.choff is a domstring containing a integer indicating how many characters must be left at the right (for left-to-right scripts; or at the left for right-to-left scripts) of the character defined by htmltablerowelement.ch. this property was optional and was not very well supported. htmltablerowelement.rowindex read only returns a long value which gives the logical position of the row within the entire table. if the row is not part of a table, returns -1. htmltablerowelement.sectionrowindex read only returns a long value which gives the logical position of the row within the table section it belongs to. if the row is not part of a section, returns -1. htmltablerowelement.valign is a domstring r...
...n attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablerowelement.deletecell() removes the cell at the given position in the row. if the given position is greater (or equal as it starts at zero) than the amount of cells in the row, or is smaller than 0, it raises a domexception with the indexsizeerror value. htmltablerowelement.insertcell() inserts a new cell just before the given position in the row. if the given position is not given or is -1, it appends the cell to the row. if the given position is greater (or equal as it starts at zero) than the amount of cells in the row, or is smaller than -1, it raises a domexception with the indexsizeerror value. returns a reference to a htm...
... definition of 'htmltablerowelement' in that specification. living standard html5the definition of 'htmltablerowelement' in that specification. recommendation the parameter of insertcell is now optional and default to -1. document object model (dom) level 2 html specificationthe definition of 'htmltablerowelement' in that specification. obsolete the cells, rowindex, and selectionrowindex properties are now read-only. the methods insertcell and deletecell can raise exceptions. document object model (dom) level 1 specificationthe definition of 'htmltablerowelement' in that specification. obsolete initial definition. ...
IDBCursor.continuePrimaryKey() - Web APIs
rsor has been closed, without having to compare the keys one by one. calling this method more than once before new cursor data has been loaded - for example, calling continueprimarykey() twice from the same onsuccess handler - results in an invalidstateerror being thrown on the second call because the cursor’s got value flag has been unset. this method is only valid for cursors coming from an index. using it for cursors coming from an object store will throw an error. note: this feature is available in web workers. syntax cursor.continueprimarykey(key, primarykey); parameters key the key to position the cursor at. primarykey the primary key to position the cursor at. exceptions this method may raise a domexception of one of the following types: exception descriptio...
...ursor'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. ...
... recommendation ...
IDBCursorWithValue - Web APIs
the idbcursorwithvalue interface of the indexeddb api represents a cursor for traversing or iterating over multiple records in a database. it is the same as the idbcursor, except that it includes the value property. the cursor has a source that indicates which index or object store it is iterating over. it has a position within the range, and moves in a direction that is increasing or decreasing in the order of record keys. the cursor enables an application to asynchronously process all the records in the cursor's range. you can have an unlimited number of cursors at the same time. you always get the same idbcursorwithvalue object representing a given cursor. operations are performed on the underlying index or object store. note: this feature is available in web workers. <div id="inter...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.co...
...; listitem.innerhtml = cursor.value.albumtitle + ', ' + cursor.value.year; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'idbcursorwithvalue' in that specification. recommendation indexed database api draftthe definition of 'idbcursorwithvalue' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandr...
IDBDatabase.onabort - Web APIs
result; db.onerror = function() { note.innerhtml += '<li>error opening database.</li>'; }; db.onabort = function() { note.innerhtml += '<li>database opening aborted!</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "hours", { unique: false }); objectstore.createindex("minutes", "minutes", { unique: false }); objectstore.createindex("day", "day", { unique: false }); objectstore.createindex("month", "month", { unique: false }); objectstore.createindex("year", "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false }); note.innerhtml += '<li>object sto...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
IDBDatabase.onerror - Web APIs
db.onerror = function(event) { note.innerhtml += '<li>error opening database.</li>'; }; db.onabort = function(event) { note.innerhtml += '<li>database opening aborted!</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "hours", { unique: false }); objectstore.createindex("minutes", "minutes", { unique: false }); objectstore.createindex("day", "day", { unique: false }); objectstore.createindex("month", "month", { unique: false }); objectstore.createindex("year", "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false }); note.innerhtml += '<li>object sto...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
IDBDatabase.onversionchange - Web APIs
db.onerror = function(event) { note.innerhtml += '<li>error opening database.</li>'; }; db.onabort = function(event) { note.innerhtml += '<li>database opening aborted!</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); // define what data items the objectstore will contain objectstore.createindex("hours", "hours", { unique: false }); objectstore.createindex("minutes", "minutes", { unique: false }); objectstore.createindex("day", "day", { unique: false }); objectstore.createindex("month", "month", { unique: false }); objectstore.createindex("year", "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false }); note.innerhtml += '<li>object sto...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/md...
...ase change has occurred; you should refresh this browser window, or close it down and use the other open version of this application, wherever it exists.</li>'; }; }; specifications specification status comment indexed database api 2.0the definition of 'onversionchange' in that specification. recommendation indexed database api draftthe definition of 'onversionchange' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroi...
IDBDatabaseSync - 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 databasesync interface in the indexeddb api represents a synchronous connection to a database. method overview idbobjectstoresync createobjectstore (in domstring name, in domstring keypath, in optional boolean autoincrement) raises (idbdatabaseexception); idbobjectstoresync openobjectstore (in domstring name, in optional unsigned short mode) raises (idbdatabaseexception); void removeobjectstore (in domstring storename) raises (idbdatabaseexception); void setversion (in dom...
...he object store. returns idbobjectstoresync an object to access the opened object store. exceptions this method can raise an idbdatabaseexception with the following code: not_found_err if an object store with the given name (based on case-sensitive comparison) already exists in the connected database. removeobjectstore() destroys an object store with the given name, as well as all indexes that reference that object store. void removeobjectstore ( in domstring storename ) raises (idbdatabaseexception); parameters storename the name of an existing object store to remove. returns void exceptions this method can raise an idbdatabaseexception with the following code: not_found_err if the object store with the given name (based on case-sensitive comparison) does n...
... version the version to store in the database. transaction() creates and returns a transaction, acquiring locks on the given database objects, within the specified timeout duration, if possible. idbtransactionsync transaction ( in optional domstringlist storenames, in optional unsigned int timeout ) raises (idbdatabaseexception); parameters storenames the names of object stores and indexes in the scope of the new transaction. timeout the interval that this operation is allowed to take to acquire locks on all the objects stores and indexes identified in storenames. returns idbtransactionsync an object to access the newly created transaction. exceptions this method can raise an idbdatabaseexception with the following code: timeout_err if reserving all the database ob...
IDBFactorySync - Web APIs
method overview idbdatabasesync open (in domstring name, in domstring description, 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. ...
... method overview idbdatabasesync open (in domstring name, in domstring description, 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. ...
... method overview idbdatabasesync open (in domstring name, in domstring description, 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. ...
IDBKeyRange.bound() - Web APIs
Web › API › IDBKeyRange › bound
rieve records with keys inside that range. this range includes the values "a" and "f", as we haven't declared that they should be open bounds. if we used idbkeyrange.bound("a", "f", true, true);, then the range would not include "a" and "f", only the values between them. ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compa...
...l = '<strong>' + cursor.value.fthing + '</strong>, ' + cursor.value.frating; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'bound()' in that specification. recommendation indexed database api draftthe definition of 'bound()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvi...
IDBKeyRange.includes() - Web APIs
eption of the following type: attribute description dataerror the supplied key was not a valid key. ...
...s('f'); // returns true var myresult = keyrangevalue.includes('w'); // returns false polyfill the includes() method was added in the second edition of the indexed db specification. for browsers that do not support it, the following polyfill can be used. ...
...exed db specification. for browsers that do not support it, the following polyfill can be used. idbkeyrange.prototype.includes = idbkeyrange.prototype.includes || function(key) { var r = this, c; if (r.lower !== undefined) { c = indexeddb.cmp(key, r.lower); if (r.loweropen && c <= 0) return false; if (!r.loweropen && c < 0) return false; } if (r.upper !== undefined) { c = indexeddb.cmp(key, r.upper); if (r.upperopen && c >= 0) return false; if (!r.upperopen && c > 0) return false; } return true; }; specification specification status comment indexed database api draftthe definition of 'includes()' in that specification. recommendation indexed database api draftthe definition of 'includes()' in that specification. ...
IDBKeyRange - Web APIs
you can limit the range using lower and upper bounds. for example, you can iterate over all values of a key in the value range a–z. a key range can be a single value or a range with upper and lower bounds or endpoints. if the key range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. a bounded key range can either be open (the endpoints are excluded) or closed (the endpoints are included). ...
... recommendation adds includes(). browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check ...
... recommendation adds includes(). ...
IDBObjectStore.add() - Web APIs
ode snippet, we open a read/write transaction on our database and add some data to an object store using add(). note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-dat...
...bject store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'add()' in that specification. recommendation indexed database api draftthe definition of 'add()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewc...
IDBObjectStore.autoIncrement - Web APIs
not auto increment. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). after the object store has been created, we log objectstore.autoincrement to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/br...
... store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'autoincrement' in that specification. recommendation indexed database api draftthe definition of 'autoincrement' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid ...
IDBObjectStore.delete() - Web APIs
the key is not a valid key or a key range. example in the following code snippet, we open a read/write transaction on our database and delete one specific record out of our object store using delete() — a sample record with the key "walk dog". for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. this is used a lot below db = dbopenrequest.result; // run the deletedata() function to delete a record from the database deletedata(); }; function deletedata() { // open a read/write db transaction...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-comp...
...ct store var objectstorerequest = objectstore.delete("walk dog"); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'delete()' in that specification. recommendation indexed database api draftthe definition of 'delete()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvi...
IDBObjectStore.get() - Web APIs
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 javascript, 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.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the getdata() function to get the data from the database getdata(); }; function getdata() { // open a read/write db transaction, ready...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-dat...
...tore.get("walk dog"); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; var myrecord = objectstorerequest.result; }; }; specifications specification status comment indexed database api 2.0the definition of 'get()' in that specification. recommendation indexed database api draftthe definition of 'get()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewc...
IDBObjectStore.keyPath - Web APIs
store.keypath; value any value type. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). after the object store has been created, we log objectstore.keypath to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat...
...object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'keypath' in that specification. recommendation indexed database api draftthe definition of 'keypath' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvie...
IDBObjectStore.openCursor() - Web APIs
e cursor what direction to travel. valid values are "next", "nextunique", "prev", and "prevunique". the default is "next". return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore or idbindex has been deleted. transactioninactiveerror this idbobjectstore's transaction is inactive. dataerror the specified key or key range is invalid. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store: var transaction = db.transaction("name", "readonly"); var ob...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/brow...
....result; if(cursor) { // cursor.value contains the current record being iterated through // this is where you'd do something with the result cursor.continue(); } else { // no more results } }; specification specification status comment indexed database api 2.0the definition of 'opencursor()' in that specification. recommendation indexed database api draftthe definition of 'opencursor()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid w...
IDBObjectStore.openKeyCursor() - Web APIs
e cursor what direction to travel. valid values are "next", "nextunique", "prev", and "prevunique". the default is "next". return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore or idbindex has been deleted. transactioninactiveerror this idbobjectstore's transaction is inactive. dataerror the specified key or key range is invalid. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store: var transaction = db.transaction("name", "readonly"); var ob...
... recommendation ...
... recommendation ...
IDBObjectStore.transaction - Web APIs
value an idbtransaction object. example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add(). after the object store has been created, we log objectstore.transaction to the console. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browse...
...ct store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'transaction' in that specification. recommendation indexed database api draftthe definition of 'transaction' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid we...
IDBOpenDBRequest.onblocked - Web APIs
r the blocked event. this event is triggered when the upgradeneeded should be triggered because of a version change but the database is still in use (that is, not closed) somewhere, even after the versionchange event was sent. note: this feature is available in web workers. syntax idbopendbrequest.onblocked = function(event) { ... }; example var db; // let us open our database var request = indexeddb.open("todolist", 4); // these two event handlers act on the database being opened // successfully, or not request.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; request.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below d...
...b variable. // this is used a lot below db = request.result; // run the displaydata() function to populate the task list with // all the to-do list data already in the idb displaydata(); }; // this event handles the event whereby a new version of the // database needs to be created. either one has not been created // before, or a new version number has been submitted via the // window.indexeddb.open line above //it is only implemented in recent browsers request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); ... }; request.onblocked = funct...
... note.innerhtml += '<li>error loading database.</li>'; }; // create an objectstore for this database var objectstore = db.createobjectstore("todolist", { keypath: "tasktitle" }); ... }; request.onblocked = function() { console.log("your database version can't be upgraded because the app is open somewhere else."); } specifications specification status comment indexed database api 2.0the definition of 'onblocked' in that specification. recommendation indexed database api draftthe definition of 'onblocked' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-c...
IDBRequest.error - Web APIs
Web › API › IDBRequest › error
n because domerror has been removed from the dom standard. the following error codes are returned under certain conditions: error explanation aborterror if you abort the transaction, then all requests still in progress receive this error. constrainterror if you insert data that doesn't conform to a constraint. it's an exception type for creating stores and indexes. you get this error, for example, if you try to add a new key that already exists in the record. quotaexceedederror if you run out of disk quota and the user declined to grant you more space. unknownerror if the operation failed for reasons unrelated to the database itself. a failure due to disk io errors is such an example. noerror if the request succeeds. ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-dat...
...ata(); }; }; objectstoretitlerequest.onerror = function() { // if an error occurs with the request, log what it is console.log("there has been an error with retrieving your data: " + objectstoretitlerequest.error); }; specifications specification status comment indexed database api 2.0the definition of 'error' in that specification. recommendation indexed database api draftthe definition of 'error' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewc...
IDBRequest.source - Web APIs
Web › API › IDBRequest › source
the source read-only property of the idbrequest interface returns the source of the request, such as an index or an object store. if no source exists (such as when calling indexeddb.open), it returns null. note: this feature is available in web workers. syntax var idbindex = request.source; var idbcursor = request.source; var idbobjectstore = request.source; value an object representing the source of the request, such as an idbindex, idbobjectstore or idbcursor. example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store in another request. the source of the 2nd request is logg...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-d...
...ce of this request is " + updatetitlerequest.source); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'source' in that specification. recommendation indexed database api draftthe definition of 'source' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webview...
IDBTransaction.abort() - Web APIs
to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. at the end, we simply abort any activity done under the current transaction using abort(). for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted i...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-da...
...ean the item // has been stored successfully in the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; // abort the transaction we just did transaction.abort(); }; specification specification status comment indexed database api 2.0the definition of 'abort()' in that specification. recommendation indexed database api draftthe definition of 'abort()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewc...
IDBTransaction.db - Web APIs
Web › API › IDBTransaction › db
tabase and add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. at the end, we return the associated database connection using db. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inser...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and ...
...ly in the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; // return the database (idbdatabase) connection with which this transaction is associated transaction.db; }; specification specification status comment indexed database api 2.0the definition of 'db' in that specification. recommendation indexed database api draftthe definition of 'db' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchro...
IDBTransaction.error - Web APIs
andlers to report on the outcome of the transaction opening in the event of success or failure. note the transaction.onerror = function(event) { }; block, making use of transaction.error to help in reporting what went wrong when the transaction was unsuccessful. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inser...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data ...
...nt) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'error' in that specification. recommendation indexed database api draftthe definition of 'error' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewch...
IDBTransaction.objectStore() - Web APIs
following code snippet, we open a read/write transaction on our database and add some data to an object store. note also the functions attached to transaction event handlers to report on the outcome of the transaction opening in the event of success or failure. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inser...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/bro...
...// report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; specification specification status comment indexed database api 2.0the definition of 'objectstore()' in that specification. recommendation indexed database api draftthe definition of 'objectstore()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid w...
IDBTransaction.onabort - Web APIs
re. 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. note the transaction.onabort = function(event) { }; block, reporting when the transaction has been aborted. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inser...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat...
....</li>'; }; transaction.onabort = function() { // report when the transaction was successfully aborted console.log("transaction aborted!"); }; // abort the transaction we just did transaction.abort(); }; specification specification status comment indexed database api 2.0the definition of 'onabort' in that specification. recommendation indexed database api draftthe definition of 'onabort' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvie...
IDBTransaction.onerror - Web APIs
andlers to report on the outcome of the transaction opening in the event of success or failure. note the transaction.onerror = function(event) { }; block, making use of transaction.error to help in reporting what went wrong when the transaction was unsuccessful. for a full working example, see our to-do notifications app (view example live.) // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inser...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-d...
...) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transaction.onsuccess) note.innerhtml += '<li>request successful.</li>'; }; }; specification specification status comment indexed database api 2.0the definition of 'onerror' in that specification. recommendation indexed database api draftthe definition of 'onerror' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webview...
IDBVersionChangeEvent.newVersion - Web APIs
nippet, we make a request to open a database, and include handlers for the success and error cases. these events are fired via the custom idbversionchangeevent interface. for a full working example, see our to-do notifications app (view example live.) var note = document.queryselector("ul"); // in the following line, you should include the prefixes of // implementations you want to test. window.indexeddb = window.indexeddb || window.mozindexeddb || window.webkitindexeddb || window.msindexeddb; // don't use "var indexeddb = ..." if you're not in a function. // moreover, you may need references to some window.idb* objects: window.idbtransaction = window.idbtransaction || window.webkitidbtransaction || window.msidbtransaction; window.idbkeyrange = window.idbkeyrange || window.webkitidbkeyrange |...
... // this is used a lot later on, for op...
....innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. // this is used a lot later on, for opening transactions and suchlike. db = dbopenrequest.result; }; specifications specification status comment indexed database api 2.0the definition of 'newversion' in that specification. recommendation indexed database api draftthe definition of 'newversion' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-...
IDBVersionChangeEvent.oldVersion - Web APIs
the oldversion read-only property of the idbversionchangeevent interface returns the old version number of the database. when the opened database doesn't exist yet, the value of oldversion is 0. note: this feature is available in web workers. syntax var oldversion = idbversionchangeevent.oldversion value a 64-bit integer. ...
... recommendation browser compatibility the compatibility table on this page is generated from structured data. ...
...equest.result; if (e.oldversion < 1) { db.createobjectstore("store1"); } if (e.oldversion < 2) { db.deleteobjectstore("store1"); db.createobjectstore("store2"); } // etc. for version < 3, 4... }; specifications specification status comment indexed database api 2.0the definition of 'oldversion' in that specification. recommendation indexed database api draftthe definition of 'oldversion' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid web...
Browser storage limits and eviction criteria - Web APIs
sers, but browser specifics are called out where known. opera and chrome should behave the same in all cases. opera mini (still presto-based, server-side rendering) doesn't store any data on the client. what technologies use browser data storage? in firefox, the following technologies make use of browser data storage to store data when required. we term them "quota clients" in this context: indexeddb asm.js caching cache api cookies note: in firefox, web storage will soon start to use the same storage management tools too, as described in this document. note: in private browsing mode, most data storage is not supported. local storage data and cookies are still stored, but they are ephemeral — the data is deleted when you close the last private browsing window. the "last acces...
... not supported. local storage data and cookies are still stored, but they are ephemeral — the data is deleted when you close the last private browsing window. the "last access time" of origins is updated when any of these are activated/deactivated — origin eviction will delete data for all these quota clients. in chrome/opera, the quota management api handles quota management for appcache, indexeddb, websql, and file system api. different types of data storage even in the same browser, using the same storage method, there are different classes of data storage to understand. this section discusses the different ones you might find in different browsers. storage comes in two types: persistent: this is data that is intended to be kept around for a long time. this will only be evicted ...
...it doesn't matter if box mode is "best-effort" or "persistent" — data is stored under <profile>/storage/default. note: in firefox, you can find your profile folder by entering about:support in the url bar, and pressing the show in... button (e.g., show in finder on mac os x) next to the profile folder title. note: if you are looking around in your profile a...
KeyboardLayoutMap.forEach() - Web APIs
array optional the keyboardlayoutmap that foreach() is being called on. ...
... array optional the keyboardlayoutmap that foreach() is being called on. ...
... array optional the keyboardlayoutmap that foreach() is being called on. thisarg optional value to use as this (i.e the reference object) when executing callback. ...
NodeList.prototype.forEach() - Web APIs
Web › API › NodeList › forEach
the foreach() method of the nodelist interface calls the callback given in parameter once for each value pair in the list, in insertion order. syntax somenodelist.foreach(callback[, thisarg]); parameters callback a function to execute on each element of somenodelist. it accepts 3 parameters: currentvalue the current element being processed in somenodelist. currentindex optional the index of the currentvalue being processed in somenodelist. listobj optional the somenodelist that foreach() is being applied to. thisarg optional value to use as this when executing callback. return value undefined. example let node = document.createelement("div"); let kid1 = document.createelement("p"); let kid2 = document.createtextnode("hey"); let kid3 = document.createelement(...
...value to use as this when executing callback. return value undefined. ...
...ndefined. ...
OVR_multiview2 - Web APIs
alse. however, the oculus browser (6+) also supports multisampling using the oculus_multiview extension. see also this webgl issue. constants this extension exposes 4 constants that can be used in getparameter() or getframebufferattachmentparameter(). framebuffer_attachment_texture_num_views_ovr number of views of the framebuffer object attachment. ...
...ulus browser (6+) also supports multisampling using the oculus_multiview extension. see also this webgl issue. constants this extension exposes 4 constants that can be used in getparameter() or getframebufferattachmentparameter(). framebuffer_attachment_texture_num_views_ovr number of views of the framebuffer object attachment. ...
...calling checkframebufferstatus for a framebuffer in this state returns framebuffer_incomplete_view_targets_ovr. ...
Selection.getRangeAt() - Web APIs
a negative number or a number greater than or equal to selection.rangecount will result in an error. return value the specified range object. ...
...a negative number or a number greater than or equal to selection.rangecount will result in an error. return value the specified range object. ...
...a negative number or a number greater than or equal to selection.rangecount will result in an error. return value the specified range object. ...
ServiceWorkerContainer.register() - Web APIs
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 in this case, if included in example.com/index.html, will control example.com/index.html, as well as pages underneath it, like example.com/product/description.html. if ('serviceworker' in navigator) { // register a service worker hosted at the root of the // site using the default scope. navigator.serviceworker.register('/sw.js').then(function(registration) { console.log('service worker registration succeeded:', registration); },...
...he // site using the default scope. navigator.serviceworker.register('/sw.js').then(function(registration) { console.log('service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('service worker registration failed:', error); }); } else { console.log('service workers are not supported.'); } the following code, if included in example.com/index.html, at the root of a site, would apply to exactly the same pages as the example above. remember the scope, when included, uses the page's location as its base. alternatively, if this code were included in a page at example.com/product/description.html, with the javascript file residing at example.com/product/sw.js, then the service worker would only apply to resources under example.com/product...
...le.log('service worker registration failed:', error); }); } else { console.log('service workers are not supported.'); } 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. the following code, if included in example.com/index.html, at the root of a site, would only apply to resources under example.com/product. if ('serviceworker' in navigator) { // declaring scope manually navigator.serviceworker.register('/sw.js', {scope: '/product/'}).then(function(registration) { console.log('service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('service worker registratio...
SpeechSynthesisEvent - Web APIs
the speechsynthesisevent interface of the web speech api contains information about the current state of speechsynthesisutterance objects that have been processed in the speech service. properties the speechsynthesisevent interface also inherits properties from its parent interface, event. speechsynthesisevent.charindex read only returns the index position of the character in the speechsynthesisutterance.text that was being spoken when the event was triggered. speechsynthesisevent.elapsedtime read only returns the elapsed time in milliseconds after the speechsynthesisutterance.text started being spoken that the event was triggered at. speechsynthesisevent.name read only returns the name associated with certain types of events occuring as the speechsynthesisutterance.text is bein...
...rk event, or the type of boundary reached in the case of a boundary event. speechsynthesisevent.utterance read only returns the speechsynthesisutterance instance that the event was triggered on. methods the speechsynthesisevent interface also inherits methods from its parent interface, event. ...
...ary event. speechsynthesisevent.utterance read only returns the speechsynthesisutterance instance that the event was triggered on. methods the speechsynthesisevent interface also inherits methods from its parent interface, event. examples utterthis.onpause = function(event) { var char = event.utterance.text.charat(event.charindex); console.log('speech paused at character ' + event.charindex + ' of "' + event.utterance.text + '", which is "' + char + '".'); } utterthis.onboundary = function(event) { console.log(event.name + ' boundary reached after ' + event.elapsedtime + ' milliseconds.'); } specifications specification status comment web speech apithe definition of 'speechsynthesisevent' in that specification. draft ...
StylePropertyMapReadOnly.forEach() - Web APIs
arrayoptional the stylepropertymapreadonly thatforeach() is being called on. ...
... arrayoptional the stylepropertymapreadonly thatforeach() is being called on. ...
... arrayoptional the stylepropertymapreadonly thatforeach() is being called on. thisarg optional value to use as this (i.e the reference object) when executing callback. ...
WebGL2RenderingContext.getTransformFeedbackVarying() - Web APIs
return value a webglactiveinfo object. ...
... return value a webglactiveinfo object. ...
... return value a webglactiveinfo object. ...
WebGL2RenderingContext.uniformBlockBinding() - Web APIs
uniformblockbinding a gluint specifying the binding point to which to bind the uniform block. return value none. ...
... uniformblockbinding a gluint specifying the binding point to which to bind the uniform block. return value none. ...
... uniformblockbinding a gluint specifying the binding point to which to bind the uniform block. return value none. ...
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. ...
... 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. ...
... 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. ...
WebGL2RenderingContext - Web APIs
l members of the webglrenderingcontext interface. some methods of the webgl 1 context can accept additional values when used in a webgl 2 context. you will find this info noted on the webgl 1 reference pages. the webgl tutorial has more information, examples, and resources on how to get started with webgl. constants see the webgl constants page. state information webgl2renderingcontext.getindexedparameter() returns the indexed value for the given target. buffers webgl2renderingcontext.bufferdata() initializes and creates the buffer object's data store. webgl2renderingcontext.buffersubdata() updates a subset of a buffer object's data store. webgl2renderingcontext.copybuffersubdata() copies part of the data of a buffer to another buffer. webgl2renderingcontext.getbuffersubdata...
...eturns information about varying variables from webgltransformfeedback buffers. webgl2renderingcontext.pausetransformfeedback() pauses a transform feedback operation. webgl2renderingcontext.resumetransformfeedback() resumes a transform feedback operation. uniform buffer objects webgl2renderingcontext.bindbufferbase() binds a given webglbuffer to a given binding point (target) at a given index. webgl2renderingcontext.bindbufferrange() binds a range of a given webglbuffer to a given binding point (target) at a given index. webgl2renderingcontext.getuniformindices() retrieves the indices of a number of uniforms within a webglprogram. webgl2renderingcontext.getactiveuniforms() retrieves information about active uniforms within a webglprogram. webgl2renderingcontext.getuniformbl...
...webgl2renderingcontext.bindbufferrange() binds a range of a given webglbuffer to a given binding point (target) at a given index. webgl2renderingcontext.getuniformindices() retrieves the indices of a number of uniforms within a webglprogram. webgl2renderingcontext.getactiveuniforms() retrieves information about active uniforms within a webglprogram. webgl2renderingcontext.getuniformblockindex() retrieves the index of a uniform block within a webglprogram. webgl2renderingcontext.getactiveuniformblockparameter() retrieves information about an active uniform block within a webglprogram. webgl2renderingcontext.getactiveuniformblockname() retrieves the name of the active uniform block at a given index within a webglprogram. webgl2renderingcontext.uniformblockbinding() assigns bindin...
Using the Web Speech API - Web APIs
b service for recognition processing, so it won't work offline. demo to show simple usage of web speech recognition, we've written a demo called speech color changer. when the screen is tapped/clicked, you can say an html color keyword, and the app's background color will change to that color. to run the demo, you can clone (or directly download) the github repo it is part of, open the html index file in a supporting desktop browser, or navigate to the live demo url in a supporting mobile browser like chrome. browser support support for web speech api speech recognition is curently limited to chrome for desktop and android — chrome has supported it since around version 33 but with prefixed interfaces, so you need to include prefixed versions of them, e.g. webkitspeechrecognition. htm...
...eb speech synthesis, we've provided a demo called speak easy synthesis. this includes a set of form controls for entering text to be synthesised, and setting the pitch, rate, and voice to use when the text is uttered. after you have entered your text, you can press enter/return to hear it spoken. to run the demo, you can clone (or directly download) the github repo it is part of, open the html index file in a supporting desktop browser, or navigate to the live demo url in a supporting mobile browser like chrome, or firefox os. browser support support for web speech api speech synthesis is still getting there across mainstream browsers, and is currently limited to the following: firefox desktop and mobile support it in gecko 42+ (windows)/44+, without prefixes, and it can be turned on...
...eak(utterthis); in the final part of the handler, we include an speechsynthesisutterance.onpause handler to demonstrate how speechsynthesisevent can be put to good use. when speechsynthesis.pause() is invoked, this returns a message reporting the character number and name that the speech was paused at. utterthis.onpause = function(event) { var char = event.utterance.text.charat(event.charindex); console.log('speech paused at character ' + event.charindex + ' of "' + event.utterance.text + '", which is "' + char + '".'); } finally, we call blur() on the text input. this is mainly to hide the keyboard on firefox os. inputtxt.blur(); } updating the displayed pitch and rate values the last part of the code simply updates the pitch/rate values displayed in the ui, each time ...
XRInputSourceArray.keys() - Web APIs
od in the xrinputsourcearray interface returns a javascript iterator which can then be used to iterate over the keys used to reference each item in the array of input sources. syntax xrinputsourcearray.keys(); parameters none. return value a javascript iterator that can be used to walk through the keys for each entry in the list of input sources. ...
...d to iterate over the keys used to reference each item in the array of input sources. syntax xrinputsourcearray.keys(); parameters none. return value a javascript iterator that can be used to walk through the keys for each entry in the list of input sources. the values returned by the iterator are the indexes of each entry in the list; that is, the numbers 0, 1, 2, and so forth through the index of the last item in the list. examples this example snippet gets the list of inputs for a session and tries to handle each type of input device it supports using. for (const inputidx of xrsession.inputsources.keys()) { /* the keys are the indexes into the list of inputs */ checkinput(xrsession.inputsources[inputidx]); } here, for...of is used to iterate over each of the keys. for each ke...
...ples this example snippet gets the list of inputs for a session and tries to handle each type of input device it supports using. for (const inputidx of xrsession.inputsources.keys()) { /* the keys are the indexes into the list of inputs */ checkinput(xrsession.inputsources[inputidx]); } here, for...of is used to iterate over each of the keys. for each key, the input is retrieved using the index with array notation: xrsession.inputsources[inputidx]. specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that specification.1 working draft xrinputsourcearray interface [1] see iterator-like methods in information contained in a webidl file for information on how an iterable declaration in an interface ...
XRInputSourceArray - Web APIs
the interface xrinputsourcearray represents a live list of webxr input sources, and is used as the return value of the xrsession property inputsources. each entry is an xrinputsource representing one input device connected to the webxr system. in addition to being able to access the input sources in the list using standard array notation (that is, with index numbers insize square brackets), methods are available to allow the use of iterators and the foreach() method is also available. properties the following properties are available on xrinputsourcearray objects. length read only the number of xrinputsource objects in the list. methods the following methods are available on xrinputsourcearray objects. you may also use the features of the symbol type. entries() returns an iter...
...ties are available on xrinputsourcearray objects. length read only the number of xrinputsource objects in the list. methods the following methods are available on xrinputsourcearray objects. you may also use the features of the symbol type. entries() returns an iterator you can use to walk the list of key/value pairs in the list. each item returned is an array whose first value is the index and whose second value is the xrinputsource at that index. foreach() iterates over each item in the list, in order from first to last. keys() a list of the keys corresponding to the entries in the input source list. values() returns an iterator you can use to go through all the values in the list. each item is a single xrinputsource object. in addition to these methods, you may use array ...
...urce at that index. foreach() iterates over each item in the list, in order from first to last. keys() a list of the keys corresponding to the entries in the input source list. values() returns an iterator you can use to go through all the values in the list. each item is a single xrinputsource object. in addition to these methods, you may use array notation to access items in the list by index for example, the snippet of code below calls a function handleinput(), passing into it the first item in the input source list, if the list isn't empty. let sources = xrsession.inputsources; if (sources.length > 0) { handleinput(sources[0]); } examples specifications specification status comment webxr device apithe definition of 'xrinputsourcearray' in that spec...
Using the link role - Accessibility
can be used to change focus to the link, and enter used to execute the link. note: where possible, it is recommended that you use a native <a> element rather than the link role, as native elements are more widely supported by older user agents and assistive technology. native <a> elements also support keyboard and focus requirements by default, without need for additional customization. the tabindex attribute may optionally be used with this role to directly specify the position of the element in the tab order. possible effects on user agents and assistive technology when the link role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a link role in the operating system's accessibility api. fire an accessib...
...chnology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples this example shows how to implement a fake link using a <span> element. this includes javascript to grab the location and handle navigating to the new location using window.open() via clicking, and using keyboard, css to give the desired visuals of a link, the tabindex="0" attribute to make it keyboard-focussable, and role="link" to make it recognised as a link by assistive technology. this is a huge amount of work just to recreate something you've get for free using the <a> element, so you should really use that if possible. but this shows that it can be done. you should however note that there are still problems with this approach: it is very difficult t...
...s been visited before, and therefore use :visited styles (e.g. the default purple color for visited links). opening a page using the open() method counts as being a popup, and certain browsers may issue a warning when you try to activate it, or make you explicitly agree to allowing popups form the domain it exists on. ...
Using the radio role - Accessibility
and assistive technology 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: example from the basic form hints mdn page. ...
...d above is one of those opinions and therefore not normative. examples example 1: example from the basic form hints mdn page. ...
...d="rg1_label">lunch options</h3> <ul class="radiogroup" id="rg1" role="radiogroup" aria-labelledby="rg1_label"> <li id="r1" tabindex="-1" role="radio" aria-checked="false"> <img role="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> working examples: notes aria attributes used related aria techniques compatibility tbd: add support information for common ua and at product combinations additional resources ...
ARIA: table role - Accessibility
mantic_elements_table_desc" aria-rowcount="81"> <div id="semantic_elements_table_desc">semantic elements to use instead of aria's roles</div> <div role="rowgroup"> <div role="row"> <span role="columnheader" aria-sort="none">aria role</span> <span role="columnheader" aria-sort="none">semantic element</span> </div> </div> <div role="rowgroup"> <div role="row" aria-rowindex="11"> <span role="cell">header</span> <span role="cell">h1</span> </div> <div role="row" aria-rowindex="16"> <span role="cell">header</span> <span role="cell">h6</span> </div> <div role="row" aria-rowindex="18"> <span role="cell">rowgroup</span> <span role="cell">thead</span> </div> <div role="row" aria-rowindex="24"> <span role="c...
...need to be added via associated roles, such as rowgroup, row, columnheader, and cell. if the table contains sortable columns or rows, the aria-sort attribute should be added on the header 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 multiple rows or multiple 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 th...
..._elements_table_desc" aria-rowcount="81"> <div id="semantic_elements_table_desc">semantic elements to use instead of aria's roles</div> <div role="rowgroup"> <div role="row"> <span role="columnheader" aria-sort="none">aria role</span> <span role="columnheader" aria-sort="none">semantic element</span> </div> </div> <div role="rowgroup"> <div role="row" aria-rowindex="11"> <span role="cell">header</span> <span role="cell">h1</span> </div> <div role="row" aria-rowindex="16"> <span role="cell">header</span> <span role="cell">h6</span> </div> <div role="row" aria-rowindex="18"> <span role="cell">rowgroup</span> <span role="cell">thead</span> </div> <div role="row" aria-rowindex="24"> <span ro...
::after (:after) - CSS: Cascading Style Sheets
Web › CSS › ::after
bc8f7; } .ribbon::after { content: "this is a fancy orange box."; background-color: #ffba10; border-color: black; border-style: dotted; } result tooltips this example uses ::after, in conjunction with the attr() css expression and a data-descr custom data attribute, to create tooltips. ...
...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 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">tooltips</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; ...
... working draft no significant changes to the previous specification. css animationsthe definition of 'animations on pseudo-element properties' in that specification. working draft allows animations on properties...
position - CSS: Cascading Style Sheets
Web › CSS › position
ithub repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax the position property is specified as a single keyword chosen from the list of values below. values static the element is positioned according to the normal flow of the document. the top, right, bottom, left, and z-index properties have no effect. this is the default value. relative the element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top, right, bottom, and left. the offset does not affect the position of any other elements; thus, the space given for the element in the page layout is the same as if position were static. this value cr...
...alue. relative the element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top, right, bottom, and left. the offset does not affect the position of any other elements; thus, the space given for the element in the page layout is the same as if position were static. this value creates a new stacking context when the value of z-index is not auto. its effect on table-*-group, table-row, table-column, table-cell, and table-caption elements is undefined. absolute the element is removed from the normal document flow, and no space is created for the element in the page layout. it is positioned relative to its closest positioned ancestor, if any; otherwise, it is placed relative to the initial containing block. its final position...
...olute the element is removed from the normal document flow, and no space is created for the element in the page layout. it is positioned relative to its closest positioned ancestor, if any; otherwise, it is placed relative to the initial containing block. its final position is determined by the values of top, right, bottom, and left. this value creates a new stacking context when the value of z-index is not auto. the margins of absolutely positioned boxes do not collapse with other margins. fixed the element is removed from the normal document flow, and no space is created for the element in the page layout. it is positioned relative to the initial containing block established by the viewport, except when one of its ancestors has a transform, perspective, or filter property set to something...
Rich-Text Editing in Mozilla - Developer guides
; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body onload="initdoc();"> <form name="compform" method="post" action="sample.php" onsubmit="if(validatemode()){this.mydoc.value=odoc.innerhtml;return true;}return false;"> <input type="hidden" name="mydoc"> <div id="toolbar1"> <select onchange="formatdoc('formatblock',this[this.selectedindex].value);this.selectedindex=0;"> <option selected>- formatting -</option> <option value="h1">title 1 &lt;h1&gt;</option> <option value="h2">title 2 &lt;h2&gt;</option> <option value="h3">title 3 &lt;h3&gt;</option> <option value="h4">title 4 &lt;h4&gt;</option> <option value="h5">title 5 &lt;h5&gt;</option> <option value="h6">subtitle &lt;h6&gt;</option> <option value="p">paragraph &lt;p&gt;</opti...
...ion value="h2">title 2 &lt;h2&gt;</option> <option value="h3">title 3 &lt;h3&gt;</option> <option value="h4">title 4 &lt;h4&gt;</option> <option value="h5">title 5 &lt;h5&gt;</option> <option value="h6">subtitle &lt;h6&gt;</option> <option value="p">paragraph &lt;p&gt;</option> <option value="pre">preformatted &lt;pre&gt;</option> </select> <select onchange="formatdoc('fontname',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- font -</option> <option>arial</option> <option>arial black</option> <option>courier new</option> <option>times new roman</option> </select> <select onchange="formatdoc('fontsize',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- size -</option> <option value="1">very small</option> <option ...
...ue);this.selectedindex=0;"> <option class="heading" selected>- size -</option> <option value="1">very small</option> <option value="2">a bit small</option> <option value="3">normal</option> <option value="4">medium-large</option> <option value="5">big</option> <option value="6">very big</option> <option value="7">maximum</option> </select> <select onchange="formatdoc('forecolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- color -</option> <option value="red">red</option> <option value="blue">blue</option> <option value="green">green</option> <option value="black">black</option> </select> <select onchange="formatdoc('backcolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- background -</option> <option va...
Making content editable - Developer guides
; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body onload="initdoc();"> <form name="compform" method="post" action="sample.php" onsubmit="if(validatemode()){this.mydoc.value=odoc.innerhtml;return true;}return false;"> <input type="hidden" name="mydoc"> <div id="toolbar1"> <select onchange="formatdoc('formatblock',this[this.selectedindex].value);this.selectedindex=0;"> <option selected>- formatting -</option> <option value="h1">title 1 &lt;h1&gt;</option> <option value="h2">title 2 &lt;h2&gt;</option> <option value="h3">title 3 &lt;h3&gt;</option> <option value="h4">title 4 &lt;h4&gt;</option> <option value="h5">title 5 &lt;h5&gt;</option> <option value="h6">subtitle &lt;h6&gt;</option> <option value="p">paragraph &lt;p&gt;</opti...
...ion value="h2">title 2 &lt;h2&gt;</option> <option value="h3">title 3 &lt;h3&gt;</option> <option value="h4">title 4 &lt;h4&gt;</option> <option value="h5">title 5 &lt;h5&gt;</option> <option value="h6">subtitle &lt;h6&gt;</option> <option value="p">paragraph &lt;p&gt;</option> <option value="pre">preformatted &lt;pre&gt;</option> </select> <select onchange="formatdoc('fontname',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- font -</option> <option>arial</option> <option>arial black</option> <option>courier new</option> <option>times new roman</option> </select> <select onchange="formatdoc('fontsize',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- size -</option> <option value="1">very small</option> <option ...
...ue);this.selectedindex=0;"> <option class="heading" selected>- size -</option> <option value="1">very small</option> <option value="2">a bit small</option> <option value="3">normal</option> <option value="4">medium-large</option> <option value="5">big</option> <option value="6">very big</option> <option value="7">maximum</option> </select> <select onchange="formatdoc('forecolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- color -</option> <option value="red">red</option> <option value="blue">blue</option> <option value="green">green</option> <option value="black">black</option> </select> <select onchange="formatdoc('backcolor',this[this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- background -</option> <option va...
<button>: The Button element - HTML: Hypertext Markup Language
Web › HTML › Element › button
iterion 1.4.3 | w3c understanding wcag 2.0 clicking and focus whether clicking on a <button> causes it to (by default) become focused varies by browser and os. the results for <input> of type="button" and type="submit" are the same. ...
...ult) become focused varies by browser and os. the results for <input> of type="button" and type="submit" are the same. ...
...3 chrome yes - chrome 35 yes - chrome 65 safari n/a no (even with a tabindex) safari 12 (bug 22261) internet explorer yes - internet explorer 11 n/a presto yes - opera 12 yes - opera 12 does tapping on a <button> give it focus? mobile browsers ios 7.1.2 android 4.4.4 safari mobile no (even with a tabindex) n/a chrome 35 no (even with a tabindex) yes specifications specification status comment html living standardthe definition of '<button>' in that specification. living standard html5the definition of '<button>' in that specification. recommendation html 4.01 specificationthe definition of '<button>' in that spec...
Link types - HTML: Hypertext Markup Language
if the media attribute is set) in another language (if the hreflang attribute is set), in another format, such as a pdf (if the type attribute is set) a combination of these <a>, <area>, <link> <form> archives defines a hyperlink to a document that contains an archive link to this one. for example, a blog entry could link to a monthly index page this way. note: although recognized, the singular archive is incorrect and must be avoided. <a>, <area>, <link> <form> author defines a hyperlink to a page describing the author or providing a way to contact the author. note: this may be a mailto: hyperlink, but this is not recommended on public pages as robot harvesters will quickly lead to a lot of spam ...
...bpage icon for web clip or a start-up placeholder. instead it uses the non-standard apple-touch-icon and apple-touch-startup-image respectively. the shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore. <link> <a>, <area>, <form> import html imports <link> <a>, <area>, <form> index obsolete since html5 indicates that the page is part of a hierarchical structure and that the hyperlink leads to the top level resource of that structure. if one or several up link types are also present, the number of these up indicates the depth of the current page in the hierarchy. <a>, <area>, <link> <form> last indicates that the hyperlink leads to the last re...
...hapter, section, subsection, and appendix html 4.01 specificationthe definition of 'link types' in that specification. recommendation added alternate, stylesheet, start, chapter, section, subsection, appendix, and bookmark. renamed previous to prev. removed top, and search. unknownthe definition of '<link>' in that specification. obsolete added top, contents, index, glossary, copyright, next, previous, help, and search. rfc 1866: html 2.0 obsolete initial definition. ...
Using the application cache - HTML: Hypertext Markup Language
rowser should cache for offline access. resources are identified by uri. entries listed in the cache manifest must have the same scheme, host, and port as the manifest. example 1: a simple cache manifest file the following is a simple cache manifest file, example.appcache, for an imaginary web site at www.example.com. cache manifest # v1 - 2011-08-13 # this is a comment. http://www.example.com/index.html http://www.example.com/header.png http://www.example.com/blah/blah a cache manifest file can include three sections (cache, network, and fallback, discussed below). in the example above, there is no section header, so all data lines are assumed to be in the explicit (cache) section, meaning that the browser should cache all the listed resources in the application cache. resources can be sp...
...mple.com/blah/blah a cache manifest file can include three sections (cache, network, and fallback, discussed below). in the example above, there is no section header, so all data lines are assumed to be in the explicit (cache) section, meaning that the browser should cache all the listed resources in the application cache. resources can be specified using either absolute or relative urls (e.g., index.html). the "v1" comment in the example above is there for a good reason. browsers only update an application cache when the manifest file changes, byte for byte. if you change a cached resource (for example, you update the header.png image with new content), you must also change the content of the manifest file in order to let browsers know that they need to refresh the cache. you can make any c...
...t file. wildcards may be used. the cache, network, and fallback sections can be listed in any order in a cache manifest file, and each section can appear more than once in a single manifest. example 2: a more complete cache manifest file the following is a more complete cache manifest file for the imaginary web site at www.example.com: cache manifest # v1 2011-08-14 # this is another comment index.html cache.html style.css image1.png # use from network if available network: network.html # fallback content fallback: . fallback.html this example uses network and fallback sections to specify that the network.html page must always be retrieved from the network, and that the fallback.html page should be served as a fallback resource (e.g., in case a connection to the server cannot be establ...
JavaScript data types and data structures - JavaScript
like a number in cases where it is converted to boolean: if, ||, &&, boolean, !. bigints cannot be operated on interchangeably with numbers. instead a typeerror will be thrown. string type javascript's string type is used to represent textual data. it is a set of "elements" of 16-bit unsigned integer values. each element in the string occupies a position in the string. the first element is at index 0, the next at index 1, and so on. the length of a string is the number of elements in it. unlike some programming languages (such as c), javascript strings are immutable. this means that once a string is created, it is not possible to modify it. however, it is still possible to create another string based on an operation on the original string. for example: a substring of the original by pi...
...rty. false "normal" objects, and functions a javascript object is a mapping between keys and values. keys are strings (or symbols), and values can be anything. this makes objects a natural fit for hashmaps. functions are regular objects with the additional capability of being callable. dates when representing dates, the best choice is to use the built-in date utility in javascript. ...
...this makes arrays a perfect candidate to represent lists or sets. typed arrays are new to javascript with ecmascript 2015, and present an array-like view of an underlying binary data buffer. ...
Loops and iteration - JavaScript
th a label, it terminates the specified labeled statement. the syntax of the break statement looks like this: break; break [label]; the first form of the syntax terminates the innermost enclosing loop or switch. the second form of the syntax terminates the specified enclosing labeled statement. ...
... for...of statement the for...of statement creates a loop iterating over iterable objects (including array, m...
...; return result; } for an object car with properties make and model, result would be: car.make = ford car.model = mustang arrays although it may be tempting to use this as a way to iterate over array elements, the for...in statement will return the name of your user-defined properties in addition to the numeric indexes. therefore, it is better to use a traditional for loop with a numeric index when iterating over arrays, because the for...in statement iterates over user-defined properties in addition to the array elements, if you modify the array object (such as adding custom properties or methods). for...of statement the for...of statement creates a loop iterating over iterable objects (including array, map, set, arguments object and so on), invoking a custom iteration hook with sta...
The legacy Iterator protocol - JavaScript
next a zero arguments function that returns an value. difference between legacy and es2015 iterator protocols the value was returned directly as a return value of calls to next, instead of the value property of a placeholder object iteration termination was expressed by throwing a stopiteration object. ...
...erence between legacy and es2015 iterator protocols the value was returned directly as a return value of calls to next, instead of the value property of a placeholder object iteration termination was expressed by throwing a stopiteration object. ...
...the value was returned directly as a return value of calls to next, instead of the value property of a placeholder object iteration termination was expressed by throwing a stopiteration object. ...
TypeError: cannot use 'in' operator to search for 'x' in 'y' - JavaScript
to check if a property is in an object. you can't search in strings, or in numbers, or other primitive types. examples searching in strings unlike in other programming languages (e.g. python), you can't search in strings using the in operator. "hello" in "hello world"; // typeerror: cannot use 'in' operator to search for 'hello' in 'hello world' instead you will need to use string.prototype.indexof(), for example. "hello world".indexof("hello") !== -1; // true the operand can't be null or undefined make sure the object you are inspecting isn't actually null or undefined. var foo = null; "bar" in foo; // typeerror: cannot use 'in' operator to search for 'bar' in 'foo' (chrome) // typeerror: right-hand side of 'in' should be an object, got null (firefox) the in operator always expects...
... var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; 3 in trees; // true "oak" in trees; // false ...
... var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; 3 in trees; // true "oak" in trees; // false ...
Array.prototype.entries() - JavaScript
the entries() method returns a new array iterator object that contains the key/value pairs for each index in the array. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax array.entries() return value a new array iterator object. ...
...terator object that contains the key/value pairs for each index in the array. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax array.entries() return value a new array iterator object. ...
...ndex in the array. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax array.entries() return value a new array iterator object. examples iterating with index and element const a = ['a', 'b', 'c']; for (const [index, element] of a.entries()) console.log(index, element); // 0 'a' // 1 'b' // 2 'c' using a for…of loop var a = ['a', 'b', 'c']; var iterator = a.entries(); for (let e of iterator) { console.log(e); } // [0, 'a'] // [1, 'b'] // [2, 'c'] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.entries' in that specification. ...
Array.prototype.fill() - JavaScript
return value the modified array, filled with value. ...
... return value the modified array, filled with value. ...
...the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.fill(value[, start[, end]]) parameters value value to fill the array with. (note all elements in the array will be this exact value.) start optional start index, default 0. end optional end index, default arr.length. return value the modified array, filled with value. description if start is negative, it is treated as array.length + start. if end is negative, it is treated 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 ...
Date() constructor - JavaScript
nt format. date objects contain a number that represents milliseconds since 1 january 1970 utc. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax new date() new date(value) new date(datestring) new date(year, monthindex [, day [, hours [, minutes [, seconds [, milliseconds]]]]]) note: the only correct way to instantiate a new date object is by using the new operator. if you simply call the date object directly, such as now = date(), the returned value is a string rather than a date object. parameters there are four basic forms for the date() constructor: no parameters when no parameters are provid...
... component values (year, month, day, hour, minute, second, and millisecond) all come from the following parameters. any missing fields are given the lowest possible value (1 for day and 0 for every other component). year integer value representing the year. values from 0 to 99 map to the years 1900 to 1999. all other values are the actual year. see the example below. monthindex integer value representing the month, beginning with 0 for january to 11 for december. day optional integer value representing the day of the month. the default is 1. hours optional integer value representing the hour of the day. the default is 0 (midnight). minutes optional integer value representing the minute segment of a time. the default is 0 minutes past the hour. se...
... ...
TypedArray.prototype.every() - JavaScript
example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.every(callback[, thisarg]) parameters callback function to test for each element, taking three arguments: currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array every was called upon. thisarg optional. value to use as this when executing callback. return value true if the callback function returns a truthy value for every array element; otherwise, false. description the every method executes the provided callback function once for each element pres...
...ion once for each element present in the typed array until it finds one where callback returns a falsy value (a value that becomes false when converted to a boolean). if such an element is found, the every method immediately returns false. otherwise, if callback returned a true value for all elements, every will return true. callback is invoked with three arguments: the value of the element, the index of the element, and the array object being traversed. if a thisarg parameter is provided to every, it will be passed to callback when invoked, for use as its this value. otherwise, the value undefined will be passed for use as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. every does not m...
... for use as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. every does not mutate the typed array on which it is called. examples testing size of all typed array elements the following example tests whether all elements in the typed array are bigger than 10. function isbigenough(element, index, array) { return element >= 10; } new uint8array([12, 5, 8, 130, 44]).every(isbigenough); // false new uint8array([12, 54, 18, 130, 44]).every(isbigenough); // true testing typed array elements using arrow functions arrow functions provide a shorter syntax for the same test. new uint8array([12, 5, 8, 130, 44]).every(elem => elem >= 10); // false new uint8array([12, 54, 18, 130, 44]).every(...
TypedArray.prototype.fill() - JavaScript
defaults to this.length. return value the modified array. ...
...defaults to this.length. return value the modified array. ...
... typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.fill(value[, start = 0[, end = this.length]]) parameters value value to fill the typed array with. start optional. start index. defaults to 0. end optional. end index (not included). defaults to this.length. return value the modified array. description the elements interval to fill is [start, end). the fill method takes up to three arguments value, start and end. the start and end arguments are optional with default values of 0 and the length of the this object. if start is negative, it is treated as length+star...
TypedArray.prototype.slice() - JavaScript
e algorithm as array.prototype.slice(). typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.slice([begin[, end]]) parameters begin optional zero-based index at which to begin extraction. a negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. if begin is undefined, slice begins from index 0. end optional zero-based index before which to end extraction. slice extracts up to but not including end. for example, slice(1,4) extracts the second element through the fourt...
...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. ...
...slice(2,-1) extracts the third element through the second-to-last element in the sequence. ...
TypedArray.prototype.some() - JavaScript
example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.some(callback[, thisarg]) parameters callback function to test for each element, taking three arguments: currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array some was called upon. thisarg optional. value to use as this when executing callback. return value true if the callback function returns a truthy value for any array element; otherwise, false. description the some method executes the callback function once for each element present in the ty...
...ction returns a truthy value for any array element; otherwise, false. description the some method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value. if such an element is found, some immediately returns true. otherwise, some returns false. callback is invoked with three arguments: the value of the element, the index of the element, and the array object being traversed. if a thisarg parameter is provided to some, it will be passed to callback when invoked, for use as its this value. otherwise, the value undefined will be passed for use as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. some does not mut...
...rray.prototype.some }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable. examples 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(isbiggerthan10); // false new uint8array([12, 5, 8, 1, 4]).some(isbiggerthan10); // true testing typed array elements using arrow functions arrow functions provide a shorter syntax for the same test. new uint8array([2, 5, 8, 1, 4]).some(elem => elem > 10); // false new uint8array([12, 5, 8, 1, 4]).some(elem => elem > 10);...
for...in - JavaScript
a different property name is assigned to variable on each iteration. object object whose non-symbol enumerable properties are iterated over. description a for...in loop only iterates over enumerable, non-symbol properties. objects created from built–in constructors like array and object have inherited non–enumerable properties from object.prototype and string.prototype, such as string's indexof() method or object's tostring() method. the loop will iterate over all enumerable properties of the object itself and those the object inherits from its prototype chain (properties of nearer prototypes take precedence over those of prototypes further away from the object in its prototype chain). deleted, added, or modified properties a for...in loop iterates over the properties of an object i...
... iteration, other than the property currently being visited. there is no guarantee whether an added property will be visited, whether a modified property (other than the current one) will be visited before or after it is modified, or whether a deleted property will be visited before it is deleted. array iteration and for...in note: for...in should not be used to iterate over an array where the index order is important. array indexes are just enumerable properties with integer names and are otherwise identical to general object properties. there is no guarantee that for...in will return the indexes in any particular order. the for...in loop statement will return all enumerable properties, including those with non–integer names and those that are inherited. because the order of iteration ...
... iterating over own properties only if you only want to consider properties attached to the object itself, and not its prototypes, use getownpropertynames() or perform a hasownproperty() check (propertyisenumerable() can also be used). ...
How to make PWAs installable - Progressive web apps (PWAs)
art menu, or an icon on the desktop), and a background color to use in loading or splash screens. this information is needed for the browser to present the web app properly during the installation process, as well as within the device's app-launching interface, such as the home screen of a mobile device. the js13kpwa.webmanifest file of the js13kpwa web app is included in the <head> block of the index.html file using the following line of code: <link rel="manifest" href="js13kpwa.webmanifest"> there are a few common kinds of manifest file that have been used in the past: manifest.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 w...
...13kpwa", "description": "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", "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. description: a sentence or two explaining what your app does. icons: a bunch of icon information — source urls, sizes,...
...xplanatory, 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. description: 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 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...
The building blocks of responsive design - Progressive web apps (PWAs)
ing live. note that getusermedia() is an experimental technology, which currently only works in google chrome and firefox desktop. more functionality and a clean up of the styling of snapshot are planned for a future date. our desktop layout for snapshot is three columns, containing the camera viewer, image capture view, and gallery, respectively. the markup is very simple: <x-deck selected-index="0"> <x-card> … </x-card> <x-card> … </x-card> <x-card> … </x-card> </x-deck> note: these weird x- elements may be unfamiliar; they are part of brick, mozilla's ui element library for mobile web apps. we have used brick to create the mobile layout for snapshot, which you will read more about below. to get these sitting side-by-side we have used the following rule...
...n any card a button's width higher up the card. when you click on an image in the gallery it brings up options to delete or cancel deletion of the card, and you don't want two buttons on top of one another. x-card:nth-child(3) img { width: 50%; } this rule simply changes the width of the gallery images so now there are two per line. ...
... next up, the font-size of the buttons is set to 6.8vw. why? because the top-margin of the x-cards was set to 17vw earlier on. all buttons in the app have been set to have a line-height of 2.5, in the default css at the top of the stylesheet (check if you don...
Web API reference - Web technology reference
Web › Reference › API
there's also a listing of all available events in the event reference. ...
....g. ...
...ty api, device orientation api, screen orientation api, vibration api. ...
<a> - SVG: Scalable Vector Graphics
Web › SVG › Element › a
elf; animatable: yes type a mime type for the linked url. value type: <string> ; default value: none; animatable: yes xlink:href deprecated since svg 2 the url or url fragment that the hyperlink points to. may be required for backwards compatibility for older browsers. ...
...y, 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-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <fo...
<circle> - SVG: Scalable Vector Graphics
Web › SVG › Element › circle
lue type: <length> ; default value: 0; animatable: yes pathlength the total length for the circle's circumference, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2, cx, cy, and r are geometry properties, meaning those attributes can also be used as css properties for that element. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector grap...
<ellipse> - SVG: Scalable Vector Graphics
Web › SVG › Element › ellipse
e> ; default value: auto; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2 cx, cy, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector grap...
<foreignObject> - SVG: Scalable Vector Graphics
alue type: <length>|<percentage> ; default value: 0; animatable: yes y the y coordinate of the foreignobject. value type: <length>|<percentage> ; default value: 0; animatable: yes note: starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
... candidate recommendation ...
<g> - SVG: Scalable Vector Graphics
Web › SVG › Element › g
vg { 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: requiredextensions, systemlanguage event attributes global event attributes, graphical event attributes presentation attributes most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <...
<line> - SVG: Scalable Vector Graphics
Web › SVG › Element › line
value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes y2 defines the y-axis coordinate of the line ending point. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes pathlength defines the total path length in user units. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector grap...
<marker> - SVG: Scalable Vector Graphics
Web › SVG › Element › marker
able: yes refy this attribute defines the y coordinate for the reference point of the marker. value type: top|center|bottom|<coordinate> ; default value: 0; animatable: yes viewbox this attribute defines the bound of the svg viewport for the current svg fragment. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <fo...
<path> - SVG: Scalable Vector Graphics
Web › SVG › Element › path
q 90,60 50,90 q 10,60 10,30 z"/> </svg> attributes d this attribute defines the shape of the path. value type: <string> ; default value: ''; animatable: yes pathlength this attribute lets authors specify the total length for the path, in user units. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, 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 elementsdescriptive elements specifications specification status comment svg pathsthe definition of '<path>' in th...
<polygon> - SVG: Scalable Vector Graphics
Web › SVG › Element › polygon
attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. value type: <number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector grap...
<polyline> - SVG: Scalable Vector Graphics
Web › SVG › Element › polyline
attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polyline value type: <number>+ ; default value: ""; animatable: yes pathlength this attribute lets specify the total length for the path, in user units. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector grap...
<rect> - SVG: Scalable Vector Graphics
Web › SVG › Element › rect
; default value: auto; animatable: yes pathlength the total length of the rectangle's perimeter, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2, x, y, width, height, rx and ry are geometry properties, meaning those attributes can also be used as css properties for that element. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector grap...
<svg> - SVG: Scalable Vector Graphics
Web › SVG › Element › svg
e> ; default value: 0; animatable: yes y the displayed y coordinate of the svg container. no effect on outermost svg elements. value type: <length>|<percentage> ; default value: 0; animatable: yes note: starting with svg2, x, y, width, and height are geometry properties, meaning these attributes can also be used as css properties. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <...
<text> - SVG: Scalable Vector Graphics
Web › SVG › Element › text
animatable: yes lengthadjust how the text is stretched or compressed to fit the width defined by the textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. ...
...nant-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-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, 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 elementsdescriptive elementstext content elements<a> specifications specification status comment ...
<textPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › textPath
able: yes startoffset how far the beginning of the text should be offset from the beginning of the path. value type: <length>|<percentage>|<number> ; default value: 0; animatable: yes textlength the width of the space into which the text will render. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, 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:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> ...
<tspan> - SVG: Scalable Vector Graphics
Web › SVG › Element › tspan
animatable: yes lengthadjust how the text is stretched or compressed to fit the width defined by the textlength attribute. value type: spacing|spacingandglyphs; default value: spacing; animatable: yes textlength a width that the text should be scaled to fit. ...
...nant-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-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, 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:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> specifications speci...
<use> - SVG: Scalable Vector Graphics
Web › SVG › Element › use
es note: width, and height have no effect on use elements, unless the element referenced has a viewbox - i.e. they only have an effect when use refers to a svg or symbol element. note: starting with svg2, x, y, width, and height are geometry properties, meaning those attributes can also be used as css properties for that element. ...
...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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, 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 elementsdescriptive elements specifications specificat...
For Further Reading - XSLT: Extensible Stylesheet Language Transformations
logies, many of which become the de-facto standard. articles hands-on xsl author: don r. day location: http://www-106.ibm.com/developerwork...-hands-on-xsl/ understanding xslt author: jay greenspan location: http://hotwired.lycos.com/webmonkey/...l?tw=authoring what is xslt? author: g. ...
....ibm.com/developerwork...-hands-on-xsl/ understanding xslt author: jay greenspan location: http://hotwired.lycos.com/webmonkey/...l?tw=authoring what is xslt? author: g. ...
... what is xslt? author: g. ...
clipboard - Archive of obsolete content
pboard = require("sdk/clipboard"); clipboard.set("lorem ipsum dolor sit amet"); var contents = clipboard.get(); set the clipboard contents to some html. var clipboard = require("sdk/clipboard"); clipboard.set("<blink>lorem ipsum dolor sit amet</blink>", "html"); if the clipboard contains html content, open it in a new tab. var clipboard = require("sdk/clipboard"); if (clipboard.currentflavors.indexof("html") != -1) require("sdk/tabs").open("data:text/html;charset=utf-8," + clipboard.get("html")); set the clipboard contents to an image. var clipboard = require("sdk/clipboard"); clipboard.set("data:image/png;base64,ivborw0kggoaaaansuheugaaacaaaaagcaya" + "aabzenr0aaaasuleqvryhe3o0qkaiawd0eyqe3q993aq3cbsukpygfsnty" + "n5ugbqpk0baadgp0brdwxwlweaaaaagpsa3rzdaaaaah...
....set("data:image/png;base64,ivborw0kggoaaaansuheugaaacaaaaagcaya" + "aabzenr0aaaasuleqvryhe3o0qkaiawd0eyqe3q993aq3cbsukpygfsnty" + "n5ugbqpk0baadgp0brdwxwlweaaaaagpsa3rzdaaaaahgpcgrpganzq2fg" + "bwrr9aaaaabjru5erkjggg%3d%3d"); if the clipboard contains an image, open it in a new tab. var clipboard = require("sdk/clipboard"); if (clipboard.currentflavors.indexof("image") != -1) require("sdk/tabs").open(clipboard.get()); as noted before, data type can be easily omitted for images. if the intention is set the clipboard to a data url as string and not as image, it can be done by specifying a different flavor, like text. var clipboard = require("sdk/clipboard"); clipboard.set("data:image/png;base64,ivborw0kggoaaaansuheugaaacaaaaagcaya" + ...
tabs - Archive of obsolete content
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. ...
...tion instead. contenttype this is currently an experimental api, so we might change it in future releases. returns the mime type that the document currently loaded in the tab is being rendered as. this may come from http headers or other sources of mime information, and might be affected by automatic type conversions performed by either the browser or extensions. this property is read-only. index the index of the tab relative to other tabs in the application window. this property can be set to change its relative position. ispinned whether or not this tab is pinned as an app tab. this property is read-only. window the window object for this tab. readystate new in firefox 33. a string telling you the load state of the document hosted by this tab. this corresponds directly to docu...
Using third-party modules (jpm) - Archive of obsolete content
current directory, under a directory called "node_modules". the --save argument instructs npm to add this package to the dependencies key in the add-on's package.json file. you'll now see a new directory in "my-menuitem" called "node_modules". ...
...ee a new directory in "my-menuitem" called "node_modules". it will contain a single directory "addon-pathfinder", and the modules included in this package will be somewhere in that directory: my-menuitem index.js node_modules menuitem package.json test we're interested in using the "menuitem" module, which is at "addon-pathfinder/lib/ui/menuitem". open "index.js" and replace it with this: var menuitems = require("menuitem"); var menuitem = menuitems.menuitem({ id: "clickme", menuid: "menu_toolspopup", label: "click me!", oncommand: function() { console.log("clicked"); }, insertbefore: "menu_pageinfo" }); now run the add-on: jpm run -b nightly you should see a new menu item in the tools menu labeled "click me!". click the button, a...
Miscellaneous - Archive of obsolete content
rg/appshell/window-mediator;1"].getservice(ci.nsiwindowmediator); var mainwindow = wm.getmostrecentwindow("navigator:browser"); //get sessionhistory from the current selected tab var history = mainwindow.gbrowser.selectedbrowser.webnavigation.sessionhistory; and then get the page you want, and it's postdata. this example obtains the post data of the last page. var postdata = history.getentryatindex(history.index-1,false).queryinterface(ci.nsishentry).postdata; if you got here all by yourself, your problem must be at reading the postdata, because it's a nsiinputstream object, whose available function always returns 0. and if you read it directly, you always got nothing. and here's how it's done postdata.queryinterface(ci.nsiseekablestream).seek(ci.nsiseekablestream.ns_seek_set, 0); var st...
...nt/certs" + certname, null, null); var input=channel.open(); scriptablestream.init(input); var certfile=scriptablestream.read(input.available()); scriptablestream.close(); input.close(); var begincert = "-----begin certificate-----"; var endcert = "-----end certificate-----"; certfile = certfile.replace(/[\r\n]/g, ""); var begin = certfile.indexof(begincert); var end = certfile.indexof(endcert); var cert = certfile.substring(begin + begincert.length, end); certdb.addcertfrombase64(cert, certtrust, ""); }, classdescription: "certificate service", contractid: "@mozilla.org/certs-service;2", classid: components.id("{e9d2d37c-bf25-4e37-82a1-16b8fa089939}"), queryinterface: xpcomutils.generateqi([ci.nsio...
Windows - Archive of obsolete content
ditionally, 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. ...
...t doesn't, it opens one. var wenum = components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getservice(components.interfaces.nsiwindowwatcher) .getwindowenumerator(); var index = 1; var windowname = "yourwindowname"; while (wenum.hasmoreelements()) { var win = wenum.getnext(); if (win.name == windowname) { win.focus(); return; } index++ } window.open("chrome://to/your/window.xul", windowname, "features"); uniquely identifying dom windows requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1) in gecko, each dom window has a unique 64-bit id number. you can get a dom window's id using the nsidomwindowutils attribute outerwindowid. each time a new window is created, it gets assigned an id one greater than the las...
Adding sidebars - Archive of obsolete content
you'll need finer grained control than the one provided by a tabbox. in these cases the « xul reference « and « xul reference « elements are probably what you're looking for. they are extremely useful, and you'll find yourself using them in many situations besides sidebars. a deck is like a tabbbox without the tabs. it only displays one of its child nodes at a time, depending on its selectedindex value. in the following example, the second child will be displayed, not the first which would be the default. <deck selectedindex="2"> <hbox> <!-- content for the first child. --> </hbox> <hbox> <!-- content for the second child. --> </hbox> </deck> note how this is one of the few cases where an attribute of an element is named using camel case instead of all small caps. ...
...o different purposes, and the only difference between the two cases is a label that has a value in one case and something else in another. using a .properties file and a string bundle is a viable option, but it involves a lot of code for something so simple, specially if that's the only case where you need dynamic text. the alternative is to use a deck with the two labels, and change the selected index depending on the purpose of the window. this way you can still use dtd, and the code remains simple. a stack is like a deck, except that all of its children are always on display, one of top of the other. it allows you to decompose complex ui into individual layers, broadening the layout possibilities. one common use for a stack is to have an image background that stretches horizontally and vert...
XPCOM Objects - Archive of obsolete content
need to be publicized are exposed through xpcom components and interfaces. you can think of xpcom as a reference to all the capabilities available on the lower layers of firefox. using xpcom components is relatively simple, as you've seen in previous examples. this.obsservice = cc["@mozilla.org/observer-service;1"].getservice(ci.nsiobserverservice); the cc object (components.classes) is an index to static objects and class definitions available through xpcom. the string between the brackets is just an identifier, in this case corresponding to the observer service. you'll usually know what string to use by reading examples and documentation. there is no comprehensive list of these (that we know of), and that's understandable since it would be a very long list, and it can be extended by ad...
...classes, just like the objects we handle in js. the method you call on 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 snippet 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 ...
Promises - Archive of obsolete content
f files) { let data = yield os.file.read(file); processor.add(data); } // now write the processed files back out, as a binary blob. yield os.file.writeatomic(config.processedpath, processor.process(), { tmppath: config.processedpath + "." + math.random() }); // and write out a new config file. config.indexstats = processor.stats; yield os.file.writeatomic(configpath, json.stringify(config), { tmppath: configpath + "." + math.random(), encoding: "utf-8" }) timestamp = new date; }); http requests http requests should, in nearly all circumstances, be made via the standard xmlhttprequest api. while this api does not have direct su...
...row: row => { runtask(row.getresultbyname("task"), row.getresultbyname("group")); } }); // and quickly grab a single row value. let [row] = yield db.execute( "select value from nodes where key = 'timestamp' \ order by value desc limit 1"); latesttimestamp = row.getresultbyindex(0); } finally { // make sure to close the database when finished. // failure to do this will prevent firefox from shutting down // cleanly. yield db.close(); } }); promise wrappers and helpers the following are some example promise-based wrappers for common callback-based asynchronous apis. addonmanager var aom = { __proto__: addonmanager, ...
Creating regular expressions for a microsummary generator - Archive of obsolete content
m/.*qqitemz.*qqcmdzviewitem in this expression, we use .* twice, since there are two places where there may be some characters that vary between auction item urls. handling https urls note: although ebay doesn't do this, occasionally a site will make pages available at both insecure and secure urls. ...
...s expression, we use .* twice, since there are two places where there may be some characters that vary between auction item urls. handling https urls note: although ebay doesn't do this, occasionally a site will make pages available at both insecure and secure urls. for example, both of the following urls might point to the same page: http://www.example.com/index.html https://www.example.com/index.html to make a regular expression that matches both pages, we just need to start the expression with "https" and then add a question mark (?) after that string, for example: ^https?://www\.example\.com/index\.html the question mark makes the previous character optional, so the regular expression matches strings that include the "s" in "https" as well as ones that don't. conclusion if we i...
Monitoring downloads - Archive of obsolete content
tatement("select * from items"); // get all items in table try { while (statement.executestep()) { var row = document.createelement('listitem'); // add the cells to the row var cell = document.createelement('listcell'); var sourcestr = statement.getstring(0); row.setattribute("tooltiptext", sourcestr); sourcestr = sourcestr.slice(sourcestr.lastindexof("/")+1); cell.setattribute("label", sourcestr); // source row.appendchild(cell); cell = document.createelement('listcell'); cell.setattribute("label", (statement.getint64(1) / 1024).tofixed(1) + "kb"); // size cell.setattribute("style", "text-align:right"); row.appendchild(cell); var thedate = new date(statement.getint64(2) / 1000); ...
...ow of the results is fetched. after that, the list row object is created, and each entry in the search result is fetched and inserted into the appropriate list cell. the interesting bits to take away from this: mozistoragestatement has several data getter routines for fetching search results, including getstring(), getdouble(), and getint64(). these methods take as a parameter the zero-based index number of the column whose value you wish to retrieve. note that the start time is being divided by 1000 before we create a javascript date object from it. that's to adjust the value from the granularity stored in the database to that expected by javascript. to right-justify the numeric columns, we set the appropriate cells' style attribute to text-align:right. exercises for the reader there...
How to implement a custom XUL query processor component - Archive of obsolete content
e string value getbindingobjectfor: function(avar) { return null; }, // called when a rule matches this item. ...
...ved and the result is no longer being used by the builder hasbeenremoved: function() { } }; // basic wrapper for nsisimpleenumerator function templateresultset(aarrayofdata) { this._index = 0; this._array = aarrayofdata; } templateresultset.prototype = { queryinterface: xpcomutils.generateqi([components.interfaces.nsisimpleenumerator]), hasmoreelements: function() { return this._index < this._array.length; }, getnext: function() { return new templateresult(this._array[this._index++]); } }; // the query processor class - implements nsixultemplatequeryprocessor function templatequeryprocessor() { // our basic list of data this._data = [ {name: "mark", age: 36, hair: "brown", eye: "brown"}, {name: "bill", age: 25, hair: "red", eye:...
getSessionResultAt - Archive of obsolete content
...
... ...
getSessionStatusAt - Archive of obsolete content
...
... ...
getSessionValueAt - Archive of obsolete content
...
... ...
moveTabTo - Archive of obsolete content
...
... ...
setSelectionRange - Archive of obsolete content
set both arguments to the same value to move the cursor to the corresponding position without selecting text. ...
...set both arguments to the same value to move the cursor to the corresponding position without selecting text. ...
MenuModification - Archive of obsolete content
be appended to this existing one. while the appenditem method always adds the new item to the end of the menu, the insertitemat method may be used in a similar fashion to insert an item into the menu elsewhere. menu.insertitemat(0, "delete", "delete"); in this example, the insertitemat method is used to insert a new 'delete' item at the beginning of the menu's popup. the first argument is the index where the new item should be inserted. in this case, 0 is supplied as the index, which means before the first item. indicies are counted starting at 0, so to insert an item before the fourth item pass 3 as the argument. the second and third arguments to insertitemat are the label and value for the new item, as with appenditem. both the appenditem and insertitemat methods return the new menuitem,...
...); } </script> the haschildnodes method may be used to check if a node has any children. the first time the function is called, the haschildnodes method will return false, however the second time, the method will return true as the items have already been added to the menu. removing items from a menu to remove an item from the menu, use the removeitemat method. it takes a single argument, the index of the item to remove. in this example, an item is appended to a menu, and then immediately removed again. menu.appenditem("open", ""); menu.removeitemat(menu.itemcount - 1); the itemcount property holds the number of items within the menu. to remove all of the items from a menu, you may wish to simply remove the menupopup directly, instead of removing each item individually. ...
Menus - Archive of obsolete content
th the up or down arrow on the keyboard, then pressing the return key or right arrow key will open the menu. if it were a menuitem, then pressing the return key would have launched the command associated with it. there may be occasion to access or set this programatically with a script. if the menu has been created using a menulist, this is easily accomplished using the selecteditem or selectedindex properties. however, it is not possible to use these properties for menus whose popup is the child of menu, button, or toolbarbutton. however, there is a way to access the active item using the nsimenuboxobject interface: activeitem = xulmenu.boxobject.queryinterface(components.interfaces.nsimenuboxobject).activechild; where xulmenu is the menu, button, or toolbarbutton object. you can set ...
...l will deactivate all items, and keyboard navigation will start from the top of the menu. it should be noted that setting the active item in this way will not affect the selected property or selected attribute of the previously and newly activated item. you must unset/set those explicity for each item affected, if you want them to be. for menulists, however, setting the selecteditem or selectedindex properties on the menu will automatically take care of that for you. ...
Commands - Archive of obsolete content
the supportscommand method returns true for the '...
...e, the following example will disable pasting into a textbox. var tboxcontroller = { supportscommand : function(cmd){ return (cmd == "cmd_paste"); }, iscommandenabled : function(cmd){ return false; }, docommand : function(cmd){ }, onevent : function(evt){ } }; document.getelementbyid("tbox").controllers.insertcontrollerat(0,tboxcontroller); in this example, we insert the controller at index 0, which means before any others. the new controller supports the 'cmd_paste' command and always indicates that the command is disabled. the default textbox controller never gets called because the command dispatcher found the controller above to handle the command first. next, we'll find out how to update commands. « previousnext » ...
Content Panels - Archive of obsolete content
layed 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. ...
...this example isn't functionally complete. next, we would want to add script 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. ...
Tree Box Objects - Archive of obsolete content
functions which may be used to get the parts of the tree at specific coordinates and vice versa. the getcellat() function may be used to get the cell at specific pixel location the getrowat() function may be used to get a row at a specific location. the getrowat() function takes two arguments, the x and y coordinates to use. tree.boxobject.getrowat( 50, 100 ); this example will return the index of the row with a horizontal position of 50 and a vertical position of 100. naturally, it doesn't really matter what the value of the x coordinate is since rows always take up the entire horizontal space of the tree. one important thing to note is that the coordinates are measured from the upper left corner of the containing document, not the edge of the tree itself. this makes it easy to pass ...
...u will see a number of interfaces that use out parameters in the xulplanet object reference (fixme: deadlink). these are indicated by the word 'out' before the argument. for these, you will need to supply an empty object and the function will fill in the 'value' property with the necessary value. the three out parameters will be filled in with the row, the column and a child type. the row is the index of the row the mouse is over, since we call it with the event coordinates of a mousemove event. if the coordinate is not over a row, the row value will be set to -1. the column is a column object in mozilla 1.8 and later. in earlier versions, columns are identified with a string, the id of the column. in later versions, a separate column object exists, which can be queried for column data. the f...
XUL Changes for Firefox 1.5 - Archive of obsolete content
tion, see preferences system. bfcache mozilla now caches the page's dom, so that navigating back and forward does not reload the page, making navigation much more efficient. the pageshow and pagehide events are used when switching from a page in the cache, while the load and unload events are used only when the page is loaded or unloaded. for more information see using firefox 1.5 caching. tabindex the tabindex property is now applied to most elements. <radiogroup> setting the value property on the <radiogroup> element selects the <radio> element in the group with the corresponding value. dialog: defaultbutton property the <dialog> binding now supports the defaultbutton property. setting this property changes the default button of the dialog. it can be set either to one of the buttons ...
...is has been fixed in firefox 1.5 and all code depending on this non zero-based behaviour should be changed. <stringbundle> the <stringbundle> element has a strings property which may be used to retrieve an enumeration of all of the strings in the bundle. draggable tabs the tabbrowser now allows the user to rearrange tabs by dragging them. <tabbox> the <tabbox> element now supports a selectedindex attribute to specify the tab to be selected by default. loading overlays dynamically xul now supports loading overlays dynamically with the document.loadoverlay function. original document information author(s): neil deakin ...
XUL Questions and Answers - Archive of obsolete content
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 javascript? to set the background color you need to set the property for the cell/row and not for the item. ...
...tributes 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 javascript? to set the background color you need to set the property for the cell/row and not for the item. ...
browser - Archive of obsolete content
properties accessibletype, cangoback, cangoforward, contentdocument, contentprincipal, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, messagemanager, preferences, securityui, sessionhistory, webbrowserfind, webnavigation, webprogress methods addprogresslistener, goback, goforward, gohome, gotoindex, loaduri, loaduriwithflags, reload, reloadwithflags, removeprogresslistener, stop, swapdocshells examples <!-- shows mozilla homepage inside a groupbox --> <groupbox flex="1"> <caption label="mozilla homepage"/> <browser type="content" src="http://www.mozilla.org" flex="1"/> </groupbox> attributes autocompleteenabled type: boolean set to true to enable autocomplete of fields.
...progress listener to the browser which will monitor loaded documents. the progress listener should implement the nsiwebprogresslistener interface. goback() return type: no return value go back one page in the history. goforward() return type: no return value go forward one page in the history. gohome() return type: no return value load the user's home page into the browser. gotoindex( index ) return type: no return value navigate to the page in the history with the given index. use a positive number to go forward and a negative number to go back. note: this is the xul method on <browser> / <tabbrowser>, not the global function in chrome://browser/content/browser.js. please check which one you're documenting! (this one has no post data parameter, see loaduriwithflags for a ...
tabpanels - Archive of obsolete content
me people like to use tabpanel elements. by clicking the first tab, the first panel will be displayed. by clicking the second tab, the second panel will be displayed and so on. there should be the same number of panels as there are tabs. panels should never be hidden; hiding the tab suffices to make the panel inaccessible. more information is available in the xul tutorial. attributes selectedindex properties selectedindex, selectedpanel examples (example needed) attributes selectedindex type: integer gets and sets the index of the currently selected panel. the first item is at index 0. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, ...
...minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties accessible type: nsiaccessible returns the accessibility object for the element. selectedindex type: integer returns the index of the currently selected item. you may select an item by assigning its index to this property. by assigning -1 to this property, all items will be deselected. returns -1 if no items are selected selectedpanel type: element holds a reference to the currently selected panel within a <tabbox> element. assigning a value to this property will modif...
toolbar - Archive of obsolete content
n a toolbar is first displayed. in 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. ...
...ubar" and a menubar element. currentset not in seamonkey 1.x type: comma-separated string the current set of displayed items on the toolbar. this will be modified when the user customizes the toolbar. the value of this attribute should be a comma-separated list of item ids from the toolbarpalette or, additionally, any of the following strings: "separator", "spring", "spacer". customindex not in seamonkey 1.x type: integer this value is the index of the toolbar in the list of the custom toolbars. the value is updated automatically by the toolbar customization dialog. customizable not in seamonkey 1.x type: boolean set this attribute to true on toolbars that can be customized. this causes the set of buttons to be persisted across sessions. defaultset not in seamo...
Browser Feature Detection - Archive of obsolete content
rue stress true false false tablelayout true true true textshadow true false true top true true true unicodebidi true true true visibility true true true voicefamily true false true volume true false true widows true false true zindex true true true test code // document properties that are used to determine // support levels var _features = { 'domcore1': [ {name: 'doctype', 'supported': false}, {name: 'implementation', 'supported': false}, {name: 'documentelement', 'supported': false}, {name: 'createelement', 'supported': false}, {name: 'createdocumentfragment', 'supported': false}, {name: 'creat...
... false}, {name: 'stress', 'supported': false}, {name: 'tablelayout', 'supported': false}, {name: 'textshadow', 'supported': false}, {name: 'top', 'supported': false}, {name: 'unicodebidi', 'supported': false}, {name: 'visibility', 'supported': false}, {name: 'voicefamily', 'supported': false}, {name: 'volume', 'supported': false}, {name: 'widows', 'supported': false}, {name: 'zindex', 'supported': false} ] }; function supports(object, featureset) { var i; var features = _features[featureset]; var level = 0; if (!features) return level; for (i = 0; i < features.length; i++) if (typeof(object[features[i].name]) != 'undefined') { features[i].supported = true; ++level; } return math.floor( (100 * level) / features.length ); } function generatereport...
Array.unobserve() - Archive of obsolete content
anonymous function, because this reference will be used to unset the previous observer. it's useless to call array.unobserve() with an anonymous function as callback, it will not remove any observer. ...
...array.observe(arr, observer); ​ arr.push(4); // [{type: "splice", object: <arr>, index: 3, removed:[], addedcount: 1}] array.unobserve(arr, observer); arr.pop(); // the callback wasn't called using an anonymous function var persons = ['khalid', 'ahmed', 'mohammed']; array.observe(persons, function (changes) { console.log(changes); }); persons.shift(); // [{type: "splice", object: <arr>, index: 0, removed: [ "khalid" ], addedcount: 0 }] array.unobserve(persons, function (changes) { console.log(changes); }); persons.push('abdullah'); // [{type: "splice", object: <arr>, index: 2, removed: [], addedcount: 1 }] // the callback will always be called ...
VBArray.ubound - Archive of obsolete content
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 "subscript out of range" error. ...
...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 "subscript out of range" error. ...
JSObject - Archive of obsolete content
of javascript source code which will be evaluated in the context given by "this". declaration public object eval(string s) getmember method. retrieves the value of a property of a javascript object. equivalent to "this.name" in javascript. declaration public object getmember(string name) getslot method. retrieves the value of an array element of a javascript object. equivalent to "this[index]" in javascript. declaration public object getslot(int index) getwindow static method. returns a jsobject for the window containing the given applet. this method is useful in client-side javascript only. declaration public static jsobject getwindow(applet applet) removemember method. removes a property of a javascript object. declaration public void removemember(string name) setmemb...
...vemember method. removes a property of a javascript object. declaration public void removemember(string name) setmember method. sets the value of a property of a javascript object. equivalent to "this.name = value" in javascript. declaration public void setmember(string name, object value) setslot method. sets the value of an array element of a javascript object. equivalent to "this[index] = value" in javascript. declaration public void setslot(int index, object value) tostring method. converts a jsobject to a string. overrides: tostring in class java.lang.object declaration public string tostring() ...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
to advertise through jaxer using the data from the database we captured from prior form submissions. ...
...jaxer using the data from the database we captured from prior form submissions. listing 10 - creating a simple xml service <script runat="server"> var rs_comments = jaxer.db.execute("select * from comments"); var doc = document.implementation.createdocument('', 'comments', null); var root = doc.documentelement; rs_comments.rows.foreach(function(row, index) { if (true || index < 10) { var node = doc.createelement('comment'); node.setattribute('id', row.id); node.setattribute('name', row.name); node.setattribute('message', row.message); root.appendchild(node); } }); jaxer.response.exit(200, doc); </script> the data from the database is represented in xml format as follows: <comments> <comment message="”jaxer" name="”nigel" id="”1”"></comment> ... more comment...
Archive of obsolete content
ature or api, and how it worked. there are many reasons older documentation can be useful. so, we've established this area into which we can archive older documentation. material in this archived content zone should not be used for building new web sites or apps for modern browsers. it's here for historical reference only. see the complete index of archived content note to writers: we need to try to keep the subpages here organized instead of all dumped into one large folder. try to create subtrees for categories of material. also, only move pages here that are extremely obsolete. if anyone might realistically need the information in a living product, it may not be appropriate to move it here. ...
...book is to help you update websites to work with standards-based browsers and properly detect gecko. getting the page url in npapi plugin sometimes, you want to restrict an npapi plugin to be loadable only from a certain url or domain or scheme. or whenever you make network requests yourself, you almost always need to enforce same-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. jxon jxon (lossless javascript xml object notation) is a generic...
Introduction to game development for the Web - Game development
let's look at how the web can help you. the reach of the web is enormous; it's everywhere. games built with html5 work on smartphones, tablets,...
... game, you'll need this api. html and css together, these two technologies let you build, style, and lay out your game's user interface. part of html is the <canvas> element, which provides one way to do 2d graphics. html audio the <audio> element lets you easily play simple sound effects and music. if your needs are more involved, check out the web audio api for real audio processing power! indexeddb a powerful data storage api for maintaining user data on their own computer or device. a great way to save game state and other information locally so it doesn't have to be downloaded every time it's needed. also useful to help make your game playable even when the user isn't connected to the web (such as when they're stuck on an airplane for hours on end). javascript javascript, the progr...
GLSL Shaders - Game development
ement in the <head> includes the three.js library in the page; we will write our code into three script tags in the <body> tag: the first one will contain the vertex shader. the second one will contain the fragment shader. the third one will contain the actual javascript code generating the scene. before reading on, copy this code to a new text file and save it in your working directory as index.html. we'll create a scene featuring a simple cube in this file to explain how the shaders work. the cube's source code instead of creating everything from scratch we can reuse the building up a basic demo with three.js source code of the cube. most of the components like the renderer, camera, and lights will stay the same, but instead of the basic material we will set the cube's color and posi...
...ith three.js source code of the cube. most of the components like the renderer, camera, and lights will stay the same, but instead of the basic material we will set the cube's color and position using shaders. go to the cube.html file on github, copy all the javascript code from inside the second <script> element, and paste it into the third <script> element of the current example. save and load index.html in your browser — you should see a blue cube. the vertex shader code let's continue by writing a simple vertex shader — add the code below inside the body's first <script> tag: void main() { gl_position = projectionmatrix * modelviewmatrix * vec4(position.x+10.0, position.y, position.z+5.0, 1.0); } the resulting gl_position is calculated by multiplying the model-view and the projec...
Create the Canvas and draw on it - Game development
nvas-workshop/lesson1.html. before we can start writing the game's functionality, we need to create a basic structure to render the game inside. this can be done using html and the <canvas> element. the game's html the html document structure is quite simple, as the game will be rendered entirely on the <canvas> element. ...
...byid("mycanvas"); var ctx = canvas.getcontext("2d"); here we're storing a reference to the <canvas> element to the canvas variable. then we're creating the ctx variable to store the 2d rendering context — the actual tool we can use to paint on the canvas. let's see an example piece of code that prints a red square on the canvas. add this below your previous lines of javascript, then load your index.html in a browser to try it out. ctx.beginpath(); ctx.rect(20, 40, 50, 50); ctx.fillstyle = "#ff0000"; ctx.fill(); ctx.closepath(); all the instructions are between the beginpath() and closepath() methods. we are defining a rectangle using rect(): the first two values specify the coordinates of the top left corner of the rectangle on the canvas, while the second two specify the width and height...
Initialize the framework - Game development
nctionality, we need to create a basic structure to render the game inside. this can be done using html — the phaser framework will generate the required <canvas> element. the game's html the html document structure is quite simple, as the game will be rendered entirely on the <canvas> element generated by the framework. ...
...haser (v3). the v2 library is still available on the phaser download page, below the links for the v3 download. go to the phaser download page. choose an option that suits you best — i would recommend the min.js option as it keeps the source code smaller, and you are unlikely need to go through the source code anyway. save the phaser code inside a /js directory in the same location as your index.html file. update the src value of the first <script> element as shown above. walking through what we have so far at this point we have a charset defined, <title> and some basic css in the header to reset the default margin and padding. we also have a <script> element to apply the phaser source code to the page. the body contains a second <script> element, where we will write the javascript c...
Load the assets and print them on screen - Game development
parameter is the relative path to the graphic asset. in our case, we will load the image for our ball. (note that the file name does not also have to be the same, but we'd recommend it, as it makes everything easier to follow.) of course, to load the image, it must be available in our code directory. grab the ball image from github, and save it inside an /img directory in the same place as your index.html file. now, to show it on the screen we will use another phaser method called add.sprite(); add the following new code line inside the create() function as shown: function create() { ball = game.add.sprite(50, 50, 'ball'); } this will add the ball to the game and render it on the screen. the first two parameters are the x and y coordinates of the canvas where you want it added, and t...
...prite(); add the following new code line inside the create() function as shown: function create() { ball = game.add.sprite(50, 50, 'ball'); } this will add the ball to the game and render it on the screen. the first two parameters are the x and y coordinates of the canvas where you want it added, and the third one is the name of the asset we defined earlier. that's it — if you load your index.html file you will see the image already loaded and rendered on the canvas! compare your code you can check the finished code for this lesson for yourself in the live demo below, and play with it to better understand how it works: next steps printing out the ball was easy; next, we'll try moving the ball on screen. « previousnext » ...
Player paddle and controls - Game development
we can use the world.width and world.height values to position the paddle exactly where we want it: game.world.width*0.5 will be right in the middle of the screen. in our case the world is the same as the canvas, but for other types of games, like side-scrollers for example, the world will be bigger, and you can tinker with it to create interesting effects. as you'll notice if you reload your index.html at this point, the paddle is currently not exactly in the middle. why? because the anchor from which the position is calculated always starts from the top left edge of the object. we can change that to have the anchor in the middle of the paddle's width and at the bottom of it's height, so it's easier to position it against the bottom edge. add the following line below the previous new one: ...
...t's x position, however when we start the game, the position of the paddle is not in the middle. it's because the input position is not yet defined. to fix that we can set the default position (if an input position is not yet defined) to be the middle of the screen. update the previous line as follows: paddle.x = game.input.x || game.world.width*0.5; if you haven't already done so, reload your index.html and try it out! position the ball we have the paddle working as expected, so let's position the ball on it. it's very similar to positioning the paddle — we need to have it placed in the middle of the screen horizontally and at the bottom vertically with a little offset from the bottom. to place it exactly as we want it we will set the anchor to the exact middle of the ball. find the exi...
2D maze game with device orientation - Game development
online documentation and go through the big collection of examples. the phaser framework provides you with a set of tools that will speed up development and help handle generic tasks needed to complete the game, so you can focus on the game idea itself. starting with the project you can see cyber orb 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 javascript files with all the source code of the game defined inside. audio: the sound files used in the game.
...also three folders in the directory: img: all the images that we will use in the game. src: the javascript 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 html> <html> <head> <meta charset="utf-8" /> <title>cyber orb demo</title> <style> body { margin: 0; background: #333; } </style> <script src="src/phaser-arcade-physics.2.2.2.min.js"></script> <script src="src/boot.js"></script> <script src="src/preloader.js"></script...
Origin - MDN Web Docs Glossary: Definitions of Web-related terms
web content's origin is defined by the scheme (protocol), host (domain), and port of the url used to access it. two objects have the same origin only when the scheme, host, and port all match. some operations are restricted to same-origin content, and this restriction can be lifted using cors. ...
... web content's origin is defined by the scheme (protocol), host (domain), and port of the url used to access it. two objects have the same origin only when the scheme, host, and port all match. some operations are restricted to same-origin content, and this restriction can be lifted using cors. ...
MDN Web Docs Glossary: Definitions of Web-related terms
houdini hpkp hsts html html5 http http header http/2 http/3 https hyperlink hypertext i i18n iana icann ice ide idempotent identifier idl ietf iife imap immutable index indexeddb information architecture inheritance input method editor instance internationalization internet intrinsic size ip address ipv4 ipv6 irc iso isp itu j jank java javascript jpeg jquery j...
...simd simple header simple response header sisd site site map sld sloppy mode slug smoke test smpte (society of motion picture and television engineers) smtp snap positions soap spa (single-page application) specification speculative parsing speed index sql sql injection sri stacking context state machine statement static method static typing strict mode string stun style origin stylesheet svg svn symbol symmetric-key cryptography synchronous syntax syntax error ...
CSS and JavaScript accessibility best practices - Learn web development
; the first two lines run the functions when the mouse pointer hovers over and stops hovering over the thumbnail, respectively. this won't allow us to access the zoomed view by keyboard though — to allow that, we've included the last two lines, which run the functions when the image is focused and blurred (when focus stops). ...
...e, because we've included tabindex="0" on it. the click event is interesting — it sounds mouse-dependent, but most browsers will activate onclick event handlers after enter/return is pressed on a link or form element that has focus, or when such an element is tapped on a touchscreen device. this doesn't work by default however when you allow a non-default-focusable event to have focus using tabindex — in such cases you need to detect specifically when that exact key is pressed (see building keyboard accessibility back in). 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: css and javascript accessibility.
Advanced styling effects - Learn web development
we will cover these in detail i...
...we will cover these in detail in our css layout module. css shapes while it is true that everything in css is a rectangular box, and images are a physical rectangular box, we can make it look as if our content flows around non-rectangular things by using css shapes. ...
Organizing your CSS - Learn web development
tials) these can then all be compiled together into one, or a small number of stylesheets to actually link into your website. ...
...ink into your website. so for example, with partials, you could have several style files inside a directory, say foundation/_code.scss, foundation/_lists.scss, foundation/_footer.scss, foundation/_links.scss, etc., then use the sass @use role to load them into other stylesheets: // foundation/_index.sass @use 'code' @use 'lists' @use 'footer' @use 'links' if the partials are all loaded into an index file, as implied above, you can then load that entire directory into another stylesheet in one go: // style.sass @use 'foundation' note: a simple way to try out sass is to use codepen — you can enable sass for your css in the settings for a pen, and codepen will then run the sass parser for you, in order that you can see the resulting webpage with regular css applied. sometimes you will find...
Getting started with CSS - Learn web development
d, basic knowledge of working with files, and html basics (study introduction to html.) objective: to understand the basics of linking a css document to an html file, and be able to do simple text formatting with css. starting with some html our starting point is an html document. you can copy the code from below if you want to work on your own computer. save the code below as index.html in a folder on your machine. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>getting started with css</title> </head> <body> <h1>i am a level one heading</h1> <p>this is a paragraph of text. in the text is a <span>span element</span> and also a <a href="http://example.com">link</a>.</p> <p>this is the second paragraph. it contains an <em>emphasi...
...es we want it to use. there are three different ways to apply css to an html document that you'll commonly come across, however, for now, we will look at the most usual and useful way of doing so — linking css from the head of your document. create a file in the same folder as your html document and save it as styles.css. the .css extension shows that this is a css file. to link styles.css to index.html add the following line somewhere inside the <head> of the html document: <link rel="stylesheet" href="styles.css"> this <link> element tells the browser that we have a stylesheet, using the rel attribute, and the location of that stylesheet as the value of the href attribute. you can test that the css works by adding a rule to styles.css. using your code editor add the following to your cs...
CSS FAQ - Learn web development
Learn › CSS › Howto › CSS FAQ
ed. for example: -ms-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg); note: for more information on dealing with prefixed properties, see handling common html and css problems — handling css prefixes from our cross-browser testing module. note: see the mozilla css extensions page for more information on the mozilla-prefixed css properties. how does z-index relate to positioning? the z-index property specifies the stack order of elements. an element with a higher z-index/stack order is always rendered in front of an element with a lower z-index/stack order on the screen. z-index will only work on elements that have a specified position (position:absolute, position:relative, or position:fixed). note: for more information, see our positioning lear...
...ifies the stack order of elements. an element with a higher z-index/stack order is always rendered in front of an element with a lower z-index/stack order on the screen. z-index will only work on elements that have a specified position (position:absolute, position:relative, or position:fixed). note: for more information, see our positioning learning article, and in particular the introducing z-index section. ...
create fancy boxes - Learn web development
cy::after { /* this is required to be allowed to display the pseudo-elements, event if the value is an empty string */ content: ''; /* we positionnate our pseudo-elements on the left and right sides of the box, but always at the bottom */ position: absolute; bottom : 0; /* this makes sure our pseudo-elements will be below the box content whatever happens. */ z-index : -1; background-color: #a4c9cf; border-radius: 100%; } .fancy::before { /* this is the size of the clouds left ear */ width : 125px; height : 125px; /* we sligthly move it to the left */ left : -80px; /* to make sure that the bottom of the cloud remains flat, we must make the bottom right corner of the left ear square. */ border-bottom-right-radius: 0; } .fa...
...box-shadow property allow us to create inner light and a flat drop shadow effect, but with some little extra work it becomes possible to create a more natural geometry by using pseudo-element and the transform property. .fancy { position: relative; background-color: #ffc; padding: 2rem; text-align: center; max-width: 200px; } .fancy::before { content: ""; position : absolute; z-index : -1; bottom : 15px; right : 5px; width : 50%; top : 80%; max-width: 200px; box-shadow: 0px 13px 10px black; transform: rotate(4deg); } what's next in many ways, making a fancy box is mostly about adding color and images within the background, so it could worth digging into managing colors and images. also, fancy boxes themselves are quite useless if they are not...
What is the difference between webpage, website, web server, and search engine? - Learn web development
pages, such as google, bing, yahoo, or duckduckgo. search engines are normally accessed through a web browser (e.g. you can perform search engine searches directly in the address bar of firefox, chrome, etc.) or through a web page (e.g. bing.com or duckduckgo.com). let's look at a simple analogy — a public library. this is what you would generally 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 multiple websites. the different sections (science, mat...
... 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 each be found at a unique location (url). the search index is like the search engine. each book has its own unique location in the library (two books cannot be kept at the same place) which is specified by the catalog number. active learning there is no active learning available yet. deeper dive so, let's dig deeper 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 d...
How do I use GitHub Pages? - Learn web development
top of. next, sign up for a github account. it's simple and easy. once you've signed up, log in to github.com with your username and password. preparing your code for upload you can store any code you like in a github repository, but to use the github pages feature to full effect, your code should be structured as a typical website, e.g. with the primary entry point being an html file called index.html. the other thing you need to do before moving on is to initialise your code directory as a git repository. to do this: point the command line to your test-site directory (or whatever you called the directory containing your website). for this, use the cd command (i.e. "change directory"). here's what you'd type if you've put your website in a directory called test-site on your desktop: ...
...ur repository choose settings, then scroll down until you get to the github pages section. underneath source, choose master branch. the page should refresh. go to the github pages section again, and you should see a line of the form "your site is ready to be published at https://xxxxxx." if you click on this url, you should go to a live version of your example, provided the home page is called index.html — it goes to this entry point by default. if your site's entry point is called something else, for example mypage.html, you'll need to go to https://xxxxxx/mypage.html. further github knowledge if you want to make more changes to your test site and upload those to github, you simply need to make the change to your files just like you did before. then, you need to enter the following com...
CSS basics - Learn web development
out! using a text editor, paste the three lines of css (above) into a new file. save the file as style.css in a directory named styles. to make the code work, we still need to apply this css (above) to your html document. otherwise, the styling won't change the appearance of the html. (if you haven't been following our project, pause here to read dealing with files and html basics.) open your index.html file. paste the following line in the head (between the <head> and </head> tags): <link href="styles/style.css" rel="stylesheet"> save index.html and load it in your browser. you should see something like this: if your paragraph text is red, congratulations! your css is working. anatomy of a css ruleset let's dissect the css code for red paragraph text to understand how it works : ...
...y more selectors to discover. to learn more, see the mdn selectors guide. fonts and text now that we've explored some css fundamentals, let's improve the appearance of the example by adding more rules and information to the style.css file. first, find the output from google fonts that you previously saved from what will your website look like?. add the <link> element somewhere inside your index.html's head (anywhere between the <head> and </head> tags). it looks something like this: <link href="https://fonts.googleapis.com/css?family=open+sans" rel="stylesheet"> this code links your page to a style sheet that loads the open sans font family with your webpage. next, delete the existing rule you have in your style.css file. it was a good test, but let's not continue with lots of red...
What’s in the head? Metadata in HTML - Learn web development
sts in browsers). the humble favicon has been around for many years. it is the first icon of this type: a 16-pixel square icon used in multiple places. you may see (depending on the browser) favicons displayed in the browser tab containing each open page, and next to bookmarked pages in the bookmarks panel. ...
...pply, try checking out our css-and-js.html example page. setting the primary language of the document finally, it's worth mentioning that you can (and really should) set the language of your page. this can be done by adding the lang attribute to the opening html tag (as seen in the meta-example.html and shown below.) <html lang="en-us"> this is useful in many ways. your html document will be indexed more effectively by search engines if its language is set (allowing it to appear correctly in language-specific results, for example), and it is useful to people with visual impairments using screen readers (for example, the word "six" exists in both french and english, but is pronounced differently.) you can also set subsections of your document to be recognised as different languages. for ex...
Mozilla splash page - Learn web development
u should have already worked through the rest of the multimedia and embedding module. objective: to test knowledge around embedding images and video in web pages, frames, and html responsive image techniques. starting point to start off this assessment, you need to grab the html and all the images available in the mdn-splash-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 manipulate (some of) them using a graphics editor before they...
...x wide versions of: firefox_logo-only_rgb.png firefox-addons.jpg mozilla-dinosaur-head.png call them something sensible, e.g. firefoxlogo400.png and firefoxlogo120.png. along with mdn.svg, these images will be your icons to link to further resources, inside the further-info area. you'll also link to the firefox logo in the site header. save copies of all these inside the same directory as index.html. next, create a 1200px wide landscape version of red-panda.jpg, and a 600px wide portrait version that shows the panda in more of a close up shot. again, call them something sensible so you can easily identify them. save a copy of both of these inside the same directory as index.html. note: you should optimise your jpg and png images to make them as small as possible, while still looking ...
Drawing graphics - Learn web development
e of these means learning another new api (a third party one, in this case), but they are a lot simpler than coding raw webgl. recreating our cube let's look at a simple example of how to create something with a webgl library. we'll choose three.js, as it is one of the most popular ones. in this tutorial we'll create the 3d spinning cube we saw earlier. ...
...s it is one of the most popular ones. in this tutorial we'll create the 3d spinning cube we saw earlier. to start with, make a local copy of index.html in a new folder, then save a copy of metal003.png in the same folder. this is the image we'll use as a surface texture for the cube later on. next, create a new file called main.js, again in the same folder as before. if you open index.html in your code editor, you'll see that it has two <script> elements — the first one attaching three.min.js to the page, and the second one attaching our main.js file to the page. you need to download the three.min.js library and save it in the same directory as before. now we've got three.js attached to our page, we can start to write javascript that makes use of it into main.js. let's...
Introduction to web APIs - Learn web development
library and a framework is “inversion of control”. when calling a method from a library, the developer is in control. with a framework, the control is inverted: the framework calls the developer's code. what can apis do? there are a huge number of apis available in modern browsers that allow you to do a wide variety of things in your code. you can see this by taking a look at the mdn apis index page. common browser apis in particular, the most common categories of browser apis you'll use (and which we'll cover in this module in greater detail) are: apis for manipulating documents loaded into the browser. the most obvious example is the dom (document object model) api, which allows you to manipulate html and css — creating, removing and changing html, dynamically applying new styl...
...de storage apis are becoming a lot more widespread in web browsers — the ability to store data on the client-side is very useful if you want to create an app that will save its state between page loads, and perhaps even work when the device is offline. there are a number of options available, e.g. simple name/value storage with the web storage api, and more complex tabular data storage with the indexeddb api. common third-party apis third-party apis come in a large variety; some of the more popular ones that you are likely to make use of sooner or later are: the twitter api, which allows you to do things like displaying your latest tweets on your website. map apis like mapquest and the google maps api allows you to do all sorts of things with maps on your web pages. the facebook suite...
Silly story generator - Learn web development
prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript 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 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 java...
...silly story if you press the button again (and again...) the following screenshot shows an example of what the finished program should output: to give you more of an idea, have a look at the finished example (no peeking at the source code!) steps to complete the following sections describe what you need to do. basic setup: create a new file called main.js, in the same directory as your index.html file. apply the external javascript file to your html by inserting a <script> element into your html referencing main.js. put it just before the closing </body> tag. initial variables and functions: in the raw text file, copy all of the code underneath the heading "1. complete variable and function definitions" and paste it into the top of the main.js file. this gives you three variabl...
Working with JSON - Learn web development
if we loaded this object into a javascript program, parsed in a variable called superheroes for example, we could then access the data inside it using the same dot/bracket notation we looked at in the javascript object basics article. for example: superheroes.hometown superheroes['active'] to access data further down the hierarchy, you simply have to chain the required property names and array indexes together. for example, to access the third superpower of the second hero listed in the members list, you'd do this: superheroes['members'][1]['powers'][2] first we have the variable name — superheroes. inside that we want to access the members property, so we use ["members"]. members contains an array populated by objects. we want to access the second object inside the array, so we use...
...iation resistance", "turning tiny", "radiation blast" ] }, { "name": "madame uppercut", "age": 39, "secretidentity": "jane wilson", "powers": [ "million tonne punch", "damage resistance", "superhuman reflexes" ] } ] the above is perfectly valid json. you'd just have to access array items (in its parsed version) by starting with an array index, for example [0]["powers"][0]. other notes json is purely a data format — it contains only properties, no methods. json requires double quotes to be used around strings and property names. single quotes are not valid. even a single misplaced comma or colon can cause a json file to go wrong, and not work. you should be careful to validate any data you are attempting to use (although comput...
Perceived performance - Learn web development
er, but you can make it feel faster even if the metrics discussed in the othser sections can't be improved. there is no unicorn metric that can measure what the user feels, but metrics are useful in guaging improvements (and regressions). relevant measurements include first meaningful paint (fmp), largest contentful paint (lcp), time to interactive (tti), render start, dom interactive, and speed index. first paint is reported by the browser and provides the time, in ms, of when the page starts changing; but this change can be a simple background color update or something even less noticable. it doesn’t indicate completeness and may report a time when nothing visible is painted. first contentful paint (fcp) reports the time when the browser first rendered anything of signifigance, be that te...
...t the user has content to consume. the first meaningful paint, or fmp, is the when content appears on the screen that is actually meaningful; which is a better metric for user-perceived loading experience, but still not ideal. largest contentful paint (lcp) metric, definited in the largest contentful paint api, reports the render time of the largest content element visible in the viewport. speed index is also used to approximate perceived performance: it measures the average time for pixels on the visible screen to be painted. it doesn't account for jitter, nor does it weight which content important to a user more highly, so it's not a perfect metric. these metrics have to do with initial load and render. it is also important to ensure the site feels fast once the user begins interacting with...
Componentizing our React app - Learn web development
r code with one of javascript's core abilities: iteration. to use iteration, we should first re-think our tasks. tasks as data each of our tasks currently contains three pieces of information: its name, whether it has been checked, and its unique id. this data translates nicely to an object. since we have more than one task, an array of objects would work well in representing this data. ...
...you can console.log() it to check, if you’d like. ...
Starting our Svelte Todo list app - Learn web development
r list of todos. create a new folder — src/components. note: you can put your components anywhere inside the src folder, but the components folder is a recognized convention to follow, allowing you to find your components easily. ...
... font-size: 1.6rem; line-height: 1.25; display: block; position: relative; min-height: 44px; padding-left: 40px; clear: left; } .c-cb > label::before, .c-cb > input[type="checkbox"] { box-sizing: border-box; top: -2px; left: -2px; width: 44px; height: 44px; } .c-cb > input[type="checkbox"] { -webkit-font-smoothing: antialiased; cursor: pointer; position: absolute; z-index: 1; margin: 0; opacity: 0; } .c-cb > label { font-size: inherit; font-family: inherit; line-height: inherit; display: inline-block; margin-bottom: 0; padding: 8px 15px 5px; cursor: pointer; touch-action: manipulation; } .c-cb > label::before { content: ""; position: absolute; border: 2px solid currentcolor; background: transparent; } .c-cb > input[type="checkbox"]:focu...
Deployment and next steps - Learn web development
ld to build our application. we are also telling gitlab to deploy the contents of the public folder. on the last line, we are configuring gitlab to redeploy our app only when there's a push to our master branch. since our app will be published at a subdirectory (like https://your-user.gitlab.io/mdn-svelte-todo), we'll have to make the references to the javascript and css files in our public/index.html file relative. to do this, we just remove the leading slashes (/) from the /global.css, /build/bundle.css, and /build/bundle.js urls, like this: <title>svelte to-do list</title> <link rel='icon' type='image/png' href='favicon.png'> <link rel='stylesheet' href='global.css'> <link rel='stylesheet' href='build/bundle.css'> <script defer src='build/bundle.js'></script> do this now. ...
.../bundle.js urls, like this: <title>svelte to-do list</title> <link rel='icon' type='image/png' href='favicon.png'> <link rel='stylesheet' href='global.css'> <link rel='stylesheet' href='build/bundle.css'> <script defer src='build/bundle.js'></script> do this now. now we just have to commit and push our changes to gitlab. do this by running the following commands: > git add public/index.html > git add .gitlab-ci.yml > git commit -m "added .gitlab-ci.yml file and fixed index.html absolute paths" > git push counting objects: 5, done. delta compression using up to 8 threads. compressing objects: 100% (5/5), done. writing objects: 100% (5/5), 541 bytes | 541.00 kib/s, done. total 5 (delta 3), reused 0 (delta 0) to gitlab.com:opensas/mdn-svelte-todo.git 7dac9f3..5725f46 master ->...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
t checkalltodos = (completed) => { todos.foreach(t => t.completed = completed) todos = todos } this will solve the problem. internally svelte will flag todos as changed and remove the apparently redundant self-assignment. apart from the fact that it looks weird, it's perfectly ok to use this technique, and sometimes it's the most concise way to do it. we could also access the todos array by index, like this: const checkalltodos = (completed) => { todos.foreach( (t,i) => todos[i].completed = completed) } assignments to properties of arrays and objects — e.g. obj.foo += 1 or array[i] = x — work the same way as assignments to the values themselves. when svelte analyzes this code, if can detect that the todos array is being modified. another solution is to assign a new array to todos...
...adingel.focus(). update the contents of todosstatus.svelte like so: <script> export let todos $: totaltodos = todos.length $: completedtodos = todos.filter(todo => todo.completed).length let headingel export function focus() { // shorter version: export const focus = () => headingel.focus() headingel.focus() } </script> <h2 id="list-heading" bind:this={headingel} tabindex="-1">{completedtodos} out of {totaltodos} items completed</h2> note that we've added a tabindex attribute to the <h2> to allow the element to receive focus programmatically. as we saw earlier, using the bind:this={headingel} directive gives us a reference to the dom node in the variable headingel. then we use export function focus() to expose a function that gives focus to the <h2> heading.
Working with Svelte stores - Learn web development
at the beginning we import the alert store. next we import the ondestroy() lifecycle function, which lets us execute a callback after the component has been unmounted. we then create a local...
...'completed' : 'active'}` todos[i] = { ...todos[i], ...todo } } add the following reactive block beneath the block that starts with let filter =...
Dynamic behavior in Svelte: working with variables and props - Learn web development
the data at the moment, our displayed todo items are all static. we want to iterate over each item in our todos array and render the markup for each task, so let's do that now. html doesn't have a way of expressing logic — like conditionals and loops. svelte does. in this case we use the {#each...} directive to iterate over the todos array. the second parameter, if provided, will contain the index of the current item. also, a key expression can be provided, which will uniquely identify each item. svelte will use it to diff the list when data changes, rather than adding or removing items at the end, and it's a good practice to always specify one. finally, an :else block can be provided, which will be rendered when the list is empty. let's give it a try. replace the existing <ul> elem...
...elte will use it to diff the list when data changes, rather than adding or removing items at the end, and it's a good practice to always specify one. finally, an :else block can be provided, which will be rendered when the list is empty. let's give it a try. replace the existing <ul> element with the following simplified version to get an idea of how it works: <ul> {#each todos as todo, index (todo.id)} <li> <input type="checkbox" checked={todo.completed}/> {index}. {todo.name} (id: {todo.id}) </li> {:else} nothing to do here! {/each} </ul> go back to the app; you'll see something like this: now we've seen that this is working, let's generate a complete todo item with each loop of the {#each} directive, and inside embed the information from the todos array: i...
Getting started with Vue - Learn web development
elopment code into older syntax that is more cross-browser compatible in production code. you can register additional babel plugins in this file. .browserslistrc: this is a config for browserslist. you can use this to control which browsers your tooling optimizes for. public: this directory contains static assets that are published, but not processed by webpack during build (with one exception; index.html gets some processing). favicon.ico: this is the favicon for your app. currently, it's the vue logo. index.html: this is the template for your app. your vue app is run from this html page, and you can use lodash template syntax to interpolate values into it. note: this is not the template for managing the layout of your application — this template is for managing static html th...
...aging the layout of your application — this template is for managing static html that sits outside of your vue app. editing this file typically only occurs in advanced use cases. src: this directory contains the core of your vue app. main.js: this is the entry point to your application. currently, this file initializes your vue application and signifies which html element in the index.html file your app should be attached to. this file is often where you register global components or additional vue libraries. app.vue: this is the top-level component in your vue app. see below for more explanation of vue components. components: this directory is where you keep your components. currently it just has one example component. assets: this directory is for storing static ass...
Accessibility/LiveRegionDevGuide
e, the root event string is object:text-changed with ":delete" and ":insert" being appended to complete the event type. in iaccessible2, there are two distinct event types - ia2_event_text_removed and ia2_event_text_inserted. the text associated with an at-spi text changed event is directly in the event object. the event.any_data field holds the entire text string while event.detail1 is the start index while event.detail2 is the text string length. in iaccessible2, iaccessibletext::get_oldtext and iaccessibletext::get_newtext are used to acquire the text and offsets. filtering events text changed events certain web page mutation events, such as adding to a list, trigger both an object changed and a text changed event. both events should not be acted upon or double announcements would resul...
...hole while atomic="false" (default) indicates that the region can stand on it's own. the text offsets associated with a text changed event are used when supporting this property. the offsets can be acquired directly in a text changed event object in at-spi and through the use of iaccessibletext::get_oldtext and iaccessibletext::get_newtext in iaccessible2. when atomic is set to "false", the start index and end index/run length are used as given. the result being that only the change will be presented. when atomic is set to "true", the entire region should be presented. in this case the start index is 0 and the end index/run length is the length of the text - 1. container-channel the channel property defines two channels - 'main' and 'alert'. it was originally intended to give web developers ...
Android-specific test suites
public class testpermissions { @ignore @test public void testsuccessrunnableisexecutedifpermissionsaregranted() { ... contact information android-test is currently owned by :sebastian and :nalexander. file tickets in the firefox for android product in bugzilla. android-checkstyle verifies that the java coding style is consistent throughout. see http://checkstyle.sourceforge.net/index.html and https://docs.gradle.org/2.14/userguide/checkstyle_plugin.html for more details. running android-checkstyle to run android-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 ...
.... android-findbugs ensures that the code avoids common java coding errors. using this suite will allow the code to be analyzed to spot any design flaws or potential bugs. if an issue is found within the code, a warning will be identified and put into the correct category that the suite controls — this could be malicious, correctness, or just bad practice. see http://findbugs.sourceforge.net/index.html and https://docs.gradle.org/2.14/userguide/findbugs_plugin.html for more details. running android-findbugs to run android-findbugs, first build firefox for android with your changes; then run ./mach android findbugs 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 new java code...
HTMLIFrameElement.executeScript()
, or an onerror handler if not. parameters script the script to be executed. options optional optionally, you can provide an origin or url for the script to be executed against. it's recommended that you include an origin or url, in order to ensure that the script is being executed in the expected context: origin: an origin, e.g. http://example.com url: a url, e.g. ...
...re that the script 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 script seems to execute even if a url/origin is specified. ...
HTML parser threading
ing in a speculating state and sets the newly created speculation object as the tree op sink (instead of the tree op stage described earlier) of the tree builder. the speculation object has a queue of tree ops (into which the tree builder will now flush ops to instead of the tree op stage), an owning reference to the nshtml5owningutf16buffer that contains the starting point of the speculation, an index into the nshtml5owningutf16buffer defining the exact starting point within the buffer, the line number of the tokenizer at that point and a snapshot of the tree op state. the line number and the snapshot are also added to the tree op that attempts to execute scripts (before flushing it). the tree builder snapshot contains a copy of the tree builder stack, a copy of the list of open formatting ele...
...e mtokenizermutex. if the single speculation is successful, the tree ops from the parser-thread tree builder are flushed straight to the tree op executor and the tree op stage is set as the tree op sink for the tree builder. the executor is told that it's reading from the stage again. if the speculation failed, the first buffer corresponding to the starting point of the speculation gets its start index restored to the index stored on the speculation object. subsequent buffers get their start index reset back to zero. the tokenizer gets its line number restored from the speculation object. this is equivalent to rewinding the input to where it was when speculation started. all the speculations in the speculation queue are destroyed. pending tree ops in the tree builder are cleared. the tree op st...
HTTP Cache
the eviction preparation operation - i.e. clearing of the internal io state - is then put to the end of the open_prio...
...the eviction preparation operation - i.e. clearing of the internal io state - is then put to the end of the open_priority le...
PBackground
t side of a pbackground actor pair is always on the designated background thread, while the child side is on the thread that chooses to use pbackground. the background thread is designed to be responsive (nobody is allowed to do long running computation or file i/o on it) to guarantee better latency than going through the main threads (which can run arbitrary js, gc, etc.) can provide. examples indexeddb was rebuilt on top of pbackground last year. this allows the dom code to generally not worry about what thread (main vs. worker) or process (single vs. multiple) it is running in. instead, it simply turns all of its operations into ipdl calls on a set of pbackground-based actors and the processing, file i/o, etc, can be controlled from the pbackground thread regardless of where the dom calls ...
... about what thread (main vs. worker) or process (single vs. multiple) it is running in. instead, it simply turns all of its operations into ipdl calls on a set of pbackground-based actors and the processing, file i/o, etc, can be controlled from the pbackground thread regardless of where the dom calls are being made. the logic is all implemented in actorsparent.cpp and actorschild.cpp in the dom/indexeddb directory. these are not small files (actorsparent.cpp was over 27k lines of code as of this publication) but the logic that needs to run in the parent is very clearly separated from the dom code no matter what thread it's running on. note: this article was original published as what is pbackground?, by kyle huey. ...
JNI.jsm
g a cdata object that is a java string. return value a javascript string. unloadclasses() blah blah void unloadclasses(); parameters this function takes no arguments. return value this function has no return value, if you try to store the return value in a variable, it will be undefined. working with arrays creating/preallocating a typed array methods cdata .get(number aindex); cdata .getelements(number astart, number alength); void .set(number aindex, cdata avalue); void .setelements(number astart, [array, size_is(arr.length > number anynumber > 0)] in cdata avalsarray); .get() gets the value of the element in the array at given aindex. cdata get(number aindex); parameters aindex the position in the array to obtain. return ...
...ied by astart and ending at position astart + alength. void setelements(number astart, number alength); parameters astart the position to start setting elements of the array in. alength the number of elements to copy from astart. if 0 is supplied, an empty cdata array is returned. return value a new cdata array object based on the array. .set() sets an element in the array at given aindex to the given aval. void set(number aindex, cdata aval); parameters aindex the position in the array to change. aval a value to set it to. return value this function has no return value, if you try to store the return value in a variable, it will be undefined. .setelements() sets a section of a typed array to specified values. this function starts on the position of astart in the arr...
Mozilla DOM Hacking Guide
that the initialization has been performed. the implementation is described in section 1.5. static nsresult registerclassname(print32 adomclassinfoid): help me! static nsresult registerclassprotos(print32 adomclassinfoid): help me! static nsresult registerexternalclasses();: help me! nsresult resolveconstructor(jscontext *cx, jsobject *obj, jsobject **objp);: help me! static print32 getarrayindexfromid(jscontext *cx, jsval id, prbool *aisnumber = nsnull): if the js value is an integer, then *aisnumber is true, and the integer is returned. else, *aisnumber is false and -1 is returned. static inline prbool isreadonlyreplaceable(jsval id) { ... }: help me! static inline prbool iswritablereplaceable(jsval id) { ... }: help me! nsresult docheckpropertyaccess(...): help me! (bug 90757) ...
... add a new js external constructor, like "new image()" to bypass the default behavior of xpconnect to implement a "replaceable" property to mess with the prototypes of dom objects example of functionality implemented using domclassinfo: constructors of dom objects in the global scope (e.g. node) setting up custom prototypes for those dom objects new image(), new option() window.history[index] document.<formname> how to add a new interface to an existing dom object for this section, we will use the simple example of the domimplementation dom object. this is a real-world case that was used to solve bug 33871 (the patch is not checked in yet, as of writing this document). the problem is the following: we have to add a new htmldomimplementation interface to the domimplementation dom...
Mozilla Web Developer FAQ
origin resource sharing http headers. downloadable fonts in the eot format are not supported. if you use downloadable fonts, please make sure the fonts have the right unicode mappings and the content uses the right unicode characters. the past practice of displaying non-latin text by assigning non-latin glyphs to latin code points breaks copying and pasting, breaks searching on the page, breaks indexing by search engines and breaks readability in browsers that do not support downloadable fonts (e.g. legacy browsers or mobile browsers that opt not to download fonts due to file size). why aren’t symbol/dingbat fonts working? they are working. characters in html 4 and xml documents are unicode characters (even if the document has been encoded using a legacy encoding for transfer)—not font ...
... search engines and breaks readability in browsers that do not support downloadable fonts (e.g. legacy browsers or mobile browsers that opt not to download fonts due to file size). why aren’t symbol/dingbat fonts working? they are working. characters in html 4 and xml documents are unicode characters (even if the document has been encoded using a legacy encoding for transfer)—not font glyph indexes. <font face="symbol">a</font> means the character latin small letter a (u+0061) preferably displayed using the symbol font. since the symbol font does not have glyph for that character, another font is used. if you mean α, you should use greek small letter alpha (u+03b1). if you are using a legacy encoding that cannot represent that character, you can use a numeric character reference: &#945;...
NSS 3.12.9 release notes
new and revised documents available since the release of nss 3.11 include the following:</for> build instructions for nss 3.11.4 and above nss shared db compatibility nss 3.12.9 shared libraries are backward compatible with all older nss 3.x ...
...ngecerttrust and cert_savesmimeprofile bug 585518: addtrust qualified ca root serial wrong in certdata.txt trust entry bug 337433: need cert_findcertbynicknameoremailaddrbyusage bug 592939: expired cas in certdata.txt documentation <for a="" class="new " documentation="" href="/en/index.html#documentation" list="" nss="" of="" pages="" primary="" rel="internal" see="" the="" title="en/index.html#documentation">nss documentation. new and revised documents available since the release of nss 3.11 include the following:</for> build instructions for nss 3.11.4 and above nss shared db compatibility nss 3.12.9 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.12.9 shared li...
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
s rv; prfiledesc *headerfile = null; prfiledesc *encfile = null; prfiledesc *infile = null; certcertificate *cert = null; secitem data; unsigned char ptext[modblocksize]; unsigned char encbuf[modblocksize]; unsigned int ptextlen; int index; unsigned int nwritten; unsigned int pad[1]; secitem paditem; unsigned int paddinglength = 0; seckeypublickey *pubkey = null; /* if the intermediate encrypted file already exists, delete it*/ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedfilename); } /* r...
...headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); rv = secfailure; goto cleanup; } /* read input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { if (ptextlen != modblocksize) { paddinglength = modblocksize - ptextlen; for ( index=0; index < paddinglength; index++) { ptext[ptextlen+index] = (unsigned char)paddinglength; } ptextlen = modblocksize; } rv = pk11_pubencryptraw(pubkey, encbuf, ptext, ptextlen, null); nwritten = pr_write(encfile, encbuf, ptextlen); } /* write the padding to header file */ pad[0] = paddinglength; paditem.t...
sample2
. ...
...to write padding */ headerfile = pr_open(headerfilename, pr_create_file | pr_rdwr | pr_append, 00660); if (!headerfile) { pr_fprintf(pr_stderr, "unable to open \"%s\" for writing.\n", headerfilename); rv = secfailure; goto cleanup; } /* read input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { if (ptextlen != modblocksize) { paddinglength = modblocksize - ptextlen; for ( index=0; index < paddinglength; index++) { ptext[ptextlen+index] = (unsigned char)paddinglength; } ptextlen = modblocksize; } rv = pk11_pubencryptraw(pubkey, encbuf, ptext, ptextlen, null); nwritten = pr_write(encfile, encbuf, ptextlen); } /* write the padding to header file */ pad[0] = paddinglength; paditem.type = sibuffer; paditem.data = (unsigned char *)pad; paditem.len = sizeof(pad[0]); writetohea...
JIT Optimization Strategies
on that the type inference engine has failed to collect enough information to guide the optimization process. getelement getelem_typedobject attempts to optimized element accesses on array typed objects. getelem_dense attempts to optimize element accesses on densely packed array objects. dense arrays are arrays which do not have any 'holes'. this means that the array has valid values for all indexes from 0 to length-1. getelem_typedstatic attempts to optimize element accesses on a typed array that can be determined to always refer to the same array object. if this optimization succeeds, the 'array' object is treated as a constant, and is not looked up or retrieved from a variable. getelem_typedarray attempts to optimize element accesses on a typed array. getelem_string attempts to op...
...bject. if this optimization succeeds, the 'array' object is treated as a constant, and is not looked up or retrieved from a variable. setelem_typedarray attempts to optimize element writes on a typed array. setelem_dense attempts to optimize element writes on densely packed array objects. dense arrays are arrays which do not have any 'holes'. this means that the array has valid values for all indexes from 0 to length-1. setelem_arguments attempts to optimize element writes to the arguments special object available in functions. this optimization only works if the arguments object is used in well-understood ways within the function. the function containing the arguments.length is allowed to use the arguments object in the following ways without disabling this optimization: access argume...
JS::HandleValueArray
values js::autovaluevector &amp; elements of newly created array. values js::autovaluearray &amp; elements of newly created array. args js::callargs &amp; elements of newly created ar...
...allargs &amp; elements of newly created array. len size_t (frommarkedlocation only) length of elements array or (subarray only) length of sub array of values. elements js::value * (frommarkedlocation only) a pointer to the first element of an array of js::value. values js::handlevaluearray (subarray only) an array to get sub array. startindex size_t (subarray only) an index of the first element of subarray of values. methods method description size_t length() const returns the length of the array. const value *begin() const returns the pointer to the first element of the array. js::handlevalue operator[](size_t i) const returns i-th element of the array. description ...
JSObjectOps.getRequiredSlot
. syntax typedef jsval (*jsgetrequiredslotop)(jscontext *cx, jsobject *obj, uint32 slot); typedef jsbool (*jssetrequiredslotop)(jscontext *cx, jsobject *obj, uint32 slot, jsval v); name type description cx jscontext * the js context in which we access the slot. obj jsobject * the object whose slot we access. slot uint32 the index of the slot to access. see note below. v jsval the value to store in the slot, for jssetrequiredslotop. description get and set a required slot, one that should already have been allocated. these operations are infallible, so required slots must be pre-allocated, or implementations must suppress out-of-memory errors. the native ops (js_objectops, see js/src/jsobj.cpp) acces...
...quired slot, one that should already have been allocated. these operations are infallible, so required slots must be pre-allocated, or implementations must suppress out-of-memory errors. the native ops (js_objectops, see js/src/jsobj.cpp) access slots reserved by including a call to the jsclass_has_reserved_slots(n) macro in the jsclass.flags initializer. note: the slot parameter is a zero-based index into obj slots, unlike the index parameter to the js_getreservedslot and js_setreservedslot api entry points, which is a zero-based index into the jsclass_reserved_slots(clasp) reserved slots that come after the initial well-known slots: proto, parent, class, and optionally, the private data slot. ...
JS_AlreadyHasOwnProperty
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object to be searched. name or id const char * or const char16_t *or js::handleid (in js_alreadyhasownproperty, alreadyhas...
... searched. name or id const char * or const char16_t *or js::handleid (in js_alreadyhasownproperty, alreadyhasownucproperty, and js_alreadyhasownpropertybyid) the name of the property to search for. namelen size_t (in js_alreadyhasownucproperty only) the length of name, in characters; or the special value (size_t) -1 to indicate that name is null-terminated. index uint32_t (in js_alreadyhasownelement only) the index of the element to search for. foundp bool * out parameter. *foundp receives true if the property is found or false if it is not found. if an error occurs, the value left in *foundp is undefined. description these functions attempt to determine whether a property already exists on a specific jsobject without modifying ...
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 description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete an element. index uint32_t index number of the element to delete. result js::objectopresult &amp; (out parameter) receives the result of the operation. description js_del...
...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_deleteelement returns true. ...
JS_DeleteElement2
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. 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 description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object from which to delete an element. index uint32_t index number of the element to delete. succeede...
...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. ...
JS_GetElement
vp js::mutablehandlevalue out parameter. ...
...ement(jscontext *cx, js::handleobject obj, uint32_t index, js::mutablehandlevalue vp); name type description cx jscontext * the context in which to perform the property lookup. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the element. index uint32_t index of the element to look up. vp js::mutablehandlevalue out parameter. on success, *vp receives the current value of the element, if it exists, and undefined otherwise. description js_getelement examines a specified js object, obj, and its prototype chain, for an element or numeric property numbered index. if the element exists, js_getelement sets *vp to the...
JS_GetStringCharAt
this article covers features introduced in spidermonkey 38 return a specified character from a string. syntax bool js_getstringcharat(jscontext *cx, jsstring *str, size_t index, char16_t *res); char16_t js_getflatstringcharat(jsflatstring *str, size_t index); name type description cx jscontext * the context in which to create the new string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str jsstring * or jsflatstring * the string to get character. index size_t an integer between 0 and 1-less-than the length of the string. res char16_t * (js_getstringcharat only) out parameter. on successful, receives the character code. description js_getstringcharat...
...ar16_t * (js_getstringcharat only) out parameter. on successful, receives the character code. description js_getstringcharat and js_getflatstringcharat get the specified character from the string str. on successful, js_getstringcharat returns true and stores the character code into *res, otherwise returns false. js_getflatstringcharat always succeeds, and returns the character code. index should not be greater than or equal to the length of str. see also mxr id search for js_getstringcharat mxr id search for js_getflatstringcharat bug 1034627 ...
Redis Tips
s 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. ...
... yet redis is so easy to learn and use that you'll seldom feel you need to consult it. there are three reasons to look at the docs for every command you use. time complexity - each command's complexity is given in big-o notation. ...
Gecko events
ion_changed a table's column description changed. event_table_column_header_changed a table's column header changed. event_table_column_insert event_table_column_delete event_table_column_reorder event_window_activate event_window_deactivate event_window_destroy event_window_maximize event_window_minimize event_window_resize event_window_restore event_hyperlink_end_index_changed the ending index of this link within the containing string has changed. event_hyperlink_number_of_anchors_changed the number of anchors assoicated with this hyperlink object has changed. event_hyperlink_selected_link_changed the hyperlink selected state changed from selected to unselected or from unselected to selected. event_hypertext_link_activated one of the links associated with t...
...s hyperlink object has changed. event_hyperlink_selected_link_changed the hyperlink selected state changed from selected to unselected or from unselected to selected. event_hypertext_link_activated one of the links associated with the hypertext object has been activated. event_hypertext_link_selected one of the links associated with the hypertext object has been selected. event_hyperlink_start_index_changed the starting index of this link within the containing string has changed. event_hypertext_changed focus has changed from one hypertext object to another, or focus moved from a non-hypertext object to a hypertext object, or focus moved from a hypertext object to a non-hypertext object. event_hypertext_nlinks_changed the number of hyperlinks associated with a hypertext object changed. ev...
XForms Accessibility
so, yes we d...
...there are set of tests at beaufour.dk w3c's xforms test 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 stripped out as it was believed the focus model was dependent on the content which used it. so, yes we don't care about navindex in xforms. if you use xhtml1.x use tabindex. if you use xhtml2 use nextfocus. therefore since mozilla xforms works in xhtml (1.x) or xul documents only then we use tabindex instead. note, we support -moz-user-focus style neit...
Components.classes
all of the properties and methods of the nsijscid and its ancestor interface nsijsid are available for use on the objects contained in this object. ...
... all of the properties and methods of the nsijscid and its ancestor interface nsijsid are available for use on the objects contained in this object. ...
Components.classesByID
components.classesbyid is a read-only object whose properties are classes indexed by cid. introduction components.classesbyid is a read-only object whose properties implement the nsijscid interface. each property represents one of the classes of xpcom components that can be constructed or accessed as an xpcom service. components.classesbyid is exactly like components.classes except that the elements are indexed by the canonical form of their cid, and does not only represent the component classes that have been registered with the component manager using a contractid, but also those registered using a plain cid. ...
... xpcom service. components.classesbyid is exactly like components.classes except that the elements are indexed by the canonical form of their cid, and does not only represent the component classes that have been registered with the component manager using a contractid, but also those registered using a plain cid. ...
Components.interfaces
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 description as scriptable, that is the interfaces which xpconnect is capable of reflecting into javascript. properties of the components.interfaces object are used where xpcom methods expect a parameter of type nsid. ...
...a parameter of type nsid. this includes nsisupports.queryinterface(), the optional parameter accepted by nsijscid.getservice(), nsijscid.createinstance() when called from javascript, and nsiclassinfo.getinterfaces(). the properties of the components.interfaces object can be enumerated using a for...in loop. usage accessing an interface object properties of the components.interfaces object are indexed by interface name. you can retrieve an interface object using: var iface = components.interfaces.nsisupportsarray; this will return you the interface object for the nsisupportsarray interface. accessing constants defined in an interface interface descriptions (cf. xpidl) may not only contain method declarations, but also constants. for example, assume we have the following interface declar...
Components.utils.importGlobalProperties
using this api you can import these objects into such a system scope. this function is not intended for sandboxes but for system-privileged scopes. to import these objects into a sandbox, use the wantglobalproperties option in the sandbox constructor. this function is passed an array of strings. each string is the name of an object to import, and will be defined on the importing scope's global. ...
...nstructor. this function is passed an array of strings. each string is the name of an object to import, and will be defined on the importing scope's global. ...
Language bindings
are currently available: components objectthe components object is the object through which xpconnect functionality is reflected into javascript. the components object is actually a native instance of the nsixpccomponents interface which is reflected into javascript as a top level object using xpconnect.components.classescomponents.classes is a read-only object whose properties are classes indexed by contractid.components.classesbyidcomponents.classesbyid is a read-only object whose properties are classes indexed by cid.components.constructorcreates a javascript function which can be used to create or construct new instances of xpcom components.components.exceptioncomponents.exception is a javascript constructor to create nsixpcexception objects. these exception objects may be thrown whe...
...objects may be thrown when implementing xpcom interfaces in javascript, and they can provide better diagnostics in the error console if not caught than simply throwing an nsresult's value will.components.idcomponents.id is a constructor that creates native objects that conform to the nsijsid interface.components.interfacescomponents.interfaces is a read-only object whose properties are interfaces indexed by their names.components.interfacesbyidcomponents.interfacesbyid is a read-only array of classes indexed by iid.components.issuccesscodedetermines whether a given xpcom return code (that is, an nsresult value) indicates the success or failure of an operation, returning true or false respectively.components.lastresultcomponents.managercomponents.manager is a convenience reflection of the global...
Insert
« xpcom api reference summary the insert family of functions inserts a value into a string's internal buffer. void insert( const self_type& astring, index_type aposition ); parameters astring [in] a nsacstring to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. void insert( const char_type* adata, index_type aposition, size_type adatalength = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise...
...arameters adata [in] a raw character array to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void insert( char_type achar, index_type aposition ); parameters achar [in] a character to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Replace
« xpcom api reference summary the replace family of functions sets the value of a string's internal buffer. void replace( index_type acutstart, index_type acutlength, const self_type& astring ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. astring [in] a nsacstring to append to this string. void replace( index_type acutstart, size_type acutlength, const char_type* adata, size_type adatalength = pr_uint32_max ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. adata [in] a raw character array ...
...ex of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. adata [in] a raw character array to append to this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void replace( index_type acutstart, index_type acutlength, char_type achar ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buff...
Insert
« xpcom api reference summary the insert family of functions inserts a value into a string's internal buffer. void insert( const self_type& astring, index_type aposition ); parameters astring [in] a nsastring to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. void insert( const char_type* adata, index_type aposition, size_type adatalength = pr_uint32_max ); parameters adata [in] a raw character array to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise,...
...arameters adata [in] a raw character array to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void insert( char_type achar, index_type aposition ); parameters achar [in] a character to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Replace
« xpcom api reference summary the replace family of functions sets the value of a string's internal buffer. void replace( index_type acutstart, index_type acutlength, const self_type& astring ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. astring [in] a nsastring to append to this string. void replace( index_type acutstart, size_type acutlength, const char_type* adata, size_type adatalength = pr_uint32_max ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. adata [in] a raw character array t...
...ex of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. adata [in] a raw character array to append to this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void replace( index_type acutstart, index_type acutlength, char_type achar ); parameter acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffe...
IAccessibleRelation
ess to an object's set of relations. 1.0 66 introduced gecko 1.9 inherits from: iunknown last changed in gecko 1.9 (firefox 3) method overview [propget] hresult localizedrelationtype([out] bstr localizedrelationtype ); [propget] hresult ntargets([out] long ntargets ); [propget] hresult relationtype([out] bstr relationtype ); [propget] hresult target([in] long targetindex, [out] iunknown target ); [propget] hresult targets([in] long maxtargets, [out, size_is(maxtargets), length_is( ntargets)] iunknown targets, [out] long ntargets ); methods localizedrelationtype() returns a localized version of the relation type. [propget] hresult localizedrelationtype( [out] bstr localizedrelationtype ); parameters localizedrelationtype return value s_ok. ntargets() re...
...long ntargets ); parameters ntargets return value s_ok. relationtype() returns the type of the relation. [propget] hresult relationtype( [out] bstr relationtype ); parameters relationtype the strings returned are defined @ref grprelations "in this section of the documentation". return value s_ok. target() returns one accessible relation target. [propget] hresult target( [in] long targetindex, [out] iunknown target ); parameters targetindex 0 based index. target return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. targets() returns multiple accessible relation targets. [propget] hresult targets( [in] long maxtargets, [out, size_is(maxtargets), length_is( ntargets)] iunknown targets, [out] long ...
mozIStorageConnection
nt(in autf8string asqlstatement); void createtable(in string atablename, in string atableschema); mozistoragependingstatement executeasync([array, size_is(anumstatements)] in mozistoragebasestatement astatements, in unsigned long anumstatements, [optional] in mozistoragestatementcallback acallback ); void executesimplesql(in autf8string asqlstatement); boolean indexexists(in autf8string aindexname); void preload(); obsolete since gecko 1.9 void removefunction(in autf8string afunctionname); mozistorageprogresshandler removeprogresshandler(); void rollbacktransaction(); void setgrowthincrement(in print32 aincrement, in autf8string adatabasename); mozistorageprogresshandler setprogresshandler(in print32 a...
...atements' execution. executesimplesql() executes an sql expression that has no bound parameters. warning: performing synchronous io on the main thread can cause serious performance problems. as a result, this method of modifying the database is strongly discouraged! void executesimplesql( in autf8string asqlstatement ); parameters asqlstatement the sql statement to execute. indexexists() this method determines whether or not the given index exists. boolean indexexists( in autf8string aindexname ); parameters aindexname the index to check. return value true if the index exists, false otherwise. preload() obsolete since gecko 1.9 (firefox 3) this is used to preload the database cache. it loads pages from the start of the database ...
mozIStorageService
.opendatabase() method. warning: if you have more than one connection to a file, you must use the exact same name for the file each time, including case. the sqlite code uses a simple string comparison to see if there is already a connection. opening a connection to "foo.sqlite" and "foo.sqlite" will corrupt your database. if your database contains virtual tables (for example, for full-text indexes), you must use mozistorageservice.openunshareddatabase() to open it, since those tables are not compatible with a shared cache. if you use this method to open a database containing virtual tables, it will think the database is corrupted and throw ns_error_file_corrupted. note: the connection object returned by this function is not threadsafe. you must use it only from the thread you created it ...
...nded that you call mozistorageservice.backupdatabasefile() to back up the database so that user data is not lost (although we have no way of recovering this data yet). each connection uses its own sqlite cache, which is inefficient, so you should use opendatabase() instead of this method unless you need a feature of sqlite that is incompatible with a shared cache, like virtual table and full text indexing support. if cache contention is expected, for instance when operating on a database from multiple threads, using unshared connections may be a performance win. warning: if you have more than one connection to a file, you must use the exact same name for the file each time, including case. the sqlite code uses a simple string comparison to see if there is already a connection. opening a co...
nsIAbCard
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...
... 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 h...
nsIAccessibleRelation
cessiblerelation.idlscriptable this interface gives access to an accessibles set of relations. 1.0 66 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. method overview nsiaccessible gettarget(in unsigned long index); nsiarray gettargets(); attributes attribute type description relationtype unsigned long returns the type of the relation. read only. targetscount unsigned long returns the number of targets for this relation. read only. constants constant value descript...
...he name or description fields of an nsiaccessible. relation_description_for 0x0f this object is describes the target object. relation_default_button 0x4000 part of a form/dialog with a related default button. it is used for msaa only, no for ia2 nor atk/at-spi. methods gettarget() returns accessible relation target at the given index. nsiaccessible gettarget( in unsigned long index ); parameters index zero-based index of relation target. return value returns an nsiaccessible object. exceptions thrown ns_error_invalid_arg indicates the given index is out of range. gettargets() returns an array of accessible relation targets. nsiarray gettargets(); parameters none. return value a...
nsIAccessibleTableChangeEvent
read only. ...
...read only. ...
nsIAccessibleTreeCache
viewinvalidated(in long astartrow, in long aendrow, in long astartcol, in long aendcol); methods getcachedtreeitemaccessible() returns the tree item from the cache for the cell in the specified row and column; the nsiaccessible is created if it doesn't already exist in the cache. nsiaccessible getcachedtreeitemaccessible( in long arow, in nsitreecolumn acolumn ); parameters arow the row index. acolumn the column object. if is is null then the primary column is used. it makes sense for atk only. return value the nsiaccessible corresponding to the specified tree cell. invalidatecache() invalidates the number of cached treeitem accessibles. void invalidatecache( in long arow, in long acount ); parameters arow row index the invalidation starts from. acount the number of treeitem ac...
...n specifies whether rows have been inserted (plus) or removed (minus) treeviewchanged() invalidates children created for the previous tree view. void treeviewchanged(); parameters none. treeviewinvalidated() fires name change events for invalidated area of tree. void treeviewinvalidated( in long astartrow, in long aendrow, in long astartcol, in long aendcol ); parameters astartrow row index invalidation starts from. aendrow row index invalidation ends, -1 means the last row index. astartcol column index invalidation starts from. aendcol column index invalidation ends, -1 means the last column index. ...
nsIBrowserSearchService
may be null if there are no visible search engines. defaultengine nsisearchengine the default...
... init(). void init( [optional] in nsibrowsersearchinitobserver observer ); parameters observer if specified, a callback called once initialization is complete, or immediately, if the service has already been initialized. in javascript, this observer can be a regular function. moveengine() moves a visible search engine. void moveengine( in nsisearchengine engine, in long newindex ); parameters engine the engine to move. newindex the engine's new index in the set of visible engines. exceptions thrown ns_error_failure if newindex is out of bounds, or if engine is hidden. removeengine() removes the search engine. if the search engine is installed in a global location, this will just hide the engine. if the engine is in the user'...
nsICRLManager
security/manager/ssl/public/nsicrlmanager.idlscriptable please add a summary to this article. ...
...ing key); constants constant value description type_autoupdate_time_based 1 type_autoupdate_freq_based 2 methods computenextautoupdatetime() wstring computenextautoupdatetime( in nsicrlinfo info, in unsigned long autoupdatetype, in double noofdays ); parameters info autoupdatetype noofdays return value deletecrl() delete the crl. void deletecrl( in unsigned long crlindex ); parameters crlindex getcrls() get a list of crl entries in the db. nsiarray getcrls(); parameters none. return value importcrl() import a crl into the certificate database. void importcrl( [array, size_is(length)] in octet data, in unsigned long length, in nsiuri uri, in unsigned long type, in boolean dosilentdownload, in wstring crlkey ); parameters data length uri type...
nsIDOMOfflineResourceList
e dynamically managed resource list. dom/interfaces/offline/nsidomofflineresourcelist.idlscriptable please add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports 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 attribute type description mozitems nsidomofflineresourcelist the list of dynamically-managed entries in the offline resource list. read only. mozlength unsigned long the number of entries in the dynamically managed offline resource list...
...domstring uri ); parameters uri the uri of the resource to check. return value true if the resource is in the list, otherwise false. mozitem returns the uri of the item at the specific offset into the list of cached resources. note: this method is deprecated in firefox 3.5; you should instead access the list directly using the items attribute. domstring mozitem( in unsigned long index ); parameters index the index of the cached item whose uri should be returned. return value an domstring containing the uri of the specified resource. mozremove() removes an item from the list of dynamically managed entries. if this was the last reference to the given uri in the application cache, the cache entry is removed. void mozremove( in domstring uri ); parameters ur...
nsIDOMStorage
only exist once within a storage object, and only one value may be associated with a particular key. keys are stored in a particular order with the condition that this order not change by merely changing the value associated with a key, but the order may change when a key is added or removed. method overview void clear(); domstring getitem(in domstring key); domstring key(in unsigned long index); void removeitem(in domstring key); void setitem(in domstring key, in domstring data); attributes attribute type description length unsigned long the number of keys stored in the session store. read only. methods clear() clear the content of this storage bound to a domain or an origin. void clear(); parameters none. getitem() returns from session storage the data corresponding to...
...meters none. getitem() returns from session storage the data corresponding to the specified key. domstring getitem( in domstring key ); parameters key the key for which data should be returned. return value an nsidomstorageitem object describing the data corresponding to the specified key, or null if no data exists for the given key. key() returns the key for the item stored at the specified index in the data store. domstring key( in unsigned long index ); parameters index the index for which the corresponding key should be returned. return value a string containing the requested key. exceptions thrown index_size_err there is no key at the specified index. removeitem() given a key, removes the corresponding entry from the session store. void removeitem( in domstring key ); parame...
nsIDOMStorage2
dom window's local storage object can be retrieved from the window's localstorage attribute. dom/public/idl/storage/nsidomstorage2.idlscriptable please add a summary to this article. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports method overview void clear(); domstring getitem(in domstring key); domstring key(in unsigned long index); void removeitem(in domstring key); void setitem(in domstring key, in domstring data); attributes attribute type description length unsigned long the number of keys stored in local storage. methods clear() clears the contents of this storage context; this removes all values bound to the domain or origin. void clear(); parameters none. getitem() returns from local storage the da...
...n. void clear(); parameters none. getitem() returns from local storage the data corresponding to the specified key. domstring getitem( in domstring key ); parameters key the key for which data should be returned. return value a string containing the data corresponding to the specified key, or null if no data exists for the given key. key() returns the key for the item stored at the specified index in the data store. domstring key( in unsigned long index ); parameters index the index for which the corresponding key should be returned. return value a string containing the requested key. exceptions thrown index_size_errthere is no key at the specified index. removeitem() given a key, removes the corresponding entry from local storage. void removeitem( in domstring key ); parameters ke...
nsIDOMXPathResult
read only. ...
...ailable nodes of an unordered_node_iterator_type or ordered_node_iterator_type result. nsidomnode iteratenext(); parameters none. return value a dom node. snapshotitem() returns the specified node from what is essentially an array of resulting dom nodes. is only available if the result type is unordered_node_snapshot_type or ordered_node_snapshot_type. nsidomnode snapshotitem( in unsigned long index ); parameters index the index of the dom node to return. return value a dom node. see also introduction to using xpath in javascript document object model (dom) level 3 xpath specification nsidomxpathevaluator document.evaluate nsidomxpathexception ...
nsIDocShell
(after the onunload event has fired, but before the new document has been set up) read only. isoffscreenbrowser boolean if true, this docshell is not visible in the traditional sense, but is being actively rendered to the screen (such as by being painted to a canvas), and should be treated accordingly. layouthistorystate nsilayouthistorystate loadedtransindex long keeps track of the previous shtransaction index and the current shtransaction index at the time that the doc shell begins to load. used for contentviewer eviction. read only. loadtype unsigned long load type for the document. valid states are defined in constants. note that nsidocshell may use other states internally so you should check for the specific state bit. ...
...assumed to be nulled out by the parent when the parent is going away. obsolete since gecko 1.8 prescontext nsprescontext presentation context for the currently loaded document. this may be null. read only. native code only! presshell nsipresshell presentation shell for the currently loaded document. this may be null. read only. native code only! previoustransindex long keeps track of the previous shtransaction index and the current shtransaction index at the time that the doc shell begins to load. used for contentviewer eviction. read only. printpreview nsiwebbrowserprint if the current content viewer is not initialized for print preview, it is replaced with one which is and to which an about:blank document is loaded. read only. ...
nsIDragSession
widget/public/nsidragsession.idlscriptable provides support for interacting 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 description 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 u...
... targetsize nssize sets the current width and height of the drag target area. it will contain the current 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 multiple drag items, zero-based. must be less than numdropitems. isdataflavorsupported() checks to see if any of the native data on the clipboard matches a given data flavor. if numdropitems is greater than one, there is no indication as to which of the items matches the data flavor. boolean ...
nsIDynamicContainer
firefox 3) the service can fill result nodes directly into the container when it is opened. it can use the property bag on every result node to store data associated with each item, such as a full path on disk. it can also create additional containers for each container, registered to its service. method overview void oncontainermoved(in long long aitemid, in long long anewparent, in long anewindex); void oncontainernodeclosed(in nsinavhistorycontainerresultnode acontainer); void oncontainernodeopening(in nsinavhistorycontainerresultnode acontainer, in nsinavhistoryqueryoptions aoptions); void oncontainerremoving(in long long aitemid); methods oncontainermoved() this method is called when the given container has just been moved, in case the service needs to do any bookkeeping. it i...
...nerresultnode acontainer, in nsinavhistoryqueryoptions aoptions); void oncontainerremoving(in long long aitemid); methods oncontainermoved() this method is called when the given container has just been moved, in case the service needs to do any bookkeeping. it is called after the container has been moved. void oncontainermoved( in long long aitemid, in long long anewparent, in long anewindex ); parameters aitemid the item-id of the container item. anewparent the item of the new parent folder for the container. anewindex the index at which the container will be inserted, or "-1" to append to the end of the list. oncontainernodeclosed() this method is called when the given container has just been collapsed so that the service can do any necessary cleanup. this is not guaranteed to g...
nsIHttpHeaderVisitor
his is done by subscribing to the http-on-examine-response and http-on-examine-cached-response observers. when the observer fires, the visitor interface is used to walk through the response headers and evaluate the mime type. ...
...d http-on-examine-cached-response observers. when the observer fires, the visitor interface is used to walk through the response headers and evaluate the mime type. ...
nsIMessageBroadcaster
sage managers within its window. see message manager interfaces for more details on the distinction between message senders and message broadcasters. methods void broadcastasyncmessage([optional] in astring messagename, [optional] in jsval obj, [optional] in jsval objects); nsimessagelistenermanager getchildat(in unsigned long aindex); broadcastasyncmessage() like sendasyncmessage(), but also broadcasts this message to all "child" message managers of this message manager. see nsimessagelistener::receivemessage() for the format of the data delivered to listeners. warning: broadcasting messages can be very expensive and leak sensitive data. use with extreme caution. throws ns_error_not_initialized if the sender is not...
...data property of the received message. objects object. an object each of whose properties is an object. this becomes the objects property of the received message, with each original object replaced with a cross process object wrapper for it. getchildat() return a single subordinate message manager. parameters name type description aindex number the index of the subordinate message manager to retrieve. returns nsimessagelistenermanager: the message manager at the given index. attributes childcount number: the number of subordinate message managers. read only. ...
nsIMsgDBHdr
meters propertyname the name of the property to retrieve. return value the value of the property. getuint32property() get an integer property. usually you would use this to store your own properties. unsigned long getuint32property(in string propertyname); parameters propertyname the name of the property to retrieve. thunderbird stored uint32 properties (not a complete list): indexed used for spotlight integration on osx. notaphishmessage indicates whether phisihing filters have been run on a message yet. return value the value of the property. setuint32property() void setuint32property(in string propertyname, in unsigned long propertyval); parameters propertyname the name of the property to set. propertyval the value of the...
...); parameters flags flags to be retained on the current message flags. all other flags are cleared. setreferences() void setreferences(in string references); parameters references sets the list of references for a news message. getstringreference() returns one of the references in the list of references. acstring getstringreference(in long refnum); parameters refnum the index of the reference to return. must be less than the total number of references. setrecipientsarray() uses the header parser to recreate the recipients header from an array of names and addresses. void setrecipientsarray(in string names, in string addresses, in unsigned long numaddresses); parameters names a null-delimited list of recipien...
nsIMsgFilter
eadonly attribute nsimsgfiltercustomaction customaction; methods addterm() void nsimsgfilter::addterm ( in nsmsgsearchattribvalue attrib, in nsmsgsearchopvalue op, in nsimsgsearchvalue value, in boolean booleanand, in acstring arbitraryheader ) getterm() void nsimsgfilter::getterm ( in long termindex, in nsmsgsearchattribvalue attrib, in nsmsgsearchopvalue op, in nsimsgsearchvalue value, out boolean booleanand, out acstring arbitraryheader ) appendterm() void nsimsgfilter::appendterm (in nsimsgsearchterm term) createterm() nsimsgsearchterm nsimsgfilter::createterm ( ) matchhdr() void nsimsgfilter::matchhdr ( in nsi...
...lder folder, in nsimsgdatabase db, in string headers, in unsigned long headersize, out boolean result ) logrulehit() void nsimsgfilter::logrulehit ( in nsimsgruleaction afilteraction, in nsimsgdbhdr aheader ) createaction() nsimsgruleaction nsimsgfilter::createaction ( ) getactionat() nsimsgruleaction nsimsgfilter::getactionat (in long aindex) appendaction() void nsimsgfilter::appendaction (in nsimsgruleaction action ) clearactionlist() void nsimsgfilter::clearactionlist() getsortedactionlist() void nsimsgfilter::getsortedactionlist (in nsisupportsarray actionlist) ...
nsIMsgFilterList
ribute unsigned long nsimsgfilterlist::filtercount loggingenabled attribute boolean nsimsgfilterlist::loggingenabled defaultfile attribute nsilocalfile nsimsgfilterlist::defaultfile logstream attribute nsioutputstream nsimsgfilterlist::logstream logurl readonly attribute acstring nsimsgfilterlist::logurl methods getfilterat() nsimsgfilter nsimsgfilterlist::getfilterat (in unsigned long filterindex ) getfilternamed() nsimsgfilter nsimsgfilterlist::getfilternamed (in astring filtername) setfilterat() nsimsgfilter nsimsgfilterlist::setfilterat ( in unsigned long filterindex, in nsimsgfilter filter ) removefilter() void nsimsgfilterlist::removefilter (in nsimsgfilter filter) removefilterat() void nsimsgfilterlist::removefilterat (in unsigned long filterindex)...
...terat() nsimsgfilter nsimsgfilterlist::setfilterat ( in unsigned long filterindex, in nsimsgfilter filter ) removefilter() void nsimsgfilterlist::removefilter (in nsimsgfilter filter) removefilterat() void nsimsgfilterlist::removefilterat (in unsigned long filterindex) movefilterat() void nsimsgfilterlist::movefilterat ( in unsigned long filterindex, in nsmsgfiltermotionvalue motion ) insertfilterat() void nsimsgfilterlist::insertfilterat ( in unsigned long filterindex, in nsimsgfilter filter ) movefilter() void nsimsgfilterlist::movefilter ( in nsimsgfilter filter, in nsmsgfiltermotionvalue motion ) createfilter() nsimsgfilter nsimsgfilterlist::createfilter ( in astring name ) sav...
nsINavHistoryResultNode
1) attributes attribute type description accesscount unsigned long total number of times the uri has been accessed. 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). read only. bookmarkindex long when this item is in a bookmark folder (its parent is of type folder), this is the index into that folder at which this node resides. these indices start at 0 and increase in the order at which the nodes appear in the bookmark folder. for items that are not in a bookmark folder, this value is -1. read only. dateadded prtime if the node is an item (bookmark, folder, or separator), this valu...
...e of node. you can use queryinterface to access the corresponding specialized result node interface. read only. uri autf8string the uri of the resource represented by the node. for visits and urls, this is the url of the page. for folders and queries, this is the place: uri of the corresponding folder or query. this may be empty for other types of objects, like host containers. read only. viewindex long value with undefined meaning for use by the view. its initial value will be -1. the result implementation treats 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 initita...
nsISHEntry
6.0 / thunderbird 6.0 / seamonkey 2.3) implemented by: @mozilla.org/browser/session-history-entry;1. ...
.... methods addchildshell() saved child docshells corresponding to contentviewer. the child shells are restored as children of the parent docshell, in this order, when the parent docshell restores a saved presentation. append a child shell to the end of our list. void addchildshell( in nsidocshelltreeitem shell ); parameters shell childshellat() nsidocshelltreeitem childshellat( in long index ); parameters index the child shell at index; null if index is out of bounds. return value clearchildshells() clear the child shell list. void clearchildshells(); parameters none. clone() nsishentry clone(); parameters none. return value native code only!create additional ways to create an entry. void create( in nsiuri uri, in astring title, in nsiinputstream inputstream, in nsilay...
nsISHistoryListener
ny action (except adding a new session history entry) from happening by returning false from the corresponding callback method. a session history listener can be registered on a particular nsishistory instance via the nsishistory.addshistorylistener() method. method overview boolean onhistorygoback(in nsiuri abackuri); boolean onhistorygoforward(in nsiuri aforwarduri); boolean onhistorygotoindex(in long aindex, in nsiuri agotouri); void onhistorynewentry(in nsiuri anewuri); boolean onhistorypurge(in long anumentries); boolean onhistoryreload(in nsiuri areloaduri, in unsigned long areloadflags); methods onhistorygoback() called when navigating to a previous session history entry, for example due to an nsiwebnavigation.goback() call. boolean onhistorygoback( in nsiuri abackuri )...
...oceed or false to cancel it. onhistorygoforward() called when navigating to a next session history entry, for example due to an nsiwebnavigation.goforward() call. boolean onhistorygoforward( in nsiuri aforwarduri ); parameters aforwarduri the uri of the session history entry being navigated to. return value true to allow the go forward operation to proceed or false to cancel it. onhistorygotoindex() called when navigating to a session history entry by index, for example, when nsiwebnavigation.gotoindex() is called. boolean onhistorygotoindex( in long aindex, in nsiuri agotouri ); parameters aindex the index in session history of the entry to be loaded. agotouri the uri of the session history entry to be loaded. return value true to allow the operation to proceed or false to cancel i...
nsISelection
offset); native code only! void collapsetoend(); void collapsetostart(); boolean containsnode(in nsidomnode node, in boolean partlycontained); void deletefromdocument(); void extend(in nsidomnode parentnode, in long offset); void extendnative(in nsidomnode parentnode, in long offset); native code only! ...
... in nsidomnode parentnode, in long offset ); parameters parentnode the node where the selection will be extended to. offset where in the node to place the offset in the new selection end. native code only!extendnative void extendnative( in nsinode parentnode, in long offset ); parameters parentnode offset getrangeat() returns the nsidomrange at the specified index. nsidomrange getrangeat( in long index ); parameters index return value the nsidomrange requested modify() modifies the selection. note that the parameters are case-insensitive. void modify( in domstring alter, in domstring direction, in domstring granularity ); parameters alter can be one of { "move", "extend()" } "move" collapses the selection to the end of the se...
nsITaskbarWindowPreview
buttons may be accessed by calling getbutton(); each button is an nsitaskbarpreviewbutton 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. method overview nsitaskbarpreviewbutton getbutton(in unsigned long index); attributes attribute type description enablecustomdrawing boolean if true, the nsitaskbarpreviewcontroller object's nsitaskbarpreviewcontroller.drawpreview() and nsitaskbarpreviewcontroller.drawthumbnail() methods will be called to draw the preview. if false, the operating system draws these for you. constants ...
...e description num_toolbar_buttons 7 the maximum number of toolbar buttons supported by the windows taskbar api. methods getbutton() returns the specified button from the preview's toolbar. note: by default, all buttons are hidden. you must fetch and configure each button that you want to make visible. nsitaskbarpreviewbutton getbutton( in unsigned long index ); parameters index the index into the button array for the nsitaskbarpreviewbutton to retrieve. this value must be at least 0 (the leftmost button) and less than num_toolbar_buttons. return value an nsitaskbarpreviewbutton describing the requested button. see also nsitaskbarpreview nsitaskbarpreviewcontroller nsitaskbartabpreview nsitaskbarpreviewbutton nsiwintaskbar ...
nsITreeColumns
the nsitreecolumns interface represents the tree columns. layout/xul/base/src/tree/public/nsitreecolumns.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview nsitreecolumn getcolumnat(in long index); nsitreecolumn getcolumnfor(in nsidomelement element); nsitreecolumn getfirstcolumn(); nsitreecolumn getkeycolumn(); nsitreecolumn getlastcolumn(); nsitreecolumn getnamedcolumn(in astring id); nsitreecolumn getprimarycolumn(); nsitreecolumn getsortedcolumn(); void invalidatecolumns(); void restorenaturalorder(); attributes attribute type description count long the number of columns. read only. length long an alias for count (for the benefit of scripts which treat this as an array)...
...olumn getsortedcolumn(); void invalidatecolumns(); void restorenaturalorder(); attributes attribute type description count long the number of columns. read only. length long an alias for count (for the benefit of scripts which treat this as an array). read only. tree nsitreeboxobject the tree widget for these columns. read only. methods getcolumnat() get the column for a given index. nsitreecolumn getcolumnat( in long index ); parameters index index of the column return value a nsitreecolumn for this index. getcolumnfor() get the column for a given element. nsitreecolumn getcolumnfor( in nsidomelement element ); parameters element a dom element return value a nsitreecolumn for this element. getfirstcolumn() get the first column. nsitreecolumn getfirstcolumn(); par...
nsIUpdate
a complete file-replace patch. 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. 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 description 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 it...
... statustext astring an optional message associated with the update. type astring the type of patch represented by the object: "major" a major new version of the application. "minor" a minor update, such as a security update. version astring the application version of the update.obsolete since gecko 2.0 methods getpatchat() retrieves a patch. nsiupdatepatch getpatchat( in unsigned long index ); parameters index the index of the patch to retrieve. return value an nsiupdatepatch object describing the specified patch. serialize() serializes the update object into a dom element. nsidomelement serialize( in nsidomdocument updates ); parameters updates the dom document into which to serialize the update. return value the patch object serialized into an nsidomelement. see also nsiu...
nsPIPromptService
embedding/components/windowwatcher/public/nspipromptservice.idlscriptable this interface is for the dialog implementers, not for other developers. inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) implemented by: the contract id isn't defined. this interface defines the meaning of each indexes of getint(), setint(), getstring() and setstring() of the nsidialogparamblock interface but they are defined on in c++. the indexes for getstring() and setstring() are: emsg the value is 0. this is the message text of the dialog. echeckboxmsg the value is 1. this is the label text of a checkbox on the dialog. eiconclass the value is 2. this is the class attribute value of the icon image. etitlemessage the value is 3. this is the heading of...
...3text the value is 11. this is the label of the forth button on the dialog. edialogtitle the value is 12. this is the title of the dialog. eopeningsound obsolete since gecko 1.9.2 the value is 13. this is the system sound name which should be played when the dialog is shown. see also nsisound.playsystemsound(). this is obsolete on gecko 1.9.2 and later. you should use esoundeventid instead. the indexes for getint() and setint() are: ebuttonpressed the value is 0. this is used for the result of the dialog. the pressed button number will be returned. echeckboxstate the value is 1. this is the default checkbox state and the result of it. enumberbuttons the value is 2. this is the number of the visible buttons on the dialog. enumbereditfields the value is 3. this is the number of the visible tex...
Storage
a named placeholder called "parameter" to be bound later (described in binding parameters). similarly, the c++ looks like this: nscomptr<mozistoragestatement> statement; rv = dbconn->createstatement(ns_literal_cstring("select * from table_name where column_name = ?1"), getter_addrefs(statement)); ns_ensure_success(rv, rv); this example uses the numbered placeholder indexed by zero for a parameter to be bound later (described in binding parameters). note: numerical indexes for parameters are always one less than the number you write in the sql. the use of numerical indexes for parameters is strongly discouraged in javascript where named parameters are much easier to use. note: if you need to execute a statement multiple times, caching the result of createstateme...
...inding functions can be found with the mozistoragestatement documentation. c++ example: nscomptr<mozistoragestatement> statement; rv = mdbconn->createstatement(ns_literal_cstring("select * from table_name where id = ?1"), getter_addrefs(statement)); ns_ensure_success(rv, rv); rv = statement->bindint32parameter(0, 1234); ns_ensure_success(rv, rv); note: numerical indexes for parameters are always one less than the number you write in the sql. the use of numerical indexes for parameters is strongly discouraged in javascript where named parameters are much easier to use. binding multiple sets of parameters starting in gecko 1.9.2 (firefox 3.6), there's a new, more convenient way to bind multiple sets of parameters at once prior to executing your statement asy...
xptcall FAQ
tub code for calling and implementing all interfaces. though the chosen approach requires some core platform specific code, it has minimal footprint and is extendable to work with any valid xpcom interface without requiring additional per platform compiled code to be distributed. what does xptcall really do? the core invoke function has the declaration: xptc_public_api(nsresult) xptc_invokebyindex(nsisupports* that, pruint32 methodindex, pruint32 paramcount, nsxptcvariant* params); nsxptcvariant is a discriminated union of the types that can be passed as parameters to the target function (including void* to represent arbitrary pointer types). given the correct set of parameters, this function can call any method on any xpcom in...
...criminated union of the types that can be passed as parameters to the target function (including void* to represent arbitrary pointer types). given the correct set of parameters, this function can call any method on any xpcom interface. xpconnect uses information from typelib files to reflect arbitrary xpcom interfaces into javascript and to make calls from javascript to xpcom using xptc_invokebyindex. the information in the typelibs allows xpconnect to convert function parameters and build the nsxptcvariant array required to make this call. the stubs (or impersonation) facility of xptcall allows for implementing a class which can, at runtime, pretend to be any xpcom interface. this is done by providing a vtbl full of generic function stubs in xptcall. these stubs forward calls to a shared fu...
Demo Addon
nsimsgdbhdr. we iterate over the first ten of them and extract author, subject and date for each one. demo 3- search messages by subject this demo shows how to find messages by a subject accross all folders using gloda. ...
... to find messages by a subject accross all folders using gloda. ...
Standard OS Libraries
find out what types to give to values/arguments by supplying links to the documentation of the os libraries. windows windows has many standard os libraries. the most common, found on all windows os version, is "winapi". windows also has the "winapilists" and ".net framework" (i'm not sure if it can be accessed jsctypes but probably). a complete list of windows apis can be found at the msdn api index. winapi this is the one that is most commonly used by js-ctypes. this comes shipped by default with all installations of windows operating systems since win98. it's also known as winapi32 or just winapi. a list of all the functions available through this api can be found at the msdn winapi index. for finding out the values and types of arguments and returns of the functions you want to use from...
...i then searched it on msdn and saw that it needed the user32.dll. (msdn - getcursorpos) this example was created on windows xp sp2. it is a full working example; just copy & paste it to try it out. ...
ArrayType
ly for unsized arraytype. return value a cdata representing the newly allocated array. exceptions thrown typeerror length is not provided for unsized array, or is provided for sized array. arraytype cdata properties property type description length number the length of the array. read only. in addition, each element in the array can be referenced by index using standard bracket notation, such as myarray[index]. properties inherited from cdata property type description constructor ctype the data type of the cdata object, as a ctype. read only. note: this is never ctypes.void_t or an array type with an unspecified length. value object the javascript equivalent of the cdata object's value. ...
...raytype cdata methods addressofelement() returns a new cdata object of the appropriate pointer type, whose value points to the specified array element on which the method was called. cdata addressofelement( idx ); parameters idx a numeric value indicating the offset into the array of the element just to return a pointer. if this value isn't a valid javascript number that's also a valid index into the array, a typeerror exception is thrown. return value a new cdata object pointing to the specified element. the type of the returned object will be determined by ctypes.pointertype(thearraytype.constructor.elementtype)). see also ctype cdata type conversion ...
Plug-in Basics - Plugins
this nesting is quite commo...
...base="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,30,0" width="749" height="68"> <param name="movie" value="foo.swf"> <param name="quality" value="high"> <param name="bgcolor" value="#eeeeee"> <param name="salign" value="tl"> <param name="menu" value="0"> <embed src="foo.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash" type="application/x-shockwave-flash" width="749" height="68" bgcolor="#eeeeee" salign="tl" menu="0"> </embed> </object> using custom embed attributes in addition to these standard attributes, you can create private, plug-in-specific attributes and use them in the embed attribute to pass extra information between the html page and the plu...
Debugger.Script - Firefox Developer Tools
null if the source code was not retained. if the instance refers to webassembly code, the debugger.source instance representing the serialized text format of the webassembly code. sourcestart if the instance refers to a jsscript, the character within the debugger.source instance given by source at which this script’s code starts; zero-based. if this is a function’s script, this is the index of the start of the function token in the source code. if the instance refers to webassembly code, throw a typeerror. sourcelength if the instance refers to a jsscript, the length, in characters, of this script’s code within the debugger.source instance given by source. if the instance refers to webassembly code, throw a typeerror. global if the instance refers to a jsscript, a ...
...ebugger.script prototype object the functions described below may only be called with a this value referring to a debugger.script instance; they may not be used as methods of other kinds of objects. getalloffsets() if the instance refers to a jsscript, return an arrayl describing the relationship between bytecode instruction offsets and source code positions in this script.l is sparse, and indexed by source line number. if a source line numberline has no code, thenl has noline property. if there is code forline, then l[line] is an array of offsets of byte code instructions that are entry points to that line. for example, suppose we have a script for the following source code: a=[] for (i=1; i < 10; i++) // it's hip to be square. a[i] = i*i; calling getalloffsets() on that c...
CSSStyleDeclaration.item() - Web APIs
the cssstyledeclaration.item() method interface returns a css property name from a cssstyledeclaration by index. this method doesn't throw exceptions as long as you provide arguments; the empty string is returned if the index is out of range and a typeerror is thrown if no argument is provided. syntax var propertyname = style.item(index); parameters index is the index of the node to be fetched. the index is zero-based. return value propertyname is a domstring that is the name of the css property at the specified index. ...
...index is out of range and a typeerror is thrown if no argument is provided. syntax var propertyname = style.item(index); parameters index is the index of the node to be fetched. the index is zero-based. return value propertyname is a domstring that is the name of the css property at the specified index. javascript has a special simpler syntax for obtaining an item from a nodelist by index: var propertyname = style[index]; example var style = document.getelementbyid('div1').style; var propertyname = style.item(1); // or simply style[1] - returns the second style listed specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.item()' in that specification. working draft document obje...
CSSStyleSheet - Web APIs
remove items in cssrules, use the cssstylesheet's insertrule() and deleterule() methods. ownerrule read only if this stylesheet is imported into the document using an @import rule, the ownerrule property returns the corresponding cssimportrule; otherwise, this property's value is null. methods inherits methods from its parent, stylesheet. deleterule() deletes the rule at the specified index into the stylesheet's rule list. insertrule() inserts a new rule at the specified position in the stylesheet, given the textual representation of the rule. legacy properties these properties are legacy properties first introduced by microsoft long ago; they shouldn't be used but are not likely to be removed anytime soon. rules read only the rules property is functionally identical to th...
... danger of being removed anytime soon. addrule() adds a new rule to the stylesheet given the selector to which the style applies and the style block to apply to the matching elements. this differs from insertrule(), which simply takes the textual representation of the entire rule as a single string. removerule() functionally identical to deleterule(); removes the rule at the specified index from the stylesheet's rule list. notes in some browsers, if a stylesheet is loaded from a different domain, accessing cssrules results in securityerror. a stylesheet is associated with at most one document, which it applies to (unless disabled). a list of cssstylesheet objects for a given document can be obtained using the document.stylesheets property. a specific style sheet can also be acce...
CSSValueList - Web APIs
the cssvaluelist interface derives from the cssvalue interface and provides the abstraction of an ordered collection of css values. some properties allow an empty list in their syntax. in that case, these properties take the none identifier. so, an empty list means that the property has the value none. the items in the cssvaluelist are accessible via an integral index, starting from 0. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/cssvalue" target="_top"><rect x="1" y="1" width="80" height="50" fill="#fff" ...
...e53" text-anchor="middle" alignment-baseline="middle">cssvaluelist</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, cssvalue. cssvaluelist.lengthread only an unsigned long representing the number of cssvalues in the list. methods cssvaluelist.item() this method is used to retrieve a cssvalue by ordinal index. the order in this collection represents the order of the values in the css style property. if index is greater than or equal to the number of values in the list, this returns null. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvalueslist' in that specification. obsolete initial definition ...
Basic animations - Web APIs
} function anim() { requestanimationframe(anim); c.fillstyle = "rgba(0,0,0,0.05)"; c.fillrect(0, 0, cn.width, cn.height); a.foreach(function(e, i) { e.dr(); }); } </script> <style> #cw { position: fixed; z-index: -1; } body { margin: 0; padding: 0; background-color: rgba(0,0,0,0.05); } </style> </head> <body> <canvas id="cw"></canvas> </body> </html> output snake game <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" cont...
...-1, e = -1; if (t) { var i = { ...this.sn[0] }; if ("arrowup" == d && (i.y -= this.h), "arrowdown" == d && (i.y += this.h), "arrowleft" == d && (i.x -= this.w), "arrowright" == d && (i.x += this.w), i.x >= w ? i.x = 0 : i.x < 0 && (i.x = w - this.w), i.y > h ? ...
CustomElementRegistry.define() - Web APIs
htmlelement { constructor() { // always call super first in constructor super(); // create a shadow root var shadow = this.attachshadow({mode: 'open'}); // create spans var wrapper = document.createelement('span'); wrapper.setattribute('class','wrapper'); var icon = document.createelement('span'); icon.setattribute('class','icon'); icon.setattribute('tabindex', 0); var info = document.createelement('span'); info.setattribute('class','info'); // take attribute content and put it inside the info span var text = this.getattribute('text'); info.textcontent = text; // insert icon var imgurl; if(this.hasattribute('img')) { imgurl = this.getattribute('img'); } else { imgurl = 'img/default.png'; } var ...
... 'padding: 10px;' + 'background: white;' + 'border-radius: 10px;' + 'opacity: 0;' + 'transition: 0.6s all;' + 'position: absolute;' + 'bottom: 20px;' + 'left: 10px;' + 'z-index: 3;' + '}' + 'img {' + 'width: 1.2rem' + '}' + '.icon:hover + .info, .icon:focus + .info {' + 'opacity: 1;' + '}'; // attach the created elements to the shadow dom shadow.appendchild(style); shadow...
Examples of web and XML development using the DOM - Web APIs
ocument.createelement('table'); var thead = table.createthead(); var row = thead.insertrow(-1); var lablelist = ['#', 'property', 'value']; var len = lablelist.length; for (var i=0; i<len; i++) { addcell(row, lablelist[i]); } var tbody = document.createelement('tbody'); table.appendchild(tbody); for (var p in e) { row = tbody.insertrow(-1); row.classname = (row.rowindex % 2)? 'odd':'even'; addcell(row, row.rowindex); addcell(row, p); addcell(row, e[p]); } document.body.appendchild(table); } window.onload = function(event){ showeventproperties(event); } </script> </head> <body> <h1>properties of the dom <span id="eventtype"></span> event object</h1> </body> </html> example 8: using the dom table interface the dom htmltableelement inte...
... methods are htmltableelement.insertrow and tablerow.insertcell. to add a row and some cells to an existing table: <table id="table0"> <tr> <td>row 0 cell 0</td> <td>row 0 cell 1</td> </tr> </table> <script> var table = document.getelementbyid('table0'); var row = table.insertrow(-1); var cell, text; for (var i = 0; i < 2; i++) { cell = row.insertcell(-1); text = 'row ' + row.rowindex + ' cell ' + i; cell.appendchild(document.createtextnode(text)); } </script> notes a table's innerhtml property should never be used to modify a table, although you can use it to write an entire table or the content of a cell. if dom core methods document.createelement and node.appendchild are used to create rows and cells, ie requires that they are appended to a tbody element, whereas ot...
EffectTiming.iterationStart - Web APIs
frameeffectreadonly, and keyframeeffect. syntax var timingproperties = { iterationstart = iterationnumber }; timingproperties.iterationstart = iterationnumber; value a floating-point value whose value is at least 0 and is not +infinity, indicating the offset into the number of iterations the animation sequence is to run at which to start animating. ...
...meanwhile, a value of 1.2 means the animation will begin playback 20% of the way through its second iteration, and so forth. ...
File.getAsBinary() - Web APIs
Web › API › File › getAsBinary
...
... ...
File.getAsText() - Web APIs
Web › API › File › getAsText
...
... ...
Introduction to the File and Directory Entries API - Web APIs
dit a binary file that's in their local file directory. it provides a storage api that is already familiar to your users, who are used to working with file systems. for examples of features you can create with this app, see the sample use cases section. the file and directory entries api and other storage apis the file and directory entries api is an alternative to other storage apis like indexeddb, websql (which has been deprecated since november18, 2010), and appcache. the api is a better choice for apps that deal with blobs for the following reasons: the file and directory entries api offers client-side storage for use cases that are not addressed by databases. if you want to have large mutable chunks of data, the file and directory entries api is a much more efficient storage sol...
... and appcache. the api is a better choice for apps that deal with blobs for the following reasons: the file and directory entries api offers client-side storage for use cases that are not addressed by databases. if you want to have large mutable chunks of data, the file and directory entries api is a much more efficient storage solution than a database. while firefox supports blob storage for indexeddb, chrome currently does not (chrome is still implementing support for blob storage in indexeddb). if you are targeting chrome for your app and you want to store blobs, the file and directory entries api and app cache are your only choices. however, appcache storage isn't locally mutable, and doesn't allow for fine-grained client-side management. in chrome, you can use the file and directory e...
Gamepad - Web APIs
Web › API › Gamepad
senting the controls with axes present on the device (e.g. analog thumb sticks). gamepad.buttons read only an array of gamepadbutton objects representing the buttons present on the device. gamepad.connected read only a boolean indicating whether the gamepad is still connected to the system. gamepad.id read only a domstring containing identifying information about the controller. gamepad.index read only an integer that is auto-incremented to be unique for each device currently connected to the system. gamepad.mapping read only a string indicating whether the browser has remapped the controls on the device to a known layout. gamepad.timestamp read only a domhighrestimestamp representing the last time the data for this gamepad was updated. experimental extensions to gamepad th...
...ation. gamepad.hand read only an enum defining what hand the controller is being held in, or is most likely to be held in. gamepad.hapticactuators read only an array containing gamepadhapticactuator objects, each of which represents haptic feedback hardware available on the controller. example window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.length, e.gamepad.axes.length); }); specifications specification status comment gamepadthe definition of 'gamepad' in that specification. working draft initial definition gamepad extensionsthe definition of 'gamepad extensions' in that specification. editor's draft de...
HTMLAnchorElement - Web APIs
that reflects the rel html attribute, specifying the relationship 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 tabbing navigation order for the current document. htmlanchorelement.target is a domstring that reflects the target html attribute, indicating where to display the linked resource. htmlanchorelement.text is a domstring being a synonym for the node.textcontent property. htmlanchorelement.type is a domstring that reflects the type html ...
...rty has been added: download. technically, the url-related properties, media, host, hostname, pathname, port, protocol, search, and hash, have been moved to the htmlhyperlinkelementutils mixin, and htmlanchorelement implements this mixin. html5the definition of 'htmlanchorelement' in that specification. recommendation the methods blur() and focus(), as well as the properties tabindex and accesskey, are now defined on htmlelement. the following properties are now obsolete: charset, coords, name, rev, and shape. the following properties have been added: hash, host, hostname, media, pathname, port, protocol, rellist, search, and text. document object model (dom) level 2 html specificationthe definition of 'htmlanchorelement' in that specification. obsolete ...
HTMLAreaElement - Web APIs
dicating relationships of the current document to the linked resource, as a list of tokens. htmlhyperlinkelementutils.search is a usvstring containing the search element (including leading question mark '?'), if any, of the referenced url. htmlareaelement.shape is a domstring that reflects the shape html attribute, indicating the shape of the hot-spot, limited to known values. htmlelement.tabindex is a long containing the element's position in the tabbing order. htmlareaelement.target is a domstring that reflects the target html attribute, indicating the browsing context in which to open the linked resource. htmlareaelement.type is a domstring that reflects the type html attribute, indicating the mime type of the linked resource. htmlhyperlinkelementutils.username is a usvstring con...
...g standard the following property has been added: download. technically, the url-related properties, media, host, hostname, pathname, port, protocol, search, and hash, have been moving to the htmlhyperlinkelementutils mixin, and htmlareaelement implements this mixin. html5the definition of 'htmlareaelement' in that specification. recommendation technically, the properties tabindex and accesskey are now defined on htmlelement. the following property is now obsolete: nohref. the following properties have been added: rel, rellist, media, hreflang, type, host, hostname, pathname, port, protocol, search, and hash. document object model (dom) level 2 html specificationthe definition of 'htmlareaelement' in that specification. obsolete no change from docume...
HTMLButtonElement - Web APIs
st that represents a list of <label> elements that are labels for this button. htmlbuttonelement.menu is a htmlmenuelement representing the menu element to be displayed if the button is clicked and is of type="menu". htmlbuttonelement.name is a domstring representing the name of the object when submitted with a form. html5 if specified, it must not be the empty string. htmlbuttonelement.tabindex is a long that represents this element's position in the tabbing order. htmlbuttonelement.type is a domstring indicating the behavior of the button. this is an enumerated attribute with the following possible values: submit: the button submits the form. this is the default value if the attribute is not specified, html5 or if it is dynamically changed to an empty or invalid value. reset: ...
...on. recommendation the menu attribute and type="menu" value have been removed. html 5.1the definition of 'htmlbuttonelement' in that specification. recommendation the following attribute has been added: menu. the type attribute can take one more value, "menu". html5the definition of 'htmlbuttonelement' in that specification. recommendation the attributes tabindex and accesskey, are now defined on htmlelement. the following attributes have been added: autofocus, formaction, formenctype, formmethod, formnovalidate, formtarget, labels, validity, validationmessage, and willvalidate. the following methods have been added: checkvalidity(), setcustomvalidity(). the type attribute is no more read-only. document object model (dom) level 2 html...
HTMLCollection.item - Web APIs
the htmlcollection method item() returns the node located at the specified offset into the collection. note: because the contents of an htmlcollection are live, changes to the underlying dom can and will cause the position of individual nodes in the collection to change, so the index value will not necessarily remain constant for a given node. syntax var element = htmlcollection.item(index) parameters index the position of the node to be returned. elements appear in an htmlcollection in the same order in which they appear in the document's source. return value the node at the specified index, or null if index is less than zero or greater than or equal to the length property. usage notes the item() method returns a numbered element from an htmlcollection. in javascript, it is eas...
...see the example below. ...
HTMLCollection - Web APIs
e the modern dom, collections implementing this interface could only have html elements as their items). an htmlcollection in the html dom is live; it is automatically updated when the underlying document is changed. properties htmlcollection.length read only returns the number of items in the collection. methods htmlcollection.item() returns the specific node at the given zero-based index into the list. returns null if the index is out of range. an alternative to accessing collection[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. htmlcollection.nameditem() returns the specific node whose id or, as a fallback, name matches the string specified by name. matching by name is only done as a last resort, on...
... only in html, and only if the referenced element supports the name attribute. returns null if no node exists by the given name. an alternative to accessing collection[name] (which instead returns undefined when name does not exist). this is mostly useful for non-javascript dom implementations. usage in javascript htmlcollection also exposes its members directly as properties by both name and index. html ids may contain : and . as valid characters, which would necessitate using bracket notation for property access. currently htmlcollections does not recognize purely numeric ids, which would cause conflict with the array-style access, though html5 does permit these. for example, assuming there is one <form> element in the document and its id is myform: var elem1, elem2; // document.forms ...
HTMLElement - Web APIs
t, relative to the layout. htmlelement.properties read only returns a htmlpropertiescollection… htmlelement.spellcheck is a boolean that controls spell-checking. it is present on all html elements, though it doesn't have an effect on all of them. htmlelement.style is a cssstyledeclaration, an object representing the declarations of an element's style attributes. htmlorforeignelement.tabindex is a long representing the position of the element in the tabbing order. htmlelement.title is a domstring containing the text that appears in a popup box when mouse is over the element. htmlelement.translate is a boolean representing the translation. event handlers most event handler properties, of the form onxyz, are defined on the documentandelementeventhandlers, globaleventhandlers o...
...lowing properties: translate, itemscope, itemtype, itemid, itemref, itemprop, properties, and itemvalue. added the following method: forcespellcheck(). moved the onxyz attributes to the globaleventhandlers interface and added an inheritance from it. html5the definition of 'htmlelement' in that specification. recommendation added the following properties: dataset, hidden, tabindex, accesskey, accesskeylabel, draggable, dropzone, contenteditable, iscontenteditable, contextmenu, spellcheck, commandtype, commandlabel, commandicon, commandhidden, commanddisabled, commandchecked, style, and all the onxyz properties. moved the id and classname properties to the element interface. document object model (dom) level 2 html specificationthe definition of 'htmlelement' i...
HTMLImageElement.useMap - Web APIs
s in our learning article add a hitmap on top of an image. usage notes the string value of usemap must be a valid anchor for a <map> element. in other words, this string should be the value of the appropriate <map>'s name attribute with a pound or hash symbol prepended to it. ...
...usemap must be a valid anchor for a <map> element. in other words, this string should be the value of the appropriate <map>'s name attribute with a pound or hash symbol prepended to it. consider a <map> that looks like this: <map name="mainmenu-map"> <area shape="circle" coords="25, 25, 75, 75" href="/index.html" alt="return to home page"> <area shape="rect" coords="25, 25, 100, 150" href="/index.html" alt="shop"> </map> given the image map named mainmenu-map, the image which uses it should look something like the following: <img src="menubox.png" usemap="#mainmenu-map"> for additional examples (including interactive ones), see the articles about the <map> and <area> elements, as well as the guide to using image maps. example the source for this interactive example is stored in a ...
HTMLInputElement - Web APIs
s text, search, tel, url or email; otherwise it is ignored. readonly boolean: returns / sets the element's readonly attribute, indicating that the user cannot modify the value of the control. html5this is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type. selectionstart unsigned long: returns / sets the beginning index of the selected text. when nothing is selected, this returns the position of the text input cursor (caret) inside of the <input> element. selectionend unsigned long: returns / sets the end index of the selected text. when there's no selection, this returns the offset of the character immediately following the current text input cursor position. selectiondirection string: r...
...arch is initiated on an <input> of type="search". also available via the onsearch event handler property. specifications specification status comment html living standardthe definition of 'htmlinputelement' in that specification. living standard html5the definition of 'htmlinputelement' in that specification. recommendation technically, 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, multiple, pattern, placeho...
HTMLObjectElement - Web APIs
s. htmlobjectelement.hspace is a long representing the horizontal space in pixels around the control. htmlobjectelement.name returns a domstring that reflects the name html attribute, specifying the name of the browsing context. htmlobjectelement.standby is a domstring that reflects the standby html attribute, specifying a message to display while the object loads. htmlobjectelement.tabindex is a long representing the position of the element in the tabbing navigation order for the current document. htmlobjectelement.type is a domstring that reflects the type html attribute, specifying the mime type of the resource. htmlobjectelement.typemustmatch is a boolean that reflects the typemustmatch html attribute, indicating if the resource specified by data must only be played if it ma...
... not validate. specifications specification status comment html living standardthe definition of 'htmlobjectelement' in that specification. living standard html5the definition of 'htmlobjectelement' in that specification. recommendation the w3c specification is a latest of a previous version of html living standard technically, the property tabindex is now defined on htmlelement. the following properties are now obsolete: align, archive, border, code, codebase, codetype, declare, hspace, standby, and vspace. the following properties have been added: typemustmatch, contentwindow, willvalidate, validity, and validationmessage. the following methods have been added: checkvalidity() and setcustomvalidity(). document object m...
HTMLOrForeignElement - Web APIs
the focused element is the element which will receive keyboard and similar events by default. specifica...
...the focused element is the element which will receive keyboard and similar events by default. specifications ...
HTMLTableCellElement - Web APIs
tive label for the header cell.. this alternate label can be used in other contexts, such as when describing the headers that apply to a data cell. this is used to offer a shorter term for use by screen readers in particular, and is a valuable accessibility tool. usually the value of abbr is an abbreviation or acronym, but can be any text that's appropriate contextually. htmltablecellelement.cellindex read only a long integer representing the cell's position in the cells collection of the <tr> the cell is contained within. if the cell doesn't belong to a <tr>, it returns -1. htmltablecellelement.colspan an unsigned long integer indicating the number of columns this cell must span; this lets the cell occupy space across multiple columns of the table. it reflects the colspan attribute. html...
...en obsoleted: align, axis, bgcolor, height, width, ch, choff, nowrap, and valign. the headers property is now read-only and contains a domsettabletokenlist rather than a mere domstring. the colspan and rowspan properties are now unsigned long. document object model (dom) level 2 html specificationthe definition of 'htmltablecellelement' in that specification. obsolete the cellindex property is now read-only. document object model (dom) level 1 specificationthe definition of 'htmltablecellelement' in that specification. obsolete initial definition. ...
HTMLTableRowElement.insertCell() - Web APIs
row (<tr>) and returns a reference to the cell. note: insertcell() inserts the cell directly into the row. the cell does not need to be appended separately with node.appendchild() as would be the case if document.createelement() had been used to create the new <td> element. you can not use insertcell() to create a new <th> element though. syntax var newcell = htmltablerowelement.insertcell(index); htmltablerowelement is a reference to an html <tr> element. parameters index optional index is the cell index of the new cell. if index is -1 or equal to the number of cells, the cell is appended as the last cell in the row. if index is greater than the number of cells, an indexsizeerror exception will result. if index is omitted it defaults to -1. return value newcell is an htmltable...
...t.createtextnode() and node.appendchild(). ...
IDBCursor.advance() - Web APIs
Web › API › IDBCursor › advance
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-c...
...nerhtml = '<strong>' + cursor.value.albumtitle + '</strong>, ' + cursor.value.year; list.appendchild(listitem); cursor.advance(2); } else { console.log('every other entry displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'advance()' in that specification. recommendation indexed database api draftthe definition of 'advance()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid web...
IDBCursor.continue() - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-com...
...li'); listitem.innerhtml = cursor.value.albumtitle + ', ' + cursor.value.year; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'continue()' in that specification. recommendation indexed database api draftthe definition of 'continue()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvi...
IDBCursor.direction - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-comp...
...'</strong>, ' + cursor.value.year; list.appendchild(listitem); console.log(cursor.direction); cursor.continue(); } else { console.log('entries displayed backwards.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'direction' in that specification. recommendation indexed database api draftthe definition of 'direction' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvi...
IDBCursor.key - Web APIs
Web › API › IDBCursor › key
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data a...
...innerhtml = cursor.value.albumtitle + ', ' + cursor.value.year; list.appendchild(listitem); console.log(cursor.key); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'key' in that specification. recommendation indexed database api draftthe definition of 'key' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewch...
IDBCursor.primaryKey - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser...
...rsor.value.albumtitle + ', ' + cursor.value.year; list.appendchild(listitem); console.log(cursor.primarykey); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'primarykey' in that specification. recommendation indexed database api draftthe definition of 'primarykey' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid we...
IDBCursorWithValue.value - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-com...
...html = cursor.value.albumtitle + ', ' + cursor.value.year; list.appendchild(listitem); console.log(cursor.value); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'source' in that specification. recommendation indexed database api draftthe definition of 'idbdatabase' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid we...
IDBDatabase.close() - Web APIs
Web › API › IDBDatabase › close
t actually closed until all transactions created using this connection are complete. no new transactions can be created for this connection once this method is called. methods that create transactions throw an exception if a closing operation is pending. note: this feature is available in web workers. syntax idbdatabase.close(); example // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // opening a database. // create event handlers for both success and failure of dbopenrequest.onerror = function(event) { note.innerhtml += "<li>error loading database.</li>"; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += "<li>database initialised.</li>"; // store the result of opening the database in the db variable. db = dbopenrequest.resul...
...unction(event) { note.innerhtml += "<li>error loading database.</li>"; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += "<li>database initialised.</li>"; // store the result of opening the database in the db variable. db = dbopenrequest.result; // now let"s close the database again! db.close(); }; specification specification status comment indexed database api 2.0the definition of 'close()' in that specification. recommendation indexed database api draftthe definition of 'close()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat...
IDBDatabase.name - Web APIs
Web › API › IDBDatabase › name
x var dbname = idbdatabase.name; value a domstring containing the name of the connected database. example this example shows a database connection being opened, the resulting idbdatabase object being stored in a db variable, and the name property then being logged. for a full example, see our to-do notifications app (view example live). // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being // opened successfully, or not dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. this is used a lot be...
...; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. this is used a lot below db = dbopenrequest.result; // this line will log the name of the database, which should be "todolist" console.log(db.name); }; specifications specification status comment indexed database api 2.0the definition of 'name' in that specification. recommendation indexed database api draftthe definition of 'name' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data...
IDBDatabase.objectStoreNames - Web APIs
e interface is a domstringlist containing a list of the names of the object stores currently in the connected database. note: this feature is available in web workers. syntax var list[] = idbdatabase.objectstorenames; value a domstringlist containing a list of the names of the object stores currently in the connected database. example // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database being opened successfully, or not dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. this is used a lot below...
...+= '<li>database initialised.</li>'; // store the result of opening the database in the db variable. this is used a lot below db = dbopenrequest.result; // this line will log the version of the connected database, which should be // an object that looks like { ['my-store-name'] } console.log(db.objectstorenames); }; specifications specification status comment indexed database api 2.0the definition of 'objectstorenames' in that specification. recommendation indexed database api draftthe definition of 'objectstorenames' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/...
IDBDatabase.version - Web APIs
f the idbdatabase interface is a 64-bit integer that contains the version of the connected database. when a database is first created, this attribute is an empty string. note: this feature is available in web workers. syntax var myinteger = idbdatabase.version; value an integer containing the version of the connected database. example // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // these two event handlers act on the database // being opened successfully, or not dbopenrequest.onerror = function(event) { note.innerhtml += '<li>error loading database.</li>'; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. this is used a lot be...
...penrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. this is used a lot below db = dbopenrequest.result; // this line will log the version of the connected database, which should be "4" console.log(db.version); }; specifications specification status comment indexed database api 2.0the definition of 'version' in that specification. recommendation indexed database api draftthe definition of 'version' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat...
IDBDatabaseException - Web APIs
attributes attribute type description code unsigned short the most appropriate error code for the condition. message domstring error message describing the exception raised. constants note: do not rely on the numeric values of the constants, which might change as the specifications continue to change. use the constant names instead. ...
...ange as the specifications continue to change. use the constant names instead. constant value description abort_err 8 a request was aborted, for example, through a call to idbtransaction.abort. constraint_err 4 a mutation operation in the transaction failed because a constraint was not satisfied. for example, an object, such as an object store or index, already exists and a request attempted to create a new one. data_err 5 data provided to an operation does not meet requirements. non_transient_err 2 an operation was not allowed on an object. unless the cause of the error is corrected, retrying the same operation would result in failure. not_allowed_err 6 an operation was called on an object wher...
IDBEnvironment - Web APIs
important: the indexeddb property that was previously defined in this mixin is instead now windoworworkerglobalscope.indexeddb (that is, defined as a member of the windoworworkerglobalscope mixin). the idbenvironment helper of the indexeddb api contains the indexeddb property, which provides access to indexeddb functionality. it is the top level indexeddb interface implemented by the window and worker objects. note: this feature is available in web workers. properties idbenvironment.indexeddb read only provides a mechanism for applications to asynchronously access capabilities of indexed databases; contains an idbfactory object. example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess ...
...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. ...
IDBFactory.cmp() - Web APIs
Web › API › IDBFactory › cmp
the cmp() method of the idbfactory interface compares two values as keys to determine equality and ordering for indexeddb operations, such as storing and iterating. note: this feature is available in web workers. note: do not use this method for comparing arbitrary javascript values, because many javascript values are either not valid indexeddb keys (booleans and objects, for example) or are treated as equivalent indexeddb keys (for example, since indexeddb ignores arrays with non-numeric properties and treats them as empty arrays, so any non-numeric arrays are treated as equivalent). this throws an exception if either of the values is not a valid key. syntax var result = indexeddb.cmp(first, second); parameters first the first key to compare. second the second key to compare. ...
... description -1 1st key is less than the 2nd key 0 1st key is equal to the 2nd key 1 1st key is greater than the 2nd key exceptions this method may raise a domexception of the following types: attribute description dataerror one of the supplied keys was not a valid key. example var a = 1; var b = 2; var result = window.indexeddb.cmp(a, b); console.log( "comparison results: " + result ); specifications specification status comment indexed database api 2.0the definition of 'cmp()' in that specification. recommendation indexed database api draftthe definition of 'cmp()' in that specification. recommendation browser compatibility the compatibility table on th...
databases - Web APIs
the databases method of the idbfactory interface returns a list represening all the available databases, including their names and versions. note: this feature is available in web workers. note: this method is introduced in a draft of a specifications and browser compatibility is limited. syntax const promise = indexeddb.databases() parameters the method does not take in any parameters. return value a promise that resolves either to an error or a list of dictionaries, each with two elements, name and version. name the database name. version the database version. exceptions this method may raise a domexception of the following types: attribute description securityerror the method is called from an opaque origin. other error specificatio...
...ries, each with two elements, name and version. name the database name. version the database version. exceptions this method may raise a domexception of the following types: attribute description securityerror the method is called from an opaque origin. other error specification does not describe all possible errors. example const promise = indexeddb.databases() promise.then(databases => { console.log(databases) }) specifications specification status comment indexed database api draftthe definition of 'databases()' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute ...
IDBKeyRange.lower - Web APIs
Web › API › IDBKeyRange › lower
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-dat...
...l = '<strong>' + cursor.value.fthing + '</strong>, ' + cursor.value.frating; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'lower' in that specification. recommendation indexed database api draftthe definition of 'lower' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewc...
IDBKeyRange.lowerBound() - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/brow...
...trong>' + cursor.value.fthing + '</strong>, ' + cursor.value.frating; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'lowerbound()' in that specification. recommendation indexed database api draftthe definition of 'lowerbound()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid w...
IDBKeyRange.lowerOpen - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-co...
... = '<strong>' + cursor.value.fthing + '</strong>, ' + cursor.value.frating; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'loweropen' in that specification. recommendation indexed database api draftthe definition of 'loweropen' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webv...
IDBKeyRange.only() - Web APIs
Web › API › IDBKeyRange › only
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data ...
...rhtml = '<strong>' + cursor.value.fthing + '</strong>, ' + cursor.value.frating; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'only' in that specification. recommendation indexed database api draftthe definition of 'only' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewch...
IDBKeyRange.upper - Web APIs
Web › API › IDBKeyRange › upper
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-dat...
...l = '<strong>' + cursor.value.fthing + '</strong>, ' + cursor.value.frating; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'upper' in that specification. recommendation indexed database api draftthe definition of 'upper' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewc...
IDBKeyRange.upperBound() - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/brow...
...ng>' + cursor.value.fthing + '</strong>, ' + cursor.value.frating; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'upperbound()' in that specification. recommendation indexed database api draftthe definition of 'upperbound()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid w...
IDBKeyRange.upperOpen - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-co...
...'<strong>' + cursor.value.fthing + '</strong>, ' + cursor.value.frating; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; }; specification specification status comment indexed database api 2.0the definition of 'upperopen' in that specification. recommendation indexed database api draftthe definition of 'upperopen' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webv...
IDBObjectStore.getKey() - Web APIs
ons this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobjectstore's transaction is inactive. dataerror the key or key range provided contains an invalid key. invalidstateerror the idbobjectstore has been deleted or removed. ...
... 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. desktopmobilechromeedgefirefoxinternet exploreroperasa...
IDBObjectStore.put() - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data ...
...iginated this request is " + updatetitlerequest.transaction); // when this new request succeeds, run the displaydata() function again to update the display updatetitlerequest.onsuccess = () => { displaydata(); }; }; specification specification status comment indexed database api 2.0the definition of 'put()' in that specification. recommendation indexed database api draftthe definition of 'put()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewch...
IDBRequest.onerror - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat...
...h the request, log what it is console.log("there has been an error with retrieving your data: " + objectstoretitlerequest.error); // todo what about event parameter into onerror()? what will be inside of this event? }; specifications specification status comment indexed database api 2.0the definition of 'onerror' in that specification. recommendation indexed database api draftthe definition of 'onerror' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvie...
IDBRequest.onsuccess - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-co...
...r updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'onsuccess' in that specification. recommendation indexed database api draftthe definition of 'onsuccess' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webv...
IDBRequest.readyState - Web APIs
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-...
...quest is " + updatetitlerequest.readystate); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'readystate' in that specification. recommendation indexed database api draftthe definition of 'readystate' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid web...
IDBRequest.result - Web APIs
Web › API › IDBRequest › result
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-d...
... var updatetitlerequest = objectstore.put(data); // when this new request succeeds, run the displaydata() // function again to update the display updatetitlerequest.onsuccess = function() { displaydata(); }; }; specifications specification status comment indexed database api 2.0the definition of 'result' in that specification. recommendation indexed database api draftthe definition of 'result' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webview...
IDBTransactionSync - Web APIs
when an application creates an idbtransactionsync object, it blocks until the browser is able to reserve the require database objects. ...
...when an application creates an idbtransactionsync object, it blocks until the browser is able to reserve the require database objects. ...
Key Values - Web APIs
virtual keycode windows mac linux android "avrinput" [3] changes the input mode on an external audio/video receiver (avr) unit. keycode_avr_input (182) "avrpower" [3] toggles the power on an external avr unit. keycode_avr_power (181) "colorf0red" [3] general-purpose media function key, color-coded red. this has index 0 among the colored keys. vk_colored_key_0 keycode_prog_red (183) "colorf1green" [3] general-purpose media funciton key, color-coded green. this has index 1 among the colored keys. vk_colored_key_1 keycode_prog_green (184) "colorf2yellow" [3] general-purpose media funciton key, color-coded yellow. this has index 2 among the colored keys. vk_c...
...key, color-coded green. this has index 1 among the colored keys. vk_colored_key_1 keycode_prog_green (184) "colorf2yellow" [3] general-purpose media funciton key, color-coded yellow. this has index 2 among the colored keys. vk_colored_key_2 keycode_prog_yellow (185) "colorf3blue" [3] general-purpose media funciton key, color-coded blue. this has index 3 among the colored keys. vk_colored_key_3 keycode_prog_blue (186) "colorf4grey" general-purpose media funciton key, color-coded grey. this has index 4 among the colored keys. vk_colored_key_4 keycode_prog_grey "colorf5brown" general-purpose media funciton key, color-coded brown. this has index 5 among the colored keys. vk_colored_key_5 ...
Using the MediaStream Recording API - Web APIs
mented already, but we thought we'd give a mention to the checkbox hack, which abuses the fact that you can click on the <label> of a checkbox to toggle it checked/unchecked. in web dictaphone this powers the information screen, which is shown/hidden by clicking the question mark icon in the top right hand corner. ...
... information screen, which is shown/hidden by clicking the question mark icon in the top right hand corner. ...
NamedNodeMap - Web APIs
a namednodemap object is live and will thus be auto-updated if changes are made to its contents internally or elsewhere. although called namednodemap, this interface doesn't deal with node objects but with attr objects, which were originally a specialized class of node, and still are in some implementations. properties this interface doesn't inherit any property. ...
... the amount of objects in the map. methods this interface doesn't inherit any method. namednodemap.getnameditem() returns a attr, corresponding to the given name. namednodemap.setnameditem() replaces, or adds, the attr identified in the map by the given name. namednodemap.removenameditem() removes the attr identified by the given map. namednodemap.item() returns the attr at the given index, or null if the index is higher or equal to the number of nodes. namednodemap.getnameditemns() returns a attr identified by a namespace and related local name. namednodemap.setnameditemns() replaces, or adds, the attr identified in the map by the given namespace and related local name. namednodemap.removenameditemns() removes the attr identified by the given namespace and related local name...
Node.childNodes - Web APIs
Web › API › Node › childNodes
the node.childnodes read-only property returns a live nodelist of child nodes of the given element where the first child node is assigned index 0. ...
...to get data from node objects, use their properties. (for example, to get the name of the first childnode: elementnodereference.childnodes[1].nodename.) the document object itself has 2 children: the doctype declaration and the root element, typically referred to as documentele...
NodeList.item() - Web APIs
Web › API › NodeList › item
returns a node from a nodelist by index. this method doesn't throw exceptions as long as you provide arguments. a value of null is returned if the index is out of range, and a typeerror is thrown if no argument is provided. syntax nodeitem = nodelist.item(index) nodelist is a nodelist. this is usually obtained from another dom property or method, such as childnodes. index is the index of the node to be fetched. the index is zero-based. nodeitem is the indexth node in the nodelist returned by the item method. ...
...item = nodelist.item(index) nodelist is a nodelist. this is usually obtained from another dom property or method, such as childnodes. index is the index of the node to be fetched. the index is zero-based. nodeitem is the indexth node in the nodelist returned by the item method. alternate syntax javascript also offers an array-like bracketed syntax for obtaining an item from a nodelist by index: nodeitem = nodelist[index] example var tables = document.getelementsbytagname("table"); var firsttable = tables.item(1); // or simply tables[1] - returns the second table in the dom specifications specification status comment domthe definition of 'nodelist: item' in that specification. living standard ...
OVR_multiview2.framebufferTextureMultiviewOVR() - Web APIs
possible values: gl.framebuffer: collection buffer data storage of color, alpha, depth and stencil buffers used to render an image. gl.draw_framebuffer: equivalent to gl.framebuffer. used as a destination for drawing, rendering, clearing, and writing operations. ...
... ext.color_attachment13_webgl ext.color_attachment14_webgl ext.color_attachment15_webgl when using the webgl_depth_texture extension: ext.depth_stencil_attachment: depth and stencil buffer data storage. texture a webgltexture object whose image to attach. level a glint specifying the mipmap level of the texture image to be attached. must be 0. baseviewindex a glint specifying the base view index of the framebuffer object attachment. numviews a glsizei specifying the number of views of the framebuffer object attachment. return value none. exceptions a gl.invalid_enum error is thrown if target is not gl.framebuffer. attachment is not one of the accepted attachment points. a gl.invalid_value error is thrown if level is n...
RTCIceCandidate.RTCIceCandidate() - Web APIs
a newly-created rtcicecandidate object, optionally configured based on the specified object based on the rtcicecandidateinit dictionary. if candidateinfo is provided, the new rtcicecandidate is initialized as follows: each member of the rtcicecandidateinit object is initialized to the value of the property by the same name from rtcicecandidateinit. this includes the candidate, sdpmid, sdpmlineindex, and usernamefragment properties. the candidate string (which is sdp text) is parsed; each property found is stored in the corresponding field in the rtcicecandidate. if any of the fields is invalid, parsing of the string silently aborts without throwing an exception. the default value of candidate is the empty string, which indicates that the candidate is an "end-of-candidates" message. the fo...
...hey are not included in the rtcicecandidate.candidate property: foundation, component, priority , ip, protocol, port, type, tcptype, relatedaddress, and relatedport. note: parsing of the candidate string is performed using the candidate-attribute grammar from the webrtc specification. exceptions typeerror the specified rtcicecandidateinit has values of null in both the sdpmid and sdpmlineindex properties. usage notes this constructor does not do complete validation of the specified candidateinfo object or string. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate()' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.addIceCandidate() - Web APIs
peer's description 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. ...
... the specified ufrag doesn't match the ufrag field in any of the remote descriptions 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. ...
SpeechSynthesisVoice - Web APIs
draft ...
... draft ...
Storage API - Web APIs
api gives sites' code the ability to find out how much space they can use, how much they are already using, and even control whether or not they need to be alerted before the user agent disposes of site data in order to make room for other things. note: this feature is available in web workers. ...
...e site storage unit for each origin. in essence, every web site or web application has its own storage unit into which its data gets placed. the diagram below shows a site storage pool with three storage units within, showing how storage units can have different data types stored within and may have different quotas (maximum storage limits). origin 1 has some web storage data as well as some indexeddb data, but also has some free space left; its current usage hasn't yet reached its quota. origin 2 has no data stored in it yet; it's just an empty box waiting for content. this origin, however, has a lower quota than the other two do. it may be a less-visited site, or one known to have lower data storage requirements. origin 3's storage unit is completely full; it's reached its quota and ca...
Text.splitText() - Web APIs
Web › API › Text › splitText
. the newly created node is returned to the caller. if the original node had a parent, the new node is inserted as the next sibling of the original node. if the offset is equal to the length of the original node, the newly created node has no data. separated text nodes can be concatenated using the node.normalize() method. ...
...the newly created node has no data. separated text nodes can be concatenated using the node.normalize() method. syntax newnode = textnode.splittext(offset) parameters offset the index immediately before which to break the text node. return value returns a newly created text node that contains the text after the specified offset point. exceptions thrown a domexception with a value of index_size_err is thrown if the specified offset is negative or is greater than the number of 16-bit units in the node's text; a domexception with a value of no_modification_allowed_err is thrown if the node is read-only. example in this example, the text of a <p> is split into two text nodes, and a <u> is inserted between them. html <p>foobar</p> javascript const p = document.queryselector('p');...
TextEncoder.prototype.encodeInto() - Web APIs
-8. this may be less than string.length if uint8array did not have enough space. written the number of bytes modified in the destination uint8array. the bytes written are guaranteed to form complete utf-8 byte sequences. encode into a specific position encoder.encodeinto always puts its output at the start of the array. however, it is sometimes useful to make the output start at a particular index. the solution is typedarray.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...
...hold t such that if rounduptobucketsize(s.length) + t >= s.length * 3, you simply allocate for s.length * 3. otherwise, first allocate for rounduptobucketsize(s.length) and convert. if the read item it the return dictionary is s.length, the conversion is done. if not, reallocate the target buffer to written + (s.length - read) * 3 and then convert the rest by taking a substring of s starting from index read and a subbuffer of the target buffer starting from index written. above rounduptobucketsize() is a function that rounds up to the allocator bucket size. for example, if your wasm allocator 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, roundup...
TimeRanges - Web APIs
timeranges interface is used to represent a set of time ranges, primarily for the purpose of tracking which portions of media have been buffered when loading it for use by the <audio> and <video> elements. a timeranges object includes one or more ranges of time, each specified by a starting and ending time offset. you reference each time range by using the start() and end() methods, passing the index number of the time range you want to retrieve. the term "normalized timeranges object" indicates that ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). properties timeranges.length read only returns an unsigned long representing the number of time ranges represented by the time range object. methods t...
...bject" indicates that ranges in such an object are ordered, don't overlap, aren't empty, and don't touch (adjacent ranges are folded into one bigger range). properties timeranges.length read only returns an unsigned long representing the number of time ranges represented by the time range object. methods timeranges.start() returns the time for the start of the range with the specified index. timeranges.end() returns the time for the end of the specified range. specifications specification status comment html living standardthe definition of 'timeranges' in that specification. living standard initial definition ...
WebGLRenderingContext.getActiveUniform() - Web APIs
the webglrenderingcontext.getactiveuniform() method of the webgl api returns a webglactiveinfo object containing size, type, and name of a uniform attribute. it is generally used when querying unknown uniforms either for debugging or generic library creation. syntax webglactiveinfo webglrenderingcontext.getactiveuniform(program, index); parameters program a webglprogram specifying the webgl shader program from which to obtain the uniform variable's information. index a gluint specifying the index of the uniform attribute to get. this value is an index 0 to n - 1 as returned by gl.getprogramparameter(program, gl.active_uniforms). return value a webglactiveinfo object describing the uniform. the type attribute of the return value will be one of the following: gl.float gl.float_...
...o, and uniform block { float bar; } e; will result in block.bar. the size attribute of the return value corresponds to the length of the array for uniforms declared as arrays. otherwise, it is 1 (this includes interface blocks instanced with arrays). exceptions gl.invalid_value is generated if the program webglprogram is invalid (not linked, deleted, etc.). gl.invalid_value is generated if index is not in the range [0, gl.getprogramparameter(program, gl.active_uniforms) - 1]. examples const numuniforms = gl.getprogramparameter(program, gl.active_uniforms); for (let i = 0; i < numuniforms; ++i) { const info = gl.getactiveuniform(program, i); console.log('name:', info.name, 'type:', info.type, 'size:', info.size); } specifications specification status comment ...
WebGLRenderingContext.getFramebufferAttachmentParameter() - Web APIs
chment_depth_size gl.framebuffer_attachment_green_size gl.framebuffer_attachment_red_size gl.framebuffer_attachment_stencil_size gl.framebuffer_attachment_texture_layer when using the ovr_multiview2 extension: ext.framebuffer_attachment_texture_num_views_ovr: the number of views of the framebuffer object attachment. ext.framebuffer_attachment_texture_base_view_index_ovr: the base view index of the framebuffer object attachment. return value depends on the requested information (as specified with pname). either a glint, a glenum, a webglrenderbuffer, or a webgltexture. pname parameter return value gl.framebuffer_attachment_object_type a glenum indicating the type of the texture. either gl.renderbuffer, gl.texture, o...
...umber of the texture layer which contains the attached image. ext.framebuffer_attachment_color_encoding_ext a glenum indicating the framebuffer color encoding. either gl.linear or ext.srgb_ext. ext.framebuffer_attachment_texture_num_views_ovr a glsizei indicating the number of views of the framebuffer object attachment. ext.framebuffer_attachment_texture_base_view_index_ovr a glint indicating the base view index of the framebuffer object attachment. exceptions a gl.invalid_enum error is thrown if target is not gl.framebuffer, gl.draw_framebuffer, gl.read_framebuffer or if attachment is not one of the accepted attachment points. examples gl.getframebufferattachmentparameter(gl.framebuffer, gl.color_attachment0, ...
WebGLRenderingContext.getUniformLocation() - Web APIs
values correspond to the uniform names returned by getactiveuniform; see that function for specifics on how declared uniforms map to uniform location names. additionally, for uniforms declared as arrays, the following names are also valid: the uniform name without the [0] suffix. e.g. the location returned for arrayuniform is equivalent to the one for arrayuniform[0]. the uniform name indexed with an integer. e.g. the location returned for arrayuniform[2] would point directly to the third entry of the arrayuniform uniform. return value a webgluniformlocation value indicating the location of the named variable, if it exists. if the specified variable doesn't exist, null is returned instead. the webgluniformlocation is an opaque value used to uniquely identify the location in ...
... the specified variable doesn't exist, null is returned instead. the webgluniformlocation is an opaque value used to uniquely identify the location in the gpu's memory at which the uniform variable is located. with this value in hand, you can call other webgl methods to access the value of the uniform variable. the webgluniformlocation type is compatible with the glint type when specifying the index or location of a uniform attribute. errors the following errors may occur; to check for errors after getuniformlocation() returns, call geterror(). gl_invalid_value the program parameter is not a value or object generated by webgl. gl_invalid_operation the program parameter doesn't correspond to a glsl program generated by webgl, or the specified program hasn't been linked successfully. ...
WebGL best practices - Web APIs
apting to the case there they are not supported. likewise the limits of your system will be different than your clients' systems! don't assume you can use thirty texture samplers per shader just because it works on your machine! take advantage of universally supported webgl 1 extensions these webgl 1 extensions are universally supported: angle_instanced_arrays ext_blend_minmax oes_element_index_uint oes_standard_derivatives oes_vertex_array_object webgl_debug_renderer_info webgl_lose_context (see also: https://jdashg.github.io/misc/webgl/webgl-feature-levels.html) consider polyfilling these into webglrenderingcontext, like: https://github.com/jdashg/misc/blob/master/webgl/webgl-v1.1.js universally supported limits the minimum requirements for webgl are quite low. in practice, e...
... compression that makes basis universal compressed texture files much smaller than regular compressed textures over-the-wire, more comparable to jpeg. https://github.com/binomialllc/basis_universal/blob/master/webgl/readme.md memory usage of depth and stencil formats depth and stencil attachments and formats are actually inseparable on many devices. you may ask for depth_component24 or stencil_index8, but you're often getting d24x8 and x24s8 32bpp formats behind the scenes. assume that the memory usage of depth and stencil formats is rounded up to the nearest four bytes. teximage/texsubimage uploads (particularly with videos) can cause pipeline flushes most texture uploads from dom elements will incur a processing pass that will temporarily switch gl progams internally, causing a pipeline ...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
ccurs, this handler executes. using destructuring, the rtctrackevent's track and streams properties are extracted. the former is either the video track or the audio track being received. the latter is an array of mediastream objects, each representing a stream containing this track (a track may in rare cases belong to multiple streams at once). in our case, this will always contain one stream, at index 0, because we passed one stream into addtrack() earlier. we add an unmute event handler to the track, because the track will become unmuted once it starts receiving packets. we put the remainder of our reception code in there. if we already have video coming in from the remote peer (which we can see if the remote view's <video> element's srcobject property already has a value), we do nothing. o...
...ck() earlier. we add an unmute event handler to the track, because the track will become unmuted once it starts receiving packets. we put the remainder of our reception code in there. if we already have video coming in from the remote peer (which we can see if the remote view's <video> element's srcobject property already has a value), we do nothing. otherwise, we set srcobject to the stream at index 0 in the streams array. the perfect negotiation logic now we get into the true perfect negotiation logic, which functions entirely independently from the rest of the application. handling the negotiationneeded event first, we implement the rtcpeerconnection event handler onnegotiationneeded to get a local description and send it using the signaling channel to the remote peer. let makingoffer...
The structured clone algorithm - Web APIs
the structured clone algorithm copies complex javascript objects. it is used internally to transfer data between workers via postmessage(), storing objects with indexeddb, or copying objects for other apis. it clones by recursing through the input object while maintaining a map of previously visited references, to avoid infinitely traversing cycles. things that don't work with structured clone function objects cannot be duplicated by the structured clone algorithm; attempting to throws a data_clone_err exception. cloning dom nodes likewise throws a data_clone_err exception. certain object properties are not preserved: the lastindex property of regexp objects is not preserved. property descriptors, setters, getters, and similar metadata-like features are not duplicated. fo...
...read/write in the duplicate, since that's the default. the prototype chain is not walked or duplicated. note: native error types can be cloned in chrome, and firefox is working on it. supported types object type notes all primitive types however, not symbols. boolean objects string objects date regexp lastindex is not preserved. blob file filelist arraybuffer arraybufferview including other typed arrays. imagebitmap imagedata array object only plain objects (e.g. from object literals) map set ...
Using Web Workers - Web APIs
reference documentation on workers and additional guides. you can run whatever code you like inside the worker thread, with some exceptions. for example, you can't directly manipulate the dom from inside a worker, or use some default methods and properties of the window object. but you can use a large number of items available under window, including websockets, and data storage mechanisms like indexeddb. see functions and classes available to workers for more details. data is sent between workers and the main thread via a system of messages — both sides send their messages using the postmessage() method, and respond to messages via the onmessage event handler (the message is contained within the message event's data attribute.) the data is copied rather than shared. workers may, in turn,...
...everal browsing contexts, all those browsing contexts must share the exact same origin (same protocol, host, and port). note: in firefox, shared workers cannot be shared between documents loaded in private and non-private windows (bug 1177621). spawning a shared worker spawning a new shared worker is pretty much the same as with a dedicated worker, but with a different constructor name (see index.html and index2.html) — each one has to spin up the worker using code like the following: var myworker = new sharedworker('worker.js'); one big difference is that with a shared worker you have to communicate via a port object — an explicit port is opened that the scripts can use to communicate with the worker (this is done implicitly in the case of dedicated workers). the port connection n...
Window.getComputedStyle() - Web APIs
syntax var style = window.getcomputedstyle(element [, pseudoelt]); element the element for which to get the computed style. ...
...rned 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 safest to query values with only longhand names like font-size. shorthand names like font will not work with most browsers. css property values may be accessed using the getpropertyvalue(propname) api or by indexing directly into the object such as obj['z-index'] or obj.zindex. the values returned by getcomputedstyle are resolved values. these are usually the same as css 2.1’s computed values, but for some older properties like width, height, or padding, they are instead the same as used values. originally, css 2.0 defined the computed values as the "ready to be used" final values of properties after c...
XPathResult.snapshotItem() - Web APIs
exceptions type_err in case xpathresult.resulttype is not unordered_node_snapshot_type or ordered_node_snapshot_type, an xpathexception of type type_err is thrown. example the following example shows the use of the snapshotitem() method. ...
... exceptions type_err in case xpathresult.resulttype is not unordered_node_snapshot_type or ordered_node_snapshot_type, an xpathexception of type type_err is thrown. example the following example shows the use of the snapshotitem() method. ...
Basic form hints - Accessibility
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 on line 1, which is the label for the radio group. ...
...sets the aria-labelledby attribute to rg1_label, the id of the <h3> element on line 1, which is the label for the radio group. <h3 id="rg1_label">lunch options</h3> <ul class="radiogroup" id="rg1" role="radiogroup" aria-labelledby="rg1_label"> <li id="r1" tabindex="-1" role="radio" aria-checked="false"> <img role="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 description associated with them, in addition to the label. aria provides the aria-de...
Alerts - Accessibility
this method takes three parameters: the id of the input that is to be...
...se"); removeoldalert(); } } </script> the checkvalidity function the primary method in javascript used for form validation is the checkvalidity function. this method takes three parameters: the id of the input that is to be validated, the term to search for to ensure validity, and the error message to be inserted into the alert. to see if it is valid, the function checks whether the indexof the input’s value is anything greater than -1. a value of -1 or less is returned if the index of the search term could not be found within the value. if invalid, the function does two things: it sets the element’s aria-invalid attribute to “true”, which will indicate to screen readers that there is invalid content in here. it will call the addalert function to add the alert with th...
:target - CSS: Cascading Style Sheets
Web › CSS › :target
the :target css pseudo-class represents a unique element (the target element) with an id matching the url's fragment. /* selects an element with an id matching the current url's fragment */ :target { border: 2px solid black; } for example, the following url has a fragment (denoted by the # sign) that points to an element called section2: http://www.example.com/index.html#section2 the following element would be selected by a :target selector when the current url is equal to the above: <section id="section2">example</section> syntax :target examples a table of contents the :target pseudo-class can be used to highlight the portion of a page that has been linked to from a table of contents. html <h3>table of contents</h3> <ol> <li><a href="#p1">jump to the first paragraph!</a></li> ...
... align-items: center; justify-content: center; } /* lightbox content */ .lightbox figcaption { width: 25rem; position: relative; padding: 1.5em; background-color: lightpink; } /* close button */ .lightbox .close { position: relative; display: block; } .lightbox .close::after { right: -1rem; top: -1rem; width: 2rem; height: 2rem; position: absolute; display: flex; z-index: 1; align-items: center; justify-content: center; background-color: black; border-radius: 50%; color: white; content: "×"; cursor: pointer; } /* lightbox overlay */ .lightbox .close::before { left: 0; top: 0; width: 100%; height: 100%; position: fixed; background-color: rgba(0,0,0,.7); content: ""; cursor: default; } result specifications specificatio...
CSS Tutorials - CSS: Cascading Style Sheets
Web › CSS › Tutorials
ground 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 devices like touchscreens or printed sheets vary greatly nowadays. media queries are the fundamental building blocks in achieving web sites that render everywhere in their best quality. understanding z-index controlling superposition of boxes is a basic feature that is very quickly needed by web developers. though not that difficult, it requires a basic knowledge of css. intermediate-level css tutorials after the release of css 2 (level 1), new features have been added to css. some of them are fancy and are pretty self contained. they are easy to use for anybody with a fair knowledge of basic con...
... 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 multiple 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. ...
WAI ARIA Live Regions/API Support - Developer guides
c or the live region report to learn about aria live region markup. as always, we're open to questions and suggestions for changes in community forums. ...
... iaccessible2 event object about to be hidden or removed children_changed::remove (fired on the parent, with event data pointing to the child index of the accessible object to be removed) event_object_hide* (fired on the actual accessible object about to go away) object shown or inserted children_changed::add (fired on the parent, with event data pointing to the child index of the inserted accessible object) event_object_show* (fired on the actual new accessible object) object replaced with different object (this happens especially if an object's interfaces or role changes) children_changed::remove followed immediately by children_change::add event_object_hide followed immediately by event_object_show text removed text_changed::delete ...
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
d, or name is empty, the input's value is not submitted with the form! (disabled controls, unchecked radio buttons, unchecked checkboxes, and reset buttons are also not sent.) there are two special cases: _charset_ : if used as the name of an <input> element of type hidden, the input's value is automatically set by the user agent to the character encoding being used to submit the form. isindex: for historical reasons, the name isindex is not allowed. name and radio buttons the name attribute creates a unique behavior for radio buttons. only one radio button in a same-named group of radio buttons can be checked at a time. selecting any radio button in that group automatically deselects any currently-selected radio button in the same group. the value of that one checked radio but...
...the user doesn't adhere to the stepping configuration, the value is considered invalid in contraint validation and will match the :invalid pseudoclass. the step attribute is expressed in seconds. the step scale factor is 1000 (which converts the seconds to milliseconds, as used in the other algorithms). the default step is 60 seconds. see client-side validation for more information. tabindex global attribute valid for all elements, including all the input types, an integer attribute indicating if the element can take input focus (is focusable), if it should participate to sequential keyboard navigation. as all input types except for input of type hidden are focusable, this attribute should not be used on form controls, because doing so would require the management of the focus ord...
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
ea consists of content that is directly related to or expands upon the central topic of a document, or the central functionality of an application. <nav> the html <nav> element represents a section of a page whose purpose is to provide navigation links, either within the current document or to other documents. common examples of navigation sections are menus, tables of contents, and indexes. <section> the html <section> element represents a standalone section — which doesn't have a more specific semantic element to represent it — contained within an html document. text content use html text content elements to organize blocks or sections of content placed between the opening <body> and closing </body> tags. important for accessibility and seo, these elem...
... a particular area in which another html document can be displayed. a frame should be used within a <frameset>. <frameset> the html <frameset> element is used to contain <frame> elements. <image> the obsolete html image element (<image>) is an obsolete remnant of an ancient version of html lost in the mists of time; use the standard <img> element instead. <isindex> <isindex> was an obsolete html element that put a text field in a page for querying the document. <keygen> the html <keygen> element exists to facilitate generation of key material, and submission of the public key as part of an html form. this mechanism is designed for use with web-based certificate management systems. it is expected that the <keygen> element will be used in an...
contextmenu - HTML: Hypertext Markup Language
recommendation snapshot of html living standard, initial definition. ...
... recommendation snapshot of html living standard, initial definition. ...
Using HTTP cookies - HTTP
Web › HTTP › Cookies
avior cookies were once used for general client-side storage. while this was legitimate when they were the only way to store data on the client, it is now recommended to use modern storage apis. cookies are sent with every request, so they can worsen performance (especially for mobile data connections). modern apis for client storage are the web storage api (localstorage and sessionstorage) and indexeddb. to see stored cookies (and other storage that a web page can use), you can enable the storage inspector in developer tools and select cookies from the storage tree. creating cookies after receiving an http request, a server can send one or more set-cookie headers with the response. the cookie is usually stored by the browser, and then the cookie is sent with requests made to the same se...
...ese regulations. other ways to store information in the browser another approach to storing data in the browser is the web storage api. the window.sessionstorage and window.localstorage properties correspond to session and permanent cookies in duration, but have larger storage limits than cookies, and are never sent to a server. more structured and larger amounts of data can be stored using the indexeddb api, or a library built on it. other techniques have been created to cause cookies to be recreated after they are deleted, known as "zombie" cookies. these techniques violate the principles of user privacy and user control, may violate data privacy regulations, and could expose a website using them to legal liability. ...
301 Moved Permanently - HTTP
Web › HTTP › Status › 301
direction is performed, not all user-agents align with it - you can still find this type of bugged software out there. ...
...s therefore recommended to use the 301 code only as a response for get or head methods and to use the 308 permanent redirect for post methods instead, as the method change is explicitly prohibited with this status. ...
Enumerability and ownership of properties - JavaScript
xcluding symbols) not available without extra code not available without extra code not available without extra code obtaining properties by enumerability/ownership note that this is not the most efficient algorithm for all cases, but useful for a quick demonstration. ...
...function(obj, prop) { return true; }, // inspired by http://stackoverflow.com/a/8024294/271577 _getpropertynames: function getallpropertynames(obj, iterateselfbool, iterateprototypebool, includepropcb) { var props = []; do { if (iterateselfbool) { object.getownpropertynames(obj).foreach(function(prop) { if (props.indexof(prop) === -1 && includepropcb(obj, prop)) { props.push(prop); } }); } if (!iterateprototypebool) { break; } iterateselfbool = true; } while (obj = object.getprototypeof(obj)); return props; } }; detection table in for..in obj.haso...
Equality comparisons and sameness - JavaScript
which operation you choose depends on what sort of comparison you are looking to perform. briefly: double equals (=...
... which operation you choose depends on what sort of comparison you are looking to perform. briefly: double equals (=...
Keyed collections - JavaScript
maps map object ecmascript 2015 introduces a new data structure to map values to values. a map object is a simple key/value map and can iterate its elements in insertion order. the following code shows some basic operations with a map. see also the map reference page for more examples and the complete api. you can use a for...of loop to return an array of [key, value] for each iteration. ...
...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 javascript 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 keep track of duplicates. weakset object weakset objects are collections of objects. an object in the weakset may only occur once.
JavaScript modules - JavaScript
and then draw (and report information about) different shapes on the canvas. these are fairly trivial, but have been kept deliberately simple to demonstrate modules clearly. note: if you want to download the examples and run them locally, you'll need to run them through a local web server. basic example structure in our first example (see basic-modules) we have a file structure as follows: index.html main.js modules/ canvas.js square.js note: all of the examples in this guide have basically the same structure; the above should start getting pretty familiar. the modules directory's two modules are described below: canvas.js — contains functions related to setting up the canvas: create() — creates a canvas with a specified width and height inside a wrapper <div> w...
...ynamic-module-imports directory we've got another example based on our classes example. this time however we are not drawing anything on the canvas when the example loads. instead, we include three buttons — "circle", "square", and "triangle" — that, when pressed, dynamically load the required module and then use it to draw the associated shape. in this example we've only made changes to our index.html and main.js files — the module exports remain the same as before. over in main.js we've grabbed a reference to each button using a document.queryselector() call, for example: let squarebtn = document.queryselector('.square'); we then attach an event listener to each button so that when pressed, the relevant module is dynamically loaded and used to draw the shape: squarebtn.addeventlist...
Working with objects - JavaScript
type called fishes var fish = object.create(animal); fish.type = 'fishes'; fish.displaytype(); // output:fishes inheritance all objects in javascript inherit from at least one other object. the object being inherited from is known as the prototype, and the inherited properties can be found in the prototype object of the constructor. see inheritance and the prototype chain for more information. indexing object properties you can refer to a property of an object either by its property name or by its ordinal index. if you initially define a property by its name, you must always refer to it by its name, and if you initially define a property by an index, you must always refer to it by its index. this restriction applies when you create an object and its properties with a constructor function (...
... the exception to this rule is array-like object reflected from html, such as the forms array-like object. ...
Memory Management - JavaScript
2019, it is not possible to explicitly or programmatically trigger garbage collection in javascript. node.js node.js offers additional options and tools for configuring and debugging memory issues that may not be available for javascript executed within a browser environment. ...
... and tools for configuring and debugging memory issues that may not be available for javascript executed within a browser environment. ...
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
warning: string.concat is deprecated; use string.prototype.concat instead warning: string.contains is deprecated; use string.prototype.contains instead warning: string.endswith is deprecated; use string.prototype.endswith instead warning: string.includes is deprecated; use string.prototype.includes instead warning: string.indexof is deprecated; use string.prototype.indexof instead warning: string.lastindexof is deprecated; use string.prototype.lastindexof instead warning: string.localecompare is deprecated; use string.prototype.localecompare instead warning: string.match is deprecated; use string.prototype.match instead warning: string.normalize is ...
... strict'; var i, // we could also build the array of methods with the following, but the // getownpropertynames() method is non-shimable: // object.getownpropertynames(string).filter(function(methodname) { // return typeof string[methodname] === 'function'; // }); methods = [ 'contains', 'substring', 'tolowercase', 'touppercase', 'charat', 'charcodeat', 'indexof', 'lastindexof', 'startswith', 'endswith', 'trim', 'trimleft', 'trimright', 'tolocalelowercase', 'normalize', 'tolocaleuppercase', 'localecompare', 'match', 'search', 'slice', 'replace', 'split', 'substr', 'concat', 'localecompare' ], methodcount = methods.length, assignstringgeneric = function(methodname) { var method = string.prototype[methodname]; st...
The arguments object - JavaScript
for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description note: if you're writing es6 compatible code, then rest parameters should be preferred. note: “array-like” means that arguments has a length property and properties indexed from zero, but it doesn't have array's built-in methods like foreach() or map(). see §description for details. the arguments object is a local variable available within all non-arrow functions. you can refer to a function's arguments inside that function by using its arguments object. it has entries for each argument the function was called with, with the first entry's index at 0. for examp...
... can use arguments.length to count how many arguments the function was called with. if you instead want to count how many parameters a function is declared to accept, inspect that function's length property. using typeof with arguments the typeof operator returns 'object' when used with arguments console.log(typeof arguments); // 'object' the type of individual arguments can be determined by indexing arguments: console.log(typeof arguments[0]); // returns the type of the first argument properties arguments.callee reference to the currently executing function that the arguments belong to. forbidden in strict mode. arguments.length the number of arguments that were passed to the function. arguments[@@iterator] returns a new array iterator object that contains the values for each in...
Array.prototype[@@unscopables] - JavaScript
the @@unscopable symbol property contains property names that were not included in the ecmascript standard prior to the es2015 version. these properties are excluded from with statement bindings. description the default array properties that are excluded from with bindings are: copywithin() entries() fill() find() findindex() includes() keys() values() see symbol.unscopables for how to set unscopables for your own objects. property attributes of array.prototype[@@unscopables] writable no enumerable no configurable yes examples use in with environments the following code works fine in es5 and below. however, in ecmascript 2015 and later, the array.prototype.keys() method was introdu...
...e 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) { keys.push('something'); } object.keys(array.prototype[symbol.unscopables]); // ["copywithin", "entries", "fill", "find", "findindex", // "includes", "keys", "values"] specifications specification ecmascript (ecma-262)the definition of 'array.prototype[@@unscopables]' in that specification. ...
Array.prototype.copyWithin() - JavaScript
array to another location in the same array and returns it without modifying its length. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.copywithin(target[, start[, end]]) parameters target zero-based index at which to copy the sequence to. if negative, target will be counted from the end. if target is at or greater than arr.length, nothing will be copied. if target is positioned after start, the copied sequence will be trimmed to fit arr.length. start optional zero-based index at which to start copying elements from. if negative, start will be counted from the end. if start is omitted, copywith...
...the sequence to. if negative, target will be counted from the end. if target is at or greater than arr.length, nothing will be copied. if target is positioned after start, the copied sequence will be trimmed to fit arr.length. start optional zero-based index at which to start copying elements from. if negative, start will be counted from the end. if start is omitted, copywithin will copy from index 0. end optional zero-based index at which to end copying elements from. copywithin copies up to but not including end. if negative, end will be counted from the end. if end is omitted, copywithin will copy until the last index (default to arr.length). return value the modified array. description the copywithin works like c and c++'s memmove, and is a high-performance method to shift the ...
Array.prototype.slice() - JavaScript
the slice() method returns a shallow copy of a portion of an array into a new array object selected from start to end (end not included) where start and end represent the index of items in that array. the original array will not be modified. the source for this interactive demo is stored in a github repository. if you'd like to contribute to the interactive demo project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.slice([start[, end]]) parameters start optional zero-based index at which to start extraction. a negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. if start is undefined, slice starts from the index 0. if start is greater than the ind...
...art[, end]]) parameters start optional zero-based index at which to start extraction. a negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. if start is undefined, slice starts from the index 0. if start is greater than the index range of the sequence, an empty array is returned. end optional zero-based index before which to end extraction. slice extracts up to but not including end. for example, slice(1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3). a negative index can be used, indicating an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. if end is omitted, slice extracts thro...
Array.prototype.values() - JavaScript
syntax arr.values() return value a new array iterator object. examples iteration using for...of loop var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); for (let letter of iterator) { console.log(letter); } //"a" "b" "c" "d" "e" array.prototype.values is default implementation of array.prototype[symbol.iterator]. ...
...see iteration protocols. value: there are no values stored in the array iterator object; instead it stores the address of the array used in its creation and so depends on the values stored in that array. var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); console.log(iterator); // array iterator { } iterator.next().value; // "a" arr[1]=...
Atomics.add() - JavaScript
urns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.add(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to add a value to. value the number to add. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the ...
...typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to add a value to. value the number to add. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using add() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.add(ta, 0, 12); // returns 0, the old value atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.add' in that specification. ...
Atomics.and() - JavaScript
urns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.and(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to compute the bitwise and. value the number to compute the bitwise and with. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror...
... description the bitwise and operation only yields 1, if both a and b are 1. ...
Atomics.compareExchange() - JavaScript
e expected value or not. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.compareexchange(typedarray, index, expectedvalue, replacementvalue) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. expectedvalue the value to check for equality. replacementvalue the number to exchange. return value the old value at the given posi...
...replacementvalue) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. expectedvalue the value to check for equality. replacementvalue the number to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using compareexchange() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 7; atomics.compareexchange(ta, 0, 7, 12); // returns 7, the old value atomics.load(ta, 0); // 12 specifications ...
Atomics.exchange() - JavaScript
sition. this atomic operation guarantees that no other write happens between the read of the old value and the write of the new value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.exchange(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. value the number to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one ...
...rray. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to exchange a value. value the number to exchange. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using exchange() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.exchange(ta, 0, 12); // returns 0, the old value atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.exchange' in that specification. ...
Atomics.or() - JavaScript
turns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.or(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to compute the bitwise or. value the number to compute the bitwise or with. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, ...
... description the bitwise or operation yields 1, if either a or b are 1. ...
Atomics.store() - JavaScript
the static atomics.store() method stores a given value at the given position in the array and returns that value. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.store(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to store a value in. value the number to store. return value the value that has been stored. exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror,...
...pedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to store a value in. value the number to store. return value the value that has been stored. exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using store() var sab = new sharedarraybuffer(1024); var ta = new uint8array(sab); atomics.store(ta, 0, 12); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.store' in that specification. ...
Atomics.sub() - JavaScript
urns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.sub(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to subtract a value from. value the number to subtract. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not...
... one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to subtract a value from. value the number to subtract. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. examples using sub const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 48; atomics.sub(ta, 0, 12); // returns 48, the old value atomics.load(ta, 0); // 36 specifications specification ecmascript (ecma-262)the definition of 'atomics.sub' in that specification. ...
Atomics.wait() - JavaScript
the static atomics.wait() method verifies that a given position in an int32array still contains a given value and if so sleeps, awaiting a wakeup or a timeout. it returns a string which is either "ok", "not-equal", or "timed-out". note: this operation only works with a shared int32array and may not be allowed on the main thread. ...
...hat a given position in an int32array still contains a given value and if so sleeps, awaiting a wakeup or a timeout. it returns a string which is either "ok", "not-equal", or "timed-out". note: this operation only works with a shared int32array and may not be allowed on the main thread. syntax atomics.wait(typedarray, index, value[, timeout]) parameters typedarray a shared int32array. index the position in the typedarray to wait on. value the expected value to test. timeout optional time to wait in milliseconds. infinity, if no time is provided. return value a string which is either "ok", "not-equal", or "timed-out". exceptions throws a typeerror, if typedarray is not a shared int32array. throws a rangeerror, if index is out of bounds in the typedarray. examples usin...
Atomics.xor() - JavaScript
urns the old value at that position. this atomic operation guarantees that no other write happens until the modified value is written back. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.xor(typedarray, index, value) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to compute the bitwise xor. value the number to compute the bitwise xor with. return value the old value at the given position (typedarray[index]). exceptions throws a typeerror...
... description the bitwise xor operation yields 1, if a and b are different. ...
NaN - JavaScript
...
...oing to be nan after it is coerced to a number, while the latter will return true only if the value is currently nan: isnan('hello world'); // true number.isnan('hello world'); // false additionally, some array methods cannot find nan, while others can. let arr = [2, 4, nan, 12]; arr.indexof(nan); // -1 (false) arr.includes(nan); // true arr.findindex(n => number.isnan(n)); // 2 specifications specification ecmascript (ecma-262)the definition of 'nan' in that specification. ...
Object.getOwnPropertyNames() - JavaScript
array.prototype.filter() function to remove the enumerable keys (obtained with object.keys()) from a list of all keys (obtained with object.getownpropertynames()) thus giving only the non-enumerable keys as output. ...
... function to remove the enumerable keys (obtained with object.keys()) from a list of all keys (obtained with object.getownpropertynames()) thus giving only the non-enumerable keys as output. var target = myobject; var enum_and_nonenum = object.getownpropertynames(target); var enum_only = object.keys(target); var nonenum_only = enum_and_nonenum.filter(function(key) { var indexinenum = enum_only.indexof(key); if (indexinenum == -1) { // not found in enum_only keys, // meaning that the key is non-enumerable, // so return true so we keep this in the filter return true; } else { return false; } }); console.log(nonenum_only); specifications specification ecmascript (ecma-262)the definition of 'object.getownpropertynames' in that specification. ...
RegExp.prototype[@@search]() - JavaScript
string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax regexp[symbol.search](str) parameters str a string that is a target of the search. return value integer if successful, [@@search]() returns the index of the first match of the regular expression inside the string. otherwise, it returns -1. description this method is called internally in string.prototype.search(). for example, the following two examples return the same result. 'abc'.search(/a/); /a/[symbol.search]('abc'); this method exists for customizing the search behavior in regexp subclasses. examples direct call this method can b...
... different this and the different arguments order. var re = /-/g; var str = '2016-01-02'; var result = re[symbol.search](str); console.log(result); // 4 using @@search in subclasses subclass of regexp can override [@@search]() method to modify the behavior. class myregexp extends regexp { constructor(str) { super(str) this.pattern = str; } [symbol.search](str) { return str.indexof(this.pattern); } } var re = new myregexp('a+b'); var str = 'ab a+b'; var result = str.search(re); // string.prototype.search calls re[@@search]. console.log(result); // 3 specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype[@@search]' in that specification. ...
RegExp() constructor - JavaScript
his can also be another regexp object or literal (for the two regexp constructor notations only). patterns may include special characters to match a wider range of values than would a literal string. flags if specified, flags is a string that contains the flags to add. alternatively, if an object is supplied for the pattern, the flags string will replace any of that object's flags (and lastindex will be reset to 0) (as of es2015). if flags is not specified and a regular expressions object is supplied, that object's flags (and lastindex value) will be copied over. flags may contain any combination of the following characters: g (global match) find all matches rather than stopping after the first match. i (ignore case) if u flag is also enabled, use unicode case folding. m...
... treat beginning and end characters (^ and $) as working over multiple lines. in other words, match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input string. s ("dotall") 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 in the target string. does not attempt to match from any later indexes. examples literal notation and constructor there are two ways to create a regexp object: a literal notation and a constructor. the literal notation's parameters are enclosed between slashes and do not use quotation marks. the constructor function's para...
String.prototype.codePointAt() - JavaScript
ject = {}; var $defineproperty = object.defineproperty; var result = $defineproperty(object, object, object) && $defineproperty; } catch(error) {} return result; }()); var codepointat = function(position) { if (this == null) { throw typeerror(); } var string = string(this); var size = string.length; // `tointeger` var index = position ? number(position) : 0; if (index != index) { // better `isnan` index = 0; } // account for out-of-bounds indices: if (index < 0 || index >= size) { return undefined; } // get the first code unit var first = string.charcodeat(index); var second; if ( // check if it’s the start of a surrogate pair first >= 0...
... { // better `isnan` index = 0; } // account for out-of-bounds indices: if (index < 0 || index >= size) { return undefined; } // get the first code unit var first = string.charcodeat(index); var second; if ( // check if it’s the start 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/javascript-encoding#surrogate-formulae return (first - 0xd800) * 0x400 + second - 0xdc00 + 0x10000; } } return first; }; if (defineproperty) { definepro...
String.prototype.match() - JavaScript
n this case, the returned item will have additional properties as described below. additional properties as explained above, some results contain additional properties as described below. groups an object of named capturing groups whose keys are the names and values are the capturing groups or undefined if no named capturing groups were defined. see groups and ranges for more information. index the index of the search at which the result was found. input a copy of the search string. description if the regular expression does not include the g flag, str.match() will return the same result as regexp.exec(). other methods if you need to know if a string matches a regular expression regexp, use regexp.test(). if you only want the first match found, you might want to use regexp.ex...
...llowed by a decimal point and numeric character 0 or more times. the regular expression includes the i flag so that upper/lower case differences will be ignored. const str = 'for more information, see chapter 3.4.5.1'; const re = /see (chapter \d+(\.\d)*)/i; const found = str.match(re); console.log(found); // logs [ 'see chapter 3.4.5.1', // 'chapter 3.4.5.1', // '.1', // index: 22, // input: 'for more information, see chapter 3.4.5.1' ] // 'see chapter 3.4.5.1' is the whole match. // 'chapter 3.4.5.1' was captured by '(chapter \d+(\.\d)*)'. // '.1' was the last value captured by '(\.\d)'. // the 'index' property (22) is the zero-based index of the whole match. // the 'input' property is the original string that was parsed. using global and ignore case flags wi...
String.prototype.search() - JavaScript
e example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.search(regexp) parameters regexp a regular expression object. if a non-regexp object regexp is passed, it is implicitly converted to a regexp with new regexp(regexp). return value the index of the first match between the regular expression and the given string, or -1 if no match was found. description when you want to know whether a pattern is found, and also know its index within a string, use search(). (if you only want to know if it exists, use the similar test() method on the regexp prototype, which returns a boolean.) for more information (but slower execution) use match() ...
...or more information (but slower execution) use match() (similar to the regular expression exec() method). examples using search() the following example searches a string with two different regex objects to show a successful search (positive value) vs. an unsuccessful search (-1) let str = "hey jude" let re = /[a-z]/g let redot = /[.]/g console.log(str.search(re)) // returns 4, which is the index of the first capital letter "j" console.log(str.search(redot)) // returns -1 cannot find '.' dot punctuation specifications specification ecmascript (ecma-262)the definition of 'string.prototype.search' in that specification. ...
Symbol.search - JavaScript
this function is called by the string.prototype.search() method. for more information, see regexp.prototype[@@search]() and string.prototype.search(). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...xamples and send us a pull request. property attributes of symbol.search writable no enumerable no configurable no examples custom string search class caseinsensitivesearch { constructor(value) { this.value = value.tolowercase(); } [symbol.search](string) { return string.tolowercase().indexof(this.value); } } console.log('foobar'.search(new caseinsensitivesearch('bar'))); // expected output: 3 specifications specification ecmascript (ecma-262)the definition of 'symbol.search' in that specification. ...
TypedArray.prototype.copyWithin() - JavaScript
the copywithin() method copies the sequence of array elements within the array to the position starting at target. the copy is taken from the index positions of the second and third arguments start and end. the end argument is optional and defaults to the length of the array. this method has the same algorithm as array.prototype.copywithin. typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...rototype.copywithin. typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.copywithin(target, start[, end = this.length]) parameters target target start index position where to copy the elements to. start source start index position where to start copying elements from. end optional optional. source end index position where to end copying elements from. return value the modified array. description see array.prototype.copywithin for more details. examples using copywithin var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); u...
TypedArray.prototype.map() - JavaScript
repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.map(mapfn[, thisarg]) parameters mapfn a callback function that produces an element of the new typed array, taking three arguments: currentvalue the current element being processed in the typed array. index optional the index of the current element being processed in the typed array. array optional the typed array map() was called upon. thisarg optional value to use as this when executing mapfn. return value a new typed array. description the map() method calls a provided callback function (mapfn) once for each element in a typed array, in order, and constructs a new typed array fro...
...nt being processed in the typed array. array optional the typed array map() was called upon. thisarg optional value to use as this when executing mapfn. return value a new typed array. description the map() method calls a provided callback function (mapfn) once for each element in a typed array, in order, and constructs a new typed array from the results. mapfn is invoked only for indexes of the typed array which have assigned values; it is not invoked for indexes that are undefined, those which have been deleted, or which have never been assigned values. mapfn is invoked with three arguments: the value of the element, the index of the element, and the typed array object being traversed. if a thisarg parameter is provided to map(), it will be passed to mapfn when invoked, for ...
TypedArray.prototype.reduce() - JavaScript
-examples and send us a pull request. syntax typedarray.reduce(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: previousvalue the value previously returned in the last invocation of the callback, or initialvalue, if supplied (see below). currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array reduce was called upon. initialvalue optional. object to use as the first argument to the first call of the callback. return value the value that results from the reduction. description the reduce method executes the callback function once for each element present in the typed array, exclud...
... as the first argument to the first call of the callback. return value the value that results from the reduction. description the reduce method executes the callback function once for each element present in the typed array, excluding holes in the typed array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the typed array over which iteration is occurring. the first time the callback is called, previousvalue and currentvalue can be one of two values. if initialvalue is provided in the call to reduce, then previousvalue will be equal to initialvalue and currentvalue will be equal to the first value in the typed array. if no initialvalue was provided, then previousvalue will be equal to the fir...
TypedArray.prototype.reduceRight() - JavaScript
e of the typed array types here. syntax typedarray.reduceright(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: previousvalue the value previously returned in the last invocation of the callback, or initialvalue, if supplied (see below). currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array reduce was called upon. initialvalue optional. object to use as the first argument to the first call of the callback. return value the value that results from the reduction. description the reduceright method executes the callback function once for each element present in the typed array, e...
...he first argument to the first call of the callback. return value the value that results from the reduction. description the reduceright method executes the callback function once for each element present in the typed array, excluding holes in the typed array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the typed array over which iteration is occurring. the call to the reduceright callback would look something like this: typedarray.reduceright(function(previousvalue, currentvalue, index, typedarray) { // ... }); the first time the function is called, the previousvalue and currentvalue can be one of two values. if an initialvalue was provided in the call to reduceright, then previousva...
WebAssembly.Table.prototype.get() - JavaScript
examples using get the following example (see table.html on github, and view it live also) compiles and instantiates the loaded table.wasm byte code using the webassembly.instantiatestreaming() method. ...
... examples using get the following example (see table.html on github, and view it live also) compiles and instantiates the loaded table.wasm byte code using the webassembly.instantiatestreaming() method. ...
WebAssembly.Table - JavaScript
ebassembly. note: tables can currently only store function references, but this will likely be expanded in the future. constructor webassembly.table() creates a new table object. instance properties table.prototype.length returns the length of the table, i.e. the number of elements. instance methods table.prototype.get() accessor function — gets the element stored at a given index. table.prototype.grow() increases the size of the table instance by a specified number of elements. table.prototype.set() sets an element stored at a given index to a given value. examples creating a new webassembly table instance the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 elements. we then print ...
... of the table instance by a specified number of elements. table.prototype.set() sets an element stored at a given index to a given value. examples creating a new webassembly table instance the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 elements. we then print out the table length and contents of the two indexes (retrieved via table.prototype.get() to show that the length is two and both elements are null. var tbl = new webassembly.table({initial:2, element:"anyfunc"}); console.log(tbl.length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null" we then create an import object that contains the table: var importobj = { js: { tbl:tbl } }; finally, we load and inst...
WebAssembly.instantiate() - JavaScript
bassembly.memory objects. there must be one matching property for each declared import of the compiled module or else a webassembly.linkerror is thrown. return value a promise that resolves to a resultobject which contains two fields: module: a webassembly.module object representing the compiled webassembly module. this module can be instantiated again, shared via postmessage() or cached in indexeddb. instance: a webassembly.instance object that contains all the exported webassembly functions. exceptions if either of the parameters are not of the correct type or structure, a typeerror is thrown. if the operation fails, the promise rejects with a webassembly.compileerror, webassembly.linkerror, or webassembly.runtimeerror, depending on the cause of the failure. secondary overload ...
...ported webassembly function that is exported by the instance. var importobject = { imports: { imported_func: function(arg) { console.log(arg); } } }; fetch('simple.wasm').then(response => response.arraybuffer() ).then(bytes => webassembly.instantiate(bytes, importobject) ).then(result => result.instance.exports.exported_func() ); note: you can also find this example at index.html on github (view it live also). second overload example the following example (see our index-compile.html demo on github, and view it live also) compiles the loaded simple.wasm byte code using the webassembly.compilestreaming() method and then sends it to a worker using postmessage(). var worker = new worker("wasm_worker.js"); webassembly.compilestreaming(fetch('simple.wasm')) .then(mod ...
Progressive web app structure - Progressive web apps (PWAs)
gress and not yet fully available in any of the major browsers. when 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. structure of our example application the js13kpwa website structure is quite simple: it consists of a single html file (index.html) with basic css styling (style.css), and a few images, scripts, and fonts. the folder structure looks like this: the html from the html point of view, the app shell is everything outside the content section: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>js13kgames a-frame entries</title> <meta name="description" content="a list of a-frame entries submitted to ...
...cation, 30000); } the service worker the last file we will quickly look at is the service worker: sw.js — it first imports data from the games.js file: self.importscripts('data/games.js'); next, it creates a list of all the files to be cached, both from the app shell and the content: var cachename = 'js13kpwa-v1'; var appshellfiles = [ '/pwa-examples/js13kpwa/', '/pwa-examples/js13kpwa/index.html', '/pwa-examples/js13kpwa/app.js', '/pwa-examples/js13kpwa/style.css', '/pwa-examples/js13kpwa/fonts/graduate.eot', '/pwa-examples/js13kpwa/fonts/graduate.ttf', '/pwa-examples/js13kpwa/fonts/graduate.woff', '/pwa-examples/js13kpwa/favicon.ico', '/pwa-examples/js13kpwa/img/js13kgames.png', '/pwa-examples/js13kpwa/img/bg.png', '/pwa-examples/js13kpwa/icons/icon-32.png', '/p...
Structural overview of progressive web apps - Progressive web apps (PWAs)
api isn't yet fully supported by any of the major browsers. once it's available, however, it 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, scripts, 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 par...
..., which is found in the file sw.js. this script begins by importing data from the file games.js in the data directory: self.importscripts("data/games.js"); then it creates a list of all the files that the service worker needs to cache. ...
Progressive web apps (PWAs)
ining a simple example and showing you how all the pieces work. introduction to progressive web apps progressive web app structure making pwas work offline with service workers how to make pwas installable how to make pwas re-engageable using notifications and push progressive loading technology guides client-side storage — a lengthy guide showing how and when to use web storage, indexeddb, and service workers. using service workers — a more in-depth guide covering the service worker api. using indexeddb — the fundamentals of indexeddb, explained in detail. using the web storage api — the web storage api made simple. instant loading web apps with an application shell architecture — a guide to using the app shell coding pattern to create apps that load quickly. usin...
...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 javascript 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 precache specific resources. workbox — spiritual successor to sw-precach...
SVG Core Attributes - SVG: Scalable Vector Graphics
Web › SVG › Attribute › Core
its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with css). value: any valid id string; animatable: no lang participates in defining the language of the element, the language that non-editable elements are written in or the language that editable elements should be written in. ...
...non-editable elements are written in or the language that editable elements should be written in. the tag contains one single entry value in the format defined in the tags for identifying languages (bcp47) ietf document. svg 2 introduce the new lang attributes. if both lang and xml:lang attribute are used, xml:lang has priority over lang. value: any valid language id; animatable: no tabindex the tabindex svg attribute allows you to control whether an element is focusable and to define the relative order of the element for the purposes of sequential focus navigation. value type: <integer>; animatable: no xml:base specifies a base iri other than the base iri of the document. value type: <iri>; animatable: no xml:lang it is a universal attribute allowed in all xml dialects to m...
SVG Attribute reference - SVG: Scalable Vector Graphics
Web › SVG › Attribute
shape-rendering slope spacing specularconstant specularexponent speed spreadmethod startoffset stddeviation stemh stemv stitchtiles stop-color stop-opacity strikethrough-position strikethrough-thickness string stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width style surfacescale systemlanguage t tabindex tablevalues target targetx targety text-anchor text-decoration text-rendering textlength to transform transform-origin type u u1 u2 underline-position underline-thickness unicode unicode-bidi unicode-range units-per-em v v-alphabetic v-hanging v-ideographic v-mathematical values vector-effect version vert-adv-y vert-origin-x vert-origin-y viewbox viewtarget...
... xlink attributes xlink:href, xlink:type, xlink:role, xlink:arcrole, xlink:title, xlink:show, xlink:actuate presentation attributes note that all svg presentation attributes can be used as css properties. alignment-...
<symbol> - SVG: Scalable Vector Graphics
Web › SVG › Element › symbol
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-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-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-...
...opeffect, 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-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriescontainer element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <...
SVG In HTML Introduction - SVG: Scalable Vector Graphics
<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> <script> function signalerror() { document.getelementbyid('body').setattribute("class", "invalid"); } </script> </head> <body id="body" style="position:absolute; z-index:0; border:1px solid black; left:5%; top:5%; width:90%; height:90%;"> <form> <fieldset> <legend>html form</legend> <p><label>enter something:</label> <input type="text"> <span id="err">incorrect value!</span></p> <p><input type="button" value="activate!" onclick="signalerror();"></p> </fieldset> </form> <svg viewbox="0 0 100 100" preserveaspectratio="xmidymid slice" st...
...the only interesting part is the <...
Same-origin policy - Web security
ed it. data: urls get a new, empty, security context. exceptions in internet explorer internet explorer has two major exceptions to the same-origin policy: trust zones if both domains are in the highly trusted zone (e.g. corporate intranet domains), then the same-origin limitations are not applied. port ie doesn't include port into same-origin checks. therefore, https://company.com:81/index.html and https://company.com/index.html are considered the same origin and no restrictions are applied. these exceptions are nonstandard and unsupported in any other browser. changing origin a page may change its own origin, with some limitations. a script can set the value of document.domain to its current domain or a superdomain of its current domain. if set to a superdomain of the current ...
...o more properties than the above. location the following cross-origin access to location properties is allowed: methods location.replace attributes urlutils.href write-only. some browsers allow access to more properties than the above. cross-origin data storage access access to data stored in the browser such as web storage and indexeddb are separated by origin. each origin gets its own separate storage, and javascript in one origin cannot read from or write to the storage belonging to another origin. cookies use a separate definition of origins. a page can set a cookie for its own domain or any parent domain, as long as the parent domain is not a public suffix. firefox and chrome use the public suffix list to determine if a...
Using shadow DOM - Web Components
reate a shadow root let shadow = this.attachshadow({mode: 'open'}); creating the shadow dom structure next, we use some dom manipulation to create the element's internal shadow dom structure: // create spans let wrapper = document.createelement('span'); wrapper.setattribute('class', 'wrapper'); let icon = document.createelement('span'); icon.setattribute('class', 'icon'); icon.setattribute('tabindex', 0); let info = document.createelement('span'); info.setattribute('class', 'info'); // take attribute content and put it inside the info span let text = this.getattribute('data-text'); info.textcontent = text; // insert icon let imgurl; if(this.hasattribute('img')) { imgurl = this.getattribute('img'); } else { imgurl = 'img/default.png'; } let img = document.createelement('img'); img.src =...
... create some css to apply to the shadow dom let style = document.createelement('style'); style.textcontent = ` .wrapper { position: relative; } .info { font-size: 0.8rem; width: 200px; display: inline-block; border: 1px solid black; padding: 10px; background: white; border-radius: 10px; opacity: 0; transition: 0.6s all; position: absolute; bottom: 20px; left: 10px; z-index: 3; } img { width: 1.2rem; } .icon:hover + .info, .icon:focus + .info { opacity: 1; }`; attaching the shadow dom to the shadow root the final step is to attach all the created elements to the shadow root: // attach the created elements to the shadow dom shadow.appendchild(style); shadow.appendchild(wrapper); wrapper.appendchild(icon); wrapper.appendchild(info); using our custom elemen...
Using the WebAssembly JavaScript API - WebAssembly
through some examples that explain how to use the webassembly javascript api, and how to use it to load a wasm module in a web page. 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. next, let’s create a simple html file called index.html in the same directory as your wasm file (can use our simple template if you haven’t got one easily available). now, to help us understand what is going on here, let’s look at the text representation of our wasm module (which we also meet in converting webassembly format to wasm): (module (func $i (import "imports" "imported_func") (param i32)) (func (export "exported_func") i3...
...on references are necessary to compile languages like c/c++ that have function pointers. in a native implementation of c/c++, a function pointer is represented by the raw address of the function’s code in the process’s virtual address space and so, for the safety reasons mentioned above, cannot be stored directly in linear memory. instead, function references are stored in a table and their indexes, which are integers and can be stored in linear memory, are passed around instead. when the time comes to call a function pointer, the webassembly caller supplies the index, which can then be safety bounds checked against the table before indexing and calling the indexed function reference. thus, tables are currently a rather low-level primitive used to compile low-level programming language ...
Porting the Library Detector - Archive of obsolete content
so main.js needs to filter out any duplicates, in ca...
addon-page - Archive of obsolete content
. note: this module has no effect on fennec. for pages like this, navigational elements such as the awesome bar, search bar, or bookmarks toolbar are not usually relevant and distract from the content you are presenting. the addon-page module provides a simple way to have a page which excludes these elements. to use the module import it using require(). after this, the page loaded from "data/index.html" will not contain navigational elements: var addontab = require("sdk/addon-page"); var data = require("sdk/self").data; require("sdk/tabs").open(data.url("index.html")); this only affects the page at "data/index.html": all other pages are displayed normally. ...
page-mod - Archive of obsolete content
attached to a page-mod: var workers = []; var pagemod = require("sdk/page-mod").pagemod({ include: ['*'], contentscriptwhen: 'ready', contentscriptfile: data.url('pagemod.js'), onattach: function(worker) { workers.push(worker); } }); you can remove workers when they are no longer valid by listening to detach: var workers = []; function detachworker(worker, workerarray) { var index = workerarray.indexof(worker); if(index != -1) { workerarray.splice(index, 1); } } var pagemod = require("sdk/page-mod").pagemod({ include: ['*'], contentscriptwhen: 'ready', contentscriptfile: data.url('pagemod.js'), onattach: function(worker) { workers.push(worker); worker.on('detach', function () { detachworker(this, workers); }); } }); cleaning up on add-...
self - Archive of obsolete content
nique uri string. this uri can be used for apis which require a valid uri string, such as the passwords module. id this property is a printable string that is unique for each add-on. it comes from the id property set in the package.json file in the main package (i.e. the package in which you run jpm xpi). while not generally of use to add-on code directly, it can be used by internal api code to index local storage and other resources that are associated with a particular add-on. name this property contains the add-on's short name. it comes from the name property in the main package's package.json file. version this property contains the add-on's version string. it comes from the version property set in the package.json file in the main package. loadreason this property contains of the f...
High-Level APIs - Archive of obsolete content
ncompatible changes to them. addon-page create a page that does not contain navigational elements. base64 data encoding and decoding using base64 algorithms. clipboard interact with the system clipboard, 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 javascript code. notifications display transient, toaster-style desktop messages to the user. page-mod run scripts 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...
test/assert - Archive of obsolete content
alence is determined by ==. for all other object pairs, including array objects, equivalence is determined by having the same number of owned properties (as verified with object.prototype.hasownproperty.call), the same set of keys (although not necessarily the same order), equivalent values for every corresponding key, and an identical "prototype" property. note: this accounts for both named and indexed properties on arrays. assert.deepequal({ a: "foo" }, { a: "foo" }, "equivalent objects"); parameters actual : object the actual result. expected : object the expected result. message : string optional message to log, providing extra information about the test. notdeepequal(actual, expected, message) tests that two objects do not have a deep equality relation, using the negation of t...
util/array - Archive of obsolete content
let { has } = require('sdk/util/array'); let a = ['rock', 'roll', 100]; has(a, 'rock'); // true has(a, 'rush'); // false has(a, 100); // true parameters array : array the array to search. element : * the element to search for in the array. returns boolean : a boolean indicating whether or not the element was found in the array. ...
cfx to jpm - Archive of obsolete content
same as it was when you were using cfx. entry point the add-on's entry point is the file that's executed when the add-on needs to initialize itself: for example, when firefox starts, or when the add-on's installed, enabled, or upgraded. with cfx, this defaults to "lib/main.js", although it can be set to a different file using the main field in package.json. in jpm, the entry point defaults to "index.js". so when switching over to jpm: either rename your "main.js" to "index.js" and move it from "lib" to the top level or add a main field to package.json with the value "lib/main.js". loading modules the jpm tool uses the same logic as node.js to determine how to resolve the argument to require(). in most respects this is the same as the old cfx logic. however there are a few differences,...
jpm - Archive of obsolete content
ch is shown in brackets after the question. if you just press enter, your add-on gets the default value. once you've supplied a value or accepted the default for these properties, you'll be shown the complete contents of "package.json" and asked to accept it. then jpm creates a skeleton add-on, as a starting point for your add-on development, with the following file structure: my-addon index.js package.json test test-index.js jpm run this command runs a new instance of firefox with the add-on installed: jpm run jpm run accepts the following options: -b --binary binary use the version of firefox specified in binary. binary may be specified as a full path or as a path relative to the current directory. jpm run -b /path/to/firefo...
package.json - Archive of obsolete content
he following keys: title, description and homepage. these json objects will be used to localizations for the add-on's meta data shown within the add-ons manager. see the documentation for how to localize the add-on's meta data. main a string representing the name of a program module that is located in one of the top-level module directories specified by lib. defaults to "index.js". name the add-on's name. this name cannot contain spaces or periods, and defaults to the name of the parent directory. when the add-on is built as an xpi, if the fullname and title keys are not present, name is used as the add-on's em:name element in its install.rdf. packages note: this is deprecated along with cfx and is not available when ...
Adding a Button to the Toolbar - Archive of obsolete content
cs of jpm. to add a button to the toolbar, use the action button or toggle button modules. create a new directory, navigate to it, and execute jpm init, accepting all the defaults. ...
Logging - Archive of obsolete content
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. the 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! console in content scripts you can use the console in content scripts 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...
Developing for Firefox Mobile - Archive of obsolete content
stall it. afterwards you can delete it using adb as follows: adb shell cd /mnt/sdcard rm my-addon.xpi module compatibility modules not supported in firefox mobile are marked in the tables below. ...
Modifying Web Pages Based on URL - Archive of obsolete content
); // create a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscript: 'document.body.innerhtml = ' + ' "<h1>page matches ruleset</h1>";' }); do as follows: create a new directory and navigate to it. run jpm init, accepting all the defaults open the file index.js and add the code above run jpm run open ietf.org in the browser window that opens. below is what you should see. specifying the match pattern match pattern uses match-pattern syntax. you can pass a single match-pattern string, or an array. keeping the content script in a separate file in the example above, we've supplied content script as a string. unless the script is extremely sim...
Modifying the Page Hosted by a Tab - Archive of obsolete content
then your content script can use that. loading several content script files the data assigned to contentscriptfile can be a vector. scripts will be loaded in the same order as the vector. in the following example, we are loading two scripts, first.js & second.js. both scripts will be executed in the same context, so everything publicly defined in first.js will be accessible from second.js. ...
Finding window handles - Archive of obsolete content
; let sel = ctypes.voidptr_t; // constants let nil = ctypes.voidptr_t(0); //common functions let sel_registername = objc.declare('sel_registername', ctypes.default_abi, sel, ctypes.char.ptr); let objc_msgsend = objc.declare('objc_msgsend', ctypes.default_abi, id, id, sel, '...'); /* https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/nsapplication_class/index.html#//apple_ref/occ/instp/nsapplication/orderfront: * [nswindowptr orderfront:nil] */ var orderfront = sel_registername('orderfront:'); var nswindowptr = ctypes.voidptr_t(ctypes.uint64(nswindowstring)); var rez_orderfront = objc_msgsend(nswindowptr, orderfront, nil); console.log('rez_orderfront:', rez_orderfront, rez_orderfront.tostring()); objc.close(); unix under unix systems, the nat...
LookupPrefix - Archive of obsolete content
ceuri && originalelement.namespaceuri === namespaceuri && originalelement.prefix && originalelement.lookupnamespaceuri(originalelement.prefix) === namespaceuri) { return originalelement.prefix; } if (originalelement.attributes && originalelement.attributes.length) { for (var i=0; i < originalelement.attributes.length; i++) { var att = originalelement.attributes[i]; xmlnspattern.lastindex = 0; var localname = att.localname || att.name.substr(att.name.indexof(':')+1); // latter test for ie which doesn't support localname if (localname.indexof(':') !== -1) { // for firefox when in html mode localname = localname.substr(att.name.indexof(':')+1); } if ( xmlnspattern.test(att.name) && att.value === namespaceuri && lookupnamespaceuri(originalelement, localnam...
Custom about: URLs - Archive of obsolete content
utpage_description = 'this is my custom about page'; const aboutpage_id = 'aa132730-2278-11e5-867f-0800200c9a66'; // make sure 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 classdescription() { return aboutpage_description; } 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); } ...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
study group as part of the information-technology promotion agency’s (ipa) “platform-technology development and businesses relating to electronic commerce” project. this report is available online (in japanese) at http://www.meti.go.jp/kohosys/press/0004397/ the ipa has also established an open-source software center to promote and cultivate oss http://www.ipa.go.jp/software/open/o...ish/index.html ...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
have around. install extensions for firefox from the mozilla add-ons website. optional - install firebug and chromebug chromebug is used by the firebug development team to develop firebug. you can use it to help debug firefox extensions as well as to inspect and learn how the firefox ui (chrome) is constructed. you can learn more about chromebug and download it at http://getfirebug.com/wiki/index.php/chromebug_user_guide you may also find this extension to be valuable: extension developer https://addons.mozilla.org/firefox/addon/7434 developing extensions: what you need to know let’s delve into chrome, something you’ll need to know about in order to develop extensions. chrome what is chrome? “chrome”is the word used to describe all the gui structural elements that go into ...
Adding windows and dialogs - Archive of obsolete content
ess moves you to the next control in the window, giving it focus. in general, there's nothing you need to do in order to have good keyboard focus management. firefox will automatically focus the first input control in your window, and tab focus advances in the order the items are found in the xul document. if you have a very complex layout, or need customized tabbing behavior, you can set the tabindex attribute in the controls. you can also use the focus function to focus an element depending on events such as window load. you should do this carefully, to avoid having inaccessible controls. you can also use the -moz-user-focus css property to enable focusing of elements that typically wouldn't receive focus. again, this should be used sparingly. « previousnext » this tutorial was ki...
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
s, as calling .bind() does require some work and memory. overriding/extending/amending existing functions a common thing add-ons do during their initialization is overriding/extending existing browser functions by using function.tostring/function.tosource and eval to "string-patch" the function body. // do not use! var functionbody = gbrowser.addtab.tosource(); var afterbracket = functionbody.indexof("{") + 1; functionbody = functionbody.substring(0, afterbracket) + "myaddon.onaddtab(auri);" + functionbody.substring(afterbracket); eval("gbrowser.addtab = " + functionbody); of course, this not only looks messy, but can be quite error prone. other extensions might do something similar, trying to hook the same functions, but a little different, ending up with completely broken code. the ...
JavaScript Object Management - Archive of obsolete content
embers in the namespace: /** * 〈namespace〉 namespace. */ if (typeof 〈namespace〉 == "undefined") { var 〈namespace〉 = { /** * initializes this object. */ init : function() { this.obsservice = cc["@mozilla.org/observer-service;1"].getservice(ci.nsiobserverservice); } }; 〈namespace〉.init(); }; js objects can also be treated as string-indexed arrays: // equivalent. 〈namespace〉.hello = {}; 〈namespace〉["hello"] = {}; // equivalent. 〈namespace〉.hello.init(); 〈namespace〉.hello["init"](); this is very useful in cases where you have to set attributes or functions with dynamically generated names. it's one of the funky properties of javascript: all objects are nothing more than name / value mappings. you can add o...
Mozilla Documentation Roadmap - Archive of obsolete content
o mozilla's source code and try to locate the code you need. one way to do this is to look into your firefox installation directory, maybe unpack a few jars and see what's inside. but this is very awkward and limited. it would be much better to be able to search and navigate through the huge code base with some ease. luckily, mozilla provides exactly that in the mozilla cross-reference. the main index in this page gives you options to look into the different product branches in development at mozilla. make sure you pick the one that matches your target versions. all of these provide advanced search capabilities, including regular expression search and file path search. you'll be able to navigate the full source tree, inspect the change history for all files, and link to specific code lines. i...
User Notifications and Alerts - Archive of obsolete content
is to also add a hidden box to the overlay, but use css positioning to locate it where you want. this usually means that the box will be hovering on top of the page's content, and there are a few things you must know about this. first of all, switching tabs will probably make your alert disappear. this is probably due to the fact that the browser tab box uses a deck internally, and that affects z-indexing. you'll have to code around this using tab events in order to know when to re-display your alert. another problem you need to take into account is that transparency of floating xul on the mac os version of firefox 2 doesn't work. you'll end up with a box with a white background you can't get rid of . on firefox 3 and above, this seems to have been corrected, using the panel element. the botto...
Creating a dynamic status bar extension - Archive of obsolete content
the variable output from the xmlhttprequest.responsetext property. the text we receive back from the server looks something like this: "goog",414.20,"5/1/2006","1:36pm",-3.74,417.85,419.44,412.19,4760215 we then parse the text. we use the split() string function to split the comma-separated value string into its individual parts, with each field in a separate element in the array fieldarray. at index 0 is the ticker symbol itself, which we don't need since we know which stock we're looking at. the status bar panel's label is set to indicate the current value of the stock, which is stored in fieldarray, by setting the samplepanel.label property. we then set the tooltip for the status bar panel by assigning an appropriate string to the samplepanel.tooltiptext property. the string is built from ...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
vendor: remi collet release : 1.fc6.remi build date: sat 24 feb 2007 01:45:37 pm cet install date: tue 20 mar 2007 02:47:27 pm cet build host: remi.famillecollet.com packager : http://remi.collet.free.fr/ references other documents about autoconfig http://mit.edu/~firefox/www/maintain...utoconfig.html http://www.alain.knaff.lu/howto/mozi...ion/index.html http://thegoldenear.org/toolbox/wind...re-config.html http://ilias.ca/blog/2005/03/locking...efox-settings/ compile on windows: http://forums.mozillazine.org/viewtopic.php?t=276014 http://www.mozilla.org/community/dev...er-forums.html http://forums.mozillazine.org/viewto...config#2090731 http://forums.mozillazine.org/viewto...config#1354355 http://forums.mozillazine.org/viewto...toco...
Same-origin policy for file: URIs - Archive of obsolete content
r local disk. starting in gecko 1.9, files are allowed to read only certain other files. specifically, a file can read another file only if the parent directory of the originating file is an ancestor directory of the target file. directories cannot be loaded this way, however. for example, if you have a file foo.html which accesses another file bar.html and you have navigated to it from the file index.html, the load will succeed only if bar.html is either in the same directory as index.html or in a directory contained within the same directory as index.html. this policy affects anything that does same-origin checks, including xmlhttprequest, xslt, and xbl. for cross-window dom access, each file is treated as a separate origin, with one exception: if a file is loaded from another file that woul...
Source code directories overview - Archive of obsolete content
cross-platform file library. it is used to store mail box data, news data and global history data. it has not been updated to support xpcom yet. this code originated in the mozilla classic code base. dbm contains c code for managing, reading and writing hash tables. it is used for the auto-completion feature on the url edit box (stored in netscape.hst in mozilla classic) and for the cached pages index (stored in fat.db in mozilla classic). this code originated at uc berkeley. directory contains the ldap sdk. docshell contains c interfaces and code for loading and displaying a single web page (e.g. scroll). the [#seamonkey-embedding embedding] code wraps this code with higher level browser functions like forward, back and history. dom contains c interfaces and code for implementing and track...
Dehydra Object Reference - Archive of obsolete content
.template template object the template from which this class was instantiated, if applicable. pointer and reference types property type description .ispointer boolean flag .isreference boolean flag .type type object the type this points to or references array type property type description .isarray boolean flag .max integer or normal fixed-size arrays, the index of the largest element of the array. for example, an int[10] would have .max = 9 .variablelength boolean flag true if the type represents a c99 variable-length array type number type property type description .precision integer for floating-point types, the precision of the type .min integer for integer types, the minimum value capable of being stored .max integer for integer ...
Drag and Drop - Archive of obsolete content
t on it. this should be changed in the ondragover and ondragenter event handlers. dragaction set to the current action to be performed, which should be one or more of the constants described earlier. this can be used to provide extra feedback to the user. numdropitems the number of items being dragged. for example, this will be set to 5 if five bookmarks are being dragged. getdata(transfer,index) get the data being dragged. the first argument should be an nsitransferable object to hold the data. the second argument, index, should be the index of the item to return. sourcedocument the document where the drag started. sourcenode the dom node where the drag started. isdataflavorsupported(flavor) returns true if the data being dragged contains data of the specified flavor. next...
Editor Embedding Guide - Archive of obsolete content
mandparams could possibly be a null pointer or a pointer to a valid structure filled with relative parameters to acommand (see list below for legal params). 3. verify if a command is enabled -- iscommandenabled: commandmanager->iscommanddisabled(acommand, retval) 4. get the current command state of a given command -- getcommandstate: commandmanager->getcommandstate(acommand,acommandparams) index of commands and parameters cmd_bold toggles bold style on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters example normal bold cmd_italics toggles italics style on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "st...
Menu - Archive of obsolete content
Archive › Mozilla › Jetpack › UI › Menu
ts some methods act on existing items within a menu. existing items are always identified using targets. a target is a string, regular expression, or integer. a string target is case-insensitively matched against the label, id, and xulid properties of menuitems. a regular expression target is tested against the label, id, and xulid properties of menuitems. an integer target indicates a zero-based index within a menu. integer targets can be negative: -1 indicates the last item in a menu, -2 the second-to-last, and so on. multiple items in a menu may match a target, but action is only ever taken on the first matching item. examples before running any examples, import the api from the future: jetpack.future.import("menu"); snippets add a single, static menuitem to the jetpack menu that doesn't do...
Message Summary Database - Archive of obsolete content
to access our database objects, but it does increase memory usage. mork assumes the caller will do file locking, so two processes or threads writing to the same database can corrupt it. but i believe sql-lite has the same problem. mork is schema-less. this means we can add properties to rows arbitrarily. and we only pay the storage cost for a property if the row has the property set. we can still index on these properties, if we want. we would need the equivalent capabilities if we replaced mork. ...
Microsummary XML grammar reference - Archive of obsolete content
mozilla.org/microsummaries/0.1" name="firefox download count"> <template> <transform xmlns="http://www.w3.org/1999/xsl/transform" version="1.0"> <output method="text"/> <template match="/"> <value-of select="id('download-count')"/> <text> fx downloads</text> </template> </transform> </template> <pages> <include>http://(www\.)?spreadfirefox\.com/(index\.php)?</include> </pages> </generator> namespace the namespace uri for microsummary generator xml documents is: http://www.mozilla.org/microsummaries/0.1 all elements in a microsummary 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 <generat...
Microsummary topics - Archive of obsolete content
createinstance(components.interfaces.nsidomparser); var generatordoc = domparser.parsefromstring(generatortext, "text/xml"); var microsummaryservice = components.classes["@mozilla.org/microsummary/service;1"]. getservice(components.interfaces.nsimicrosummaryservic...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
same event type. both methods require three parameters: the event type, a function reference, and a boolean denoting whether the listener should catch events in their capture phase. if the boolean is set to false, it will only catch bubbling events. w3c events have three phases: capturing, at target, and bubbling. every event object has an eventphase attribute indicating the phase numerically (0 indexed). every time you trigger an event, the event starts at the dom's outermost element, the element at the top of the dom tree. it then walks the dom using the most direct route toward the target, which is the capturing phase. when the event reaches the target, the event is in the target phase. after arriving at the target, it walks up the dom tree back to the outermost node; this is bubbling. inte...
Hacking wiki - Archive of obsolete content
</tt> directory on your server. the contents of the <tt>trunk</tt> directory you just checked out is a slightly modified mediawiki install, so you can follow the mediawiki install instructions. 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 script, 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 l...
SpiderMonkey coding conventions - Archive of obsolete content
s. naming conventions public function names begin with js_ followed by capitalized "intercaps", e.g. js_newobject. extern but library-private function names use a js_ prefix and mixed case, e.g. js_searchscope. most static function names have unprefixed, mixed-case names: getchar. but static native methods of js objects have lowercase, underscore-separated or intercaps names, e.g., str_indexof. and library-private and static data use underscores, not intercaps (but library-private data do use a js_ prefix). scalar type names are lowercase and js-prefixed: jsdouble. aggregate type names are js-prefixed and mixed-case: jsobject. macros are generally all_caps and underscored, to call out potential side effects, multiple uses of a formal argument, etc. linkage dll entry po...
String Rosetta Stone - Archive of obsolete content
) ...
Table Cellmap - Archive of obsolete content
ml-2.0). further the table header and footer will be repeated on every page when printed out. due to this behind the cellmap for the table we will find a cellmap for every rowgroup. in this low level cellmap the row count begins every time with 0. a typical code segment to come from the table level down to the rowgroup level nscellmap* map = mfirstmap; while (map) { if (map->getrowcount() > rowindex) { // add your action here } rowindex -= map->getrowcount(); map = map->getnextsibling(); } data entry the usual way to populate the cellmap is via nstableframe::insertrows. enabling the debug code at the function entrance and exit gives a quite complete picture of the cellmap structure. below follows the dump for the 2x2 table. insertrowsbefore firstrow=0 ***start table dump*** mco...
Anonymous Content - Archive of obsolete content
cus events are both stopped. as far as the bound element is concerned, it retains focus throughout the two events. anonymous content can receive focus when the user tabs through the document. the same rules apply. if the anonymous content is focusable, it can be tabbed into, but if the bound element is not focusable, the event will be stopped before it reaches the bound element. in html4 the tabindex attribute can be used to specify the tab order for focusable elements. this attribute can be specified on anonymous content. each scope has a unique tab order. the tabindex values used in one scope are ignored by other scopes. as an example, consider the html file upload control. it is a focusable element that in turn is made up of two focusable anonymous elements: a textfield and a button. tab ...
Binding Implementations - Archive of obsolete content
en on the tag using the name attribute is the name that can be used to invoke the method on the element. a method with parameters specifies those parameters and their names with parameter elements declared underneath the method element. the implementation of the method is contained inside a body element. the parameters specified are bound to their names in the method body. <method name="scrolltoindex"> <parameter name="index"/> <body> <![cdata[ if (index < 0) return; ... ]]> </body> </method> properties properties can also be defined on the bound element using property tags. there are two basic types of properties. the first type of property is a raw value that is set directly on the element itself. the second type of property is one that defines functions...
Elements - Archive of obsolete content
#implied > the method element is used to describe a single method of a binding implementation. id - the id attribute is a document-unique identifier. name - the name attribute's value is the name given to the method when it is attached to the bound element. the method can be invoked directly from the bound element using this value. example <method name="scrollto"> <parameter name="index"/> <body> this.setattribute("scrollpos", index); </body> </method> parameter <!element parameter empty> <!attlist parameter id id #implied name cdata #required > the parameter element is used inside a method element. it represents a single parameter of a method. id - the id attribute is a document-unique identifier. name - the valu...
Using XPInstall to Install Plugins - Archive of obsolete content
f installation and uninstallation will be handled by exe, which can then create files and registry entries and also clean up after itself upon removal. original document information author(s): arun k. ranganathan, netscape communications last updated date: 05 aug 2002 copyright information: copyright © 2001-2003 netscape. all rights reserved. link: http://devedge-temp.mozilla.org/view.../index_en.html triggering an xpinstall download from html in a manner analogous to how smartupdate downloads were initiated by the pluginurl attribute of the embed tag, xpinstall downloads can also be initiated by html tags invoking plugins, notably via the codebase attribute of the object tag. this is analogous to how internet explorer downloads cab files pointed to by the codebase attribute of the...
windowsShortcut - Archive of obsolete content
ngpath a filespecobject representing the absolute path to the working dir for where atarget will is to be run from. aparams parameters that atarget requires. aicon a filespecobject representing the absolute path (including fiilename) to a file that contains icons. can be either .ico, .dll, .exe, or any other binary file that contains icons. aiconid index of the icon from aicon to use for this shortcut. returns an integer error code. for a list of possible values, see return codes. example see file.windowsshortcut in the script examples chapter. ...
autoFillAfterMatch - Archive of obsolete content
...
linkedpanel - Archive of obsolete content
« xul reference home linkedpanel type: id the id of the linked tabpanel element that will be displayed when the tab is selected. if this attribute is not used, the tab will be connected 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. ...
pagestep - Archive of obsolete content
...
position - Archive of obsolete content
« xul reference home position type: string (representing an integer) when an element is in an overlay, the position is an index where the child is inserted. the position is one-based, so use a value of 1 to place the element at the beginning. this attribute is ignored if either an insertbefore or insertafter attribute matches an element. ...
selected - Archive of obsolete content
« xul reference home selected type: boolean indicates whether the element is selected or not. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. see also visuallyselected ...
visuallyselected - Archive of obsolete content
isuallyselected type: boolean new in firefox 40. indicates that a tab is selected. the visuallyselected attribute is set asynchronously, once the browser has switched to the selected tab. if your code needs to apply some styling to the currently selected tab, this is the attribute you should use from firefox 40 onwards. this value is read-only. to change the selection, set either the selectedindex or selecteditem property of the containing element. ...
advance - Archive of obsolete content
Archive › Mozilla › XUL › Method › advance
supply null as the argument to go to the next page in the sequence. ...
appendItem - Archive of obsolete content
of the existing list of items. you may optionally set a value. the function returns the newly created element. ...
getResultAt - Archive of obsolete content
« xul reference home getresultat( index ) obsolete since gecko 26 return type: nsiautocompleteitem returns the result item at the specified index. the item will be a value of type nsiautocompleteitem. ...
getResultValueAt - Archive of obsolete content
« xul reference home getresultvalueat( index ) return type: result value returns the result value at the specified index. the item will correspond to the text of that item that appears in the popup. ...
getSearchAt - Archive of obsolete content
« xul reference home getsearchat( index ) return type: string returns the search component with the given index. the components are set with the autocompletesearch attribute. ...
getSelectedItem - Archive of obsolete content
« xul reference home getselecteditem( index ) return type: element when multiple items are selected, you can retrieve each selected item using this method. the argument index specifies the index in the list of the selected items, not the row number of the item. the item index is zero-based, thus this example will return the first selected item: getselecteditem(0). ...
getSession - Archive of obsolete content
« xul reference home getsession( index ) obsolete since gecko 26 return type: nsiautocompletesession returns the session object with the given index. this will return an object of type nsiautocompletesession. ...
loadTabs - Archive of obsolete content
urn value loads a set of uris, specified by the array uris, into tabs. ...
startEditing - Archive of obsolete content
the tree view's nsitreeview.getcelltext() method is called to obtain the cell contents. ...
contentView - Archive of obsolete content
« xul reference contentview type: nsitreecontentview for trees built with a content builder - that is, those that do not have flags set -- the contentview will be a reference to the nsitreecontentview for the tree. this interface lets you retrieve the dom element corresponding to a given a row index and vice versa. for trees that are not built with a content builder, the functions of nsitreecontentview will not be available, since there are no dom nodes to retrieve. in newer versions of mozilla, the contentview property is actually a synonym for the view property, since the two interfaces are flattened together into a single interface in javascript. this property is read-only. ...
controllers - Archive of obsolete content
keeper/there.is.only.xul"> <script> function init() { var list = document.getelementbyid("thelist"); var listcontroller = { supportscommand : function(cmd){ return (cmd == "cmd_delete"); }, iscommandenabled : function(cmd){ if (cmd == "cmd_delete") return (list.selecteditem != null); return false; }, docommand : function(cmd){ list.removeitemat(list.selectedindex); }, onevent : function(evt){ } }; list.controllers.appendcontroller(listcontroller); } </script> <listbox id="thelist"> <listitem label="ocean"/> <listitem label="desert"/> <listitem label="jungle"/> <listitem label="swamp"/> </listbox> </window> ...
editingRow - Archive of obsolete content
...
onFirstPage - Archive of obsolete content
...
pageStep - Archive of obsolete content
...
selectedItem - Archive of obsolete content
...
selectionEnd - Archive of obsolete content
« xul reference selectionend type: integer get or set the end of the selected portion of the field's text. use in conjuction with the selectionstart property. the value specifies the index of the character after the selection. if this value is equal to the value of the selectionstart property, no text is selected, but the value indicates the position of the caret (cursor) within the textbox. ...
selectionStart - Archive of obsolete content
...
Sorting and filtering a custom tree view - Archive of obsolete content
"goalie masked man", weapon: "hockey stick"}); data.push({name: "april o'neil", description: "journalist", weapon: "none"}); } if (filtertext == "") { //show all of them table = data; } else { //filter out the ones we want to display table = []; data.foreach(function(element) { //we'll match on every property for (var i in element) { if (prepareforcomparison(element[i]).indexof(filtertext) != -1) { table.push(element); break; } } }); } sort(); //restore scroll position if (topvisiblerow) { settopvisiblerow(topvisiblerow); } } //generic custom tree view stuff function treeview(table) { this.rowcount = table.length; this.getcelltext = function(row, col) { return table[row][col.id]; }; this.getcellvalue = function(row, col) { return t...
Tabboxes - Archive of obsolete content
ect it by default) that will contain some options for searching. this may not be the best interface for doing this, but we'll use it to demonstrate tabs. the 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. <vbox flex="1"> <tabbox selectedindex="1"> <tabs> <tab label="search"/> <tab label="options"/> </tabs> <tabpanels> <tabpanel id="searchpanel" orient="vertical"> <description> enter your search criteria below and select the find button to begin the search. </description> <spacer style="height: 10px"/> <groupbox orient="horizontal"> <caption label="search criteria"/> <menulist...
XPCOM Examples - Archive of obsolete content
to leave the old items there each time. next, the cookie manager is retrieved. the cookie manager has an enumerator method which returns an object which implements nsisimpleenumerator. this can be used to iterate over all of the cookies. an enumerator has a hasmoreelements() method which will return true until we get to the last cookie. the getnext() method gets a cookie and moves the enumerator index to the next cookie. since an enumerator just returns a generic object, we need to queryinterface() it to an nsicookie before we can use it. in this case, we just use the instanceof operator to accomplish this. finally, an item is added to the menu for the cookie. the host, name and value properties of the cookie are used for this. menus have an appenditem() function which can be used to add an it...
XUL element attributes - Archive of obsolete content
olean attributes like checked where absence means false, you will need to explicitly set the attribute to false before the window closes (bug 15232). popup type: id should be set to the value of the id of the popup element that should appear when the user clicks on the element. position type: string (representing an integer) when an element is in an overlay, the position is an index where the child is inserted. the position is one-based, so use a value of 1 to place the element at the beginning. this attribute is ignored if either an insertbefore or insertafter attribute matches an element. preference-editable mozilla 1.8 type: boolean if true, the element may be used as one that modifies a preference in a prefwindow. the preference attribute may be used to connect...
XUL accessibility guidelines - Archive of obsolete content
with physical disabilities rely on the keyboard as their primary input tool. these users require easy, predictable, and well-documented keyboard control. tab order provide a logical tab order and ensure that users can navigate all content using a keyboard. by default, the tab order is determined by the order of the elements in the underlying code. it can also be set programmatically with the tabindex attribute if needed, but this should be done sparingly and thoroughly tested whenever it is used. the navigation order should be logical, generally left to right, top to bottom. navigation order may vary depending on the nature of the application or the reading direction of the language. ensure that tab order is logical and all interactive elements can be accessed simply without the use of a mou...
Extentsions FAQ - Archive of obsolete content
c page that does not use greasemonkey? var newnode = document.createelement(" ... html content here ... "); var replaceme = document.getelementbyid("replaceme"); replaceme.parentnode.replacechild(newnode, replaceme); is it possible to place an image in the window that can be moved to anywhere in the window, and always remain on top of everything else?(similiar to using position:absolute and-index:100000 in html) you can almost do this with a stack: <window ...> <stack flex="1"> <image top="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 for...
Adobe Flash - Archive of obsolete content
reater than 6r.49 // 3. if so, the plugin is scriptable on windows and linux // 4. determine whether the browser is a mach-o browser // 5. if the browser is a mach-o browser, determine whether the version of the plugin // is greater than 12, a hypothetical version when flash will fix the plugin to be // scriptable on mach-o browsers also var flashversionosxscriptable = 12; if(navigator.useragent.indexof("mach-o")!=-1) { if(flashversion < flashversionosxscriptable) // flash version is less than version 12, thus not scriptable on os x } // 6. handle errors (no flash installed, etc.) example 1 uses the regexp (regular expression) object exposed to javascript strings. the description string is broken into an array of constituent strings based on an invocation of the match method with a regula...
Developing cross-browser and cross-platform pages - Archive of obsolete content
e branching) or web content. site branching can be particularly dangerous as people may enter a page through a link, bookmark, search engine or cache with a "wrong" browser. let's see a basic example of this approach. // bad sample if (navigator.appversion.charat(0) == "8") { if (navigator.appname == "netscape") { isns8 = true; alert("netscape 8"); }; } else if (navigator.appversion.indexof("msie") != -1) { isie = true; alert("internet explorer"); }; while this kind of checking in the above code can work in a crude sense, sharp readers may wonder what happens when internet explorer 8 is released or when an opera 8.x user visits the page or even when an user with any non-netscape browser starting with a "8" character in the appversion string visits that page. as new browsers a...
Using JavaScript Generators in Firefox - Archive of obsolete content
// simple event listener function to pass the received event to the generator. function grabevent(event) { generator.send(event); } // when we're all done we can close the generator, but that must happen outside // of the generator so we use a timeout. ...
Enumerator - Archive of obsolete content
in windows 8.x store apps. the enumerator object enables enumeration of items in a collection. syntax enumobj = new enumerator([collection]) parameters enumobj the variable name to which the enumerator object is assigned. collection optional any collection object. remarks collections differ from arrays in that the members of a collection are not directly accessible. instead of using indexes, as you would with arrays, you can move the current item pointer only to the first or next element of a collection. the enumerator object provides a way to access any member of a collection and behaves similarly to the for...each statement in vbscript. example the following code shows the usage of the enumerator object: var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scri...
VBArray.lbound - Archive of obsolete content
non-standard. do not use! this object 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. if dimension is greater than the number of dimensions in the vbarray, or is negative, the method generates a "subscript out of range" error. parameters safearray a vbarray object. dimension optional optional. the dimension of the vbarray for which the lower bound index is wanted. if omitted, lbound behaves as if a 1 was passed. example the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. the second part is j...
VBArray - Archive of obsolete content
9; i++) { document.writeln(b[i]); } } --> </script> </head> <body> <script type="text/javascript"> <!-- vbarraytest(createvbarray()); --> </script> </body> properties the vbarray object has no properties. methods vbarray.dimensions returns the number of dimensions in a vbarray. vbarray.getitem returns the item at the specified location. vbarray.lbound returns the lowest index value used in the specified dimension of a vbarray. vbarray.toarray returns a standard javascript array converted from a vbarray. vbarray.ubound returns the highest index value used in the specified dimension of the vbarray. requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet e...
New in JavaScript 1.2 - Archive of obsolete content
l platforms. it no longer converts undefined elements to null and sorts them to the high end of the array. string.prototype.split() it can take a regular expression argument, as well as a fixed string, by which to split the object string. it can take a limit count so that it won't include trailing empty elements in the resulting array. string.prototype.substring(): no longer swaps index numbers when the first index is greater than the second. tostring(): now converts the object or array to a literal. the break and continue statements can now be used with the new labeled statement. ...
New in JavaScript 1.6 - Archive of obsolete content
05. the corresponding ecma standard is ecma-262 edition 3 and ecmascript 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 javascript 1.6 support for ecmascript for xml (e4x) for creating and processing xml content within javascript 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 javascript 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. ...
ECMAScript 2015 support in Mozilla - Archive of obsolete content
iec 16262:2016. a pdf and html version of the standard can be freely downloaded on ecma-international.org. a channel for feedback on ecmascript standards is es-discuss. ...
for each...in - Archive of obsolete content
s variable is local to the function, not to the loop. object object for which the properties are iterated. statement a statement to execute for each property. to execute multiple statements within the loop, use a block statement ({ ... }) to group those statements. description some built-in properties are not iterated over. these include all built-in methods of objects, e.g. string's indexof method. however, all user-defined properties are iterated over. examples using for each...in warning: never use a loop like this on arrays. only use it on objects. see for...in for more details. the following snippet iterates over an object's properties, calculating their sum: var sum = 0; var obj = {prop1: 5, prop2: 13, prop3: 8}; for each (var item in obj) { sum += item; } console.lo...
LiveConnect Overview - Archive of obsolete content
yte, char, short, int, long, float, and double are converted to javascript numbers. a java boolean is converted to a javascript boolean. an object of class netscape.javascript.jsobject is converted to the original javascript object. java arrays are converted to a javascript pseudo-array object; this object behaves just like a javascript array object: you can access it with the syntax arrayname[index] (where index is an integer), and determine its length with arrayname.length. a java object of any other class is converted to a javascript wrapper, which can be used to access methods and fields of the java object: converting this wrapper to a string calls the tostring method on the original object. converting to a number calls the doublevalue method, if possible, and fails otherwise. ...
JSException - Archive of obsolete content
the detail message or other information for the exception. the getwrappedexception method was not available. jsexception constructors, deprecated in javascript 1.4, constructs a jsexception object with an optional detail 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 javascript code being evaluated. tokenindex the index into the source string where the error occurred. getwrappedexception instance method getwrappedexception. declaration public o...
JavaArray - Archive of obsolete content
d to javascript. javaarray is a wrapper for the instance; all references to the array instance are made through the javaarray. in javascript 1.4 and later, the componenttype parameter is either a javaclass object representing the type of the array or class object, such as one returned by java.lang.class.forname. in javascript 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 javascript is converted to javascript data types. when the javaarray is passed back to java, the array i...
Old Proxy API - Archive of obsolete content
ue of this method is ignored. delete proxy.name delete: function(name) -> boolean delete the named property from the proxy. the boolean return value of this method should indicate whether or not the name property was successfully deleted. object.freeze(proxy) object.seal(proxy) object.preventextensions(proxy) fix: function() -> propertydescriptor map (indexed on property names) | undefined should return an object that maps property names to property descriptors. after a call to fix(), the proxy becomes a regular (non-proxy) object with the properties listed in the return value. the handler is no longer used. moreover, the respective method (freeze(), seal(), or preventextension()) is immediately called on the fixed object. note: the fixed ob...
forEach - Archive of obsolete content
st to dev-mdc@lists.mozila.org, explaining the change you desire. jswisher 15 aug 2011 <hr> is this a from _core_ of javascript 1.5? if so, is js 1.5 gecko only? those extra features like foreach are gecko only, and it should be mentioned that they should *_not_* be used on web pages. --gandalf 07:18, 31 may 2005 (pdt) is there a way to make foreach make use of break? [1].foreach(function(value, index, array){ print(value); //break? if (value>1){ return false;//we could have some way to break when we return false } }); //woulld print 1 2 --porfirio 11:17, 22-06-2008 another option would be to throw stopiteration and catch it within foreach(). --bencollver 11:18, 13-08-2008 ...
Mozilla XForms Specials - Archive of obsolete content
upport we currently support all the css pseudo-classes in xforms (:enabled, :disabled, etc. ), except for :read-only and :read-write, because of non-specified behaviour of these for (x)html. instead you have to use :-moz-read-only and :-moz-read-write for now. (limitation tracked in bug 313111)pseudo element support there is no support for the pseudo elements (::value, ::repeat-item, and ::repeat-index ). instead you will have to use the following normal classes instead: xf-value xf-repeat-item xf-repeat-index for example, to target the value element of an input control use: @namespace xf url("http://www.w3.org/2002/xforms"); xf|input .xf-value { ... } the pseudo elements are defined in the css3 basic user interface specification . (limitation tracked in bug 271724) optional parameters in ...
Mozilla XForms User Interface - Archive of obsolete content
ser interface presentation in a form. appearance - the value provided by the form author gives a hint to the processor as to which widget to use to represent the xforms control. three possible values are available to the author: minimal, compact and full. generally speaking, the main purpose for these values is to reflect how much space (screen real estate) the displayed widget will take. tabindex - defines the keyboard navigation sequence between controls. accesskey - 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 server...
Windows Media in Netscape - Archive of obsolete content
etection scripts browser architecture supports: netscapeplugin windows media player installed: true windows media scriptable: false windows media version: pluginversion a complete source code listing showing how that detection was done can be found here (devedge-temp). ...
Building up a basic demo with A-Frame - Game development
ogle cardboard. create a new directory to store your project in. save a copy of the latest a-frame javascript 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"> <title>mdn games: a-frame demo</title> <script src="aframe.min.js"></script> </head> <body> <!-- html goes here --> </body> </html> this contains some basic information like the document charset and <title>. the <script> element includes the a-frame framework in the page; we will write ou...
Building up a basic demo with Babylon.js - Game development
s will use to render the content on) to fill the entire available viewport space. the first <script> element includes the babylon.js library in the page; we will write our example code in the second one. there is one helper variable already included, which will store a reference to the <canvas> element. before reading on, copy this code to a new text file and save it in your working directory as index.html. initialising the babylon.js engine we have to create a babylon.js engine instance first (passing it the <canvas> element to render on) before we start developing our game. add the following code to the bottom of your second <script> element: var engine = new babylon.engine(canvas); the babylon global object contains all the babylon.js functions available in the engine. creating a scen...
Building up a basic demo with the PlayCanvas engine - Game development
canvas will use to 100% so that it will fill the entire available viewport space. the first <script> element includes the playcanvas library in the page; we will write our example code in the second one. there is one helper variable already included, which will store a reference to the <canvas> element. before reading on, copy this code to a new text file and save it in your working directory as index.html. playcanvas application to begin developing our game we have to create the playcanvas application first (using the given <canvas> element), and then start the update loop. add the following code to the bottom of your second <script> element: var app = new pc.application(canvas); app.start(); the pc global object contains all the playcanvas functions available in the engine. next, we'll...
Building up a basic demo with Three.js - Game development
ee.js will insert on the page to 100% to fill the entire available viewport space. the first <script> element includes the three.js library in the page, and we will write our example code inside the second. 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. renderer a renderer is a tool which displays scenes right in your browser. there are a few different renderers: webgl is the default, and others you can use are canvas, svg, css, and dom. they differ in how everything is rendered, so the webgl implementation will implement differently than the css one. despite the variety of ways they achieve the goal, the experience will look the same fo...
Desktop gamepad controls - Game development
ndler(3)) { playerx += 5; } if(gamepadbuttonpressedhandler(11)) { alert('boom!'); } // ... ctx.drawimage(img, playerx, playery); requestanimationframe(draw); } in this case, we are checking the four d-pad buttons (0-3) and the a button (11). note: 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. you could also create a helper function that would assign proper names to the listed buttons, so for example istead of checking out if gamepadbuttonpressedhandler(3) is pressed, you could do a more descriptive check: gamepadbuttonpressedhandler('dpad-right'). you can see a live demo in action — try connecting your ...
Implementing game control mechanisms - Game development
a quick overview of the game's folder structure, javascript 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, javascript files, fonts and sound effects. the src folder contains the javascript 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 phaser, the second preloads all the assets, the third one controls the main menu welcoming the player, and the fourth controls the actual gameplay. every state has its own default methods: preload(), create(), and update(). the first one is needed for preloading required assets, create() is executed once the state had started, and update() is e...
Tiles and tilemaps overview - Game development
as the most efficient way to store the tile images is in an atlas or spritesheet. this is simply all of the required tiles grouped together in a single image file. when it's time to draw a tile, only a small section of this bigger image is rendered on the game canvas. the below images shows a tile atlas of 8 x 4 tiles: using an atlas also has the advantage of naturally assigning every tile an index. this index is perfect to use as the tile identifier when creating the tilemap object. the tilemap data structure it is common to group all the information needed to handle tilemaps into the same data structure or object. these data objects (map object example) should include: tile size: the size of each tile in pixels across / pixels down. image atlas: the image atlas that will be used (on...
Finishing up - Game development
have fun coding! « previous ...
Bounce off the walls - Game development
complished using the collideworldsbound property. add this line right after the existing game.physics.enable() method call: ball.body.collideworldbounds = true; now the ball will stop at the edge of the screen instead of disappearing, but it doesn't bounce. to make this occur we have to set its bounciness. add the following line below the previous one: ball.body.bounce.set(1); try reloading index.html again — now you should see the ball bouncing off all the walls and moving inside the canvas area. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps this is starting to look more like a game now, but we can't control it in any way — it's high time we introduced the player paddle an...
Build the brick field - Game development
compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps something is missing though. the ball goes through the bricks without stopping — we need proper collision detection. « previousn...
Move the ball - Game development
its definition? the code inside it is executed on every frame, so it's a perfect place to put the code that will update the ball's position on screen. add the following new lines of the code inside update(), as shown: function update() { ball.x += 1; ball.y += 1; } the code above adds 1 to the x and y properties representing the the ball coordinates on the canvas, on each frame. reload index.html and you should see the ball rolling across the screen. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps the next step is to add some basic collision detection, so our ball can bounce off the walls. this would take several lines of code — a significantly more complex step than we ha...
Physics - Game development
at the moment, the physics engine has gravity and friction set to zero. adding gravity would result in the ball falling down while friction would eventually stop the ball. fun with physics you can do much more with physics, for example by adding ball.body.gravity.y = 100; you will set the vertical gravity of the bal...
Randomizing gameplay - Game development
ry hit. change the images and use your own. grant extra bonus points if bricks are destroyed rapidly, several-in-a-row (or other bonuses of your choosing.) create levels with different brick layouts. be sure to check the ever growing list of examples and the official documentation, and visit the html5 gamedevs forums if you ever need any help. you could also go back to this tutorial series' index page. « previous ...
The score - Game development
stroyed we will increase the number of points every time the ball hits a brick and update the scoretext to display the current score. this can be done using the settext() method — add the two new lines seen below to the ballhitbrick() function: function ballhitbrick(ball, brick) { brick.kill(); score += 10; scoretext.settext('points: '+score); } that's it for now — reload your index.html and check that the score updates on every brick hit. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps we now have a scoring system, but what's the point of playing and keeping score if you can't win? let's see how we can add a victory state, allowing us to win the game. « prev...
Visual typescript game engine - Game development
├── engine-config.ts | | ├── ioc.ts | | ├── starter.ts | ├── icon/ ... ...
CSRF - MDN Web Docs Glossary: Definitions of Web-related terms
csrf (cross-site request forgery) is an attack that impersonates a trusted user and sends a website unwanted commands. this can be done, for example, by including malicious parameters in a url behind a link that purports to go somewhere else: <img src="https://www.example.com/index.php?action=delete&id=123"> for users who have modification permissions on https://www.example.com, the <img> element executes action on https://www.example.com without their noticing, even if the element is not at https://www.example.com. there are many ways to prevent csrf, such as implementing restful api, adding secure tokens, etc. learn more general knowledge cross-site request forgery on wikipedia prevention measures ...
Crawler - MDN Web Docs Glossary: Definitions of Web-related terms
learn more web crawler on wikipedia ...
Cryptanalysis - MDN Web Docs Glossary: Definitions of Web-related terms
cryptanalysis is the branch of cryptography that studies how to break codes and cryptosystems. cryptanalysis creates techniques to break ciphers, in particular by methods more efficient than a brute-force search. in addition to traditional methods like frequency analysis and index of coincidence, cryptanalysis includes more recent methods, like linear cryptanalysis or differential cryptanalysis, that can break more advanced ciphers. learn more general knowledge cryptanalysis on wikipedia ...
Digest - MDN Web Docs Glossary: Definitions of Web-related terms
a digest is a small value generated by a hash function from a whole message. ideally, a digest is quick to calculate, irreversible, and unpredictable, and therefore indicates whether someone has tampered with a given message. a digest can be used to perform several tasks: in non-cryptographic applications (e.g., the index of hash tables, or a fingerprint used to detect duplicate data or to uniquely identify files) verify message integrity (a tampered message will have a different hash) store passwords so that they can't be retrieved, but can still be checked (to do this securely, you also need to salt the password.) generate pseudo-random numbers generate keys it is critical to choose the proper hash function for your use case to avoid collisions and predictability. learn mor...
Endianness - MDN Web Docs Glossary: Definitions of Web-related terms
every byte can store an 8-bit number (i.e. between 0x00 and 0xff), so you must reserve more than one byte to store a larger number. by far the most common ordering of multiple bytes in one number is the little-endian, which is used on all intel processors. little-endian means storing bytes in order of least-to-most-significant (where the least significant byte takes the first or lowest address), comparable to a common european way of writing dates (e.g., 31 december 2050). ...
JavaScript - MDN Web Docs Glossary: Definitions of Web-related terms
d with the java programming language. although "java" and "javascript" 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. javascript is primarily used in the browser, enabling developers to manipulate webpage content through the dom, manipulate data with ajax and indexeddb, draw graphics with canvas, interact with the device running the browser through various apis, and more. javascript 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), javascript soon came t...
MVC - MDN Web Docs Glossary: Definitions of Web-related terms
lowest to highest price. in this case the controller could handle this directly without needing to update the model. mvc on the web as a web developer, this pattern will probably be quite familiar even if you've never consciously used it before. your data model is probably contained in some kind of database (be it a traditional server-side database like mysql, or a client-side solution such as indexeddb [en-us].) your app's controlling code is probably written in html/javascript, and your user interface is probably written using html/css/whatever else you like. this sounds very much like mvc, but mvc makes these components follow a more rigid pattern. in the early days of the web, mvc architecture was mostly implemented on the server-side, with the client requesting updates via forms or lin...
Perceived performance - MDN Web Docs Glossary: Definitions of Web-related terms
hat a button press or a page load. perceived performance is not how fast your site is; it's how fast your users think it is. perceived performance is not measured by when your site is done loading but when it has loaded enough for users to believe it has loaded and is interactive. in terms of conversion rates, perceived performance is more important than the actual load and response times. speed index is a common metric for measuring perceived performance, though it's not perfect. other features, such as good ux design, including animations, and lazy loading, can make your site appear more responsive, even if the download and response times remain the same. actual performance is a measurement from when a request is made, through the downloading, parsing and execution of all resources, and the...
Robots.txt - MDN Web Docs Glossary: Definitions of Web-related terms
robots.txt is a file which is usually placed in the root of any website. it decides whether crawlers are permitted or forbidden access to the web site. for example, the site admin can forbid crawlers to visit a certain folder (and all the files therein contained) or to crawl a specific file, usually to prevent those files being indexed by other search engines. learn more general knowledge robots.txt on wikipedia https://developers.google.com/search/reference/robots_txt standard specification draft: https://tools.ietf.org/html/draft-rep-wg-topic https://www.robotstxt.org/ ...
Search engine - MDN Web Docs Glossary: Definitions of Web-related terms
are looking for specific information. a search engine conducts the following processes: web crawling: searching web sites by navigating hyperlinks on web pages, both within a site, and from one site to another. a web site owner can exclude areas of the site from being accessed by a search engine's web crawler (or spider), by defining "robot exclusion" information in a file named robots.txt. indexing: associating keywords and other information with specific web pages that have been crawled. this enables users to find relevant pages as quickly as possible. searching: looking for relevant web pages based on queries consisting of key words and other commands to the search engine. the search engine finds the urls of pages that match the query, and ranks them based on their relevance. it then ...
Stacking context - MDN Web Docs Glossary: Definitions of Web-related terms
learn more general knowledge further explanation and example ...
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
in case file:// doesn't return content type (as seems to be the case); can some other tool be uesd in ff (or ie) to detect encoding of local file? probably just need bom test since other encodings must be specified var patternxml = /\.(svg|xml|xul|rdf|xhtml)$/; if ((contenttype && contenttype.match(/[text|application]\/(.*)\+?xml/)) || (href.indexof('file://') === 0 && href.match(patternxml))) { /* grab the response as text (see below for that routine) and then find encoding within*/ var encname = '([a-za-z][a-za-z0-9._-]*)'; var pattern = new regexp('^<\\?xml\\s+.*encoding\\s*=\\s*([\'"])'+encname+'\\1.*\\?>'); // check document if not? ...
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 multiple 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 javascript, arrays start at index zero and can be manipulated with various methods. what an array in javascript looks like: let myarray = [1, 2, 3, 4]; let catnamesarray = ["jacqueline", "sophia", "autumn"]; //arrays in javascript can hold different types of data, as shown above. learn more general knowledge array on wikipedia technical reference javascript array on mdn ...
A cool-looking box - Learn web development
prerequisites: before attempting this assessment, you should have already worked through all the articles in this module. objective: to test comprehension of the css box model and other box-related features such as borders and backgrounds. starting point to get this assessment started, you should: make local copies of the starting html and css — save them as index.html and style.css in a new directory. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors. if the online editor you are using doesn't have a separate css panel, feel free to put it in a <style> element in the head of the document. note: if you get stuck, then ask us for help — see the ...
Creating fancy letterheaded paper - Learn web development
such a look. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of css box model, and other box-related features such as implementing backgrounds. starting point to get this assessment started, you should: make local copies of the html and css — save them as index.html and style.css in a new directory. save local copies of the top, bottom and logo images in the same directory as your code files. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors. if the online editor you are using doesn't have a separate css panel, feel free to put it in a <style> ...
Floats - Learn web development
e 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 float example let's explore how to use floats. we'll start with a really simple example involving floating a block of text around an element. you can follow along by creating a new index.html file on your computer, filling 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> <d...
Test Your Skills: Fundamental layout comprehension - Learn web development
his page. project brief you have been provided with some raw html, basic css, and images — now you need to create a layout for the design, which should look just like the image below. basic setup you can download the html, css, and a set of six images here. save the html document and stylesheet into a directory on your computer, and add the images into a folder named images. opening the index.html file in a browser should give you a page with basic styling but no layout, which should look something like the image seen below. this starting point has all of the content of your layout as displayed by the browser in normal flow. if you don't want to work locally then using a tool such as codepen or jsfiddle will work as well. you will need to upload the images using their assets functi...
Legacy layout methods - Learn web development
of systems. it is worth bearing in mind, as we explore these systems, that none of them actually create a grid in the way that css grid layout creates a grid. they work by giving items a size, and pushing them around to line them up in a way that looks like a grid. a two column layout let's start with the simplest possible example — a two column layout. you can follow along by creating a new index.html file on your computer, filling 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> <...
How CSS is structured - Learn web development
ve. for example, perhaps your cms only allows you to edit the html body. you may also see a lot of inline styles in html email to achieve compatibility with as many email clients as possible. playing with the css in this article for the exercise that follows, create a folder on your computer. you can name the folder whatever you want. ...
How do you make sure your website works properly? - Learn web development
t see the image. http statuses servers respond with a status message whenever they receive a request. here are the most common statuses: 200: ok the resource you asked for was delivered. 301: moved permanently the resource has moved to a new location. you won't see this much in your browser, but it's good to know about "301" since search engines use this information a lot to update their indexes. 304: not modified the file has not changed since the last time you asked for it, so your browser can display the version from its cache, resulting in faster response times and more efficient use of bandwidth. 403: forbidden you aren't allowed to display the resource. usually it has to do with a configuration mistake (e.g. your hosting provider forgot to give you access rights to a director...
How can we design for all types of users? - Learn web development
ose-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). transcript 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 transcript 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 so...
What HTML features promote accessibility? - Learn web development
the following content describes specific features of html that can be used to make a web page more accessible to people with different disabilities. tabbing users who do not or cannot use pointing devices can tab through links and, as such, links should be in a logical tabbing order. the tabindex attribute allows you to define this order. if the html is linear, as it should be, a logical tabbing order should 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 li...
How do you host your website on Google App Engine? - Learn web development
prepare an app for our project. we'll need a sample application to publish. if you've not got one to use, download and unzip this sample app. have a look at the sample application's structure — the website folder contains your website content and app.yaml is your application configuration file. your website content must go inside the website folder, and its landing page must be called index.html, but apart from that it can take whatever form you like. the app.yaml file is a configuration file that tells app engine how to map urls to your static files. you don't need to edit it. publishing your application now that we've got our project made and sample app files collected together, let's publish our app. open google cloud shell. drag and drop the sample-app folder into...
How do you upload your files to a web server? - Learn web development
us between your computer and the sftp server, and a live log of every interaction between your sftp client and the server. uploading to the server our example host instructions told us "to publish on the web, put your files into the public/htdocs directory." you need to navigate to the specified directory in your right pane. this directory is effectively the root of your website — where your index.html file and other assets will go. once you've found the correct remote directory to put your files in, to upload your files to the server you need to drag-and-drop them from the left pane to the right pane. are they really online? so far, so good, but are the files really online? you can double-check by going back to your website (e.g. http://demozilla.examplehostingprovider.net/) in your br...
What are hyperlinks? - Learn web development
wo webpages together. anchors tie two sections of one document together. when you follow a link pointing to an anchor, your browser jumps to another part of the current document instead of loading a new document. however, you make and use anchors the same way as other links. links and search engines links matter both to users and search engines. every time search engines crawl a webpage, they index the website by following the links available on the webpage. search engines not only follow links to discover the various pages of the website, but they also use the link's visible text to determine which search queries are appropriate for reaching the target webpage. links influence how readily a search engine will link to your site. the trouble is, it's hard to measure search engines' activiti...
Example 2 - Learn web development
background : #f0f0f0; background : -webkit-linear-gradient(90deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "â–¼"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0 .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background:...
HTML basics - Learn web development
nner content. this is because an image element doesn't wrap content to affect it. its purpose is to embed an image in the html page in the place it appears. anatomy of an html document that wraps up the basics of individual html elements, but they aren't handy on their own. now we'll look at how individual elements are combined to form an entire html page. let's revisit the code we put into our index.html example (which we first met in the dealing with files article): <!doctype html> <html> <head> <meta charset="utf-8"> <title>my test page</title> </head> <body> <img src="images/firefox-icon.png" alt="my test image"> </body> </html> here, we have the following: <!doctype html> — the doctype. it is required preamble. in the mists of time, when html was young (around ...
Publishing your website - Learn web development
on this page, in the repository name box, enter username.github.io, where username is your username. for example, our friend bob smith would enter bobsmith.github.io. check the "initialize this repository with a readme" box. then click create repository. drag and drop the content of your website folder into your repository. then click commit changes. note: make sure your folder has an index.html file. navigate your browser to username.github.io to see your website online. for example, for the username chrisdavidmills, go to chrisdavidmills.github.io. note: it may take a few minutes for your website to go live. if your website does not display immediately, wait a few minutes. try again. to learn more, see github pages help. further reading what is a web serv...
Getting started with HTML - Learn web development
content that displays on the page, including text, images, videos, games, playable audio tracks, or whatever else. active learning: adding some features to an html document if you want to experiment with writing some html on your local computer, you can: copy the html page example listed above. create a new file in your text editor. paste the code into the new text file. save the file as index.html. note: you can also find this basic html template on the mdn learning area github repo. you can now open this file in a web browser to see what the rendered code looks like. edit the code and refresh the browser to see what the result is. initially the page looks like this: in this exercise, you can edit the code locally on your computer, as described previously, or you can edit it in ...
HTML text fundamentals - Learn web development
t structure, so the browser does not know what is a heading and what is a paragraph. furthermore: users looking at a web page tend to scan quickly to find relevant content, often just reading the headings to begin with. (we usually spend a very short time on a web page.) if they can't see anything useful within a few seconds, they'll likely get frustrated and go somewhere else. search engines indexing your page consider the contents of headings as important keywords for influencing the page's search rankings. without headings, your page will perform poorly in terms of seo (search engine optimization). severely visually impaired people often don't read web pages; they listen to them instead. this is done with software called a screen reader. this software provides ways to get fast access to...
Images in HTML - Learn web development
k primer on urls and paths to refresh your memory on relative and absolute urls before continuing. so for example, if your image is called dinosaur.jpg, and it sits in the same directory as your html page, you could embed the image like so: <img src="dinosaur.jpg"> if the image was in an images subdirectory, which was inside the same directory 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 descriptive 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 thi...
Video and audio content - Learn web development
miro video converter and audacity. we'd like you to have a go! if you are unable to source any video or audio, then you can feel free to use our sample audio and video files to carry out this exercise. you can also use our sample code for reference. we would like you to: save your audio and video files in a new directory on your computer. create a new html file in the same directory, called index.html. add <audio> and <video> elements to the page; make them display the default browser controls. give both of them <source> elements so that browsers will find the audio format they support best and load it. these should include type attributes. give the <video> element a poster that will be displayed before the video starts to be played. have fun creating your own poster graphic. for an ...
Introducing asynchronous JavaScript - Learn web development
cumstance. so you could have different actions to run on the response downloaded, such as processjson(), displaytext(), etc. note that not all callbacks are async — some run synchronously. an example is when we use array.prototype.foreach() to loop through the items in an array (see it live, and the source): const gods = ['apollo', 'artemis', 'ares', 'zeus']; gods.foreach(function (eachname, index){ console.log(index + '. ' + eachname); }); in this example we loop through an array of greek gods and print the index numbers and values to the console. the expected parameter of foreach() is a callback function, which itself takes two parameters, a reference to the array name and index values. however, it doesn't wait for anything — it runs immediately. promises promises are the new styl...
Graceful asynchronous programming with Promises - Learn web development
not really very async. the asynchronous nature is basically faked using settimeout(), although it does still show that promises are useful for creating a custom function with a sensible flow of operations, good error handling, etc. one example we'd like to invite you to study, which does show a useful async application of the promise() constructor, is jake archibald's idb library. this takes the indexeddb api, which is an old-style callback-based api for storing and retrieving data on the client-side, and allows you to use it with promises. in the code you'll see the same kind of techniques we discussed above being used there. the following block converts the basic request model used by many indexeddb methods to use promises (see this code, for example). conclusion promises are a good way to...
Looping code - Learn web development
the loop has run, 1 will be added to i (i++), then the process will start again. when i becomes equal to cats.length (in this case, 5), the loop will stop, and the browser will move on to the next bit of code below the loop. note: we have made the condition i < cats.length, not i <= cats.length, because computers count from 0, not 1 — we are starting i at 0, and going up to i = 4 (the index of the last array item). cats.length returns 5, as there are 5 items in the array, but we don't want to get up to i = 5, as that would return undefined for the last item (there is no array item with an index of 5). so, therefore, we want to go up to 1 less than cats.length (i <), not the same as cats.length (i <=). note: a common mistake with conditions is making them use "equal to" (===) rath...
Fetching data from the server - Learn web development
we don't need anything more than a simple console.log(). you can test the fail case yourself: make a local copy of the example files (download and unpack the can-store zip file). run the code through a web server (as described above, in serving your example from a server). modify the path to the file being fetched, to something like 'produc.json' (make sure it is misspelled). now load the index file in your browser (via localhost:8000) and look in your browser developer console. you'll see a message similar to "network request for produc.json failed with response 404: file not found". the second fetch block can be found inside the fetchblob() function: fetch(url).then(function(response) { return response.blob(); }).then(function(blob) { // convert the blob to an object url — ...
Test your skills: Arrays - Learn web development
o recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. arrays 3 for this final array task, we provide you with a starting array, and you will work in somewhat the opposite direction. you need to: remove the last item in the array. add two new names to the end of the array. go over each item in the array and add its index number after the name inside parentheses, for example ryu (0). note that we don't teach how to do this in the arrays article, so you'll have to do some research. finally, join the array items together in a single string called mystring, with a separator of " - ". try updating the live code below to recreate the finished example: download the starting point for this task to work in your own...
Test your skills: Strings - Learn web development
rectly? try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. strings 2 in this task you are provided with two variables, quote and substring, which contain two strings. we would like you to: retrieve the length of the quote, and store it in a variable called quotelength. find the index position where substring appears in quote, and store that value in a variable called index. use a combination of the variables you have and available string properties/methods to trim down the original quote to "i do not like green eggs and ham.", and store it in a variable called revisedquote. try updating the live code below to recreate the finished example: download the starting point ...
Storing the information you need — Variables - Learn web development
ed in square brackets and separated by commas. try entering the following lines into your console: let mynamearray = ['chris', 'bob', 'jim']; let mynumberarray = [10, 15, 40]; once these arrays are defined, you can access each value by their location within the array. try these lines: mynamearray[0]; // should return 'chris' mynumberarray[2]; // should return 40 the square brackets specify an index value corresponding to the position of the value you want returned. you might have noticed that arrays in javascript are zero-indexed: the first element is at index 0. you'll learn a lot more about arrays in a future article. objects in programming, an object is a structure of code that models a real-life object. you can have a simple object that represents a box and contains information about...
Adding features to our bouncing balls demo - Learn web development
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 javascript 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 javascript into one of these online editors. if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> e...
JavaScript object basics - Learn web development
] to name.first name.last otherwise your methods will no longer work. bracket notation there is another way to access object properties — using bracket notation. instead of using these: person.age person.name.first you can use person['age'] person['name']['first'] this looks very similar to how you access the items in an array, and it is basically the same thing — instead of using an index number to select an item, you are using the name associated with each member's value. it is no wonder that objects are sometimes called associative arrays — they map strings to values in the same way that arrays map numbers to values. setting object members so far we've only looked at retrieving (or getting) object members — you can also set (update) the value of object members by simply de...
Object building practice - Learn web development
s knowledge of these apis, and we hope that by the time you've finished this article you'll be interested in exploring them more. along the way we'll make use of some nifty objects, and show you a couple of nice techniques like bouncing balls off walls, and checking whether they have hit each other (otherwise known as collision detection). getting started to begin with, make local copies of our index.html, style.css, and main.js files. these contain the following, respectively: a very simple html document featuring an <h1> element, a <canvas> element to draw our balls on, and elements to apply our css and javascript to our html. some very simple styles, which mainly serve to style and position the <h1>, and get rid of any scrollbars or margin around the edge of the page (so that it looks ...
Object prototypes - Learn web development
r javascript — try looking for the methods and properties defined on the prototype of the string, date, number, and array global objects, for example. these all have a number of members defined on their prototype, which is why for example when you create a string, like this: let mystring = 'this is my string.'; mystring immediately has a number of useful methods available on it, like split(), indexof(), replace(), etc. note: it is worth reading our more in-depth guide to "using prototypes in javascript", once you've made sense of this section and wish to know more. this section is intentionally simplified to make these concepts a little easier to understand when you first meet them. important: the prototype property is one of the most confusingly-named parts of javascript — you might...
What is web performance? - Learn web development
ntioned above, you really should understand some specifics about how browsers work. this includes: how the browser works. when you request a url and hit enter / return, the browser finds out where the server is that holds that website's files, establishes a connection to it, and requests the files. see populating the page: how the browser works for a detailed overview. source order. your html index file's source order can significantly affect performance. the download of additional assets linked to from the index file is generally sequential, based on source order, but this can be manipulated and should definitely be optimized, realizing that some resources block additional downloads until their content is parsed and executed. the critical path. this is the process that the browser uses to...
Getting started with Ember - Learn web development
his would require url rewrites at build time and therefore be less efficient and more complicated to set up). in ember-cli-build.js, find the following code: let app = new emberapp(defaults, { // add options here }); add the following lines underneath it before saving the file: app.import('node_modules/todomvc-common/base.css'); app.import('node_modules/todomvc-app-css/index.css'); for more information on what ember-cli-build.js does, and for other ways in which you can customize your build / pipeline, the ember guides have a page on addons and dependencies. finally, find app.css, located at app/styles/app.css, and paste in the following: :focus, .view label:focus, .todo-list li .toggle:focus + label, .toggle-all:focus + label { /* !important needed bec...
Componentizing our Svelte app - Learn web development
fortable you feel dealing with this level of complexity in a single component. you should also consider whether splitting it further would enable reusing this component in a different context. to get the update functionality working, we have to handle the update event from the todos component. in its <script> section, add this handler: function updatetodo(todo) { const i = todos.findindex(t => t.id === todo.id) todos[i] = { ...todos[i], ...todo } } we find the todo by id in our todos array, and update its content using spread syntax. in this case we could have also just used todos[i] = todo, but this implementation is more bullet-proof, allowing the todo component to return only the updated parts of the todo. next we have to listen for the update event on our <todo> com...
Vue conditional rendering: editing existing todos - Learn web development
e haven’t actually handled updating the todoitems array back in app.vue. to fix that, we need to listen for the item-edited event, and update the list accordingly. we'll also want to handle the delete event so that we can delete todo items. add the following new methods to your app.vue's component object, below the existing methods inside the methods property: deletetodo(todoid) { const itemindex = this.todoitems.findindex(item => item.id === todoid); this.todoitems.splice(itemindex, 1); }, edittodo(todoid, newlabel) { const todotoedit = this.todoitems.find(item => item.id === todoid); todotoedit.label = newlabel; } next, we'll add the event listeners for the item-deleted and item-edited events: for item-deleted, you'll need to pass the item.id to the method. for item-edited, y...
Creating our first Vue component - Learn web development
we can set the state programmatically. however, we can currently only add one todolist component to the page because the id is hardcoded. this would result in errors with assistive technology since the id is needed to correctly map labels to their checkboxes. to fix this, we can programmatically set the id in the component data. we can use the lodash package's uniqueid() method to help keep the index unique. this package exports a function that takes in a string and appends a unique integer to the end of the prefix. this will be sufficient for keeping component ids unique. let’s add the package to our project with npm; stop your server and enter the following command into your terminal: npm install --save lodash.uniqueid note: if you prefer yarn, you could instead use yarn add lodash.un...
Styling Vue components with CSS - Learn web development
tom-checkbox { font-family: arial, sans-serif; -webkit-font-smoothing: antialiased; font-weight: 400; font-size: 1.6rem; line-height: 1.25; display: block; position: relative; min-height: 40px; margin-bottom: 10px; padding-left: 40px; clear: left; } .custom-checkbox > input[type="checkbox"] { -webkit-font-smoothing: antialiased; cursor: pointer; position: absolute; z-index: 1; top: -2px; left: -2px; width: 44px; height: 44px; margin: 0; opacity: 0; } .custom-checkbox > .checkbox-label { font-size: inherit; font-family: inherit; line-height: inherit; display: inline-block; margin-bottom: 0; padding: 8px 15px 5px; cursor: pointer; touch-action: manipulation; } .custom-checkbox > label::before { content: ""; box-sizing: border-box; po...
Handling common accessibility problems - Learn web development
hen you press certain keys on the keyboard. see desktop mouse and keyboard controls for some game-related examples that can be adapted for any purpose. use some interesting tactics to fake button behaviour. take for example our fake-div-buttons.html example (see source code). here we've given our fake <div> buttons the ability to be focused (including via tab) by giving each one the attribute tabindex="0" (see webaim's tabindex article for more really useful details). this allows us to tab to the buttons, but not to activate them via the enter/return key. to do that, we had to add the following bit of javascript trickery: document.onkeydown = function(e) { if(e.keycode === 13) { // the enter/return key document.activeelement.onclick(e); } }; here we add a listener to the document o...
Setting up your own test automation environment - Learn web development
e(); visit your lambdatest automation dashboard, to fetch your lambdatest's username and access key by clicking on the key icon on the top-right(see username and access keys). replace the {username} and {accesskey} placeholders in the code with your actual user name and access key values (and make sure you keep them secure). run the below command in your terminal to execute your test: node index.js the test will be sent to lambdatest, and the output of your test will be reflected on your lambdatest console. if you wish to extract these results for reporting purpose from lambdatest platform then you can do so by using lambdatest restful api. now if you go to your lambdatest automation dashboard, you'll see your test listed; from here you'll be able to see videos, screenshots, and oth...
Software accessibility: Where are we today?
le following the mouse or the current focus. screen magnifiers also have some built-in text-to-speech and the ability to filter text and images through various color palettes, such as black on yellow for high contrast, or green on blue for low contrast. the optacon provides access to printed words, graphics and on-screen information by means of an array vibrating pins the size of an index finger. the user uses one hand to read the vibrating pins, and the other hand moves a mini-camera over the material to be read. unfortunately, the unit is not currently produced, although there is occasional talk of resurrecting this useful device. braille a solution used for quiet reading, for detailed work, and by deaf-blind users. this can come in the form of hard copy braille pr...
Mozilla’s UAAG evaluation report
e): available through dom, can be styled using css? html: colgroup element (table): available through dom, can be styled using css? html: col element (table): available through dom, can be styled using css? html: scope attribute (table): available through dom html: headers attribute (table): available through dom html: axis attribute (table): available through dom html: tabindex attribute: yes, can be used to order sequential navigation html: accesskey attribute: supported with alt-{key}, menu key conflict favor the accesskey? html: alt for img: yes html: longdesc for img: yes, available in context menu properties html: alt for area: ? html: alt for input: ? css: text-indent: yes css: text-align: yes css: word-spacing: yes css: letter-...
Developer guide
e latest version of the code from main but are relevant when building old codebases. firefox source docs web-hosted documentation built from the mozilla-central source code. tools bugzilla the bugzilla database used to track issues for mozilla projects. dxr next generation of searching mozilla's source code. in active development. searchfox another option for mozilla code searching. indexes js as well as c++, includes blame capabilities. in active development. mozilla build vm a virtualbox compatible virtual machine configured with all the software needed to build and work on firefox. taskcluster taskcluster is the task execution framework that supports mozilla's continuous integration and release processes. treeherder treeherder shows the status of the tree (whether or not ...
Error codes returned by Mozilla APIs
with a badly encoded property file. try using utf-8 encoding instead. see nsistringbundle. ns_base_stream_would_block (0x80470007) this error occurs when an attempt is made to read from a non blocking stream yet there is not enough data available to read without waiting for more. document and node errors the following errors can occur when using documents, nodes and elements. ns_error_dom_index_size_err (0x80530001) an attempt was made to adjust the value of a text node using an index that was out of range. ns_error_dom_domstring_size_err (0x80530002) an attempt was made to create a string larger than is supported. ns_error_dom_hierarchy_request_err (0x80530003) a node was inserted into a location where it cannot go. for instance, a node cannot be inserted into a descendant of itse...
Communicating with frame scripts
oadframescript("chrome://my-addon@me.org/content/frame-script.js", false); messagemanagers.push(browsermm); console.log(messagemanagers.length); we can listen for message-manager-disconnect to update the array when the message managers disconnect (for example because the user closed the tab): function myobserver() { } myobserver.prototype = { observe: function(subject, topic, data) { var index = messagemanagers.indexof(subject); if (index != -1) { console.log("one of our message managers disconnected"); mms.splice(index, 1); } }, register: function() { var observerservice = cc["@mozilla.org/observer-service;1"] .getservice(ci.nsiobserverservice); observerservice.addobserver(this, "message-manager-disconnect", false); console...
Multiprocess Firefox
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. ...
Storage access policy: Block cookies from trackers
mpty 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 firefox 70: window.localstorage is null. thus, attempts to read and write using this object will throw a typeerror exception. sessionstorage: read and write attempts are permitted. indexeddb: attempting to access the indexeddb factory object throws a securityerror exception. messaging and workers: broadcast channel: attempts to create a new broadcastchannel will throw a securityerror exception. shared worker: attempts to create a new sharedworker will throw a securityerror exception. service worker: attempts to create a new serviceworker will throw a securityerror exceptio...
CustomizableUI.jsm
est way to obtain information about what the state of your widget is. the internals of this call are cheap (no dom necessary) and you will know where the user has put your widget. parameters awidgetid the id of the widget whose placement you want to know return value a js object of the form: { area: "somearea", // the id of the area where the widget is placed position: 42 // the index in the placements array corresponding to your widget } or null if the widget is not placed anywhere (that is, it is in the palette). iswidgetremovable() check if a widget can be removed from the area it's in. note that if you're wanting to move the widget somewhere, you should generally be checking canwidgetmovetoarea, because that will return true if the widget is already in the area where ...
Sqlite.jsm
has been set, this will return the string "0". setschemaversion(value) sets value as the new version associated with the schema for the current database. this is a wrapper around the pragma user_version statement. tableexists(name) this function determines whether a table exists in the current database. it returns a promise that is resolved with a boolean indicating whether the table exists. indexexists(name) this functions determines whether a named index exists in the current database. it returns a promise that is resolved with a boolean indicating whether the index exists. statement execution these apis facilitate execution of statements on the connection. these are arguably the most important apis in this type. executecached(sql, params, onrow) execute(sql, params, onrow) these s...
Localizing extension descriptions
d from install.rdf and path_to_localization_file is the chrome path to the localization file you added to earlier): pref("extensions.extension_id.description", "path_to_localization_file"); localizable strings the following add-on metadata can be localized using this process: name description creator homepageurl localizable lists in cases where multiple values can exist, a numeric index is appended to the end of the preference name: extensions.extension_id.contributor.1=first_localized_contributor_name extensions.extension_id.contributor.2=second_localized_contributor_name extensions.extension_id.contributor.3=thrid_localized_contributor_name pref("extensions.extension_id.contributor.1", "path_to_localization_file"); pref("extensions.extension_id.contributor.2", "path_to_local...
BloatView
| 20 60| 89987 3| 302 |pcompositorchild | 412 412| 1 1| 308 |pimagebridgechild | 416 416| 1 1| the first line tells you the pid of the leaking process, along with the type of process. here's how you interpret the columns. the first, numerical column is the index of the leaking class. class - the name of the class in question (truncated to 20 characters). bytes per-inst - the number of bytes returned if you were to write sizeof(class). note that this number does not reflect any memory held onto by the class, such as internal buffers, etc. (e.g. for nsstring you'll see the size of the header struct, not the size of the string contents!) bytes leaked - t...
Research and prep
collaboration with the site provider and mozilla, ask for permission from the site provider to include it. ensure that your suggestions follow these parameters: search there are typically five search plug-ins listed for firefox desktop (only four for firefox mobile): generic search the default option should expose the quickest path to the best result on the world wide web for the user (indexing a large portion of the global www). global search the second position can be used for the next best local language provider, meaning coverage within the local language and/or locale (indexing a smaller portion of the www but producing better local language results). local search a good test is if you were to run a set of comparative queries; the secondary engine should produce ...
Firefox Sync
n each device; no sync data is ever transmitted to a server without being encrypted. mozilla does not hold any keys to your sync data. your data can only be decrypted by someone who is able to log in to your firefox account (ie, that knows your firefox accounts password and has access to your email for the verification required during the initial login). documentation this document serves as an index for all technical documentation related to sync. it is not designed for use by end-users, but instead for people who wish to understand the details of how sync is implemented or wish to interact with it. general the always prolific richard newman has written a couple of notes about bookmark syncing (first, second) and has a blog where he talks about the various challenges syncing this kind of d...
L20n Javascript API
ctx.removeeventlistener(event: string, callback: function) remove an event listener previously registered with addeventlistener. ctx.updatedata(ctxdata: object) update the context data which will be available to all entities in the context. the ctxdata is an object which extends the context data per key and per level of hierarchy. in other words, the following two c...
AsyncTestUtils extended framework
get at the nsimsgdbhdr instances directly. keep in mind that the class is not magic and will lose track of the message headers if you manipulate them without referencing the message set. accessing synthetic messages and headers synmessages [attribute] the js list of syntheticmessages held in the set. while you should not modify this list, you can get its length and read from it. getmsghdr(aindex) [function] retrieve the nsimsgdbhdr at the given index. getmsguri(aindex) [function] retrieve the uri of the message header at the given index. msghdrlist [getter] return a js list with all the nsimsgdbhdrs for the messages that have been injected into folders. xpcomhdrarray [getter] return an nsimutablearray of the message headers that have been injected into folders. folderswithmsghdrs...
NSPR Error Handling
oad a dynamic library. pr_unload_library_error failure to unload a dynamic library. pr_find_symbol_error symbol could not be found in the specified library. pr_insufficient_resources_error there are insufficient system resources to process the request. pr_directory_lookup_error a directory lookup on a network address has failed. pr_tpd_range_error attempt to access a thread-private data index that is out of range of any index that has been allocated to the process. pr_proc_desc_table_full_error the process' table for holding open file descriptors is full. pr_sys_desc_table_full_error the system's table for holding open file descriptors has been exceeded. pr_not_socket_error an attempt to use a non-network file descriptor on a network-only operation. pr_not_tcp_socket_error att...
PLHashEnumerator
syntax #include <plhash.h> typedef printn (pr_callback *plhashenumerator)(plhashentry *he, printn index, void *arg); /* return value */ #define ht_enumerate_next 0 /* continue enumerating entries */ #define ht_enumerate_stop 1 /* stop enumerating entries */ #define ht_enumerate_remove 2 /* remove and free the current entry */ #define ht_enumerate_unhash 4 /* just unhash the current entry */ description plhashenumerator is a function type used in the enumerating a hash table. when all the table entries are enumerated, each entry is passed to a user-specified function of type plhashenumerator with the hash table entry, an integer index, and an arbitrary piece of user data as argument. remark the meaning of ht_enumerate_unhash is not clear. in the current implementatio...
PLHashNumber
syntax #include <plhash.h> typedef pruint32 plhashnumber; #define pl_hash_bits 32 description plhashnumber is an unsigned 32-bit integer. plhashnumber is the data type of the return value of a hash function. a hash function maps a key to a hash number, which is then used to compute the index of the bucket. the macro pl_hash_bits is the size (in bits) of the plhashnumber data type and has the value of 32. see also plhashfunction ...
PL_HashTableEnumerateEntries
...
PRThreadPrivateDTOR
the destructor function passed to pr_newthreadprivateindex that is associated with the resulting thread private index. syntax #include <prthread.h> typedef void (pr_callback *prthreadprivatedtor)(void *priv); description until the data associated with an index is actually set with a call to pr_setthreadprivate, the value of the data is null. if the data associated with the index is not null, nspr passes a reference to the data to the destructor function when the thread terminates. ...
PR EnumerateAddrInfo
to begin an enumeration, this argument is set to null. ...
Threads
ties, see setting thread priorities. you set a thread's nspr priority when you create it with pr_createthread. after a thread has been created, you can get and set its priority with these functions: pr_getthreadpriority pr_setthreadpriority controlling per-thread private data you can use these functions to associate private data with each of the threads in a process: pr_newthreadprivateindex allocates a unique index. if the call is successful, every thread in the same process is capable of associating private data with the new index. pr_setthreadprivate associates private thread data with an index. pr_getthreadprivate retrieves data associated with an index. interrupting and yielding pr_interrupt requests an interrupt of another thread. once the target thread has been notified...
Cryptography functions
3.2 and later pk11_getbestslot mxr 3.2 and later pk11_getbestslotmultiple mxr 3.2 and later pk11_getbestwrapmechanism mxr 3.2 and later pk11_getblocksize mxr 3.2 and later pk11_getcertfromprivatekey mxr 3.9.3 and later pk11_getcurrentwrapindex mxr 3.2 and later pk11_getdefaultarray mxr 3.8 and later pk11_getdefaultflags mxr 3.8 and later pk11_getdisabledreason mxr 3.8 and later pk11_getfirstsafe mxr 3.2 and later pk11_getinternalkeyslot mxr 3.2 and later pk11_getinternal...
NSS_3.12_release_notes.html
fychain ignores -b time option when -p option is present bug 403563: implement the tls session ticket extension (ste) bug 400917: want exported function that outputs all host names for dns name matching bug 315643: test_buildchain_resourcelimits won't build bug 353745: klocwork null ptr dereference in pkcs12 decoder bug 338367: the gf2m_populate and gfp_populate should check the eccurve_map array index bounds before use bug 201139: ssltap should display plain text for null cipher suites bug 233806: support nist crl policy bug 279085: nss tools display public exponent as negative number bug 363480: ocspclnt needs option to take cert from specified file bug 265715: remove unused hsearch.c dbm code bug 337361: leaks in jar_parse_any (security/nss/lib/jar/jarver.c) bug 338453: leaks in security/nss...
NSS functions
3.2 and later pk11_getbestslot mxr 3.2 and later pk11_getbestslotmultiple mxr 3.2 and later pk11_getbestwrapmechanism mxr 3.2 and later pk11_getblocksize mxr 3.2 and later pk11_getcertfromprivatekey mxr 3.9.3 and later pk11_getcurrentwrapindex mxr 3.2 and later pk11_getdefaultarray mxr 3.8 and later pk11_getdefaultflags mxr 3.8 and later pk11_getdisabledreason mxr 3.8 and later pk11_getfirstsafe mxr 3.2 and later pk11_getinternalkeyslot mxr 3.2 and later pk11_getinternal...
NSS Tools certutil-tasks
nss security tools: certutil tasks newsgroup: mozilla.dev.tech.crypto task list better error reporting. most certutil errors provide no detail. mistakes with command-line options just print a usage message. improve certificate listings. allow for sorting by name and trust. sorting by trust will return ca certs first. allow listing and lookup of keys by index and nickname. improve coherence of key and certificate nicknames. remove keys "stranded" without a certificate (except for the imminent (????) encryption key for password files). support importing keys from a file. improve hardware token support. (bugfix) some certificate extensions cause certutil to crash. (bugfix) certificate entries require a serial number; one sh...
Installing Pork
jects can be preprocessed with gcc -e -wp,-w0,-k. building a 32-bit mcpp on a 64-bit system this is dark magic, and i hope i've got it right. first i built gcc in a separate --prefix=/builds/gcc-3.4.6-installed. note: once you do this, you can only use this version of gcc in -m32 mode. apply this patch: note: this doesn't seem necessary in the latest version; cppflags is already an argument. ...
Rhino and BSF
...
Running the Rhino tests
...
Rhino overview
a piece of code for certificate-based security policies. when javascript code attempts a restricted action, the security domain can be retrieved in the following manner. the class context should be obtained from the security manager (see java.lang.securitymanager.getclasscontext()). then, the class of the code that called to request the restricted action can be obtained by looking an appropriate index into the class context array. if the caller is javascript the class obtained may be one of two types. first, it may be the class of the interpreter if interpretive mode is in effect. second, it may be a generated class if classfile generation is supported. an embedding can distinguish the two cases by calling isinterpreterclass() in the context class. if it is the interpreter class, call the geti...
Getting SpiderMonkey source code
n 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 zip or gz links at https://hg.mozilla.org/index.cgi/mozilla-central/file/tip. 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 source code from git the following command line...
Bytecodes
background spidermonkey bytecodes are the canonical form of code representation that is used in the javascript engine. the javascript frontend constructs an ast from the source text, then emits stack-based bytecodes from that ast as a part of the jsscript data structure. bytecodes can reference atoms and objects (typically by array index) which are also contained in the jsscript data structure. within the engine, all bytecode execute within a stack frame -- even global (top-level) and eval code has a stack frame associated with it. a frame on the stack has space for javascript values (the tagged value format) in a few different categories. the space for a single javascript value is called a "slot", so the categories are: argument slots: holds the actual arguments passed to the curr...
Statistics API
into slices is completely separate from the division into phases; neither one is a refinment of the other). a little bit of gc work is done in each slice. in between slices, other browser code is allowed to run. the slices array describes how long each slice took and what work was done during the slice. each element of the slices array is an object with these fields: slice: integer - the slice index, starting at 0. pause: number (milliseconds) - the slice duration. when: number (milliseconds) - the time this slice started, relative to the first slice's start time. reason: string - a string describing the api that initiated this gc slice. page_faults: integer - number of page faults incurred during the processing of this slice. start_timestamp: integer (microseconds) - time of slice star...
SpiderMonkey Internals
cts consist of a possibly shared structural description, called the map or scope; and unshared property values in a vector, called the slots. each property has an id, either a nonnegative integer or an atom (unique string), with the same tagged-pointer encoding as a jsval. the atom manager consists of a hash table associating strings uniquely with scanner/parser information such as keyword type, index in script or function literal pool, etc. atoms play three roles: as literals referred to by unaligned 16-bit immediate bytecode operands, as unique string descriptors for efficient property name hashing, and as members of the root gc set for exact gc. standard library the methods for arrays, booleans, dates, functions, numbers, and strings are implemented using the js api. most are jsfastnative...
JS::AutoIdArray
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 ownership. methods method description bool operator!() const return true if this has no owned array. jsid operator[](size_t i) const return a jsid in specified index of the owned array. size_t length() const return the length of the owned array. jsidarray *steal() return the owned array and release the ownership. description js::autoidarray takes the ownership of jsidarray, and frees it in destructor by calling js_destroyidarray. examples { js::autoidarray ids(cx, js_enumerate(cx, obj)); if (!ids) // check the returned va...
JS::CallArgs
cx, const char *fnname, unsigned required) returns true if there are at least required arguments passed in. if false, it reports an error message on the context. methods inherited from js::callargsbase method description unsigned length() const returns the number of arguments.. js::mutablehandlevalue operator[](unsigned i) const returns the i-th zero-indexed argument. js::handlevalue get(unsigned i) const returns the i-th zero-indexed argument, or undefined if there's no such argument. bool hasdefined(unsigned i) const returns true if the i-th zero-indexed argument is present and is not undefined. methods inherited from js::detail::callreceiverbase method description jsobject &callee() const r...
JSCheckAccessOp
cesscallback.) syntax typedef jsbool (* jscheckaccessop)(jscontext *cx, jsobject *obj, jsval id, jsaccessmode mode, jsval *vp); name type description cx jscontext * the js context in which the property access attempt is occurring. obj jsobject * the object whose properties are being accessed. id jsval the name or index of the property being accessed. mode jsaccessmode the type of access being checked. vp jsval * out parameter. on success, the callback must set *vp to the stored value of the property. description check whether obj[id] may be accessed per mode, returning js_false on error/exception, js_true on success with obj[id]'s stored value in *vp. as for jspropertyop, i...
JSConstDoubleSpec
he double. flags uint8_t property attributes for the double. obsolete since jsapi 35 currently these can be 0 or more of the following values or'd: jsprop_enumerate: property is visible in for loops. jsprop_readonly: property is read-only. jsprop_permanent: property cannot be deleted. jsprop_exported: property can be exported outside its object. jsprop_index: property is actually an array element. if this field is 0, js_defineconstdoubles uses the default attributes jsprop_readonly | jsprop_permanent instead. spare uint8_t [3] reserved for future use. obsolete since jsapi 35 description jsconstdoublespecs is used to define a set of double values that are assigned as properties to an object using js_defineconstdoubles...
JSDeletePropertyOp
cx jscontext * the context in which the property access is taking place. provides request. in js_threadsafe builds, the javascript engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). obj js::handleobject the object whose properties are being deleted. id js::handleid the name or index of the property being deleted. this is either a string (unicode property identifier) or an integer (element index). succeeded bool * out parameter. receives the result of deletion. description jsdeletepropertyop callback is a hook that applications may install to be called at some point during property access. a jsdeletepropertyop may be installed on a jsclass to hook prope...
JSErrorReport
or-reporting mechanism. syntax jserrorreport(); properties name type description filename const char * indicates the source file or url that produced the error condition. if null, the error is local to the script in the current html page. lineno unsigned line number in the source that caused the error. column unsigned zero-based column index in line in the source that caused the error. ismuted bool the web platform allows scripts 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 conte...
JSFunctionSpec
with an object. an application typically has an array of jsfunctionspec to define all the functions for an object and calls js_definefunctions or js_initclass to create the functions and assign them to an object. jsfunctionspec can also be used to define an array element rather than a named property. array elements are actually individual properties. to define an array element, cast the element's index value to const char*, initialize the name field with it, and specify the jsprop_index attribute in flags. to define an array of jspropertyspec, use js_fs, js_fn, js_sym_fn, js_fninfo, js_self_hosted_fn, js_self_hosted_sym_fn, js_sym_fnspec, js_fnspec, and js_fs_end. see also mxr id search for jsfunctionspec jspropertyspec jsnative js_fs js_fn js_sym_fn js_fninfo js_self_hosted_fn js_sel...
JSNewResolveOp
ol (* jsnewresolveop)(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandleobject objp); name type description cx jscontext * pointer to the js context in which the property access is taking place. obj js::handleobject pointer to the object whose properties are being accessed. id js::handleid name or index of the property being accessed. flags uint32_t obsolete since jsapi 31 flags giving contextual information about the ongoing property access. objp js::mutablehandleobject out parameter. on success, the resolve hook must set *objp to the object in which the property has been defined, or null if it was not defined. description like jsresolveop, but flags provide ...
JSObjectOps.defineProperty
tax jsbool (*jsdefinepropop)(jscontext *cx, jsobject *obj, jsid id, jsval value, jspropertyop getter, jspropertyop setter, unsigned int attrs); name type description cx jscontext * pointer to the js context in which the property is being defined. obj jsobject * the object on which the property is being defined. id jsid the name or index of the property to define. value jsval the initial value for the new property. getter jspropertyop the getter for the new property. setter jspropertyop the setter for the new property. attrs unsigned int the property attributes for the new property. description define obj[id], an own property of obj named id, having the given ini...
JSObjectOps.getAttributes
a property. syntax typedef jsbool (*jsattributesop)(jscontext *cx, jsobject *obj, jsid id, jsproperty *prop, unsigned int *attrsp); name type description cx jscontext * pointer to the js context in which the property access is happening. obj jsobject * the object whose property attributes are being accessed. id jsid the name or index of the property whose attributes are being accessed. prop jsproperty * the property whose attributes are being accessed. this may be null. attrsp unsigned int * in/out parameter. see the description section below. description get or set attributes of the property obj[id]. returns js_false on error or exception, else js_true with current attributes in *attrsp.
JSObjectOps.getProperty
lled during property accesses and don't have to implement any of that. syntax typedef jsbool (*jspropertyidop)( jscontext *cx, jsobject *obj, jsid id, jsval *vp); name type description cx jscontext * pointer to the js context in which the property access is happening. obj jsobject * the object to be accessed. id jsid the name or index of the property to access. vp jsval * in/out parameter. see the description section below. description get, set, or delete obj[id], returning js_false on error or exception, js_true on success. if getting or setting, the new value is returned in *vp on success. if deleting without error, *vp will be jsval_false if obj[id] is permanent, and jsval_true if id named a direct p...
JSObjectOps.lookupProperty
ot call lookupproperty). syntax typedef jsbool (*jslookuppropop)(jscontext *cx, jsobject *obj, jsid id, jsobject **objp, jsproperty **propp); name type description cx jscontext * pointer to the js context in which the property lookup is happening. obj jsobject * the object whose properties are being searched. id jsid the name or index of the property to look up. objp jsobject ** out parameter. if the property is found, the callback stores the object on which the property was found in *objp. propp jsproperty ** out parameter. on success, the callback stores in *propp a pointer to the property, if it exists, or null if it doesn't. description look for id in obj and its prototype chain, retur...
JSObjectOps.setProto
setobjectslotop. syntax typedef jsbool (*jssetobjectslotop)(jscontext *cx, jsobject *obj, uint32 slot, jsobject *pobj); name type description cx jscontext * pointer to the js context in which the object's prototype or parent is being modified. obj jsobject * the object whose prototype or parent is being modified. slot uint32 the index of the slot being modified: jsslot_proto for the jsobjectops.setproto callback, and jsslot_parent for the jsobjectops.setparent callback. pobj jsobject * the new prototype or parent object. description these hooks must check for cycles without deadlocking, and otherwise take special steps. see js_setprototype or js_setparent in js/src/jsobj.cpp for an example. ...
JSPropertyOp
jscontext * the context in which the property access is taking place. provides request. in js_threadsafe builds, the javascript engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). obj js::handleobject the object whose properties are being accessed. id js::handleid the name or index of the property being accessed. this is either a string (unicode property identifier) or an integer (element index). strict bool (jsstrictpropertyop only) if strict is true, treating the assignment as strict mode code. vp js::mutablehandlevalue in/out parameter. points to a js::value variable. the meaning of this variable is different for each of the hooks; see below...
JSResolveOp
f bool (* jsresolveop)(jscontext *cx, js::handleobject obj, js::handleid id); // obsolete since jsapi 36 name type description cx jscontext * pointer to the js context in which the property access is taking place. obj js::handleobject pointer to the object whose properties are being accessed. id js::handleid the name or index of the property being resolved. resolvedp bool * out parameter. receives the result of resolve operation. description jsresolveop callback is a hook which is called when a property is not found on an object. it resolves a lazy property named by id in obj by defining it directly in obj. lazy properties are those reflected from some peer native property space (e.g., the dom ...
JS_AddExternalStringFinalizer
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. description add a finalizer for external strings created by js_newexternalstring using a type-code returned from this function, and that understands how to free or release the memory pointed at by js_getstringchars(str). returns a nonnegative type index if there is room for finalizer in the global gc finalizers table, else returns -1. in a js_threadsafe build, this function must be invoked on the primordial thread only, at startup—or else the entire program must single-thread itself while loading a module that calls this function. to remove an external string finalizer, use js_removeexternalstringfinalizer. see also js_removeexternalstrin...
JS_CheckAccess
*obj, jsid id, jsaccessmode mode, jsval *vp, unsigned int *attrsp); name type description cx jscontext * the context in which to perform the access check. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object that has the property 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. description js_checkaccess determines whether the property of obj given by i...
JS_FS
bol, 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 description name const char * the javascript name for the function. (or index, if jsprop_index is present in flags) symbol a member name of js::symbolcode the javascript 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 number of arguments the function expects. flags uint16 the bitwise or of ...
JS_ForwardGetPropertyTo
this article covers features introduced in spidermonkey 17 find a specified property 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 description cx jscontext * a context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to search on for the property. id or index js::handleid or uint32_t name or index of the property to look up. ...
JS_HasElement
determine whether a javascript array has an element in the specified index. syntax bool js_haselement(jscontext *cx, js::handleobject obj, uint32_t index, bool *foundp); name type description cx jscontext * the context in which to perform the property lookup. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject the object to search for the element. index uint32_t index of the element to look up. foundp bool * out parameter. on success, it stores true to *foundp, false otherwise. description js_haselement examines a specified js object, obj, and its prototype chain, for an element or numeric property numbered index. if the element exists, js_ha...
JS_IdArrayGet
this article covers features introduced in spidermonkey 17 get the item of a jsidarray. syntax jsid js_idarrayget(jscontext *cx, jsidarray *ida, unsigned index) name type description cx jscontext * a context. ida jsidarray * the jsidarray to get the length. index unsigned the index of the id in the jsidarray. description js_idarrayget gets the item in the specified index of the id array pointed to by ida. see also mxr id search for js_idarrayget jsidarray js_idarraylength bug 641027 ...
JS_LookupProperty
bool js_lookupucproperty(jscontext *cx, js::handleobject obj, const char16_t *name, size_t namelen, js::mutablehandlevalue vp); bool js_lookuppropertybyid(jscontext *cx, js::handleobject obj, js::handleid id, js::mutablehandlevalue vp); // added in spidermonkey 1.8.1 bool js_lookupelement(jscontext *cx, js::handleobject obj, uint32_t index, js::mutablehandlevalue vp); // ---- obsolete since spidermonkey 31 ---- bool js_lookuppropertywithflags(jscontext *cx, js::handleobject obj, const char *name, unsigned flags, js::mutablehandlevalue vp); bool js_lookuppropertywithflagsbyid(jscontext *cx, js::handleobject obj, js::handleid id, unsigned flags, js::mutable...
JS_NewArrayObject
array(length). the new array has the specified length, but it doesn't have any elements. on success, js_newarrayobject returns the new array object. otherwise it reports an error as though by calling js_reportoutofmemory and returns null. obsolete since jsapi 30. js_newarrayobject with length parameter creates a new array object with the specified length. if vector is non-null, then for each index i from 0 to length - 1, js_newarrayobject defines an enumerable array element with the value vector[i] on the new array. (this means that if length is nonzero and vector is null, the result is like the javascript expression new array(length). the new array has the specified length, but it doesn't have any elements.) it is often better to call js_newarrayobject(cx, 0, null), store the returned ob...
JS_NewDependentString
g str, size_t start, size_t length); name type description cx jscontext * the context in which to create the new string. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. str js::handlestring the string containing the characters for the new string. start size_t the start index of the substring. length size_t length of the substring, in characters. description js_newdependentstring creates a new string as a substring of an existing javascript string, str. the new string contains the same characters as if it were created with the javascript method str.substr(start, length). the characters are not copied. instead, the new string shares str's existing ...
JS_NewRegExpObject
racters. flags unsigned regular expression flags. see below. flags name description regexp constructor flag jsreg_fold fold uppercase to lowercase. i jsreg_glob global execution, creates array of matches. g jsreg_multiline treat ^ and $ as begin and end of line. m jsreg_sticky only match starting at lastindex. y description js_newregexpobject and js_newucregexpobject create a new regexp instance. the flags from the built-in regexp constructor properties ignorecase, global, multiline, and sticky are or'd in with the provided flags parameter. js_newregexpobjectnostatics and js_newucregexpobjectnostatics create a new regexp instance. they do not or in any regexp constructor properties. see...
JS_NextProperty
description cx jscontext * the js context in which to enumerate properties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. iterobj js::handleobject the opaque iterator object returned by a previous call to js_newpropertyiterator. idp js::mutablehandleid out parameter. on success, *idp receives the name or index of the next property name; or jsid_void if there are no more enumerable properties to visit. description on success, js_nextproperty returns true, with *idp containing the id of the next enumerable own property to visit using iterobj, or jsid_void if there is no such property left to visit. on error, it returns false, and the value left in *idp is undefined. see also bug 1081660 ...
JS_PSGS
s_psg(name, getter, flags) ... #define js_psgs(name, getter, setter, flags) ... #define js_self_hosted_get(name, gettername, flags) ... // added in spidermonkey 31 #define js_self_hosted_getset(name, gettername, settername, flags) ... // added in spidermonkey 31 #define js_ps_end ... name type description name const char * the javascript name for the property. (or index, if jsprop_index is present in flags) getter jsnative pointer to the c/c++ implementation of the getter function. setter jsnative pointer to the c/c++ implementation of the setter function. flags uint16 the bitwise or of any number of property attributes. gettername const char * the function's name in self-hosted javascript code for gett...
JS_ParseJSON
js_parsejsonwithreviver(jscontext *cx, const jschar *chars, uint32 len, jsval reviver, jsval *vp); name type description cx jscontext * pointer to a js context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ch jsobject * the object to be searched. chars const jschar * the characters of the string. len uint32 the length of the string. index jsint (in js_parsejsonwithreviver only) a reviver function to apply to the created value after parsing; see json.parse. vp jsval * out parameter. *vp receives the value after parsing (and optionally, processing by the reviver). if an error occurs, the value left in *vp is undefined. description use these functions to parse a sequence of characters as json. the parsing rules applied by these...
JS_SetArrayLength
r of elements, or to change the number of elements allocated for an array. if you set a shorter array length on an existing array, the elements that no longer fit in the array are destroyed. setting the number of array elements does not initialize those elements. to initialize an element call js_defineelement. if you call js_setarraylength on an existing array, and length is less than the highest index number for previously defined elements, all elements greater than or equal to length are automatically deleted. on success, js_setarraylength returns true. otherwise it returns false. see also mxr id search for js_setarraylength js_defineelement js_deleteelement js_getarraylength js_getelement js_isarrayobject js_lookupelement js_newarrayobject js_setelement ...
JS_SetPropertyAttributes
integer containing the attribute value to set. it is the bitwise or of zero or more of the following values: flag purpose jsprop_enumerate property is visible in for and in loops. jsprop_readonly property is read only. jsprop_permanent property cannot be deleted. jsprop_exported property can be imported by other objects. jsprop_index property is actually an index into an array of properties, and is cast to a const char *. if js_setpropertyattributes cannot locate an object with the specified property, it returns js_false, and the value left in *foundp is undefined. if the specified property or the specified object does not exist, foundp is set to js_false. then, if the property exists, but is associated with a diff...
Shell global objects
ehaviour ensures that a falsy value means that we are not in ion, but expect a compilation to occur in the future. conversely, a truthy value means that we are either in ion or that there is litle or no chance of ion ever compiling the current script. assertjitstackinvariants() iterates the jit stack and check that stack invariants hold. setcompileroption(option, number) set a compiler option indexed in jscompileoption enum to a number. setioncheckgraphcoherency(bool) set whether ion should perform graph consistency (debug-only) assertions. these assertions are valuable and should be generally enabled, however they can be very expensive for large (wasm) programs. serialize(data, [transferables, [policy]]) serialize data using js_writestructuredclone. returns a structured clone buffer ob...
TPS Tests
helpful. (note that the python testrunner will generally still kill firefox after a tps test runs for 5 or so minutes, so it's often helpful to kill the python testrunner outright, and then use aboutsync in a different instance of the browser). a tps failure may not point directly to the problem. for example, most errors involving bookmarks look like "places item not found in expected index", which could mean a number of issues. the other engines are similarly unhelpful, and will likely fail if there's any problem, without really indicating what the problem is. it's common for the phase after the problem to be the one reporting errors (e.g. if one phase doesn't upload what it should, we won't notice until the next phase). tps runs one "cleanup" phase for each profile (even ...
Gecko object attributes
called "cycles", which moves to the next option in the same way a manual click does. applied to: role_cell for the <xul:tree/> note: it's not exposed currently table related attributes layout-guess true when gecko's heuristic determines that it is a table that is probably used for layout, not for table. value not set means it is probably a data table. applied to: role_table table-cell-index the index of the table cell accessible. use nsiaccessibletable and nsiaccessibletablecell instead. applied to role_cell hypertext attributes formatting "block" if the object uses block formatting, and thus starts on a new line and ends with a hard line break that is not visible in the actual text. for example, a heading, paragraph, or list item is typically formatted as a block, but t...
Using the Places livemark service
-1); the first parameter is the id of the folder in which to create the livemark. the second parameter is the livemark's name as it will appear in the bookmark's title. the third parameter is the uri of the site the livemark was created from (specified as an nsiuri object. fourth argument is the uri of the actual rss feed. the last argument takes in the index to insert at, or -1 to append the new livemark to the end of the folder. you can convert a string into an nsiuri using nsiioservice. when creating livemarks during startup, you should use the nsilivemarkservice.createlivemarkfolderonly() to avoid http traffic. this creates the encapsulating livemark without actually fetching the rss feed's contents. var bmsvc = components.classes["@mozilla.org/b...
Creating a Python XPCOM component
ef write(self): print self.yourname def change(self, newname): self.yourname = newname then register your component; the procedure is the same for any component, but will not work if python components weren't enabled. to register the component, touch the .autoreg (a hidden file) in the bin directory, or delete xpti.dat. then, the next time mozilla starts, it will rebuild the index of components, including any new one in the 'components' directory. it is helpful to then start mozilla from the command line to see if new components register successfully. generating implementation templates the module xpcom.xpt is used internally to process type information, but it has a nice feature - it can spit out a template for a python implementation of any interface. just execute this f...
Mozilla internal string guide
nside libxul free() is preferred.. substrings (string fragments) it is very simple to refer to a substring of an existing string without actually allocating new space and copying the characters into that substring. substring() is the preferred method to create a reference to such a string. void processstring(const nsastring& str) { const nsastring& firstfive = substring(str, 0, 5); // from index 0, length 5 // firstfive is now a string representing the first 5 characters } unicode conversion ns*cstring vs. ns*string strings can be stored in two basic formats: 8-bit code unit (byte/char) strings, or 16-bit code unit (char16_t) strings. any string class with a capital "c" in the classname contains 8-bit bytes. these classes include nscstring, nsdependentcstring, and so forth. any st...
XPCOM Stream Guide
Mozilla › Tech › XPCOM › Guide › Streams
ss that underlying stream's data. complex input stream types type purpose native class contract id interface how to bind to a primitive input stream multiplex concatenate multiple input streams into one. nsmultiplexinputstream @mozilla.org/io/multiplex-input-stream;1 nsimultiplexinputstream .appendstream(stream) .insertstream(stream, index) buffered read ahead in the underlying stream into a buffer, so that calls to the underlying stream are minimized. nsbufferedinputstream @mozilla.org/network/buffered-input-stream;1 nsibufferedinputstream .init(stream, buffersize) binary read binary data from the underlying stream, in "big-endian" order. nsbinaryinputstream @mozilla.org/binaryinputstr...
XPCOM guide
Mozilla › Tech › XPCOM › Guide
up process, so they can start new services at appropriate times, for example.xpcom array guidemozilla 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 multiple objects with a numeric, zero-based index.xpcom changes in gecko 2.0several changes that affect xpcom component compatibility are taking place in gecko 2. this article details those changes, and provides suggestions for how to update your code.xpcom hashtable guidea hashtable is a data construct that stores a set of items. each item has a key that identifies the item. items are found, added, and removed from the hashtable by using the ke...
Components.interfacesByID
components.interfacesbyid is a read-only array of classes indexed by iid. introduction components.interfacesbyid is a read-only array of objects which implement the nsijsiid interface. each object represents one of the xpcom interfaces -- that some component or another might or might not implement. it reflects only those interfaces which have been designated in their .idl description as [scriptable], i.e. the interfaces which xpconnect is capable of reflecting into javascript. components.interfacesbyid is exactly like components.interfaces except that the elements are indexed by the canonical form of their iid. usage you can retrieve an interface object using: var iface = components.interfacesbyid["{aa610f20-a889-11d3-8c81-000064657374}"]; ...
Components.utils.Sandbox
e of an object that you want to make available as a global to code running in the sandbox. the exception is "-promise": the promise constructor is available by default for sandboxes, and you use this option to remove it from the sandbox. note that "-promise" is removed in firefox 37. ...
Cut
« xpcom api reference summary the cut function removes a section of the string's internal buffer. void cut( index_type acutstart, size_type acutlength ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. ...
nsACString
er string composed of single-byte storage units. this class is typically used to represent ascii or utf-8 character arrays. #include "nsstringapi.h" class nsacstring { ... }; typedefs char_type [char] storage unit for this class. self_type [nsacstring] an alias for the type of this class. size_type [pruint32] type used to represent the number of bytes stored in the string. index_type [pruint32] type used to represent an offset into the string. methods beginreading the beginreading function returns a const pointer to the first element of the string's internal buffer. endreading the endreading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer. length the length function returns the number...
Cut
« xpcom api reference summary the cut function removes a section of the string's internal buffer. void cut( index_type acutstart, index_type acutlength ); parameters acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. ...
nsAString
of double-byte storage units. this class is typically used to represent unicode character arrays. #include "nsstringapi.h" class nsastring { ... }; typedefs char_type [prunichar] storage unit for this class. self_type [nsastring] an alias for the type of this class. size_type [pruint32] type used to represent the number of double-byte units stored in the string. index_type [pruint32] type used to represent an offset into the string. methods beginreading the beginreading function returns a const pointer to the first element of the string's internal buffer. endreading the endreading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer. length the length function retur...
mozIStorageRow
the mozistoragerow interface represents a row in the result set from a storage database query. storage/public/mozistoragerow.idlscriptable please add a summary to this article. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: mozistoragevaluearray method overview nsivariant getresultbyindex(in unsigned long aindex); nsivariant getresultbyname(in autf8string aname); methods getresultbyindex() returns the value from a specific column in the row, using a zero-based index to identify the column. nsivariant getresultbyindex( in unsigned long aindex ); parameters aindex the zero-based index of the column number whose value is to be returned. return value an nsivariant object containing...
nsIAccessNode
voidptr a unique id calculated for this dom node, for the purposes of caching and referencing this object. read only. native code only! methods getchildnodeat() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) get the nth child of this node. nsiaccessnode getchildnodeat( in long childnum ); parameters childnum zero-based child index. return value the nth nsiaccessnode child. exceptions thrown ns_error_failure indicates that the access node is unattached from the accessible tree. getcomputedstylecssvalue() retrieve the computed style value as nsidomcssprimitivevalue for the dom node this access node is associated with. note: the meanings of width, height and other size measurements depend on the version of css bei...
DoAction
« nsiaccessible page summary this method performs the accessible action at the given zero-based index. action number 0 is the default action. void doaction( in pruint8 aindex ); parameters aindex[in] the zero-based index. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ns_error_invalid_arg indicates that the given index is our of range. see also nsiaccessible.numactions nsiaccessible.getactionname() nsiaccessible.getactiondescription() ...
GetActionDescription
« nsiaccessible page summary this method retrieves the description (localized name) of the accessible action at the given zero-based index. astring getactiondescription( in pruint8 aindex ); parameters aindex[in] the zero-based index. return value returns the description of the accessible action. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ns_error_invalid_arg indicates that the given index is our of range. see also nsiaccessible.numactions nsiaccessible.getactionname() nsiaccessible.doaction() ...
GetActionName
« nsiaccessible page summary this method retrieves the name of the accessible action at the given zero-based index. astring getactionname( in pruint8 aindex ); parameters aindex[in] the zero-based index. return value returns the name of the accessible action. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree.ns_error_invalid_arg indicates that the given index is our of range. see also nsiaccessible.numactions nsiaccessible.getactiondescription() nsiaccessible.doaction() ...
GetKeyBindings
« nsiaccessible page summary this method provides array of localized string of global keyboard accelerator for the given action index supported by accessible. nsidomdomstringlist getkeybindings( in pruint8 aactionindex ); parameters aactionindex[in] index of the given action. return values returns array of localized string of global keyboard accelerator. exceptions thrown ns_error_invalid_arg the given index doesn't correspond to default action (not zero). remark key bindings are supported for default action only. see also nsiaccessible.defaultkeybinding nsiaccessible.keyboardshortcut ...
nsIAccessibleEditableText
ailure indicates the text cannot be pasted from the clipboard. setattributes() sets the attributes for the text between the two given indices. the old attributes are replaced by the new list of attributes. for example, sets font styles, such as italic, bold, and so on. void setattributes( in long startpos, in long endpos, in nsisupports attributes ); parameters startpos the start index of the text whose attributes are modified. endpos the end index of the text whose attributes are modified. attributes the set of attributes that replaces the old list of attributes of the specified text portion. exceptions thrown ns_error_not_implemented always. the method is not implemented. settextcontents() replaces the text represented by this object with the given text. void se...
nsIAccessibleTableCell
gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview boolean isselected(); attributes attribute type description columnextent long return the number of columns occupied by this cell. the result differs from 1 if the specified cell spans multiple columns. read only. columnheadercells nsiarray return an array of column header cells for this cell. read only. columnindex long return column index of this cell. read only. rowextent long return the number of rows occupied by this accessible cell. the result differs from 1 if the specified cell spans multiple rows. read only. rowheadercells nsiarray return an array of row header cells for this cell. read only. rowindex long return row index of this cell. read only. table nsiaccessibletable return host table a...
nsICategoryManager
they are often used to register lists of contractids, corresponding to components that wish to be notified of various events by some subsystem. ...
nsIDOMFontFace
e these attributes only have meaningful values when the font is a user font defined using @font-face. attribute type description format domstring the font format. read only. localname domstring null if not a src:local(...) rule. read only. metadata domstring xml metadata from woff file(if any). read only. rule nsidomcssfontfacerule null if no associated @font-face rule. read only. srcindex long index in the rule's src list, -1 if no @font-face rule. read only. uri domstring null if not a downloaded font, that is local. read only. see also nsidomfontfacelist ...
nsIDOMFontFaceList
layout/inspector/public/nsidomfontfacelist.idlscriptable a list of nsidomfontface objects, each representing a single font face. 1.0 66 introduced gecko 7.0 inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) method overview nsidomfontface item(in unsigned long index); attributes attribute type description length unsigned long the number of items in the list. read only. methods item() returns the nsidomfontface object at the specified index into the list. nsidomfontface item( in unsigned long index ); parameters index the index into the array of the font face object to return. return value an nsidomfontface object representing a single font face. see ...
nsIDOMHTMLAudioElement
into the audio stream, specified either as a javascript array or as a numeric typed array. return value the actual number of bytes written to the stream. exceptions thrown ns_error_dom_invalid_state_err the stream has not been initialized for writing by a call to mozsetup(). ns_error_dom_type_mismatch_err the data isn't a valid data type (an array or typed array of numeric values). ns_error_dom_index_size_err the number of samples specified doesn't divide evenly across the number of channels; you must provide exactly the same number of samples for all channels. ...
nsIDOMStorageWindow
moved. attributes attribute type description globalstorage nsidomstoragelist global storage, accessible by domain. read only. localstorage nsidomstorage local storage for the current browsing context. data stored in local storage may only be accessed from the same origin that inserted the data into storage in the first place. read only. moz_indexeddb nsiidbfactory indexed databases for the current browsing context. read only. sessionstorage nsidomstorage session storage for the current browsing context. data stored in session storage may be accessed by any site in the browsing context. read only. ...
nsIDOMXULControlElement
...
nsIEventListenerService
attributes attribute type description systemeventgroup nsidomeventgroup returns system event group. 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.currenttarget while dispatching an event to aeventtarget. note: some events, especially 'load', may actually have a shorter event target chain than what this methods returns. void geteventtargetchainfor( in nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsidomeventtarget aoutar...
ExtensionManager (Toolkit)
is obsolete starting in gecko 2.0, and has been replaced by the new add-on manager. ...
nsIFilePicker
lling 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 modeopenmultiple 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 calling init(). constant value description modeopen 0 load a file. modesave 1 ...
nsIMessenger
ibutes attribute type description transactionmanager nsitransactionmanager readonly: the transaction manager for this nsimessenger instance. sendingunsentmsgs boolean indicates if sending messages is in progress. lastdisplayedmessageuri acstring readonly: the url of the last displayed message. navigatepos long the current index in the navigation history. constants name value description eunknown 0 unknown transaction type. edeletemsg 1 delete transaction type. emovemsg 2 move transaction type. ecopymsg 3 copy transaction type. methods setdisplaycharset() sets the character set for the displayed message. void setdisplaycharset(i...
nsIMimeConverter
parameters propertyname the name of the property to retrieve. return value the value of the property. b64encoderinit() get an integer property. usually you would use this to store you own properties. unsigned long getuint32property(in string propertyname); parameters propertyname the name of the property to retrieve. thunderbird stored uint32 properties (not a complete list): indexed used for spotlight integration on osx. notaphishmessage indicates whether phisihing filters have been run on a message yet. return value the value of the property. qpencoderinit() void setuint32property(in string propertyname, in unsigned long propertyval); parameters propertyname the name of the property to set. propertyval the value of the pro...
nsIProgrammingLanguage
...
nsITransactionManager
ned or when the transaction manager is destroyed. void dotransaction( in nsitransaction atransaction ); parameters atransaction the nsitransaction to do. endbatch() turns off the transaction manager's batch mode. void endbatch(); parameters none. getredolist() returns the list of nsitransaction on the redo stack. note that the transaction at the top of the redo stack will actually be at the index n-1 in the list, where n is the number of items in the list. nsitransactionlist getredolist(); parameters none. return value a list of nsitransaction on the redo stack. getundolist() returns the list of nsitransaction on the undo stack. note that the transaction at the top of the undo stack will actually be at the index n-1 in the list, where n is the number of items in the list. nsitransactionl...
nsITreeColumn
ue, then the column is a cycler column. if the cycler attribute is not set, the column cells are regular text cells. read only. editable boolean if true the nsitreecolumn content is editable. if the editable attribute is not set, the column cells are not editable. read only. element nsidomelement the treecol element. read only. id astring the id attribute of the nsitreecolumn. read only. index long the index of the nsitreecolumn in displayed order. read only. primary boolean if true the nsitreecolumn is the primary column. if the primary attribute is not set, the column is not the primary column. read only. selectable boolean if true the nsitreecolumn is able to be selected. if the selectable attribute is not set, the column cells are not selectable. read only. type short the ty...
nsIXPCScriptable
not be checked for the property. prbool newresolve( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in jsval id, in pruint32 flags, out jsobjectptr objp ); parameters wrapper cx the pointer to the jscontext newresolve is being called from. obj the pointer to the jsobject that the property named by id that is being accessed. id the name or index of the property being accessed as a jsval. flags the flags that describe the access to the property named by id. see js_lookupproperty for the flags and their meaning. objp an out parameter that, on success, points to the jsobject that the property named by id has been defined on. if the property named by id was not defined, this should be set to null. return value this should (although d...
XPCOM Interface Reference
w2nsidomwindowinternalnsidomwindowutilsnsidomxpathevaluatornsidomxpathexceptionnsidomxpathexpressionnsidomxpathresultnsidomxulcontrolelementnsidomxulelementnsidomxullabeledcontrolelementnsidomxulselectcontrolelementnsidomxulselectcontrolitemelementnsidatasignatureverifiernsidebugnsidebug2nsidevicemotionnsidevicemotiondatansidevicemotionlistenernsidialogcreatornsidialogparamblocknsidictionarynsidirindexnsidirindexlistenernsidirindexparsernsidirectoryenumeratornsidirectoryiteratornsidirectoryservicensidirectoryserviceprovidernsidirectoryserviceprovider2nsidiskcachestreaminternalnsidispatchsupportnsidocshellnsidocumentloadernsidownloadnsidownloadhistorynsidownloadmanagernsidownloadmanageruinsidownloadobservernsidownloadprogresslistenernsidownloadernsidragdrophandlernsidragservicensidragsessionnsid...
XPCOM Interface Reference by grouping
ice nsicomponentregistrar internationalization nsibidikeyboard nsilocale io filesystem nsidirectoryenumerator nsidirectoryiterator nsidirectoryservice nsidirectoryserviceprovider nsidirectoryserviceprovider2 nsidirindex nsidirindexlistener nsidirindexparser nsifile nsilocalfile stream nsiasyncinputstream nsiasyncoutputstream nsiasyncstreamcopier nsibinaryinputstream nsibinaryoutputstream nsicontentsniffer nsiconverterinputstream nsifileinp...
NS_CStringCutData
« xpcom api reference summary the ns_cstringcutdata function removes a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringcutdata( nsacstring& astring, pruint32 acutstart, pruint32 acutlength ); parameters astring [in] a nsacstring instance to be modified. acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. pass pr_uint32_max to specify the length from acutstart to the end of the string. return values the ns_cstringcutdata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_cstringsetdatarange . examp...
NS_CStringSetDataRange
_cstringsetdatarange function copies data into a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_cstringsetdatarange( nsacstring& astring, pruint32 acutstart, pruint32 acutlength, const char* adata, pruint32 adatalength = pr_uint32_max ); parameters astring [in] a nsacstring instance to modify. acutstart [in] the starting index of the section to replace, measured in storage units. acutlength [in] the length of the section to replace, measured in storage units. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return valu...
NS_StringCutData
« xpcom api reference summary the ns_stringcutdata function removes a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringcutdata( nsastring& astring, pruint32 acutstart, pruint32 acutlength ); parameters astring [in] a nsastring instance to be modified. acutstart [in] the starting index of the section to remove, measured in storage units. acutlength [in] the length of the section to remove, measured in storage units. pass pr_uint32_max to specify the length from acutstart to the end of the string. return values the ns_stringcutdata function returns ns_ok if successful. otherwise, it returns an error code. remarks this function is defined inline as a wrapper around ns_stringsetdatarange. note: gcc r...
NS_StringSetDataRange
atarange function copies data into a section of the string's internal buffer. this is a low-level api. #include "nsstringapi.h" nsresult ns_stringsetdatarange( nsastring& astring, pruint32 acutstart, pruint32 acutlength, const prunichar* adata, pruint32 adatalength = pr_uint32_max ); parameters astring [in] a nsastring instance to modify. acutstart [in] the starting index of the section to replace, measured in storage units. acutlength [in] the length of the section to replace, measured in storage units. adata [in] a raw character array to copy into this string. adatalength [in] the length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. return values the ...
nsIAbCard/Thunderbird3
faxnumber, faxnumbertype pagernumber, pagernumbertype cellularnumber, cellularnumbertype jobtitle, department, company _aimscreenname dates: anniversaryyear, anniversarymonth, anniversaryday birthyear, birthmonth, birthday webpage1 (work), webpage2 (home) custom1, custom2, custom3, custom4 notes integral properties: lastmodifieddate popularityindex prefermailformat (see nsiabprefermailformat) boolean properties: allowremotecontent inherits from: nsiabitem method overview nsivariant getproperty(in autf8string name, in nsivariant defaultvalue); [noscript] astring getpropertyasastring(in string name); [noscript] autf8string getpropertyasautf8string(in string name); [noscript] pruint32...
nsMsgNavigationType
the nsmsgnavigationtype interface contains constants used for message navigation in thunderbird. for example to move forward a message, you would call: // assuming gdbview is a global nsimsgdbview var resultid = new object(); var resultindex = new object(); var threadindex = new object(); gdbview.viewnavigate(components.interfaces.nsmsgnavigationtype.nextmessage, resultid, resultindex, threadindex, true); the nsmsgnavigationtype interface is defined as a global variable in thunderbird: var nsmsgviewcommandtype = components.interfaces.nsmsgviewcommandtype; mailnews/base/public/nsimsgdbview.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) constants name value description firstmessage 1 go to the first message in the...
Xptcall Porting Status
ts that work will be occuring soon. <font color="black">works</font> netbsd/m68k dave huang <khym@bga.com> dave's changes are in the tree. waiting for verification that it is really finished. <font color="black">partially working</font> netbsd/arm32 mike pumford <mpumford@black-star.demon.co.uk> mike writes: i have started porting to the platform based on the code for linux arm. the invokebyindex code works correctly when used with testxptcinvoke. i am currently working on making testxpc function correctly. i am doing the porting work with egcs-1.1.2 on netbsd 1.4p (netbsd-current snapshot from a couple of days ago). <font color="white">done</font> linux ia64 hp ulrich drepper <drepper@redhat.com> bug 40950 comment 15 <font color="white">help!</font> all others! - - note: i've u...
Mozilla technologies
t as a general application messaging system. toolkit apithe mozilla toolkit is a set of programming interfaces (apis) built on top of gecko which provide advanced services to xul applications. these services include:viewing and searching mozilla source code onlinesource code for 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. the module is structured as a drop-in component and exposes its xml-as-data features both to javascript and c++/xpcom users. the xml extras module is built by default on all platforms, and is included in the browser install...
Measuring Code Coverage on Firefox
documentation moved in-tree: https://firefox-source-docs.mozilla.org/tools/code-coverage/index.html ...
Mail client architecture overview
his includes management of accounts, folders and messages. the base module consists of the 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 multiple 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...
Thunderbird extensions
sages 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 how to create your first message query and read the gloda examples gloda internals: gloda debugging, gloda indexing more thunderbird-specific links some links may be out of date, but they still provide valuable information on the codebase. an overview of thunderbird components developer reference docs: folder classes db views (message list) message summary database mailnews protocols mailnews filters error reporting tools ...
Using the Multiple Accounts API
mber of minutes between checks for new mail preference: mail.server.server.remember_password - boolean, should we remember the password? preference: mail.server.server.download_on_biff. - boolean, should we download new messags on biff (true) or just alert user that there is 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_subscription - boolean, should we use subscriptions? (i.e. use lsub instead of list) preference: mail.server.server.cleanup_inbox_on_exit - boolean, should we purge the ...
Using the Mozilla source server
using the mozilla source server is now even more feature-packed. ...
CData
); console.info('fromcharcode:', fromcharcode); var char16_val = fromcharcode.join(''); console.info('char16_val:', char16_val); return char16_val; } if (!jschar) { try { var char8_val = stringptr.readstring(); console.info('stringptr.readstring():', char8_val); return char8_val; } catch (ex if ex.message.indexof('malformed utf-8 character sequence at offset ') == 0) { console.warn('ex of offset utf8 read error when trying to do readstring so using alternative method, ex:', ex); return readjscharstring(); } } else { return readjscharstring(); } } ...
UInt64
digits in the specified radix. arithmetic operations const uint64 = ctypes.uint64; const int64 = ctypes.int64; function ensureuint64(aarr) { // makes elements in aarr a uint64 if it can be made, else throws for (var i=0; i<aarr.length; i++) { var ccon = aarr[i].constructor.name; if (ccon != 'uint64') { if (['string', 'number'].indexof(ccon) > -1) { aarr[i] = uint64(aarr[i]); } else { throw new error('invalid type at position ' + i + ' it must be a numeric string, a number, or a uint64. type is "' + ccon + '"'); } } } } function uint64_add(...uint64) { ensureuint64(uint64); var hi = uint64.hi(uint64[0]); ...
Mozilla
t be paired. using tab-modal prompts note: this part of the documentation is outdated. the updated prompt documentation can be found in the firefox source docs. using the mozilla source server using the mozilla source server is now even more feature-packed. the nightly debug builds are now also source indexed so that by following a couple of simple steps you can also have the source code served to you for debugging without a local build using the mozilla symbol server the mozilla project runs a symbol server for trunk firefox nightly and release builds on windows. symbols are available for at least 30 previous days worth of nightly builds, and fi...
Accessibility Inspector - Firefox Developer Tools
escription — any further description provided on the element, usually by the content of a title attribute. keyboardshortcut — any keyboard shortcut that is available to activate the element, as specified in an accesskey attribute. note that this works correctly as of firefox 62 (bug 1467381). childcount — the number of child items the current item has in the accessibility tree hierarchy. indexinparent — an index value indicating what number child the item is, inside its parent. if the item is the first item inside its parent, it has a value of 0. if it is the second, it has a value of 1. and so on. states — a list of the different accessibility-relevant states that can apply to the current item. for example, one of the links in one demo has states of focusable, linked, selectable ...
Use a source map - Firefox Developer Tools
reconstructed original in the debugger. to enable the debugger to work with a source map, you 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 coffeescript and compiled to javascript. 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 coffeescript source now appears as "main.coffee", and we can debug it just like any other source. ...
Debugger - Firefox Developer Tools
object describing the error, with the following properties: message the fully formatted error message. file if present, the source file name, url, etc. (if this property is present, theline property will be too, and vice versa.) line if present, the source line number at which the error occurred. linetext if present, this is the source code of the offending line. offset the index of the character within linetext at which the error occurred. warning present and true if this is a warning; absent otherwise. strict present and true if this error or warning is due to the strict option (not to be confused with es strict mode) exception present and true if an exception will be thrown; absent otherwise. arguments an array of strings, representing the arguments sub...
Migrating from Firebug - Firefox Developer Tools
e inspector the cookies panel in firebug displays information related to the cookies created by a page and allows to manipulate the information they store. within the devtools this functionality is located within the storage inspector. in contrast to firebug the storage inspector not only allows to inspect cookies but also other kinds of storages like the local and session storage, the cache and indexeddb databases. inspect cookies all cookies related to a website are listed inside the cookies panel in firebug. inside the devtools, the cookies are grouped by domain under the cookies section within the storage inspector. both show pretty much the same information per cookie, i.e. the name, value, domain, path, expiration date and whether the cookie is http-only. the devtools don't show by de...
Examine and edit HTML - Firefox Developer Tools
elements, even if you haven’t set any margin or padding on them. since firefox 52, the inspector displays these whitespace nodes, so you can see where the gaps in your markup come from. whitespace nodes are represented with a dot: and you get an explanatory tooltip when you hover over them: to see this in action, see the demo at https://mdn.github.io/devtools-examples/whitespace-only-demo/index.html. shadow roots any shadow roots present in the dom are exposed in the html page in the same manner as the regular dom. the shadow root is signified by a node named #shadow-root — you can click its expansion arrow to see the full contents of the shadow dom, and then manipulate the contained nodes in a similar way to other part of the page's dom (although with a limited featureset — you c...
Style Editor - Firefox Developer Tools
d by default. editing original sources you can also edit the original sources in the style editor and see the results applied to the page immediately. to get this to work there are two extra steps. first, set up your preprocessor so it watches the original source and automatically regenerates the css when the source changes. with sass you can do this simply by passing the --watch option: sass index.scss:index.css --watch next, save the original source in the style editor by clicking the "save" button next to the file, and saving it over the original file. now when you make changes to the source file in the style editor the css is regenerated and you can see the changes right away. keyboard shortcuts source editor shortcuts this table lists the default shortcuts for the source editor. ...
Firefox Developer Tools
includes inspection of service workers and web app manifests. note: the collective term for the ui inside which the devtools all live is the toolbox. more tools these developer tools are also built into firefox. unlike the "core tools" above, you might not use them every day. memory figure out which objects are keeping memory in use. storage inspector inspect cookies, local storage, indexeddb, and session storage present in a page. dom property viewer inspect the page's dom properties, functions, etc. eyedropper select a color from the page. style editor view and edit css styles for the current page. taking screenshots take a screenshot of the entire page or of a single element. measure a portion of the page measure a specific area of a web page. rulers overlay horizon...
ANGLE_instanced_arrays.drawArraysInstancedANGLE() - Web APIs
gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. primcount a glsizei specifying the number of instances of the range of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if first, count or primcount are negative, a gl.invalid_value error is thrown. if gl.curre...
ANGLE_instanced_arrays.drawElementsInstancedANGLE() - Web APIs
t. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. primcount a glsizei specifying the number of instances of the set of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is a...
ANGLE_instanced_arrays.vertexAttribDivisorANGLE() - Web APIs
the angle_instanced_arrays.vertexattribdivisorangle() method of the webgl api modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with ext.drawarraysinstancedangle() and ext.drawelementsinstancedangle(). note: when using webgl2, this method is available as gl.vertexattribdivisor() by default. syntax void ext.vertexattribdivisorangle(index, divisor); parameters index a gluint specifying the index of the generic vertex attributes. divisor a gluint specifying the number of instances that will pass between updates of the generic attribute. return value none. examples var ext = gl.getextension('angle_instanced_arrays'); ext.vertexattribdivisorangle(0, 2); specifications specification status comment ...
AnalyserNode.fftSize - Web APIs
ize of the fft, given in number of samples. a higher value will result in more details in the frequency domain but fewer details in the time domain. must be a power of 2 between 252^5 and 2152^15, so one of: 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768. defaults to 2048. note: if its value is not a power of 2, or it is outside the specified range, a domexception with the name indexsizeerror is thrown. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relevant code). ...
AnalyserNode.maxDecibels - Web APIs
value for scaling the fft analysis data, where 0 db is the loudest possible sound, -10 db is a 10th of that, etc. the default value is -30 db. when getting data from getfloatfrequencydata() or getbytefrequencydata(), any frequencies with an amplitude of maxdecibels or higher will be returned as +1.0 or 255, respectively. note: if a value less than or equal to analysernode.mindecibels is set, an indexsizeerror exception is thrown. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for releva...
AnalyserNode.minDecibels - Web APIs
um decibel value for scaling the fft analysis data, where 0 db is the loudest possible sound, -10 db is a 10th of that, etc. the default value is -100 db. when getting data from getfloatfrequencydata() or getbytefrequencydata(), any frequencies with an amplitude of mindecibels or lower will be returned as 0.0 or 0, respectively. note: if a value greater than analysernode.maxdecibels is set, an index_size_err exception is thrown. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relev...
AnalyserNode.smoothingTimeConstant - Web APIs
of 1 means "overlap the previous and current buffer quite a lot while computing the value", which essentially smoothes the changes across analysernode.getfloatfrequencydata/analysernode.getbytefrequencydata calls. in technical terms, we apply a blackman window and smooth the values over time. the default value is good enough for most cases. note: if a value outside the range 0–1 is set, an index_size_err exception is thrown. example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input. for more complete applied examples/information, check out our voice-change-o-matic demo (see app.js lines 128–205 for relev...
AudioBuffer.copyFromChannel() - Web APIs
destination a float32array to copy the channel's samples to. channelnumber the channel number of the current audiobuffer to copy the channel data from. startinchannel optional an optional offset into the source channel's buffer from which to begin copying samples. if not specified, a value of 0 (the beginning of the buffer) is assumed by default. return value undefined. exceptions indexsizeerror one of the input parameters has a value that is outside the accepted range: the value of channelnumber specifies a channel number which doesn't exist (that is, it's greater than or equal to the value of numberofchannels on the channel). the value of startinchannel is outside the current range of samples that already exist in the source buffer; that is, it's greater than its curren...
AudioBuffer.copyToChannel() - Web APIs
les to the specified channel of the audiobuffer, from the source array. syntax myarraybuffer.copytochannel(source, channelnumber, startinchannel); parameters source a float32array that the channel data will be copied from. channelnumber the channel number of the current audiobuffer to copy the channel data to. if channelnumber is greater than or equal to audiobuffer.numberofchannels, an index_size_err will be thrown. startinchannel optional an optional offset to copy the data to. if startinchannel is greater than audiobuffer.length, an index_size_err will be thrown. example var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); var anotherarray = new float32array; // copy channel data from second channel of myarraybuffer. myarraybuffer.copyfromchannel(anot...
AudioBuffer.getChannelData() - Web APIs
getchanneldata() method of the audiobuffer interface returns a float32array containing the pcm data associated with the channel, defined by the channel parameter (with 0 representing the first channel). syntax var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); var nowbuffering = myarraybuffer.getchanneldata(channel); parameters channel the channel property is an index representing the particular channel to get data for. an index value of 0 represents the first channel. if the channel index value is greater than of equal to audiobuffer.numberofchannels, an index_size_err exception will be thrown. return value a float32array. example in the following example we create a two second buffer, fill it with white noise, and then play it via an audiobuffersourc...
AudioNode.channelInterpretation - Web APIs
. the specification explicitly allows the future definition of new speaker layouts. this fallback is therefore not future proof as the behavior of the browsers for a specific number of channels may change in the future. discrete any (x) any (y) where x<y up-mix discrete channels. fill each output channel with its input counterpart, that is the input channel with the same index. channels with no corresponding input channels are left silent. any (x) any (y) where x>y down-mix discrete channels. fill each output channel with its input counterpart, that is the input channel with the same index. input channels with no corresponding output channels are dropped. syntax var oscillator = audioctx.createoscillator(); oscillator.channelinterpretation ...
AudioWorkletNode() - Web APIs
ng the name of a custom parameter and value being its initial value. processoroptions optional any additional data that can be used for custom initialization of the underlying audioworkletprocessor. return value the newly constructed audioworkletnode instance. exceptions notsupportederror the specified options.outputchannelcount is 0 or larger than the current implementation supports. indexsizeerror the length of options.outputchannelcount array does not match options.numberofoutputs. example for a complete example demonstrating user-defined audio processing, see the audioworkletnode page. specifications specification status comment web audio apithe definition of 'audioworkletnode()' in that specification. working draft initial definition. ...
AudioWorkletNodeOptions - Web APIs
ta that can be used for custom initialization of the underlying audioworkletprocessor. usage notes when creating an audioworkletnode, these options can have various effects. if the number of inputs and number of outputs are both set to 0, a notsupportederror will be thrown and the node construction process aborted. if the length of the outputchannelcount array doesn't match numberofoutputs, an indexsizeerror will be thrown. if outputchannelcount isn't specified, and numberofinputs and numberofoutputs are both 1, the audioworkletnode's initial channel count is set to 1. this has the effect of changing the output channel count to dynamically change to the computed number of channels, based on the input's channel count and the current setting of the audionode property channelcountmode. otherw...
BaseAudioContext.createChannelMerger() - Web APIs
stream will contain; the default is 6 if this parameter is not specified. returns a channelmergernode. example the following example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently. to use them, you need to use the second and third parameters of the audionode.connect(audionode) method, which allow you to specify both the index of the channel to connect from and the index of the channel to connect to. var ac = new audiocontext(); ac.decodeaudiodata(somestereobuffer, function(data) { var source = ac.createbuffersource(); source.buffer = data; var splitter = ac.createchannelsplitter(2); source.connect(splitter); var merger = ac.createchannelmerger(2); // reduce the volume of the left channel only var gainnode = a...
BaseAudioContext.createChannelSplitter() - Web APIs
tput separately; the default is 6 if this parameter is not specified. returns a channelsplitternode. example the following simple example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently. to use them, you need to use the second and third parameters of the audionode.connect(audionode) method, which allow you to specify the index of the channel to connect from and the index of the channel to connect to. var ac = new audiocontext(); ac.decodeaudiodata(somestereobuffer, function(data) { var source = ac.createbuffersource(); source.buffer = data; var splitter = ac.createchannelsplitter(2); source.connect(splitter); var merger = ac.createchannelmerger(2); // reduce the volume of the left channel only var gainnode = a...
Blob.slice() - Web APIs
Web › API › Blob › slice
the blob interface's slice() method creates and returns a new blob object which contains data from a subset of the blob on which it's called. syntax var newblob = blob.slice(start, end, contenttype); parameters start optional an index into the blob indicating the first byte to include in the new blob. if you specify a negative value, it's treated as an offset from the end of the blob toward the beginning. for example, -10 would be the 10th from last byte in the blob. the default value is 0. if you specify a value for start that is larger than the size of the source blob, the returned blob has size 0 and contains no data. end optional an index into the blob indicating the first byte that will *not* be included in the new blob (i.e. the byte exactly at this index is not included). if yo...
Blob.type - Web APIs
Web › API › Blob › type
do something here. } }); specifications specification status comment file apithe definition of 'blob.type' in that specification. working draft initial definition. ...
CSSGroupingRule - Web APIs
sents any css at-rule that contains other rules nested within it. objects deriving from it : cssconditionrule and its children: cssmediarule, csssupportsrule, and cssdocumentrule. csspagerule syntax the syntax is described using the webidl format. interface cssgroupingrule : cssrule { readonly attribute cssrulelist cssrules; unsigned long insertrule (domstring rule, unsigned long index); void deleterule (unsigned long index); } properties common to all cssgroupingrule instances the cssgroupingrule derives from cssrule and inherits all properties of this class. it has one specific property: cssgroupingrule.cssrules read only returns a cssrulelist of the css rules in the media rule. methods common to all cssgroupingrule instances the cssgroupingrule derives from cs...
CSSKeyframesRule - Web APIs
sskeyframesrule.appendrule() inserts a new keyframe rule into the current csskeyframesrule. the parameter is a domstring containing a keyframe in the same format as an entry of a @keyframes at-rule. if it contains more than one keyframe rule, a domexception with a syntax_err is thrown. csskeyframesrule.deleterule() deletes a keyframe rule from the current csskeyframesrule. the parameter is the index of the keyframe to be deleted, expressed as a domstring resolving as a number between 0% and 100%. csskeyframesrule.findrule() returns a keyframe rule corresponding to the given key. the key is a domstring containing an index of the keyframe to be returned, resolving to a percentage between 0% and 100%. if no such keyframe exists, findrule returns null. specification specification ...
CSSRule.cssText - Web APIs
Web › API › CSSRule › cssText
is property with element-style cssstyledeclaration.csstext. be aware that this property can no longer be set directly, as it is now specified to be functionally modify-only, and silently so. in other words, attempting to set it does absolutely nothing, and doesn't even omit a warning or error. furthermore, it has no settable sub-properties. therefore, to modify it, use the stylesheet's cssrules[index] properties .selectortext and .style (or its sub-properties). see using dynamic styling information for details. syntax string = cssrule.csstext example <style> body { background-color: darkblue; } </style> <script> var stylesheet = document.stylesheets[0]; alert(stylesheet.cssrules[0].csstext); // body { background-color: darkblue; } </script> specifications specifi...
CSSStyleDeclaration - Web APIs
ial alias for the float css property. cssstyledeclaration named properties dashed and camel-cased attributes for all supported css properties. methods cssstyledeclaration.getpropertypriority() returns the optional priority, "important". cssstyledeclaration.getpropertyvalue() returns the property value given a property name. cssstyledeclaration.item() returns a css property name by its index, or the empty string if the index is out-of-bounds. an alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. cssstyledeclaration.removeproperty() removes a property from the css declaration block. cssstyledeclaration.setproperty() modifies an existing css property or creates a new css prop...
CSSStyleSheet.addRule() - Web APIs
the obsolete cssstylesheet interface's addrule() legacy method adds a new rule to the stylesheet. you should avoid using this method, and should instead use the more standard insertrule() method. syntax var result = cssstylesheet.addrule(selector, styleblock, index); parameters selector a domstring specifying the selector portion of the css rule. the default is the string undefined. styleblock a domstring indicating the style block to apply to elements matching the selector. the default is the string undefined. index optional an optional index into the stylesheet's cssrulelist at which to insert the new rule. if index is not specified, the next index after the last item currently in the list is used (that is, the value of cssstylesheet.cssrules.length). return value always retu...
CSSStyleSheet.cssRules - Web APIs
which comprises the stylesheet. each item in the list is a cssrule defining a single rule. syntax var rules = cssstylesheet.cssrules; value a live-updating cssrulelist containing each of the css rules making up the stylesheet. each entry in the rule list is a cssrule object describing one rule making up the stylesheet. examples individual rules within the stylesheet can then be accessed by index: let rulelist = document.stylesheets[0].cssrules; for (let i=0; i < rulelist.length; i++) { processrule(rulelist[i]); } rules can also be accessed using for...of: let rulelist = document.stylesheets[0].cssrules; for (let rule of rulelist) { processrule(rule); } however, because cssrule is not a proper array, you can't use foreach(). specifications specification status ...
CSSStyleSheet.removeRule() - Web APIs
the obsolete cssstylesheet method removerule() removes a rule from the stylesheet object. it is functionally identical to the standard, preferred method deleterule(). note: this is a legacy method which has been replaced by the standard method deleterule(). you should use that instead. syntax cssstylesheet.removerule(index) parameters index the index into the stylesheet's cssrulelist indicating the rule to be removed. return value undefined example this example removes the first rule from the stylesheet mystyles. mystyles.removerule(0); you can rewrite this to use the standard deleterule() method very easily: mystyles.deleterule(0); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.removerule()'...
CSSUnparsedValue.keys() - Web APIs
syntax cssunparsedvalue.keys() parameters none. return value a new array. ...
CSSUnparsedValue.values() - Web APIs
syntax cssunparsedvalue.values() parameters none. return value a new array. ...
CSSUnparsedValue - Web APIs
own enumerable property [key, value] pairs in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). cssunparsedvalue.foreach() executes a provided function once for each element of the cssunparsedvalue object. cssunparsedvalue.keys() returns a new array iterator object that contains the keys for each index in the cssunparsedvalue object. cssunparsedvalue.values() returns a new array iterator object that contains the values for each index in the cssunparsedvalue object. specifications specification status comment css typed om level 1the definition of 'cssunparsedvalue' in that specification. working draft initial definition. ...
CSSValueList.item() - Web APIs
Web › API › CSSValueList › item
the item() method of the cssvaluelist interface is used to retrieve a cssvalue by ordinal index. the order in this collection represents the order of the values in the css style property. if the index is greater than or equal to the number of values in the list, this method returns null. syntax var cssvalue = cssvaluelist.item(index); parameters index an unsigned long representing the index of the css value within the collection. return value a cssvalue object at the index position in the cssvaluelist, or null if that is not a valid index. specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssvaluelist.item' in that specification. obsolete initial definition ...
Using dynamic styling information - Web APIs
the document. the basic style object exposes the stylesheet and the cssstylesheet interfaces. those interfaces contain members like insertrule, selectortext, and parentstylesheet for accessing and manipulating the individual style rules that make up a css stylesheet. 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.). modify a stylesheet rule with cssom <html> <head> <title>modifying a stylesheet rule with cssom</title> <style type="text/css"> body { background-color: red; } </style> <script type="text/javascript"> var stylesheet = document.stylesheets[0]; stylesheet.cssrules[0].style.backgroundcolor="blue"; </script> </...
CSS Typed Object Model API - Web APIs
rable property [key, value] pairs in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). cssunparsedvalue.foreach() method executing a provided function once for each element of the cssunparsedvalue. cssunparsedvalue.keys() method returning a new array iterator object that contains the keys for each index in the array. csskeywordvalue serialization the csskeywordvalue interface of the the css typed object model api creates an object to represent css keywords and other identifiers. csskeywordvalue.csskeywordvalue() constructor constructor creates a new csskeywordvalue.csskeywordvalue() object which represents css keywords and other identifiers. csskeywordvalue.value() property of the csske...
Cache.add() - Web APIs
Web › API › Cache › add
.) examples this code block waits for an installevent to fire, then calls waituntil() to handle the install process for the app. this consists of calling cachestorage.open to create a new cache, then using cache.add to add an asset to it. this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.add('/sw-test/index.html'); }) ); }); specifications specification status comment service workersthe definition of 'cache: add' in that specification. working draft initial definition. ...
Cache.addAll() - Web APIs
Web › API › Cache › addAll
its for an installevent to fire, then runs waituntil() to handle the install process for the app. this consists of calling cachestorage.open to create a new cache, then using addall() to add a series of assets to it. ...
Cache.keys() - Web APIs
Web › API › Cache › keys
dless of whether the response object has a vary header. it defaults to false. cachename: a domstring that represents a specific cache to search within. note that this option is ignored by cache.keys(). return value a promise that resolves to an array of cache keys. examples caches.open('v1').then(function(cache) { cache.keys().then(function(keys) { keys.foreach(function(request, index, array) { cache.delete(request); }); }); }) specifications specification status comment service workersthe definition of 'cache: keys' in that specification. working draft initial definition. ...
Cache.match() - Web APIs
Web › API › Cache › match
owser as if there were no service worker involvement. if fetch() returns a valid http response with an response code in the 4xx or 5xx range, the catch() will not be called. self.addeventlistener('fetch', function(event) { // we only want to call event.respondwith() if this is a get request for an html document. ...
Cache.matchAll() - Web APIs
Web › API › Cache › matchAll
tching responses in the cache object. note: cache.match() is basically identical to cache.matchall(), except that rather than resolving with an array of all matching responses, it resolves with the first matching response only (that is, response[0]). examples caches.open('v1').then(function(cache) { cache.matchall('/images/').then(function(response) { response.foreach(function(element, index, array) { cache.delete(element); }); }); }) specifications specification status comment service workersthe definition of 'cache: matchall' in that specification. working draft initial definition. ...
CacheStorage.delete() - Web APIs
ep). we return the keys of the caches in the cachestorage object using cachestorage.keys, then check each key to see if it is in the array. if not, we delete it using delete(). this.addeventlistener('activate', function(event) { var cachestokeep = ['v2']; event.waituntil( caches.keys().then(function(keylist) { return promise.all(keylist.map(function(key) { if (cachestokeep.indexof(key) === -1) { return caches.delete(key); } })); }) ); }); specifications specification status comment service workersthe definition of 'cachestorage: delete' in that specification. working draft initial definition. ...
CacheStorage.keys() - Web APIs
Web › API › CacheStorage › keys
turn the keys of the caches in the cachestorage object using keys(), then check each key to see if it is in the whitelist. if not, we delete it using cachestorage.delete(). then.addeventlistener('activate', function(event) { var cachewhitelist = ['v2']; event.waituntil( caches.keys().then(function(keylist) { return promise.all(keylist.map(function(key) { if (cachewhitelist.indexof(key) === -1) { return caches.delete(key); } }); }) ); }); specifications specification status comment service workersthe definition of 'cachestorage: keys' in that specification. working draft initial definition. ...
CacheStorage.open() - Web APIs
Web › API › CacheStorage › open
an installevent to fire, then runs waituntil() to handle the install process for the app. this consists of calling cachestorage.open() to create a new cache, then using cache.addall() to add a series of assets to it. ...
CacheStorage - Web APIs
(event.request, response.clone()).) if this fails (e.g. because the network is down), return a fallback response. finally, return whatever the custom response ended up being equal to, using fetchevent.respondwith. ...
CanvasGradient.addColorStop() - Web APIs
the canvasgradient.addcolorstop() method adds a new color stop, defined by an offset and a color, to a given canvas gradient. syntax void gradient.addcolorstop(offset, color); parameters offset a number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end; an index_size_err is raised if the number is outside that range. color a css <color> value representing the color of the stop. a syntax_err is raised if the value cannot be parsed as a css <color> value. examples adding stops to a gradient this example uses the addcolorstop method to add stops to a linear canvasgradient object. the gradient is then used to fill a rectangle. html <canvas id="canvas"></canvas> javascript const canvas = docume...
CanvasGradient - Web APIs
srenderingcontext2d.createlineargradient() or canvasrenderingcontext2d.createradialgradient(). it can be used as a fillstyle or strokestyle. properties as an opaque object, there is no exposed property. methods there is no inherited method. canvasgradient.addcolorstop() adds a new stop, defined by an offset and a color, to the gradient. if the offset is not between 0 and 1, inclusive, an index_size_err is raised; if the color can't be parsed as a css <color>, a syntax_err is raised. specifications specification status comment html living standardthe definition of 'canvasgradient' in that specification. living standard ...
CanvasRenderingContext2D.createImageData() - Web APIs
e vertical axis. height the height to give the new imagedata object. a negative value flips the rectangle around the horizontal axis. imagedata an existing imagedata object from which to copy the width and height. the image itself is not copied. return value a new imagedata object with the specified width and height. the new object is filled with transparent black pixels. errors thrown indexsizeerror thrown if either of the width or height arguments is zero. examples creating a blank imagedata object this snippet creates a blank imagedata object using the createimagedata() method. html <canvas id="canvas"></canvas> javascript the generated object is 100 pixels wide and 50 pixels tall, making 5,000 pixels in all. each pixel within an imagedata object consists of four array v...
CanvasRenderingContext2D.drawImage() - Web APIs
of the source image. dwidth optional the width to draw the image in the destination canvas. this allows scaling of the drawn image. if not specified, the image is not scaled in width when drawn. dheight optional the height to draw the image in the destination canvas. this allows scaling of the drawn image. if not specified, the image is not scaled in height when drawn. exceptions thrown index_size_err if the canvas or source rectangle width or height is zero. invalid_state_err the image has no image data. type_mismatch_err 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...
CanvasRenderingContext2D.getImageData() - Web APIs
d negative to the left. sh the height of the rectangle from which the imagedata will be extracted. positive values are down, and negative are up. return value an imagedata object containing the image data for the rectangle of the canvas specified. the coordinates of the rectangle's top-left corner are (sx, sy), while the coordinates of the bottom corner are (sx + sw, sy + sh). exceptions indexsizeerror thrown if either sw or sh are zero. securityerror the canvas contains or may contain pixels which were loaded from an origin other than the one 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 dat...
CanvasRenderingContext2D.textBaseline - Web APIs
mple demonstrates the various textbaseline property values. html <canvas id="canvas" width="550" height="500"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const baselines = ['top', 'hanging', 'middle', 'alphabetic', 'ideographic', 'bottom']; ctx.font = '36px serif'; ctx.strokestyle = 'red'; baselines.foreach(function (baseline, index) { ctx.textbaseline = baseline; const y = 75 + index * 75; ctx.beginpath(); ctx.moveto(0, y + 0.5); ctx.lineto(550, y + 0.5); ctx.stroke(); ctx.filltext('abcdefghijklmnop (' + baseline + ')', 0, y); }); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.textbaseline' in that specification. ...
Hit regions and accessibility - Web APIs
h.</p> </canvas> see the video how nvda reads this example by steve faulkner. aria rules accessible rich internet applications (aria) defines ways to make web content and web applications more accessible to people with disabilities. you can use aria attributes to describe the behavior and purpose of the canvas element. see aria and aria techniques for more information. <canvas id="button" tabindex="0" role="button" aria-pressed="false" aria-label="start game"></canvas> hit regions whether the mouse coordinates are within a particular area on the canvas, is a common problem to solve. the hit region api allows you to define an area of your canvas and provides another possibility to expose interactive content on a canvas to accessibility tools. it allows you to make hit detection easier an...
Optimizing canvas - Web APIs
in generally unchanged. <div id="stage"> <canvas id="ui-layer" width="480" height="320"></canvas> <canvas id="game-layer" width="480" height="320"></canvas> <canvas id="background-layer" width="480" height="320"></canvas> </div> <style> #stage { width: 480px; height: 320px; position: relative; border: 2px solid black; } canvas { position: absolute; } #ui-layer { z-index: 3; } #game-layer { z-index: 2; } #background-layer { z-index: 1; } </style> use plain css for large background images if you have a static background image, you can draw it onto a plain <div> element using the css background property and position it under the canvas. this will negate the need to render the background to the canvas on every tick. scaling canvas using css transforms css t...
ChannelMergerNode - Web APIs
es from its parent, audionode. methods no specific method; inherits methods from its parent, audionode. example the following example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently. to use them, you need to use the second and third parameters of the audionode.connect(audionode) method, which allow you to specify both the index of the channel to connect from and the index of the channel to connect to. var ac = new audiocontext(); ac.decodeaudiodata(somestereobuffer, function(data) { var source = ac.createbuffersource(); source.buffer = data; var splitter = ac.createchannelsplitter(2); source.connect(splitter); var merger = ac.createchannelmerger(2); // reduce the volume of the left channel only var gainnode = a...
ChannelSplitterNode - Web APIs
from its parent, audionode. methods no specific method; inherits methods from its parent, audionode. example the following simple example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently. to use them, you need to use the second and third parameters of the audionode.connect(audionode) method, which allow you to specify the index of the channel to connect from and the index of the channel to connect to. var ac = new audiocontext(); ac.decodeaudiodata(somestereobuffer, function(data) { var source = ac.createbuffersource(); source.buffer = data; var splitter = ac.createchannelsplitter(2); source.connect(splitter); var merger = ac.createchannelmerger(2); // reduce the volume of the left channel only var gainnode = a...
Clients.matchAll() - Web APIs
Web › API › Clients › matchAll
"worker", "sharedworker", and "all". the default is "all". return value a promise that resolves to an array of client objects. in chrome 46/firefox 54 and later, this method returns clients in most recently focused order, correct as per spec. examples clients.matchall(options).then(function(clientlist) { for (var i = 0 ; i < clientlist.length ; i++) { if (clientlist[i].url === 'index.html') { clients.openwindow(clientlist[i]); // or do something else involving the matching client } } }); specifications specification status comment service workersthe definition of 'clients: matchall' in that specification. working draft initial definition ...
Console.table() - Web APIs
Web › API › Console › table
displays tabular data as a table. this function takes one mandatory argument data, which must be an array or an object, and one additional optional parameter columns. it logs data as a table. each element in the array (or enumerable property if data is an object) will be a row in the table. the first column in the table will be labeled (index). if data is an array, then its values will be the array indices. if data is an object, then its values will be the property names. note that (in firefox) console.table is limited to displaying 1000 rows (first row is the labeled index). note: this feature is available in web workers. collections of primitive types the data argument may be an array or an object. // an array of strings console.table(["apples", "oranges", "bananas"]); // an objec...
DOMError - Web APIs
Web › API › DOMError
the domerror interface describes an error object that contains an error name. properties domerror.name read only returns a domstring representing one of the error type names (see below). domerror.message read only returns a domstring representing a message or description associated with the given error type name. error types type description indexsizeerror the index is not in the allowed range (e.g. thrown in a range object). hierarchyrequesterror the node tree hierarchy is not correct. wrongdocumenterror the object is in the wrong document. invalidcharactererror the string contains invalid characters. nomodificationallowederror the object can not be modified. notfounderror the object can not ...
DOMException - Web APIs
error name. error names common error names are listed here. some apis define their own sets of names, so this is not necessarily a complete list. note: because historically the errors were identified by a numeric value that corresponded with a named variable defined to have that value, some of the entries below indicate the legacy code value and constant name that were used in the past. indexsizeerror the index is not in the allowed range. for example, this can be thrown by the range object. (legacy code value: 1 and legacy constant name: index_size_err) hierarchyrequesterror the node tree hierarchy is not correct. (legacy code value: 3 and legacy constant name: hierarchy_request_err) wrongdocumenterror the object is in the wrong document. (legacy code value: 4 and legacy constan...
DOMImplementationList - Web APIs
properties domimplementationlist.length read only returns an integer. methods domimplementationlist.item() returns the pos item. ...
DOMParser - Web APIs
Web › API › DOMParser
living standard ...
DOMTokenList.forEach() - Web APIs
the foreach() method of the domtokenlist interface calls the callback given in parameter once for each value pair in the list, in insertion order. syntax tokenlist.foreach(callback [, thisarg]); parameters callback function to execute for each element, eventually taking three arguments: currentvalue the current element being processed in the array. currentindex the index of the current element being processed in the array. listobj the array that foreach() is being applied to. thisarg optional value to use as this when executing callback. return value undefined. example in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we when retrieve an iterator containing the values using foreach(), wri...
DOMTokenList.item() - Web APIs
Web › API › DOMTokenList › item
return value a domstring representing the returned item. it returns null if the number is greater than or equal to the length of the list. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then retrieve the last item in the list using item(tokenlist.length - 1), and write it into the <span>'s node.textcontent. ...
DOMTokenList - Web APIs
the domtokenlist interface represents a set of space-separated tokens. such a set is returned by element.classlist, htmllinkelement.rellist, htmlanchorelement.rellist, htmlareaelement.rellist, htmliframeelement.sandbox, or htmloutputelement.htmlfor. it is indexed beginning with 0 as with javascript array objects. domtokenlist is always case-sensitive. properties domtokenlist.length read only is an integer representing the number of objects stored in the object. domtokenlist.value a stringifier property that returns the value of the list as a domstring. methods domtokenlist.item(index) returns the item in the list by its index, or undefined if index is greater than or equal to the list's length. domtokenlist.contains(token) returns true if the list contains the given token, othe...
DataTransfer.mozTypesAt() - Web APIs
the datatransfer.moztypesat() method returns a list of the format types that are stored for an item at the specified index. if the index is not in the range from 0 to the number of items minus one, an empty string list is returned. note: this method is gecko-specific. syntax nsivariant datatransfer.moztypesat(index); arguments index a unsigned long that is the index of the data for which to retrieve the types. return value nsivariant a list of data formats (which are strings). if the index is not in the range from 0 to the number of items minus one, an empty string list is returned. example this example shows the use of the moztypesat() method in a drop event handler. function drop_handler(event) { var dt = event.datatransfer; var count = dt.mozitemcount; output("it...
DataTransferItemList - Web APIs
his interface has no constructor. properties datatransferitemlist.length read only an unsigned long that is the number of drag items in the list. methods datatransferitemlist.add() adds an item (either a file object or a string) to the drag item list and returns a datatransferitem object for the new item. datatransferitemlist.remove() removes the drag item from the list at the given index. datatransferitemlist.clear() removes all of the drag items from the list. datatransferitemlist.datatransferitem() getter that returns a datatransferitem at the given index. example each of this interface's methods and properties has a reference page, and each reference page has an example of its usage. specifications specification status comment html living stand...
Document: animationstart event - Web APIs
the animationstart event is fired when a css animation has started. if there is an animation-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). bubbles yes cancelable no interface animationevent event handler property onanimationstart the original target for this event is the element that had the animation applied. you can listen for this event on the document interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: animationstart. examples this listens for th...
Document.cookie - Web APIs
Web › API › Document › cookie
} <button onclick="doonce()">only do something once</button> example #4: reset the previous cookie function resetonce() { document.cookie = "dosomethingonlyonce=; expires=thu, 01 jan 1970 00:00:00 gmt"; } <button onclick="resetonce()">reset only once cookie</button> example #5: check a cookie existence //es5 if (document.cookie.split(';').some(function(item) { return item.trim().indexof('reader=') == 0 })) { console.log('the cookie "reader" exists (es5)') } //es2016 if (document.cookie.split(';').some((item) => item.trim().startswith('reader='))) { console.log('the cookie "reader" exists (es6)') } example #6: check that a cookie has a specific value //es5 if (document.cookie.split(';').some(function(item) { return item.indexof('reader=1') >= 0 })) { conso...
Document.forms - Web APIs
Web › API › Document › forms
ut type="button" onclick="alert(document.forms[0].id);" value="robby's form" /> </form> <form id="dave"> <input type="button" onclick="alert(document.forms[1].id);" value="dave's form" /> </form> <form id="paul"> <input type="button" onclick="alert(document.forms[2].id);" value="paul's form" /> </form> </body> </html> getting an element from within a form var selectform = document.forms[index]; var selectformelement = document.forms[index].elements[index]; named form access <!doctype html> <html lang="en"> <head> <title>document.forms example</title> </head> <body> <form name="login"> <input name="email" type="email"> <input name="password" type="password"> <button type="submit">log in</button> </form> <script> var loginform = document.forms.login; // or document.forms...
DocumentOrShadowRoot.msElementsFromRect() - Web APIs
floating-point retval [out, reval] type: nodelist example to find all of the elements under a given point, use mselementsfrompoint(x, y). to find all of the elements which intersect a rectangle, use mselementsfromrect(top, left, width, height). var nodelist = document.mselementsfromrect(x,y,width,height) var nodelist = document.mselementsfrompoint(x,y) the returned nodelist is sorted by z-index so that you can tell the relative stacking order of the elements. see also advanced hit testing apis demo for mselementsfrompoint() and mselementsfromrect() microsoft api extensions ...
EffectTiming.delay - Web APIs
nds directly to effecttiming.delay in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { delay: delayinmilliseconds }; timingproperties.delay = delayinmilliseconds; value a number specifying the delay, in milliseconds, from the start of the animation's play cycle to the beginning of its active interval (the time index at which actual animation begins). defaults to 0. examples in the pool of tears example, each tear is passed a random delay via its timing object: // randomizer function var getrandommsrange = function(min, max) { return math.random() * (max - min) + min; } // loop through each tear tears.foreach(function(el) { // animate each tear el.animate( tearsfalling, { delay: ge...
Element.attributes - Web APIs
the element.attributes property returns a live collection of all attribute nodes registered to the specified node. it is a namednodemap, not an array, so it has no array methods and the attr nodes' indexes may differ among browsers. to be more specific, attributes is a key/value pair of strings that represents any information regarding that attribute. syntax var attr = element.attributes; example basic examples // get the first <p> element in the document var para = document.getelementsbytagname("p")[0]; var atts = para.attributes; enumerating elements attributes numerical indexing is useful for going through all of an element's attributes. the following example runs through the attribute nodes for the element in the document with id "paragraph", and prints each attribute's value. <!
Element: keydown event - Web APIs
the keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered. for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. an uppercase "a" is reported as 65 by all events. keyboard events are only generated by <inputs>, <textarea> and anything with the contenteditable attribute or with tabindex="-1". since firefox 65, the keydown and keyup events are now fired during ime composition, to improve cross-browser compatibility for cjkt users (bug 354358, also see keydown and keyup events are now fired during ime composition for more useful details). to ignore all keydown events that are part of composition, do something like this (229 is a special value set for a keycode relating to an even...
Element.tabStop - Web APIs
Web › API › Element › tabStop
the tabstop property of the element interface returns a boolean indicating if the element can receive input focus via the tab key. if the specified element is a shadow host tab navigation is delegated to its children. this property was proposed to add tab functionality for custom elements. while with the existing tabindex property, it is required to specify an order for the element to become tabbable. the tabstop property would decouple the tabbable property from the tab index. after feedback, this property was removed from the design doc and replaced by shadowroot.delegatesfocus. syntax var istabstop = element.tabstop; element.tabstop = (true|false); example // tbd ...
EventSource - Web APIs
, data messages are delivered in one direction, from the server to the client (such as a user's web browser). that makes them an excellent choice when there's no need to send data from the client to the server in message form. for example, eventsource is a useful approach for handling things like social media status updates, news feeds, or delivering data into a client-side storage mechanism like indexeddb or web storage. when not used over http/2, sse suffers from a limitation to the maximum number of open connections, which can be specially painful when opening various tabs as the limit is per browser and set to a very low number (6). the issue has been marked as "won't fix" in chrome and firefox. this limit is per browser + domain, so that means that you can open 6 sse connections across a...
Using files from web applications - Web APIs
if (isset($_files['myfile'])) { // example: move_uploaded_file($_files['myfile']['tmp_name'], "uploads/" . $_files['myfile']['name']); exit; } ?><!doctype html> <html> <head> <title>dnd binary upload</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script type="application/javascript"> function sendfile(file) { const uri = "/index.php"; const xhr = new xmlhttprequest(); const fd = new formdata(); xhr.open("post", uri, true); xhr.onreadystatechange = function() { if (xhr.readystate == 4 && xhr.status == 200) { alert(xhr.responsetext); // handle response. } }; fd.append('myfile', file); // ...
File.getAsDataURL() - Web APIs
Web › API › File › getAsDataURL
...
FileList - Web APIs
Web › API › FileList
nput> 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 file = document.getelementbyid('fileitem').files[0]; method overview file item(index); properties attribute type description length integer a read-only value indicating the number of files in the list. methods item() returns a file object representing the file at the specified index in the file list. file item( index ); parameters index the zero-based index of the file to retrieve from the list. return value the file r...
File and Directory Entries API support in Firefox - Web APIs
n 2012, but by that point, google chrome included its own implementation of the api. over time, a number of popular sites and web applications came to use it, often without providing any means of falling back to standard apis or even checking to be sure the api is available before using it. mozilla instead opted to implement other apis which can be used to solve many of the same problems, such as indexeddb; see the blog post why no filesystem api in firefox? for more insights. this has caused a number of popular web sites not to work properly on browsers other than chrome. because of that, an attempt was made to create a spec offering the features of google's api which consensus could be reached on. the result was the file and directory entries api. this subset of the api provided by chrome is...
Gamepad.id - Web APIs
Web › API › Gamepad › id
mple, a ps2 controller returned 810-3-usb gamepad. this information is intended to allow you to find a mapping for the controls on the device as well as display useful feedback to the user. syntax readonly attribute domstring id; example window.addeventlistener("gamepadconnected", function() { var gp = navigator.getgamepads()[0]; gamepadinfo.innerhtml = "gamepad connected at index " + gp.index + ": " + gp.id + "."; }); value a string. specifications specification status comment gamepadthe definition of 'gamepad.id' in that specification. working draft initial definition ...
GamepadEvent.gamepad - Web APIs
roperty of the gamepadevent interface returns a gamepad object, providing access to the associated gamepad data for fired gamepadconnected and gamepaddisconnected events. syntax readonly attribute gamepad gamepad; example the gamepad property being called on a fired window.gamepadconnected event. window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.length, e.gamepad.axes.length); }); value a gamepad object. specifications specification status comment gamepadthe definition of 'gamepadevent.gamepad' in that specification. working draft initial definition ...
GlobalEventHandlers.onerror - Web APIs
tribute on <script> and having the server send the appropriate cors http response headers. a workaround is to isolate "script error." and handle it knowing that the error detail is only viewable in the browser console and not accessible via javascript. ...
GlobalEventHandlers.onfocus - Web APIs
note: the opposite of onfocus is onblur. syntax target.onfocus = functionref; value functionref is a function name or a function expression. ...
GlobalEventHandlers.onmousemove - Web APIs
tion receives a mouseevent object as its sole argument. examples tooltips this example creates link tooltips that follow your mouse. it uses the onmousemove, onmouseover, and onmouseout event handlers. ...
GlobalEventHandlers.onmouseup - Web APIs
and onmouseup event handlers. ...
HTMLElement: animationstart event - Web APIs
the animationstart event is fired when a css animation has started. if there is an animation-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). bubbles yes cancelable no interface animationevent event handler property onanimationstart examples this listens for the animationstart event and logs a message when it is fired: const animated = document.queryselector('.animated'); animated.addeventlistener('animationstart', () => { console.log('animation started'); }); the same, but using onanimationstart: const animated = docu...
HTMLElement.offsetLeft - Web APIs
ithin a div with a blue 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. ...
HTMLFormElement - Web APIs
otes obtaining a form element object to obtain an htmlformelement object, you can use a css selector with queryselector(), or you can get a list of all of the forms in the document using its forms property. document.forms returns an array of htmlformelement objects listing each of the forms on the page. you can then use any of the following syntaxes to get an individual form: document.forms[index] returns the form at the specified index into the array of forms. document.forms[id] returns the form whose id is id. document.forms[name] returns the form whose name attribute's value is name. accessing the form's elements you can access the list of the form's data-containing elements by examining the form's elements property. this returns an htmlformcontrolscollection listing all of the...
HTMLImageElement.x - Web APIs
then it looks at that <tr> (table row) element's cells property to get a list of the cells in that row. the third cell is taken from that row (once again, specifying 2 as the zero-based offset). from there, we can get the <img> element itself from the cell by calling queryselector() on the htmltablecellelement representing that cell. finally, we can look up ...
HTMLImageElement.y - Web APIs
then it looks at that <tr> (table row) element's cells property to get a list of the cells in that row. the third cell is taken from that row (once again, specifying 2 as the zero-based offset). from there, we can get the <img> element itself from the cell by calling queryselector() on the htmltablecellelement representing that cell. finally, we can look up ...
HTMLInputElement.setRangeText() - Web APIs
the htmlinputelement.setrangetext() method replaces a range of text in an <input> or <textarea> element with a new string. syntax element.setrangetext(replacement); element.setrangetext(replacement, start, end [, selectmode]); parameters replacement the string to insert. start optional the 0-based index of the first character to replace. defaults to the current selectionstart value (the start of the user's current selection). end optional the 0-based index of the character after the last character to replace. defaults to the current selectionend value (the end of the user's current selection). selectmode optional a string defining how the selection should be set after the text has been replaced. possible values: "select" selects the newly inserted text. "start"moves the sel...
HTMLInputElement.setSelectionRange() - Web APIs
ut element's type ('number') does not support selection". if you wish to select all text of an input element, you can use the htmlinputelement.select() method instead. syntax element.setselectionrange(selectionstart, selectionend [, selectiondirection]); parameters if selectionend is less than selectionstart, then both are treated as the value of selectionend. selectionstart the 0-based index of the first selected character. an index greater than the length of the element's value is treated as pointing to the end of the value. selectionend the 0-based index of the character after the last selected character. an index greater than the length of the element's value is treated as pointing to the end of the value. selectiondirection optional a string indicating the direction in which ...
HTMLOptionElement - Web APIs
tribute, which indicates that the option is unavailable to be selected. an option can also be disabled if it is a child of an <optgroup> element that is disabled. htmloptionelement.form read only is a htmlformelement representing the same value as the form of the corresponding <select> element, if the option is a descendant of a <select> element, or null if none is found. htmloptionelement.index read only is a long representing the position of the option within the list of options it belongs to, in tree-order. if the option is not part of a list of options, like when it is part of the <datalist> element, the value is 0. htmloptionelement.label read only is a domstring that reflects the value of the label html attribute, which provides a label for the option. if this attribute isn't...
HTMLElement.focus() - Web APIs
in that specification. obsolete document object model (dom) level 1 specificationthe definition of 'focus' in that specification. obsolete notes if you call htmlelement.focus() from a mousedown event handler, you must call event.preventdefault() to keep the focus from leaving the htmlelement behaviour of the focus in relation to different html features like tabindex or shadow dom, which previously remained under-specified, were recently updated (as october of 2019). checkout whatwg blog for more info. ...
HTMLSelectElement.add() - Web APIs
the htmlselectelement.add() method adds an element to the collection of option elements for this select element. syntax collection.add(item[, before]); parameters item is an htmloptionelement or htmloptgroupelement before is optional and an element of the collection, or an index of type long, representing the item item should be inserted before. if this parameter is null (or the index does not exist), the new element is appended to the end of the collection. exceptions a domerror of the type hierarchyrequesterror if the item passed to the method is an ancestor of the htmlselectelement. examples creating elements from scratch var sel = document.createelement("select"); var opt1 = document.createelement("option"); var opt2 = document.createelement("option"); opt1.value = "1"; ...
HTMLSelectElement.remove() - Web APIs
the htmlselectelement.remove() method removes the element at the specified index from the options collection for this select element. syntax collection.remove(index); parameters index is a long for the index of the htmloptionelement to remove from the collection. if the index is not found the method has no effect. example var sel = document.getelementbyid("existinglist"); sel.remove(1); /* takes the existing following select object: <select id="existinglist" name="existinglist"> <option value="1">option: value 1</option> <option value="2">option: value 2</option> <option value="3">option: value 3</option> </select> and changes it to: <select id="existinglist" name="existinglist"> <option value="1">option: value 1</option> <option value="3">option:...
HTMLTableElement.deleteRow() - Web APIs
the htmltableelement.deleterow() method removes a specific row (<tr>) from a given <table>. syntax htmltableelement.deleterow(index) parameters index index is an integer representing the row that should be deleted. however, the special index -1 can be used to remove the very last row of a table. return value no return value errors thrown if the number of the row to delete, specified by the parameter, is greater or equal to the number of available rows, or if it is negative and not equal to the special index -1, representing the last row of the table, the exception index_size_err is thrown. example this example uses javascript to delete a table's second row. html <table> <tr><td>cell 1.1</td><td>cell 1.2</td><td>cell 1.3</td></tr> <tr><td>cell 2.1</td><td>cell 2.2</td><td>c...
HTMLTableSectionElement - Web APIs
e and can have one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablesectionelement.deleterow() removes the cell at the given position in the section. if the given position is greater (or equal as it starts at zero) than the amount of rows in the section, or is smaller than 0, it raises a domexception with the indexsizeerror value. htmltablesectionelement.insertrow() inserts a new row just before the given position in the section. if the given position is not given or is -1, it appends the row to the end of section. if the given position is greater (or equal as it starts at zero) than the amount of rows in the section, or is smaller than -1, it raises a domexception with the indexsizeerror value. specifi...
The HTML DOM API - Web APIs
barprop navigator window deprecated web app and browser integration interfaces external obsolete web app and browser...
IDBCursor.request - Web APIs
Web › API › IDBCursor › request
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. desktopmobilechromeedgefirefoxinternet exploreroperas...
IDBDatabase.onclose - Web APIs
and the connection has been closed. note: this feature is available in web workers. syntax idbdatabase.onclose = function(event) { ... }; value a function which is called when the close event is fired. example db.onclose = function(event) { myappshowalert('the database "' + db.name + '" has unexpectedly closed.'); }; specifications specification status comment indexed database api draftthe definition of 'onclose' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webvie...
IDBEnvironmentSync - 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 unimplemented idbenvironmentsync interface of the indexeddb api will be implemented by worker objects. attributes attribute type description indexeddbsync readonly idbfactorysync provides a synchronous means of accessing the capabilities of indexed databases. note: until the indexed database api specification is finalized, this attribute should be accessed as moz_indexeddbsync. ...
IDBMutableFile - Web APIs
be large incompatibilities between implementations and the behavior may change in the future. summary the idbmutablefile interface provides access in read or write mode to a file, dealing with all the necessary locks. note: this interface used to be called filehandle , but it was changed to this (bug 1006485.) as idbmutablefile objects are bound to a fake file system built on top of indexeddb, such an object is created using the idbdatabase.createmutablefile method. properties mutablefile.name read only the name of the handled file. mutablefile.type read only the mime type of the handled file. events handler mutablefile.onabort the abort event is triggered each time the handled file is aborted. mutablefile.onerror the error event is triggered each time something g...
IDBObjectStore.count() - Web APIs
ount() — when the success handler fires, we log the count value (an integer) to the console. var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); var countrequest = objectstore.count(); countrequest.onsuccess = function() { console.log(countrequest.result); } specification specification status comment indexed database api 2.0the definition of 'count()' in that specification. recommendation indexed database api draftthe definition of 'count()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat...
IDBObjectStore.getAll() - Web APIs
this idbobjectstore's transaction is inactive. dataerror the key or key range provided contains an invalid key or is null. invalidstateerror the idbobjectstore has been deleted or removed. a typeerror exception is thrown if the count parameter is not between 0 and 232-1 included. specifications specification status comment indexed database api draftthe definition of 'getall()' in that specification. recommendation initial definition ...
IDBObjectStore.getAllKeys() - Web APIs
recommendation initial definition ...
IDBTransaction.objectStoreNames - Web APIs
the objectstorenames read-only property of the idbtransaction interface returns a domstringlist of names of idbobjectstore objects. syntax var mydatabase = transactionobj.objectstorenames; returns a domstringlist of names of idbobjectstore objects. specification specification status comment indexed database api 2.0the definition of 'objectstorenames' in that specification. recommendation indexed database api draftthe definition of 'objectstorenames' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechrome...
IDBTransaction.commit() - Web APIs
recommendation unitial 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. desktopmobilechromeedgefirefoxinterne...
IDBVersionChangeRequest - Web APIs
warning: the latest specification does not include this interface anymore as the idbdatabase.setversion() method has been removed. see the compatibility table for version details. the new way to do it is to use the idbopendbrequest interface which has now the onblocked handler and the newly needed onupgradeneeded one. the idbversionchangerequest interface the indexeddb api represents a request to change the version of a database. it is used only by the setversion() method of idbdatabase. methods inherits from: idbrequest idbversionchangerequest.setversion updates the version of the database. returns immediately and runs a versionchange transaction on the connected database in a separate thread. attributes attribute type description onblocked function...
ImageData() - Web APIs
ven, an image with a transparent black rectangle of the specified width and height will be created. width an unsigned long representing the width of the image. height an unsigned long representing the height of the image. this value is optional if an array is given: the height will be inferred from the array's size and the given width. return value a new imagedata object. errors thrown indexsizeerror thrown if array is specified, but its length is not a multiple of (4 * width) or (4 * width * height). examples creating a blank imagedata object this example creates an imagedata object that is 200 pixels wide and 100 pixels tall, containing a total of 20,000 pixels. let imagedata = new imagedata(200, 100); // imagedata { width: 200, height: 100, data: uint8clampedarray[80000] } ...
KeyboardLayoutMap.keys - Web APIs
syntax iterator = keyboardlayoutmap.keys value an iterator. ...
KeyboardLayoutMap.values - Web APIs
syntax var iterator = keyboardlayoutmap.values value an iterator. ...
KeyboardLayoutMap - Web APIs
ation. properties keyboardlayoutmap.entries read only returns an array of a given object's own enumerable property [key, value] pairs, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). keyboardlayoutmap.keys read only returns a new array iterator object that contains the keys for each index in the array. keyboardlayoutmap.size read only returns the number of elements in the keyboardlayoutmap object. keyboardlayoutmap.values read only returns a new array iterator object that contains the values for each index in the keyboardlayoutmap object. methods keyboardlayoutmap.foreach() read only executes a provided function once for each element of keyboardlayoutmap. keybo...
Location - Web APIs
Web › API › Location
ointer;} [title]:before {content:attr(title); font-family:monospace; position:absolute; top:100%; width:100%; left:50%; margin-left:-50%; font-size:40%; line-height:1.5; background:black;} [title]:hover:before, :target:before {background:black; color:yellow;} [title] [title]:before {margin-top:1.5em;} [title] [title] [title]:before {margin-top:3em;} [title]:hover, :target {position:relative; z-index:1; outline:50em solid rgba(255,255,255,.8);} javascript [].foreach.call(document.queryselectorall('[title][id]'), function (node) { node.addeventlistener("click", function(e) { e.preventdefault(); e.stoppropagation(); window.location.hash = '#' + $(this).attr('id'); }); }); [].foreach.call(document.queryselectorall('[title]'), function (node) { node.addeventlistener("click", f...
LockManager.request() - Web APIs
ame is held, other "shared" locks for the same name can be granted, but no "exclusive" locks with that name can be held or granted. this shared/exclusive lock pattern is common in database transaction architecture, for example to allow multiple simultaneous readers (each requests a "shared" lock) but only one writer (a single "exclusive" lock). this is known as the readers-writer pattern. in the indexeddb api, this is exposed as "readonly" and "readwrite" transactions which have the same semantics. syntax lockmanager.request(var promise = name[, {options}], callback) parameters name an identifier for the lock you want to request. options optional an object describing characteristics of the lock you want to create. valid values are: mode optional: either "exclusive" or "shared". th...
LockedFile.location - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the location property is a zero-based index representing the position of the read/write pointer within the file. its value indicates at which bytes within the file any write or read operation will start. this value is changed automatically after every read and write operation. the special value null means end-of-file. this property can be changed at will. syntax var location = instanceoflockedfile.location value a number. specifications specification status comment ...
LockedFile.truncate() - Web APIs
d is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the truncate method is used to remove some data within the file. if the method is called with no argument, the operation removes all the bytes starting at the index set in lockedfile.location. if the method is called with an argument, the operation removes all the bytes starting at the index corresponding to the parameter and regardless of the value of lockedfile.location. syntax var request = instanceoflockedfile.truncate(start); parameters start optional a number representing the index where to start the operation. return a filerequest object to...
MediaKeyStatusMap.forEach() - Web APIs
operty of the mediakeystatusmap interface calls callback once for each key-value pair in the status map, in insertion order. if an argument is present it will be passed to the callback. syntax mediakeystatusmap.foreach(callback[, thisarg]) parameters callback function to execute for each element, taking three arguments: currentvalue the current element being processed in the array. index the index of the current element being processed in the array. array which array foreach() is being applied to. thisarg optional value used as this when executing callback. returns undefined. specifications specification status comment encrypted media extensions recommendation initial definition. browser compatibility the compatibility table...
MediaList - Web APIs
Web › API › MediaList
st as text, and also allows you to set a new medialist. medialist.length read only returns the number of media queries in the medialist. methods medialist.appendmedium() adds a media query to the medialist. medialist.deletemedium() removes a media query from the medialist. medialist.item() a getter that returns a cssomstring representing a media query as text, given the media query's index value inside the medialist. examples the following would log to the console a textual representation of the medialist of the first stylesheet applied to the current document. const stylesheets = document.stylesheets; let stylesheet = stylesheets[0]; console.log(stylesheet.media.mediatext); specifications specification status comment css object model (cssom)the defini...
MimeTypeArray - Web APIs
mimetypearray.nameditem() returns the mimetype object with the specified name. ...
NameList - Web APIs
Web › API › NameList
wsers, its use is discouraged since it could be removed at any time. try to avoid using it. note: although this interface was previously implemented in gecko, there was no way to actually create one. namelist has been removed, effective with gecko 10.0 the namelist interface provides an abstraction for an ordered collection of name and namespace value pairs. items can be accessed by a 0-based index. the dom spec does not specify how the collection is to be implemented. properties namelist.length read only methods namelist.contains() returns a boolean. namelist.containsns() returns a boolean. namelist.getname() returns a domstring. namelist.getnamespaceuri() returns a domstring. specifications specification status comment document object model (dom...
Navigator.getGamepads() - Web APIs
the navigator.getgamepads() method returns an array of gamepad objects, one for each gamepad connected to the device. elements in the array may be null if a gamepad disconnects during a session, so that the remaining gamepads retain the same index. syntax var gamepads = navigator.getgamepads(); example window.addeventlistener("gamepadconnected", function(e) { var gp = navigator.getgamepads()[e.gamepad.index]; console.log( "gamepad connected at index %d: %s. %d buttons, %d axes.", gp.index, gp.id, gp.buttons.length, gp.axes.length ); }); specifications specification status comment gamepadthe definition of 'the gamepad api specification' in that specification. working draft initial definition. ...
NavigatorPlugins.mimeTypes - Web APIs
returns a mimetypearray object, which contains a list of mimetype objects representing the mime types recognized by the browser. note: named properties of mimetypearray objects are no longer enumerable in the latest browser versions. syntax var mimetypes[] = navigator.mimetypes; mimetypes is a mimetypearray object which has a length property as well as item(index) and nameditem(name) methods. example function isjavapresent() { return 'application/x-java-applet' in navigator.mimetypes; } function getjavaplugindescription() { var mimetype = navigator.mimetypes['application/x-java-applet']; if (mimetype === undefined) { // no java plugin present return undefined; } return mimetype.enabledplugin.description; } specifications specification status commen...
NavigatorPlugins.plugins - Web APIs
ange does not disable any plugins; it just hides some plugin names from enumeration. syntax var plugins = navigator.plugins; plugins is pluginarray object used to access plugin objects either by name or as a list of items. the returned value is not a javascript array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and nameditem("name") methods. examples the following example function returns the version of the shockwave flash plugin. function getflashversion() { var flash = navigator.plugins.nameditem('shockwave flash'); if (typeof flash != 'object') { // flash is not present return undefined; } if(flash.version){ return flash.version; } else { //no version property (e.g. in c...
NavigatorStorage - Web APIs
navigator.storage property, which provides access to the storagemanager singleton used for controlling the persistence of data stores as well as obtaining information note: this feature is available in web workers. there are many apis which provide ways for web content to store data on a user's computer, including cookies, the web storage api (window.localstorage and window.sessionstorage), and indexeddb. the storage standard is designed to serve as a common basis for the implementation of all of those apis and storage technologies, so that their constraints and configurations can be understood and controlled using a common set of methods and properties. properties storage read only secure context returns the storagemanager singleton object which is used to access the storage manager. th...
Node.isConnected - Web APIs
Web › API › Node › isConnected
* no warranty expressed or implied. use at...
Node - Web APIs
Web › API › Node
we use a wrapper function named grep to do the searching: function grep(parentnode, pattern) { const matches = [] let endscan = false eachnode(parentnode, function(node){ if (endscan) { return false } // ignore anything which isn't a text node if (node.nodetype !== node.text_node) { return } if (typeof pattern === "string") { if (-1 !== node.textcontent.indexof(pattern)) { matches.push(node) } } else if (pattern.test(node.textcontent)) { if (!pattern.global) { endscan = true matches = node } else { matches.push(node) } } }) return matches } for example, to find text nodes that contain typos: const typos = ["teh", "adn", "btu", "adress", "youre", "msitakes"] const pattern = new re...
NodeList - Web APIs
Web › API › NodeList
ct the content of the collection. the ubiquitous document.queryselectorall() method returns a static nodelist. it's good to keep this distinction in mind when you choose how to iterate over the items in the nodelist, and whether you should cache the list's length. properties nodelist.length the number of nodes in the nodelist. methods nodelist.item() returns an item in the list by its index, or null if the index is out-of-bounds. an alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. nodelist.entries() returns an iterator, allowing code to go through all key/value pairs contained in the collection. (in this case, the keys are numbers starting from 0 and the values are nodes.
Using the Notifications API - Web APIs
use cases for web notifications is a web-based mail or irc application that needs to notify the user when a new message is received, even if the user is doing something else with another application. many examples of this now exist, such as slack. we've written a real world example — a to-do list app — to give more of an idea of how web notifications can be used. it stores data locally using indexeddb and notifies users when tasks are due using system notifications. download the to-do list code, or view the app running live. requesting permission before an app can send a notification, the user must grant the application the right to do so. this is a common requirement when an api tries to interact with something outside a web page — at least once, the user needs to specifically grant t...
Page Visibility API - Web APIs
ling behavior. in these cases, you can use the page visibility api to reduce the tabs' performance impact while they're hidden. tabs which are playing audio are considered foreground and aren’t throttled. tabs running code that's using real-time network connections (websockets and webrtc) go unthrottled in order to avoid closing these connections timing out and getting unexpectedly closed. indexeddb processes are also left unthrottled in order to avoid timeouts. example view live example (video with sound). the example, which pauses the video when you switch to another tab and plays again when you return to its tab, was created with the following code: // set the name of the hidden property and the change event for visibility var hidden, visibilitychange; if (typeof document.hidden ...
PaymentAddress.addressLine - Web APIs
artment number, rural delivery route, descriptive instructions, or post office box. syntax var paymentaddresslines = paymentaddress.addressline; value an array of domstring objects, each containing one line of the address. ...
PaymentAddress.postalCode - Web APIs
syntax var paymentpostalcode = paymentaddress.postalcode; value a domstring which contains the postal code portion of the address. a postal code is a string (either numeric or alphanumeric) which is used by a postal service to optimize mail routing and delivery. various countries use different terms for this. ...
Plugin - Web APIs
Web › API › Plugin
ger enumerable in the latest browser versions. properties plugin.description read only a human readable description of the plugin. plugin.filename read only the filename of the plugin file. plugin.name read only the name of the plugin. plugin.version read only the plugin's version number string. methods plugin.item returns the mime type of a supported content type, given the index number into a list of supported types. plugin.nameditem returns the mime type of a supported item. specifications specification status comment html living standardthe definition of 'plugin' in that specification. living standard initial definition. ...
PluginArray - Web APIs
the pluginarray interface is used to store a list of plugin objects describing the available plugins; it's returned by the window.navigator.plugins property. the pluginarray is not a javascript array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and nameditem("name") methods. note: own properties of pluginarray objects are no longer enumerable in the latest browser versions. properties pluginarray.lengthread only the number of plugins in the array. methods pluginarray.item returns the plugin at the specified index into the array. pluginarray.nameditem returns the plugin with the specified name. pluginarray.refresh refreshes all plugins on the current page, optionally reloading documents.
PublicKeyCredential.getClientExtensionResults() - Web APIs
ch 2019, only appid (used during creation with publickeycredentialrequestoptions.extensions) is supported by chrome and edge. firefox does not seem to support any extension. ...
PublicKeyCredentialCreationOptions.extensions - Web APIs
selection. restricts the list of authenticator models which may be used. if no matching authenticator is available, the credential is still generated with another available authenticator. exts boolean supported extensions. if true, the client outputs an array of strings containing the extensions which are supported by the authenticator. uvi boolean user verification index. if true, the client outputs an arraybuffer which contains a value uniquely identifying a user verification data record. in other words, this may be used server side to check if the current operation is based on the same biometric data that the previous authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authent...
PublicKeyCredentialRequestOptions.extensions - Web APIs
splay an image or some non-textual content on the authenticator before verifying the user or testing their presence. the contenttype gives the mime type of the resource to be displayed while content gives its actual content. the client outputs the hash of the content which was displayed (hashing with the same algorithm which is used for the signature). uvi boolean user verification index. if true, the client outputs an arraybuffer which contains a value uniquely identifying a user verification data record. in other words, this may be used server side to check if the current operation is based on the same biometric data that the previous authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authent...
PushManager.subscribe() - Web APIs
sponding 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 pushsubscription 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) { var options = { uservisibleonly: true, applicationserverkey: applicationserverkey }; serviceworkerregist...
PushManager - Web APIs
strations() retrieves existing push subscriptions. replaced by pushmanager.getsubscription(). pushmanager.unregister() unregisters and deletes a specified subscription endpoint. in the updated api, a subscription is unregistered by calling the pushsubscription.unsubscribe() method. 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').then( function(serviceworkerregistration) { serviceworkerregistration.pushmanager.subscribe().then( function(pushsubscription) { console.log(pushsubscription.endpoint); // the push subscription details needed by the application // server a...
RTCIceCandidate.priority - Web APIs
6 44323 typ host the priority is the number after the protocol, so it's the fourth field in the candidate string. in this example, the priority is 2043278322. example this candidate examines the priority of the candidate and, if it's greater than the priority of a previously-seen candidate, remembers the candidate for later use. ...
RTCIceCandidate.sdpMid - Web APIs
e of sdpmid is extracted from the specified candidate m-line string. syntax var sdpmid = rtcicecandidate.sdpmid; value a domstring which uniquely identifies the source media component from which the candidate draws data, or null if no such association exists for the candidate. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.sdpmid' in that specification. candidate recommendation initial definition. ...
RTCIceCandidate - Web APIs
tedport 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 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 description (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 rtcicecand...
RTCIceCandidateInit.sdpMid - Web APIs
sdpmid in the rtcicecandidateinit dictionary specifies the value of the rtcicecandidate object's sdpmid property. value a domstring which uniquely identifies the source media component from which the candidate draws data, or null if no such association exists for the candidate. note: attempting to add a candidate (using addicecandidate()) that has a value of null for either sdpmid or sdpmlineindex will throw a typeerror exception. example ... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidateinit.sdpmid' in that specification. candidate recommendation initial specification. ...
RTCIceCandidateInit - Web APIs
ate optional the ice candidate-attribute. if the candidate is an indicator that there are no further candidates (rather than representing a new candidate), this is the empty string (""). the default is the empty string. sdpmid optional the identification tag of the media stream with which the candidate is associated, or null if there is no associated media stream. the default is null. sdpmlineindex optional the zero-based index of the m-line within the sdp of the media description with which the candidate is associated, or null if no such associated exists. the default is null. usernamefragment optional a domstring containing a string which uniquely identifies the remote peer. this string is generated by webrtc at the beginning of the session, and at least 24 bits worth of the string con...
RTCIceTransport.getLocalCandidates() - Web APIs
match found so far, call rtcicetransport.getselectedcandidatepair(). example this simple example gets the local candidate list from the rtcicetransport for the first rtcrtpsender on the rtcpeerconnection, then outputs to the console all of the candidates in the list. var localcandidates = pc.getsenders()[0].transport.transport.getlocalcandidates(); localcandidates.foreach(function(candidate, index)) { console.log("candidate " + index + ": " + candidate.candidate); }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.getlocalcandidates()' in that specification. candidate recommendation initial definition. ...
RTCIceTransport.getRemoteCandidates() - Web APIs
ch found so far, call rtcicetransport.getselectedcandidatepair(). example this simple example gets the remote candidate list from the rtcicetransport for the first rtcrtpsender on the rtcpeerconnection, then outputs to the console all of the candidates in the list. var remotecandidates = pc.getsenders()[0].transport.transport.getremotecandidates(); remotecandidates.foreach(function(candidate, index)) { console.log("candidate " + index + ": " + candidate.candidate); }); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.getremotecandidates()' in that specification. candidate recommendation initial definition. ...
RTCInboundRtpStreamStats.qpSum - Web APIs
erage from there. see calculating average quantization below for a function that does this. also, the exact meaning of the qp value depends on the codec being used. for example, for the vp8 codec, the qp value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in rfc 6386: 19.2. h.264 uses a qp which ranges from 0 to 51; in this case, it's an index used to derive a scaling matrix used during the quantization process. additionally, qp is not likely to be the only parameter the codec uses to adjust the compression. see the individual codec specifications for details. example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcstats object that contains rtp stream statistic...
RTCOutboundRtpStreamStats.qpSum - Web APIs
erage from there. see calculating average quantization below for a function that does this. also, the exact meaning of the qp value depends on the codec being used. for example, for the vp8 codec, the qp value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in rfc 6386: 19.2. h.264 uses a qp which ranges from 0 to 51; in this case, it's an index used to derive a scaling matrix used during the quantization process. additionally, qp is not likely to be the only parameter the codec uses to adjust the compression. see the individual codec specifications for details. example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcstats object that contains rtp stream statistic...
RTCRtpStreamStats.qpSum - Web APIs
erage from there. see calculating average quantization below for a function that does this. also, the exact meaning of the qp value depends on the codec being used. for example, for the vp8 codec, the qp value can be anywhere from 1 to 127 and is found in the frame header element "y_ac_qi", whose value is defined in rfc 6386: 19.2. h.264 uses a qp which ranges from 0 to 51; in this case, it's an index used to derive a scaling matrix used during the quantization process. additionally, qp is not likely to be the only parameter the codec uses to adjust the compression. see the individual codec specifications for details. example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcrtpstreamstats object, returning 0 if the objec...
Range.getBoundingClientRect() - Web APIs
boundingrect = range.getboundingclientrect() example html <div id="highlight"></div> <p>this example positions a "highlight" rectangle behind the contents of a range. the range's content <b>starts here</b> and continues on until it <b>ends here</b>. ...
Range.setEnd() - Web APIs
Web › API › Range › setEnd
which the range should end. endoffset an integer greater than or equal to zero representing the offset for the end of the range from the start of endnode. return value undefined. exceptions exceptions are thrown as domexception objects of the following types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located inside a doctype node. indexsizeerror the value specified by endoffset is either greater than or equal to the length of the node or is less than zero. usage notes if the endnode is a node of type text, comment, or cdatasection, then endoffset is the number of characters from the start of endnode. for other node types, endoffset is the number of child nodes between the start of the endnode. example const range = documen...
ReadableStream.cancel() - Web APIs
t.done) { console.log('failed to find match'); return; } bytesreceived += result.value.length; console.log(`received ${bytesreceived} bytes of data so far`); buffer += decoder.decode(result.value, {stream: true}); // already found match & just context-gathering? if (matchfoundat === -1) { matchfoundat = (caseinsensitive ? ...
Response.useFinalURL - Web APIs
the usefinalurl property of the response interface contains a boolean stating whether this is the final url of the response. this property applies only to serviceworkers. in other contexts it will return undefined. syntax var isfinalurl = response.usefinalurl; value a boolean indicating whether or not the url is final rather than a redirect. example consider a script residing in page index.html: fetch('/test').then((r) => console.log(r.url)) test.html is being controlled by the service worker sw.js: onfetch = (e) => { e.respondwith(fetch('/page2').then((r) => { r.usefinalurl = true; return r; }) } the output will be /page2 and not /test in index.html, since setting the usefinalurl means that the response's url is not set to request's url. ...
SVGGraphicsElement: paste event - Web APIs
but this will not affect the document's contents. ...
SVGPathElement - Web APIs
ch this interface inherits it. svgpathelement.getpointatlength() returns an svgpoint representing the x and y coordinates in user space utilizing the browser's distance-along-a-path algorithm. note: in svg 2 this method was moved to the svggeometryelement interface, from which this interface inherits it. svgpathelement.getpathsegatlength() returns an unsigned long representing the index within the pathseglist utilizing the user agent's distance-along-a-path algorithm. svgpathelement.createsvgpathsegclosepath() returns a stand-alone, parentless svgpathsegclosepath object. svgpathelement.createsvgpathsegmovetoabs() returns a stand-alone, parentless svgpathsegmovetoabs object. svgpathelement.createsvgpathsegmovetorel() returns a stand-alone, parentless svgpathsegmovetor...
Selection.setBaseAndExtent() - Web APIs
beginning of the text rather the end, which matters for any keyboard command that might follow. for example, shift + ➡︎ would cause the selection to narrow from the beginning rather than grow at the end. return value void. exceptions if anchoroffset is larger than the number of child nodes inside anchornode, or if focusoffset is larger than the number of child nodes inside focusnode, an indexsizeerror exception is thrown. examples in this example, we have two paragraphs containing spans, each one containing a single word. the first one is set as the anchornode and the second is set as the focusnode. we also have an additional paragraph that sits in between the two nodes. next, we have two form inputs that allow you to set the anchoroffset and focusoffset — they both have a defaul...
ServiceWorkerGlobalScope: activate event - Web APIs
interface extendableevent event handler property serviceworkerglobalscope.onactivate examples the following snippet shows how you could use an activate event handler to upgrade a cache. globalscope.addeventlistener('activate', function(event) { var cachewhitelist = ['v2']; event.waituntil( caches.foreach(function(cache, cachename) { if (cachewhitelist.indexof(cachename) == -1) { return caches.delete(cachename); } }) ); }); you can also set up the event handler using the serviceworkerglobalscope.onactivate property: globalscope.onactivate = function(event) { ... }; specifications specification status comment service workersthe definition of 'activate' in that specification. working draft ...
ServiceWorkerGlobalScope: contentdelete event - Web APIs
the contentdelete event of the serviceworkerglobalscope interface is fired when an item is removed from the indexed content via the user agent. bubbles no cancelable no interface contentindexevent event handler property oncontentdelete examples the following example uses a contentdelete event handler to remove cached content related to the deleted index item. self.addeventlistener('contentdelete', event => { event.waituntil( caches.open('cache-name').then(cache => { return promise.all([ cache.delete(`/icon/${event.id}`), cache.delete(`/content/${event.id}`) ]) }) ); }); you can also set up the event handler using the serviceworkerglobalscope.ondelete property: sel...
ServiceWorkerGlobalScope: install event - Web APIs
globalscope.oninstall examples the following snippet shows how an install event handler can be used to populate a cache with a number of responses, which the service worker can then use to serve assets offline: this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.add( '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', '/sw-test/gallery/', '/sw-test/gallery/bountyhunters.jpg', '/sw-test/gallery/mylittlevader.jpg', '/sw-test/gallery/snowtroopers.jpg' ); }) ); }); you can also set up the event handler using the serviceworkerglobalscope...
ServiceWorkerGlobalScope.onactivate - Web APIs
be controlled by the service worker refreshes. syntax serviceworkerglobalscope.onactivate = function(event) { ... }; examples the following snippet shows how you could use an activate event handler to upgrade a cache. then.addeventlistener('activate', function(event) { var cachewhitelist = ['v2']; event.waituntil( caches.foreach(function(cache, cachename) { if (cachewhitelist.indexof(cachename) == -1) { return caches.delete(cachename); } }) ); }); specifications specification status comment service workersthe definition of 'event handlers' in that specification. working draft initial definition ...
ServiceWorkerGlobalScope.oncontentdelete - Web APIs
the oncontentdelete property of the serviceworkerglobalscope interface is an event handler fired when an item is removed from the indexed content via the user agent. syntax serviceworkerglobalscope.oncontentdelete = function(event) { ... }; examples the following example uses a contentdelete event handler to remove cached content related to the deleted index item. self.addeventlistener('contentdelete', event => { event.waituntil( caches.open('cache-name').then(cache => { return promise.all([ cache.delete(`/icon/${event.id}`), cache.delete(`/content/${event.id}`) ]) }) ); }); specifications specification status comment unknownthe definition of 'contentdelete' in that specification. unknown initial definiti...
ServiceWorkerGlobalScope.oninstall - Web APIs
= function(event) { ... ...
ServiceWorkerGlobalScope - Web APIs
he service worker's registration. serviceworkerglobalscope.caches read only contains the cachestorage object associated with the service worker. events activate occurs when a serviceworkerregistration acquires a new serviceworkerregistration.active worker. also available via the serviceworkerglobalscope.onactivate property. contentdelete occurs when an item is removed from the content index. also available via the serviceworkerglobalscope.oncontentdelete property. fetch occurs when a fetch() is called. also available via the serviceworkerglobalscope.onfetch property. install occurs when a serviceworkerregistration acquires a new serviceworkerregistration.installing worker. also available via the serviceworkerglobalscope.oninstall property. message occurs when incoming mess...
ServiceWorkerRegistration.pushManager - Web APIs
e returns a reference to the pushmanager interface for managing push subscriptions; this includes support for subscribing, getting an active subscription, and accessing push permission status. syntax var pushmanager = serviceworkerregistration.pushmanager; value a pushmanager object. examples this.onpush = function(event) { console.log(event.data); // from here we can write the data to indexeddb, send it to any open // windows, display a notification, etc. } navigator.serviceworker.register('serviceworker.js').then( function(serviceworkerregistration) { serviceworkerregistration.pushmanager.subscribe().then( function(pushsubscription) { console.log(pushsubscription.subscriptionid); console.log(pushsubscription.endpoint); // the push subscription...
ServiceWorkerRegistration - Web APIs
serviceworkerregistration.pushmanager read only returns a reference to the pushmanager interface for managing push subscriptions including subscribing, getting an active subscription, and accessing push permission status. serviceworkerregistration.sync read only returns a reference to the syncmanager interface, which manages background synchronization processes. serviceworkerregistration.index read only returns a reference to the contentindex interface, for managing indexed content for offline viewing. unimplemented properties serviceworkerregistration.periodicsync read only returns a reference to the periodicsyncmanager interface, which manages periodic background synchronization processes. this was mentioned as an idea in the sw explainer at some point, but as yet has not...
SourceBufferList - Web APIs
} properties sourcebufferlist.length read only returns the number of sourcebuffer objects in the list. event handlers sourcebufferlist.onaddsourcebuffer the event handler for the addsourcebuffer event. sourcebufferlist.onremovesourcebuffer the event handler for the removesourcebuffer event. methods inherits methods from its parent interface, eventtarget. sourcebufferlist: indexed property getter this getter allows the sourcebuffer objects in the list to be accessed with an array operator (i.e. [].) examples tbd. specifications specification status comment media source extensionsthe definition of 'sourcebufferlist' in that specification. recommendation initial definition. ...
SpeechRecognitionEvent - Web APIs
recognition result. properties speechrecognitionevent also inherits properties from its parent interface, event. speechrecognitionevent.emma read only returns an extensible multimodal annotation markup language (emma) — xml — representation of the result. speechrecognitionevent.interpretation read only returns the semantic meaning of what the user said. speechrecognitionevent.resultindex read only returns the lowest index value result in the speechrecognitionresultlist "array" that has actually changed. speechrecognitionevent.results read only returns a speechrecognitionresultlist object representing all the speech recognition results for the current session. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { ...
SpeechSynthesisEvent.utterance - Web APIs
the utterance read-only property of the speechsynthesisutterance interface returns the speechsynthesisutterance instance that the event was triggered on. syntax event.utterance; value a speechsynthesisutterance object. examples utterthis.onpause = function(event) { var char = event.utterance.text.charat(event.charindex); console.log('speech paused at character ' + event.charindex + ' of "' + event.utterance.text + '", which is "' + char + '".'); } specifications specification status comment web speech apithe definition of 'utterance' in that specification. draft ...
Storage.key() - Web APIs
Web › API › Storage › key
the key() method of the storage interface, when passed a number n, returns the name of the nth key in a given storage object. the order of keys is user-agent defined, so you should not rely on it. syntax var akeyname = storage.key(index); parameters index an integer representing the number of the key you want to get the name of. this is a zero-based index. return value a domstring containing the name of the key. if the index does not exist, null is returned. examples the following function iterates over the local storage keys: function foreachkey(callback) { for (var i = 0; i < localstorage.length; i++) { callback(localstorage.key(i)); } } the following function iterates over the local storage keys and gets the value set for each key: for(var i =0; i < localstorage.lengt...
Storage Access API - Web APIs
xample (e.g. scripts, 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 cache, and so on. in firefox, the storage access grants are phased out after 30 calendar days passing, whereas in safari 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...
StylePropertyMapReadOnly.values() - Web APIs
syntax stylepropertymapreadonly.values() parameters none. return value a new array. ...
StylePropertyMapReadOnly - Web APIs
lue objects containing the values for the provided property. stylepropertymapreadonly.has() indicates whether the specified property is in the stylepropertymapreadonly object. stylepropertymapreadonly.keys() returns a new array iterator containing the keys for each item in stylepropertymapreadonly. stylepropertymapreadonly.values() returns a new array iterator containing the values for each index in the stylepropertymapreadonly object. examples we have to have an element to observe: <p> this is a paragraph with some text. we can add some css, or not. the style map will include all the default and inherted css property values. </p> <dl id="output"></dl> we add a touch of css with a custom property to better demonstrate the output: p { --somevariable: 1.6em; --someothervar...
SubtleCrypto - Web APIs
which exports the key and then encrypts it using another key; the api calls a "key-wrapping key". the inverse of wrapkey() is unwrapkey(), which decrypts then imports the key. storing keys cryptokey objects can be stored using the structured clone algorithm, meaning that you can store and retrieve them using standard web storage apis. the specification expects that most developers will use the indexeddb api to store cryptokey objects. supported algorithms the cryptographic functions provided by the web crypto api can be performed by one or more different cryptographic algorithms: the algorithm argument to the function indicates which algorithm to use. some algorithms need extra parameters: in these cases the algorithm argument is a dictionary object that includes the extra parameters. the...
TextMetrics - Web APIs
actualboundingboxascent', 'emheightascent', 'hangingbaseline']; const baselinesbelowalphabetic = ['ideographicbaseline', 'emheightdescent', 'actualboundingboxdescent', 'fontboundingboxdescent']; const baselines = [...baselinesabovealphabetic, ...baselinesbelowalphabetic]; ctx.font = '25px serif'; ctx.strokestyle = 'red'; baselines.foreach(function (baseline, index) { let text = 'abcdefghijklmnop (' + baseline + ')'; let textmetrics = ctx.measuretext(text); let y = 50 + index * 50; ctx.beginpath(); ctx.filltext(text, 0, y); let liney = y - math.abs(textmetrics[baseline]); if (baselinesbelowalphabetic.includes(baseline)) { liney = y + math.abs(textmetrics[baseline]); } ctx.moveto(0, liney); ctx.lineto(550, liney); ctx.stroke(); });...
TextTrack.mode - Web APIs
Web › API › TextTrack › mode
so that every time a cue is finished, the video automatically pauses playback. this is done by setting the pauseonexit property on each cue to true. however, to ensure that the track's cues are available, we first set mode to showing. window.addeventlistener("load", event => { let trackelem = document.queryselector("track"); let track = trackelem.track; track.mode = "showing"; for (let index=0; index < track.cues.length; index++) { let cue = track.cues[index]; cue.pauseonexit = true; }; }); specifications specification status comment html living standardthe definition of 'mode' in that specification. living standard ...
TimeRanges.end() - Web APIs
Web › API › TimeRanges › end
returns the time offset at which a specified time range ends. syntax endtime = timeranges.end(index) parameters index is the range number to return the ending time for. exceptions index_size_err a domexception thrown if the specified index doesn't correspond to an existing range. example given a video element with the id "myvideo": var v = document.getelementbyid("myvideo"); var buf = v.buffered; var numranges = buf.length; if (buf.length == 1) { // only one range if (buf.start(0) == 0 && buf.end(0) == v.duration) { // the one range starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } this example looks at the time ranges and looks to see if the entire video has been loaded. specifications specification ...
TimeRanges.start() - Web APIs
Web › API › TimeRanges › start
returns the time offset at which a specified time range begins. syntax starttime = timeranges.start(index) parameters index is the range number to return the starting time for. exceptions index_size_err a domexception thrown if the specified index doesn't correspond to an existing range. example given a video element with the id "myvideo": var v = document.getelementbyid("myvideo"); var buf = v.buffered; var numranges = buf.length; if (buf.length == 1) { // only one range if (buf.start(0) == 0 && buf.end(0) == v.duration) { // the one range starts at the beginning and ends at // the end of the video, so the whole thing is loaded } } this example looks at the time ranges and looks to see if the entire video has been loaded. specifications specifica...
TouchList - Web APIs
Web › API › TouchList
rackpad), the corresponding touchlist object would have one touch object for each finger, for a total of three entries. properties touchlist.length read only the number of touch objects in the touchlist. methods touchlist.identifiedtouch() returns the first touch item in the list whose identifier matches a specified value. touchlist.item() returns the touch object at the specified index in the list. example see the example on the main touch events article. specifications specification status comment touch events – level 2 draft non-stable version. touch events recommendation initial definition. ...
TrackDefaultList.TrackDefault() - Web APIs
the trackdefault() getter method of the trackdefaultlist interface allows the trackdefault objects in the list to be accessed with an array operator (i.e. [].) syntax var mytrackdefault = trackdefaultlist[index]; parameters index the index position of the trackdefault object you want to return. returns a trackdefault object. errors no specific errors are returned, but if the supplied index is great than or equal to trackdefaultlist.length, the operation will return undefined. example tbd. ...
USBAlternateInterface - Web APIs
rns the protocol supported by this interface. this is equal to the binterfaceprotocol field of the interface descriptor defining this interface. the meaning of this value depends on the interfaceclass and interfacesubclass fields. usbalternateinterface.interfacenameread only returns the name of the interface, if one is provided by the device. this is the value of the string descriptor with the index specified by the iinterface field of the interface descriptor defining this interface. usbalternateinterface.endpointsread only returns an array containing instances of the usbendpoint interface describing each of the endpoints that are part of this interface. specifications specification status comment webusbthe definition of 'usbalternateinterface' in that specific...
USBConfiguration.configurationName - Web APIs
the configurationname read-only property of the usbconfiguration interface returns the name provided by the device to describe this configuration. this is equal to the value of the string descriptor with the index provided in the iconfiguration field of the configuration descriptor defining this configuration. syntax var name = usbconfiguration.configurationname value the name provided by the device to describe this configuration. specifications specification status comment unknownthe definition of 'configurationname' in that specification. unknown initial definition. ...
USBConfiguration - Web APIs
ion.configurationvalueread only returns the configuration value of this configuration. this is equal to the bconfigurationvalue field of the configuration descriptor provided by the device defining this configuration. usbconfiguration.configurationnameread only returns the name provided by the device to describe this configuration. this is equal to the value of the string descriptor with the index provided in the iconfiguration field of the configuration descriptor defining this configuration. usbconfiguration.interfacesread only returns an array containing instances of the usbinterface describing each interface supported by this configuration. specifications specification status comment webusbthe definition of 'usbconfiguration' in that specification. draf...
USBDevice.claimInterface() - Web APIs
interfaces are device-specific. return value a promise. example the following example shows claiminterface() in the context of connecting to a usb device. ...
USBDevice.controlTransferIn() - Web APIs
are: requesttype: must be one of three values specifying whether the tranfer is "standard" (common to all usb devices) "class" (common to an industry-standard class of devices) or "vendor". recipient: specifices the target of the transfer on the device, one of "device", "interface", "endpoint", or "other". request: a vendor-specific command. value: vender-specific request parameters. index: the interface number of the recipient. length the maximum number of bytes to read from the device. the actual data is in the usbintransferresult in the resolved promise. return value promise that resolves with a usbintransferresult. specifications specification status comment webusbthe definition of 'controltransferin()' in that specification. draft initi...
USBDevice.controlTransferOut() - Web APIs
are: requesttype: must be one of three values specifying whether the tranfer is "standard" (common to all usb devices) "class" (common to an industry-standard class of devices) or "vendor". recipient: specifices the target of the transfer on the device, one of "device", "interface", "endpoint", or "other". request: a vendor-specific command. value: vender-specific request parameters. index: the interface number of the recipient. data a typedarray containing the data that will be transfered to the device. not all commands require data; some commands can send data just through the value parameter. check with your device to see what the specific request requires. return value a promise that resolves with a usbouttransferresult. specifications specification statu...
USBDevice.opened - Web APIs
Web › API › USBDevice › opened
particular and unique to each device. async setdevicecolor(usbdevice, r, g, b) { if (device.opened) { // this hypothetical usb device requires that the data passed to // it be in a uint8array. let payload = new uint8array([r, g, b]); await usbdevice.controltransferout({ requesttype: 'vendor', recipient: 'device', request: 1, value: 0, index: 0, }, payload); } } specifications specification status comment webusbthe definition of 'opened' in that specification. draft initial definition. ...
USBDevice.releaseInterface() - Web APIs
the releaseinterface() method of the usbdevice interface returns a promise that resolves when a cliamed interface is released from exclusive access. syntax var promise = usbdevice.releaseinterface(interfacenumber) parameters interfacenumber the device-specific index of the currently-claimed interface. return value a promise. specifications specification status comment webusbthe definition of 'releaseinterface()' in that specification. draft initial definition. ...
USBDevice.selectAlternateInterface() - Web APIs
the selectalternateinterface() method of the usbdevice interface returns a promise that resolves when the specified alternative endpoint is selected. syntax var promise = usbdevice.selectalternateinterface(interfacenumber, alternatesetting) parameters interfacenumber the index of one of the interfaces supported by the device. interfaces are device-specific. alternatesetting the configuration of the selected interface. return value a promise. specifications specification status comment webusbthe definition of 'selectalternateinterface()' in that specification. draft initial definition. ...
VideoTrackList - Web APIs
each track represented by a separate videotrack object in the list. retrieve an instance of this object with htmlmediaelement.videotracks. the individual tracks can be accessed using array syntax or functions such as foreach() for example. properties this interface also inherits properties from its parent interface, eventtarget. length read only the number of tracks in the list. selectedindex read only the index of the currently selected track, if any, or −1 otherwise. event handlers onaddtrack an event handler to be called when the addtrack event is fired, indicating that a new video track has been added to the media element. onchange an event handler to be called when the change event occurs — that is, when the value of the selected property for a track has changed, du...
WebGL2RenderingContext.bindSampler() - Web APIs
sampler a webglsampler object to bind. return value none. examples var sampler = gl.createsampler(); gl.bindsampler(0, sampler); specifications specification status comment webgl 2.0the definition of 'bindsampler' in that specification. ...
WebGL2RenderingContext.drawArraysInstanced() - Web APIs
gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. instancecount a glsizei specifying the number of instances of the range of elements to execute. return value none. examples gl.drawarraysinstanced(gl.points, 0, 8, 4); specifications specification status comment webgl 2.0the definition of 'drawarraysinstanced' in tha...
WebGL2RenderingContext.drawElementsInstanced() - Web APIs
t. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must be a valid multiple of the size of the given type. instancecount a glsizei specifying the number of instances of the set of elements to execute. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset ...
WebGL2RenderingContext.drawRangeElements() - Web APIs
l.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. start a gluint specifying the minimum array index contained in offset. end a gluint specifying the maximum array index contained in offset. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short gl.unsigned_int offset a glintptr specifying an offset in the element array buffer. must b...
WebGL2RenderingContext.getActiveUniforms() - Web APIs
webglprogram containing the active uniforms. uniformindices an array of gluint specifying the indices of the active uniforms to query. pname a glenum specifying which information to query. possible values: gl.uniform_type: returns an array of glenum indicating the types of the uniforms. gl.uniform_size: returns an array of gluint indicating the sizes of the uniforms. gl.uniform_block_index: returns an array of glint indicating the block indices of the uniforms. gl.uniform_offset: returns an array of glint indicating the uniform buffer offsets. gl.uniform_array_stride: returns an array of glint indicating the strides between the elements. gl.uniform_matrix_stride: returns an array of glint indicating the strides between columns of a column-major matrix or a row-major matrix. ...
WebGL2RenderingContext.getBufferSubData() - Web APIs
or storing uniform blocks. gl.pixel_pack_buffer: buffer used for pixel transfer operations. gl.pixel_unpack_buffer: buffer used for pixel transfer operations. srcbyteoffset a glintptr specifying the byte offset from which to start reading from the buffer. dstdata an arraybuffer or sharedarraybuffer to which to write the buffer data. srcoffset optional a gluint specifying the element index offset where to start reading the buffer. length optional a gluint defaulting to 0. return value none. exceptions an invalid_value error is generated if: offset + returneddata.bytelength would extend beyond the end of the buffer returneddata is null offset is less than zero. an invalid_operation error is generated if: zero is bound to target target is transform_feedback_buffer, ...
WebGL2RenderingContext.renderbufferStorageMultisample() - Web APIs
height a glsizei specifying the height of the renderbuffer in pixels. return value none. examples gl.renderbufferstoragemultisample(gl.renderbuffer, 4, gl.rbga4, 256, 256); specifications specification status comment webgl 2.0the definition of 'glrenderbufferstoragemultisample' in that spe...
WebGL2RenderingContext.vertexAttribDivisor() - Web APIs
the webgl2renderingcontext.vertexattribdivisor() method of the webgl 2 api modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with gl.drawarraysinstanced() and gl.drawelementsinstanced(). note: when using webgl 1, the angle_instanced_arrays extension can provide this method, too. syntax void gl.vertexattribdivisor(index, divisor); parameters index a gluint specifying the index of the generic vertex attributes. divisor a gluint specifying the number of instances that will pass between updates of the generic attribute. return value none. examples gl.vertexattribdivisor(0, 2); specifications specification status comment webgl 2.0the definition of 'vertexattribdivisor' in that specifica...
WebGLActiveInfo.name - Web APIs
the read-only webglactiveinfo.name property represents the name of the requested data returned by calling the getactiveattrib() or getactiveuniform() methods. examples var activeattrib = gl.getactiveattrib(program, index); activeattrib.name; var activeuniform = gl.getactiveuniform(program, index); activeuniform.name; specifications specification status comment webgl 1.0the definition of 'webglactiveinfo.name' in that specification. recommendation initial definition. ...
WebGLActiveInfo.size - Web APIs
the read-only webglactiveinfo.size property is a number representing the size of the requested data returned by calling the getactiveattrib() or getactiveuniform() methods. examples var activeattrib = gl.getactiveattrib(program, index); activeattrib.size; var activeuniform = gl.getactiveuniform(program, index); activeuniform.size; specifications specification status comment webgl 1.0the definition of 'webglactiveinfo.size' in that specification. recommendation initial definition. ...
WebGLActiveInfo.type - Web APIs
the read-only webglactiveinfo.type property represents the type of the requested data returned by calling the getactiveattrib() or getactiveuniform() methods. examples var activeattrib = gl.getactiveattrib(program, index); activeattrib.type; var activeuniform = gl.getactiveuniform(program, index); activeuniform.type; specifications specification status comment webgl 1.0the definition of 'webglactiveinfo.type' in that specification. recommendation initial definition. ...
WebGLActiveInfo - Web APIs
. webglactiveinfo.size the read-only size of the requested variable. webglactiveinfo.type the read-only type of the requested variable. examples a webglactiveinfo object is returned by: webglrenderingcontext.getactiveattrib() webglrenderingcontext.getactiveuniform() or webgl2renderingcontext.gettransformfeedbackvarying() webglactiveinfo? getactiveattrib(webglprogram? program, gluint index); webglactiveinfo? getactiveuniform(webglprogram? program, gluint index); webglactiveinfo? gettransformfeedbackvarying(webglprogram? program, gluint index) specifications specification status comment webgl 1.0the definition of 'webglactiveinfo' in that specification. recommendation initial definition. ...
WebGLRenderingContext.bufferData() - Web APIs
are intended to be respecified repeatedly by reading data from webgl, and used many times as the source for webgl drawing and image specification commands. gl.stream_copy: the contents are intended to be specified once by reading data from webgl, and used at most a few times as the source for webgl drawing and image specification commands. srcoffset a gluint specifying the element index offset where to start reading the buffer. length optional a gluint defaulting to 0. return value none. exceptions a gl.out_of_memory error is thrown if the context is unable to create a data store with the given size. a gl.invalid_value error is thrown if size is negative. a gl.invalid_enum error is thrown if target or usage are not one of the allowed enums. examples using bufferdat...
WebGLRenderingContext.bufferSubData() - Web APIs
used for pixel transfer operations. gl.pixel_unpack_buffer: buffer used for pixel transfer operations. dstbyteoffset a glintptr specifying an offset in bytes where the data replacement will start. srcdata optional an arraybuffer, sharedarraybuffer or one of the arraybufferview typed array types that will be copied into the data store. srcoffset a gluint specifying the element index offset where to start reading the buffer. length optional a gluint defaulting to 0. return value none. exceptions a gl.invalid_value error is thrown if the data would be written past the end of the buffer or if data is null. a gl.invalid_enum error is thrown if target is not one of the allowed enums. examples using buffersubdata var canvas = document.getelementbyid('canvas'); var gl...
WebGLRenderingContext.checkFramebufferStatus() - Web APIs
ues can be returned additionally: gl.framebuffer_incomplete_multisample: the values of gl.renderbuffer_samples are different among attached renderbuffers, or are non-zero if the attached images are a mix of renderbuffers and textures. when using the ovr_multiview2 extension, the following value can be returned additionally: ext.framebuffer_incomplete_view_targets_ovr: if baseviewindex is not the same for all framebuffer attachment points where the value of framebuffer_attachment_object_type is not none, the framebuffer is considered incomplete. examples var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var framebuffer = gl.createframebuffer(); // ... gl.checkframebufferstatus(gl.framebuffer); specifications specification...
WebGLRenderingContext.clearStencil() - Web APIs
default value: 0. return value none. examples gl.clearstencil(1); to get the current stencil clear value, query the stencil_clear_value constant. ...
WebGLRenderingContext.disableVertexAttribArray() - Web APIs
return value none. examples gl.disablevertexattribarray(0); specifications specification status comment webgl 1.0the definition of 'disablevertexattribarray' in that specification. recommendation initial definition. ...
WebGLRenderingContext.drawArrays() - Web APIs
gl.points: draws a single dot. gl.line_strip: draws a straight line to the next vertex. gl.line_loop: draws a straight line to the next vertex, and connects the last vertex back to the first. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. first a glint specifying the starting index in the array of vector points. count a glsizei specifying the number of indices to be rendered. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if first or count are negative, a gl.invalid_value error is thrown. if gl.current_program is null, a gl.invalid_operation error is thrown. examples gl.drawarrays(gl.points, 0, 8); ...
WebGLRenderingContext.drawElements() - Web APIs
t. gl.lines: draws a line between a pair of vertices. gl.triangle_strip gl.triangle_fan gl.triangles: draws a triangle for a group of three vertices. count a glsizei specifying the number of elements to be rendered. type a glenum specifying the type of the values in the element array buffer. possible values are: gl.unsigned_byte gl.unsigned_short when using the oes_element_index_uint extension: gl.unsigned_int offset a glintptr specifying a byte offset in the element array buffer. must be a valid multiple of the size of the given type. return value none. exceptions if mode is not one of the accepted values, a gl.invalid_enum error is thrown. if offset is not a valid multiple of the size of the given type, a gl.invalid_operation error is throw...
WebGLRenderingContext.getActiveAttrib() - Web APIs
the webglrenderingcontext.getactiveattrib() method of the webgl api returns a webglactiveinfo object containing size, type, and name of a vertex attribute. it is generally used when querying unknown attributes either for debugging or generic library creation. syntax webglactiveinfo gl.getactiveattrib(program,index); parameters program a webglprogram containing the vertex attribute. index a gluint specifying the index of the vertex attribute to get. this value is an index 0 to n - 1 as returned by gl.getprogramparameter(program, gl.active_attributes). return value a webglactiveinfo object. examples const numattribs = gl.getprogramparameter(program, gl.active_attributes); for (let i = 0; i < numattribs; ++i) { const info = gl.getactiveattrib(program, i); console.log('name:', i...
WebGLRenderingContext.getExtension() - Web APIs
registered in the webgl extension registry. ...
WebGLRenderingContext.getParameter() - Web APIs
gl.max_array_texture_layers glint gl.max_client_wait_timeout_webgl glint64 gl.max_color_attachments glint gl.max_combined_fragment_uniform_components glint64 gl.max_combined_uniform_blocks glint gl.max_combined_vertex_uniform_components glint64 gl.max_draw_buffers glint gl.max_element_index glint64 gl.max_elements_indices glint gl.max_elements_vertices glint gl.max_fragment_input_components glint gl.max_fragment_uniform_blocks glint gl.max_fragment_uniform_components glint gl.max_program_texel_offset glint gl.max_samples glint gl.max_server_wait_timeout ...
WebGLRenderingContext.getRenderbufferParameter() - Web APIs
internal_format: returns a glenum indicating the internal format of the currently bound renderbuffer. the default is gl.rgba4. possible return values: gl.rgba4: 4 red bits, 4 green bits, 4 blue bits 4 alpha bits. gl.rgb565: 5 red bits, 6 green bits, 5 blue bits. gl.rgb5_a1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.depth_component16: 16 depth bits. gl.stencil_index8: 8 stencil bits. gl.renderbuffer_green_size: returns a glint that is the resolution size (in bits) for the green color. gl.renderbuffer_blue_size: returns a glint that is the resolution size (in bits) for the blue color. gl.renderbuffer_red_size: returns a glint that is the resolution size (in bits) for the red color. gl.renderbuffer_alpha_size: returns a glint that is the resolut...
WebGLRenderingContext.getSupportedExtensions() - Web APIs
registered in the webgl extension registry. ...
WebGLRenderingContext.getVertexAttribOffset() - Web APIs
pname a glenum which must be gl.vertex_attrib_array_pointer. return value a glintptr indicating the address of the vertex attribute. examples gl.getvertexattriboffset(i, gl.vertex_attrib_array_pointer); specifications specification status comment webgl 1.0the definition of 'getvertexattriboffset' in that specification. ...
WebGLRenderingContext.renderbufferStorage() - Web APIs
data storage for single images in a renderable internal format. internalformat a glenum specifying the internal format of the renderbuffer. possible values: gl.rgba4: 4 red bits, 4 green bits, 4 blue bits 4 alpha bits. gl.rgb565: 5 red bits, 6 green bits, 5 blue bits. gl.rgb5_a1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.depth_component16: 16 depth bits. gl.stencil_index8: 8 stencil bits. gl.depth_stencil when using a webgl 2 context, the following values are available additionally: gl.r8 gl.r8ui gl.r8i gl.r16ui gl.r16i gl.r32ui gl.r32i gl.rg8 gl.rg8ui gl.rg8i gl.rg16ui gl.rg16i gl.rg32ui gl.rg32i gl.rgb8 gl.rgba8 gl.srgb8_alpha8 (also available as an extension for webgl 1, see below) ...
WebGLRenderingContext - Web APIs
e. webglrenderingcontext.texsubimage2d() updates a sub-rectangle of the current webgltexture. webglrenderingcontext.texparameterf() sets texture parameters. webglrenderingcontext.texparameteri() sets texture parameters. programs and shaders webglrenderingcontext.attachshader() attaches a webglshader to a webglprogram. webglrenderingcontext.bindattriblocation() binds a generic vertex index to a named attribute variable. webglrenderingcontext.compileshader() compiles a webglshader. webglrenderingcontext.createprogram() creates a webglprogram. webglrenderingcontext.createshader() creates a webglshader. webglrenderingcontext.deleteprogram() deletes a webglprogram. webglrenderingcontext.deleteshader() deletes a webglshader. webglrenderingcontext.detachshader() detaches a we...
A basic 2D WebGL animation example - Web APIs
rm4fv() to the color we wish to use when drawing the square. this is a 4-component floating-point vector (one component each for red, green, blue, and alpha). now that that's all out of the way, we can set up the vertex buffer and draw our shape, first, the buffer of vertexes that will be used to draw the triangles of the shape is set by calling bindbuffer(). then the vertex position attribute's index is obtained from the shader program by calling getattriblocation(). with the index of the vertex position attribute now available in avertexposition, we call enablevertexattribarray() to enable the position attribute so it can be used by the shader program (in particular, by the vertex shader). then the vertex buffer is bound to the avertexposition attribute by calling vertexattribpointer(). th...
Color masking - Web APIs
e]; var redtoggle = document.queryselector("#red-toggle"), greentoggle = document.queryselector("#green-toggle"), bluetoggle = document.queryselector("#blue-toggle"); redtoggle.addeventlistener("click", setcolormask, false); greentoggle.addeventlistener("click", setcolormask, false); bluetoggle.addeventlistener("click", setcolormask, false); function setcolormask(evt) { var index = evt.target === greentoggle && 1 || evt.target === bluetoggle && 2 || 0; mask[index] = !mask[index]; if (mask[index] === true) evt.target.innerhtml="on"; else evt.target.innerhtml="off"; gl.colormask(mask[0], mask[1], mask[2], true); drawanimation(); }; function drawanimation () { var color = getrandomcolor(); gl.clearcolor(color[0],...
Lighting in WebGL - Web APIs
0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, // left -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0 ]; gl.bufferdata(gl.array_buffer, new float32array(vertexnormals), gl.static_draw); ... return { position: positionbuffer, normal: normalbuffer, texturecoord: texturecoordbuffer, indices: indexbuffer, }; this should look pretty familiar by now; we create a new buffer, bind it to be the buffer we're working with, then send along our array of vertex normals into the buffer by calling bufferdata(). then we add the code to drawscene() to bind the normals array to a shader attribute so the shader code can get access to it: // tell webgl how to pull out the normals from // the norm...
Using textures in WebGL - Web APIs
0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, // right 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, // left 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, ]; gl.bufferdata(gl.array_buffer, new float32array(texturecoordinates), gl.static_draw); ... return { position: positionbuffer, texturecoord: texturecoordbuffer, indices: indexbuffer, }; first, this code creates a webgl buffer into which we'll store the texture coordinates for each face, then we bind that buffer as the array we'll be writing into. the texturecoordinates array defines the texture coordinates corresponding to each vertex of each face. note that the texture coordinates range from 0.0 to 1.0; the dimensions of textures are normalized to a range of 0.0 ...
Using WebGL extensions - Web APIs
r each supported extension. ...
WebGL: 2D and 3D graphics for the web - Web APIs
Web › API › WebGL API
formfeedback webgluniformlocation 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_mipmap 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_textur...
Writing a WebSocket server in C# - Web APIs
. note that the mask bit is set in our message. this means that the next four bytes (61, 84, 35, and 6) are the mask bytes used to decode the message. these bytes change with every message. the remaining bytes are the encoded message payload. decoding algorithm di = ei xor m(i mod 4) where d is the decoded message array, e is the encoded message array, m is the mask byte array, and i is the index of the message byte to decode. example in c#: byte[] decoded = new byte[3]; byte[] encoded = new byte[3] {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 syste...
Inputs and input sources - Web APIs
lexible is the tracked-pointer mode, in which the ray's origin is at a handheld controller or hand tracking system's origin and extends outward in the direction in which the controller is pointing. the ray extends outward in a direction defined by whatever platform and controller are being used, if that's defined; otherwise, the ray extends in the same direction the user is pointing in with their index finger, if it were currently outstretched. the third and final target ray mode is most commonly found on mobile devices like smartphones and tablets. the screen mode indicates that the target ray is determined based on the user interacting with the 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 fin...
Movement, orientation, and motion: A WebXR example - Web APIs
the right mouse button is held down, and clicking using the right mouse button triggers the context menu, we add a handler for the contextmenu event to the canvas to prevent the context menu fom appearing when the user initially begins their drag of the mouse. next, we compile the shader programs; get references to its variables; initialize the buffers that store the array of each position; the indexes into the position table for each vertex; the vertex normals; and the texture coordinates for each vertex. this is all taken directly from the webgl sample code, so refer to lighting in webgl and its preceding articles creating 3d objects using webgl and using textures in webgl. then our loadtexture() function is called to load the texture file. now that the rendering structures and data are lo...
Basic concepts behind Web Audio API - Web APIs
. the specification explicitly allows the future definition of new speaker layouts. this fallback is therefore not future proof as the behavior of the browsers for a specific number of channels may change in the future. discrete any (x) any (y) where x<y up-mix discrete channels. fill each output channel with its input counterpart, that is the input channel with the same index. channels with no corresponding input channels are left silent. any (x) any (y) where x>y down-mix discrete channels. fill each output channel with its input counterpart, that is the input channel with the same index. input channels with no corresponding output channels are dropped. visualizations in general, audio visualizations are achieved by accessing an output of a...
Migrating from webkitAudioContext - Web APIs
re it gets removed when the // audiobuffersourcenode reaches its end. // first argument is the audiobuffersourcenode to start, other arguments are // the argument to the |start()| method of the audiobuffersourcenode. function startsource() { var src = arguments[0]; var startargs = array.prototype.slice.call(arguments, 1); src.onended = function() { sources.splice(sources.indexof(src), 1); } sources.push(src); src.start.apply(src, startargs); } function activesources() { return sources.length; } var src0 = context.createbuffersource(); var src0 = context.createbuffersource(); // set buffers and other parameters... startsource(src0, 0); startsource(src1, 0); // some time later, query the number of sources... console.log(activesources()...
Example and tutorial: Simple synth keyboard - Web APIs
ded when handling events. making music playing a tone the playtone() function's job is to play a tone at the given frequency. this will be used by the handler for events triggering keys on the keyboard to start playing the appropriate notes. function playtone(freq) { let osc = audiocontext.createoscillator(); osc.connect(mastergainnode); let type = wavepicker.options[wavepicker.selectedindex].value; if (type == "custom") { osc.setperiodicwave(customwaveform); } else { osc.type = type; } osc.frequency.value = freq; osc.start(); return osc; } playtone() begins by creating a new oscillatornode by calling the audiocontext.createoscillator() method. we then connect it to the master gain node by calling the new oscillator's oscillatornode.connect() method;, which t...
Using IIR filters - Web APIs
f the same size. // arrays for our frequency response const totalarrayitems = 30; let myfrequencyarray = new float32array(totalarrayitems); let magresponseoutput = new float32array(totalarrayitems); let phaseresponseoutput = new float32array(totalarrayitems); let's fill our first array with frequency values we want data to be returned on: myfrequencyarray = myfrequencyarray.map(function(item, index) { return math.pow(1.4, index); }); we could go for a linear approach, but it's far better when working with frequencies to take a log approach, so let's fill our array with frequency values that get larger further on in the array items. now let's get our response data: iirfilter.getfrequencyresponse(myfrequencyarray, magresponseoutput, phaseresponseoutput); we can use this data to draw...
Web Locks API - Web APIs
ire the same lock, which allows a web app running in multiple 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. for example, if a web app running in multiple tabs wants to ensure that only one tab is syncing data between the network and indexed db, each tab could try to acquire a "my_net_db_sync" lock, but only one tab will succeed (the leader election pattern.) the api is used as follows: the lock is requested. work is done while holding the lock in an asynchronous task. the lock is automatically released when the task completes. navigator.locks.request('my_resource', async lock => { // the lock has been acquired. await d...
Functions and classes available to Web Workers - Web APIs
pairs representing form fields and their values, which can then be easily sent using the xmlhttprequest send() method. ? (should be in 39 (39)) ? (yes) ? imagedata the underlying pixel data of an area of a canvas element. manipulating such data can be a complex task better suited to be delegated to a web worker. 25 (25) no support no support no support indexeddb database to store records holding simple values and hierarchical objects. 37 (37), 42 (42) for idbcursorwithvalue. 10.0 (yes) 10.1 network information api provides information about the system's connection in terms of general connection type (e.g., 'wifi', 'cellular', etc.). 53.0 (53) only on mobile (yes) only on mobile no support no support no...
Web Workers API - Web APIs
rkers - workers that are shared between multiple scripts). you can run whatever code you like inside the worker thread, with some exceptions. for example, you can't directly manipulate the dom from inside a worker, or use some default methods and properties of the window object. but you can use a large number of items available under window, including websockets, and data storage mechanisms like indexeddb. see functions and classes available to workers for more details. data is sent between workers and the main thread via a system of messages — both sides send their messages using the postmessage() method, and respond to messages via the onmessage event handler (the message is contained within the message event's data property). the data is copied rather than shared. workers may in turn s...
Window: animationstart event - Web APIs
the animationstart event is fired when a css animation has started. if there is an animation-delay, this event will fire once the delay period has expired. a negative delay will cause the event to fire with an elapsedtime equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence). bubbles yes cancelable no interface animationevent event handler property onanimationstart the original target for this event is the element that had the animation applied. you can listen for this event on the window interface to handle it in the capture or bubbling phases. for full details on this event please see the page on htmlelement: animationstart. examples this listens for the ...
Window.open() - Web APIs
Web › API › Window › open
d, no java, no activex, no flash. for various reasons (security, public access, text browsers, etc..), about 5% to 10% of users on the web surf with javascript disabled. "javascript:" links will interfere with advanced features in tab-capable browsers: eg. middle-click on links, ctrl+click on links, tab-browsing features in extensions, etc. "javascript:" links will interfere with the process of indexing webpages by search engines. "javascript:" links interfere with assistive technologies (e.g. voice browsers) and several web-aware applications (e.g. pdas and mobile browsers). "javascript:" links also interfere with "mouse gestures" features implemented in browsers. protocol scheme "javascript:" will be reported as an error by link validators and link checkers. further reading: top ten...
window.postMessage() - Web APIs
l receive the message. methods for obtaining such a reference include: window.open (to spawn a new window and then reference it), window.opener (to reference the window that spawned this one), htmliframeelement.contentwindow (to reference an embedded <iframe> from its parent window), window.parent (to reference the parent window from within an embedded <iframe>), or window.frames + an index value (named or numeric). message data to be sent to the other window. the data is serialized using the structured clone algorithm. this means you can pass a broad variety of data objects safely to the destination window without having to serialize them yourself. [1] targetorigin specifies what the origin of targetwindow must be for the event to be dispatched, either as the literal string...
Window - Web APIs
Web › API › Window
tc. returns a reference to the window object in the frames. see window.frames for more details. properties implemented from elsewhere windoworworkerglobalscope.caches read only returns the cachestorage object associated with the current context. this object enables functionality such as storing assets for offline use, and generating custom responses to requests. windoworworkerglobalscope.indexeddb read only provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an idbfactory object. windoworworkerglobalscope.issecurecontext read only returns a boolean indicating whether the current context is secure (true) or not (false). windoworworkerglobalscope.origin read only returns the global object's origin, serialized as a string. (thi...
WindowOrWorkerGlobalScope.caches - Web APIs
requests. syntax var mycachestorage = self.caches; // or just caches value a cachestorage object. example the following example shows how you'd use a cache in a service worker context to store assets offline. ...
WindowOrWorkerGlobalScope - Web APIs
s read only returns the cachestorage object associated with the current context. this object enables functionality such as storing assets for offline use, and generating custom responses to requests. windoworworkerglobalscope.crossoriginisolated read only returns a boolean value that indicates whether a sharedarraybuffer can be sent via a window.postmessage() call. windoworworkerglobalscope.indexeddb read only provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an idbfactory object. windoworworkerglobalscope.issecurecontext read only returns a boolean indicating whether the current context is secure (true) or not (false). windoworworkerglobalscope.origin read only returns the origin of the global scope, serialized as a string. ...
WorkerGlobalScope - Web APIs
orkers. workerglobalscope.console read only returns the console associated with the worker. properties implemented from elsewhere windoworworkerglobalscope.caches read only returns the cachestorage object associated with the current context. this object enables functionality such as storing assets for offline use, and generating custom responses to requests. windoworworkerglobalscope.indexeddb read only provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an idbfactory object. windoworworkerglobalscope.issecurecontext read only returns a boolean indicating whether the current context is secure (true) or not (false). windoworworkerglobalscope.origin read only returns the global object's origin, serialized as a string. (thi...
HTML in XMLHttpRequest - Web APIs
use it only when it is really necessary. specifications specification status comment xmlhttprequest ...
Using XMLHttpRequest - Web APIs
k. otherwise, an invalid_access_err exception is thrown. bypassing the cache a cross-browser compatible approach to bypassing the cache is appending a timestamp to the url, being sure to include a "?" or "&" as appropriate. for example: http://foo.com/bar.html -> http://foo.com/bar.html?12345 http://foo.com/bar.html?foobar=baz -> http://foo.com/bar.html?foobar=baz&12345 as the local cache is indexed by url, this causes every request to be unique, thereby bypassing the cache. you can automatically adjust urls using the following code: var oreq = new xmlhttprequest(); oreq.open("get", url + ((/\?/).test(url) ? "&" : "?") + (new date()).gettime()); oreq.send(null); security firefox 3 note versions of firefox prior to firefox 3 allowed you to set the preference capability.policy.
XPathResult - Web APIs
des in the result snapshot. xpathresult.stringvalueread only a string representing the value of the result if resulttype is string_type. methods xpathresult.iteratenext() if the result is a node set, this method iterates over it and returns the next node from it or null if there are no more nodes. xpathresult.snapshotitem() returns an item of the snapshot collection or null in case the index is not within the range of nodes. unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated. constants result type defined constant value description any_type 0 a result set containing whatever type naturally results from evaluation of the expression. note that if the result is a node-set ...
XRInputSource.targetRayMode - Web APIs
vice. tracked-pointer targeting is being performed using a handheld device or hand-tracking system which the user points in the direction of the target. the target ray extends from the hand (or the object in the hand) in the targeted direction. the direction is determined using platform-specific rules, though if no such rules exist, the direction is chosen by assuming the user is pointing their index finger straight out from their hand. usage notes the input source's targetrayspace indicates the position and orientation of the target ray, and can be used to determine where to render the ray. example this fragment of code shows part of a function to be called once every frame. it looks for inputs which have a non-null targetrayspace. inputs which have a value for this property represent i...
XRInputSourceArray.forEach() - Web APIs
the xrinputsourcearray method foreach() executes the specified callback once for each input source in the array, starting at index 0 and progressing until the end of the list. syntax xrinputsourcearray.foreach(callback, thisarg); parameters callback a function to execute once for each entry in the array xrinputsourcearray. the callback accepts up to three parameters: currentvalue a xrinputsource object which is the value of the item from within the xrinputsourcearray which is currently being processed. currentindex optional an integer value providing the index into the array at which the element given by currentvalue is located. if you don't need to know the index number, you can omit this. sourcelist optional the xrinputsourcearray object which is being processed. i...
XRInputSourceArray.values() - Web APIs
the xrinputsourcearray method values() returns a javascript iterator that can walk over the list of xrinputsource objects contained in the array, from first to last. syntax xrinputsourcearray.values(); parameters none. return value a javascript iterator that can be used to walk through the list of xrinputsource objects in the array, starting with the first entry (at index 0) and proceeding straight through the list. examples this example snippet walks through each input and calls the function checkinput() with each returned value. 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 ...
XRTargetRayMode - Web APIs
vice. tracked-pointer targeting is being performed using a handheld device or hand-tracking system which the user points in the direction of the target. the target ray extends from the hand (or the object in the hand) in the targeted direction. the direction is determined using platform-specific rules, though if no such rules exist, the direction is chosen by assuming the user is pointing their index finger straight out from their hand. examples this fragment of code shows part of a function to be called once every frame. it looks for inputs which have a non-null targetrayspace. inputs which have a value for this property represent inputs that project a target ray outward from the user. for each such input, this example looks for inputs whose targetraymode is tracked-pointer, indicating t...
ARIA guides - Accessibility
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. error handling in forms labeling widgets labeling composite widgets and regions managing focus in composite widgets (aria-activedescendant vs roving tabindex) using landmark roles handling dynamic updates & live regions virtual vs. non virtual mode in at products using drag & drop notifying users of non-aria screen readers fixing structure with presentation role hiding layout tables managing modal and non modal dialogs using aria with html5 how to test aria aria on mobile devices ...
ARIA live regions - Accessibility
because the live region has aria-live="polite", the screen reader will wait until the user pauses before announcing the update. thus, moving down in the list and selecting another planet will not announce updates in the live region. updates in the live regio...
Using the alertdialog role - Accessibility
ssistive 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 snippet below shows how to mark up an alert dialog that only provides a message and an ok button. ...
Using the aria-invalid attribute - Accessibility
on could wait until the form is submitted (though this is not necessarily recommended). ...
x-ms-aria-flowfrom - Accessibility
rder. the property serves to define element relationships utilizing aria relationship attributes and the aria-flowto property. this proprietary property is specific to internet explorer and microsoft edge. ...
Using ARIA: Roles, states, and properties - Accessibility
-multiselectable aria-orientation aria-placeholder aria-pressed aria-readonly aria-required aria-selected aria-sort aria-valuemax aria-valuemin aria-valuenow aria-valuetext live region attributes aria-live aria-relevant aria-atomic aria-busy drag & drop attributes aria-dropeffect aria-dragged relationship attributes aria-activedescendant aria-colcount aria-colindex aria-colspan aria-controls aria-describedby aria-details aria-errormessage aria-flowto aria-labelledby aria-owns aria-posinset aria-rowcount aria-rowindex aria-rowspan aria-setsize microsoftedge-specific properties x-ms-aria-flowfrom ...
ARIA: tabpanel role - Accessibility
instead of re-purposing an element and adding an aria role, state or property to make it accessible, then do so. then post full details in best practices section below. examples fill in a simple example that nicely shows a typical usage of the property, then perhaps some more complex examples. <div role="tablist"> <div role="tab" aria-selected="true" aria-controls="tabpanel-id" id="tab-id" tabindex="0">tab label</div> accessibility concerns optionally, warn of any potential accessibility concerns that exist with using this property, and how to work around them. remove this section if there are none to list. best practices optionally, here list any best practices that exist for this role. remove the section if none exist. added benefits any additional benefits this feature has for non...
ARIA: feed role - Accessibility
t of related products on an ecommerce page. these streams can be limited or infinite, loading more content as the user scrolls. implementing the feed pattern allows a screen reader to reliably read and trigger the loading of feed content while in reading mode. a feed is a container element whose children are <article>s or have role article. each article within a feed should be focusable, with tabindex of 0 or -1. an article should be scrolled into view when it, or a descendant element, receives focus. if the addition of articles occupies the main browser thread, make sure to set aria-busy="true" on the feed itself, and make sure to set it back to false when processing ends, or the user may not see the updates. to ensure good user experience, avoid inserting or removing articles in the middle ...
ARIA: Region role - Accessibility
egion</code> role with discretion</h3> <!-- content --> </div> ... <div role="region" aria-labelledby="please-reconsider"> <h3 id="please-reconsider">please reconsider your document structure</h3> <!-- content --> </div> in this example, the region's label is being generated by the aria-labelledby attribute. scrolling content areas with overflow text if there is a content area with tabindex="0", add role="region" to convey to screen reader users that is a generic region. this is done to allow keyboard-only users to scroll regions with overflow text. svg role="region" can be declared on areas of svg along with an aria-label to allow individual sections of the svg to be described. added benefits certain technologies such as browser extensions can generate lists of all landmark rol...
ARIA: switch role - Accessibility
mixed for the aria-checked attribute; assigning a value of mixed to a switch instead sets the value to false. assistive technologies may choose to represent switch widgets with a specialized presentation to reflect the notion of an on/off switch. since a switch is an interactive control, it must be focusable and keyboard accessible. if the role is applied to a non-focusable element, use the tabindex attribute to change this. the expected keyboard shortcut for toggling the value of a switch is the space key. the developer is required to change the value of the aria-checked attribute dynamically when the switch is toggled. associated aria roles, states, and properties aria-checked attribute the aria-checked attribute is required when using the switch role, as it represents the current sta...
ARIA: listbox role - Accessibility
e or property to make it accessible, then do so. the <select> element with descendant <option> elements handles all the needed interactions natively. examples example 1: a single select listbox that uses aria-activedescendant the snippet below shows how the listbox role is added directly into the html source code. ...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
usy flag. no method to get clipped/unclipped bounds of a piece of text within a text object. this is needed by screen magnifiers. no scrollto method, also needed by screen magnifiers. implement a custom interface for text objects, and support it through queryinterface or queryservice if it's being implemented on a different object than iaccessible is. support a scrollto method which takes a text index, and a getclippedbounds and getunclippedbounds method which takes a start and end index. publish your custom interface. no way for assistive technology to know when scrolling has stopped. fire the event_system_scrollingend event to indicate when scrolling has ended (try not to fire too many of these, wait until scrolling has truly stopped). there is no need to support event_system_scrollingstart...
Accessibility Information for Web Authors - Accessibility
sibility guidelines (wcag) 1.0 another important set of guidelines from the w3c web accessibility initiative (wai). the european union is looking to base their upcoming accessibility regulations on these guidelines. these guidelines are discussed on the wai interest group discussion list. how-to's key-navigable custom dhtml widgets in mozilla & ie this document discusses how to use tabindex, element.focus() and onkeypress to make custom dhtml widgets such as menus or tree views keyboard accessible. accessible web page authoring ibm has put together a simple, practical resource for web authors to learn accessibility the fast and painless way. highly recommended, an excellent resource. dive into accessibility by mark pilgrim an excellent, easy-to-understand resource (availab...
Mobile accessibility checklist - Accessibility
everything other than the currently visible screen must be truly invisible (especially relevant for single page apps with multiple cards): use the hidden attribute or visibility or display style properties. unless absolutely unavoidable, aria-hidden attribute should not be used. focus all activat...
-moz-user-focus - CSS: Cascading Style Sheets
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 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 skipped in the tab order. normal the element can accept the keyboard focus. select-after ? select-before ? select-menu ? select-same ? select-all ? none ? formal definition initial valuenoneapplies toall ele...
:focus-visible - CSS: Cascading Style Sheets
10px; } .focus-only:focus { outline: 2px solid black; } .focus-visible-only:focus-visible { outline: 4px dashed darkorange; } selectively showing the focus indicator a custom control, such as a custom element button, can use :focus-visible to selectively apply a focus indicator only on keyboard-focus. this matches the native focus behavior for controls like <button>. ...
:nth-child() - CSS: Cascading Style Sheets
1) represents the odd rows of an html table: 1, 3, 5, etc. tr:nth-child(even) or tr:nth-child(2n) represents the even rows of an html table: 2, 4, 6, etc. :nth-child(7) represents the seventh element. :nth-child(5n) represents elements 5 [=5×1], 10 [=5×2], 15 [=5×3], etc. the first one to be returned as a result of the formula is 0 [=5x0], resulting in a no-match, since the elements are indexed from 1, whereas n starts from 0. this may seem weird at first, but it makes more sense when the b part of the formula is >0, like in the next example. :nth-child(n+7) represents the seventh and all following elements: 7 [=0+7], 8 [=1+7], 9 [=2+7], etc. :nth-child(3n+4) represents elements 4 [=(3×0)+4], 7 [=(3×1)+4], 10 [=(3×2)+4], 13 [=(3×3)+4], etc. :nth-child(-n+3) represents the fi...
:nth-last-child() - CSS: Cascading Style Sheets
elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc., counting from the end. even represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc., counting from the end. functional notation <an+b> represents elements whose numeric position in a series of siblings matches the pattern an+b, for every positive integer or zero value of n. the index of the first element, counting from the end, is 1. the values a and b must both be <integer>s. formal syntax :nth-last-child( <nth> [ of <complex-selector-list> ]? )where <nth> = <an-plus-b> | even | odd<complex-selector-list> = <complex-selector>#where <complex-selector> = <compound-selector> [ <combinator>? <compound-selector> ]*where <compound-selector> = [ <type-selector>? <subclass-select...
prefix - CSS: Cascading Style Sheets
<color-stop-length>?<linear-color-hint> = <length-percentage><length-percentage> = <length> | <percentage><angular-color-stop> = <color> && <color-stop-angle>?<angular-color-hint> = <angle-percentage>where <color-stop-length> = <length-percentage>{1,2}<color-stop-angle> = <angle-percentage>{1,2}<angle-percentage> = <angle> | <percentage> examples adding a prefix to a counter html <ul class="index"> <li>the boy who lived</li> <li>the vanishing glass</li> <li>the letters from no one</li> <li>the keeper of the keys</li> <li>diagon alley</li> </ul> css @counter-style chapters { system: numeric; symbols: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"; prefix: 'chapter '; } .index { list-style: chapters; padding-left: 15ch; } result specifications specification ...
src - CSS: Cascading Style Sheets
Web › CSS › @font-face › src
document containing svg font definitions. if the element reference is omitted, a reference to the first defined font is implied. similarly, font container formats that can contain more than one font load only one of the fonts for a given @font-face rule. fragment identifiers are used to indicate which font to load. if a container format lacks a defined fragment identifier scheme, a simple 1-based indexing scheme (e.g., "font-collection#1" for the first font, "font-collection#2" for the second font, etc.) is used. formal definition related at-rule@font-faceinitial valuen/a (required)computed valueas specified formal syntax [ <url> [ format( <string># ) ]? | local( <family-name> ) ]#where <family-name> = <string> | <custom-ident>+ examples specifying font resources using url() and local() ...
color - CSS: Cascading Style Sheets
Web › CSS › @media › color
ning that you can also use the prefixed min-color and max-color variants to query minimum and maximum values, respectively. note: if the various color components are represented by different numbers of bits, the smallest number is used. for example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component. if the device uses indexed colors, the minimum number of bits per color component in the color table is used. see applying color to html elements using css to learn more about using css to apply color to html. examples html <p>this text should be black on non-color devices, red on devices with a low number of colors, and greenish on devices with a high number of colors.</p> css p { color: black; } /* any color...
@media - CSS: Cascading Style Sheets
Web › CSS › @media
how accurate is it? added in media queries level 4. aspect-ratio width-to-height aspect ratio of the viewport color number of bits per color component of the output device, or zero if the device isn't color color-gamut approximate range of colors that are supported by the user agent and output device added in media queries level 4. color-index number of entries in the output device's color lookup table, or zero if the device does not use such a table device-aspect-ratio width-to-height aspect ratio of the output device deprecated in media queries level 4. device-height height of the rendering surface of the output device deprecated in media queries level 4. device-width width of th...
CSS Containment - CSS: Cascading Style Sheets
that element and does not affect the rest of the page, and the containing box establishes an independent formatting context. in addition: float layout will be performed independently. margins won't collapse across a layout containment boundary the layout container will be a containing block for absolute/fixed position descendants. the containing box creates a stacking context, therefore z-index can be used. paint containment article { contain: paint; } paint containment essentially clips the box to the padding edge of the principal box. there can be no visible overflow. the same things are true for paint containment as layout containment (see above). another advantage is that if the containing box is offscreen, the browser does not need to paint its contained elements — these m...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
s authors great powers of rearrangement over the document. however, these are not a substitute for correct ordering of the document source. the order property and grid placement do not affect ordering in non-visual media (such as speech). likewise, rearranging grid items visually does not affect the default traversal order of sequential navigation modes (such as cycling through links, see e.g. tabindex html5). if you reorder things visually using grid layout, this will not change how the items are ordered if the content is being read out by a screen reader, or other text to speech user agent. in addition, the reordering will not change tab order. this means that someone navigating using the keyboard could be tabbing through links on your site and suddenly find themselves jumping from the top ...
Layout using named grid lines - CSS: Cascading Style Sheets
y: grid; grid-template-columns: repeat(9, 1fr); grid-auto-rows: minmax(100px, auto); grid-template-areas: "hd hd hd hd hd hd hd hd hd" "sd sd sd main main main main main main" "ft ft ft ft ft ft ft ft ft"; } .header { grid-area: hd; } .footer { grid-area: ft; } .content { grid-area: main; } .sidebar { grid-area: sd; } .wrapper > div.overlay { z-index: 10; grid-column: main-start / main-end; grid-row: hd-start / ft-end; border: 4px solid rgb(92,148,13); background-color: rgba(92,148,13,.4); color: rgb(92,148,13); font-size: 150%; } <div class="wrapper"> <div class="header">header</div> <div class="sidebar">sidebar</div> <div class="content">content</div> <div class="footer">footer</div> <div class="overlay">overlay</div...
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
c concepts of grid layout, we started to look at how to position items on a grid using line numbers. in this article we will fully explore how this fundamental feature of the specification works. starting your exploration of grid with numbered lines is the most logical place to begin, as when you use grid layout you always have numbered lines. the lines are numbered for columns and rows, and are indexed from 1. note that grid is indexed according to the writing mode of the document. in a left to right language such as english line 1 is on the left-hand side of the grid. if you are working in a right-to-left language then line 1 will be the far right of the grid. we will learn more about the interaction between writing modes and grids in a later guide. a basic example as a very simple example...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
em1 { grid-column: col-start / span 3; } .item2 { grid-column: col-start 6 / span 4 ; grid-row: 1 / 3; } .item3 { grid-column: col-start 2 / span 2; grid-row: 2; } .item4 { grid-column: col-start 3 / -1; grid-row: 3; } as described in the guide to named lines, we are using the named line to place our item. as we have 12 lines all with the same name we use the name, and then the index of the line. you could also use the line index itself if you prefer and avoid using named lines at all. rather than setting the end line number, i have chosen to say how many tracks this element should span, using the span keyword. i like this approach as when working with a multiple-column layout system we usually think of blocks in terms of the number of tracks of the grid they span, and adjus...
Stacking with floated blocks - CSS: Cascading Style Sheets
lements, in order of appearance in the html note: if an opacity value is applied to the non-positioned block (div #4), then something strange happens: the background and border of that block pops up above the floating blocks and the positioned blocks. this is due to a peculiar part of the specification: applying a opacity value creates a new stacking context (see what no one told you about z-index). source code for the example html <div id="abs1"> <b>div #1</b><br />position: absolute;</div> <div id="flo1"> <b>div #2</b><br />float: left;</div> <div id="flo2"> <b>div #3</b><br />float: right;</div> <br /> <div id="sta1"> <b>div #4</b><br />no positioning</div> <div id="abs2"> <b>div #5</b><br />position: absolute;</div> css div { padding: 10px; text-align: center;...
CSS Positioned Layout - CSS: Cascading Style Sheets
css positioned layout is a module of css that defines how to position elements on the page. reference css properties bottom clear float left position right top z-index guides understanding css z-index presents the notion of stacking context and explains how z-ordering works, with several examples. specifications specification status comment css positioned layout module level 3 working draft css level 2 (revision 1) recommendation ...
CSS Properties Reference - CSS: Cascading Style Sheets
roke-dasharray strokedasharray stroke-dashoffset strokedashoffset stroke-width strokewidth text-align textalign text-decoration textdecoration text-indent textindent text-transform texttransform top top vertical-align verticalalign visibility visibility width width z-index zindex ...
CSS selectors - CSS: Cascading Style Sheets
optionally, it may be restricted to a specific namespace or to all namespaces. syntax: * ns|* *|* example: * will match all the elements of the document. type selector selects all elements that have the given node name. syntax: elementname example: input will match any <input> element. class selector selects all elements that have the given class attribute. syntax: .classname example: .index will match any element that has a class of "index". id selector selects an element based on the value of its id attribute. there should be only one element with a given id in a document. syntax: #idname example: #toc will match the element that has the id "toc". attribute selector selects all elements that have the given attribute. syntax: [attr] [attr=value] [attr~=value] [attr|=value] [a...
CSS data types - CSS: Cascading Style Sheets
Web › CSS › CSS Types
css data types define typical values (including keywords and units) accepted by css properties and functions. they are a special kind of component value type. in formal syntax, data types are denoted by a keyword placed between the inequality signs "<" and ">". ...
Animatable CSS properties - CSS: Cascading Style Sheets
olor shape-image-threshold shape-margin shape-outside tab-size text-decoration text-decoration-color text-decoration-thickness text-emphasis text-emphasis-color text-indent text-shadow text-underline-offset top transform transform-origin translate vertical-align visibility width word-spacing z-index zoom ...
Using media queries - CSS: Cascading Style Sheets
how accurate is it? added in media queries level 4. aspect-ratio width-to-height aspect ratio of the viewport color number of bits per color component of the output device, or zero if the device isn't color color-gamut approximate range of colors that are supported by the user agent and output device added in media queries level 4. color-index number of entries in the output device's color lookup table, or zero if the device does not use such a table device-aspect-ratio width-to-height aspect ratio of the output device deprecated in media queries level 4. device-height height of the rendering surface of the output device deprecated in media queries level 4. device-width width of th...
Pseudo-classes - CSS: Cascading Style Sheets
:checked on certain form elements), or the position of the mouse (like :hover, which lets you know if the mouse is over an element or not). note: in contrast to pseudo-classes, pseudo-elements can be used to style a specific part of an element. syntax selector:pseudo-class { property: value; } like regular classes, you can chain together as many pseudo-classes as you want in a selector. ...
Pseudo-elements - CSS: Cascading Style Sheets
n use only one pseudo-element in a selector. it must appear after the simple selectors in the statement. note: as a rule, double colons (::) should be used instead of a single colon (:). this distinguishes pseudo-classes from pseudo-elements. however, since this distinction was not present in older versions of the w3c spec, most browsers support both syntaxes for the original pseudo-elements. ...
calc() - CSS: Cascading Style Sheets
Web › CSS › calc
h unit, for example: h1 { font-size: calc(1.5rem + 3vw); } this ensures that text size will scale if the page is zoomed. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 usage with integers when calc() is used where an <integer> is expected, the value will be rounded to the nearest integer. for example: .modal { z-index: calc(3 / 2); } this will give .modal a final z-index value of 2. note: the chrome browser currently won’t accept some values returned by calc() when an integer is expected. this includes any division, even if it results in an integer. ie. z-index: calc(4 / 2); will not be accepted. examples positioning an object on screen with a margin calc() makes it easy to position an object with a se...
flex-basis - CSS: Cascading Style Sheets
6">6: flex-basis test</li> </ul> css .container { font-family: arial, sans-serif; margin: 0; padding: 0; list-style-type: none; display: flex; flex-wrap: wrap; } .flex { background: #6ab6d8; padding: 10px; margin-bottom: 50px; border: 3px solid #2e86bb; color: white; font-size: 14px; text-align: center; position: relative; } .flex:after { position: absolute; z-index: 1; left: 0; top: 100%; margin-top: 10px; width: 100%; color: #333; font-size: 12px; } .flex1 { flex-basis: auto; } .flex1:after { content: 'auto'; } .flex2 { flex-basis: max-content; } .flex2:after { content: 'max-content'; } .flex3 { flex-basis: min-content; } .flex3:after { content: 'min-content'; } .flex4 { flex-basis: fit-content; } .flex4:after { content:...
<integer> - CSS: Cascading Style Sheets
Web › CSS › integer
syntax the <integer> data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign. there is no unit associated with integers. note: there is no official range of valid <integer> values. ...
justify-items - CSS: Cascading Style Sheets
grid container is given a justify-items value of stretch (the default), which causes the grid items to stretch across the entire width of their cells. if you hover or tab onto the grid container however, it is given a justify-items value of center, which causes the grid items to span only as wide as their content width, and align in the center of their cells. ...
matrix3d() - CSS: Cascading Style Sheets
c 3d affine transformation can't be represented using a cartesian-coordinate matrix, as translations are not linear transformations. a1a2a3a4b1b2b3b4c1c2c3c4d1d2d3d4 examples cube squashing example the following example shows a 3d cube created from dom elements and transforms, which can be hovered/focused to apply a matrix3d() transform to it. ...
visibility - CSS: Cascading Style Sheets
: initial; visibility: unset; the visibility property is specified as one of the keyword values listed below. values visible the element box is visible. hidden the element box is invisible (not drawn), but still affects layout as normal. descendants of the element will be visible if they have visibility set to visible. the element cannot receive focus (such as when navigating through tab indexes). collapse for <table> rows, columns, column groups, and row groups, the row(s) or column(s) are hidden and the space they would have occupied is removed (as if display: none were applied to the column/row of the table). however, the size of other rows and columns is still calculated as though the cells in the collapsed row(s) or column(s) are present. this value allows for the fast remova...
Guide to Web APIs - Developer guides
Web › Guide › API
ent light eventsbbackground tasksbattery api beaconbluetooth apibroadcast channel apiccss counter stylescss font loading api cssomcanvas apichannel messaging apiconsole apicredential management apiddomeencoding apiencrypted 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 apipayment request apiperformance apiperformance timeline apipermissions apipointer eventspointer lock apiproximity events push api rresize observer apiresource timing apisserver ...
Media buffering, seeking, and time ranges - Developer guides
/audio> we can access these attributes like so: var myaudio = document.getelementbyid('my-audio'); var bufferedtimeranges = myaudio.buffered; timeranges object timeranges are a series of non-overlapping ranges of time, with start and stop times. (learn more about timeranges). a timeranges object consists of the following properties: length: the number of time ranges in the object. start(index): the start time, in seconds, of a time range. end(index): the end time, in seconds, of a time range. without any user interaction there is usually only one time range, but if you jump about in the media more than one time range can appear, as illustrated by the below visualization. this represents two buffered time ranges — one spanning 0 to 5 seconds and the second spanning 15 to 19 second...
Creating a cross-browser video player - Developer guides
ode. the exception to this is safari 5.1, which will only allow webkitrequestfullscreen to be called on the <video> element. the custom controls will only appear on this browser in fullscreen mode with some webkit specific css: the default browser controls have to be hidden with video::-webkit-media-controls { display:none !important; } the custom controls container needs to have a special z-index value: .controls { z-index:2147483647; } dealing with webkit-specific code in this way will affect all webkit browsers, but everything works as expected in more advanced webkit browsers such as chrome and the latest opera. another user defined function — setfullscreendata() — is also called, which simply sets the value of a data-fullscreen attribute on the videocontainer (this makes use of...
HTML5 - Developer guides
Web › Guide › HTML › HTML5
ents firefox 3 supports whatwg online and offline events, which let applications and extensions detect whether or not there's an active internet connection, as well as to detect when the connection goes up and down. whatwg client-side session and persistent storage (aka dom storage) client-side session and persistent storage allows web applications to store structured data on the client side. 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 multiple files ...
HTML attribute reference - HTML: Hypertext Markup Language
ddable content. srcdoc <iframe> srclang <track> srcset <img>, <source> one or more responsive image candidates. start <ol> defines the first number if other than 1. step <input> style global attribute defines css styles which will override styles previously set. summary <table> tabindex global attribute overrides the browser's default tab order and follows the one specified instead. target <a>, <area>, <base>, <form> specifies where to open the linked document (in the case of an <a> element) or where to display the response recieved (in the case of a <form> element) title global attribute text to be displayed in a tooltip when hovering over th...
<area> - HTML: Hypertext Markup Language
Web › HTML › Element › area
s (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 scripted by older browsers. nohref indicates that no hyperlink exists for the associated area. note: since html5, omitting the href attribute is sufficient. tabindex a numeric value specifying the position of the defined area in the browser tabbing order. this attribute is global in html5. type no effect. browsers ignore it. (the w3c 5.3 fork of the html specification defines it as valid, but the canonical html specification doesn’t, and it has no effect in any user agents.) examples <map name="primary"> <area shape="circle" coords="75,75,75" hr...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
Web › HTML › Element › dialog
ning root permitted content flow content tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content implicit aria role dialog permitted aria roles alertdialog dom interface htmldialogelement attributes this element includes the global attributes. the tabindex attribute must not be used on the <dialog> element. open indicates that the dialog is active and can be interacted with. when the open attribute is not set, the dialog shouldn't be shown to the user. usage notes <form> elements can close a dialog if they have the attribute method="dialog". when such a form is submitted, the dialog closes with its returnvalue property set to the value of...
<input type="datetime-local"> - HTML: Hypertext Markup Language
anuary 1st, 10000: the exact time of y10k--> <input type="datetime-local" value=""+010000-01-01t05:00"/> it's that simple. just prepare your code for any number of digits. do not only prepare for 5 digits. here is javascript code for programmatically setting the value: function setvalue(element, date) { var isostring = date.toisostring() element.value = isostring.substring(0, (isostring.indexof("t")|0) + 6|0); } why worry about the y10k problem if it is going to happen many centuries after your death? exactly because you will already be dead, so the companies using your software will be stuck using your software without any other coder who knows the system well enough to come in and fix it. examples in this example we create two sets of ui elements for choosing datetimes — a nati...
<nav>: The Navigation Section element - HTML: Hypertext Markup Language
Web › HTML › Element › nav
the source for this interactive example is stored in a github repository. if 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, sectioning content, palpable content. ...
<object> - HTML: Hypertext Markup Language
Web › HTML › Element › object
e of the attribute must be an id of a <form> element in the same document. height the height of the displayed resource, in css pixels. -- (absolute values only. no percentages) name the name of valid browsing context (html5), or the name of the control (html 4). standbyhtml 4 onlyobsolete since html5 a message that the browser can show while loading the object's implementation and data. tabindexhtml 4 onlyobsolete since html5 the position of the element in the tabbing navigation order for the current document. type the content type of the resource specified by data. at least one of data and type must be defined. typemustmatchhtml5 this boolean attribute indicates if the type attribute and the actual content type of the resource must match to be used. usemap a hash-name reference t...
Microdata - HTML: Hypertext Markup Language
mats such as hcard (company contact information), hrecipe (food recipe), hreview (market reviews) and hproduct (product data) and provides its own format for the definition of the terms and encyclopedic articles. this extension was made to solve transliteration problems between the cyrillic and latin alphabets. due to the implementation of additional marking parameters of schema's vocabulary, the indexation of information in russian-language web-pages became considerably more successful. global attributes itemid – the unique, global identifier of an item. itemprop – used to add properties to an item. every html element may have an itemprop attribute specified, where an itemprop consists of a name and value pair. itemref – properties that are not descendants of an element with the item...
Choosing between www and non-www URLs - HTTP
ilerplate project has an example on how to configure an apache server to redirect one domain to the other. using <link rel="canonical"> it is possible to add a special html <link> element to a page to indicate what the canonical address of a page is. this has no impact on the human reader of the page, but tells search engine crawlers where the page actually lives. this way, search engines don't index the same page several times, potentially leading to it being considered as duplicate content or spam, and even removing or lowering your page from the search engine result pages. when adding such a tag, you serve the same content for both domains, telling search engines which url is canonical. in the previous example, http://www.example.org/whaddup would serve the same content as http://example.
Browser detection using the user agent - HTTP
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. so, you might have thought to do this: // this code snippet 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 script, including // sections of the code that are never executed. var camelcaseexpression = new regexp("(?<=[a-z])"); var splitu...
Clear-Site-Data - HTTP
is affects the entire registered domain, including subdomains. so https://example.com as well as https://stage.example.com, will have cookies cleared. "storage" indicates that the server wishes to remove all dom storage for the origin of the response url. this includes storage mechanisms such as: localstorage (executes localstorage.clear), sessionstorage (executes sessionstorage.clear), indexeddb (for each database execute idbfactory.deletedatabase), service worker registrations (for each service worker registration, execute serviceworkerregistration.unregister), appcache, websql databases, filesystem api data, plugin data (flash via npp_clearsitedata). "executioncontexts" indicates that the server wishes to reload all browsing contexts for the origin of the response (...
Location - HTTP
Web › HTTP › Headers › Location
en content negotiation happened, without the need of further content negotiation. ...
Retry-After - HTTP
imal integer indicating the seconds to delay after the response is received. examples dealing with scheduled downtime support for the retry-after header on both clients and servers is still inconsistent. however, some crawlers and spiders, like the googlebot, honor the retry-after header. it is useful to send it along with a 503 (service unavailable) response, so that search engines will keep indexing your site when the downtime is over. retry-after: wed, 21 oct 2015 07:28:00 gmt retry-after: 120 specifications specification title rfc 7231, section 7.1.3: retry-after hypertext transfer protocol (http/1.1): semantics and content ...
Upgrade - HTTP
Web › HTTP › Headers › Upgrade
er type request header, response header forbidden header name yes overview the upgrade header field may be used by clients to invite a server to switch to one (or more) of the listed protocols, in descending preference order. for example, the client might send a get request as shown, listing the preferred protocols to switch to (in this case "example/1" and "foo/2"): get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2 note: connection: upgrade must be set whenever upgrade is sent. the server can choose to ignore the request, for any reason, in which case it should just respond as though the upgrade header had not been sent (for example, with a  200 ok). if the server decides to upgrade the connection, it must: send bac...
HTTP headers - HTTP
Web › HTTP › Headers
the header is effectively equivalent to <meta name="robots" content="...">. x-ua-compatible used by internet explorer to signal which document mode to use. ...
GET - HTTP
Web › HTTP › Methods › GET
the http get method requests a representation of the specified resource. requests using get should only retrieve data. ...
HEAD - HTTP
Web › HTTP › Methods › HEAD
similar get request would have received. ...
OPTIONS - HTTP
Web › HTTP › Methods › OPTIONS
the http options method requests permitted communication options for a given url or server. a client can specify a url with this method, or an asterisk (*) to refer to the entire server. ...
TRACE - HTTP
Web › HTTP › Methods › TRACE
ssage body of a 200 (ok) response with a content-type of message/http. ...
An overview of HTTP - HTTP
Web › HTTP › Overview
ml form results. http can also be used to fetch parts of documents to update web pages on demand. components of http-based systems http is a client-server protocol: requests are sent by one entity, the user-agent (or a proxy on behalf of it). most of the time the user-agent is a web browser, but it can be anything, for example a robot that crawls the web to populate and maintain a search engine index. each individual request is sent to a server, which handles it and provides an answer, called the response. between the client and the server there are numerous entities, collectively called proxies, which perform different operations and act as gateways or caches, for example. in reality, there are more computers between a browser and the server handling the request: there are routers, modem...
Protocol upgrade mechanism - HTTP
mechanism; it is specific to http/1.1. upgrading http/1.1 connections the upgrade header field is used by clients to invite the server to switch to one of the listed protocols, in descending preference order. because upgrade is a hop-by-hop header, it also needs to be listed in the connection header field. this means that a typical request that includes upgrade would look something like: get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2 other headers may be required depending on the requested protocol; for example, websocket upgrades allow additional headers to configure details about the websocket connection as well as to offer a degree of security in opening the connection. see upgrading to a websocket connection for more details. if the server...
Proxy Auto-Configuration (PAC) file - HTTP
are shell glob expressions, not regular expressions. * and ? are always supported, while [characters] and [^characters] are supported by some implmentations including firefox. this is mainly because the expression is translated to a regexp via subsitution of [.*?]. for a reliable way to use these regexp syntaxes, just use regexp instead. examples shexpmatch("http://home.netscape.com/people/ari/index.html" , "*/ari/*"); // returns true shexpmatch("http://home.netscape.com/people/montulli/index.html", "*/ari/*"); // returns false weekdayrange() syntax weekdayrange(wd1, wd2, [gmt]) note: (before firefox 49) wd1 must be less than wd2 if you want the function to evaluate these parameters as a range. see the warning below. parameters wd1 and wd2 one of the ordered weekday strings: ...
Concurrency model and the event loop - JavaScript
only communicate through sending messages via the postmessage method. this method adds a message to the other runtime if the latter listens to message events. never blocking a very interesting property of the event loop model is that javascript, unlike a lot of other languages, never blocks. handling i/o is typically performed via events and callbacks, so when the application is waiting for an indexeddb query to return or an xhr request to return, it can still process other things like user input. legacy exceptions exist like alert or synchronous xhr, but it is considered a good practice to avoid them. beware: exceptions to the exception do exist (but are usually implementation bugs, rather than anything else). specifications specification html living standardthe definit...
Control flow and error handling - JavaScript
ch statement. the example calls a function that retrieves a month name from an array based on the value passed to the function. if the value does not correspond to a month number (1–12), an exception is thrown with the value "invalidmonthno" and the statements in the catch block set the monthname variable to 'unknown'. ...
Functions - JavaScript
"red, orange, blue, " myconcat(', ', 'red', 'orange', 'blue'); // returns "elephant; giraffe; lion; cheetah; " myconcat('; ', 'elephant', 'giraffe', 'lion', 'cheetah'); // returns "sage. basil. oregano. pepper. parsley. " myconcat('. ', 'sage', 'basil', 'oregano', 'pepper', 'parsley'); note: the arguments variable is "array-like", but not an array. it is array-like in that it has a numbered index and a length property. however, it does not possess all of the array-manipulation methods. see the function object in the javascript reference for more information. function parameters starting with ecmascript 2015, there are two new kinds of parameters: default parameters and rest parameters. default parameters in javascript, parameters of functions default to undefined. however, in some s...
Grammar and types - JavaScript
note : an array literal is a type of object initializer. see using object initializers. if an array is created using a literal in a top-level script, javascript interprets the array each time it evaluates the expression containing the array literal. in addition, a literal used in a function is created each time the function is called. note: array literals are also array objects. see array and indexed collections for details on array objects. extra commas in array literals you do not have to specify all elements in an array literal. if you put two commas in a row, the array fills in the value undefined for the unspecified elements. the following example creates the fish array: let fish = ['lion', , 'angel']; this array has two elements with values and one empty element: fish[0] is "...
Meta programming - JavaScript
lue and arguments provided as an array (or an array-like object). function.prototype.apply.call(math.floor, undefined, [1.75]) with reflect.apply this becomes less verbose and easier to understand: reflect.apply(math.floor, undefined, [1.75]) // 1 reflect.apply(string.fromcharcode, undefined, [104, 101, 108, 108, 111]) // "hello" reflect.apply(regexp.prototype.exec, /ab/, ['confabulation']).index // 4 reflect.apply(''.charat, 'ponies', [3]) // "i" checking if property definition has been successful with object.defineproperty, which returns an object if successful, or throws a typeerror otherwise, you would use a try...catch block to catch any error that occurred while defining a property. because reflect.defineproperty returns a boolean success status, you can just use an if...else bl...
Assertions - JavaScript
ch(regex)); // null console.log('this is a first test in a year.'.match(regex)); // [ 'first' ] console.log('this is a first peach in a month.'.match(regex)); // null basic negative lookahead assertion for example, /\d+(?!\.)/ matches a number only if it is not followed by a decimal point. /\d+(?!\.)/.exec('3.141') matches "141" but not "3. console.log(/\d+(?!\.)/g.exec('3.141')); // [ '141', index: 2, input: '3.141' ] different meaning of '?!' combination usage in assertions and ranges different meaning of ?! combination usage in assertions /x(?!y)/ and ranges [^?!]. let orangenotlemon = "do you want to have an orange? yes, i do not want to have a lemon!"; // different meaning of '?!' combination usage in assertions /x(?!y)/ and ranges /[^?!]/ let selectnotlemonregex = /[^?!]+have(...
Regular expression syntax cheatsheet - JavaScript
s and remembers "foo" in "foo bar". a regular expression may have multiple 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 regexp object's properties ($1, ..., $9). capturing groups have a performance penalty. if you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). string.match() won't return groups if the /.../g flag is set. however, you can still use string.matchall() to get all matches. ...
Groups and ranges - JavaScript
s and remembers "foo" in "foo bar". a regular expression may have multiple 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 regexp object's properties ($1, ..., $9). capturing groups have a performance penalty. if you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). string.match() won't return groups if the /.../g flag is set. however, you can still use string.matchall() to get all matches. ...
Unicode property escapes - JavaScript
a "non-predominant" script, we could use the script_extensions property (scx for short). // Ù¢ is the digit 2 in arabic-indic notation // while it is predominantly written within the arabic script // it can also be written in the thaana script "Ù¢".match(/\p{script=thaana}/u); // null as thaana is not the predominant script super() "Ù¢".match(/\p{script_extensions=thaana}/u); // ["Ù¢", index: 0, input: "Ù¢", groups: undefined] unicode property escapes vs. character classes with javascript regular expressions, it is also possible to use character classes and especially \w or \d to match letters or digits. however, such forms only match characters from the latin script (in other words, a to z and a to z for \w and 0 to 9 for \d). as shown in this example, it might be a bit clumsy to...
JavaScript Guide - JavaScript
arguments & parameters arrow functions expressions and operators assignment & comparisons arithmetic operators bitwise & logical operators conditional (ternary) operator numbers and dates number literals number object math object date object text formatting string literals string object template literals internationalization regular expressions indexed collections arrays typed arrays keyed collections map weakmap set weakset working with objects objects and properties creating objects defining methods getter and setter details of the object model prototype-based oop creating object hierarchies inheritance promises guarantees chaining error propagation composition timing iter...
Inheritance and the prototype chain - JavaScript
ly created object o has object.prototype as its [[prototype]] // o has no own property named 'hasownproperty' // hasownproperty is an own property of object.prototype. // so o inherits hasownproperty from object.prototype // object.prototype has null as its prototype. ...
Deprecated and obsolete features - JavaScript
g following the most recent match. the following are now properties of regexp instances, no longer of the regexp object: property description global whether or not to test the regular expression against all possible matches in a string, or only against the first. ignorecase whether or not to ignore case while attempting a match in a string. lastindex the index at which to start the next match. multiline whether or not to search in strings across multiple lines. source the text of the pattern. regexp methods the compile() method is deprecated. the valueof method is no longer specialized for regexp. use object.valueof(). function properties the caller and arguments properties are deprecated, because th...
Arrow function expressions - JavaScript
mous) @ vm51800:1 > f3 = x => (z1 = x + 1) x => (z1 = x + 1) > z1 vm51891:1 uncaught referenceerror: z1 is not defined at <anonymous>:1:1 (anonymous) @ vm51891:1 > f3(10) 11 > z1 11 f2 illustrates that when explicitly setting the arrow function to apply strict mode, it does throw an error when attempting to assign an undeclared variable. https://www.ecma-international.org/ecma-262/10.0/index.html#sec-strict-mode-code https://www.ecma-international.org/ecma-262/10.0/index.html#sec-arrow-function-definitions-runtime-semantics-evaluation correction: end invoked through call or apply since arrow functions do not have their own this, the methods call() and apply() can only pass in parameters. any this argument is ignored. var adder = { base: 1, add: function(a) { var f = v =...
Method definitions - JavaScript
thand syntax must be before the generator property name. (that is, * g(){} will work, but g *(){} will not.) non-generator method definitions cannot contain the yield keyword. this means that legacy generator functions won't work either, and will throw a syntaxerror. always use yield in conjunction with the asterisk (*). // using a named property const obj2 = { g: function* () { let index = 0 while (true) { yield index++ } } }; // the same object using shorthand syntax const obj2 = { * g() { let index = 0 while (true) { yield index++ } } }; const it = obj2.g() console.log(it.next().value) // 0 console.log(it.next().value) // 1 async methods async methods can also be defined using the shorthand syntax. // using a named property const obj...
Array.prototype.flatMap() - JavaScript
epth 1, but flatmap() is often quite useful, as merging both into one method is slightly more efficient. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax var new_array = arr.flatmap(function callback(currentvalue[, index[, array]]) { // return element for new_array }[, thisarg]) parameters callback function that produces an element of the new array, taking three arguments: currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array map was called upon. thisargoptional value to us...
Array.from() - JavaScript
arraylike [, mapfn [, thisarg]]) parameters arraylike an array-like or iterable object to convert to an array. mapfn optional map function to call on every element of the array. thisarg optional value to use as this when executing mapfn. return value a new array instance. description array.from() lets you create arrays from: array-like objects (objects with a length property and indexed elements); or iterable objects (objects such as map and set). array.from() has an optional parameter mapfn, which allows you to execute a map() function on each element of the array being created. more clearly, array.from(obj, mapfn, thisarg) has the same result as array.from(obj).map(mapfn, thisarg), except that it does not create an intermediate array. this is especially important for ce...
Array.prototype.keys() - 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 arr.keys() return value a new array iterator object. ...
Array.prototype.length - 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. ...
Array.prototype.push() - JavaScript
he new length property of the object upon which the method was called. description the push method appends values to an array. push is intentionally generic. this method can be used with call() or apply() on objects resembling arrays. the push method relies on a length property to determine where to start inserting the given values. if the length property cannot be converted into a number, the index used is 0. this includes the possibility of length being nonexistent, in which case length will also be created. although strings are native, array-like objects, they are not suitable in applications of this method, as strings are immutable. similarly for the native, array-like object arguments. examples adding elements to an array the following code creates the sports array containing two e...
Array.prototype.shift() - 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 arr.shift() return value the removed element from the array; undefined if the array is empty. description the shift method removes the element at the zeroeth index and shifts the values at consecutive indexes down, then returns the removed value. if the length property is 0, undefined is returned. shift is intentionally generic; this method can be called or applied to objects resembling arrays. objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful mann...
ArrayBuffer - JavaScript
operties arraybuffer.prototype.bytelength the read-only size, in bytes, of the arraybuffer. this is established when the array is constructed and cannot be changed. instance methods arraybuffer.prototype.slice() returns a new arraybuffer whose contents are a copy of this arraybuffer's bytes from begin (inclusive) up to end (exclusive). if either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. examples creating an arraybuffer in this example, we create a 8-byte buffer with a int32array view referring to the buffer: const buffer = new arraybuffer(8); const view = new int32array(buffer); specifications specification ecmascript (ecma-262)the definition of 'arraybuffer' in that specification. ...
Atomics.load() - JavaScript
the static atomics.load() method returns a value at a given position in the array. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax atomics.load(typedarray, index) parameters typedarray an integer typed array. one of int8array, uint8array, int16array, uint16array, int32array, uint32array, bigint64array, or biguint64array. index the position in the typedarray to load from. return value the value at the given position (typedarray[index]). exceptions throws a typeerror, if typedarray is not one of the allowed integer types. throws a rangeerror, if index is out of bounds in the typedarray. exampl...
Atomics.notify() - JavaScript
the static atomics.notify() method notifies up some agents that are sleeping in the wait queue. note: this operation works with a shared int32array only. it will return 0 on non-shared arraybuffer objects. syntax atomics.notify(typedarray, index, count) parameters typedarray a shared int32array. index the position in the typedarray to wake up on. count optional the number of sleeping agents to notify. defaults to +infinity. return value returns the number of woken up agents. returns 0, if a non-shared arraybuffer object is used. exceptions throws a typeerror, if typedarray is not a int32array. throws a rangeerror, if index is out of bounds in the typedarray. examples using notify given a shared int32array: const sab = new sharedarraybuffer(1024); const int32 = ...
BigInt64Array() constructor - JavaScript
the bigint64array() typed array constructor creates a new bigint64array object, which is, an array of 64-bit signed integers in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0n. once established, you can reference elements in the array using the object's methods, or by using standard array index syntax (that is, using bracket notation). syntax new bigint64array(); new bigint64array(length); new bigint64array(typedarray); new bigint64array(object); new bigint64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argum...
BigUint64Array() constructor - JavaScript
the biguint64array() typed array constructor creates a new biguint64array object, which is, an array of 64-bit unsigned integers in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0n. once established, you can reference elements in the array using the object's methods, or by using standard array index syntax (that is, using bracket notation). syntax new biguint64array(); new biguint64array(length); new biguint64array(typedarray); new biguint64array(object); new biguint64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedar...
Date.prototype.getTimezoneOffset() - JavaScript
the offset will change depending on the date and time that the date represents and that daylight saving applies. examples using gettimezoneoffset() // get current timezone offset for host device let x = new date(); let currenttimezoneoffsetinhours = x.gettimezoneoffset() / 60; // 1 // get timezone offset for international labour day (may 1) in 2016 // be careful, the date() constructor uses 0-indexed months, so may is // represented with 4 (and not 5) let labourday = new date(2016, 4, 1) let labourdayoffset = labourday.gettimezoneoffset() / 60; specifications specification ecmascript (ecma-262)the definition of 'date.prototype.gettimezoneoffset' in that specification. ...
Date.prototype.toDateString() - JavaScript
for date objects, as the format is implementation-dependent and simple string slicing approaches may not produce consistent results across multiple 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 ecmascript (ecma-262)the definition of 'date.prototype.todatestring' in that specification. ...
Date - JavaScript
veral ways to create javascript 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. ...
Float32Array() constructor - JavaScript
float32array() typed array constructor creates a new float32array object, which is, an array of 32-bit floating point numbers (corresponding to the c float data type) in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). syntax new float32array(); // new in es2017 new float32array(length); new float32array(typedarray); new float32array(object); new float32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
Float64Array() constructor - JavaScript
loat64array() typed array constructor creates a new float64array object, which is, an array of 64-bit floating point numbers (corresponding to the c double data type) in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). syntax new float64array(); // new in es2017 new float64array(length); new float64array(typedarray); new float64array(object); new float64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
Function.prototype.apply() - JavaScript
ct. thus, you do not have to know the arguments of the called object when you use the apply method. you can use arguments to pass all the arguments to the called object. the called object is then responsible for handling the arguments. since ecmascript 5th edition, you can also use any kind of object which is array-like. in practice, this means it's going to have a length property, and integer ("index") properties in the range (0..length - 1). for example, you could use a nodelist, or a custom object like { 'length': 2, '0': 'eat', '1': 'bananas' }. note: many older browsers—including chrome <17 and internet explorer <9—don't accept array-like objects, and will throw an exception. examples using apply to append an array to another you can use push to append an element to an array. an...
Function.prototype.call() - JavaScript
all(this, name, price); this.category = 'toy'; } const cheese = new food('feta', 5); const fun = new toy('robot', 40); using call to invoke an anonymous function in this example, we create an anonymous function and use call to invoke it on every object in an array. the main purpose of the anonymous function here is to add a print function to every object, which is able to print the correct index of the object in the array. passing the object as this value is not strictly necessary, but is done for explanatory purpose. const animals = [ { species: 'lion', name: 'king' }, { species: 'whale', name: 'fail' } ]; for (let i = 0; i < animals.length; i++) { (function(i) { this.print = function() { console.log('#' + i + ' ' + this.species + ': ' + this.name)...
Generator.prototype.next() - JavaScript
nction* gen() { yield 1; yield 2; yield 3; } const g = gen(); // "generator { }" g.next(); // "object { value: 1, done: false }" g.next(); // "object { value: 2, done: false }" g.next(); // "object { value: 3, done: false }" g.next(); // "object { value: undefined, done: true }" using next() with a list function* getpage(pagesize = 1, list) { let output = []; let index = 0; while (index < list.length) { output = []; for (let i = index; i < index + pagesize; i++) { if (list[i]) { output.push(list[i]); } } yield output; index += pagesize; } } list = [1, 2, 3, 4, 5, 6, 7, 8] var page = getpage(3, list); // generator { } page.next(); // object {value: (3) [1, 2, 3], done: fals...
Generator - JavaScript
// "generator { }" instance methods generator.prototype.next() returns a value yielded by the yield expression. generator.prototype.return() returns the given value and finishes the generator. generator.prototype.throw() throws an error to a generator (also finishes the generator, unless caught from within that generator). examples an infinite iterator function* infinite() { let index = 0; while (true) { yield index++; } } const generator = infinite(); // "generator { }" console.log(generator.next().value); // 0 console.log(generator.next().value); // 1 console.log(generator.next().value); // 2 // ... specifications specification ecmascript (ecma-262)the definition of 'generator objects' in that specification. ...
Int16Array() constructor - JavaScript
the int16array() typed array constructor creates an array of twos-complement 16-bit signed integers in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). syntax new int16array(); // new in es2017 new int16array(length); new int16array(typedarray); new int16array(object); new int16array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object...
Int32Array() constructor - JavaScript
the int32array() typed array constructor creates an array of twos-complement 32-bit signed integers in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). syntax new int32array(); // new in es2017 new int32array(length); new int32array(typedarray); new int32array(object); new int32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object...
Int8Array() constructor - JavaScript
the int8array() constructor creates a typed array of twos-complement 8-bit signed integers. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). syntax new int8array(); // new in es2017 new int8array(length); new int8array(typedarray); new int8array(object); new int8array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed ar...
Intl - JavaScript
iven operation. a single locale may be specified by either an intl.locale object or a string that is a unicode bcp 47 locale identifier. multiple locales may be specified (and a best-supported locale determined by evaluating each of them in order and comparing against the locales supported by the implementation) by passing an array (or array-like object, with a length property and corresponding indexed elements) whose elements are either intl.locale objects or values that convert to unicode bcp 47 locale identifier strings. if the locales argument is not provided or is undefined, the runtime's default locale is used. a unicode bcp 47 locale identifier consists of a language code, (optionally) a script code, (optionally) a region (or country) code, (optionally) one or more variant code...
JSON.parse() - JavaScript
} } return reviver.call(holder, key, value); } // parsing happens in four stages. in the first stage, we replace certain // unicode characters with escape sequences. javascript 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(-4) ); }); } // in the second stage, we run the text against regular expressions that look // for non-json patterns. we are...
JSON.stringify() - JavaScript
f an object being stringified has a property named tojson whose value is a function, then the tojson() method customizes json stringification behavior: instead of the object being serialized, the value returned by the tojson() method when called will be serialized. ...
Object.assign() - JavaScript
nction') { // must be writable: true, enumerable: false, configurable: true object.defineproperty(object, "assign", { value: function assign(target, varargs) { // .length of function is 2 'use strict'; if (target === null || target === undefined) { throw new typeerror('cannot convert undefined or null to object'); } var to = object(target); for (var index = 1; index < arguments.length; index++) { var nextsource = arguments[index]; if (nextsource !== null && nextsource !== undefined) { for (var nextkey in nextsource) { // avoid bugs when hasownproperty is shadowed if (object.prototype.hasownproperty.call(nextsource, nextkey)) { to[nextkey] = nextsource[nextkey]; } ...
Object.prototype.hasOwnProperty() - JavaScript
e specified property as own property. description all descendents of object inherit the hasownproperty method. this method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check for a property in the object's prototype chain. if an object is an array, hasownproperty method can check whether an index exists. note hasownproperty returns true even if the value of the property is null or undefined. o = new object(); o.propone = null; o.hasownproperty('propone'); // returns true o.proptwo = undefined; o.hasownproperty('proptwo'); // returns true examples using hasownproperty to test for a property's existence the following example determines whether the o object contains a property nam...
Reflect.apply() - JavaScript
y (or an array-like object). function.prototype.apply.call(math.floor, undefined, [1.75]); with reflect.apply() this becomes less verbose and easier to understand. examples using reflect.apply() reflect.apply(math.floor, undefined, [1.75]); // 1; reflect.apply(string.fromcharcode, undefined, [104, 101, 108, 108, 111]) // "hello" reflect.apply(regexp.prototype.exec, /ab/, ['confabulation']).index // 4 reflect.apply(''.charat, 'ponies', [3]) // "i" specifications specification ecmascript (ecma-262)the definition of 'reflect.apply' in that specification. ...
Reflect.ownKeys() - JavaScript
...
RegExp.prototype.compile() - JavaScript
ular expression. flags if specified, flags can have any combination of the following values: g global match i ignore case m multiline; treat beginning and end characters (^ and $) as working over multiple lines (i.e., match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input string) y sticky; matches only from the index indicated by the lastindex property of this regular expression in the target string (and does not attempt to match from any later indexes). description 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 reg...
RegExp.$1-$9 - JavaScript
a property of an individual regular expression object. instead, you always use them as regexp.$1, ..., regexp.$9. the values of these properties are read-only and modified whenever successful matches are made. the number of possible parenthesized substrings is unlimited, but the regexp object can only hold the first nine. you can access all parenthesized substrings through the returned array's indexes. these properties can be used in the replacement text for the string.replace method. when used this way, do not prepend them with regexp. the example below illustrates this. when parentheses are not included in the regular expression, the script interprets $n's literally (where n is a positive integer). examples using $n with string.replace the following script uses the replace() method of ...
SharedArrayBuffer - JavaScript
r.prototype.bytelength the size, in bytes, of the array. this is established when the array is constructed and cannot be changed. read only. instance methods sharedarraybuffer.prototype.slice(begin, end) returns a new sharedarraybuffer whose contents are a copy of this sharedarraybuffer's bytes from begin, inclusive, up to end, exclusive. if either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. examples creating a new sharedarraybuffer var sab = new sharedarraybuffer(1024); slicing the sharedarraybuffer sab.slice(); // sharedarraybuffer { bytelength: 1024 } sab.slice(2); // sharedarraybuffer { bytelength: 1022 } sab.slice(-2); // sharedarraybuffer { bytelength: 2 } sab.slice(0, 1); // sharedarraybuffer { bytelength...
String.prototype.includes() - JavaScript
specification and may not be available in all javascript implementations yet. ...
String.prototype.replace() - JavaScript
a "$". $& inserts the matched substring. $` inserts the portion of the string that precedes the matched substring. $' inserts the portion of the string that follows the matched substring. $n where n is a positive integer less than 100, inserts the nth parenthesized submatch string, provided the first argument was a regexp object. note that this is 1-indexed. if a group n is not present (e.g., if group is 3), it will be replaced as a literal (e.g., $3). $<name> where name is a capturing group name. if the group is not in the regular expressions (or not in the match), this will resolve to the empty string. only available in browser versions supporting named capturing groups. specifying a function as a parameter you can specify a ...
String.prototype.replaceAll() - JavaScript
a "$". $& inserts the matched substring. $` inserts the portion of the string that precedes the matched substring. $' inserts the portion of the string that follows the matched substring. $n where n is a positive integer less than 100, inserts the nth parenthesized submatch string, provided the first argument was a regexp object. note that this is 1-indexed. specifying a function as a parameter you can specify a function as the second parameter. in this case, the function will be invoked after the match has been performed. the function's result (return value) will be used as the replacement string. (note: the above-mentioned special replacement patterns do not apply in this case.) note that the function will be invoked multiple times for ...
Symbol.unscopables - JavaScript
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 (array.prototype) { keys.push('something'); } object.keys(array.prototype[symbol.unscopables]); // ["copywithin", "entries", "fill", "find", "findindex", // "includes", "keys", "values"] unscopables in objects you can also set unscopables for your own objects. var obj = { foo: 1, bar: 2 }; obj[symbol.unscopables] = { foo: false, bar: true }; with (obj) { console.log(foo); // 1 console.log(bar); // referenceerror: bar is not defined } specifications specification ecmascript (ecma-262)the definition of 'symb...
Symbol - JavaScript
o determine if an object may be used as a regular expression. used by string.prototype.match(). symbol.matchall a method that returns an iterator, that yields matches of the regular expression against a string. used by string.prototype.matchall(). symbol.replace a method that replaces matched substrings of a string. used by string.prototype.replace(). symbol.search a method that returns the index within a string that matches the 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 v...
TypedArray.prototype.entries() - 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 arr.entries() return value a new array iterator object. ...
TypedArray.from() - JavaScript
64array parameters source an array-like or iterable object to convert to a typed array. mapfn optional map function to call on every element of the typed array. thisarg optional value to use as this when executing mapfn. return value a new typedarray instance. description typedarray.from() lets you create typed arrays from: array-like objects (objects with a length property and indexed elements); or iterable objects (objects where you can get its elements, such as map and set). typedarray.from() has the optional parameter mapfn, which allows you to execute a map() function on each element of the typed array (or subclass object) that is being created. this means that the following are equivalent: typedarray.from(obj, mapfn, thisarg) typedarray.from(array.prototype.map.c...
TypedArray.prototype.includes() - JavaScript
opriate. this method has the same algorithm as array.prototype.includes(). typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.includes(searchelement[, fromindex]); parameters searchelement the element to search for. fromindex optional. the position in this array at which to begin searching for searchelement; defaults to 0. return value a boolean. examples using includes var uint8 = new uint8array([1,2,3]); uint8.includes(2); // true uint8.includes(4); // false uint8.includes(3, 3); // false // nan handling (only true for float32 an...
TypedArray.prototype.keys() - 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 arr.keys() return value a new array iterator object. ...
TypedArray.prototype.set() - JavaScript
yped array, the two arrays may share the same underlying arraybuffer; the javascript engine will intelligently copy the source range of the buffer to the destination range. offset optional the offset into the target array at which to begin writing values from the source array. if this value is omitted, 0 is assumed (that is, the source array will overwrite values in the target array starting at index 0). exceptions a rangeerror, if the offset is set such as it would store beyond the end of the typed array. examples using set() var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1, 2, 3], 3); console.log(uint8); // uint8array [ 0, 0, 0, 1, 2, 3, 0, 0 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.pr...
TypedArray.prototype.subarray() - JavaScript
. the offset is inclusive. the whole array will be included in the new view if this value is not specified. end optional element to end at. the offset is exclusive. if not specified, all elements from the one specified by begin to the end of the array are included in the new view. return value a new typedarray object. description the range specified by begin and end is clamped to the valid index range for the current array; if the computed length of the new array would be negative, it's clamped to zero. if either begin or end is negative, it refers to an index from the end of the array instead of from the beginning. also note that this is creating a new view on the existing buffer; changes to the new object's contents will impact the original object and vice versa. examples using the ...
TypedArray.prototype.values() - 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 arr.values() return value a new array iterator object. ...
Uint16Array() constructor - JavaScript
d; if only length is omitted, the remainder of buffer is viewed. description the uint16array() typed array constructor creates an array of 16-bit unsigned integers in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). starting with ecmascript 2015, uint16array constructors require to be constructed with a new operator. calling a uint16array constructor as a function without new, will throw a typeerror from now on. var dv = uint16array([1, 2, 3]); // typeerror: calling a builtin uint16array constructor // without new is forbidden var dv = new uint16array([1, 2, 3]); ...
Uint32Array() constructor - JavaScript
the uint32array() typed array constructor creates an array of 32-bit unsigned integers in the platform byte order. if control over byte order is needed, use dataview instead. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). syntax new uint32array(); // new in es2017 new uint32array(length); new uint32array(typedarray); new uint32array(object); new uint32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any ...
Uint8Array() constructor - JavaScript
the uint8array() constructor creates a typed array of 8-bit unsigned integers. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). syntax new uint8array(); // new in es2017 new uint8array(length); new uint8array(typedarray); new uint8array(object); new uint8array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. eac...
Uint8ClampedArray() constructor - JavaScript
uint8clampedarray() constructor creates a typed array of 8-bit unsigned integers clamped to 0-255; if you specified a value that is out of the range of [0,255], 0 or 255 will be set instead; if you specify a non-integer, the nearest integer will be set. the contents are initialized to 0. once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation). syntax new uint8clampedarray(); // new in es2017 new uint8clampedarray(length); new uint8clampedarray(typedarray); new uint8clampedarray(object); new uint8clampedarray(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element...
WeakMap - JavaScript
mented in javascript with two arrays (one for keys, one for values) shared by the four api methods. setting elements on this map would involve pushing a key and value onto the end of each of those arrays simultaneously. as a result, the indices of the key and value would correspond to both arrays. getting values from the map would involve iterating through all keys to find a match, then using the index of this match to retrieve the corresponding value from the array of values. such an implementation would have two main inconveniences: the first one is an o(n) set and search (n being the number of keys in the map) since both operations must iterate through the list of keys to find a matching value. the second inconvenience is a memory leak because the arrays ensure that references to each k...
WebAssembly.Module.exports() - JavaScript
ions of all the declared exports of the given module. syntax webassembly.module.exports(module); parameters module a webassembly.module object. return value an array containing objects representing the exported functions of the given module. exceptions if module is not a webassembly.module object instance, a typeerror is thrown. examples using exports the following example (see our index-compile.html demo on github, and view it live also) compiles the loaded simple.wasm byte code using the webassembly.compilestreaming() method and then sends it to a worker using postmessage(). var worker = new worker("wasm_worker.js"); webassembly.compilestreaming(fetch('simple.wasm')) .then(mod => worker.postmessage(mod) ); in the worker (see wasm_worker.js) we define an import object for t...
WebAssembly.Module - JavaScript
py of the contents of all custom sections in the module with the given string name. webassembly.module.exports() given a module, returns an array containing descriptions of all the declared exports. webassembly.module.imports() given a module, returns an array containing descriptions of all the declared imports. examples sending a compiled module to a worker the following example (see our index-compile.html demo on github, and view it live also) compiles the loaded simple.wasm byte code using the webassembly.compilestreaming() method and then sends the resulting module instance to a worker using postmessage(). var worker = new worker("wasm_worker.js"); webassembly.compilestreaming(fetch('simple.wasm')) .then(mod => worker.postmessage(mod) ); in the worker (see wasm_worker.js) we de...
WebAssembly.Table() constructor - JavaScript
tabledescriptor is not of type object, a typeerror is thrown. if maximum is specified and is smaller than initial, a rangeerror is thrown. examples creating a new webassembly table instance the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 elements. we then print out the table length and contents of the two indexes (retrieved via table.prototype.get() to show that the length is two and both elements are null. var tbl = new webassembly.table({initial:2, element:"anyfunc"}); console.log(tbl.length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null" we then create an import object that contains the table: var importobj = { js: { tbl:tbl } }; finally, we load and inst...
Standard built-in objects - JavaScript
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 manipulating them. string regexp indexed collections these objects represent collections of data which are ordered by an index value. this includes (typed) arrays and array-like constructs. array int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array keyed collections these objects represent collections which use keys. the itera...
Optional chaining (?.) - JavaScript
g. it can also be helpful while exploring the content of an object when there's no known guarantee as to which properties are required. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax obj?.prop obj?.[expr] arr?.[index] func?.(args) description 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 n...
for...of - JavaScript
tom because of inheritance and the prototype chain. for (const i in iterable) { console.log(i); // logs 0, 1, 2, "foo", "arrcustom", "objcustom" } this loop logs only enumerable properties of the iterable object, in arbitrary order. it doesn't log array elements 3, 5, 7 or hello because those are not enumerable properties, in fact they are not properties at all, they are values. it logs array indexes as well as arrcustom and objcustom, which are. if you're not sure why these properties are iterated over, there's a more thorough explanation of how array iteration and for...in work. for (const i in iterable) { if (iterable.hasownproperty(i)) { console.log(i); // logs 0, 1, 2, "foo" } } this loop is similar to the first one, but it uses hasownproperty() to check if the found enumerab...
function* - JavaScript
the generator. much like a return statement, an error is thrown inside the generator will make the generator finished -- unless caught within the generator's body. when a generator is finished, subsequent next() calls will not execute any of that generator's code, they will just return an object of this form: {value: undefined, done: true}. examples simple example function* idmaker() { var index = 0; while (true) yield index++; } var gen = idmaker(); console.log(gen.next().value); // 0 console.log(gen.next().value); // 1 console.log(gen.next().value); // 2 console.log(gen.next().value); // 3 // ... example with yield* function* anothergenerator(i) { yield i + 1; yield i + 2; yield i + 3; } function* generator(i) { yield i; yield* anothergenerator(i); yield i + 10; ...
throw - JavaScript
object you can specify an object when you throw an exception. you can then reference the object's properties in the catch block. the following example creates an object of type userexception and uses it in a throw statement. ...
Strict mode - JavaScript
es. delete name in strict mode is a syntax error: 'use strict'; var x; delete x; // !!! syntax error eval('var y; delete y;'); // !!! syntax error making eval and arguments simpler strict mode makes arguments and eval less bizarrely magical. both involve a considerable amount of magical behavior in normal code: eval to add or remove bindings and to change binding values, and arguments by its indexed properties aliasing named arguments. strict mode makes great strides toward treating eval and arguments as keywords, although full fixes will not come until a future edition of ecmascript. first, the names eval and arguments can't be bound or assigned in language syntax. all these attempts to do so are syntax errors: 'use strict'; eval = 17; arguments++; ++eval; var obj = { set p(arguments) {...
JavaScript reference - JavaScript
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 int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array keyed collections map set weakmap weakset structured data arraybuffer sharedarraybuffer atomics dataview json control abstraction promise generator generatorfunction asyn...
Authoring MathML - MathML
document.body.removechild(div); return math.abs(box.height - 23) <= 1 && math.abs(box.width - 77) <= 1; } alternatively, the following ua string sniffing will allow to detect the rendering engines with native mathml support (gecko and webkit). note that ua string sniffing is not the most reliable method and might break from version to version: var ua = navigator.useragent; var isgecko = ua.indexof("gecko") > -1 && ua.indexof("khtml") === -1 && ua.indexof('trident') === -1; var iswebkit = ua.indexof('applewebkit') > -1 && ua.indexof('chrome') === -1; mathematical fonts in order to get a good layout or to allow different style, it's important to have mathematical fonts available. it's always good to provide a link to mdn's font instructions, so that your visitors can verify whether they...
<mroot> - MathML
Web › MathML › Element › mroot
attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified url. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the color of the root symbol itself. you can use #rgb, #rrggbb and html color names. ...
<msqrt> - MathML
Web › MathML › Element › msqrt
the square root accepts only one argument, which leads to the following syntax: <msqrt> base </msqrt>. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the color of the root symbol itself. you can use #rgb, #rrggbb and html color names. ...
<mstyle> - MathML
Web › MathML › Element › mstyle
element accepts all attributes of all presentation elements with the following exceptions: height, depth or width do not apply to <mglyph>, <mpadded> or <mtable>. rowalign, columnalign, or groupalign do not apply to <mtr>, <mlabeledtr>, <mtd> or <maligngroup>. lspace or voffset do not apply to <mpadded>. fontfamily does not apply to <mglyph>. align does not apply to <mtable> or <mstack>. index cannot be set on <mstyle>. src and alt on <mglyph> cannot be set on <mstyle>. actiontype on <maction> cannot be set on <mstyle>. examples using displaystyle and mathcolor to effect style changes in the layout of the whole sum. <math> <mstyle displaystyle="true" mathcolor="teal"> <mrow> <munderover> <mo stretchy="true" form="prefix">&sum;</mo> <mrow> <...
MathML element reference - MathML
laying non-standard symbols) i <mi> (identifier) l <mlabeledtr> (labeled row in a table or a matrix) <mlongdiv> (long division notation) m <mmultiscripts> (prescripts and tensor indices) n <mn> (number) o <mo> (operator) <mover> (overscript) 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>) <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 alignm...
Media container formats (file types) - Web media technologies
other cases, a particular codec, stored in a certain container type, is so ubiquitous that the pairing is treated in a unique fashion. a good example of this is the mp3 audio file, which is in fact an mpeg-1 container with a single audio track encoded using mpeg-1 audio layer iii encoding. these files use the audio/mp3 mime type and the .mp3 extension, even though their containers are just mpeg. index of media container formats (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. codec name (short) full codec name browser compatibility1 3gp third...
Performance budgets - Web Performance
shold over a period of time. why do i need a performance budget? a budget exists to reflect your reachable goals. it's a tradeoff between user experience, against other performance indicators (e.g. conversion rate). these goals can be: timing based (e.g. time to interactive, first contentful paint). quantity-based (e.g. amount of js files/total image size). rule-based (e.g. pagespeed index, lighthouse score). their primary goal is to prevent regressions, but they can provide insights to forecast trends (i.e. on september, 50% of the budget was spent in a week). additionally, it can uncover development needs (i.e. a large library with smaller alternatives is often picked to solve a common problem). how do i define a performance budget? a budget should include 2 levels: warni...
Web Performance
or it can significantly harm download time, render time, in ap...
Introduction to progressive web apps - Progressive web apps (PWAs)
or connectivity. control what is shown to the user in situations where there is no connectivity. this is achieved using a combination of technologies: service workers to control page requests (for example storing them offline), the cache api for storing responses to network requests offline (very useful for storing site assets), and client-side data storage technologies such as web storage and indexeddb to store application data offline. progressive enhancement suppport modern web apps can be developed to provide an excellent experience to fully capable browsers, and an acceptable (although not quite as shiny) experience to less capable browsers. we've been doing this for years with best practices such as progressive enhancement. by using progressive enhancement, pwas are cross-browser. ...
Progressive loading - Progressive web apps (PWAs)
<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 met. in our js13kpwa demo app, the css is simple enough to leave it all in a single file with no specific rules as to how to load them. we could go even further and move everything from style.css to the <style> tag in the <head> of index.html — this would improve performance even more, but for the readability of the example we will skip that approach too. images besides javascript and css, websites will likely contain a number of images. when you include <img> elements in your html, then every referenced image will be fetched and downloaded during initial website access. it's not unusual to have megabytes of image data to dow...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
e) => { console.log('[service worker] install'); }); in the install listener, we can initialize the cache and add files to it for offline use. our js13kpwa app does exactly that. first, a variable for storing the cache name is created, and the app shell files are listed in one array. ...
image-rendering - SVG: Scalable Vector Graphics
note: as a presentation attribute, image-rendering can be used as a css property. see the css image-rendering property for more information. ...
visibility - SVG: Scalable Vector Graphics
lue visible | hidden | collapse default value visible 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 clipping 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...
<pattern> - SVG: Scalable Vector Graphics
Web › SVG › Element › pattern
es. value type: <url>; default value: none; animatable: yes note: for browsers implementing href, if both href and xlink:href are set, xlink:href will be ignored and only href will be used. y this attribute determines the y coordinate shift of the pattern tile. ...
Other Resources - SVG: Scalable Vector Graphics
here is a list of additional resources on svg: mozilla svg resources svg.org svgbasics tutorials w3c svg homepage svg wiki http://wiki.svg.org/index.php?title=..._configuration i moved this from the other resources category, not sure why it's in other resources -nickolay http://developer.mozilla.org/en/docs...%28external%29 ...
SVG: Scalable Vector Graphics
Web › SVG
sed 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, javascript, 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, scripted, 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 rendered at any size without loss of quality and can be easily localized by updating the text within them, without the need of a graphical editor to do so. with proper l...
Using custom elements - Web Components
finally attach some css to the shadow root to style it. ...
XML: Extensible Markup Language
Web › XML
it stands for extensible markup language and is a w3c recommended specification as a general purpose markup language. this means, unlike other markup languages, xml is not predefined so you must define your own tags. the primary purpose of the language is the sharing of data across different systems, such as the internet. ...
Introduction to using XPath in JavaScript - XPath
the total number of nodes contained can be accessed through the snapshotlength property. snapshots do not change with document mutations, so unlike the iterators, the snapshot does not become invalid, but it may not correspond to the current document, for example, the nodes may have been moved, it might contain nodes that no longer exist, or new nodes could have been...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
all rights reserved. note: this reprinted article was originally part of the devedge site. ...
WebAssembly Concepts - WebAssembly
and javascript 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 javascript 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 audio api, etc.). historically, the vm has been able to load only javascript. this has worked well for us as javascript is powerful enough to solve most problems people have on the web today. we have run into performance problems, however, when trying to use javascript for more intensive use cases like 3d games, virtual and augmented reality, computer vision, image/video editing, and a...
Exported WebAssembly functions - WebAssembly
all(), bind(), etc. testfunc.tostring() returns an interesting result: function 0() { [native code] } this gives you more of an idea of its wrapper-type nature. some other particulars to be aware of with exported webassembly functions: their length property is the number of declared arguments in the wasm function signature. their name property is the tostring() result of the function's index in the wasm module. if you try to call a exported wasm function that takes or returns an i64 type value, it currently throws an error because javascript currently has no precise way to represent an i64. this may well change in the future though — a new int64 type is being considered for future standards, which could then be used by wasm. ...