Search completed in 1.20 seconds.
1385 results for "cm":
Your results are loading. Please wait...
NSS tools : cmsutil
name cmsutil — performs basic cryptograpic operations, such as encryption and decryption, on cryptographic message syntax (cms) messages.
... synopsis cmsutil [options] arguments description the cmsutil command-line uses the s/mime toolkit to perform basic operations, such as encryption and decryption, on cryptographic message syntax (cms) messages.
... to run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section.
...And 6 more matches
NSS Tools cmsutil
using cmsutil newsgroup: mozilla.dev.tech.crypto the cmsutil command-line utility uses the s/mime toolkit to perform basic operations, such as encryption and decryption, on cryptographic message syntax (cms) messages.
... syntax to run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section.
...the options and arguments for the cmsutil command are defined as follows: options -ddecode a message.
...And 6 more matches
NSS tools : cmsutil
MozillaProjectsNSStoolscmsutil
name cmsutil — performs basic cryptograpic operations, such as encryption and decryption, on cryptographic message syntax (cms) messages.
... synopsis cmsutil [options] arguments description the cmsutil command-line uses the s/mime toolkit to perform basic operations, such as encryption and decryption, on cryptographic message syntax (cms) messages.
... to run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section.
...And 6 more matches
ECMAScript 2016 to ES.Next support in Mozilla - Archive of obsolete content
(may 2019) ecmascript next refers to new features of the ecma-262 standard (commonly referred to as javascript) introduced after ecmascript 2015.
... new versions of ecmascript specifications are released yearly.
...this year, the es2019 specification will be released and es2020 is the current ecmascript draft specification.
...And 5 more matches
ECMAScript 2015 support in Mozilla - Archive of obsolete content
ecmascript 2015 is the sixth edition of the ecmascript language specification standard.
... code-named "es.next", "harmony", or "ecmascript 6", the first working draft (based on ecmascript 5.1) was published on july 12, 2011 as "es.next".
... in august 2014, the ecmascript 2015 draft specification was feature frozen and went through a stabilization and bug fixing period.
...And 4 more matches
JS_ValueToECMAInt32
convert a javascript value to an integer type as specified by the ecmascript standard.
... syntax jsbool js_valuetoecmaint32(jscontext *cx, jsval v, int32 *ip); jsbool js_valuetoecmauint32(jscontext *cx, jsval v, uint32 *ip); jsbool js_valuetouint16(jscontext *cx, jsval v, uint16 *ip); name type description cx jscontext * the context in which to perform the conversion.
... description js_valuetoecmaint32, js_valuetoecmauint32, and js_valuetouint16 convert a javascript value to various integer types as specified in the ecmascript specification.
...And 4 more matches
ECMAScript 5 support in Mozilla - Archive of obsolete content
ecmascript 5.1, an older version of the standard upon which javascript is based, was approved in june 2011.
... the javascript runtime used in the latest versions of mozilla projects including both firefox and thunderbird has full support for ecmascript 5.1 features.
... supported features added in javascript 1.8.5 (gecko 2, firefox 4 and later) firefox 4 has full ecmascript 5 support including the object.* methods and strict mode.
...And 3 more matches
AesGcmParams - Web APIs
the aesgcmparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.encrypt(), subtlecrypto.decrypt(), subtlecrypto.wrapkey(), or subtlecrypto.unwrapkey(), when using the aes-gcm algorithm.
... for details of how to supply appropriate values for this parameter, see the specification for aes-gcm: nist sp800-38d, in particular section 5.2.1.1 on input data.
...this should be set to aes-gcm.
...And 3 more matches
EncDecMAC using token object - sample 3
encdecmac using token object example: <h2 id="nss_sample_code_3_hashing.">nss sample code 3: enc/dec/mac using token object id.</h2> <p class="summary">computes the hash of a file and saves it to another file, illustrates the use of nss message apis.</p> <pre class="brush: cpp"> /* this source code form is subject to the terms of the mozilla public * license, v.
...t file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printashex(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac) { pk11_destroycontext(ctxmac, pr_true); } if (ctxenc) { pk11_destroycon...
...*/ int main(int argc, char **argv) { secstatus rv; secstatus rvshutdown; pk11slotinfo *slot = null; ploptstate *optstate; ploptstatus status; char headerfilename[50]; char encryptedfilename[50]; prfiledesc *infile; prfiledesc *outfile; prbool ascii = pr_false; commandtype cmd = unknown; const char *command = null; const char *dbdir = null; const char *infilename = null; const char *outfilename = null; const char *noisefilename = null; secupwdata pwdata = { pw_none, 0 }; char * progname = strrchr(argv[0], '/'); progname = progname ?
...And 2 more matches
IDBFactory.cmp() - Web APIs
WebAPIIDBFactorycmp
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.
... syntax var result = indexeddb.cmp(first, second); parameters first the first key to compare.
... 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.
...And 2 more matches
Warning: 08/09 is not a legal ECMA-262 octal constant - JavaScript
the javascript warning "08 (or 09) is not a legal ecma-262 octal constant" occurs when 08 or 09 number literals are used.
... message warning: syntaxerror: 08 is not a legal ecma-262 octal constant.
... warning: syntaxerror: 09 is not a legal ecma-262 octal constant.
...And 2 more matches
Date.prototype.setUTCMinutes() - JavaScript
the setutcminutes() method sets the minutes for a specified date according to universal time.
... syntax dateobj.setutcminutes(minutesvalue[, secondsvalue[, msvalue]]) parameters minutesvalue an integer between 0 and 59, representing the minutes.
... description if you do not specify the secondsvalue and msvalue parameters, the values returned from getutcseconds() and getutcmilliseconds() methods are used.
...And 2 more matches
ECMA - MDN Web Docs Glossary: Definitions of Web-related terms
ecma international (formally european computer manufacturers association) is a non-profit organization that develops standards in computer hardware, communications, and programming languages.
... on the web it is famous for being the organization which maintain the ecma-262 specification (aka.
... ecmascript) which is the core specification for the javascript language.
... learn more ecma international on wikipedia the ecma international web site ...
JS_EnumerateDiagnosticMemoryRegions
syntax void js_enumeratediagnosticmemoryregions(jsenumeratediagnosticmemorycallback callback); name type description callback jsenumeratediagnosticmemorycallback pointer to the new callback function to use.
... callback syntax typedef bool (* jsenumeratediagnosticmemorycallback)(void *ptr, size_t length); name type description ptr void * pointer to the allocated memory.
... description js_enumeratediagnosticmemoryregions enumerates memory regions that contain diagnostic information intended to be included in crash report minidumps.
... see also mxr id search for js_enumeratediagnosticmemoryregions mxr id search for jsenumeratediagnosticmemorycallback bug 662646 ...
nsISyncMessageSender
both sendsyncmessage() and sendrpcmessage() will block until a reply is received, but they may be temporarily interrupted to process an urgent incoming message (such as a cpow request).
... methods jsval sendsyncmessage([optional] in astring messagename, [optional] in jsval obj, [optional] in jsval objects, [optional] in nsiprincipal principal); jsval sendrpcmessage([optional] in astring messagename, [optional] in jsval obj, [optional] in jsval objects, [optional] in nsiprincipal principal); sendsyncmessage() like sendasyncmessage(), except blocks the sender until all listeners of the message have been invoked.
...sendrpcmessage() like sendsyncmessage(), except re-entrant.
... new rpc messages may be issued even if, earlier on the call stack, we are waiting for a reply to an earlier sendrpcmessage() call.
SyncManager - Web APIs
the syncmanager interface of the the serviceworker api provides an interface for registering and listing sync registrations.
... methods syncmanager.register create a new sync registration and return a promise.
... syncmanager.gettags return a list of developer-defined identifiers for syncmanager registration.
... specifications specification status comment web background synchronizationthe definition of 'syncmanager' in that specification.
Date.prototype.getUTCMilliseconds() - JavaScript
the getutcmilliseconds() method returns the milliseconds portion of the time object's value.
... syntax dateobj.getutcmilliseconds() return value an integer number, between 0 and 999, representing the milliseconds portion of the given date object.
... examples using getutcmilliseconds() the following example assigns the milliseconds portion of the current time to the variable milliseconds.
... var today = new date(); var milliseconds = today.getutcmilliseconds(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutcmilliseconds' in that specification.
Date.prototype.getUTCMinutes() - JavaScript
the getutcminutes() method returns the minutes in the specified date according to universal time.
... syntax dateobj.getutcminutes() return value an integer number, between 0 and 59, representing the minutes in the given date according to universal time.
... examples using getutcminutes() the following example assigns the minutes portion of the current time to the variable minutes.
... var today = new date(); var minutes = today.getutcminutes(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutcminutes' in that specification.
Date.prototype.getUTCMonth() - JavaScript
the getutcmonth() returns the month of the specified date according to universal time, as a zero-based value (where zero indicates the first month of the year).
... syntax dateobj.getutcmonth() return value an integer number, between 0 and 11, corresponding to the month of the given date according to universal time.
... examples using getutcmonth() the following example assigns the month portion of the current date to the variable month.
... var today = new date(); var month = today.getutcmonth(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutcmonth' in that specification.
Date.prototype.setUTCMilliseconds() - JavaScript
the setutcmilliseconds() method sets the milliseconds for a specified date according to universal time.
... syntax dateobj.setutcmilliseconds(millisecondsvalue) parameters millisecondsvalue a number between 0 and 999, representing the milliseconds.
... description if a parameter you specify is outside of the expected range, setutcmilliseconds() attempts to update the date information in the date object accordingly.
... examples using setutcmilliseconds() var thebigday = new date(); thebigday.setutcmilliseconds(500); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutcmilliseconds' in that specification.
Date.prototype.setUTCMonth() - JavaScript
the setutcmonth() method sets the month for a specified date according to universal time.
... syntax dateobj.setutcmonth(monthvalue[, dayvalue]) parameters monthvalue an integer between 0 and 11, representing the months january through december.
... if a parameter you specify is outside of the expected range, setutcmonth() attempts to update the date information in the date object accordingly.
... examples using setutcmonth() var thebigday = new date(); thebigday.setutcmonth(11); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutcmonth' in that specification.
calcMode - SVG: Scalable Vector Graphics
the calcmode attribute specifies the interpolation mode for the animation.
...for strings), the calcmode attribute is ignored and discrete interpolation is used.
... specifications specification status comment svg animations level 2the definition of 'calcmode' in that specification.
... editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'calcmode' in that specification.
Cmdline tests - Archive of obsolete content
the cmdline testsuite is located in test/cmdline.
...see test/cmdline/readme document for more information.
... two use cases for the cmdline testsuite: use case 1: test the interactive cmdline debugger test contents: start avmshell -d test.abc, set breakpoint on a line, show local variable value, quit from cmdutils import * def run(): r=runtestlib() r.run_test( 'debugger locals', '%s -d testdata/debug.abc'%r.avmrd, input='break 53\ncontinue\nnext\ninfo locals\nnext\ninfo locals\nquit\n', expectedout=['local1 = undefined','local2 = 10','local2 = 15'] ) use case 2: test -memstats returns memory logs to stdout test contents: start avmshell -memstats test.abc, assert stdout contains 'gross stats', 'sweep m reclaimed n pages.' from cmdutils import * def run(): r=runtestlib() r.run_test(name='memstats', command="%s -memstats testdata/memstats.
ECMAScript - MDN Web Docs Glossary: Definitions of Web-related terms
ecmascript is a scripting language specification on which javascript is based.
... ecma international is in charge of standardizing ecmascript.
... learn more general knowledge ecmascript on wikipedia technical reference ecmascript ...
SCM - MDN Web Docs Glossary: Definitions of Web-related terms
scm (source control management) is a system for managing source code.
...a programmer can modify source code files without being afraid of editing out useful stuff, because a scm keeps track of how the source code has changed and who made the changes.
... some scm systems include cvs, svn, git.
SyncManager.getTags() - Web APIs
the syncmanager.gettags method of the syncmanager interface returns a list of developer-defined identifiers for syncmanager registrations.
... syntax syncmanager.gettags().then(function(tags[]) { ...
... }) returns a promise that resolves to an array of domstrings containing developer-defined identifiers for syncmanager registrations.
SyncManager.register() - Web APIs
the syncmanager.register method of the syncmanager interface returns a promise that resolves to a syncregistration instance.
... syntax syncmanager.register([options]).then(function(syncregistration) { ...
CMS - MDN Web Docs Glossary: Definitions of Web-related terms
a cms (content management system) is software that allows users to publish, organize, change, or remove various kinds of content, not only text but also embedded images, video, audio, and interactive code.
nsStaticModuleInfo
#include "nsxpcom.h" struct nsstaticmoduleinfo { const char* name; nsgetmoduleproc getmodule; }; members name this member provides the name of the module as a null-terminated, ascii-valued character array.
Editor Embedding Guide - Archive of obsolete content
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), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters example normal italics cmd_underline toggles underline on selection.
...And 68 more matches
Index
the file could be named secmod.db, but in newer database generations a file named pkcs11.txt is used.
...nss has an ssl/tls module that implements the secure sockets layer/transport layer security network protocols, an s/mime module that implements cms messaging used by secure email and some instant messaging implementations, a dbm library that implements the classic database storage, and finally a core nss library for the big set of “everything else”.
... when dealing with certificates (x.509), file formats such as pkcs#12 (certificates and keys), pkcs#7 (signed data), and message formats as cms, we should mention asn.1, which is a syntax for storing structured data in a very efficient (small sized) presentation.
...And 35 more matches
Index
3 creating javascript jstest reftests ecmascript, guide, javascript, test in the js/src/tests directory, there are a few important subdirectories.
...it implements the toboolean operation described in ecma 262 §7.1.2.this function can not fail and the return value is always the boolean conversion of the argument.
...it implements the toint32 operator described in ecma 262-3 §9.5.
...And 24 more matches
Python binding for NSS
mozilla source code management (scm) information on march 21, 2013 the nss project switched from using cvs as it's source code manager (scm) to mercurial, also known as hg.
... to check out python-nss source code from mercurial do this: hg clone https://hg.mozilla.org/projects/python-nss the scm tags for various python-nss releases can be found in the release information.
... release information release 1.0.1 release date 2017-02-28 scm tag pynss_release_1_0_1 source download https://ftp.mozilla.org/pub/mozilla.org/security/python-nss/releases/pynss_release_1_0_1/src/ change log add tls 1.3 cipher suites ssl_cipher_info.py now attempts to enable tls 1.3 fix build issue in setup.py.
...And 21 more matches
NSS PKCS11 Functions
secmod_loadusermodule secmod_unloadusermodule secmod_openuserdb secmod_closeuserdb pk11_findcertfromnickname pk11_findkeybyanycert pk11_getslotname pk11_gettokenname pk11_ishw pk11_ispresent pk11_isreadonly pk11_setpasswordfunc secmod_loadusermodule load a new pkcs #11 module based on a modulespec.
... syntax #include "secmod.h" extern secmodmodule *secmod_loadusermodule(char *modulespec, secmodmodule *parent, prbool recurse); parameters this function has the following parameters: modulespec is a pkcs #11 modulespec.
... returns the function returns one of these values: if successful, a pointer to a secmodmodule.
...And 17 more matches
All keyboard shortcuts - Firefox Developer Tools
command windows macos linux open toolbox (with the most recent tool activated) ctrl + shift + i cmd + opt + i ctrl + shift + i bring toolbox to foreground (if the toolbox is in a separate window and not in foreground) ctrl + shift + i or f12 cmd + opt + i or f12 ctrl + shift + i or f12 close toolbox (if the toolbox is in a separate window and in foreground) ctrl + shift + i or f12 cmd + opt + i or f12 ctrl + shift + i or f12 open web console 1 ...
... ctrl + shift + k cmd + opt + k ctrl + shift + k toggle "pick an element from the page" (opens the toolbox and/or focus the inspector tab) ctrl + shift + c cmd + opt + c ctrl + shift + c open style editor shift + f7 shift + f7 * shift + f7 open profiler shift + f5 shift + f5 * shift + f5 open network monitor 2 ctrl + shift + e cmd + opt + e ctrl + shift + e toggle responsive design mode ctrl + shift + m cmd + opt + m ctrl + shift + m open browser console ctrl + shift + j cmd + shift + j ctrl + shift + j open browser toolbox ctrl + alt + shift + i cmd + opt + shift + i ctrl + alt + shift + i open scratchpad shift + f4 shift + f4 * shift + f4 ...
... open webide shift + f8 shift + f8 * shift + f8 storage inspector shift + f9 shift + f9 * shift + f9 open debugger 3 ctrl + shift + z cmd + opt + z ctrl + shift + z 1.
...And 16 more matches
Index - Archive of obsolete content
657 cmdline tests the cmdline testsuite is located in test/cmdline.
...see test/cmdline/readme document for more information.
... two use cases for the cmdline testsuite: 658 running tamarin acceptance tests the tamarin acceptance tests can be used to verify your installation and or local changes that you have made to the source.
...And 13 more matches
NSS functions
if you need to verify for multiple usages use cert_verifycertificatenow cert_verifyocspresponsesignature mxr 3.6 and later cert_verifysigneddata mxr 3.4 and later cert_verifysigneddatawithpublickey mxr 3.7 and later cert_verifysigneddatawithpublickeyinfo mxr 3.7 and later nss_cmpcertchainwcanames mxr 3.2 and later nss_findcertkeatype mxr 3.2 and later cryptography functions the public functions listed here perform cryptographic operations based on the pkcs #11 interface.
... 3.2 and later seckey_destroyencryptedprivatekeyinfo mxr 3.2 and later seckey_destroyprivatekeyinfo mxr 3.2 and later seckey_destroypublickey mxr 3.2 and later seckey_publickeystrength mxr 3.2 and later seckey_updatecertpqg mxr 3.2 and later secmod_addnewmodule mxr 3.3 and later secmod_addnewmoduleex mxr 3.4 and later secmod_deletemoduleex mxr 3.12 and later secmod_cancelwait mxr 3.9.3 and later secmod_candeleteinternalmodule mxr 3.5 and later secmod_createmodule mxr 3.4 and later ...
... secmod_deletemodule mxr 3.4 and later secmod_findmodule mxr 3.4 and later secmod_findslot mxr 3.4 and later secmod_freemodulespeclist mxr 3.4 and later secmod_getdbmodulelist mxr 3.9 and later secmod_getdeadmodulelist mxr 3.9 and later secmod_getmodulespeclist mxr 3.4 and later secmod_hasremovableslots mxr 3.9.3 and later secmod_ismodulepresent mxr 3.2 and later secmod_loadmodule mxr 3.4 and later secmod_loadusermodule mxr 3.4 and later secmod_lookupslot mxr 3.2 and lat...
...And 12 more matches
Introduction - JavaScript
javascript and the ecmascript specification javascript is standardized at ecma international — the european association for standardizing information and communication systems (ecma was formerly an acronym for the european computer manufacturers association) to deliver a standardized, international programming language based on javascript.
... this standardized version of javascript, called ecmascript, behaves the same way in all applications that support the standard.
...the ecmascript standard is documented in the ecma-262 specification.
...And 12 more matches
JavaScript language resources - JavaScript
ecmascript is the scripting language that forms the basis of javascript.
... ecmascript standardized by the ecma international standards organization in the ecma-262 and ecma-402 specifications.
... the following ecmascript standards have been approved or are being worked on: name links release date description current editions ecma-262 10th edition pdf, html, working draft, repository 2019 ecmascript 2019 language specification ecma-262 9th edition pdf, html, working draft, repository 2018 ecmascript 2018 language specification ecma-402 5th edition working draft, repository 2018 ecmascript 2018 internationalization api specification obsolete/historical editions ecma-262 pdf june 1997 ecmascript: a general purpose, cross-platform programming language.
...And 12 more matches
Lexical grammar - JavaScript
the source text of ecmascript scripts gets scanned from left to right and is converted into a sequence of input elements which are tokens, control characters, line terminators, comments or white space.
... ecmascript also defines certain keywords and literals and has rules for automatic insertion of semicolons to end statements.
... only the following unicode code points are treated as line terminators in ecmascript, other line breaking characters are treated as white space (for example, next line, nel, u+0085 is considered as white space).
...And 12 more matches
Strict mode - JavaScript
javascript's strict mode, introduced in ecmascript 5, is a way to opt in to a restricted variant of javascript, thereby implicitly opting-out of "sloppy mode".
... prohibits some syntax likely to be defined in future versions of ecmascript.
... " + nested(); } function notstrict() { return "i'm not strict."; } strict mode for modules ecmascript 2015 introduced javascript modules and therefore a 3rd way to enter strict mode.
...And 12 more matches
context-menu - Archive of obsolete content
declarative contexts you can specify some simple, declarative contexts when you create a menu item by setting the context property of the options object passed to its constructor, like this: var cm = require("sdk/context-menu"); cm.item({ label: "my menu item", context: cm.urlcontext("*.mozilla.org") }); constructor description pagecontext() the page context.
...the example above works because <img> elements can't contain other elements, but in the example below, node.nodename is not guaranteed to be "p" - for example, it won't be "p" if the user context-clicked a link inside a paragraph: var cm = require("sdk/context-menu"); cm.item({ label: "a paragraph", context: cm.selectorcontext("p"), contentscript: 'self.on("context", function (node) {' + ' console.log(node.nodename);' + ' return true;' + '});' }); the content script is executed for every page that a context menu is shown for.
... for example, suppose your add-on looks like this: var script = "self.on('click', function (node, data) {" + " console.log('clicked: ' + node.nodename);" + "});"; var cm = require("sdk/context-menu"); cm.item({ label: "body context", context: cm.selectorcontext("body"), contentscript: script }); this add-on creates a context-menu item that uses selectorcontext to display the item whenever the context menu is activated on any descendant of the <body> element.
...And 11 more matches
Rosetta - Archive of obsolete content
by default, the only possible standardized scripting language for html is ecmascript.
...nevertheless, the increasing computational power of modern browsers together with the introduction of typed arrays in ecmascript allow us, in theory, to build full virtual machines in pure ecmascript.
... therefore, it is also possible, in theory, to use ecmascript for a smaller task: parsing exotic programming languages (i.e., creating compilers).
...And 10 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
47 cms cms, composing, content management system, glossary a cms (content management system) is software that allows users to publish, organize, change, or remove various kinds of content, not only text but also embedded images, video, audio, and interactive code.
... 124 ecma glossary, stub, webmechanics ecma international (formally european computer manufacturers association) is a non-profit organization that develops standards in computer hardware, communications, and programming languages.
... 125 ecmascript glossary, webmechanics ecmascript is a scripting language specification on which javascript is based.
...And 9 more matches
Index - Web APIs
WebAPIIndex
44 aesgcmparams api, aesgcmparams, dictionary, reference, web crypto api the aesgcmparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.encrypt(), subtlecrypto.decrypt(), subtlecrypto.wrapkey(), or subtlecrypto.unwrapkey(), when using the aes-gcm algorithm.
... 108 audiobuffer.getchanneldata() api, audiobuffer, method, reference, web audio api the 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).
... 109 audiobuffer.length api, audiobuffer, property, reference, web audio api, length the length property of the audiobuffer interface returns an integer representing the length, in sample-frames, of the pcm data stored in the buffer.
...And 8 more matches
SubtleCrypto.unwrapKey() - Web APIs
to use aes-gcm, pass an aesgcmparams object.
... for aes-ctr, aes-cbc, aes-gcm, or aes-kw: pass the string identifying the algorithm or an object of the form { "name": algorithm }, where algorithm is the name of the algorithm.
... unwrapping a "raw" key in this example we unwrap an aes-gcm symmetric key.
...And 8 more matches
SubtleCrypto.wrapKey() - Web APIs
to use aes-gcm, pass an aesgcmparams object.
... one advantage of using aes-kw over another aes mode such as aes-gcm is that aes-kw does not require an initialization vector.
...*/ window.crypto.subtle.generatekey( { name: "aes-gcm", length: 256, }, true, ["encrypt", "decrypt"] ) .then((secretkey) => { return wrapcryptokey(secretkey); }) .then((wrappedkey) => { console.log(wrappedkey); }); pkcs #8 wrap this example wraps an rsa private signing key.
...And 8 more matches
JavaScript modules - JavaScript
see node's ecmascript modules documentation for more details.
...see node's ecmascript modules documentation for more details.disabled from version 12.0.0: this feature is behind the --experimental-modules runtime flag.
...see node's ecmascript modules documentation for more details.disabled from version 8.5.0: this feature is behind the --experimental-modules runtime flag.dynamic importchrome full support 63edge full support 79firefox full support 67 full support 67 no support 66 — 67disabled disabled from version 66 until version 67 (exclusive): this feature is behind the javascript.options.dynamicimport preference (needs to be set to true).
...And 8 more matches
JavaScript technologies overview - JavaScript
one of them is the core language (ecmascript), another is the collection of the web apis, including the dom (document object model).
... javascript, the core language (ecmascript) the core language of javascript is standardized by the ecma tc39 committee as a language named ecmascript.
... what falls under the ecmascript scope?
...And 8 more matches
S/MIME functions
function name/documentation source code nss versions nss_cmscontentinfo_getbulkkey mxr 3.2 and later nss_cmscontentinfo_getbulkkeysize mxr 3.2 and later nss_cmscontentinfo_getcontent mxr 3.2 and later nss_cmscontentinfo_getcontentencalgtag mxr 3.2 and later nss_cmscontentinfo_getcontenttypetag mxr 3.2 and later nss_cm...
...scontentinfo_setbulkkey mxr 3.2 and later nss_cmscontentinfo_setcontent mxr 3.2 and later nss_cmscontentinfo_setcontent_data mxr 3.2 and later nss_cmscontentinfo_setcontentencalg mxr 3.2 and later nss_cmscontentinfo_setcontent_digesteddata mxr 3.2 and later nss_cmscontentinfo_setcontent_encrypteddata mxr 3.2 and later nss_cmscontentinfo_setcontent_envelopeddata mxr 3.2 and later nss_cmscontentinfo_setcontent_signeddata mxr 3.2 and later nss_cmsdecoder_cancel mxr 3.2 and later nss_cmsdecoder_finish mxr 3.2 and later n...
...ss_cmsdecoder_start mxr 3.2 and later nss_cmsdecoder_update mxr 3.2 and later nss_cmsdigestcontext_cancel mxr 3.2 and later nss_cmsdigestcontext_finishmultiple mxr 3.2 and later nss_cmsdigestcontext_finishsingle mxr 3.2 and later nss_cmsdigestcontext_startmultiple mxr 3.2 and later nss_cmsdigestcontext_startsingle mxr 3.2 and later nss_cmsdigestcontext_update mxr 3.2 and later nss_cmsdigesteddata_create mxr 3.2 and later nss_cmsdigesteddata_destroy mxr 3.2 and later nss_cmsdigesteddata_getcontentinfo mxr ...
...And 7 more matches
Date - JavaScript
description the ecmascript epoch and timestamps a javascript date is fundamentally specified as the number of milliseconds that have elapsed since midnight on january 1, 1970, utc.
...instead, it is defined in ecma-262 that a maximum of ±100,000,000 (one hundred million) days relative to january 1, 1970 utc (that is, april 20, 271821 bce ~ september 13, 275760 ce) can be represented by the standard date object (equivalent to ±8,640,000,000,000,000 milliseconds).
... date.prototype.getutcmilliseconds() returns the milliseconds (0–999) in the specified date according to universal time.
...And 7 more matches
Object initializer - JavaScript
syntax let o = {} let o = {a: 'foo', b: 42, c: {}} let a = 'foo', b = 42, c = {} let o = {a: a, b: b, c: c} let o = { property: function (parameters) {}, get property() {}, set property(value) {} }; new notations in ecmascript 2015 please see the compatibility table for support for these notations.
...you will see code like this: let a = 'foo', b = 42, c = {}; let o = { a: a, b: b, c: c } with ecmascript 2015, there is a shorter notation available to achieve the same: let a = 'foo', b = 42, c = {}; // shorthand property names (es2015) let o = {a, b, c} // in other words, console.log((o.a === {a}.a)) // true duplicate property names when using the same name for your properties, the second property will overwrite the first.
... let a = {x: 1, x: 2} console.log(a) // {x: 2} in ecmascript 5 strict mode code, duplicate property names were considered a syntaxerror.
...And 7 more matches
Commands - Archive of obsolete content
mozilla uses the convention that command id's start with 'cmd_'.
...a simple way of using commands is as follows: example: simple command example 1 : source view <command id="cmd_openhelp" oncommand="alert('help!');"/> <button label="help" command="cmd_openhelp"/> in this example, instead of placing the oncommand attribute on the button, we instead place it on a command element.
...the result is that when the button is pressed, the command 'cmd_openhelp' is invoked.
...And 6 more matches
New in JavaScript - Archive of obsolete content
ecmascript versions language resources learn more about the ecmascript standards on which the javascript language is based on.
... ecmascript 5 support implementation status for the current standard ecma-262 edition 5.1 in mozilla-based engines and products.
... ecmascript 2015 support implementation status for the draft ecma-262 edition 6 (es2015) in mozilla-based engines and products.
...And 6 more matches
Communicating with frame scripts
asynchronous messaging to send an asynchronous message the frame script uses the global sendasyncmessage() function: // frame script sendasyncmessage("my-addon@me.org:my-e10s-extension-message"); sendasyncmessage() takes one mandatory parameter, which is the name of the message.
... the example below sends a message named "my-e10s-extension-message", with a data payload containing details and tag properties, and exposes the event.target object as a cpow: // frame script addeventlistener("click", function (event) { sendasyncmessage("my-addon@me.org:my-e10s-extension-message", { details : "they clicked", tag : event.target.tagname }, { target : event.target }); }, false); to receive messages from content, a chrome script needs to add a message listener using the message manager's addmessagelistener() api.
... data the json object passed as the second parameter to sendasyncmessage().
...And 6 more matches
NSS_3.12_release_notes.html
ategenericobject (see pk11pub.h) pk11_createpbev2algorithmid (see pk11pub.h) pk11_destroymergelog (see pk11pub.h) pk11_generatekeypairwithopflags (see pk11pub.h) pk11_getpbecryptomechanism (see pk11pub.h) pk11_isremovable (see pk11pub.h) pk11_mergetokens (see pk11pub.h) pk11_writerawattribute (see pk11pub.h) seckey_ecparamstobasepointorderlen (see keyhi.h) seckey_ecparamstokeysize (see keyhi.h) secmod_deletemoduleex (see secmod.h) sec_getregisteredhttpclient (see ocsp.h) sec_pkcs5isalgorithmpbealgtag (see secpkcs5.h) vfy_createcontextdirect (see cryptohi.h) vfy_createcontextwithalgorithmid (see cryptohi.h) vfy_verifydatadirect (see cryptohi.h) vfy_verifydatawithalgorithmid (see cryptohi.h) vfy_verifydigestdirect (see cryptohi.h) vfy_verifydigestwithalgorithmid (see cryptohi.h) new macros f...
...oken_not_logged_in sec_error_ocsp_responder_cert_invalid sec_error_ocsp_bad_signature sec_error_out_of_search_limits sec_error_invalid_policy_mapping sec_error_policy_validation_failed sec_error_unknown_aia_location_type sec_error_bad_http_response sec_error_bad_ldap_response sec_error_failed_to_encode_data sec_error_bad_info_access_location sec_error_libpkix_internal new mechanism flags (see secmod.h) public_mech_aes_flag public_mech_sha256_flag public_mech_sha512_flag public_mech_camellia_flag new oids (see secoidt.h) new ec signature oids sec_oid_ansix962_ecdsa_signature_recommended_digest sec_oid_ansix962_ecdsa_signature_specified_digest sec_oid_ansix962_ecdsa_sha224_signature sec_oid_ansix962_ecdsa_sha256_signature sec_oid_ansix962_ecdsa_sha384_signature sec_oid_ansix962_ecdsa_sh...
...bug 429388: vfychain.main leaks memory bug 396044: warning: usage of uninitialized variable in ckfw/object.c(174) bug 396045: warning: usage of uninitialized variable in ckfw/mechanism.c(719) bug 401986: mac os x leopard build failure in legacydb bug 325805: diff considers mozilla/security/nss/cmd/pk11util/scripts/pkey a binary file bug 385151: remove the link time dependency from nss to softoken bug 387892: add entrust root ca certificate(s) to nss bug 433386: when system clock is off by more than two days, oscp check fails, can result in crash if user tries to view certificate [[@ secitem_compareitem_util] [[@ memcmp] bug 396256: certutil and pp do not print all the generalnames in a cr...
...And 6 more matches
Rhino overview
rhino contains all the features of javascript 1.7 allows direct scripting of java a javascript shell for executing javascript scripts a javascript compiler to transform javascript source files into java class files a javascript debugger for scripts executed with rhino language the javascript language itself is standardized by standard ecma-262 ecmascript: a general purpose, cross-platform programming language.
... rhino 1.6 and greater implement ecma-357 ecmascript for xml (e4x).
... version 1.3 and greater are ecma conformant.
...And 6 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
several months after that, netscape submitted javascript to ecma international, a european standards organization, which resulted in the first edition of the ecmascript standard that year.
... the standard received a significant update as ecmascript edition 3 in 1999, and it has stayed pretty much stable ever since.
...many parts of the fourth edition formed the basis for ecmascript edition 5, published in december of 2009, and for the 6th major edition of the standard, published in june of 2015.
...And 6 more matches
Message manager overview
its most important functions and attributes are: childcount : contains the number of children (typically, browser windows) getchildat() : get the child at the given index loadframescript() : load a frame script into every tab in the browser broadcastasyncmessage() : send a message to frame scripts addmessagelistener() : start listening to a specific message from all frame scripts removemessagelistener() : stop listening to a specific message interfaces nsiframescriptloader nsimessagelistenermanager nsimessagebroadcaster how to access access it using components.classes: // chrome sc...
... its most important functions and attributes are: childcount : contains the number of children (typically, browser tabs) getchildat() : get the child at the given index loadframescript() : load a frame script into every tab in this window broadcastasyncmessage() : send a message to all frame scripts in this window addmessagelistener() : start listening to a specific message from frame scripts removemessagelistener() : stop listening to a specific message interfaces nsiframescriptloader nsimessagelistenermanager nsimessagebroadcaster how to access you can access it as a property of the ...
... its most important functions are: loadframescript() : load a frame script into this browser frame (tab) sendasyncmessage() : send a message to all frame scripts in this browser frame addmessagelistener() : start listening to a specific message from frame scripts removemessagelistener() : stop listening to a specific message interfaces nsiprocesschecker nsiframescriptloader nsimessagelistenermanager nsimessagesender how to access the browser me...
...And 5 more matches
Performance
do some work on the window } function dosomething(message) { result = helper(content, message.data) sendasyncmessage("my-addon:response-from-child", {something: result}) } addmessagelistener("my-addon:request-from-parent", dosomething) why is this bad?
...do some work on the window } function dosomething(message) { frameglobal = message.target result = helper(frameglobal.content, message.data) frameglobal.sendasyncmessage("my-addon:response-from-child", {something: result}) } function addframe(frameglobal) { frameglobal.addmessagelistener("my-addon:request-from-parent", dosomething) } javascript modules are per-process singletons and thus all their objects are only initialized once, which makes them suitable for stateless callbacks.
... store heavyweight state once per process bad: // addon.js var main = new myaddonservice(); main.onchange(statechange); function statechange() { services.mm.broadcastasyncmessage("my-addon:update-configuration", {newconfig: main.serialize()}) } // framescript.js var maincopy; function onupdate(message) { maincopy = myaddonservice.deserialize(message.data.newconfig); } addmessagelistener("my-addon:update-configuration", onupdate) // maincopy used by other functions the main issue here is that a separate object is kept for each tab.
...And 5 more matches
NSS tools : modutil
please contribute to the initial review in mozilla nss bug 836477[1] description the security module database tool, modutil, is a command-line utility for managing pkcs #11 module information both within secmod.db files and within hardware tokens.
... -list [modulename] display basic information about the contents of the secmod.db file.
... -rawadd add the module spec string to the secmod.db database.
...And 5 more matches
NSS tools : modutil
MozillaProjectsNSStoolsmodutil
synopsis modutil [options] arguments description the security module database tool, modutil, is a command-line utility for managing pkcs #11 module information both within secmod.db files and within hardware tokens.
... -list [modulename] display basic information about the contents of the secmod.db file.
... -rawadd add the module spec string to the secmod.db database.
...And 5 more matches
Creating JavaScript jstest reftests
this directory contains tests of spidermonkey conformance to ecmascript as well as spidermonkey non-standard extenstions to ecmascript.
... non262 tests the directory js/src/tests/non262/ should contain all tests of the following type: regressions of spidermonkey non-standard spidermonkey extensions to the javascript language test of "implementation-defined" details of the ecmascript standard for example, the exact definition of pi or some details of array sorting.
... performance tests or stress tests tests of spidermonkey's comformance to the ecmascript standard a brief history: in 2017, spidermonkey started comsuming test262, a comprehensive tests suite for ecmascript implementations.
...And 5 more matches
SubtleCrypto.encrypt() - Web APIs
to use aes-gcm, pass an aesgcmparams object.
...algorithm parameters of invalid sizes, or aes-gcm plaintext longer than 2³⁹−256 bytes).
...the web crypto api supports three different aes modes: ctr (counter mode) cbc (cipher block chaining) gcm (galois/counter mode) it's strongly recommended to use authenticated encryption, which includes checks that the ciphertext has not been modified by an attacker.
...And 5 more matches
JavaScript data types and data structures - JavaScript
variables in javascript are not directly associated with any particular value type, and any variable can be assigned (and re-assigned) values of all types: let foo = 42; // foo is now a number foo = 'bar'; // foo is now a string foo = true; // foo is now a boolean data and structure types the latest ecmascript standard defines nine types: six data types that are primitives, checked by typeof operator: undefined : typeof instance === "undefined" boolean : typeof instance === "boolean" number : typeof instance === "number" string : typeof instance === "string" bigint : typeof instance === "bigint" symbol : typeof instance === "symbol" null : typeof instance === "obje...
... number type ecmascript has two built-in numeric types: number and bigint (see below).
... starting with ecmascript 2015, you are also able to check if a number is in the double-precision floating-point number range using number.issafeinteger() as well as number.max_safe_integer and number.min_safe_integer.
...And 5 more matches
StringView - Archive of obsolete content
/* (npart - 252 << 30) may be not safe in ecmascript!
... ((nchar >>> 18) & 0x3f /* 63 */); atarget[nidx++] = 0x80 /* 128 */ + ((nchar >>> 12) & 0x3f /* 63 */); atarget[nidx++] = 0x80 /* 128 */ + ((nchar >>> 6) & 0x3f /* 63 */); atarget[nidx++] = 0x80 /* 128 */ + (nchar & 0x3f /* 63 */); } else /* if (nchar <= 0x7fffffff) */ { /* 2147483647 */ /* six bytes */ atarget[nidx++] = 0xfc /* 252 */ + /* (nchar >>> 30) may be not safe in ecmascript!
...aaaaaasaaaasaaaaaaaaaaaaaaaaaaaaaaaaabaaaaasaaaaaaaaaaaaaaaaaaaaaaaaaciaaaagaaaaaaaaaaaaaaaaaaaaaaaaaabsawjjlnnvljyachv0cwbfx2xpymnfc3rhcnrfbwfpbgbfx2dtb25fc3rhcnrfxwbhtelcq18yljiunqaaaaacaaiaaaaaaaeaaqabaaaaeaaaaaaaaab1gmkjaaacadeaaaaaaaaayahgaaaaaaagaaaaawaaaaaaaaaaaaaa6ahgaaaaaaahaaaaaqaaaaaaaaaaaaaa8ahgaaaaaaahaaaaagaaaaaaaaaaaaaa+ahgaaaaaaahaaaaawaaaaaaaaaaaaaasipsceilbrufiabihcb0behdaaaasipecmmaaaaaaaaaaaaaaaaaap81agugap8lbaugaa8fqad/jqifiaboaaaaaong/////yx6bcaaaaeaaadp0p////8l8gqgaggcaaaa6cd///8x7umj0v5iiejig+twufrjx8cqbuaasmfbiavaaejhxwafqadot/////rmka8fqac4fwlgafvilrajyabig/gosinldwjdw7gaaaaasixadprdvxajyad/4a8fgaaaaac4ealgafvilrajyabiwfgdsinlsincsmhqp0gb0ejr+hucxco6aaaaaeif0nt0xuijxr8qcwaa/+iph4aaaaaagd1zbcaaahurvuij5eh+////xcyfrgqgaahzww8fqabigz0yaiaaahqeuaaaaabihcb0ffw/8azgaeij5f...
...And 4 more matches
Eclipse CDT
for example, changing the find next command to cmd-g/ctrl-g is not sufficient.
... opening files you can quickly open a file by name using cmd-shift-r/ctrl-shift-r.
... to quickly switch to a recently viewed document use cmd-f6/ctrl-f6.
...And 4 more matches
NSS API Guidelines
high cert lib/certhigh ocsp.h, ocspt.h crmf provides functions, and data types, to handle certificate management message format (cmmf) and certificate request message format (crmf, see rfc 2511) data.
... cmmf no longer exists as a proposed standard; cmmf functions have been incorporated into the proposal for certificate management protocols (cmp).
... same level as ssl lib/crmf cmmf.h, crmf.h, crmft.h, cmmft.h, crmffut.h cryptohi provides high-level cryptographic support operations: such as signing, verifying signatures, key generation, key manipulation, hashing; and data types.
...And 4 more matches
NSS Tools modutil
using the security module database (modutil) newsgroup: mozilla.dev.tech.crypto the security module database tool is a command-line utility for managing pkcs #11 module information within secmod.db files or within hardware tokens.
...this tool can also create key3.db, cert8.db, and secmod.db security database files.
...the options and arguments for the modutil command are defined as follows: options -create create new secmod.db, key3.db, and cert8.db files.
...And 4 more matches
<length> - CSS: Cascading Style Sheets
WebCSSlength
the consequence of this definition is that on such devices, dimensions described in inches (in), centimeters (cm), or millimeters (mm) don't necessary match the size of the physical unit with the same name.
... for high-dpi devices, inches (in), centimeters (cm), and millimeters (mm) are the same as their physical counterparts.
... cm one centimeter.
...And 4 more matches
Grammar and types - JavaScript
ecmascript also has rules for automatic insertion of semicolons (asi) to end statements.
... javascript before ecmascript 2015 does not have block statement scope.
... if (true) { var x = 5; } console.log(x); // x is 5 this behavior changes when using the let declaration (introduced in ecmascript 2015).
...And 4 more matches
Function.prototype.bind() - JavaScript
description the bind() function creates a new bound function, which is an exotic function object (a term from ecmascript 2015) that wraps the original function object.
... // does not work with `new (funca.bind(thisarg, args))` if (!function.prototype.bind) (function(){ var slice = array.prototype.slice; function.prototype.bind = function() { var thatfunc = this, thatarg = arguments[0]; var args = slice.call(arguments, 1); if (typeof thatfunc !== 'function') { // closest thing possible to the ecmascript 5 // internal iscallable function throw new typeerror('function.prototype.bind - ' + 'what is trying to be bound is not callable'); } return function(){ var funcargs = args.concat(slice.call(arguments)) return thatfunc.apply(thatarg, funcargs); }; }; })(); you can partially work around this by inserting the following code at the beginning...
... // yes, it does work with `new (funca.bind(thisarg, args))` if (!function.prototype.bind) (function(){ var arrayprototypeslice = array.prototype.slice; function.prototype.bind = function(otherthis) { if (typeof this !== 'function') { // closest thing possible to the ecmascript 5 // internal iscallable function throw new typeerror('function.prototype.bind - what is trying to be bound is not callable'); } var baseargs= arrayprototypeslice.call(arguments, 1), baseargslength = baseargs.length, ftobind = this, fnop = function() {}, fbound = function() { baseargs.length = baseargslength; // reset to de...
...And 4 more matches
parseInt() - JavaScript
parseint understands exactly two signs: + for positive, and - for negative (since ecmascript 1).
...ecmascript 5 clarifies that 10 (decimal) should be used, but not all browsers support this yet.
... octal interpretations with no radix although discouraged by ecmascript 3 and forbidden by ecmascript 5, many implementations interpret a numeric string beginning with a leading 0 as octal.
...And 4 more matches
JavaScript
the standard for javascript is ecmascript.
... as of 2012, all modern browsers fully support ecmascript 5.1.
... older browsers support at least ecmascript 3.
...And 4 more matches
List of commands - Archive of obsolete content
list of commands (grouped by type) nsdomwindowcontroller commands (generally legal when there is a selection): cmd_copy - copy a selection to the clipboard cmd_cut - cut a selection into the clipboard cmd_paste - paste a selection from the clipboard cmd_selectall cmd_selectnone cmd_copylink cmd_copyimagelocation cmd_copyimagecontents cmd_scrolltop cmd_scrollbottom cmd_scrollpageup cmd_scrollpagedown cmd_scrolllineup cmd_scrolllinedown cmd_scrollleft cmd_scrollright cmd_selectcharprevious cmd_selectcharnext cmd_wordprevious cmd_wordnext cmd_selectwordprevious cmd_selectwordnext cmd_beginline cmd_endline cmd_selectbeginline cmd_selectendline cmd_selectlinep...
...revious cmd_selectlinenext cmd_selectpageprevious cmd_selectpagenext cmd_selectmovetop cmd_selectmovebottom editor commands (legal when the focus is anywhere where you can type text): cmd_paste - paste a selection from the clipboard cmd_pastequote cmd_delete cmd_deletecharbackward cmd_deletecharforward cmd_deletewordbackward cmd_deletewordforward cmd_deletetobeginningofline cmd_deletetoendofline cmd_scrolltop cmd_scrollbottom cmd_movetop cmd_movebottom cmd_selecttop cmd_selectbottom cmd_linenext cmd_lineprevious cmd_selectlinenext cmd_selectlineprevious cmd_charprevious cmd_charnext cmd_selectcharprevious cmd_selectcharnext cmd_beginline cmd_endline cmd_selectbeginline cmd_selectendline cmd_wordprevious cmd_wordnext cmd_selectwordprevious cmd_selectwor...
...dnext cmd_scrollpageup cmd_scrollpagedown cmd_scrolllineup cmd_scrolllinedown cmd_movepageup cmd_movepagedown cmd_selectpageup cmd_selectpagedown other commands the following list other commands (prefixed by cmd_ or browser:) which have not been categorized here yet (though they are in the alphabetical list below): http://lxr.mozilla.org/seamonkey/sou...baroverlay.xul http://lxr.mozilla.org/seamonkey/sou...t/navigator.js http://lxr.mozilla.org/seamonkey/sou...toroverlay.xul http://lxr.mozilla.org/seamonkey/sou...onaltoolbar.js http://lxr.mozilla.org/seamonkey/sou...rceoverlay.xul http://lxr.mozilla.org/seamonkey/sou...extoverlay.xul http://lxr.mozilla.org/seamonkey/sou...lityoverlay.js http://lxr.mozilla.org/seamonkey/sou...oomoverlay.xul http://lxr.mozilla.org/seamonke...
...And 3 more matches
New in JavaScript 1.3 - Archive of obsolete content
the most significant change in javascript 1.3 was compliance with ecma-262 and unicode by removing inconsistencies between javascript 1.2 and the new ecma standard (which was published in june 1997).
... additional features of version 1.2, at the time not specified by ecma-262 were kept in the javascript language (see below for a list of differences).
...--> new features in javascript 1.3 new globals nan infinity undefined new methods isfinite() function.prototype.call() function.prototype.apply() date.utc() date.prototype.getfullyear() date.prototype.setfullyear() date.prototype.getmilliseconds() date.prototype.setmilliseconds() date.prototype.getutcfullyear() date.prototype.getutcmonth() date.prototype.getutcdate() date.prototype.getutchours() date.prototype.getutcminutes() date.prototype.getutcseconds() date.prototype.getutcmilliseconds() date.prototype.toutcstring() date.prototype.setutcfullyear() date.prototype.setutcmonth() date.prototype.setutcdate() date.prototype.setutchours() date.prototype.setutcminutes() date.prototype.setutcseconds() date.prototype.s...
...And 3 more matches
Handling common JavaScript problems - Learn web development
storically, javascript was plagued with cross-browser compatibility problems — back in the 1990s, the main browser choices back then (internet explorer and netscape) had scripting implemented in different language flavours (netscape had javascript, ie had jscript and also offered vbscript as an option), and while at least javascript and jscript were compatible to some degree (both based on the ecmascript specification), things were often implemented in conflicting, incompatible ways, causing developers many nightmares.
... when developers make use of new/nascent javascript features (for example ecmascript 6 / ecmascript next features, modern web apis...) in their code, and find that such features don't work in older browsers.
...the javascript/ecmascript linters we'd recommend are jshint and eslint; these can be used in a variety of ways, some of which we'll detail below.
...And 3 more matches
Localizing with Koala
cmd_enginemanager.label.
... when you are done with translating the cmd_enginemanager.label entity, save the file.
...from the sidebar, add the cmd_addfoundengine string to the newly-created search.properties file in your locale file structure.
...And 3 more matches
NSS 3.52 release notes
note: this change modifies the ck_gcm_params struct to include the ulivbits field which, prior to pkcs #11 v3.0, was ambiguously defined and not included in the nss definition.
... bug 1623374 - support new pkcs #11 v3.0 message interface for aes-gcm and chachapoly.
... bug 1624864 - allow building of gcm-arm32-neon on non-armv7 architectures.
...And 3 more matches
sample2
*/ /* nspr headers */ #include <prthread.h> #include <plgetopt.h> #include <prerror.h> #include <prinit.h> #include <prlog.h> #include <prtypes.h> #include <plstr.h> /* nss headers */ #include <cryptohi.h> #include <keyhi.h> #include <pk11priv.h> #include <cert.h> #include <base64.h> #include <secerr.h> #include <secport.h> #include <secoid.h> #include <secmodt.h> #include <secoidt.h> #include <sechash.h> /* our samples utilities */ #include "util.h" /* constants */ #define blocksize 32 #define modblocksize 128 #define default_key_bits 1024 /* header file constants */ #define enckey_header "-----begin wrapped enckey-----" #define enckey_trailer "-----end wrapped enckey-----" #define mackey_header "-----begin wrapped mackey-----" #define mackey_traile...
...like sample 5, but finds key matching cert in header */ int main(int argc, char **argv) { secstatus rv; ploptstate *optstate; ploptstatus status; prbool initialized = pr_false; commandtype cmd = unknown; const char *dbdir = null; secupwdata pwdata = { pw_none, 0 }; char *subjectstr = null; certname *subject = 0; unsigned int serialnumber = 0; char *serialnumberstr = null; char *truststr = null; certcertdbhandle *certhandle; const char *nicknamestr = null; char *issuernamestr = null; prbool selfsign = pr_false; prbool ascii = pr_false; prbool sigverify = pr_false; const char *headerfil...
...== pl_opt_ok) { switch (optstate->option) { case 'a': ascii = pr_true; break; case 'g': /* generate a csr */ case 'a': /* add cert to database */ case 'h': /* save cert to the header file */ case 'e': /* encrypt with public key from cert in header file */ case 's': /* sign with private key */ case 'd': /* decrypt with the matching private key */ case 'v': /* verify with the matching public key */ cmd = option2command(optstate->option); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p': pwdata.source = pw_plaintext; pwdata.data = strdup(optstate->value); break; case 'i': infilename = strdup(optstate->value); break; case 'b': headerfilename = strdup(optstate->value); break; case 'e': encryptedf...
...And 3 more matches
NSS tools : certutil
certutil supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt).
... creating new security databases certificates, keys, and security modules related to managing certificates are stored in three related databases: * cert8.db or cert9.db * key3.db or key4.db * secmod.db or pkcs11.txt these databases must be created before certificates or keys can be generated.
... certificate request generated by netscape phone: 650-555-0123 common name: john smith email: (not ed) organization: example corp state: california country: us -----begin new certificate request----- miibidcbywibadbmmqswcqydvqqgewjvuzetmbega1uecbmkq2fsawzvcm5pytew mbqga1uebxmntw91bnrhaw4gvmlldzevmbmga1uechmmrxhhbxbszsbdb3jwmrmw eqydvqqdewpkb2huifntaxromfwwdqyjkozihvcnaqebbqadswawsajbamvupdoz kmhnox7rep8cc0lk+ffweuyidx9w5k/bioqokvejxyqzhit9athzbvmosf1y1s8j czdubcg1+ibnxaecaweaaaaama0gcsqgsib3dqebbquaa0earyqzvpyrutq486ny qmtyqnjii1f8c1z+tl4ufylmg8z6lg/j/u1e5t1qqb5e9q4+bhrbrqjrr1jzx3tb 1hp9gg== -----end new certificate request----- creating...
...And 3 more matches
certutil
certutil supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt).
... creating new security databases certificates, keys, and security modules related to managing certificates are stored in three related databases: o cert8.db or cert9.db o key3.db or key4.db o secmod.db or pkcs11.txt these databases must be created before certificates or keys can be generated.
... certificate request generated by netscape phone: 650-555-0123 common name: john smith email: (not ed) organization: example corp state: california country: us -----begin new certificate request----- miibidcbywibadbmmqswcqydvqqgewjvuzetmbega1uecbmkq2fsawzvcm5pytew mbqga1uebxmntw91bnrhaw4gvmlldzevmbmga1uechmmrxhhbxbszsbdb3jwmrmw eqydvqqdewpkb2huifntaxromfwwdqyjkozihvcnaqebbqadswawsajbamvupdoz kmhnox7rep8cc0lk+ffweuyidx9w5k/bioqokvejxyqzhit9athzbvmosf1y1s8j czdubcg1+ibnxaecaweaaaaama0gcsqgsib3dqebbquaa0earyqzvpyrutq486ny qmtyqnjii1f8c1z+tl4ufylmg8z6lg/j/u1e5t1qqb5e9q4+bhrbrqjrr1jzx3tb 1hp9gg== -----end new certificate request----- creating a...
...And 3 more matches
Property attributes
some property attributes are defined in the ecmascript standard, in ecma 262-3 §8.6.1.
... this is the inverse of the ecma standard dontenum attribute.
...in javascript 1.3 and higher, as in ecmascript, attempts to set a value on a read-only property are ignored.
...And 3 more matches
The JavaScript input interpreter - Firefox Developer Tools
multi-line mode for multi-line entry, click the "split pane" icon at the right hand side of the single-line entry field, or press ctrl+b (windows/linux) or cmd+b (macos).
...to execute the snippet that is currently in the editing pane, click the run button or press ctrl+enter (or cmd+return on macos).
... to open a file, press ctrl+o (cmd+o on macos).
...And 3 more matches
AudioBuffer - Web APIs
the buffer contains data in the following format: non-interleaved ieee754 32-bit linear pcm with a nominal range between -1 and +1, that is, 32bits floating point buffer, with each samples between -1.0 and 1.0.
... properties audiobuffer.samplerate read only returns a float representing the sample rate, in samples per second, of the pcm data stored in the buffer.
... audiobuffer.length read only returns an integer representing the length, in sample-frames, of the pcm data stored in the buffer.
...And 3 more matches
Public class fields - JavaScript
syntax class classwithinstancefield { instancefield = 'instance field' } class classwithstaticfield { static staticfield = 'static field' } class classwithpublicinstancemethod { publicmethod() { return 'hello world' } } examples public static fields public static fields are useful when you want a field to exist only once per class, not on every class instance you create.
... class classwithstaticfield { static basestaticfield = 'base static field' static anotherbasestaticfield = this.basestaticfield static basestaticmethod() { return 'base static method output' } } class subclasswithstaticfield extends classwithstaticfield { static substaticfield = super.basestaticmethod() } console.log(classwithstaticfield.anotherbasestaticfield) // expected output: "base static field" console.log(subclasswithstaticfield.substaticfield) // expected output: "base static method output" public instance fields public inst...
... class classwithstaticmethod { static staticmethod() { return 'static method has been called.'; } } console.log(classwithstaticmethod.staticmethod()); // expected output: "static method has been called." the static methods are added to the class constructor with object.defineproperty() at class evaluation time.
...And 3 more matches
Array.from() - JavaScript
polyfill array.from() was added to the ecma-262 standard in the 6th edition (es2015).
... polyfill notes: this algorithm is exactly as specified in ecma-262 6th edition (assuming object and typeerror have their original values and that callback.call() evaluates to the original value of function.prototype.call()).
... in addition, since true iterables cannot be polyfilled, this implementation does not support generic iterables as defined in the 6th edition of ecma-262.
...And 3 more matches
Date.parse() - JavaScript
(see the section date time string format in the ecmascript specification for more details.) for example, "2011-10-10" (date-only form), "2011-10-10t14:48:00" (date-time form), or "2011-10-10t14:48:00.000+09:00" (date-time form with milliseconds and time zone) can be passed and will be parsed.
... the ecmascript specification states: if the string does not conform to the standard format the function may fall back to any implementation–specific heuristics or implementation–specific parsing algorithm.
... however, invalid values in date strings not recognized as simplified iso format as defined by ecma-262 may or may not result in nan, depending on the browser and values provided, e.g.: // non-iso string with invalid date values new date('23/25/2014'); will be treated as a local date of 25 november, 2015 in firefox 30 and an invalid date in safari 7.
...And 3 more matches
Localization - Archive of obsolete content
text/css"?> <!doctype window system "chrome://findfile/locale/findfile.dtd"> <window id="findfile-window" title="&findwindow.title;" persist="screenx screeny width height" orient="horizontal" onload="initsearchlist()" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="findfile.js"/> <popupset> <menupopup id="editpopup"> <menuitem label="&cutcmd.label;" accesskey="&cutcmd.accesskey;"/> <menuitem label="&copycmd.label;" accesskey="&copycmd.accesskey;"/> <menuitem label="&pastecmd.label;" accesskey="&pastecmd.accesskey;" disabled="true"/> </menupopup> </popupset> <keyset> <key id="cut_cmd" modifiers="accel" key="&cutcmd.commandkey;"/> <key id="copy_cmd" modifiers="accel" key="&copycmd.commandkey;"/> <key id="paste_c...
...md" modifiers="accel" key="&pastecmd.commandkey;"/> <key id="close_cmd" keycode="vk_escape" oncommand="window.close();"/> </keyset> <vbox flex="1"> <toolbox> <menubar id="findfiles-menubar"> <menu id="file-menu" label="&filemenu.label;" accesskey="&filemenu.accesskey;"> <menupopup id="file-popup"> <menuitem label="&opencmd.label;" accesskey="&opencmd.accesskey;"/> <menuitem label="&savecmd.label;" accesskey="&savecmd.accesskey;"/> <menuseparator/> <menuitem label="&closecmd.label;" accesskey="&closecmd.accesskey;" key="close_cmd" oncommand="window.close();"/> </menupopup> </menu> <menu id="edit-menu" label="&editmenu.label;" accesskey="&editmenu.accesskey;"...
...> <menupopup id="edit-popup"> <menuitem label="&cutcmd.label;" accesskey="&cutcmd.accesskey;" key="cut_cmd"/> <menuitem label="&copycmd.label;" accesskey="&copycmd.accesskey;" key="copy_cmd"/> <menuitem label="&pastecmd.label;" accesskey="&pastecmd.accesskey;" key="paste_cmd" disabled="true"/> </menupopup> </menu> </menubar> <toolbar id="findfiles-toolbar"> <toolbarbutton id="opensearch" label="&opencmdtoolbar.label;"/> <toolbarbutton id="savesearch" label="&savecmdtoolbar.label;"/> </toolbar> </toolbox> <tabbox> <tabs> <tab label="&searchtab;" selected="true"/> <tab label="&optionstab;"/> </tabs> <tabpanels> <tabpanel id="searchpanel" orient="vertical" context="...
...And 2 more matches
Message manager overview
communicate with frame scripts using addmessagelistener() and broadcastasyncmessage() or sendasyncmessage() functions.
... broadcastasyncmessage() sends the message to every <browser> in every browser window.
...rome script let globalmm = cc["@mozilla.org/globalmessagemanager;1"] .getservice(ci.nsimessagelistenermanager); window message manager the window message manager is associated with a specific browser window, and operates on every <browser> (that is, every content tab) loaded into that window: loadframescript() loads the given script into every <browser> in that browser window broadcastasyncmessage() sends the message to every <browser> in that browser window.
...And 2 more matches
Localizing with Mercurial
# debian/ubuntu $ apt-get install mercurial # fedora $ yum install mercurial # gentoo $ emerge mercurial # arch linux $ pacman -s mercurial # opensolaris $ pkg install sunwmercurial if you prefer a graphical interface, you can download and install mercurialeclipse here.
...mercurial distributed scm (version 1.3.1)), you have installed mercurial successfully!
... type cmd.exe and click ok.
...And 2 more matches
AsyncTestUtils extended framework
synthetic message sets the code that creates synthetic message sets returns instances of the syntheticmessageset class.
... this class not only holds references to the syntheticmessage instances, but it also tracks what folders they were injected into as well as what folders you move them to.
... accessing synthetic messages and headers synmessages [attribute] the js list of syntheticmessages held in the set.
...And 2 more matches
NSS 3.12.4 release notes
currently nss 3.12.4 is in the "review pending" state in the fips 140-2 pre-validation list at http://csrc.nist.gov/groups/stm/cmvp/documents/140-1/140inprocess.pdf added crl distribution point support (see cert.h).
... new functions in the nss shared library: pk11_isinternalkeyslot (see pk11pub.h) secmod_opennewslot (see pk11pub.h) new error codes (see secerr.h): sec_error_bad_info_access_method sec_error_crl_import_failed new oids (see secoidt.h) sec_oid_x509_any_policy the nssckbi pkcs #11 module's version changed to 1.75.
...bug 495717: unable to compile nss/cmd/certutil/keystuff.c on wince bug 496961: provide truncated hmac support for testing tool fipstest bug 497002: lab required nspr-free freebl changes.
...And 2 more matches
Enc Dec MAC Output Public Key as CSR
*/ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printasascii(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printasascii(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac...
... */ int main(int argc, char **argv) { secstatus rv; secstatus rvshutdown; ploptstate *optstate; ploptstatus status; char headerfilename[50]; char encryptedfilename[50]; pk11slotinfo *slot = null; prbool ascii = pr_false; commandtype cmd = unknown; prfiledesc *infile = null; prfiledesc *outfile = null; char *subjectstr = null; certname *subject = null; const char *dbdir = null; const char *infilename = null; const char *outfilename = null;...
...progname + 1 : argv[0]; /* parse command line arguments */ optstate = pl_createoptstate(argc, argv, "c:d:i:o:f:p:z:a:s:r:"); while ((status = pl_getnextopt(optstate)) == pl_opt_ok) { switch (optstate->option) { case 'a': ascii = pr_true; break; case 'c': cmd = option2command(optstate->value); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p': pwdata.source = pw_plaintext; pwdata.data = strdup(optstate->value); break; ...
...And 2 more matches
PKCS #11 Module Specs
these modules specs can be passed by the application directly to nss via the secmod_loadusermodule() call.
...this data is currently stored in secmod.db or pkcs11.txt.
... sample file: library= name="netscape internal crypto module" parameters="configdir=/u/relyea/.netscape certprefix= secmod=secmod.db" nss="flags=internal,pkcs11module trustorder=1 cipherorder=-1 ciphers= slotparams={0x1=[slotflags='rsa,dsa,dh,rc4,rc2,des,md2,md5,sha1,ssl,tls,publiccerts,random'] 0x2=[slotflags='rsa' askpw=only]}" library=dkck32.dll name="datakey signasure 3600" nss="trustorder=50 ciphers= " library=swft32.dll name="netscape software fortezza" parameters="keyfile=/u/relyea/keyfile" nss="trustorder=5...
...And 2 more matches
JSAPI reference
ince javascript 1.9.1 js_max_operation_limit obsolete since javascript 1.9.1 js_operation_weight_base obsolete since javascript 1.9.1 js_setthreadstacklimit obsolete since jsapi 13 js_setscriptstackquota obsolete since javascript 1.8.6 js_setoptions obsolete since jsapi 27 js_getoptions obsolete since jsapi 27 js_toggleoptions obsolete since jsapi 27 enum jsversion jsversion_ecma_3 jsversion_1_6 jsversion_1_7 jsversion_1_8 jsversion_ecma_5 jsversion_default jsversion_unknown jsversion_latest js_getimplementationversion js_getversion js_setversionforcompartment added in spidermonkey 31 js_stringtoversion js_versiontostring js_setversion obsolete since jsapi 25 js::currentglobalornull added in spidermonkey 31 js_getglobalforscopec...
...7 js::touint32 added in spidermonkey 17 js::toint64 added in spidermonkey 17 js::touint64 added in spidermonkey 17 js::tonumber added in spidermonkey 17 js::tostring added in spidermonkey 31 js::ordinarytoprimitive added in spidermonkey 38 js_valuetoconstructor js_valuetofunction js_valuetoobject js_valuetosource js_convertvalue js_valuetoboolean obsolete since jsapi 28 js_valuetoecmaint32 obsolete since jsapi 26 js_valuetoecmauint32 obsolete since jsapi 28 js_valuetoint32 obsolete since jsapi 28 js_valuetonumber obsolete since jsapi 27 js_valuetostring obsolete since jsapi 28 js_valuetouint16 obsolete since jsapi 28 fast, unchecked type-casting macros.
...e since jsapi 31 js_removeobjectroot obsolete since jsapi 31 js_removegcthingroot obsolete since jsapi 31 js_addroot obsolete since javascript 1.8.5 js_addnamedroot obsolete since javascript 1.8.5 js_addnamedrootrt obsolete since javascript 1.8.5 js_removeroot obsolete since javascript 1.8.5 js_removerootrt obsolete since javascript 1.8.5 js_mapgcroots obsolete since jsapi 19 jsgcmaprootfun obsolete since jsapi 19 js_dumpnamedroots obsolete since jsapi 19 local root scopes were another way of protecting objects from the garbage collector.
...And 2 more matches
Using XPCOM Components
the snippet in getting the cookiemanager component in javascript shows how the remove() method from the xpcom cookiemanager component can be called from javascript: getting the cookiemanager component in javascript // xpconnect to cookiemanager // get the cookie manager component in javascript var cmgr = components.classes["@mozilla.org/cookiemanager;1"] .getservice(); cmgr = cmgr.queryinterface(components.interfaces.nsicookiemanager); // called as part of a largerdeleteallcookies() function function finalizecookiedeletions() { for (var c=0; c<deletedcookies.length; c++) { cmgr.remove(deletedcookies[c].host, deletedcookies[c].name, d...
... managing cookies from javascript var cmgr = components.classes["@mozilla.org/cookiemanager;1"] .getservice(); cmgr = cmgr.queryinterface(components.interfaces.nsicookiemanager); function loadcookies() { // load cookies into a table var enumerator = cmgr.enumerator; var count = 0; var showpolicyfield = false; while (enumerator.hasmoreelements()) { var nextcookie = enumerator.getnext(); nextcookie ...
...*/ } function finalizecookiedeletions() { for (var c=0; c<deletedcookies.length; c++) { cmgr.remove(deletedcookies[c].host, deletedcookies[c].name, deletedcookies[c].path, false); } deletedcookies.length = 0; } xxx: in the original document, there were only the first three parameters to the |remove| call.
...And 2 more matches
Index
MozillaTechXPCOMIndex
makes eval() use the last object on its 'obj' param's scope chain as the ecma 'variables object'.
...windows and text inputs have default controllers that allow commands such as cmd_copy to act on the focused element or window.
... 741 nsimessagelistener this interface is used to receive messages sent using the nsimessagebroadcaster, nsimessagesender, or nsisyncmessagesender interfaces.
...And 2 more matches
nsIAppShellService
upstate(in long awindowwidth, in long awindowheight); obsolete since gecko 1.8 nsixulwindow createtoplevelwindow(in nsixulwindow aparent, in nsiuri aurl, in pruint32 achromemask, in long ainitialwidth, in long ainitialheight, in nsiappshell aappshell); nsiwebnav createwindowlessbrowser (in bool aischrome) void destroyhiddenwindow(); void doprofilestartup(in nsicmdlineservice acmdlineservice, in boolean caninteract); obsolete since gecko 1.8 void ensure1window(in nsicmdlineservice acmdlineservice); obsolete since gecko 1.8 void enterlastwindowclosingsurvivalarea(); obsolete since gecko 1.8 void exitlastwindowclosingsurvivalarea(); obsolete since gecko 1.8 void gethiddenwindowandjscontext(out nsidomwindow ahiddendomwindow...
... void hidesplashscreen(); obsolete since gecko 1.8 void initialize(in nsicmdlineservice acmdlineservice, in nsisupports nativeappsupportorsplashscreen); obsolete since gecko 1.8 void quit(in pruint32 aferocity); obsolete since gecko 1.8 void registertoplevelwindow(in nsixulwindow awindow); void run(); obsolete since gecko 1.8 void toplevelwindowismodal(in nsixulwindow awindow, in boolean amodal); obsolete since gecko 1.9.1 void unregistertoplevelwindow(in nsixulwindow awindow); note: prior to gecko 8.0, all references to nsidomwindow used in this interface were nsidomwindowinternal.
... void doprofilestartup( in nsicmdlineservice acmdlineservice, in boolean caninteract ); parameters acmdlineservice the arguments given to the program.
...And 2 more matches
Debugger.Environment - Firefox Developer Tools
ecmascript environments form a tree, in which each local environment is parented by its enclosing environment (in ecmascript terms, its ‘outer’ environment).
... parent the environment that encloses this one (the “outer” environment, in ecmascript terminology), or null if this is the outermost environment.
... getvariable(name) return the value of the variable bound toname in this environment, or undefined if this environment does not bindname.name must be a string that is a valid ecmascript identifier name.
...And 2 more matches
Page inspector keyboard shortcuts - Firefox Developer Tools
command windows macos linux inspect element ctrl + shift + c cmd + shift + c ctrl + shift + c node picker these shortcuts work while the node picker is active.
... command windows macos linux delete the selected node delete delete delete undo delete of a node ctrl + z cmd + z ctrl + z redo delete of a node ctrl + shift + z / ctrl + y cmd + shift + z / cmd + y ctrl + shift + z / ctrl + y move to next node (expanded nodes only) down arrow down arrow down arrow move to previous node up arrow up arrow up arrow move to first node in the tree.
... enter step forward through the attributes of a node tab tab tab step backward through the attributes of a node shift + tab shift + tab shift + tab (when an attribute is selected) start editing the attribute enter return enter hide/show the selected node h h h focus on the search box in the html pane ctrl + f cmd + f ctrl + f edit as html f2 f2 f2 stop editing html f2 / ctrl +enter f2 / cmd + return f2 / ctrl + enter copy the selected node's outer html ctrl + c cmd + c ctrl + c scroll the selected node into view s s s find the next match in the markup, when searching is active enter return enter find the...
...And 2 more matches
SVGLength - Web APIs
WebAPISVGLength
ttype) properties readonly unsigned short unittype float value float valueinspecifiedunits domstring valueasstring constants svg_lengthtype_unknown = 0 svg_lengthtype_number = 1 svg_lengthtype_percentage = 2 svg_lengthtype_ems = 3 svg_lengthtype_exs = 4 svg_lengthtype_px = 5 svg_lengthtype_cm = 6 svg_lengthtype_mm = 7 svg_lengthtype_in = 8 svg_lengthtype_pt = 9 svg_lengthtype_pc = 10 normative document svg 1.1 (2nd edition) example <svg height="200" onload="start();" version="1.1" width="200" xmlns="http://www.w3.org/2000/svg"> <script type="text/javascript"><![cdata[ function start() { var rect = document.getelementbyid("myrect"); ...
... var val = rect.x.baseval; // read x in pixel and cm units console.log("value: " + val.value + ", valueinspecifiedunits: " + val.unittype + ": " + val.valueinspecifiedunits + ", valueasstring: " + val.valueasstring); // set x = 20pt and read it out in pixel and pt units val.newvaluespecifiedunits(svglength.svg_lengthtype_pt, 20); console.log("value: " + val.value + ", valueinspecifiedunits " + val.unittype + ": " + val.valueinspecifiedunits + ", valueasstring: " + val.valueasstring); // convert x = 20pt to inches and read out in pixel and inch units val.converttospecifiedunits(svglength.svg_lengthtype_in); console.log("value: " + val.value + ", valueinspecifiedunits " + val.unittype + ": " + val.valueinspecifie...
...dunits + ", valueasstring: " + val.valueasstring); } ]]></script> <rect id="myrect" x="1cm" y="1cm" fill="green" stroke="black" stroke-width="1" width="1cm" height="1cm" /> </svg> results on a desktop monitor (pixel units will be dpi-dependent): value: 37.7952766418457, valueinspecifiedunits: 6: 1, valueasstring: 1cm value: 26.66666603088379, valueinspecifiedunits 9: 20, valueasstring: 20pt value: 26.66666603088379, valueinspecifiedunits 8: 0.277777761220932, valueasstring: 0.277778in constants name value description svg_lengthtype_unknown 0 the unit type is not one of predefined unit types.
...And 2 more matches
WebRTC Statistics API - Web APIs
rtcaudiosourcestats or rtcvideosourcestats rtcmediasourcestats rtcstats rtcaudiosourcestats or rtcvideosourcestats outbound-rtp statistics describing the state of one of the outbound data streams on this connection.
... rtcaudioreceiverstats or rtcvideoreceiverstats rtcaudiohandlerstats or rtcvideohandlerstats rtcmediahandlerstats rtcstats remote-candidate statistics about a remote ice candidate associated with the connection's rtcicetransports.
... rtcaudiosenderstats or rtcvideosenderstats rtcaudiohandlerstats or rtcvideohandlerstats rtcmediahandlerstats rtcstats stream statistics about a particular media mediastream.
...And 2 more matches
<resolution> - CSS: Cascading Style Sheets
as 1 inch is 2.54 cm, 1dpi ≈ 0.39dpcm.
... dpcm represents the number of dots per centimeter.
... as 1 inch is 2.54 cm, 1dpcm ≈ 2.54dpi.
...And 2 more matches
Rich-Text Editing in Mozilla - Developer guides
nd(aname,false, aarg); document.getelementbyid('editorwindow').contentwindow.focus() } example: a simple but complete rich text editor <!doctype html> <html> <head> <title>rich text editor</title> <script type="text/javascript"> var odoc, sdeftxt; function initdoc() { odoc = document.getelementbyid("textbox"); sdeftxt = odoc.innerhtml; if (document.compform.switchmode.checked) { setdocmode(true); } } function formatdoc(scmd, svalue) { if (validatemode()) { document.execcommand(scmd, false, svalue); odoc.focus(); } } function validatemode() { if (!document.compform.switchmode.checked) { return true ; } alert("uncheck \"show html\"."); odoc.focus(); return false; } function setdocmode(btosource) { var ocontent; if (btosource) { ocontent = document.createtextno...
..." title="print" onclick="printdoc();" src="data:image/png;base64,ivborw0kggoaaaansuheugaaabyaaaawcayaaadetgw7aaaabgdbtueaalgpc/xhbqaaaazis0deap8a/wd/ol2nkwaaaalwsflzaaalewaacxmbajqcgaaaaad0su1fb9oebxczfmgboiwaaaaidevydenvbw1lbnqa9sywvwaaaufjrefuomvtlutsjfeux//n3nn0ydpbh1abrpt4lfqtqkc3jrkkneisiiribbehjjpklivo4m1rrmkkjqirmjruqudkpt71qpipirkpaqdf55tv5vvuszjqtjolseukd3xu/3dpzusc/22wtu2wrn+jg5so/ocdh8ycmjdflehmlkjkvk7kuyn+ufza/rtth76zavocdptrxzqtni3mrwupc+6cktlxz/sddp2uu9uxlmyxz6qm8v4tz8lhf1h+zdqxt7s8olmxtbf4e8qafhjj3kbp2mzkkthpitjp9vh6ihia+whtasx5brpwuemgdondf/2a4m7ukds1jw662+xkqtkeuoqjktojm2h53yfl15psj04zc94wdtibr26fxlc2mzrvbccebz2kirfd414tkmlezbvgt33+qcohgha81swysew0r1uzfnylmtpx80pngqq91lwvk2jgvgnfvzg6ycyrat16gftw5kkkfo1eqltfh5q2ett0biwf+aitq4fdbk+imyo1oxvgf03wafjqvbckvdffryetxqiffygazths0zwag...
...formatting" onclick="formatdoc('removeformat')" src="data:image/png;base64,ivborw0kggoaaaansuheugaaabyaaaawcayaaadetgw7aaaabgdbtueaalgpc/xhbqaaaazis0deap8a/wd/ol2nkwaaaalwsflzaaaoxaaadsqblssogwaaaad0su1fb9oecqmckpi8ciiaaaaidevydenvbw1lbnqa9sywvwaaauhjrefuomtjybgfxab501zwbvval2nhnlmk6mxcjbf69zu+hz/9fb5o1lx+bg45qhl8/fyr5it3xrp/ywtuvvvk3veqgxz70tvbjy8+wv39+2/hz19/mgwjzzutyjaluobv9jimaxheyd3h7ku8fpj2icml8z92dlbtmzdeig3fco7j08foh1kurkm3e9iw54yvkwutuom+lpt/bgbwf3//sf37/1/c02ccg1lb8f//f95dzx74mtmzshhosm6szrq/a6ir/z2rkfejbxulyfpdidi6af///2ckahbp7+7wmavp5n76+p2clrliyl8h9w36aujcbcxm4szmtjac7kza////r3h1w2cfwagafpbqs5g7d95++/p1b4+eck8tawmdw/1h7159+/7r7zcvpz4fohbzewmdwx8gbgagnnatfhzx8zqrj+4vjbh5cqegoyseua/v3n7hxmqi8wugbgygl3vvg7fupk3i5gd9/fja7zsmdazmg/ze52mzesj4yu1xeq/ff7w5dvfvas1lsxc4db7z8c3r8p7qjf///2d...
...And 2 more matches
Making content editable - Developer guides
"allaccess"); user_pref("capability.policy.allowclipboard.clipboard.paste", "allaccess"); example: a simple but complete rich text editor <!doctype html> <html> <head> <title>rich text editor</title> <script type="text/javascript"> var odoc, sdeftxt; function initdoc() { odoc = document.getelementbyid("textbox"); sdeftxt = odoc.innerhtml; if (document.compform.switchmode.checked) { setdocmode(true); } } function formatdoc(scmd, svalue) { if (validatemode()) { document.execcommand(scmd, false, svalue); odoc.focus(); } } function validatemode() { if (!document.compform.switchmode.checked) { return true ; } alert("uncheck \"show html\"."); odoc.focus(); return false; } function setdocmode(btosource) { var ocontent; if (btosource) { ocontent = document.createtextno...
..." title="print" onclick="printdoc();" src="data:image/png;base64,ivborw0kggoaaaansuheugaaabyaaaawcayaaadetgw7aaaabgdbtueaalgpc/xhbqaaaazis0deap8a/wd/ol2nkwaaaalwsflzaaalewaacxmbajqcgaaaaad0su1fb9oebxczfmgboiwaaaaidevydenvbw1lbnqa9sywvwaaaufjrefuomvtlutsjfeux//n3nn0ydpbh1abrpt4lfqtqkc3jrkkneisiiribbehjjpklivo4m1rrmkkjqirmjruqudkpt71qpipirkpaqdf55tv5vvuszjqtjolseukd3xu/3dpzusc/22wtu2wrn+jg5so/ocdh8ycmjdflehmlkjkvk7kuyn+ufza/rtth76zavocdptrxzqtni3mrwupc+6cktlxz/sddp2uu9uxlmyxz6qm8v4tz8lhf1h+zdqxt7s8olmxtbf4e8qafhjj3kbp2mzkkthpitjp9vh6ihia+whtasx5brpwuemgdondf/2a4m7ukds1jw662+xkqtkeuoqjktojm2h53yfl15psj04zc94wdtibr26fxlc2mzrvbccebz2kirfd414tkmlezbvgt33+qcohgha81swysew0r1uzfnylmtpx80pngqq91lwvk2jgvgnfvzg6ycyrat16gftw5kkkfo1eqltfh5q2ett0biwf+aitq4fdbk+imyo1oxvgf03wafjqvbckvdffryetxqiffygazths0zwag...
...formatting" onclick="formatdoc('removeformat')" src="data:image/png;base64,ivborw0kggoaaaansuheugaaabyaaaawcayaaadetgw7aaaabgdbtueaalgpc/xhbqaaaazis0deap8a/wd/ol2nkwaaaalwsflzaaaoxaaadsqblssogwaaaad0su1fb9oecqmckpi8ciiaaaaidevydenvbw1lbnqa9sywvwaaauhjrefuomtjybgfxab501zwbvval2nhnlmk6mxcjbf69zu+hz/9fb5o1lx+bg45qhl8/fyr5it3xrp/ywtuvvvk3veqgxz70tvbjy8+wv39+2/hz19/mgwjzzutyjaluobv9jimaxheyd3h7ku8fpj2icml8z92dlbtmzdeig3fco7j08foh1kurkm3e9iw54yvkwutuom+lpt/bgbwf3//sf37/1/c02ccg1lb8f//f95dzx74mtmzshhosm6szrq/a6ir/z2rkfejbxulyfpdidi6af///2ckahbp7+7wmavp5n76+p2clrliyl8h9w36aujcbcxm4szmtjac7kza////r3h1w2cfwagafpbqs5g7d95++/p1b4+eck8tawmdw/1h7159+/7r7zcvpz4fohbzewmdwx8gbgagnnatfhzx8zqrj+4vjbh5cqegoyseua/v3n7hxmqi8wugbgygl3vvg7fupk3i5gd9/fja7zsmdazmg/ze52mzesj4yu1xeq/ff7w5dvfvas1lsxc4db7z8c3r8p7qjf///2d...
...And 2 more matches
Functions - JavaScript
function parameters starting with ecmascript 2015, there are two new kinds of parameters: default parameters and rest parameters.
... without default parameters (pre-ecmascript 2015) in the past, the general strategy for setting defaults was to test parameter values in the body of the function and assign a value if they are undefined.
... b : 1; return a * b; } multiply(5); // 5 with default parameters (post-ecmascript 2015) with default parameters, a manual check in the function body is no longer necessary.
...And 2 more matches
Array.prototype.indexOf() - JavaScript
polyfill indexof() was added to the ecma-262 standard in the 5th edition; as such it may not be present in all browsers.
...this algorithm matches the one specified in ecma-262, 5th edition, assuming typeerror and math.abs() have their original values.
... } else // all else for (; i !== len; ++i) if (that[i] === member) return i return -1 // if the value was not found, then return -1 } })(object, math.max, math.min) however, if you are more interested in all the little technical bits defined by the ecma standard, and are less concerned about performance or conciseness, then you may find this more descriptive polyfill to be more useful.
...And 2 more matches
typeof - JavaScript
type result undefined "undefined" null "object" (see below) boolean "boolean" number "number" bigint (new in ecmascript 2020) "bigint" string "string" symbol (new in ecmascript 2015) "symbol" function object (implements [[call]] in ecma-262 terms) "function" any other object "object" note: ecmascript 2019 and older permitted implementations to have typeof return any implementation-defined string value for non-callable non-standard exotic objects.
...(reference) a fix was proposed for ecmascript (via an opt-in), but was rejected.
... typeof /s/ === 'function'; // chrome 1-12 non-conform to ecmascript 5.1 typeof /s/ === 'object'; // firefox 5+ conform to ecmascript 5.1 errors before ecmascript 2015, typeof was always guaranteed to return a string for any operand it was supplied with.
...And 2 more matches
with - JavaScript
using with is not recommended, and is forbidden in ecmascript 5 strict mode.
...consider this example: function f(foo, values) { with (foo) { console.log(values); } } if you call f([1,2,3], obj) in an ecmascript 5 environment, then the values reference inside the with statement will resolve to obj.
... however, ecmascript 2015 introduces a values property on array.prototype (so that it will be available on every array).
...And 2 more matches
Template literals (Template strings) - JavaScript
let str = string.raw`hi\n${2+3}!`; // "hi\n5!" str.length; // 6 array.from(str).join(','); // "h,i,\,n,5,!" tagged templates and escape sequences es2016 behavior as of ecmascript 2016, tagged templates conform to the rules of the following escape sequences: unicode escapes started by "\u", for example \u00a9 unicode code point escapes indicated by "\u{}", for example \u{2f804} hexadecimal escapes started by "\x", for example \xa9 octal literal escapes started by "\0o" and followed by one or more digits, for example \0o251 this means that a tagged template l...
...ike the following is problematic, because, per ecmascript grammar, a parser looks for valid unicode escape sequences, but finds malformed syntax: latex`\unicode` // throws in older ecmascript versions (es2016 and earlier) // syntaxerror: malformed unicode character escape sequence es2018 revision of illegal escape sequences tagged templates should allow the embedding of languages (for example dsls, or latex), where other escapes sequences are common.
... the ecmascript proposal template literal revision (stage 4, to be integrated in the ecmascript 2018 standard) removes the syntax restriction of ecmascript escape sequences from tagged templates.
...And 2 more matches
Creating regular expressions for a microsummary generator - Archive of obsolete content
here's a url for the same item in that different style: http://cgi.ebay.com/mozilla-firefox-logo-1-inch-pin-badge-button-browser_w0qqitemz280018439106qqihz018qqcategoryz2036qqcmdzviewitem to accommodate these urls, we can create a second regular expression that matches them.
... here are several other urls of this style: http://cgi.ebay.com/firefox-2002-dvd_w0qqitemz130017517168qqihz003qqcategoryz617qqcmdzviewitem http://cgi.ebay.com/ahm-ho-scale-firefox-tank-car_w0qqitemz290019763032qqihz019qqcategoryz19130qqcmdzviewitem http://cgi.ebay.com/inuyasha-anime-pin-of-kirara-kilala-firefox_w0qqitemz170019463424qqihz007qqcategoryz39557qqcmdzviewitem based on these examples, it looks like the urls all start with "http://cgi.ebay.com/", they all contain the string "qqitemz" followed by the item number, and they all end with the string "qqcmdzviewitem".
... so we might construct the following regular expression to match these urls: ^http://cgi\.ebay\.com/.*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.
...here is what the <pages> section might look like in a microsummary generator for ebay auction item pages: <pages> <include>^http://cgi\.ebay\.com/.*qqitemz.*qqcmdzviewitem</include> <include>^http://cgi\.ebay\.com/ws/ebayisapi\.dll\?viewitem&amp;.*item=</include> </pages> to see these regular expressions in action, install the ebay auction item microsummary generator available from this page of example generators.
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
bject model (dom): dom level 1, dom level 2 and parts of dom level 3 mathematical markup language: mathml version 2.0 extensible markup language (xml): xml 1.0, namespaces in xml, associating style sheets with xml documents 1.0, fragment identifier for xml xsl transformations: xslt 1.0 xml path language: xpath 1.0 resource description framework: rdf simple object access protocol: soap 1.1 ecma-262, revision 3 (javascript 1.5): ecma-262 general cross-browser coding tips even though web standards do exist, different browsers behave differently (in fact, the same browser may behave differently depending on the platform).
...as per the ecmascript specification (which is the specification javascript follows), running new date().getyear() in 2004 will return "104".
... per the ecmascript specification, getyear returns the year minus 1900, originally meant to return "98" for 1998.
... getyear was deprecated in ecmascript version 3 and replaced with getfullyear().
CommandLine - Archive of obsolete content
an nsicommandline object is passed as the first argument of the launched window: example var cmdline = window.arguments[0]; cmdline = cmdline.queryinterface(components.interfaces.nsicommandline); alert(cmdline.handleflagwithparam("test", false)); see also: chrome: command line for single instance applications of course, for a single instance application (see toolkit.singletonwindowtype for more information), the last example still applies the first time your application is launched.
...ationname/clh;1"; const cld_category = "m-applicationname"; var apphandler = { /* nsisupports */ queryinterface : function clh_qi(aiid) { if (aiid.equals(nsicommandlinehandler) || aiid.equals(nsifactory) || aiid.equals(nsisupports)) return this; throw components.results.ns_error_no_interface; }, /* nsicommandlinehandler */ handle : function clh_handle(acmdline) { var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.notifyobservers(acmdline, "commandline-args-changed", null); }, helpinfo : " -test <value> a test attribute\n", /* nsifactory */ createinstance : function mdh_ci(aouter, aiid) { ...
...nts.classes["@mozilla.org/categorymanager;1"] .getservice(nsicategorymanager); catman.deletecategoryentry("command-line-handler", cld_category); }, canunload : function (acompmgr) { return true; } }; function nsgetmodule(acompmgr, afilespec) { return apphandlermodule; } create an observer that will get notified when arguments change: chrome/content/cmdline.js function commandlineobserver() { this.register(); } commandlineobserver.prototype = { observe: function(asubject, atopic, adata) { var cmdline = asubject.queryinterface(components.interfaces.nsicommandline); var test = cmdline.handleflagwithparam("test", false); alert("test = " + test); }, register: function() { var observerservice = components.classes["@mozil...
...hrome/content/window.xul <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="main" title="&window.title;" windowtype="xulmine" style="width: 300px; height: 350px;" persist="screenx screeny width height sizemode"> <script type="application/javascript" src="cmdline.js" /> ...
Scratchpad - Archive of obsolete content
keyboard shortcuts command windows macos linux open the scratchpad shift + f4 shift + f4 shift + f4 run scratchpad code ctrl + r cmd + r ctrl + r run scratchpad code, display the result in the object inspector ctrl + i cmd + i ctrl + i run scratchpad code, insert the result as a comment ctrl + l cmd + l ctrl + l re-evaluate current function ctrl + e cmd + e ctrl + e reload the current page, then run scratchpad code ctrl + shift + r cmd + shift + r ctrl...
... + shift + r save the pad ctrl + s cmd + s ctrl + s open an existing pad ctrl + o cmd + o ctrl + o create a new pad ctrl + n cmd + n ctrl + n close scratchpad ctrl + w cmd + w ctrl + w pretty print the code in scratchpad ctrl + p cmd + p ctrl + p show autocomplete suggestions ctrl + space ctrl + space ctrl + space show inline documentation ctrl + shift + space ctrl + shift + space ctrl + shift + space source editor shortcuts this table lists the default shortcuts for the source editor.
... command windows macos linux go to line ctrl + j, ctrl + g cmd + j, cmd + g ctrl + j, ctrl + g find in file ctrl + f cmd + f ctrl + f select all ctrl + a cmd + a ctrl + a cut ctrl + x cmd + x ctrl + x copy ctrl + c cmd + c ctrl + c paste ctrl + v cmd + v ctrl + v undo ctrl + z cmd + z ctrl + z redo ctrl + shift + z / ctrl + y cmd + s...
...hift + z / cmd + y ctrl + shift + z / ctrl + y indent tab tab tab unindent shift + tab shift + tab shift + tab move line(s) up alt + up alt + up alt + up move line(s) down alt + down alt + down alt + down comment/uncomment line(s) ctrl + / cmd + / ctrl + / ...
E4X - Archive of obsolete content
ArchiveWebE4X
ecmascript for xml (e4x) is a programming language extension that adds native xml support to javascript.
... it does this by providing access to the xml document in a form that feels natural for ecmascript programmers.
... e4x is standardized by ecma international in ecma-357 standard (currently in its second edition, december 2005).
... workaround: var response = xmlhttprequest.responsetext; // bug 270553 response = response.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551 var e4x = new xml(response); resources e4x tutorial processing xml with e4x on mdc e4x for templating see the list of e4x-related pages on mdc ecma-357 standard brendan's presentation e4x at faqts.com e4x quick reference at rephrase.net ...
Function - MDN Web Docs Glossary: Definitions of Web-related terms
only function expressions can be anonymous, function declarations must have a name: // when used as a function expression (function () {}); // or using the ecmascript 2015 arrow notation () => {}; the following terms are not used in the ecmascript language specification, they're jargon used to refer to different types of functions.
... a named function is a function with a function name: // function declaration function foo() {}; // named function expression (function bar() {}); // or using the ecmascript 2015 arrow notation const foo = () => {}; an inner function is a function inside another function (square in this case).
... an outer function is a function containing a function (addsquares in this case): function addsquares(a,b) { function square(x) { return x * x; } return square(a) + square(b); }; //using ecmascript 2015 arrow notation const addsquares = (a,b) => { const square = x => x*x; return square(a) + square(b); }; a recursive function is a function that calls itself.
... function loop(x) { if (x >= 10) return; loop(x + 1); }; //using ecmascript 2015 arrow notation const loop = x => { if (x >= 10) return; loop(x + 1); }; an immediately invoked function expressions (iife) is a function that is called directly after the function is loaded into the browser’s compiler.
Command line crash course - Learn web development
the next images show the command prompts available in windows — there’s a good range of options from the "cmd" program to "powershell" — which can be run from the start menu by typing the program name.
... windows has traditionally had its own terminal-like program called cmd (“the command prompt”) for a long time, but this definitely doesn’t have parity with unix commands, and is equivalent to the old-style windows dos prompt.
...you could stick with the default command prompt (cmd), and many tools will work ok, but you’ll find everything easier if you have better parity with unix tools.
...note that this won’t work if you’re using the default windows command prompt (cmd) — the equivalent there is dir.
Introducing a complete toolchain - Learn web development
git can be downloaded and installed via the git-scm website — download the relevant installer for your system, run it, and follow the on-screen prompts.
... to configure prettier, give .prettierrc.json the following contents: { "singlequote": true, "trailingcomma": "es5" } with these settings, when prettier formats javascript for you it will use single quotes for all your quoted values, and it won't use trailing commas (a newer feature of ecmascript that will cause errors in older browsers).
... next up, we’ll configure eslint — create another file in the root of your will-it-miss directory called .eslintrc.json, and give it the following contents: { "env": { "es6": true, "browser": true }, "extends": "eslint:recommended", "parseroptions": { "ecmaversion": 6, "sourcetype": "module" }, "rules": { "no-console": 0 } } the above eslint configuration says that we want to use the "recommended" eslint settings, that we're going to allow usage of es6 features (such as map() or set()), that we can use module import statements, and that using console.log() is allowed.
... the final config file should look like this — add in the bolded parts and save it: { "env": { "es6": true, "browser": true }, "extends": ["eslint:recommended", "plugin:react/recommended"], "parseroptions": { "ecmaversion": 6, "sourcetype": "module", "ecmafeatures": { "jsx": true } }, "plugins": ["react"], "rules": { "semi": "error", "no-console": 0, "react/jsx-uses-vars": "error" } } as the configuration now uses a plugin called "react", this development dependency also needs to be installed, so that the code is there to actually run that part of the linting proces...
Cross Process Object Wrappers
passing cpows from frame scripts frame scripts can send messages to chrome using one of two global functions: sendasyncmessage() or sendsyncmessage().
...for example, this frame script sends a dom node to chrome when the user clicks it, as the clicked property of the third argument: // frame script addeventlistener("click", function (event) { sendasyncmessage("my-e10s-extension-message", {}, { clicked : event.target }); }, false); in the chrome script, the dom node is now accessible through a cross process object wrapper, as a property of the objects property of the message.
...*/ var button = content.document.getelementbyid("click-me"); button.addeventlistener("mouseover", function (event) { sendasyncmessage("my-addon-message", {}, { element : event.target }); }, false); // chrome script /* load the frame script, then listen for the message.
...consider this code: mm.addmessagelistener("gotloadevent", function (msg) { mm.sendasyncmessage("changedocumenturi", {newuri: "hello.com"}); let uri = msg.objects.document.documenturi; dump("received load event: " + uri + "\n"); }); this sends a message asking the frame script to change the current document uri, then accesses the current document uri via a cpow.
An overview of NSS Internals
the file could be named secmod.db, but in newer database generations a file named pkcs11.txt is used.
...nss has an ssl/tls module that implements the secure sockets layer/transport layer security network protocols, an s/mime module that implements cms messaging used by secure email and some instant messaging implementations, a dbm library that implements the classic database storage, and finally a core nss library for the big set of “everything else”.
... when dealing with certificates (x.509), file formats such as pkcs#12 (certificates and keys), pkcs#7 (signed data), and message formats as cms, we should mention asn.1, which is a syntax for storing structured data in a very efficient (small sized) presentation.
...there are tools for managing nss databases, for dumping or verifying certificates, for registering pkcs#11 modules with a database, for processing cms encrypted/signed messages, etc.
Encrypt Decrypt MAC Keys As Session Objects
tf(pr_stderr, "write error\n"); rv = secfailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printashex(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac) { ...
...*argv) { secstatus rv; secstatus rvshutdown; pk11slotinfo *slot = null; ploptstate *optstate; ploptstatus status; char headerfilename[50]; char encryptedfilename[50]; prfiledesc *infile; prfiledesc *outfile; prbool ascii = pr_false; commandtype cmd = unknown; const char *command = null; const char *dbdir = null; const char *infilename = null; const char *outfilename = null; const char *noisefilename = null; secupwdata pwdata = { pw_none, 0 }; char * progname = strrchr(argv[0], '/'); progname = prog...
...me = strdup(optstate->value); break; case 'z': noisefilename = strdup(optstate->value); break; default: usage(progname); break; } } pl_destroyoptstate(optstate); if (!command || !dbdir || !infilename || !outfilename) usage(progname); if (pl_strlen(command)==0) usage(progname); cmd = command[0] == 'a' ?
...ose filename as inputfile name with extension ".header" */ strcpy(headerfilename, infilename); strcat(headerfilename, ".header"); /* for intermediate encrypted file, choose filename as inputfile name with extension ".enc" */ strcpy(encryptedfilename, infilename); strcat(encryptedfilename, ".enc"); pr_init(pr_user_thread, pr_priority_normal, 0); switch (cmd) { case encrypt: /* if the intermediate header file already exists, delete it */ if (pr_access(headerfilename, pr_access_exists) == pr_success) { pr_delete(headerfilename); } /* if the intermediate encrypted already exists, delete it */ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedfilen...
Encrypt and decrypt MAC using token
tf(pr_stderr, "write error\n"); rv = secfailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printashex(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac) { ...
...*argv) { secstatus rv; secstatus rvshutdown; pk11slotinfo *slot = null; ploptstate *optstate; ploptstatus status; char headerfilename[50]; char encryptedfilename[50]; prfiledesc *infile; prfiledesc *outfile; prbool ascii = pr_false; commandtype cmd = unknown; const char *command = null; const char *dbdir = null; const char *infilename = null; const char *outfilename = null; const char *noisefilename = null; secupwdata pwdata = { pw_none, 0 }; char * progname = strrchr(argv[0], '/'); progname = prog...
...me = strdup(optstate->value); break; case 'z': noisefilename = strdup(optstate->value); break; default: usage(progname); break; } } pl_destroyoptstate(optstate); if (!command || !dbdir || !infilename || !outfilename) usage(progname); if (pl_strlen(command)==0) usage(progname); cmd = command[0] == 'a' ?
...ose filename as inputfile name with extension ".header" */ strcpy(headerfilename, infilename); strcat(headerfilename, ".header"); /* for intermediate encrypted file, choose filename as inputfile name with extension ".enc" */ strcpy(encryptedfilename, infilename); strcat(encryptedfilename, ".enc"); pr_init(pr_user_thread, pr_priority_normal, 0); switch (cmd) { case encrypt: /* if the intermediate header file already exists, delete it */ if (pr_access(headerfilename, pr_access_exists) == pr_success) { pr_delete(headerfilename); } /* if the intermediate encrypted already exists, delete it */ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedfilen...
NSS 3.14 release notes
introduction the nss team has released network security services (nss) 3.14, which is a minor release with the following new features: support for tls 1.1 (rfc 4346) experimental support for dtls 1.0 (rfc 4347) and dtls-srtp (rfc 5764) support for aes-ctr, aes-cts, and aes-gcm support for keying material exporters for tls (rfc 5705) in addition to the above new features, the following major changes have been introduced: support for certificate signatures using the md5 hash algorithm is now disabled by default.
... the following functions have been added to the libssl library included in nss 3.14: dtls_importfd (in ssl.h) dtls_gethandshaketimeout (in ssl.h) ssl_getsrtpcipher (in ssl.h) ssl_setrtpciphers (in ssl.h) support for aes-gcm support for aes-gcm has been added to the nss pkcs #11 module (softoken), based upon the draft 7 of pkcs #11 v2.30.
... warning: because of ambiguity in the current draft text, applications should only use gcm in single-part mode (c_encrypt/c_decrypt).
... 3.14 certchainverifycallback (in certt.h) certchainverifycallbackfunc (in certt.h) cert_pi_chainverifycallback, a new option for certvalparamintype (in certt.h) a new error code: sec_error_application_callback_error (in secerr.h) new for pkcs #11 pkcs #11 mechanisms: ckm_aes_cts ckm_aes_ctr ckm_aes_gcm (see warnings against using c_encryptupdate/c_decryptupdate above) ckm_sha224_key_derivation ckm_sha256_key_derivation ckm_sha384_key_derivation ckm_sha512_key_derivation changes in nss 3.14 bug 333601 - performance enhancements for intel macs when building for intel macs, nss will now take advantage of optimized assembly code for common...
NSS 3.15.2 release notes
new in nss 3.15.2 new functionality aes-gcm ciphersuites: aes-gcm cipher suite (rfc 5288 and rfc 5289) support has been added when tls 1.2 is negotiated.
... specifically, the following cipher suites are now supported: tls_ecdhe_ecdsa_with_aes_128_gcm_sha256 tls_ecdhe_rsa_with_aes_128_gcm_sha256 tls_dhe_rsa_with_aes_128_gcm_sha256 tls_rsa_with_aes_128_gcm_sha256 new functions pk11_cipherfinal has been introduced, which is a simple alias for pk11_digestfinal.
...new pkcs #11 mechanisms no new pkcs#11 mechanisms have been introduced notable changes in nss 3.15.2 bug 880543 - support for aes-gcm ciphersuites that use the sha-256 prf bug 663313 - md2, md4, and md5 signatures are no longer accepted for ocsp or crls, consistent with their handling for general certificate signatures.
... bug 884178 - add pk11_cipherfinal macro bugs fixed in nss 3.15.2 bug 734007 - sizeof() used incorrectly bug 900971 - nssutil_readsecmoddb() leaks memory bug 681839 - allow ssl_handshakenegotiatedextension to be called before the handshake is finished.
NSS 3.47 release notes
notable changes in nss 3.47 bug 1152625 - support aes hw acceleration on armv8 bug 1267894 - allow per-socket run-time ordering of the cipher suites presented in clienthello bug 1570501 - add cmac to freebl and pkcs #11 libraries bugs fixed in nss 3.47 bug 1459141 - make softoken cbc padding removal constant time bug 1589120 - more cbc padding tests bug 1465613 - add ability to distrust certificates issued after a certain date for a specified root cert bug 1588557 - bad debug statement in tls13con.c bug 1579060 - mozilla::pkix tag definitions for issueruniqueid and subjectunique...
...asting to mechanism-specific structs bug 1577953 - support longer (up to rfc maximum) hkdf outputs bug 1508776 - remove refcounting from sftk_freesession (cve-2019-11756) bug 1494063 - support tls exporter in tstclnt and selfserv bug 1581024 - heap overflow in nss utility "derdump" bug 1582343 - soft token mac verification not constant time bug 1578238 - handle invald tag sizes for ckm_aes_gcm bug 1576295 - check all bounds when encrypting with seed_cbc bug 1580286 - nss rejects tls 1.2 records with large padding with sha384 hmac bug 1577448 - create additional nested s/mime test messages for thunderbird bug 1399095 - allow nss-try to be used to test nspr changes bug 1267894 - libssl should allow selecting the order of cipher suites in clienthello bug 1581507 - fix unportable gre...
...p expression in test scripts bug 1234830 - [cid 1242894][cid 1242852] unused values bug 1580126 - fix build failure on aarch64_be while building freebl/gcm bug 1385039 - build nspr tests as part of nss continuous integration bug 1581391 - fix build on openbsd/arm64 after bug #1559012 bug 1581041 - mach-commands -> mach-completion bug 1558313 - code bugs found by clang scanners.
... bug 1578751 - ensure a consistent style for pk11_find_certs_unittest.cc bug 1570501 - add cmac to freebl and pkcs #11 libraries bug 657379 - nss uses the wrong oid for signaturealgorithm field of signerinfo in cms for dsa and ecdsa bug 1576664 - remove -mms-bitfields from mingw nss build.
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
like sample 5, but finds key matching cert in header */ int main(int argc, char **argv) { secstatus rv; ploptstate *optstate; ploptstatus status; prbool initialized = pr_false; commandtype cmd = unknown; const char *dbdir = null; secupwdata pwdata = { pw_none, 0 }; char *subjectstr = null; certname *subject = 0; unsigned int serialnumber = 0; char *serialnumberstr = null; char ...
...e 'g': /* generate a csr */ case 'a': /* add cert to database */ case 'h': /* save cert to the header file */ case 'e': /* encrypt with public key from cert in header file */ case 's': /* sign with private key */ case 'd': /* decrypt with the matching private key */ case 'v': /* verify with the matching public key */ cmd = option2command(optstate->option); break; case 'd': dbdir = strdup(optstate->value); break; case 'f': pwdata.source = pw_fromfile; pwdata.data = strdup(optstate->value); break; case 'p': pwdata.source = pw_plaintext; pwdata.data = strdup(optstate->value); ...
...mberstr = strdup(optstate->value); serialnumber = atoi(serialnumberstr); break; case 't': truststr = strdup(optstate->value); break; case 'v': sigverify = pr_true; break; default: usage(progname); break; } } pl_destroyoptstate(optstate); if (cmd == unknown || !dbdir) usage(progname); /* open db for read/write and authenticate to it */ pr_init(pr_user_thread, pr_priority_normal, 0); initialized = pr_true; rv = nss_initreadwrite(dbdir); if (rv != secsuccess) { pr_fprintf(pr_stderr, "nss_initreadwrite failed\n"); goto cleanup; } pk11_setpasswordfunc(getmodulepassword); slot...
... = pk11_getinternalkeyslot(); if (pk11_needlogin(slot)) { rv = pk11_authenticate(slot, pr_true, &pwdata); if (rv != secsuccess) { pr_fprintf(pr_stderr, "could not authenticate to token %s.\n", pk11_gettokenname(slot)); goto cleanup; } } switch (cmd) { case generate_csr: validategeneratecsrcommand(progname, dbdir, subject, subjectstr, certreqfilename); /* generate a csr */ rv = createcertrequest(slot, &pwdata, subject, certreqfilename, ascii); if (rv != secsuccess) { pr_fprintf(pr_stderr, "create certificate request: failed\n"); goto cleanup; } break; ...
Encrypt Decrypt_MAC_Using Token
*/ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printashex(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac) { ...
...*argv) { secstatus rv; secstatus rvshutdown; pk11slotinfo *slot = null; ploptstate *optstate; ploptstatus status; char headerfilename[50]; char encryptedfilename[50]; prfiledesc *infile; prfiledesc *outfile; prbool ascii = pr_false; commandtype cmd = unknown; const char *command = null; const char *dbdir = null; const char *infilename = null; const char *outfilename = null; const char *noisefilename = null; secupwdata pwdata = { pw_none, 0 }; char * progname = strrchr(argv[0], '/'); progname = prog...
...me = strdup(optstate->value); break; case 'z': noisefilename = strdup(optstate->value); break; default: usage(progname); break; } } pl_destroyoptstate(optstate); if (!command || !dbdir || !infilename || !outfilename) usage(progname); if (pl_strlen(command)==0) usage(progname); cmd = command[0] == 'a' ?
...ose filename as inputfile name with extension ".header" */ strcpy(headerfilename, infilename); strcat(headerfilename, ".header"); /* for intermediate encrypted file, choose filename as inputfile name with extension ".enc" */ strcpy(encryptedfilename, infilename); strcat(encryptedfilename, ".enc"); pr_init(pr_user_thread, pr_priority_normal, 0); switch (cmd) { case encrypt: /* if the intermediate header file already exists, delete it.
NSS Sample Code Sample_3_Basic Encryption and MACing
tf(pr_stderr, "write error\n"); rv = secfailure; break; } /* save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printashex(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac) { ...
...*argv) { secstatus rv; secstatus rvshutdown; pk11slotinfo *slot = null; ploptstate *optstate; ploptstatus status; char headerfilename[50]; char encryptedfilename[50]; prfiledesc *infile; prfiledesc *outfile; prbool ascii = pr_false; commandtype cmd = unknown; const char *command = null; const char *dbdir = null; const char *infilename = null; const char *outfilename = null; const char *noisefilename = null; secupwdata pwdata = { pw_none, 0 }; char * progname = strrchr(argv[0], '/'); progname = prog...
...me = strdup(optstate->value); break; case 'z': noisefilename = strdup(optstate->value); break; default: usage(progname); break; } } pl_destroyoptstate(optstate); if (!command || !dbdir || !infilename || !outfilename) usage(progname); if (pl_strlen(command)==0) usage(progname); cmd = command[0] == 'a' ?
...ose filename as inputfile name with extension ".header" */ strcpy(headerfilename, infilename); strcat(headerfilename, ".header"); /* for intermediate encrypted file, choose filename as inputfile name with extension ".enc" */ strcpy(encryptedfilename, infilename); strcat(encryptedfilename, ".enc"); pr_init(pr_user_thread, pr_priority_normal, 0); switch (cmd) { case encrypt: /* if the intermediate header file already exists, delete it */ if (pr_access(headerfilename, pr_access_exists) == pr_success) { pr_delete(headerfilename); } /* if the intermediate encrypted already exists, delete it */ if (pr_access(encryptedfilename, pr_access_exists) == pr_success) { pr_delete(encryptedfilena...
NSS_Initialize
syntax secstatus nss_initialize(const char *configdir, const char *certprefix, const char *keyprefix, const char *secmodname, pruint32 flags); parameters nss_initialize has five parameters: configdir [in] the directory where the certificate, key, and module databases live.
...secmodname [in] name of the security module database, usually "secmod.db".
...the following limitation applies when this is set : secmod_waitforanytokenevent will not use c_waitforslotevent, in order to prevent the need for c_finalize.
...examples #include <nss.h> secstatus rv; const char *configdir; configdir = ...; /* application-specific */ rv = nss_initialize(configdir, "", "", secmod_db, nss_init_norootinit | nss_init_optimizespace); see also nss_init, nss_initreadwrite, nss_nodb_init, nss_shutdown ...
JS_SetOptions
mxr id search for jsoption_werror jsoption_varobjfix make js_evaluatescript() use the last object on its obj param's scope chain (that is, the global object) as the ecma "variables object".
... mxr id search for jsoption_atline jsoption_xml obsolete since jsapi 15 ecmascript for xml (e4x) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in html script tags.
... mxr id search for jsoption_allow_xml jsoption_moar_xml added in spidermonkey 15 ecmascript for xml (e4x) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in html script tags.
... mxr id search for jsoption_relimit jsoption_anonfunfix added in spidermonkey 1.8 disallow function () {} in statement context, per ecma-262 edition 3.
nsIAppStartup
o use the service: var appstartup = components.classes["@mozilla.org/toolkit/app-startup;1"] .getservice(components.interfaces.nsiappstartup); method overview void createhiddenwindow(); boolean createstartupstate(in long awindowwidth, in long awindowheight); obsolete since gecko 1.9.1 void destroyhiddenwindow(); void doprofilestartup(in nsicmdlineservice acmdlineservice, in boolean caninteract); obsolete since gecko 1.9.1 void ensure1window(in nsicmdlineservice acmdlineservice); obsolete since gecko 1.9.1 void enterlastwindowclosingsurvivalarea(); void exitlastwindowclosingsurvivalarea(); void getstartupinfo(); void hidesplashscreen(); obsolete since gecko 1.9.1 void initialize(in...
... void doprofilestartup( in nsicmdlineservice acmdlineservice, in boolean caninteract ); parameters acmdlineservice the arguments given to the program.
... void ensure1window( in nsicmdlineservice acmdlineservice ); parameters acmdlineservice the command line from which startup args can be read.
... see also nsicmdlineservice nsiappstartup_mozilla_2_0 ...
nsIDOMEvent
method overview boolean deserialize(in constipcmessageptr amsg, out voidptr aiter); violates the xpcom interface guidelines void duplicateprivatedata(); native code only!
...preventdefault(); deprecated since gecko 16.0 void initevent(in domstring eventtypearg, in boolean canbubblearg, in boolean cancelablearg); boolean isdispatchstopped(); violates the xpcom interface guidelines void preventbubble(); obsolete since gecko 24 void preventcapture(); obsolete since gecko 24 void preventdefault(); void serialize(in ipcmessageptr amsg, in boolean aserializeinterfacetype); violates the xpcom interface guidelines void settarget(in nsidomeventtarget atarget); native code only!
...0 forward 0x08000000 help 0x10000000 back 0x20000000 text 0x40000000 alt_mask 0x00000001 control_mask 0x00000002 shift_mask 0x00000004 meta_mask 0x00000008 methods violates the xpcom interface guidelines deserialize() boolean deserialize( in constipcmessageptr amsg, out voidptr aiter ); parameters amsg aiter return value native code only!duplicateprivatedata void duplicateprivatedata(); parameters none.
... violates the xpcom interface guidelines serialize() void serialize( in ipcmessageptr amsg, in boolean aserializeinterfacetype ); parameters amsg aserializeinterfacetype native code only!settarget void settarget( in nsidomeventtarget atarget ); parameters atarget native code only!settrusted void settrusted( in boolean atrusted ); parameters atrusted stopimmediatepropagation() prevents other event listeners from being triggere...
nsIDocShell
load_cmd_normal 0x1 returned by the loadtype attribute for normal loads.
... load_cmd_reload 0x2 returned by the loadtype attribute for reloads.
... load_cmd_history 0x4 returned by the loadtype attribute for history navigation.
... load_cmd_pushstate 0x8 returned by the loadtype attribute when the page has used history.pushstate() character set source constants these constants are not exposed to script.
nsIFrameMessageManager
method overview void addmessagelistener(in astring amessage, in nsiframemessagelistener alistener, [optional] in boolean listenwhenclosed); void removemessagelistener(in astring amessage, in nsiframemessagelistener alistener); void sendasyncmessage(in astring amessage, in astring json); methods addmessagelistener() adds a message listener to the local frame.
... sendasyncmessage() asynchronously sends a message to the listeners.
... void sendasyncmessage( in astring amessage, in astring json ); parameters amessage the name of the message to send to the listeners.
... see also content process event handling nsiframemessagelistener nsisyncmessagesender ...
nsIMacDockSupport
this can be done like this: var docksupport = cc['@mozilla.org/widget/macdocksupport;1'].getservice(ci.nsimacdocksupport); console.log('docksupport:', docksupport); var win = services.wm.getmostrecentwindow('navigator:browser'); var macmenu = win.document.createelementns('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menupopup'); macmenu.setattribute('id', 'mymacmenu'); var macmenuitem = win.document.createelementns('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menuitem'); macmenuitem.setattribute('label', 'show most recent window'); macmenuitem.setattribute('id', 'mymacmenuitem'); macmenuit...
...em.addeventlistener('command', function(){ var docksupport = cc['@mozilla.org/widget/macdocksupport;1'].getservice(ci.nsimacdocksupport); docksupport.activateapplication(true); services.wm.getmostrecentwindow(null).focus() }) macmenu.appendchild(macmenuitem); var mainpopupset = win.document.getelementbyid('mainpopupset'); mainpopupset.appendchild(macmenu); let dockmenuelement = macmenu; //document.getelementbyid("menu_mac_dockmenu");66 let nativemenu = cc["@mozilla.org/widget/standalonenativemenu;1"].createinstance(ci.nsistandalonenativemenu); console.log('dockmenuelement:', dockmenuelement); nativemenu.init(dockmenuelement); docksupport.dockmenu = nativemenu; this replaces the default menu with this one menuitem that says "show most recent window".
...var macmenuitem = services.appshell.hiddendomwindow.document.createelementns('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menuitem'); macmenuitem.setattribute('label', 'show most recent window'); macmenuitem.setattribute('id', 'mymacmenuitem'); macmenuitem.addeventlistener('command', function(){ var docksupport = cc['@mozilla.org/widget/macdocksupport;1'].getservice(ci.nsimacdocksup...
...port); docksupport.activateapplication(true); services.wm.getmostrecentwindow(null).focus() }) services.appshell.hiddendomwindow.document.getelementbyid('menu_mac_dockmenu').appendchild(macmenuitem) this adds the "show most recent window" menuitem from the previous example as a third item.
Debugger keyboard shortcuts - Firefox Developer Tools
command windows macos linux close current file ctrl + w cmd + w ctrl + w search for a string in the current file ctrl + f cmd + f ctrl + f search for a string in all files ctrl + shift + f cmd + shift + f ctrl + shift + f find next in the current file ctrl + g cmd + g ctrl + g search for scripts by name ctrl + p cmd + p ctrl + p resume execution when at a breakpoint f8 f8 1 f8 step over f10 f10 1 f10 step into f11 f11 1 f11 step out shift + f11 shift + f11 1 shift + f11 toggle breakpoint on the currently selected line ctrl + b cmd + b ctrl + b toggle conditional breakpoint on the current...
...ly selected line ctrl + shift + b cmd + shift + b ctrl + shift + b 1.
... note: before firefox 66, the combination ctrl + shift + s on windows and linux or cmd + opt + s on macos would open/close the debugger.
... command windows macos linux increase font size ctrl + + cmd + + ctrl + + decrease font size ctrl + - cmd + - ctrl + - reset font size ctrl + 0 cmd + 0 ctrl + 0 ...
Debugger.Object - Firefox Developer Tools
class a string naming the ecmascript [[class]] of the referent.
... proxytarget if the referent is a non-revoked (scripted) proxy, return a debugger.object instance referring to the ecmascript [[proxytarget]] of the referent.
... proxyhandler if the referent is a non-revoked (scripted) proxy, return a debugger.object instance referring to the ecmascript [[proxyhandler]] of the referent.
...(in the terms used by the ecmascript specification, the variableenvironment of the execution context forcode is the referent, and thebindings appear in a new declarative environment, which is the eval code’s lexicalenvironment.) theoptions argument is as for debugger.frame.prototype.eval.
Toolbox - Firefox Developer Tools
to open the toolbox: select "toggle tools" from the web developer menu (under "tools" on os x and linux, or "firefox" on windows) click the wrench icon (), which is in the main toolbar or under the hamburger menu (), then select "toggle tools" activate any tool hosted in the toolbox (for example, the javascript debugger or the page inspector) press ctrl + shift + i on windows and linux, or cmd + opt + i on os x.
... command windows macos linux cycle through tools left to right ctrl + ] cmd + ] ctrl + ] cycle through tools right to left ctrl + [ cmd + [ ctrl + [ toggle between active tool and settings.
... f1 f1 f1 toggle toolbox between the last 2 docking modes ctrl + shift + d cmd + shift + d ctrl + shift + d toggle split console (except if console is the currently selected tool) esc esc esc these shortcuts work in all tools that are hosted in the toolbox.
... command windows macos linux increase font size ctrl + + cmd + + ctrl + + decrease font size ctrl + - cmd + - ctrl + - reset font size ctrl + 0 cmd + 0 ctrl + 0 ...
CSS values and units - CSS: Cascading Style Sheets
1 cm is not valid.
... absolute length units unit name equivalent to cm centimeters 1cm = 96px/2.54 mm millimeters 1mm = 1/10th of 1cm q quarter-millimeters 1q = 1/40th of 1cm in inches 1in = 2.54cm = 96px pc picas 1pc = 1/16th of 1in pt points 1pt = 1/72th of 1in px pixels 1px = 1/96th of 1in when including a length value, if the length is 0, the unit identifier is...
... dpcm dots per centimetre.
... adds hwb(), device-cmyk(), and color() functions.
itemtype - HTML: Hypertext Markup Language
simple example html <div itemscope itemtype="http://schema.org/product"> <span itemprop="brand">acme</span> <span itemprop="name">executive anvil</span> </div> structured data itemscope itemtype schema.org product itemprop name executive anvil itemprop brand [thing] itemprop name acme example html <div itemscope itemtype="http://schema.org/product"> <span itemprop="brand">acme<br></span> <span itemprop="name">executive an...
...vil<br></span> <img itemprop="image" src="https://udn.realityripple.com/samples/61/fa8ee62aba.png" width="50" height="50" alt="executive anvil logo" /><br> <span itemprop="description">sleeker than acme's classic anvil, the executive anvil is perfect for the business traveler looking for something to drop from a height.
...</span> </div> result html structured data itemscope itemtype product (http://schema.org/product) itemprop name executive anvil itemprop image https://pixabay.com/static/uploads/photo/2015/09/05/18/15/suitcase-924605_960_720.png itemprop description sleeker than acme's classic anvil, the executive anvil is perfect for the business traveler looking for something to drop from a height.
... itemprop mpn 925872 itemprop brand [thing] itemprop name acme itemscope itemprop[itemtype] aggregaterating[aggregaterating] itemprop ratingvalue 4.4 itemprop reviewcount 89 itemprop offers [offer] http://schema.org/offer itemprop pricecurrency usd itemprop price 119.99 itemprop pricevaliduntil 2020-11-05 itemprop itemcondition http://schema.org/usedcondition itemprop availability http://schema.org/instock itemscope itemprop[itemtype] seller [organization] http://schema.org/organization itemprop name executive objects note: a handy tool for extracting microdata struct...
Inheritance and the prototype chain - JavaScript
following the ecmascript standard, the notation someobject.[[prototype]] is used to designate the prototype of someobject.
... since ecmascript 2015, the [[prototype]] is accessed using the accessors object.getprototypeof() and object.setprototypeof().
... with object.create ecmascript 5 introduced a new method: object.create().
...hain) delete a.a; console.log(a.a); // print undefined console.log(b.a); // print undefined the new operator has a shorter chain in this example: function graph() { this.vertices = [4,4]; } var g = new graph(); console.log(g.vertices); // print [4,4] g.vertices = 25; console.log(g.vertices); // print 25 delete g.vertices; console.log(g.vertices); // print undefined with the class keyword ecmascript 2015 introduced a new set of keywords implementing classes.
Private class fields - JavaScript
class classwithprivatestaticfield { static #private_static_field static publicstaticmethod() { classwithprivatestaticfield.#private_static_field = 42 return classwithprivatestaticfield.#private_static_field } } console.assert(classwithprivatestaticfield.publicstaticmethod() === 42) private static fields are added to the class constructor at class evaluation time.
... class baseclasswithprivatestaticfield { static #private_static_field static basepublicstaticmethod() { this.#private_static_field = 42 return this.#private_static_field } } class subclass extends baseclasswithprivatestaticfield { } let error = null try { subclass.basepublicstaticmethod() } catch(e) { error = e} console.assert(error instanceof typeerror) private instance fields private instance fields are declared with # names (pronounced "hash names"), which are identifiers prefixed with #.
... class classwithprivatestaticmethod { static #privatestaticmethod() { return 42 } static publicstaticmethod1() { return classwithprivatestaticmethod.#privatestaticmethod(); } static publicstaticmethod2() { return this.#privatestaticmethod(); } } console.assert(classwithprivatestaticmethod.publicstaticmethod1() === 42); console.assert(classwithprivatestaticmethod.publicstaticme...
...in the following example this refers to the derived class (not the base class) when we try to call derived.publicstaticmethod2(), and thus exhibits the same "provenance restriction" as mentioned above: class base { static #privatestaticmethod() { return 42; } static publicstaticmethod1() { return base.#privatestaticmethod(); } static publicstaticmethod2() { return this.#privatestaticmethod(); } } class derived extends base {} console.log(derived.publicstaticmethod1()); // 42 console.log(derived.publicstaticmethod2()); // typeerror private instance methods private instance methods are methods available on class instances whose access is restricted in the same manner ...
Array.prototype.filter() - JavaScript
polyfill filter() was added to the ecma-262 standard in the 5th edition.
... you can work around this by inserting the following code at the beginning of your scripts, allowing use of filter() in ecma-262 implementations which do not natively support it.
... this algorithm is exactly equivalent to the one specified in ecma-262, 5th edition, assuming that fn.call evaluates to the original value of function.prototype.bind(), and that array.prototype.push() has its original value.
..."] // deleting words words = ['spray', 'limit', 'exuberant', 'destruction', 'elite', 'present'] const deletewords = words.filter( (word, index, arr) => { arr.pop() return word.length < 6 }) console.log(deletewords) // notice 'elite' is not even obtained as its been popped off `words` before filter can even get there // ["spray" ,"limit"] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.filter' in that specification.
Array.prototype.lastIndexOf() - JavaScript
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.
...this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object, typeerror, number, math.floor, math.abs, and math.min have their original values.
... // production steps of ecma-262, edition 5, 15.4.4.15 // reference: http://es5.github.io/#x15.4.4.15 if (!array.prototype.lastindexof) { array.prototype.lastindexof = function(searchelement /*, fromindex*/) { 'use strict'; if (this === void 0 || this === null) { throw new typeerror(); } var n, k, t = object(this), len = t.length >>> 0; if (len === 0) { return -1; } n = len - 1; if (arguments.length > 1) { n = number(arguments[1]); if (n != n) { n = 0; } else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) { n = (n > 0 || -1) * math.floor(math.abs(n)); } } for (k = n >= 0 ?
... specifications specification ecmascript (ecma-262)the definition of 'array.prototype.lastindexof' in that specification.
Array.prototype.map() - JavaScript
polyfill map was added to the ecma-262 standard in the 5th edition.
...this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object, typeerror, and array have their original values and that callback.call evaluates to the original value of function.prototype.call.
... // production steps of ecma-262, edition 5, 15.4.4.19 // reference: http://es5.github.io/#x15.4.4.19 if (!array.prototype.map) { array.prototype.map = function(callback/*, thisarg*/) { var t, a, k; if (this == null) { throw new typeerror('this is null or not defined'); } // 1.
...// filterednumbers is [1, 2, 3, undefined] // numbers is still [1, 2, 3, 4] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.map' in that specification.
Array.prototype.some() - JavaScript
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.
... this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object and typeerror have their original values and that fun.call evaluates to the original value of function.prototype.call().
... // production steps of ecma-262, edition 5, 15.4.4.17 // reference: http://es5.github.io/#x15.4.4.17 if (!array.prototype.some) { array.prototype.some = function(fun, thisarg) { 'use strict'; if (this == null) { throw new typeerror('array.prototype.some called on null or undefined'); } if (typeof fun !== 'function') { 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.
...lues = [true, 'true', 1]; function getboolean(value) { 'use strict'; if (typeof value === 'string') { value = value.tolowercase().trim(); } return truthy_values.some(function(t) { return t === value; }); } getboolean(false); // false getboolean('false'); // false getboolean(1); // true getboolean('true'); // true specifications specification ecmascript (ecma-262)the definition of 'array.prototype.some' in that specification.
Function.name - JavaScript
(function() {}).name; // "" (() => {}).name; // "" inferred function names variables and methods can infer the name of an anonymous function from its syntactic position (new in ecmascript 2015).
...constructor.name to check the "class" of an object (but be sure to read the warnings below): function foo() {} // es2015 syntax: class foo {} var fooinstance = new foo(); console.log(fooinstance.constructor.name); // logs "foo" warning: the script interpreter will set the built-in function.name property only if a function does not have an own property called name (see section 9.2.11 of the ecmascript2015 language specification).
... however, es2015 specifies the static keyword such that static methods will be set as ownproperty of the class constructor function (ecmascript2015, 14.5.14.21.b + 12.2.6.9).
... let sym1 = symbol("foo"); let sym2 = symbol(); let o = { [sym1]: function(){}, [sym2]: function(){} }; o[sym1].name; // "[foo]" o[sym2].name; // "" specifications specification ecmascript (ecma-262)the definition of 'name' in that specification.
Map - JavaScript
in the current ecmascript specification, -0 and +0 are considered equal, although this was not so in earlier drafts.
... note: since ecmascript 2015, objects do preserve creation order for string and symbol keys.
... in javascript engines that comply with the ecmascript 2015 spec, iterating over an object with only string keys will yield the keys in order of insertion.
...let merged = new map([...first, ...second, [1, 'eins']]) console.log(merged.get(1)) // eins console.log(merged.get(2)) // dos console.log(merged.get(3)) // three specifications specification ecmascript (ecma-262)the definition of 'map' in that specification.
Object.prototype.__proto__ - JavaScript
warning: while object.prototype.__proto__ is supported today in most browsers, its existence and exact behavior has only been standardized in the ecmascript 2015 specification as a legacy feature to ensure compatibility for web browsers.
...it was never originally included in the ecmascript language spec, but modern browsers implemented it anyway.
... only recently was the __proto__ property standardized by the ecmascript 2015 specification for compatibility with web browsers, so it will be supported into the future.
...n test() {}; test.prototype.myname = function () { console.log('myname'); }; var a = new test(); console.log(a.__proto__ === test.prototype); // true a.myname(); // myname // or var fn = function () {}; fn.prototype.myname = function () { console.log('myname'); }; var obj = { __proto__: fn.prototype }; obj.myname(); // myname specifications specification ecmascript (ecma-262)the definition of 'object.prototype.__proto__' in that specification.
String - JavaScript
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.
...(see object.defineproperty() for more information.) comparing strings in c, the strcmp() function is used for comparing strings.
...part of the ecmascript 5 standard.
...for example: let outputstrings = [] for (let i = 0, n = inputvalues.length; i < n; ++i) { outputstrings.push(string(inputvalues[i])); } specifications specification ecmascript (ecma-262)the definition of 'string' in that specification.
Spread syntax (...) - JavaScript
syntax for function calls: myfunction(...iterableobj); for array literals or strings: [...iterableobj, '4', 'five', 6]; for object literals (new in ecmascript 2018): let objclone = { ...obj }; rest syntax (parameters) rest syntax looks exactly like spread syntax.
... spread in object literals the rest/spread properties for ecmascript proposal (es2018) added spread properties to object literals.
... specifications specification ecmascript (ecma-262)the definition of 'array initializer' in that specification.
... ecmascript (ecma-262)the definition of 'object initializer' in that specification.
Trailing commas - JavaScript
javascript has allowed trailing commas in array literals since the beginning, and later added them to object literals (ecmascript 5) and most recently (ecmascript 2017) to function parameters.
... var arr = [1, 2, 3,,,]; arr.length; // 5 objects starting with ecmascript 5, trailing commas in object literals are legal as well: var object = { foo: "bar", baz: "qwerty", age: 42, }; trailing commas in functions ecmascript 2017 allows trailing commas in function parameter lists.
...ssignment: // array destructuring with trailing comma [a, b,] = [1, 2]; // object destructuring with trailing comma var o = { p: 42, q: true, }; var {p, q,} = o; again, when using a rest element, a syntaxerror will be thrown: var [a, ...b,] = [1, 2, 3]; // syntaxerror: rest element may not have a trailing comma trailing commas in json trailing commas in objects were only introduced in ecmascript 5.
... both lines will throw a syntaxerror: json.parse('[1, 2, 3, 4, ]'); json.parse('{"foo" : 1, }'); // syntaxerror json.parse: unexpected character // at line 1 column 14 of the json data omit the trailing commas to parse the json correctly: json.parse('[1, 2, 3, 4 ]'); json.parse('{"foo" : 1 }'); specifications specification ecmascript (ecma-262) ...
Web audio codec guide - Web media technologies
codec name (short) full codec name container support aac advanced audio coding mp4, adts, 3gp alac apple lossless audio codec mp4, quicktime (mov) amr adaptive multi-rate 3gp flac free lossless audio codec mp4, ogg, flac g.711 pulse code modulation (pcm) of voice frequencies rtp / webrtc g.722 7 khz audio coding within 64 kbps (for telephony/voip) rtp / webrtc mp3 mpeg-1 audio layer iii mp4, adts, mpeg1, 3gp opus opus webm, mp4, ogg vorbis vorbis webm, ogg [1] when mpeg-1 audio layer iii codec data is stored in an mpeg file, and there is no video track on the file, the file is...
...the audio is encoded using pulse code modulation (pcm) with either µ-law or a-law encoding.
... g.722 audio is encoded using adaptive differential pulse code modulation (adpcm), in which each sample is represented not by its absolute value, but as a value indicating how much the new sample differs from the previous sample.
... kbps; however, in practice 64 kbps is always used g.722 annex b super wide-band: 64 kbps, 80 kbps, and 96 kbps g.722 annex d stereo wide-band: 64 kbps and 80 kbps g.722 annex d stereo super wide-band: 80 kbps, 96 kbps, 112 kbps, and 128 kbps variable bit rate (vbr) support no supported sample formats 14-bit integer supported sample rates 16 khz (adpcm is specified to allow 8 khz, 11.025 khz, 22.05 khz, 44.1 khz, but g.722 uses 16 khz) recommended minimum bit rate for stereo sound 128 kbps at 44.1 khz sample rate compression lossy maximum audio channels 2 audio frequency bandwidth 50 hz - 7 khz latency 4 ms browser compatibility feature chro...
Media container formats (file types) - Web media technologies
through quicktime, mac applications (including web browsers, through the quicktime plugin or direct quicktime integration) were able to read and write audio formats including aac, aiff, mp3, pcm, and qualcomm purevoice; and video formats including avi, dv, pixlet, prores, flac, cinepak, 3gp, h.261 through h.265, mjpeg, mpeg-1 and mpeg-4 part 2, sorenson, and many more.
... sorenson video 3 no audio codecs supported by quicktime codec browser support chrome edge firefox safari aac no alaw 2:1 no apple lossless (alac) no he-aac no mpeg-1 audio layer iii (mp3) no microsoft adpcm no µ-law 2:1 (u-law) no wave (wav) the waveform audio file format (wave), usually referred to simply as wav due to its filename extension being .wav, is a format developed by microsoft and ibm to store audio bitstream data.
...the wav codec registry can be found at rfc 2361; however, because nearly all wav files use linear pcm, support for the other codecs is sparse.
... audio codecs supported by wave codec browser support chrome edge firefox safari adpcm (adaptive differential pulse code modulation) no gsm 06.10 no lpcm (linear pulse code modulation) yes mpeg-1 audio layer iii (mp3) no µ-law (u-law) no webm webm (web media) is a format based on matroska which is designed specifically for use in modern web environments.
Codecs used by WebRTC - Web media technologies
however, rfc 7742 specifies that all webrtc-compatible browsers must support vp8 and h.264's constrained baseline profile for video, and rfc 7874 specifies that browsers must support at least the opus codec as well as g.711's pcma and pcmu formats.
... mandatory audio codecs codec name browser compatibility opus chrome, edge, firefox, safari g.711 pcm (a-law) chrome, firefox, safari g.711 pcm (µ-law) chrome, firefox, safari see below for more details about any webrtc-specific considerations that exist for each codec listed above.
... g.711 g.711 defines the format for pulse code modulation (pcm) audio as a series of 8-bit integer samples taken at a sample rate of 8,000 hz, yielding a bit rate of 64 kbps.
... preferred codecs for webrtc in major web browsers audio video chrome edge firefox vp9 (firefox 46 and later) vp8 opera safari choosing the right codec before choosing a codec that isn't one of the mandatory codecs (vp8 or avc for video and opus or pcm for audio), you should seriously consider the potential drawbacks: in particular, only these codecs can be generally assumed to be available on essentially all devices that support webrtc.
Code snippets - Archive of obsolete content
rosetta by default, the only possible standardized scripting language for html is ecmascript.
...nevertheless, the increasing computational power of modern browsers together with the introduction of typed arrays in ecmascript allow us, in theory, to build full virtual machines in pure ecmascript.
... therefore, it is also possible, in theory, to use ecmascript for a smaller task: parsing exotic programming languages (i.e., creating compilers).
JXON - Archive of obsolete content
the ecmascript standard (javascript) indicates that object iteration order is implementation dependent.
...|| null, squalifiedname || "", odocumenttype || null); loadobjtree(onewdoc, onewdoc, oobjtree); return onewdoc; }; const svalprop = "keyvalue", sattrprop = "keyattributes", sattrspref = "@", /* you can customize these values */ acache = [], risnull = /^\s*$/, risbool = /^(?:true|false)$/i; })(); note: the current implementation of const (constant statement) is not part of ecmascript 5.
...const is going to be defined by ecmascript 6, but with different semantics.
List of Mozilla-Based Applications - Archive of obsolete content
dogtag certificate system uses nss dojo javascript toolkit uses mozilla rhino in shrinksafe eclipse platform open development platform the ajax toolkit framework, standard widget toolkit and eclipsemozilla projects make use of mozilla elixon wcms/xul web content management system fully remote xul wcms (no need to install extensions).
...nux distro mozcards, jolistopwatch, jolitimer simple apps for maemo uses xulrunner moznet .net control embeddable gecko for .net applications wraps xulrunner for use in .net applications my internet browser localized browser uses gecko myna application server javascript application server for java uses mozilla rhino nextcms (fr) cms nightingale music player community run effort to continue songbird support for linux olpc web browser browser oneteam jabber client opendocument viewer viewer opengate's tools cd burner, file browser, and hardware diagnostic softwares opengate is the opensource side of the easyneuf project, “a free so...
...cenari platform application suite for designing publishing chains script it android development platform uses mozilla rhino, develop directly on your android device seamonkey suite a volunteer community legally backed by mozilla foundation with 2.5 million downloads secure browser browser that uses virtualization created by dell sept cms for lemonde.fr web site more information here (in english) and here (in french) skyfire mobile browser sipear im client smartreport supervision appliance network monitoring and performance management smartreport is an appliance created by acipia (france).
Updating Commands - Archive of obsolete content
a simple way of doing this is the following: var controller = document.commanddispatcher.getcontrollerforcommand("cmd_paste"); if (controller && controller.iscommandenabled("cmd_paste")){ controller.docommand(command); } the code above first retrieves the controller for the 'cmd_paste' command from the command dispatcher.
...<script src="chrome://global/content/globaloverlay.js"/> <command id="cmd_paste" oncommand="godocommand('cmd_paste');"/> <button label="paste" command="cmd_paste"/> the example above will implement a paste button.
...a simple command updater looks like this: <commandset id="updatepasteitem" commandupdater="true" events="focus" oncommandupdate="goupdatecommand('cmd_paste');"/> a command updater is indicated by using the commandupdater attribute, which should be set to true.
Windows and menus in XULRunner - Archive of obsolete content
you can add a <commandset> and <command> elements like this: <commandset> <command id="cmd_open" label="&file.open;" oncommand="dofileopen();"/> <command id="cmd_save" label="&file.save;" oncommand="dofilesave();"/> </commandset> ...
... <menuitem command="cmd_open"/> <menuitem command="cmd_save"/> ...
... <toolbarbutton id="open" command="cmd_open"/> <toolbarbutton id="save" command="cmd_save"/> ...
Browser Detection and Cross Browser Support - Archive of obsolete content
introduction in an ideal world, we could author html, xml, css and javascript and only worry about the w3c and ecma standards.
... gecko was designed from the ground up to be compliant with the w3c html, w3c css, w3c xml, w3c dom, and ecmascript (javascript) standards.
... since browsers such as netscape navigator 4 and internet explorer 4 do not support some of the most recent additions to the javascript (ecmascript) standard, it is often necessary to limit the use of advanced javascript features such as exception processing.
New in JavaScript 1.8.5 - Archive of obsolete content
bug 429507 new ecmascript5 features get and set operators now allows the identifier to be numeric or a string.
... other standardization work various non-standard syntaxes for defining getters and setters have been removed; ecmascript 5 defined syntax has not been changed.
... global objects made read only: the nan, infinity, and undefined global objects have been made read only, per the ecmascript 5 specification.
Archived JavaScript Reference - Archive of obsolete content
see also the newer version of date.prototype.tolocaledatestring().ecmascript 2016 to es.next support in mozillaexpression closuresexpression closures are a shorthand function syntax for writing simple functions.for each...inthe for each...in statement iterates a specified variable over all values of object's properties.
...do not use it!handler.enumerate()the handler.enumerate() method used to be a trap for for...in statements, but has been removed from the ecmascript standard in es2016 and is deprecated in browsers.legacy generator functionthe legacy generator function statement declares legacy generator functions with the specified parameters.legacy generator function expressionthe function keyword can be used to define a legacy generator function inside an expression.
...you can use the more general proxy object instead.reflect.enumerate()the static reflect.enumerate() method used to return an iterator with the enumerable own and inherited properties of the target object, but has been removed in ecmascript 2016 and is deprecated in browsers.string.prototype.quote()the non-standard quote() method returns a copy of the string, replacing various special characters in the string with their escape sequences and wrapping the result in double-quotes (").
LiveConnect Overview - Archive of obsolete content
byte double float int long short all values are converted to numbers as described in ecma-262.
... the javascript string value is converted to a number according to the rules described in ecma-262.
... byte char double float int long short the object is converted to a value using the logic of the toprimitive operator described in ecma-262.
Archived open Web documentation - Archive of obsolete content
e4x ecmascript for xml (e4x) is a programming language extension that adds native xml support to javascript.
... it does this by providing access to the xml document in a form that feels natural for ecmascript programmers.
... e4x tutorial this tutorial walks you through the basic syntax of e4x (ecmascript for xml).
JavaScript - MDN Web Docs Glossary: Definitions of Web-related terms
in november 1996, netscape began working with ecma international to make javascript an industry standard.
... since then, the standardized javascript is called ecmascript and specified under ecma-262, whose latest (tenth, es2019) edition is available as of june 2019.
... learn more general knowledge javascript on wikipedia learning javascript the javascript guide on mdn the "javascripting" workshop on nodeschool the javascript course on codecademy.com john resig's learning advanced javascript technical reference the latest ecmascript standard the javascript reference on mdn the eloquent javascript book ...
Symbol - MDN Web Docs Glossary: Definitions of Web-related terms
symbol type is a new feature in ecmascript 2015.
... there is no ecmascript 5 equivalent for symbol.
... the method symbol.for(tokenstring) returns a symbol value from the registry, and symbol.keyfor(symbolvalue) returns a token string from the registry; each is the other's inverse, so the following is true: symbol.keyfor(symbol.for("tokenstring")) === "tokenstring" // true learn more general knowledge symbol (programming) on wikipedia javascript data types and data structures symbols in ecmascript 6 symbol in the mdn js reference object.getownpropertysymbols() ...
MDN Web Docs Glossary: Definitions of Web-related terms
der canvas card sorting carddav caret cdn certificate authority certified challenge-response authentication character character encoding character set chrome cia cipher cipher suite ciphertext class client hints closure cms code splitting codec compile compile time computer programming conditional constant constructor continuous media control flow cookie copyleft cors cors-safelisted request header cors-safelisted response header crawler crlf cross axis ...
... doctype document directive document environment dom (document object model) domain domain name domain sharding dominator dos attack dtls (datagram transport layer security) dtmf (dual-tone multi-frequency signaling) dynamic programming language dynamic typing e ecma ecmascript effective connection type element empty element encapsulation encryption endianness engine entity entity header event exception expando f fallback alignment falsy favicon fetch directive fetch metadata request...
...esign rest rgb ril robots.txt round trip time (rtt) routers rss rtcp (rtp control protocol) rtf rtl (right to left) rtp (real-time transport protocol) and srtp (secure rtp) rtsp: real-time streaming protocol ruby s safe same-origin policy scm scope screen reader script-supporting element scroll container scrollport sctp sdp search engine second-level domain secure sockets layer (ssl) selector (css) self-executing anonymous function semantics seo serialization server server timing ...
Inheritance in JavaScript - Learn web development
in addition, we present some advice on when and where you might use oojs, and look at how classes are dealt with in modern ecmascript syntax.
... you might also be interested in checking out some of the new ecmascript features that allow us to do inheritance more cleanly in javascript (see classes).
... ecmascript 2015 classes ecmascript 2015 introduces class syntax to javascript as a way to write reusable classes using easier, cleaner syntax, which is more similar to classes in c++ or java.
Object prototypes - Learn web development
in the next article, we talk about the modern way of doing things, which provides easier syntax to achieve the same things — see ecmascript 2015 classes.
... note: before ecmascript 2015, there wasn't officially a way to access an object's prototype directly — the "links" between the items in the chain are defined in an internal property, referred to as [[prototype]] in the specification for the javascript language (see ecmascript).
... since ecmascript 2015, you can access an object's prototype object indirectly via object.getprototypeof(obj).
Introduction to client-side frameworks - Learn web development
s to client-side frameworks if you’re looking for tools to expedite the web development process, and you know your project isn’t going to require intensive client-side javascript, you could reach for one of a handful of other solutions for building the web: a content management system server-side rendering a static site generator content management systems content-management systems (cmses) are any tools that allow a user to create content for the web without directly writing code themselves.
...they do, however, require a significant amount of time to set up, and utilizing a cms means that you surrender at least some measure of control over the final output of your website.
... for example: if your chosen cms doesn't author accessible content by default, it's often difficult to improve this.
Handling common accessibility problems - Learn web development
you might have inherited a site where the semantics are not very good (perhaps you've ended up with a horrible cms that generates buttons made with <div>s), or you are using a complex control that does not have keyboard accessibility built in, like the html5 <video> element (amazingly, opera is the only browser that allows you to tab through the <video> element's default browser controls).
... to turn it on, press cmd + f5.
...to turn it off again, press cmd + f5 again.
Localizing without a specialized tool
you should see something like this: x-testing browser chrome browser aboutcerterror.dtd // add and localize this file aboutdialog.dtd +aboutlink +aboutlink.accesskey +aboutversion +closecmdgnome.accesskey +closecmdgnome.label +copyright +copyright.accesskey +copyrightgnome.accesskey +copyrightinfo1 +copyrightinfo2 +licenselink +licenselinktext aboutprivatebrowsing.dtd // add and localize this file aboutrobots.dtd // add and localize this file ...
...<!entity cmd_enginemanager.label "manage search engines..."> <!entity searchendcap.label "search"> save the file.
... for instance, enter the proper translation for the line "add %s" cmd_addfoundengine=add "%s" with these two string examples translated, you can now test your work to see immediately where you have translated.
Mozilla DOM Hacking Guide
static nsiscriptsecuritymanager *ssecman: used by the dom security engine.
...it does a lot of different things: fill the blanks in the sclassinfodata array, initialize the sxpconnect and ssecman data members, create a new javascript context, define the jsstring data members, and register class names and class prototypes.
...then the script security manager (ssecman) is initialized.
NSS 3.15.1 release notes
aes gcm cipher suites are not yet supported.
... bug 875601 - secmod_closeuserdb/secmod_openuserdb fails to reset the token delay, leading to spurious failures.
... bug 884072 - fix a typo in the header include guard macro of secmod.h.
NSS 3.15 release notes
this is necessary for aes-gcm.
...this is necessary for aes-gcm.
... bug 853285: fixed bugs in aes gcm.
NSS 3.16.1 release notes
in secmod.h secmod_internaltopubmechflags - converts from nss-internal to public representation of mechanism flags.
... new macros in secmod.h public_mech_ecc_flag - a public mechanism flag for elliptic curve cryptography (ecc) operations.
... in utilmodt.h secmod_ecc_flag - an nss-internal mechanism flag for elliptic curve cryptography (ecc) operations.
NSS 3.46 release notes
of particular note are significant improvements to aes-gcm performance on arm.
... bugs fixed in nss 3.46 bug 1572164 - don't unnecessarily free session in nsc_wrapkey bug 1574220 - improve controls after errors in tstcln, selfserv and vfyserv cmds bug 1550636 - upgrade sqlite in nss to a 2019 version bug 1572593 - reset advertised extensions in ssl_constructextensions bug 1415118 - nss build with ./build.sh --enable-libpkix fails bug 1539788 - add length checks for cryptographic primitives (cve-2019-17006) bug 1542077 - mp_set_ulong and mp_set_int should return errors on bad values bug 1572791 - read out-of-bounds in der_decodetime...
...rning in httpserv.c bug 1561556 - remove -wmaybe-uninitialized warning in tls13esni.c bug 1561332 - ec.c:28 warning: comparison of integers of different signs: 'int' and 'unsigned long' bug 1564714 - print certutil commands during setup bug 1565013 - hacl image builder times out while fetching gpg key bug 1563786 - update hacl-star docker image to pull specific commit bug 1559012 - improve gcm perfomance using pmull2 bug 1528666 - correct resumption validation checks bug 1568803 - more tests for client certificate authentication bug 1564284 - support profile mobility across windows and linux bug 1573942 - gtest for pkcs11.txt with different breaking line formats bug 1575968 - add strsclnt option to enforce the use of either ipv4 or ipv6 bug 1549847 - fix nss builds on ios bug 14...
NSS Sample Code Sample_1_Hashing
sample code 1 /* nspr headers */ #include <prprf.h> #include <prtypes.h> #include <plgetopt.h> #include <prio.h> /* nss headers */ #include <secoid.h> #include <secmodt.h> #include <sechash.h> typedef struct { const char *hashname; secoidtag oid; } nametagpair; /* the hash algorithms supported */ static const nametagpair hash_names[] = { { "md2", sec_oid_md2 }, { "md5", sec_oid_md5 }, { "sha1", sec_oid_sha1 }, { "sha256", sec_oid_sha256 }, { "sha384", sec_oid_sha384 }, { "sha512", sec_oid_sha512 } }; /* * maps a hash name to a secoidtag.
... * returns null if the name is not a supported algorithm */ static secoidtag hashnametooidtag(const char *hashname) { int i, nhashes = sizeof(hash_names); secoidtag hashtag = sec_oid_unknown; for (i = 0; i < nhashes; i++) { if (port_strcasecmp(hashname, hash_names[i].hashname) == 0) { hashtag = hash_names[i].oid; break; } } return hashtag; } /* * newline */ static void newline(prfiledesc* out) { pr_fprintf(out, "\n"); } /* * printashex */ void printashex(prfiledesc* out, unsigned char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { pr_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++...
... progname, hashname); usage(progname); } /* digest it and print the result */ rv = digestfile(pr_stdout, pr_stdin, hashoidtag); if (rv != secsuccess) { fprintf(stderr, "%s: problem digesting data (%d)\n", progname, port_geterror()); } rv = nss_shutdown(); if (rv != secsuccess) { exit(-1); } return 0; } </sechash.h></secmodt.h></secoid.h></prio.h></plgetopt.h></prtypes.h></prprf.h> ...
nss tech note5
you can find a list of hmac mechanisms in security/nss/lib/softoken/pkcs11.c - grep for ckf_sn_vr, and choose the mechanisms that contain hmac in the name ck_mechanism_type hmacmech = ckm_md5_hmac; <big>(for example)</big> choose a slot on which to to do the operation pk11slotinfo* slot = pk11_getbestslot(hmacmech, null); or pk11slotinfo* slot = pk11_getinternalkeyslot(); /* always returns int slot, may not be optimal */ prepare the key if using a raw key /* turn the raw key into a secitem */ secitem keyitem; keyitem.type =...
... sibuffer; keyitem.data = /* ptr to an array of key bytes */ keyitem.len = /* length of the array of key bytes */ /* turn the secitem into a key object */ pk11symkey* symkey = pk11_importsymkey(slot, hmacmech, pk11_originunwrap, cka_sign, &keyitem, null); if generating the key - see section generate a symmetric key.
... secitem param; param.type = sibuffer; param.data = null; param.len = 0;</big> <big>create crypto context</big> pk11context* digestcontext = pk11_createcontextbysymkey(hmacmech, cka_sign, symkey, &param); <big>digest the data</big> <big>secstatus s = pk11_digestbegin(digestcontext); s = pk11_digestop(digestcontext, data, sizeof data); s = pk11_digestfinal(digestcontext, digest, &len, sizeof digest); /* now, digest contains the 'signed digest', and len contains ...
sslcrt.html
validating certificates manipulating certificates getting certificate information comparing secitem objects validating certificates cert_verifycertnow cert_verifycertname cert_checkcertvalidtimes nss_cmpcertchainwcanames cert_verifycertnow checks that the current date is within the certificate's validity period and that the ca signature on the certificate is valid.
... returns the function returns an enumerator of type seccerttimevalidity: typedef enum { seccerttimevalid, seccerttimeexpired, seccerttimenotvalidyet } seccerttimevalidity; nss_cmpcertchainwcanames determines whether any of the signers in the certificate chain for a specified certificate are on a specified list of ca names.
... syntax #include <nss.h> secstatus nss_cmpcertchainwcanames( certcertificate *cert, certdistnames *canames); parameters this function has the following parameters: cert a pointer to the certificate structure for the certificate whose certificate chain is to be checked.
Utility functions
3.2 and later seckey_destroyencryptedprivatekeyinfo mxr 3.2 and later seckey_destroyprivatekeyinfo mxr 3.2 and later seckey_destroypublickey mxr 3.2 and later seckey_publickeystrength mxr 3.2 and later seckey_updatecertpqg mxr 3.2 and later secmod_addnewmodule mxr 3.3 and later secmod_addnewmoduleex mxr 3.4 and later secmod_deletemoduleex mxr 3.12 and later secmod_cancelwait mxr 3.9.3 and later secmod_candeleteinternalmodule mxr 3.5 and later secmod_createmodule mxr 3.4 and later ...
... secmod_deletemodule mxr 3.4 and later secmod_findmodule mxr 3.4 and later secmod_findslot mxr 3.4 and later secmod_freemodulespeclist mxr 3.4 and later secmod_getdbmodulelist mxr 3.9 and later secmod_getdeadmodulelist mxr 3.9 and later secmod_getmodulespeclist mxr 3.4 and later secmod_hasremovableslots mxr 3.9.3 and later secmod_ismodulepresent mxr 3.2 and later secmod_loadmodule mxr 3.4 and later secmod_loadusermodule mxr 3.4 and later secmod_lookupslot mxr 3.2 and lat...
...er secmod_pubcipherflagstointernal mxr 3.4 and later secmod_pubmechflagstointernal mxr 3.4 and later secmod_unloadusermodule mxr 3.4 and later secmod_updatemodule mxr 3.4 and later secmod_updateslotlist mxr 3.9.3 and later secmod_waitforanytokenevent mxr 3.9.3 and later secoid_addentry mxr 3.10 and later secoid_comparealgorithmid mxr 3.2 and later secoid_copyalgorithmid mxr 3.2 and later secoid_destroyalgorithmid mxr 3.2 and later secoid_findoid mxr 3.2 and later secoid_fin...
64-bit Compatibility
the following table contains the most relevant opcodes: platform alias 32-bit op 64-bit op ldp ld ldq ldcp ldc ldcq piadd add qiadd piand and qiand pilsh lsh qilsh pirsh rsh qirsh pursh ush qursh pcmov cmov qcmov pior or qior pxor xor qxor addp iaddp qaddp peq - puge eq - uge qeq - quge pcall icall qcall the 32-bit versions have the following inputs and outputs.
... 32-bit op inputs output ld i32, i32 i32 ldc i32, i32 i32 add i32, i32 i32 and i32, i32 i32 lsh i32, i32 i32 rsh i32, i32 i32 ush i32 cmov i32, i32, i32 i32 or i32, i32 i32 xor i32, i32 i32 iaddp i32, i32 i32 eg - uge i32, i32 i32 icall n/a i32 the 64-bit versions have the following inputs and outputs.
... 64-bit op inputs output ldq i64, i32 i64 ldcq i64, i32 i64 qiadd i64, i64 i64 qiand i64, i64 i64 qilsh i64, i32 i64 qirsh i64, i32 i64 qursh i64, i32 i64 qcmov i32, i64, i64 i32 qior i64, i64 i64 qixor i64, i64 i64 qiaddp i64, i64 i64 qeq - quge i64, i64 i32 qcall n/a i64 extending or truncating native integers sometimes it is necessary to reduce a native integer to a 32-bit integer (for example, array or string lengths in tracemonkey) or extend a 32-bit integer to a native integer.
Self-hosted builtins in SpiderMonkey
self-hosted functions by default are not constructors and do not have a prototype property, so that they meet the requirements for standard built-in functions as described in the ecmascript language specification 5.1, clause 15.
...some general-purpose functions provided in this way are: the abstract operations toobject, tointeger, and iscallable specified in the ecmascript language specification.
...of note, it provides implementations of list and record, types defined in the ecmascript specifications that are similar to array and object, but can't be modified by application code.
JSClass.flags
(ecmascript specifies a single global object, but in spidermonkey the global object is the last object in the scope chain, which can be different objects at different times.
...js_setglobalobject sets an object which is sometimes used as the global object, as a last resort.) enable standard ecmascript behavior for setting the prototype of certain objects, such as function objects.
... if the global object does not have this flag, then scripts may cause nonstandard behavior by replacing standard constructors or prototypes (such as function.prototype.) objects that can end up with the wrong prototype object, if this flag is not present, include: arguments objects (ecma 262-3 §10.1.8 specifies "the original object prototype"), function objects (ecma 262-3 §13.2 specifies "the original function prototype"), and objects created by many standard constructors (ecma 262-3 §15.4.2.1 and others).
JS_DefaultValue
ecmascript specifies that all objects have a [[defaultvalue]] hook.
... objects with classes defined by ecmascript itself all use the [[defaultvalue]] algorithm specified in §8.12.8 (but note the algorithm's special case for date objects).
...behavior when the convert hook is js_convertstub is identical to that for objects defined by ecmascript.
JS_SealObject
as of spidermonkey 1.8.5, js_sealobject has been removed from the jsapi, because ecmascript 5 includes a "seal" concept (namely, that of object.seal) which is quite different from that of js_sealobject.
... moreover, js_sealobject's exact semantics are subtly incompatible with ecmascript.
... js_freezeobject and js_deepfreezeobject are near-substitutes compatible with ecmascript semantics, implementing semantics compatible with those of object.freeze.
JS_ValueToNumber
it implements the tonumber operator described in ecma 262-3 §9.3.
... if v is a string, conversion proceeds as specified in ecma 262-3 §9.3.1.
... see also js_convertarguments js_convertvalue js_gettypename js_typeofvalue js_valuetoint32 js_valuetoecmaint32 bug 884410 ...
Parser API
visit estree spec for a community ast standard that includes latest ecmascript features and is backward-compatible with spidermonkey format.
... note: the debugger statement is new in ecmascript 5th edition, although spidermonkey has supported it for years.
... note: e4x is not part of the ecmascript standard (ecma-262), but is a separate standard of its own (ecma-357).
SpiderMonkey 1.8.5
it is much faster than spidermonkey 1.8, implements es-5 (ecma 262, 5th edition), and contains many new language and api features, described in detail below.
...new javascript language features javascript 1.8.5 adds support for ecmascript edition 5, including es5 strict mode.
... note that there are a very small number of incompatibilities between es5 and and es3, the version of ecmascript supported by spidermonkey versions 1.5 through 1.8.
SpiderMonkey 1.8.7
it is much faster than spidermonkey 1.8, implements es-5 (ecma 262, 5th edition), and contains many new language and api features, described in detail below.
...new javascript language features xxx needs updating javascript 1.8.5 adds support for ecmascript edition 5, including es5 strict mode.
... note that there are a very small number of incompatibilities between es5 and and es3, the version of ecmascript supported by spidermonkey versions 1.5 through 1.8.
Finishing the Component
the string comparison with the url type "http", "https", and "ftp" looks like this: nsembedcstring scheme; contentlocation->getscheme(scheme); if (strcmp("http", scheme.get()) != 0 && strcmp("https", scheme.get()) != 0 && strcmp("ftp", scheme.get()) != 0) { // this isn't a type of uri that we deal with.
...omplete implementation of the shouldload() method: ns_imethodimp weblock::shouldload(print32 contenttype, nsiuri *contentlocation, nsisupports *ctxt, nsidomwindow *window, prbool *_retval) { if (!contentlocation) return ns_error_failure; nsembedcstring scheme; contentlocation->getscheme(scheme); if (strcmp("http", scheme.get()) != 0 && strcmp("https", scheme.get()) != 0 && strcmp("ftp", scheme.get()) != 0) { // this isn't a type of uri that we deal with *_retval = pr_true; return ns_ok; } nsembedcstring hosttoload; contentlocation->gethost(hosttoload); // assume failure.
...ed(rv)) return rv; urlnode* node = mrooturlnode; prbool match = pr_false; while (node) { nscomptr<nsiuri> uri; nsembedcstring urlstring(node->urlstring); rv = mioservice->newuri(urlstring, nsnull, nsnull, getter_addrefs(uri)); // if anything bad happens, just abort if (ns_failed(rv)) return rv; nsembedcstring host; uri->gethost(host); if (strcmp(hosttoload.get(), host.get()) == 0) { // match found.
NS_InitXPCOM3
#include "nsxpcom.h" nsresult ns_initxpcom3( nsiservicemanager** aresult, nsifile* abindirectory, nsidirectoryserviceprovider* aappfilelocationprovider, nsstaticmoduleinfo const* astaticmodules, pruint32 astaticmodulecount ); parameters aresult [out] the resulting xpcom service manager.
... astaticmodules [in] an array of nsstaticmoduleinfo objects.
... astaticmodulecount [in] the number of elements in astaticmodules.
nsIMessageListener
idl file: mozilla-central/source/dom/base/nsimessagemanager.idl inherits from: nsisupports this interface is used to receive messages sent using the nsimessagebroadcaster, nsimessagesender, or nsisyncmessagesender interfaces.
...this function receives a message from one of the three message-sending functions in the message manager framework: broadcastasyncmessage sendasyncmessage sendsyncmessage.
... sync true if the message was sent using sendsyncmessage, false otherwise.
DOM Inspector internals - Firefox Developer Tools
this is the two-pane inspector that appears when ctrl+shift+i (or cmd+shift+i) is pressed from one of the applications for which dom inspector has explicit support (i.e., menuitems placed via overlay).
... source code organization the contents of the top-level directory for the dom inspector repository should look like base/ js/ inspector-cmdline.js makefile.in build/ install.js makefile.in resources/ content/ … locale/ … skin/ … makefile.in install.rdf jar.mn makefile.in makefiles.sh almost all the interesting stuff is in resources/content/.
...in order for dom inspector to be useful with its host application, though, there should be a way to launch dom inspector within it, e.g., by a menu item and an optional keyboard shortcut such as ctrl+shift+i (or cmd+shift+i).
Set a breakpoint - Firefox Developer Tools
highlighting the line you want to break at in the source pane and pressing ctrl + b (windows/linux) or cmd + b (macos).
...you can set a conditional breakpoint using the context menu (see above), or by highlighting the line you want to break at in the source pane and pressing ctrl + shift + b (windows/linux) or cmd + shift + b (macos).
... highlight the line of code the breakpoint is set on and pressing ctrl + b (windows/linux) or cmd + b (macos).
Debugger.Frame - Firefox Developer Tools
(in ecmascript terms, the onpop handler receives the value returned by the [[call]] method, not the value returned by the [[construct]] method.) when a debugger handler function forces a frame to complete early, by returning a { return:...
...(in the terms used by the ecmascript specification, the variableenvironment of the execution context for the eval code is the variableenvironment of the execution context that this frame represents.) if implementation restrictions prevent spidermonkey from extending this frame’s environment as requested, this call throws an error exception.
...(in the terms used by the ecmascript specification, the variableenvironment of the execution context for the eval code is the variableenvironment of the execution context that this frame represents, and thebindings appear in a new declarative environment, which is the eval code’s lexicalenvironment.) if implementation restrictions prevent spidermonkey from extending this frame’s environment as requested, this call throws ...
Debugger.Object - Firefox Developer Tools
class a string naming the ecmascript [[class]] of the referent.
...(in the terms used by the ecmascript specification, the variableenvironment of the execution context for the eval code is the referent.) theoptions argument is as for debugger.frame.prototype.eval.
...(in the terms used by the ecmascript specification, the variableenvironment of the execution context for non-strict eval code is the referent, and thebindings appear in a new declarative environment, which is the eval code's lexicalenvironment.) theoptions argument is as for debugger.frame.prototype.eval.
SubtleCrypto.decrypt() - Web APIs
to use aes-gcm, pass an aesgcmparams object.
... function decryptmessage(key, ciphertext) { return window.crypto.subtle.decrypt( { name: "aes-cbc", iv: iv }, key, ciphertext ); } aes-gcm this code decrypts ciphertext using aes in gcm mode.
... function decryptmessage(key, ciphertext) { return window.crypto.subtle.decrypt( { name: "aes-gcm", iv: iv }, key, ciphertext ); } specifications specification status comment web cryptography apithe definition of 'subtlecrypto.decrypt()' in that specification.
SubtleCrypto.deriveKey() - Web APIs
for aes-ctr, aes-cbc, aes-gcm, or aes-kw: pass an aeskeygenparams object.
... /* derive an aes key, given: - our ecdh private key - their ecdh public key */ function derivesecretkey(privatekey, publickey) { return window.crypto.subtle.derivekey( { name: "ecdh", public: publickey }, privatekey, { name: "aes-gcm", length: 256 }, false, ["encrypt", "decrypt"] ); } async function agreesharedsecretkey() { // generate 2 ecdh key pairs: one for alice and one for bob // in more normal usage, they would generate their key pairs // separately and exchange public keys securely let aliceskeypair = await window.crypto.subtle.generatekey( { name: "ecdh", namedcurve: "p-38...
...le.importkey( "raw", enc.encode(password), "pbkdf2", false, ["derivebits", "derivekey"] ); } async function encrypt(plaintext, salt, iv) { let keymaterial = await getkeymaterial(); let key = await window.crypto.subtle.derivekey( { "name": "pbkdf2", salt: salt, "iterations": 100000, "hash": "sha-256" }, keymaterial, { "name": "aes-gcm", "length": 256}, true, [ "encrypt", "decrypt" ] ); return window.crypto.subtle.encrypt( { name: "aes-gcm", iv: iv }, key, plaintext ); } specifications specification status comment web cryptography apithe definition of 'subtlecrypto.derivekey()' in that specification.
SubtleCrypto.generateKey() - Web APIs
for aes-ctr, aes-cbc, aes-gcm, or aes-kw: pass an aeskeygenparams object.
... let key = window.crypto.subtle.generatekey( { name: "hmac", hash: {name: "sha-512"} }, true, ["sign", "verify"] ); aes key generation this code generates an aes-gcm encryption key.
... let key = window.crypto.subtle.generatekey( { name: "aes-gcm", length: 256 }, true, ["encrypt", "decrypt"] ); specifications specification status comment web cryptography apithe definition of 'subtlecrypto.generatekey()' in that specification.
SubtleCrypto.importKey() - Web APIs
for aes-ctr, aes-cbc, aes-gcm, or aes-kw: pass the string identifying the algorithm or an object of the form { "name": algorithm }, where algorithm is the name of the algorithm.
...*/ function importsecretkey(rawkey) { return window.crypto.subtle.importkey( "raw", rawkey, "aes-gcm", true, ["encrypt", "decrypt"] ); } pkcs #8 import this example imports an rsa private signing key from a pem-encoded pkcs #8 object.
...i++) { bufview[i] = str.charcodeat(i); } return buf; } const pemencodedkey = `-----begin public key----- miibijanbgkqhkig9w0baqefaaocaq8amiibcgkcaqeay3xo3u13dc+xojwqywojlcboq5fovy8llnqcjm1w1bftxihoajwohihuirmctv7dzx47tllmarskvtrjd0df92jx/xy20lz+dxp8yl5yuwafga3xko3lsjgeoex10nb8jfkmgsb7qiudtvvbbudfd5fwibmctacwwx7nyewwdb7a9cfxj7ejrdrdak3ux/tomlhfxvlqsl341tkcf4zqoz96rfpugpplofvn0x66cm1pqckdhzje6u5xge964zkkyuppsy6dcie4obhw4vdjgumlzv0z7ud010rlineugde2fqbfy/c+uwignpbpkkq+bv/uigs6dhqtcved5wgybqidaqab -----end public key-----`; function importrsakey(pem) { // fetch the part of the pem string between header and footer const pemheader = "-----begin public key-----"; const pemfooter = "-----end public key-----"; const pemcontents = pem.substring(pemheader.length, pe...
Control flow and error handling - JavaScript
important: javascript before ecmascript2015 (6th edition) does not have block scope!
...(in c or java, the equivalent code would have outputted 1.) since ecmascript2015, the let and const variable declarations are block-scoped.
...while it is common to throw numbers or strings as errors, it is frequently more effective to use one of the exception types specifically created for this purpose: ecmascript exceptions domexception and domerror throw statement use the throw statement to throw an exception.
Numbers and dates - JavaScript
var n = 0755; // 493 var m = 0644; // 420 strict mode in ecmascript 5 forbids octal syntax.
... octal syntax isn't part of ecmascript 5, but it's supported in all browsers by prefixing the octal number with a zero: 0644 === 420 and "\045" === "%".
... in ecmascript 2015, octal numbers are supported if they are prefixed with 0o, e.g.: var a = 0o10; // es2015: 8 hexadecimal numbers hexadecimal number syntax uses a leading zero followed by a lowercase or uppercase latin letter "x" (0x or 0x).
Classes - JavaScript
strict mode the body of a class is executed in strict mode, i.e., code written here is subject to stricter syntax for increased performance, some otherwise silent errors will be thrown, and certain keywords are reserved for future versions of ecmascript.
...an ecmascript class can only have a single superclass, so multiple inheritance from tooling classes, for example, is not possible.
... a function with a superclass as input and a subclass extending that superclass as output can be used to implement mix-ins in ecmascript: let calculatormixin = base => class extends base { calc() { } }; let randomizermixin = base => class extends base { randomize() { } }; a class that uses these mix-ins can then be written like this: class foo { } class bar extends calculatormixin(randomizermixin(foo)) { } specifications specification ecmascript (ecma-262)the definition of 'class definitions' in that specification.
Arrow function expressions - JavaScript
this.age++; }, 1000); } var p = new person(); in ecmascript 3/5, the this issue was fixable by assigning the value in this to a variable that could be closed over.
... 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.
...}); // parameterless arrow functions that are visually easier to parse settimeout( () => { console.log('i happen sooner'); settimeout( () => { // deeper code console.log('i happen later'); }, 1); }, 1); specifications specification ecmascript (ecma-262)the definition of 'arrow function definitions' in that specification.
Method definitions - JavaScript
starting with ecmascript 2015, a shorter syntax for method definitions on objects initializers is introduced.
...ync property( parameters… ) {}, async* generator( parameters… ) {}, // with computed keys get [property]() {}, set [property](value) {}, [property]( parameters… ) {}, *[generator]( parameters… ) {}, async [property]( parameters… ) {}, async* [generator]( parameters… ) {}, }; description the shorthand syntax is similar to the getter and setter syntax introduced in ecmascript 2015.
... const bar = { foo0: function() { return 0 }, foo1() { return 1 }, ['foo' + 2]() { return 2 } } console.log(bar.foo0()) // 0 console.log(bar.foo1()) // 1 console.log(bar.foo2()) // 2 // a global function function foo() { return 1 } let name = 'foo' console.log(window[name]()) // 1 specifications specification ecmascript (ecma-262)the definition of 'method definitions' in that specification.
arguments.callee - JavaScript
warning: the 5th edition of ecmascript (es5) forbids use of arguments.callee() in strict mode.
...l due to checks that would not otherwise be necessary.) the other major issue is that the recursive call will get a different this value, e.g.: var global = this; var sillyfunction = function(recursed) { if (!recursed) { return arguments.callee(true); } if (this !== global) { alert('this is: ' + this); } else { alert('this is the global'); } } sillyfunction(); ecmascript 3 resolved these issues by allowing named function expressions.
... however, in a case like the following, there are not alternatives to arguments.callee, so its deprecation could be a bug (see bug 725398): function createperson(sidentity) { var operson = new function('alert(arguments.callee.identity);'); operson.identity = sidentity; return operson; } var john = createperson('john smith'); john(); specifications specification ecmascript (ecma-262)the definition of 'arguments exotic objects' in that specification.
Array.prototype[@@unscopables] - JavaScript
the @@unscopable symbol property contains property names that were not included in the ecmascript standard prior to the es2015 version.
...however, in ecmascript 2015 and later, the array.prototype.keys() method was introduced.
... 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.reduceRight() - JavaScript
polyfill reduceright was added to the ecma-262 standard in the 5th edition; as such it may not be present in all implementations of the standard.
... // production steps of ecma-262, edition 5, 15.4.4.22 // reference: http://es5.github.io/#x15.4.4.22 if ('function' !== typeof array.prototype.reduceright) { array.prototype.reduceright = function(callback /*, initialvalue*/) { 'use strict'; if (null === this || 'undefined' === typeof this) { throw new typeerror('array.prototype.reduce called on null or undefined'); } if ('function' !== typeof callback) { throw new typeerror(callback + ' is not a function'); } var t = object(this), len = t.length >>> 0, k = len - 1, value; if (arguments.length >= 2) { value = arguments[1]; ...
...*/ const compose = (...args) => (value) => args.reduceright((acc, fn) => fn(acc), value) // increment passed number const inc = (n) => n + 1 // doubles the passed value const double = (n) => n * 2 // using composition function console.log(compose(double, inc)(2)); // 6 // using composition function console.log(compose(inc, double)(2)); // 5 specifications specification ecmascript (ecma-262)the definition of 'array.prototype.reduceright' in that specification.
Array.prototype.every() - JavaScript
(it is vacuously true that all elements of the empty set satisfy any given condition.) polyfill every was added to the ecma-262 standard in the 5th edition, and it may not be present in other implementations of the standard.
... this algorithm is exactly the one specified in ecma-262, 5th edition, assuming object and typeerror have their original values, and that callbackfn.call evaluates to the original value of function.prototype.call.
... 3 // --------------- // deleting items // --------------- arr = [1, 2, 3, 4]; arr.every( (elem, index, arr) => { arr.pop() console.log(`[${arr}][${index}] -> ${elem}`) return elem < 4 }) // loop runs for 2 iterations only, as the remaining // items are `pop()`ed off // // 1st iteration: [1,2,3][0] -> 1 // 2nd iteration: [1,2][1] -> 2 specifications specification ecmascript (ecma-262)the definition of 'array.prototype.every' in that specification.
Array.prototype.find() - JavaScript
polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet.
... however, you can polyfill array.prototype.find with the following snippet: // https://tc39.github.io/ecma262/#sec-array.prototype.find if (!array.prototype.find) { object.defineproperty(array.prototype, 'find', { value: function(predicate) { // 1.
...index, ' with value ', value); }); // expected output: // deleting array[5] with value 5 // visited index 0 with value 0 // visited index 1 with value 1 // visited index 2 with value undefined // visited index 3 with value undefined // visited index 4 with value undefined // visited index 5 with value undefined // visited index 6 with value 6 specifications specification ecmascript (ecma-262)the definition of 'array.prototype.find' in that specification.
Array.prototype.toLocaleString() - JavaScript
polyfill // https://tc39.github.io/ecma402/#sup-array.prototype.tolocalestring if (!array.prototype.tolocalestring) { object.defineproperty(array.prototype, 'tolocalestring', { value: function(locales, options) { // 1.
... specifications specification ecmascript (ecma-262)the definition of 'array.prototype.tolocalestring' in that specification.
... ecmascript internationalization api (ecma-402)the definition of 'array.prototype.tolocalestring' in that specification.
Date.UTC() - JavaScript
syntax since ecmascript 2017: date.utc(year[, month[, day[, hour[, minute[, second[, millisecond]]]]]]) ecmascript 2016 and earlier: (month used to be required) date.utc(year, month[, day[, hour[, minute[, second[, millisecond]]]]]) parameters year a full year.
...(up through ecmascript 2016, month was a required parameter.
... examples using date.utc() the following statement creates a date object with the arguments treated as utc instead of local: let utcdate = new date(date.utc(2018, 11, 1, 0, 0, 0)); specifications specification ecmascript (ecma-262)the definition of 'date.utc' in that specification.
Date.prototype.toISOString() - JavaScript
polyfill this method was standardized in ecma-262 5th edition.
...hich have not been updated to support this method can work around the absence of this method using the following shim: if (!date.prototype.toisostring) { (function() { function pad(number) { if (number < 10) { return '0' + number; } return number; } date.prototype.toisostring = function() { return this.getutcfullyear() + '-' + pad(this.getutcmonth() + 1) + '-' + pad(this.getutcdate()) + 't' + pad(this.getutchours()) + ':' + pad(this.getutcminutes()) + ':' + pad(this.getutcseconds()) + '.' + (this.getutcmilliseconds() / 1000).tofixed(3).slice(2, 5) + 'z'; }; })(); } examples using toisostring() let today = new date('05 october 2011 14:48 utc') console.log(today.toisostring()) ...
... specifications specification ecmascript (ecma-262)the definition of 'date.prototype.toisostring' in that specification.
Date.prototype.toString() - JavaScript
date.prototype.tostring() returns a string representation of the date in the format specified in ecma-262 which can be summarised as: week day: 3 letter english week day name, e.g.
..."sat sep 01 2018 14:53:26 gmt+1400 (lint)" until ecmascript 2018 (edition 9), the format of the string returned by date.prototype.tostring was implementation dependent.
... examples using tostring() the following assigns the tostring() value of a date object to myvar: var x = new date(); var myvar = x.tostring(); // assigns a string value to myvar in the same format as: // mon sep 08 1998 14:36:22 gmt-0700 (pdt) specifications specification ecmascript (ecma-262)the definition of 'date.prototype.tostring' in that specification.
Date.prototype.toUTCString() - JavaScript
based on rfc7231 and modified according to ecma-262 toutcstring, it can have negative values in the 2021 version the source for this interactive example is stored in a github repository.
...jan, feb, ...) yyyy year, as four or more digits with leading zeroes if required hh hour, as two digits with leading zero if required mm minute, as two digits with leading zero if required ss seconds, as two digits with leading zero if required prior to ecmascript 2018, the format of the return value varied according to the platform.
... examples using toutcstring() let today = new date('wed, 14 jun 2017 00:00:00 pdt'); let utcstring = today.toutcstring(); // wed, 14 jun 2017 07:00:00 gmt specifications specification ecmascript (ecma-262)the definition of 'date.prototype.toutcstring' in that specification.
EvalError - JavaScript
although ecma-262 specifies that evalerror should provide its own message property, in spidermonkey, it inherits error.prototype.message.
... examples evalerror is not used in the current ecmascript specification and will thus not be thrown by the runtime.
...(e instanceof evalerror); // true console.log(e.message); // "hello" console.log(e.name); // "evalerror" console.log(e.filename); // "somefile.js" console.log(e.linenumber); // 10 console.log(e.columnnumber); // 0 console.log(e.stack); // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'evalerror' in that specification.
Function.prototype.apply() - JavaScript
starting with ecmascript 5 these arguments can be a generic array-like object instead of an array.
... since ecmascript 5th edition, you can also use any kind of object which is array-like.
... specifications specification ecmascript (ecma-262)the definition of 'function.prototype.apply' in that specification.
Intl.Locale.prototype.maximize() - JavaScript
examples using maximize let mylocale = new intl.locale("fr", {hourcycle: "h24", calendar: "gregory"}); console.log(mylocale.basename); // prints "fr" console.log(mylocale.tostring()); // prints "fr-u-ca-gregory-hc-h24" let mylocmaximized = mylocale.maximize(); // prints "fr-latn-fr".
...console.log(mylocmaximized.basename); // prints "fr-latn-fr-u-ca-gregory-hc-h24".
...console.log(mylocmaximized.tostring()); specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.minimize() - JavaScript
examples using minimize let mylocale = new intl.locale("fr-latn-fr", {hourcycle: "h24", calendar: "gregory"}); console.log(mylocale.basename); // prints "fr-latn-fr" console.log(mylocale.tostring()); // prints "fr-latn-fr-u-ca-gregory-hc-h24" let mylocminimized = mylocale.minimize(); // prints "fr", since french is only written in the latin script // and is most likely to be spoken in france.
... console.log(mylocminimized.basename); // prints "fr-u-ca-gregory-hc-h24".
...console.log(mylocminimized.tostring()); specifications specification ecmascript internationalization api (ecma-402) ...
Number.prototype.toLocaleString() - JavaScript
a check that works in all hosts, including those supporting ecma-262 prior to ed 5.1, is to test for the features specified in ecma-402 that are required to support regional options for number.prototype.tolocalestring directly: function tolocalestringsupportsoptions() { return !!(typeof intl == 'object' && intl && typeof intl.numberformat == 'function'); } this tests for a global intl object, checks that it's not null and that it has a numberformat prope...
...t default language with options for number formatting var num = 30000.65; console.log(num.tolocalestring(undefined, {minimumfractiondigits: 2, maximumfractiondigits: 2})); // → "30,000.65" where english is the default language, or // → "30.000,65" where german is the default language, or // → "30 000,65" where french is the default language specifications specification ecmascript (ecma-262)the definition of 'number.prototype.tolocalestring' in that specification.
... ecmascript internationalization api (ecma-402)the definition of 'number.prototype.tolocalestring' in that specification.
Set - JavaScript
in an earlier version of ecmascript specification, this was not based on the same algorithm as the one used in the === operator.
...however, this was changed in the ecmascript 2015 specification.
...og([...new set(numbers)]) // [2, 3, 4, 5, 6, 7, 32] relation with strings let text = 'india' let myset = new set(text) // set ['i', 'n', 'd', 'i', 'a'] myset.size // 5 //case sensitive & duplicate ommision new set("firefox") // set(7) [ "f", "i", "r", "e", "f", "o", "x" ] new set("firefox") // set(6) [ "f", "i", "r", "e", "o", "x" ] specifications specification ecmascript (ecma-262)the definition of 'set' in that specification.
TypedArray - JavaScript
description ecmascript 2015 defines a typedarray constructor that serves as the [[prototype]] of all typedarray constructors.
... examples new is required starting with ecmascript 2015, typedarray constructors must be constructed with the new operator.
...oo'; (new int8array(32))[20]; // 0 // even when out of bound int8array.prototype[20] = 'foo'; (new int8array(8))[20]; // undefined // or with negative integers int8array.prototype[-1] = 'foo'; (new int8array(8))[-1]; // undefined // named properties are allowed, though (fx 30) int8array.prototype.foo = 'bar'; (new int8array(32)).foo; // "bar" specifications specification ecmascript (ecma-262)the definition of 'typedarray objects' in that specification.
escape() - JavaScript
warning: although escape() is not strictly deprecated (as in "removed from the web standards"), it is defined in annex b of the ecma-262 standard, whose introduction states: … all of the language features and behaviours specified in this annex have one or more undesirable characteristics and in the absence of legacy usage would be removed from this specification.
... … … programmers should not use or assume the existence of these features and behaviours when writing new ecmascript code.
... examples using escape escape('abc123'); // "abc123" escape('äöü'); // "%e4%f6%fc" escape('ć'); // "%u0107" // special characters escape('@*_+-./'); // "@*_+-./" specifications specification ecmascript (ecma-262)the definition of 'escape' in that specification.
isNaN() - JavaScript
note, coercion inside the isnan function has interesting rules; you may alternatively want to use number.isnan(), as defined in ecmascript 2015.
...the function should be interpreted as answering the question, "is this value, when coerced to a numeric value, an ieee-754 'not a number' value?" ecmascript 2015 contains the number.isnan() function.
... specifications specification ecmascript (ecma-262)the definition of 'isnan' in that specification.
unescape() - JavaScript
warning: although unescape() is not strictly deprecated (as in "removed from the web standards"), it is defined in annex b of the ecma-262 standard, whose introduction states: … all of the language features and behaviours specified in this annex have one or more undesirable characteristics and in the absence of legacy usage would be removed from this specification.
... … … programmers should not use or assume the existence of these features and behaviours when writing new ecmascript code.
... examples using unescape unescape('abc123'); // "abc123" unescape('%e4%f6%fc'); // "äöü" unescape('%u0107'); // "ć" specifications specification ecmascript (ecma-262)the definition of 'unescape' in that specification.
var - JavaScript
note that in both nodejs commonjs modules and native ecmascript modules, top-level variable declarations are scoped to the module, and are not, therefore added as properties to the global object.
... foo = 'f' // in non-strict mode, assumes you want to create a property named `foo` on the global object globalthis.hasownproperty('foo') // true in ecmascript 5, this behavior was changed for strict mode.
...console.log(x, z); // 3 5 console.log(typeof y); // "undefined", as y is local to function a specifications specification ecmascript (ecma-262)the definition of 'variable statement' in that specification.
Positions - SVG: Scalable Vector Graphics
much like absolute and relative font sizes in css, svg defines absolute units (ones with a dimensional identifier like "pt" or "cm") and so-called user units, that lack that identifier and are plain numbers.
...(however, the device may decide, what it understands as one pixel.) lengths in the svg file with specific dimensions, like "in" or "cm", are then calculated in a way that makes them appear 1:1 in the resulting image.
...then, for all processing of svg content: [...] "1cm" equals "35.43307px" (and therefore 35.43307 user units) « previousnext » ...
core/heritage - Archive of obsolete content
osable pieces of functionality does a better job: var hex = class({ hex: function hex() { return '#' + this.color; } }); var rgb = class({ red: function red() { return parseint(this.color.substr(0, 2), 16); }, green: function green() { return parseint(this.color.substr(2, 2), 16); }, blue: function blue() { return parseint(this.color.substr(4, 2), 16); } }); var cmyk = class({ black: function black() { var color = math.max(math.max(this.red(), this.green()), this.blue()); return (1 - color / 255).tofixed(4); }, magenta: function magenta() { var k = this.black(); return (((1 - this.green() / 255).tofixed(4) - k) / (1 - k)).tofixed(4); }, yellow: function yellow() { var k = this.black(); return (((1 - this.blue() / 255).tofix...
...) / (1 - k)).tofixed(4); }, cyan: function cyan() { var k = this.black(); return (((1 - this.red() / 255).tofixed(4) - k) / (1 - k)).tofixed(4); } }); such composable pieces can be combined into a single class definition by passing special implements option to a class function: // composing `color` prototype out of reusable components: var color = class({ implements: [ hex, rgb, cmyk ], initialize: function initialize(color) { this.color = color; } }); var pink = color('ffc0cb'); // rgb pink.red() // => 255 pink.green() // => 192 pink.blue() // => 203 // cmyk pink.magenta() // => 0.2471 pink.yellow() // => 0.2039 pink.cyan() // => 0.0000 pink instanceof color // => t...
cfx - Archive of obsolete content
--binary-args=cmdargs pass extra arguments to the binary being executed (for example, firefox).
... --binary-args=cmdargs pass extra arguments to the binary being executed (for example, firefox).
jpm - Archive of obsolete content
--binary-args cmdargs pass extra arguments to firefox.
... --binary-args cmdargs pass extra arguments to firefox.
Forms related code snippets - Archive of obsolete content
olor: #999999; cursor: pointer; } td.zdp-empty-cell { cursor: not-allowed; } </style> </head> <body> <form name="myform"> <p> from: <input type="text" readonly class="date-picker" name="date-from" /> to: <input type="text" readonly class="date-picker" name="date-to" /> </p> </form> </body> </html> note: the current implementation of const (constant statement) is not part of ecmascript 5.
...const is going to be defined by ecmascript 6, but with different semantics.
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
so if library acmelib is used inside the multifarious/ subproject in the above example, it would be placed as a subdirectory underneath that subproject (at the same level as public/ and src/).
... of course, this means that you will have to build acmelib manually on all platforms before launching the mozilla build.
Custom about: URLs - Archive of obsolete content
const {classes: cc, interfaces: ci, manager: cm, results: cr, utils: cu, constructor: cc} = components; cm.queryinterface(ci.nsicomponentregistrar); components.utils.import("resource://gre/modules/services.jsm"); // globals const aboutpage_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 aboutpag...
...nnel = services.io.newchannel(aboutpage_uri, null, null); } channel.originaluri = auri; return channel; } } class factory { constructor(component) { this.component = component; this.register(); object.freeze(this); } createinstance(outer, iid) { if (outer) { throw cr.ns_error_no_aggregation; } return new this.component(); } register() { cm.registerfactory(this.component.classid, this.component.classdescription, this.component.contractid, this); } unregister() { cm.unregisterfactory(this.component.prototype.classid, this); } } instantiation firefox 4+ now in the startup procedure of your bootstrapped addon make sure to do register the factory, for ex...
popChallengeResponse - Archive of obsolete content
resultstring = crypto.popchallengeresponse("challengestring"); argument description "challengestring" a base-64 encoded cmmf popodeckeychallcontent message.
... the current implementation does not conform to that defined in the cmmf draft, and we intend to change this implementation to that defined in the cmc rfc..
JavaScript crypto - Archive of obsolete content
in the add case, the module will be placed in the nss secmod.db database and will be loaded automatically on application restart.
... in the delete case, the module is removed from the nss secmod.db.
Menus - Archive of obsolete content
<command id="cmd_open" oncommand="alert('open a file!');"/> ...
... <menuitem label="open" accesskey="o" command="cmd_open"/> the command attribute should be set to the id of a command element within the same document, in this case 'cmd_open'.
Providing Command-Line Options - Archive of obsolete content
entry: "m-myapp" }], queryinterface: xpcomutils.generateqi([ ci.nsicommandlinehandler ]), /* nsicommandlinehandler */ handle : function clh_handle(cmdline) { try { // changeme: change "viewapp" to your command line flag that takes an argument var uristr = cmdline.handleflagwithparam("viewapp", false); if (uristr) { // convert uristr to an nsiuri var uri = cmdline.resolveuri(uristr); openwindow(chrome_uri, uri); cmdline.preventdefault = true; } } catch (e) { components.
...utils.reporterror("incorrect parameter passed to -viewapp on the command line."); } // changeme: change "myapp" to your command line flag (no argument) if (cmdline.handleflag("myapp", false)) { openwindow(chrome_uri, null); cmdline.preventdefault = true; } }, // changeme: change the help info as appropriate, but // follow the guidelines in nsicommandlinehandler.idl // specifically, flag descriptions should start at // character 24, and lines should be wrapped at // 72 characters with embedded newlines, // and finally, the string should end with a newline helpinfo : " -myapp open my application\n" + " -viewapp <uri> view and edit the uri in my application,\n" + " wrapping this d...
Keyboard Shortcuts - Archive of obsolete content
<?xml version="1.0" encoding="utf-8"?> <window xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <keyset> <key id="cut_cmd" modifiers="accel" key="x"/> <key id="copy_cmd" modifiers="accel" key="c"/> <key id="paste_cmd" modifiers="accel" key="v"/> <key id="close_cmd" keycode="vk_escape" oncommand="window.close();"/> </keyset> <vbox flex="1"> <toolbox> <menubar id="findfiles-menubar"> <menu id="file-menu" label="file" accesskey="f"> <menupopup id="file-popup"> <menuitem label="open sear...
...ch..." accesskey="o"/> <menuitem label="save search..." accesskey="s"/> <menuseparator/> <menuitem label="close" accesskey="c" key="close_cmd" oncommand="window.close();"/> </menupopup> </menu> <menu id="edit-menu" label="edit" accesskey="e"> <menupopup id="edit-popup"> <menuitem label="cut" accesskey="t" key="cut_cmd"/> <menuitem label="copy" accesskey="c" key="copy_cmd"/> <menuitem label="paste" accesskey="p" key="paste_cmd" disabled="true"/> </menupopup> </menu> </menubar> </toolbox> </vbox> </window> now we can use those shortcuts to activate the commands.
XUL Event Propagation - Archive of obsolete content
for example, if an event handler at the menu is handling an event raised by one of the menu items, then the menu should be able to identify the raising element and take the appropriate action, as in the following example, where a javascript function determines which menuitem was selected and responds appropriately: <script> function docmd(el) { v = el.getattribute("value"); if (v == "new") alert("new clicked"); else if (v == "open") alert("open clicked"); else alert("close clicked"); } </script> ...
... <menu class="menu" value="file" oncommand="docmd(event.target)"> <menupopup> <menuitem oncommand="alert('new item alert')" value="new" /> <menuitem value="open" /> <menuitem oncommand="alert('close handler')" value="close" /> </menupopup> </menu> ...
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
my app allownoicons=yes outputdir=..\build\output outputbasefilename=myapp-1.0-win32 ; setupiconfile= compression=lzma solidcompression=yes [languages] name: english; messagesfile: compiler:default.isl [components] name: main; description: my app; types: full compact custom; flags: fixed name: runtime; description: xul runner runtime; types: full custom [tasks] name: desktopicon; description: {cm:createdesktopicon}; groupdescription: {cm:additionalicons}; flags: unchecked name: quicklaunchicon; description: {cm:createquicklaunchicon}; groupdescription: {cm:additionalicons}; flags: unchecked [files] source: c:\develop\xulrunnerinstaller\myapp\myapp.exe; destdir: {app}; components: main; flags: ignoreversion source: c:\develop\xulrunnerinstaller\myapp\application.ini; destdir: {app}; compo...
... .svn; destdir: {app}\defaults; components: main; flags: ignoreversion recursesubdirs createallsubdirs source: c:\develop\xulrunnerinstaller\myapp\xulrunner\*; destdir: {app}\xulrunner; components: runtime; flags: ignoreversion recursesubdirs createallsubdirs ; note: don't use "flags: ignoreversion" on any shared system files [icons] name: {group}\my app; filename: {app}\myapp.exe name: {group}\{cm:uninstallprogram,xul explorer}; filename: {uninstallexe} name: {userdesktop}\my app; filename: {app}\myapp.exe; tasks: desktopicon name: {userappdata}\microsoft\internet explorer\quick launch\my app; filename: {app}\myapp.exe; tasks: quicklaunchicon [run] filename: {app}\myapp.exe; description: {cm:launchprogram,my app}; onlybelowversion: 0,6; flags: nowait postinstall skipifsilent step 4: bu...
Array comprehensions - Archive of obsolete content
array comprehension was previously proposed to be standardized in ecmascript 2016, it provide a useful shortcut for constructing a new array based on the contents of another.
..."3c"], the same as below: [for (i of numbers) for (j of letters) if (i > 1) if(j > 'a') i + j] // ["2b", "2c", "3b", "3c"] [for (i of numbers) if (i > 1) [for (j of letters) if(j > 'a') i + j]] // [["2b", "2c"], ["3b", "3c"]], not the same as below: [for (i of numbers) [for (j of letters) if (i > 1) if(j > 'a') i + j]] // [[], ["2b", "2c"], ["3b", "3c"]] specifications was initially in the ecmascript 2015 draft, but got removed in revision 27 (august 2014).
New in JavaScript 1.6 - Archive of obsolete content
the corresponding ecma standard is ecma-262 edition 3 and ecmascript for xml (e4x) with some additional features.
... new features in javascript 1.6 support for ecmascript for xml (e4x) for creating and processing xml content within javascript has been added.
New in JavaScript 1.7 - Archive of obsolete content
new features in javascript 1.7 the following features added with javascript 1.7 were not part of an ecma-262 standard at the time.
... in more recent firefox versions, the implementation is updated to work with semantics as specified in ecmascript edition 6.
Old Proxy API - Archive of obsolete content
object.getpropertydescriptor(proxy, name) getpropertydescriptor: function(name) -> propertydescriptor | undefined this function doesn't exist in ecmascript 5.
... object.getpropertynames(proxy) getpropertynames: function() -> strings array this function doesn't exist in ecmascript 5.
Building up a basic demo with Three.js - Game development
let's play with the last two later, but for now, the basic one should be enough: var basicmaterial = new three.meshbasicmaterial({color: 0x0095dd}); add this line below the previously added.
...this takes on a shape, and adds the specified material to every face: var cube = new three.mesh(boxgeometry, basicmaterial); again, add this line below the one you previously added.
GLSL Shaders - Game development
applying the shaders to actually apply the newly created shaders to the cube, comment out the basicmaterial definition first: // var basicmaterial = new three.meshbasicmaterial({color: 0x0095dd}); then, create the shadermaterial: var shadermaterial = new three.shadermaterial( { vertexshader: document.getelementbyid( 'vertexshader' ).textcontent, fragmentshader: document.getelementbyid( 'fragmentshader' ).textcontent }); this shader material takes the code from the scripts and applies it ...
... then, in the line that defines the cube we need to replace the basicmaterial: var cube = new three.mesh(boxgeometry, basicmaterial); ...with the newly created shadermaterial: var cube = new three.mesh(boxgeometry, shadermaterial); three.js compiles and runs the shaders attached to the mesh to which this material is given.
Tiles and tilemaps overview - Game development
some popular games that use this technique are super mario bros, pacman, zelda: link's awakening, starcraft, and sim city 2000.
...this case is very common in arcade games like pacman, arkanoid, or sokoban.
Visual-js game engine - Game development
prompt 3) select folder for server part of application (important : www is not secure place) 4) select folder for client part of application ( any path in www) 5) new app name will appear in project list , select and click open application 6) open your server folder : install node.js modules one way - use windows bat-s file (in server root folder with prefix install_ ) second way - open cmd terminal and enter next command : npm install mysql npm install delivery npm install express npm install mkdirp npm install socket.io npm install nodemailer@0.7.0 very easy installation and project files generator .
...manual start from cmd : server_folder/node editor.js after starting on-page-editor open browser icon to open internet browser in editor mode .
Visual typescript game engine - Game development
es/ | ├── imgs/ | ├── styles/ | | └── favicon.ico | ├── visualjs2.js | ├── app.html ├── src/ | ├── style/ | | ├── styles.css | ├── libs/ | | ├── class/ | | | ├── networking/ | | | | ├── rtc-multi-connection/ | | | | | ├── filebufferreader.js | | | | | ├── rtcmulticonnection2.js | | | | | ├── rtcmulticonnection3.js | | | | | ├── linkify.js | | | | | ├── gethtmlmediaelement.js | | | | | ├── socket.io.js | | | | ├── broadcaster-media.ts | | | | ├── broadcaster.ts | | | | ├── connector.ts | | | | ├── network.ts | | | ├── visua...
...is.connectorport = 1234; this.domain = "192.168.0.14"; this.masterserverkey = "multi-platformer-sever1.maximum"; this.protocol = "http"; this.issecure = false; this.appuseaccountssystem = true; this.appusevideochat = true; this.databasename = "masterdatabase"; this.databaseroot = "mongodb://localhost:27017"; - the running server is easy : npm run rtc with this cmd: npm run rtc we run server.js and connector.ts websocket.
Git - MDN Web Docs Glossary: Definitions of Web-related terms
git is a free, open-source, distributed source code management (scm) system.
...what sets it apart from previous scm systems is the ability to do common operations (branching, committing, etc.) on your local development machine, without having to change the master repository or even having write access to it.
CSS values and units - Learn web development
unit name equivalent to cm centimeters 1cm = 96px/2.54 mm millimeters 1mm = 1/10th of 1cm q quarter-millimeters 1q = 1/40th of 1cm in inches 1in = 2.54cm = 96px pc picas 1pc = 1/6th of 1in pt points 1pt = 1/72th of 1in px pixels 1px = 1/96th of 1in most of these values are more useful when used for print, rather than scre...
...for example we don't typically use cm (centimeters) on screen.
How much does it cost to do something on the Web? - Learn web development
“packaged” hosting when you want to publish a website, you could do everything by yourself: set up a database (if needed), content management system, or cms (like wordpress, dotclear, spip, etc.), upload pre-made or your own templates.
... you could use your hosting provider's environment, for roughly ten to fifteen dollars per month, or subscribe directly to a dedicated hosting service with pre-packaged cmss (e.g., wordpress, tumblr, blogger).
Handling common HTML and CSS problems - Learn web development
right/cmd + click on the element in question and choose inspect/inspect element (or whatever the option is in your browser) — this should open up the dev tools in your browser, with the element highlighted in the dom inspector.
... in your code, you can select sections of css you want to add prefixes to, open the command pallette (cmd/ctrl + shift + p), then type in autoprefixer and select the autoprefixer result that autocompletes.
Creating MozSearch plugins
<searchplugin xmlns="http://www.mozilla.org/2006/browser/search/"> <shortname>mdc</shortname> <description>mozilla developer center search</description> <inputencoding>utf-8</inputencoding> <image width="16" height="16">data:image/x-icon;base64,ivborw0kggoaaaansuheugaaabaaaaaqcayaaaaf8%2f9haaaabgdbtueaak%2finwwk6qaaabl0rvh0u29mdhdhcmuaqwrvymugsw1hz2vszwfkexhjztwaaahwsurbvhjayvz%2f%2fz8djqaggjiqoe%2ffv2fv7oz8rays%2fn%2bvkfg%2fiynjfyd%2f1%2brvq7ffu3dpfpsbaaheahibcj85c8bn2nj4vwsdw%2f8zqlwkio8ccroqu0dxqlwrdshuwzbaaigjmtnnpgya9j8uqhfelwpxf2mideirksn9fwsjorkaeeam0dd4dzmaypi%2fg%2bqky4hh5waxgf8pdq0fgwj22d27cjadaaiirlmjo%2bmxa9r2kahvgba2wwx6b8w7od6ceqcggkcmcel8bgwxycbuigtdvkhdbia%2bcuotgaccued3tdqn75d4xmavcok9armhbzaw0aecibhkalc0mdy7...
...x9abna3obazxiaa6ikecglmvqhwwyjyul2d4v2cpg8vzswx7ghyaaak7aoif7saboqcmn4ha3ahfsidtgpq%2fvlz8p4mskj2w9h8ggbjevxvhdo4fquqg%2fkdypqcg4h8luiacnq%2fsobmyi8basajfpcj1aaeejwvqqlpabxmh5bjjqi0gi9dtaagdbbccavlkgmq7ykczxpcqxquzhaeccj4xgml493ug21zd%2badaxh0wlm4a9mzpxjkjiiawtar5pqmalacabquulttbgccagcnnzgabbgamj5thwgvjlaaaaabjru5erkjggg%3d%3d</image> <url type="text/html" method="get" template="http://developer.mozilla.org/en/docs/special:search?search={searchterms}"/> <searchform>http://developer.mozilla.org/en/docs/special:search</searchform> </searchplugin> notice in this case that instead of using <param> to define parameters to the search engine, they're simply embedded inside the template url.
Error codes returned by Mozilla APIs
ns_error_dom_invalid_expression_err (0x805b0033) ns_error_dom_type_err (0x805b0034) ns_error_dom_security_err (0x805303e8) ns_error_dom_secman_err (0x805303e9) ns_error_dom_wrong_type_err (0x805303ea) ns_error_dom_not_object_err (0x805303eb) ns_error_dom_not_xpc_object_err (0x805303ec) ns_error_dom_not_number_err (0x805303ed) ns_error_dom_not_boolean_err (0x805303ee) ns_error_dom_not_function_err (0x805303ef) ns_error_dom_too_few_parameters_err (0x805303f0) ns_error_dom_bad_document_domain (0x805303f1) ...
...tor_no_dom_node_specified (0x80640002) ns_error_schemavalidator_no_type_found (0x80640003) ns_error_schemavalidator_type_not_found (0x80640004) note: there are other errors in these files: gfx/public/nsidevicecontext.h base/public/nsneterror.h parser/htmlparser/public/nsiparser.h layout/base/nslayouterrors.h profile/public/nsiprofileinternal.idl security/manager/ssl/public/nsicmsmessageerrors.idl directory/xpcom/base/public/nsildaperrors.idl content/base/public/nscontenterrors.h see also mozilla error lookup lets you quickly look up the error name by its code in different formats.
Frame script environment
sendasyncmessage() send an asynchronous message to chrome.
... sendsyncmessage() send a synchronous message to chrome.
Frame script environment
sendasyncmessage() send an asynchronous message to chrome.
... sendsyncmessage() send a synchronous message to chrome.
Frame script loading and lifetime
var gcontentframemessagemanager = this; addeventlistener('unload', function(aevent) { if (aevent.target == gcontentframemessagemanager) { sendasyncmessage('my-addon-id', 'framescript-died'); // if you did not set third argument of `services.mm.addmessagelistener` to `true`, then this will fail to send a message } }, false); note about unload during uninstallation/upgrade when your add-on is uninstalled, or disabled, you should: cancel it, if you have used allowdelayedload, by calling removedelayedframescript; ensuring the frame scrip...
... in fact, the message manager guarantees that loadframescript and broadcastasyncmessage are guaranteed to affect frame scripts in the order that they are called, so in this case "disable" will be received and consumed before the new frame scripts are loaded.
Process scripts
s the process script to receive messages from the chrome side, and to send messages to the chrome side: // process-script.js if (services.appinfo.processtype == services.appinfo.process_type_content) { dump("welcome to the process script in a content process"); } else { dump("welcome to the process script in the main process"); } // message is sent using contentprocessmessagemanager sendasyncmessage("hello"); in this example, the dump() statement will run once in each content process as well as in the main process.
...if you do, you must call removedelayedprocessscript() when your extension is disabled or removed the message-passing apis are the same: sendasyncmessage() is available in both directions, while sendsyncmessage() is available from content to chrome only process scripts are system-privileged, and have access to the components object.
Floating Point Number to String Conversion
acm sigplan '90, pp.
...acm sigplan '90, pp.
NSS 3.12.5 release_notes
see the following struct in nss.h for details: nssinitparametersstr other new functions in secmod.h: secmod_getskipfirstflag secmod_getdefaultmoddbflag in prlink.h nss_securememcmp port_loadlibraryfromorigin modified functions sgn_update (see cryptohi.h) the parameter "input" of this function is changed from unsigned char * to const unsigned char *.
... pk11_importcert fails, it leaves the certificate undiscoverable by cert_pkixverifycert bug 518443: pk11_importandreturnprivatekey leaks an arena bug 518446: pk11_derencodepublickey leaks a certsubjectpublickeyinfo bug 518457: seckey_encodedersubjectpublickeyinfo and pk11_derencodepublickey are duplicate bug 522510: add deprecated comments to key.h and pk11func.h bug 522580: nss uses port_memcmp for comparing secret data.
NSS 3.14.2 release notes
the release is available for download from https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_14_2_rtm/src/ for the primary nss documentation pages please visit /docs/nss new in nss 3.14.2 nss will now make use of the intel aes-ni and avx instruction sets for hardware-accelerated aes-gcm on 64-bit linux systems.
... new types: in certt.h cert_pi_useonlytrustanchors in secoidt.h sec_oid_ms_ext_key_usage_ctl_signing notable changes in nss 3.14.2 bug 805604 - support for aes-ni and avx accelerated aes-gcm was contributed by shay gueron of intel.
NSS 3.21 release notes
ew functionality certutil now supports a --rename option to change a nickname (bug 1142209) tls extended master secret extension (rfc 7627) is supported (bug 1117022) new info functions added for use during mid-handshake callbacks (bug 1084669) new functions in nss.h nss_optionset - sets nss global options nss_optionget - gets the current value of nss global options in secmod.h secmod_createmoduleex - create a new secmodmodule structure from module name string, module parameters string, nss specific parameters string, and nss configuration parameter string.
...the difference with secmod_createmodule is the new function handles nss configuration parameter strings.
NSS 3.24 release notes
counter mode and galois/counter mode (gcm) have checks to prevent counter overflow.
... new macros in pkcs11t.h ckm_tls12_mac in secoidt.h sec_oid_tls_ecdhe_psk - this oid governs the use of the tls_ecdhe_psk_with_aes_128_gcm_sha256 cipher suite, which is used only for session resumption in tls 1.3.
NSS 3.42 release notes
new in nss 3.42 new functionality bug 818686 - support xdg basedir specification new functions none notable changes in nss 3.42 the following ca certificates were added: none the following ca certificates were removed: none added support for some of the testcases from the wycheproof project: bug 1508666 - added aes-gcm test cases bug 1508673 - added chacha20-poly1305 test cases bug 1514999 - added the curve25519 test cases thanks to jonas allmann for adapting these tests.
... bugs fixed in nss 3.42 bug 1490006 - reject invalid ch.legacy_version in tls 1.3 bug 1507135 and bug 1507174 - add additional null checks to several cms functions to fix a rare cms crash.
NSS 3.51 release notes
bug 1611209 - correct swapped pkcs11 values of ckm_aes_cmac and ckm_aes_cmac_general bug 1612259 - complete integration of wycheproof ecdh test cases bug 1614183 - check if ppc __has_include(<sys/auxv.h>) bug 1614786 - fix a compilation error for ‘getfipsenv’ "defined but not used" bug 1615208 - send dtls version numbers in dtls 1.3 supported_versions extension to avoid an incompatibility.
...19.c:88 bug 1609751 - add test for mp_int clamping bug 1582169 - don't attempt to read the fips_enabled flag on the machine unless nss was built with fips enabled bug 1431940 - fix a null pointer dereference in blake2b_update bug 1617387 - fix compiler warning in secsign.c bug 1618400 - fix a openbsd/arm64 compilation error: unused variable 'getauxval' bug 1610687 - fix a crash on unaligned cmaccontext.aes.keyschedule when using aes-ni intrinsics this bugzilla query returns all the bugs fixed in nss 3.51: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.51 compatibility nss 3.51 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS Config Options
g="disallow=all allow=sha1:sha256:secp256r1:secp384r1" only the specified hashes and curves will be allowed, and rsa keys of 2048 or more will be accepted, and dh key exchange with 1024-bit primes or more: config="disallow=all allow=sha1:sha256:secp256r1:secp384r1:min-rsa=2048:min-dh=1024" a policy that enables the aes ciphersuites and the secp256/384 curves: config="allow=aes128-cbc:aes128-gcm::hmac-sha1:sha1:sha256:sha384:rsa:ecdhe-rsa:secp256r1:secp384r1" turn off md5 config="disallow=md5" turn off md5 and sha1 only for ssl config="disallow=md5(ssl):sha1(ssl)" disallow values are parsed first, and then allow values, independent of the order in which they appear.
...431r1 sect113r1 sect131r1 sect131r1 sect131r2 sect163k1 sect163r1 sect163r2 sect193r1 sect193r2 sect233k1 sect233r1 sect239k1 sect283k1 sect283r1 sect409k1 sect409r1 sect571k1 sect571r1 hashes md2 md4 md5 sha1 sha224 sha256 sha384 sha512 macs hmac-sha1 hmac-sha224 hmac-sha256 hmac-sha384 hmac-sha512 hmac-md5 ciphers aes128-cbc aes192-cbc aes256-cbc aes128-gcm aes192-gcm aes256-gcm camellia128-cbc camellia192-cbc camellia256-cbc seed-cbc des-ede3-cbc des-40-cbc des-cbc null-cipher rc2 rc4 idea ssl key exchanges rsa rsa-export dhe-rsa dhe-dss dh-rsa dh-dss ecdhe-ecdsa ecdhe-rsa ecdh-ecdsa ecdh-rsa restrictions for asymmetric keys (integers) rsa-min dh-min dsa-min constraints on ssl protocols versions (integers) tls-version-...
NSS Sample Code Sample_2_Initialization of NSS
return null; } for (;;) { if (p0) port_free(p0); p0 = getpassword(input, output, "enter new password: ", checkpassword); if (p1) port_free(p1); p1 = getpassword(input, output, "re-enter password: ", checkpassword); if (p0 && p1 && !port_strcmp(p0, p1)) { break; } pr_fprintf(pr_stderr, "passwords do not match.
... usage(progname); break; } } pl_destroyoptstate(optstate); if (!dbdir) usage(progname); pr_init(pr_user_thread, pr_priority_normal, 0); /* create the database */ rv = nss_initreadwrite(dbdir); if (rv != secsuccess) { pr_fprintf(pr_stderr, "nss_initialize failed"); pr_cleanup(); exit(rv); } if (pl_strcmp(slotname, "internal") == 0) slot = pk11_getinternalkeyslot(); /* if creating new database, initialize the password.
Hashing - sample 1
*/ /* nspr headers */ #include <prprf.h> #include <prtypes.h> #include <plgetopt.h> #include <prio.h> /* nss headers */ #include <secoid.h> #include <secmodt.h> #include <sechash.h> #include <nss.h> typedef struct { const char *hashname; secoidtag oid; } nametagpair; /* the hash algorithms supported */ static const nametagpair hash_names[] = { { "md2", sec_oid_md2 }, { "md5", sec_oid_md5 }, { "sha1", sec_oid_sha1 }, { "sha256", sec_oid_sha256 }, { "sha384", sec_oid_sha384 }, { "sha512", sec_oid_sha512 } }; /* * m...
... * returns null if the name if not a supported algorithm */ static secoidtag hashnametooidtag(const char *hashname) { int i, nhashes = sizeof(hash_names); secoidtag hashtag = sec_oid_unknown; for (i = 0; i < nhashes; i++) { if (port_strcasecmp(hashname, hash_names[i].hashname) == 0) { hashtag = hash_names[i].oid; break; } } return hashtag; } /* * newline */ static void newline(prfiledesc* out) { pr_fprintf(out, "\n"); } /* * printashex */ void printashex(prfiledesc* out, unsigned char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { pr_fprintf(out, "(empty)\n"); return; ...
Initialize NSS database - sample 2
return null; } for (;;) { if (p0) port_free(p0); p0 = getpassword(input, output, "enter new password: ", checkpassword); if (p1) port_free(p1); p1 = getpassword(input, output, "re-enter password: ", checkpassword); if (p0 && p1 && !port_strcmp(p0, p1)) { break; } pr_fprintf(pr_stderr, "passwords do not match.
... usage(progname); break; } } pl_destroyoptstate(optstate); if (!dbdir) usage(progname); pr_init(pr_user_thread, pr_priority_normal, 0); /* create the database */ rv = nss_initreadwrite(dbdir); if (rv != secsuccess) { pr_fprintf(pr_stderr, "nss_initialize failed"); pr_cleanup(); exit(rv); } if (pl_strcmp(slotname, "internal") == 0) slot = pk11_getinternalkeyslot(); /* if creating new database, initialize the password.
sample1
/* nspr headers */ #include <prprf.h> #include <prtypes.h> #include <plgetopt.h> #include <prio.h> #include <prprf.h> /* nss headers */ #include <secoid.h> #include <secmodt.h> #include <sechash.h> typedef struct { const char *hashname; secoidtag oid; } nametagpair; /* the hash algorithms supported */ static const nametagpair hash_names[] = { { "md2", sec_oid_md2 }, { "md5", sec_oid_md5 }, { "sha1", sec_oid_sha1 }, { "sha256", sec_oid_sha256 }, { "sha384", sec_oid_sha384 }, { "sha512", sec_oid_sha512 } }; /* maps a hash name to a secoidtag.
... * returns null if the name is not a supported algorithm */ static secoidtag hashnametooidtag(const char *hashname) { int i, nhashes = sizeof(hash_names); secoidtag hashtag = sec_oid_unknown; for (i = 0; i < nhashes; i++) { if (port_strcasecmp(hashname, hash_names[i].hashname) == 0) { hashtag = hash_names[i].oid; break; } } return hashtag; } /* newline */ static void newline(prfiledesc* out) { pr_fprintf(out, "\n"); } /* printashex */ void printashex(prfiledesc* out, unsigned char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { pr_fprintf(out, "(empty)\n"); return; ...
FC_Initialize
the library parameters string has this format: "configdir='dir' certprefix='prefix1' keyprefix='prefix2' secmod='file' flags= " here are some examples.
... nss_nodb_init(""), which initializes nss with no databases: "configdir='' certprefix='' keyprefix='' secmod='' flags=readonly,nocertdb,nomod db,forceopen,optimizespace " mozilla firefox initializes nss with this string (on windows): "configdir='c:\\documents and settings\\wtc\\application data\\mozilla\\firefox\\profiles\\default.7tt' certprefix='' keyprefix='' secmod='secmod.db' flags=optimizespace manufacturerid='mozilla.org' librarydescription='psm internal crypto services' cryptotokendescription='generic crypto services' dbtokendescription='software security device' cryptoslotdescription='psm internal cryptographic services' dbslotdescription='psm private keys' fipsslotdescription='psm internal fips-140-1 cryptographic services' fipstokendescription='psm fips-140-1 user private key ...
NSS tools : pk12util
pk12util supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt).
... the last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for pkcs #11 module information berkeleydb has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously.
NSS reference
validating certificates cert_verifycertnow cert_verifycert cert_verifycertname cert_checkcertvalidtimes nss_cmpcertchainwcanames manipulating certificates cert_dupcertificate cert_destroycertificate sec_deletepermcertificate __cert_closepermcertdb getting certificate information cert_findcertbyname cert_getcertnicknames cert_freenicknames cert_getdefaultcertdb nss_findcertkeatype comparing secitem objects secitem_compareitem key functions ke...
... secmod_loadusermodule secmod_unloadusermodule secmod_closeuserdb secmod_openuserdb pk11_findcertfromnickname pk11_findkeybyanycert pk11_getslotname pk11_gettokenname pk11_ishw pk11_ispresent pk11_isreadonly pk11_setpasswordfunc ssl functions based on "ssl functions" in the ssl reference and "ssl functions" and "deprecated ssl functions" in nss public functions.
gtstd.html
netscape software uses a file called secmod.db to keep track of the modules available.
... you can use the security module database tool, a command-line utility that comes with nss, to manage pkcs #11 module information within secmod.db files.
sslfnc.html
description nss_init opens the certn.db, keyn.db, and secmod.db files (wheren is a numeric digit) in the specified directory.
... description nss_initreadwrite opens the certn.db, keyn.db, and secmod.db files (wheren is a numeric digit) with both read and write permission in the specified directory.
NSS Tools
source, documentation, tasks/plans cmsutil 1.0 performs basic cms operations such as encrypting, decrypting, and signing messages.
... source, documentation, dbck 1.0 analyze and repair certificate databases (not working in nss 3.2) source, tasks/plans modutil 1.1 manage the database of pkcs11 modules (secmod.db).
NSS_3.12.3_release_notes.html
nss_seed nss_seed_cbc seed_block_size seed_key_length in pkcs11t.h: ckk_seed ckm_seed_key_gen ckm_seed_ecb ckm_seed_cbc ckm_seed_mac ckm_seed_mac_general ckm_seed_cbc_pad ckm_seed_ecb_encrypt_data ckm_seed_cbc_encrypt_data in secmod.h: public_mech_seed_flag in secmodt.h: secmod_seed_flag in secoidt.h: sec_oid_seed_cbc in sslproto.h: tls_rsa_with_seed_cbc_sha in sslt.h: ssl_calg_seed new structure for seed support: (see blapit.h) seedcontextstr ...
...ecerts (see cert.h) cert_registeralternateocspaiainfocallback (see ocsp.h) pk11_getsymkeyhandle (see pk11pqg.h) util_setforkstate (see secoid.h) nss_getalgorithmpolicy (see secoid.h) nss_setalgorithmpolicy (see secoid.h) for the 2 functions above see also (in secoidt.h): nss_use_alg_in_cert_signature nss_use_alg_in_cms_signature nss_use_alg_reserved support for the watcom c compiler is removed the file watcomfx.h is removed.
NSS tools : pk12util
pk12util supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt).
... the last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for pkcs #11 module information berkeleydb has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously.
NSS tools : signver
MozillaProjectsNSStoolssignver
signver supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt).
... the last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for pkcs #11 module information berkeleydb has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously.
Tutorial: Embedding Rhino
string s = ""; for (int i=0; i < args.length; i++) { s += args[i]; } evaluating a script the code object result = cx.evaluatestring(scope, s, "<cmd>", 1, null); uses the context cx to evaluate a string.
... evaluation of the script looks up variables in scope, and errors will be reported with the filename <cmd> and line number 1.
SpiderMonkey Internals
in addition to the interpreter, spidermonkey contains a just-in-time (jit) compiler, a garbage collector, code implementing the basic behavior of javascript values, a standard library implementing ecma 262-5.1 §15 with various extensions, and a few public apis.
...(otherwise, spidermonkey converts primitive values to objects before invoking their methods, per ecma 262-3 §11.2.1.) error handling spidermonkey has two interdependent error-handling systems: javascript exceptions (which are not implemented with, or even compatible with, any kind of native c/c++ exception handling) and error reporting.
JSAPI User Guide
for maximum ecmascript standard compliance, applications should also use js_setoptions to enable jsoption_varobjfix.
... rc = system(cmd); if (rc != 0) { /* throw a javascript exception.
JSObjectOps.defaultValue
description the jsobjectops.defaultvalue callback corresponds to the [[defaultvalue]] method defined in ecma 262-3 §8.6.2.6.
... many expressions in the ecmascript language, such as a+b, involve implicit conversion of the operands using [[defaultvalue]].
JSPropertyOp
this is typically the value of the left-hand side after assignment, as opposed to the value of the right-hand side, as required by ecma 262-3 §11.13.
... this ecmascript incompatibility is observable when assigning to the length property of an array, for example.
JSVersion
_0obsolete since jsapi 24 100 javascript 1.0 "1.0" jsversion_1_1obsolete since jsapi 24 110 javascript 1.1 "1.1" jsversion_1_2obsolete since jsapi 24 120 javascript 1.2 "1.2" jsversion_1_3obsolete since jsapi 24 130 javascript 1.3 "1.3" jsversion_1_4obsolete since jsapi 24 140 javascript 1.4 "1.4" jsversion_ecma_3 148 ecma 262 edition 3 "ecmav3" jsversion_1_5obsolete since jsapi 24 150 javascript 1.5 "1.5" jsversion_1_6 160 javascript 1.6 "1.6" jsversion_1_7 170 javascript 1.7 "1.7" jsversion_1_8 180 javascript 1.8 "1.8" jsversion_ecma_5 185 ecma 262 edition 5 "ecmav5" jsversion_default 0 la...
...test javascript version, but omitting web-incompatible extensions "default" jsversion_unknown -1 unknown javascript version null jsversion_latest jsversion_ecma_5 latest javascript version null see also mxr id search for jsversion js_getversion js_setversion js_stringtoversion js_versiontostring bug 824312 ...
JS_IsIdentifier
this article covers features introduced in spidermonkey 17 test whether the given string is a valid ecmascript identifier.
... description js_isidentifier tests if the given string is a valid ecmascript identifier.
JS_ParseJSON
this article covers features introduced in spidermonkey 1.8.6 parse a string using the json syntax described in ecmascript 5 and return the corresponding value.
... the parsing rules applied by these methods are exactly those specified by ecmascript 5.
JS_SetDefaultLocale
this article covers features introduced in spidermonkey 24 set and reset the default locale for the ecmascript internationalization api.
... description js_setdefaultlocale sets the default locale for the ecmascript internationalization api (intl.collator, intl.numberformat, intl.datetimeformat).
JS_ValueToBoolean
it implements the toboolean operator specified in ecma 262-3 §9.2.
...this is the behavior specified in ecma 262-3 §9.2.
JS_ValueToInt32
js_valuetoint32 is pre-ecma-262 edition 1, and rounds differently than js_valuetoecmaint32 and js::toint32.
...js::toint32 rounds as specified in ecma 262-3 §9.5, while this routine rounds by adding 0.5 to the converted float-point number and truncating the result at the decimal point.
JS_ValueToString
it implements the tostring operator specified in ecma 262-3 §9.8.
... if v is a number, conversion succeeds, and the result is a string representation of that number as specified in ecma 262-3 §9.8.1.
SpiderMonkey 24
e4x, an extension to ecmascript adding xml support, has been removed.
... the extension eventually became an evolutionary dead end, as tc39 chose not to incorporate it into ecmascript proper.
Embedded Dialog API
an example of this can be found in the mfc embedding testbed application, in the method cmfcembedapp::initializewindowcreator (lxr link accurate at revision 1.20 of that file; search for the method name in later revisions).
...a powerplant example can be found at cbrowserapp::overridecomponents (line number accurate in version 1.24) and an mfc example at cmfcembedapp::overridecomponents (line number accurate in version 1.20).
nsIContentFrameMessageManager
idl file: mozilla-central/source/dom/base/nsimessagemanager.idl inherits from: nsisyncmessagesender this interface provides the environment for scripts that are loaded into content frames using the nsiframescriptloader interface.
... frame scripts can send either synchronous or asynchronous messages to the chrome process: for details on these messaging apis see the documentation for the nsicontentframemessagemanager's parent classes nsisyncmessagesender and nsimessagesender.
nsIControllers
windows and text inputs have default controllers that allow commands such as cmd_copy to act on the focused element or window.
...cmd_copy return value the first controller in the list that supports the given command.
nsIWebProgressListener
istener", "nsisupportsweakreference"]), onstatechange: function(awebprogress, arequest, aflag, astatus) { let win = awebprogress.domwindow; let outerwindowid = win.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsidomwindowutils) .outerwindowid; sendasyncmessage("myaddonmessage", { name: "onstatechange", flag: aflag, status: astatus, }); }, onlocationchange: function(aprogress, arequest, auri, aflag) { let win = awebprogress.domwindow; let outerwindowid = win.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsidomwindowutils) ...
... .outerwindowid; sendasyncmessage("myaddonmessage", { name: "onlocationchange", outerwindowid: outerwindowid, uri: auri.spec, charset: auri.charset, flag: aflag, }); }, // for definitions of the remaining functions see related documentation onprogresschange: function(awebprogress, arequest, curself, maxself, curtot, maxtot) {}, onstatuschange: function(awebprogress, arequest, astatus, amessage) {}, onsecuritychange: function(awebprogress, arequest, astate) {} } let filter = cc["@mozilla.org/appshell/component/browser-status-filter;1"] .createinstance(ci.nsiwebprogress); filter.addprogresslistener(mylistener, ci.nsiwebprogress.notify_all); let webprogress = docshe...
Xptcall Porting Guide
ns_imethod getinterfaceinfo(nsiinterfaceinfo** info) = 0; // call this method and return result ns_imethod callmethod(pruint16 methodindex, const nsxptmethodinfo* info, nsxptcminivariant* params) = 0; }; code that wishes to make use of this stubs functionality (such as xpconnect) implement a class which inherits from nsxptcstubbase and implements the getinterfaceinfo and callmethod to let the platform specific code know how to get interface information and how to dispatch methods once their parameters have been pulled out of the platform specific calling frame.
...the stubs forward calls to a platform specific method that uses the interface information supplied by the overridden getinterfaceinfo to extract the parameters and build an array of platform independent nsxptcminivariant structs which are in turn passed on to the overridden callmethod.
Main Windows
osx only: macmenuoverlay.xul a special overlay for osx that adds a few items to the window menu.
... osx only: macmenuoverlay.xul a special overlay for osx that adds a few items to the window menu.
Finding the code for a feature
using dom inspector, i find the tag menu item, and i see that it uses command "cmd_tag".
... then i use mxr and look for "cmd_tag".
Browser Console - Firefox Developer Tools
from the keyboard: press ctrl+shift+j (or cmd+shift+j on a mac).
... note: you can restart the browser with the command ctrl + alt + r (windows, linux) or cmd + alt + r (mac) this command restarts the browser with the same tabs open as before the restart.
UI Tour - Firefox Developer Tools
you can search for a file using ctrl + p (cmd + p on a mac).
... when the source pane is focused you can search for a string in the file using ctrl + f (cmd + f on a mac).
Deprecated tools - Firefox Developer Tools
the editor mode can be triggered clicking on the icon on the right of the console input, or with ctrl + b (cmd + b on macos) when in editor mode, the enter key adds a new line in the input, and you can evaluate the expression using ctrl + enter (cmd + enter on macos).
... starting firefox 72, you can import a javascript file content in the console input with ctrl + o (cmd + o on macos), as well as saving the console input content to a file using ctrl + s (cmd + s on macos).
Index - Firefox Developer Tools
this is the two-pane inspector that appears when ctrl+shift+i (or cmd+shift+i) is pressed from one of the applications for which dom inspector has explicit support (i.e., menuitems placed via overlay).
... 9 introduction to dom inspector dom_inspector the dom inspector is a mozilla extension that you can access from the tools > web development menu in seamonkey, or by selecting the dom inspector menu item from the tools menu in firefox and thunderbird, or by using ctrl/cmd+shift+i in either application.
Migrating from Firebug - Firefox Developer Tools
to open it to inspect an element it is possible to press ctrl+shift+c / cmd+opt+c.
...the network monitor can be opened via ctrl+shift+q / cmd+opt+q, the web console via ctrl+shift+k / cmd+opt+k and the debugger via ctrl+shift+s / cmd+opt+s.
Edit Shape Paths in CSS - Firefox Developer Tools
options can be accessed by activating the shape path editor with a regular click on the icon, and you can use the context menu (ctrl/cmd + click) to access additional functionality.
... moving and scaling shapes there is extra functionality available on the shape highlight — if you ctrl/cmd + click on the shapes icon for your shape the highlight will change, instead providing the ability to scale and/or move it.
Examine and edit CSS - Firefox Developer Tools
while in the rules view, you can press ctrl / cmd + f to focus the search field.
... while in the computed view, you can press ctrl / cmd + f to focus the search field.
Examine and edit HTML - Firefox Developer Tools
to start searching the markup, click in the search box to expand it or press ctrl + f , or cmd + f on a mac.
... pressing ctrl + c (or cmd + c on a mac) also performs this action.
Style Editor - Firefox Developer Tools
command windows macos linux go to line ctrl + j, ctrl + g cmd + j, cmd + g ctrl + j, ctrl + g find in file ctrl + f cmd + f ctrl + f select all ctrl + a cmd + a ctrl + a cut ctrl + x cmd + x ctrl + x copy ctrl + c cmd + c ctrl + c paste ctrl + v cmd + v ctrl + v undo ctrl + z cmd + z ctrl + z redo ctrl + shift + z / ctrl + y cmd + s...
...hift + z / cmd + y ctrl + shift + z / ctrl + y indent tab tab tab unindent shift + tab shift + tab shift + tab move line(s) up alt + up alt + up alt + up move line(s) down alt + down alt + down alt + down comment/uncomment line(s) ctrl + / cmd + / ctrl + / ...
Web console keyboard shortcuts - Firefox Developer Tools
command windows macos linux open the web console ctrl + shift + k cmd + opt + k ctrl + shift + k search in the message display pane ctrl + f cmd + f ctrl + f open the object inspector pane ctrl + click ctrl + click ctrl + click clear the object inspector pane esc esc esc focus on the command line ctrl + shift + k cmd + opt + k ctrl + shift + k clear output ctrl + shift + l ctrl + l from firefox 67: cmd + k ctrl + shift + l command line interpreter these shortcuts apply when you're in the command line interpreter.
... command windows macos linux increase font size ctrl + + cmd + + ctrl + + decrease font size ctrl + - cmd + - ctrl + - reset font size ctrl + 0 cmd + 0 ctrl + 0 ...
AesKeyGenParams - Web APIs
the aeskeygenparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.generatekey(), when generating an aes key: that is, when the algorithm is identified as any of aes-cbc, aes-ctr, aes-gcm, or aes-kw.
...this should be set to aes-cbc, aes-ctr, aes-gcm, or aes-kw, depending on the algorithm you want to use.
BaseAudioContext.decodeAudioData() - Web APIs
the single argument to this callback is an audiobuffer representing the decodeddata (the decoded pcm audio data).
...we then pass this buffer into a decodeaudiodata() function; the success callback takes the successfully decoded pcm data, puts it into an audiobuffersourcenode created using audiocontext.createbuffersource(), connects the source to the audiocontext.destination and sets it to loop.
CSSPrimitiveValue.getFloatValue() - Web APIs
valid values are: constant description css_cm the value is a <length> in centimeters.
... example var cs = window.getcomputedstyle(document.body); var cssvalue = cs.getpropertycssvalue("margin-top"); console.log(cssvalue.getfloatvalue(cssprimitivevalue.css_cm)); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssprimitivevalue.getfloatvalue' in that specification.
DirectoryReaderSync - Web APIs
console.log(fileentry.name); }); }); }; worker.postmessage({'cmd': 'list'}); the following is worker.js code that gets the contents of the directory.
... if (!data.cmd || data.cmd != 'list') { return; } try { var fs = requestfilesystemsync(temporary, 1024*1024 /*1mb*/); getallentries(fs.root.createreader()); self.postmessage({entries: paths}); } catch (e) { onerror(e); } }; method overview entrysync readentries () raises (fileexception); method readentries() returns a lost of entries from a specific directory...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
*/ function is_all_ws( nod ) { // use ecma-262 edition 3 string and regexp features return !(/[^\t\n\r ]/.test(nod.textcontent)); } /** * determine if a node should be ignored by the iterator functions.
... */ function data_of( txt ) { var data = txt.textcontent; // use ecma-262 edition 3 string and regexp features data = data.replace(/[\t\n\r ]+/g, " "); if (data.charat(0) == " ") data = data.substring(1, data.length); if (data.charat(data.length - 1) == " ") data = data.substring(0, data.length - 1); return data; } example the following code demonstrates the use of the functions above.
Element: DOMActivate event - Web APIs
bubbles yes cancelable yes interface mouseevent examples <svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseprofile="tiny" xmlns:ev="http://www.w3.org/2001/xml-events" width="6cm" height="5cm" viewbox="0 0 600 500"> <desc>example: invoke an ecmascript function from a domactivate event</desc> <!-- ecmascript to change the radius --> <script type="application/ecmascript"><![cdata[ function change(evt) { var circle = evt.target; var currentradius = circle.getfloattrait("r"); if (currentradius == 100) circle.setfloattrait("r", currentradius ...
...* 2); else circle.setfloattrait("r", currentradius * 0.5); } ]]></script> <!-- act on each domactivate event --> <circle cx="300" cy="225" r="100" fill="red"> <handler type="application/ecmascript" ev:event="domactivate"> change(evt); </handler> </circle> <text x="300" y="480" font-family="verdana" font-size="35" text-anchor="middle"> activate the circle to change its size </text> </svg> specifications specification status ui eventsthe definition of 'domactivate' in that specification.
IDBFactory - Web APIs
idbfactory.cmp a method that compares two keys and returns a result indicating which one is greater in value.
...pera android full support 14safari ios full support 8samsung internet android full support 1.5 full support 1.5 no support 1.5 — 7.0prefixed prefixed implemented with the vendor prefix: webkitcmpchrome full support 24 full support 24 no support 23 — 24prefixed prefixed implemented with the vendor prefix: webkitedge full support 12firefox full support 16 full support ...
Using IndexedDB - Web APIs
$('#add-button').click(function(evt) { console.log("add ..."); var title = $('#pub-title').val(); var biblioid = $('#pub-biblioid').val(); if (!title || !biblioid) { displayactionfailure("required field(s) missing"); return; } var year = $('#pub-year').val(); if (year != '') { // better use number.isinteger if the engine has ecmascript 6 if (isnan(year)) { displayactionfailure("invalid year"); return; } year = number(year); } else { year = null; } var file_input = $('#pub-file'); var selected_file = file_input.get(0).files[0]; console.log("selected_file:", selected_file); // keeping a reference on how to reset the file input in the ...
... addpublication(biblioid, title, year); } }); $('#delete-button').click(function(evt) { console.log("delete ..."); var biblioid = $('#pub-biblioid-to-delete').val(); var key = $('#key-to-delete').val(); if (biblioid != '') { deletepublicationfrombib(biblioid); } else if (key != '') { // better use number.isinteger if the engine has ecmascript 6 if (key == '' || isnan(key)) { displayactionfailure("invalid key"); return; } key = number(key); deletepublication(key); } }); $('#clear-store-button').click(function(evt) { clearobjectstore(); }); var search_button = $('#search-list-button'); search_button.click(function(evt) { displaypublist();...
RTCRtpStreamStats.trackId - Web APIs
the rtcrtpstreamstats dictionary's trackid property is a string which uniquely identifies the rtcmediastreamtrackstats object which contains the track statistics for the mediastreamtrack for which statistics are provided in this object.
... syntax var trackid = rtcrtpstreamstats.trackid; value a domstring which uniquely identifies the rtcmediastreamtrackstats object that provides statistics for the track for which statistics are being collected by this rtcstatsreport.
RTCStatsReport - Web APIs
stream an object of type rtcmediastreamstats, providing statistics and information about a mediastream which is part of the rtcpeerconnection.
... track the object is one of the types based on rtcmediahandlerstats: for audio tracks, the type is rtcsenderaudiotrackattachmentstats and for video tracks, the type is rtcsendervideotrackattachmentstats.
RTCStatsType - Web APIs
stream an object of type rtcmediastreamstats, providing statistics and information about a mediastream which is part of the rtcpeerconnection.
... track the object is one of the types based on rtcmediahandlerstats: for audio tracks, the type is rtcsenderaudiotrackattachmentstats and for video tracks, the type is rtcsendervideotrackattachmentstats.
ServiceWorkerRegistration.periodicSync - Web APIs
the periodicsync read-only property of the serviceworkerregistration interface returns a reference to the periodicsyncmanager interface, which manages periodic background synchronization processes.
... syntax var periodicsyncmanager = serviceworkerregistration.periodicsync; value a periodicsyncmanager object.
ServiceWorkerRegistration.sync - Web APIs
the sync property of the serviceworkerregistration interface returns a reference to the syncmanager interface, which manages background synchronization processes.
... syntax var syncmanager = serviceworkerregistration.sync; value a syncmanager object.
ServiceWorkerRegistration - Web APIs
serviceworkerregistration.sync read only returns a reference to the syncmanager interface, which manages background synchronization processes.
... unimplemented properties serviceworkerregistration.periodicsync read only returns a reference to the periodicsyncmanager interface, which manages periodic background synchronization processes.
Web APIs
WebAPI
a angle_instanced_arrays abortcontroller abortsignal absoluteorientationsensor abstractrange abstractworker accelerometer addresserrors aescbcparams aesctrparams aesgcmparams aeskeygenparams ambientlightsensor analysernode animation animationeffect animationevent animationplaybackevent animationtimeline arraybufferview attr audiobuffer audiobuffersourcenode audioconfiguration audiocontext audiocontextlatencycategory audiocontextoptions audiodestinationnode audiolistener audionode audionodeoptions audioparam audioparamdescriptor audioparammap audioprocess...
...cognitionevent speechrecognitionresult speechrecognitionresultlist speechsynthesis speechsynthesiserrorevent speechsynthesisevent speechsynthesisutterance speechsynthesisvoice staticrange stereopannernode storage storageestimate storageevent storagemanager storagequota stylepropertymap stylepropertymapreadonly stylesheet stylesheetlist submitevent subtlecrypto syncevent syncmanager t taskattributiontiming text textdecoder textencoder textmetrics textrange texttrack texttrackcue texttracklist timeevent timeranges touch touchevent touchlist trackdefault trackdefaultlist trackevent transferable transformstream transitionevent treewalker typeinfo u uievent ulongrange url urlsearchparams urlutilsreadonly usb usbalternateinterface usbconfiguration usbd...
Web Accessibility: Understanding Colors and Luminance - Accessibility
the srgb color space the mdn document, <color> notes "the css data type represents a color in the srgb color space." color has many ways of being defined, including rgb, rgb decimal, rgb percent, hsl, cmyk among others.
... this places it far beyond standard gamuts (both rgb and cmyk), and its given rgb value is a poor approximation only." saturated red flashing: in addition to a red environment affecting the cognitive function of those with traumatic brain injury, color in the red spectrum wavelength requires special attention and tests.
bleed - CSS: Cascading Style Sheets
WebCSS@pagebleed
syntax /* keyword values */ bleed: auto; /* <length> values */ bleed: 8pt; bleed: 1cm; values auto computes to 6pt if the value of marks is crop.
... formal definition related at-rule@pageinitial valueautocomputed valueas specified formal syntax auto | <length> examples setting a page bleed of 1cm @page { bleed: 1cm; } specifications specification status comment css paged media module level 3the definition of 'bleed' in that specification.
Box-shadow generator - CSS: Cascading Style Sheets
ba(x, c, m); return; } if (h >= 2 && h < 3) { this.setrgba(m, c, x); return; } if (h >= 3 && h < 4) { this.setrgba(m, x, c); return; } if (h >= 4 && h < 5) { this.setrgba(x, m, c); return; } if (h >= 5 && h < 6) { this.setrgba(c, m, x); return; } } color.prototype.updatehsv = function updatehsv() { var red = this.r / 255; var green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red, green, blue); var cmin = math.min(red, green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; if (delta) { if (cmax === red ) { hue = ((green - blue) / delta); } if (cmax === green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red - green) / delta; } if (cmax) saturation = delta / cmax; } this.hue = 60 * hue |...
... 0; if (this.hue < 0) this.hue += 360; this.saturation = (saturation * 100) | 0; this.value = (cmax * 100) | 0; } color.prototype.sethexa = function sethexa(value) { var valid = /(^#{0,1}[0-9a-f]{6}$)|(^#{0,1}[0-9a-f]{3}$)/i.test(value) if (valid !== true) return; if (value[0] === '#') value = value.slice(1, value.length); if (value.length === 3) value = value.replace(/([0-9a-f])([0-9a-f])([0-9a-f])/i,"$1$1$2$2$3$3"); this.r = parseint(value.substr(0, 2), 16); this.g = parseint(value.substr(2, 2), 16); this.b = parseint(value.substr(4, 2), 16); this.alpha = 1; } color.prototype.gethexa = function gethexa() { var r = this.r.tostring(16); var g = this.g.tostring(16); var b = this.b.tostring(16); if (this.r < 16) r = '0' + r; if (this.g < 16) ...
Color picker tool - CSS: Cascading Style Sheets
gba(x, c, m); return; } if (h >= 2 && h < 3) { this.setrgba(m, c, x); return; } if (h >= 3 && h < 4) { this.setrgba(m, x, c); return; } if (h >= 4 && h < 5) { this.setrgba(x, m, c); return; } if (h >= 5 && h < 6) { this.setrgba(c, m, x); return; } }; color.prototype.rgbtohsv = function rgbtohsv() { var red = this.r / 255; var green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red, green, blue); var cmin = math.min(red, green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; if (delta) { if (cmax === red ) { hue = ((green - blue) / delta); } if (cmax === green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red - green) / delta; } if (cmax) saturation = delta / cmax; } this.hue = 60 * hue |...
... 0; if (this.hue < 0) this.hue += 360; this.saturation = (saturation * 100) | 0; this.value = (cmax * 100) | 0; }; color.prototype.rgbtohsl = function rgbtohsl() { var red = this.r / 255; var green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red, green, blue); var cmin = math.min(red, green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; var lightness = (cmax + cmin) / 2; var x = (1 - math.abs(2 * lightness - 1)); if (delta) { if (cmax === red ) { hue = ((green - blue) / delta); } if (cmax === green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red - green) / delta; } if (cmax) saturation = delta / x; } this.hue = 60 * hue | 0; if (this.hue < 0) this.hue += 360; this.saturation ...
CSS reference - CSS: Cascading Style Sheets
WebCSSReference
border-start-end-radiusborder-start-start-radiusborder-styleborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-styleborder-top-widthborder-widthbottom@bottom-centerbox-decoration-breakbox-shadowbox-sizingbreak-afterbreak-beforebreak-insidebrightness()ccalc()caption-sidecaret-colorch@character-variantcharacter-variant()@charset:checkedcircle()clamp()clearclipclip-pathcm<color>colorcolor-adjustcolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcolumnsconic-gradient()containcontentcontrast()<counter>counter-incrementcounter-resetcounter-set@counter-stylecounters()cross-fade()cubic-bezier()::cue::cue-regioncursor<custom-ident>d:defaultdeg<dimension>:dirdirection:disableddisplay<display-box><display-...
...inside><display-internal><display-legacy><display-listitem><display-outside>dpcmdpidppxdrop-shadow()eelement()ellipse()em:emptyempty-cells:enabledenv()exffallback (@counter-style)filter<filter-function>:first:first-child::first-letter (:first-letter)::first-line (:first-line):first-of-typefit-content()<flex>flexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloat:focusfont@font-facefont-familyfont-family (@font-face)font-feature-settingsfont-feature-settings (@font-face)@font-feature-valuesfont-kerningfont-language-overridefont-optical-sizingfont-sizefont-size-adjustfont-stretchfont-stretch (@font-face)font-stylefont-style (@font-face)font-synthesisfont-variantfont-variant (@font-face)font-variant-alternatesfont-variant-capsfont-variant-east-asianfont-variant-ligaturesfont-var...
Linear-gradient Generator - CSS: Cascading Style Sheets
gba(x, c, m); return; } if (h >= 2 && h < 3) { this.setrgba(m, c, x); return; } if (h >= 3 && h < 4) { this.setrgba(m, x, c); return; } if (h >= 4 && h < 5) { this.setrgba(x, m, c); return; } if (h >= 5 && h < 6) { this.setrgba(c, m, x); return; } }; color.prototype.rgbtohsv = function rgbtohsv() { var red = this.r / 255; var green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red, green, blue); var cmin = math.min(red, green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; if (delta) { if (cmax === red ) { hue = ((green - blue) / delta); } if (cmax === green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red - green) / delta; } if (cmax) saturation = delta / cmax; } this.hue = 60 * hue |...
... 0; if (this.hue < 0) this.hue += 360; this.saturation = (saturation * 100) | 0; this.value = (cmax * 100) | 0; }; color.prototype.rgbtohsl = function rgbtohsl() { var red = this.r / 255; var green = this.g / 255; var blue = this.b / 255; var cmax = math.max(red, green, blue); var cmin = math.min(red, green, blue); var delta = cmax - cmin; var hue = 0; var saturation = 0; var lightness = (cmax + cmin) / 2; var x = (1 - math.abs(2 * lightness - 1)); if (delta) { if (cmax === red ) { hue = ((green - blue) / delta); } if (cmax === green ) { hue = 2 + (blue - red) / delta; } if (cmax === blue ) { hue = 4 + (red - green) / delta; } if (cmax) saturation = delta / x; } this.hue = 60 * hue | 0; if (this.hue < 0) this.hue += 360; this.saturation ...
Value definition syntax - CSS: Cascading Style Sheets
bold <length> , thin this example matches the following values: bold 1em, thin bold 0, thin bold 2.5cm, thin bold 3vh, thin but not: thin 1em, bold, as the entities must be in the expressed order bold 1em thin, as the entities are mandatory; the comma, a literal, must be present bold 0.5ms, thin, as the ms values are not <length> double ampersand separating two or more components, by a double ampersand, &&, means that all these entities are mandatory but may appear in any order.
... bold && <length> this example matches the following values: bold 1em bold 0 2.5cm bold 3vh bold but not: bold, as both components must appear in the value.
attr() - CSS: Cascading Style Sheets
WebCSSattr
em, ex, px, rem, vw, vh, vmin, vmax, mm, cm, in, pt, or pc <length> the attribute value is parsed as a css <number>, that is without the unit (e.g.
...)where <type-or-unit> = string | color | url | integer | number | length | angle | time | frequency | cap | ch | em | ex | ic | lh | rlh | rem | vb | vi | vw | vh | vmin | vmax | mm | q | cm | in | pt | pc | px | deg | grad | rad | turn | ms | s | hz | khz | % examples content property html <p data-foo="hello">world</p> css [data-foo]::before { content: attr(data-foo) " "; } result <color> value html <div class="background" data-background="lime">background expected to be red if your browser does not support advanced usage of attr()</div> css .background { heig...
background-position - CSS: Cascading Style Sheets
syntax /* keyword values */ background-position: top; background-position: bottom; background-position: left; background-position: right; background-position: center; /* <percentage> values */ background-position: 25% 75%; /* <length> values */ background-position: 0 0; background-position: 1cm 2cm; background-position: 10ch 8em; /* multiple images */ background-position: 0 0, center; /* edge offsets values */ background-position: bottom 10px right 20px; background-position: right 3em bottom 10px; background-position: bottom 10px right; background-position: top right 10px; /* global values */ background-position: inherit; background-position: initial; background-position: unset; th...
...letwo">example two</div> <div class="examplethree">example three</div> css /* shared among all <div>s */ div { background-color: #ffee99; background-repeat: no-repeat; width: 300px; height: 80px; margin-bottom: 12px; } /* these examples use the `background` shorthand property */ .exampleone { background: url("https://mdn.mozillademos.org/files/11987/startransparent.gif") #ffee99 2.5cm bottom no-repeat; } .exampletwo { background: url("https://mdn.mozillademos.org/files/11987/startransparent.gif") #ffee99 left 4em bottom 1em no-repeat; } /* multiple background images: each image is matched with the corresponding position, from first specified to last.
grid-auto-columns - CSS: Cascading Style Sheets
syntax /* keyword values */ grid-auto-columns: min-content; grid-auto-columns: max-content; grid-auto-columns: auto; /* <length> values */ grid-auto-columns: 100px; grid-auto-columns: 20cm; grid-auto-columns: 50vmax; /* <percentage> values */ grid-auto-columns: 10%; grid-auto-columns: 33.3%; /* <flex> values */ grid-auto-columns: 0.5fr; grid-auto-columns: 3fr; /* minmax() values */ grid-auto-columns: minmax(100px, auto); grid-auto-columns: minmax(max-content, 2fr); grid-auto-columns: minmax(20%, 80vmax); /* fit-content() values */ grid-auto-columns: fit-content(400px); grid-aut...
...o-columns: fit-content(5cm); grid-auto-columns: fit-content(20%); /* multiple track-size values */ grid-auto-columns: min-content max-content auto; grid-auto-columns: 100px 150px 390px; grid-auto-columns: 10% 33.3%; grid-auto-columns: 0.5fr 3fr 1fr; grid-auto-columns: minmax(100px, auto) minmax(max-content, 2fr) minmax(20%, 80vmax); grid-auto-columns: 100px minmax(100px, auto) 10% 0.5fr fit-content(400px); /* global values */ grid-auto-columns: inherit; grid-auto-columns: initial; grid-auto-columns: unset; values <length> is a non-negative length.
perspective() - CSS: Cascading Style Sheets
10000100001000−1/d1 examples html <p>without perspective:</p> <div class="no-perspective-box"> <div class="face front">a</div> <div class="face top">b</div> <div class="face left">c</div> </div> <p>with perspective (9cm):</p> <div class="perspective-box-far"> <div class="face front">a</div> <div class="face top">b</div> <div class="face left">c</div> </div> <p>with perspective (4cm):</p> <div class="perspective-box-closer"> <div class="face front">a</div> <div class="face top">b</div> <div class="face left">c</div> </div> css .face { position: absolute; width: 100px; height: 100px; line-h...
...eight: 100px; font-size: 100px; text-align: center; } p + div { width: 100px; height: 100px; transform-style: preserve-3d; margin-left: 100px; } .no-perspective-box { transform: rotatex(-15deg) rotatey(30deg); } .perspective-box-far { transform: perspective(9cm) rotatex(-15deg) rotatey(30deg); } .perspective-box-closer { transform: perspective(4cm) rotatex(-15deg) rotatey(30deg); } .top { background-color: skyblue; transform: rotatex(90deg) translate3d(0, 0, 50px); } .left { background-color: pink; transform: rotatey(-90deg) translate3d(0, 0, 50px); } .front { background-color: limegreen; transform: translate3d(0, 0, 50px); } result specifications specification status comment css transforms level 2the definition of 'perspe...
transform-origin - CSS: Cascading Style Sheets
syntax /* one-value syntax */ transform-origin: 2px; transform-origin: bottom; /* x-offset | y-offset */ transform-origin: 3cm 2px; /* x-offset-keyword | y-offset */ transform-origin: left 2px; /* x-offset-keyword | y-offset-keyword */ transform-origin: right top; /* y-offset-keyword | x-offset-keyword */ transform-origin: top right; /* x-offset | y-offset | z-offset */ transform-origin: 2px 30% 10px; /* x-offset-keyword | y-offset | z-offset */ transform-origin: left 5px -3px; /* x-offset-keyword | y-offset-keywor...
...d | z-offset */ transform-origin: right bottom 2cm; /* y-offset-keyword | x-offset-keyword | z-offset */ transform-origin: bottom right 2cm; /* global values */ transform-origin: inherit; transform-origin: initial; transform-origin: unset; the transform-origin property may be specified using one, two, or three values, where each value represents an offset.
Separate sites for mobile and desktop - Developer guides
conceptually simple, this is the easiest option to add to an existing site, especially if you are using a cms or web application that supports templates.
...if you are using a cms, it is possible to arrange your site templates in a way that minimizes this duplication.
MIME types (IANA media types) - HTTP
for historical reasons, the mime sniffing standard (the definition of how browsers should interpret media types and figure out what to do with content that doesn't have a valid one) allows javascript to be served using any mime type that essentially matches any of the following: application/javascript application/ecmascript application/x-ecmascript application/x-javascript text/javascript text/ecmascript text/javascript1.0 text/javascript1.1 text/javascript1.2 text/javascript1.3 text/javascript1.4 text/javascript1.5 text/jscript text/livescript text/x-ecmascript text/x-javascript note: even though any given user agent may support any or all of these, you should only us...
...the pcm audio codec (wave codec "1") is often supported, but other codecs have limited support (if any).
About JavaScript - JavaScript
the first ever javascript was created by brendan eich at netscape, and has since been updated to conform to ecma-262 edition 5 and later versions.
...like spidermonkey, rhino is ecma-262 edition 5 compliant.
Equality comparisons and sameness - JavaScript
traditionally, and according to ecmascript, all objects are loosely unequal to undefined and null.
...even if your requirements involve having comparisons between two nan values evaluate to true, generally it is easier to special-case the nan checks (using the isnan method available from previous versions of ecmascript) than it is to work out how surrounding computations might affect the sign of any zeros you encounter in your comparison.
Keyed collections - JavaScript
maps map object ecmascript 2015 introduces a new data structure to map values to values.
...the following example is from nick fitzgerald's blog post "hiding implementation details with ecmascript 6 weakmaps".
Meta programming - JavaScript
« previousnext » starting with ecmascript 2015, javascript gains support for the proxy and reflect objects allowing you to intercept and define custom behavior for fundamental language operations (e.g.
... proxies introduced in ecmascript 6, proxy objects allow you to intercept certain operations and to implement custom behaviors.
Character classes - JavaScript
for example, /\cm/ matches "\r" in "\r\n".
... specifications specification ecmascript latest draft (ecma-262)the definition of 'regexp: character classes' in that specification.
Unicode property escapes - JavaScript
racters = "aεЛ"; // using the canonical "long" name of the script mixedcharacters.match(/\p{script=latin}/u); // a // using a short alias for the script mixedcharacters.match(/\p{script=greek}/u); // ε // using the short name sc for the script property mixedcharacters.match(/\p{sc=cyrillic}/u); // Л for more details, please refer to the unicode specification and the scripts table in the ecmascript specification.
...иключения Алисы в Стране чудес"; const regexpbmpword = /([\u0000-\u0019\u0021-\uffff])+/gu; // bmp goes through u+0000 to u+ffff but space is u+0020 console.table(nonenglishtext.match(regexpbmpword)); // using unicode property escapes instead const regexpupe = /\p{l}+/gu; console.table(nonenglishtext.match(regexpupe)); specifications specification ecmascript (ecma-262)the definition of 'regexp: unicode property escapes' in that specification.
Text formatting - JavaScript
'\u00a9' // "©" unicode code point escapes new in ecmascript 2015.
... internationalization the intl object is the namespace for the ecmascript internationalization api, which provides language sensitive string comparison, number formatting, and date and time formatting.
Using Promises - JavaScript
this is very much modeled after how synchronous code works: try { const result = syncdosomething(); const newresult = syncdosomethingelse(result); const finalresult = syncdothirdthing(newresult); console.log(`got the final result: ${finalresult}`); } catch(error) { failurecallback(error); } this symmetry with asynchronous code culminates in the async/await syntactic sugar in ecmascript 2017: async function foo() { try { const result = await dosomething(); const newresult = await dosomethingelse(result); const finalresult = await dothirdthing(newresult); console.log(`got the final result: ${finalresult}`); } catch(error) { failurecallback(error); } } it builds on promises, e.g.
...cc,val) => acc.then(val); const composeasync = (...funcs) => x => funcs.reduce(applyasync, promise.resolve(x)); the composeasync() function will accept any number of functions as arguments, and will return a new function that accepts an initial value to be passed through the composition pipeline: const transformdata = composeasync(func1, func2, func3); const result3 = transformdata(data); in ecmascript 2017, sequential composition can be done more simply with async/await: let result; for (const f of [func1, func2, func3]) { result = await f(result); } /* use last result (i.e.
Working with objects - JavaScript
{ // obj.hasownproperty() is used to filter out properties from the object's prototype chain if (obj.hasownproperty(i)) { result += `${objname}.${i} = ${obj[i]}\n`; } } return result; } so, the function call showprops(mycar, "mycar") would return the following: mycar.make = ford mycar.model = mustang mycar.year = 1969 enumerate the properties of an object starting with ecmascript 5, there are three native ways to list/traverse object properties: for...in loops this method traverses all enumerable properties of an object and its prototype chain.
... before ecmascript 5, there was no native way to list all properties of an object.
About the JavaScript reference - JavaScript
where to find javascript information javascript documentation of core language features (pure ecmascript, for the most part) includes the following: the javascript guide the javascript reference if you are new to javascript, start with the guide.
... classes chapter about javascript classes introduced in ecmascript 2015.
static - JavaScript
class staticmethodcall { static staticmethod() { return 'static method has been called'; } static anotherstaticmethod() { return this.staticmethod() + ' from another static method'; } } staticmethodcall.staticmethod(); // 'static method has been called' staticmethodcall.anotherstaticmethod(); // 'static method has been called from another static method' calling static methods from a class con...
... class staticmethodcall { constructor() { console.log(staticmethodcall.staticmethod()); // 'static method has been called.' console.log(this.constructor.staticmethod()); // 'static method has been called.' } static staticmethod() { return 'static method has been called.'; } } specifications specification ecmascript (ecma-262)the definition of 'class definitions' in that specification.
SyntaxError: invalid regular expression flag "x" - JavaScript
regular expression flags can be used separately or together in any order, but there are only six of them in ecmascript.
...to match newlines (added in ecmascript 2018) u unicode; treat pattern as a sequence of unicode code points y perform a "sticky" search that matches starting at the current position in the target string.
arguments[@@iterator]() - JavaScript
syntax arguments[symbol.iterator]() examples iteration using for...of loop function f() { // your browser must support for..of loop // and let-scoped variables in for loops for (let letter of arguments) { console.log(letter); } } f('w', 'y', 'k', 'o', 'p'); specifications specification ecmascript (ecma-262)the definition of 'createunmappedargumentsobject' in that specification.
... ecmascript (ecma-262)the definition of 'createmappedargumentsobject' in that specification.
getter - JavaScript
expression starting with ecmascript 2015, you can also use expressions for a computed property name to bind to the given function.
... } } const obj = new example(); console.log(obj.hello); // "world" console.log(object.getownpropertydescriptor(obj, 'hello')); // undefined console.log( object.getownpropertydescriptor( object.getprototypeof(obj), 'hello' ) ); // { configurable: true, enumerable: false, get: function get hello() { return 'world'; }, set: undefined } specifications specification ecmascript (ecma-262)the definition of 'method definitions' in that specification.
setter - JavaScript
expression starting with ecmascript 2015, you can also use expressions for a computed property name to bind to the given function.
...this.a = x / 2; } }); o.b = 10; // runs the setter, which assigns 10 / 2 (5) to the 'a' property console.log(o.a) // 5 using a computed property name const expr = 'foo'; const obj = { baz: 'bar', set [expr](v) { this.baz = v; } }; console.log(obj.baz); // "bar" obj.foo = 'baz'; // run the setter console.log(obj.baz); // "baz" specifications specification ecmascript (ecma-262)the definition of 'method definitions' in that specification.
Functions - JavaScript
method definition syntax starting with ecmascript 2015, you are able to define own methods in a shorter syntax, similar to the getters and setters.
... specifications specification ecmascript (ecma-262)the definition of 'function definitions' in that specification.
Array.prototype.reduce() - JavaScript
polyfill // production steps of ecma-262, edition 5, 15.4.4.21 // reference: http://es5.github.io/#x15.4.4.21 // https://tc39.github.io/ecma262/#sec-array.prototype.reduce if (!array.prototype.reduce) { object.defineproperty(array.prototype, 'reduce', { value: function(callback /*, initialvalue*/) { if (this === null) { throw new typeerror( 'array.prototype.reduce ' + 'called on null or undefined' ); ...
...= function(callback, thisarg) { return this.reduce(function(mappedarray, currentvalue, index, array) { mappedarray[index] = callback.call(thisarg, currentvalue, index, array) return mappedarray }, []) } } [1, 2, , 3].mapusingreduce( (currentvalue, index, array) => currentvalue + index + array.length ) // [5, 7, , 10] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.reduce()' in that specification.
Array.prototype.findIndex() - JavaScript
polyfill // https://tc39.github.io/ecma262/#sec-array.prototype.findindex if (!array.prototype.findindex) { object.defineproperty(array.prototype, 'findindex', { value: function(predicate) { // 1.
.../ 2 (array[2] is 7) find index using arrow function the following example finds the index of a fruit using an arrow function: const fruits = ["apple", "banana", "cantaloupe", "blueberries", "grapefruit"]; const index = fruits.findindex(fruit => fruit === "blueberries"); console.log(index); // 3 console.log(fruits[index]); // blueberries specifications specification ecmascript (ecma-262)the definition of 'array.prototype.findindex' in that specification.
Array.prototype.forEach() - JavaScript
the following is just one way and is presented to explain how array.prototype.foreach() works by using ecmascript 5 object.* meta property functions.
... function flatten(arr) { const result = [] arr.foreach((i) => { if (array.isarray(i)) { result.push(...flatten(i)) } else { result.push(i) } }) return result } // usage const nested = [1, 2, 3, [4, 5, [6, 7], 8, 9]] flatten(nested) // [1, 2, 3, 4, 5, 6, 7, 8, 9] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.foreach' in that specification.
Array.of() - JavaScript
description this function is part of the ecmascript 2015 standard.
... (!array.of) { array.of = function() { return array.prototype.slice.call(arguments); // or let vals = []; for(let prop in arguments){ vals.push(arguments[prop]); } return vals; } } examples using array.of array.of(1); // [1] array.of(1, 2, 3); // [1, 2, 3] array.of(undefined); // [undefined] specifications specification ecmascript (ecma-262)the definition of 'array.of' in that specification.
Array.prototype.sort() - JavaScript
note: the ecmascript standard does not guarantee this behavior, thus, not all browsers (e.g.
... specifications specification ecmascript (ecma-262)the definition of 'array.prototype.sort' in that specification.
Array.prototype.toString() - JavaScript
ecmascript 5 semantics starting in javascript 1.8.5 (firefox 4), and consistent with ecmascript 5th edition semantics, the tostring() method is generic and can be used with any object.
... examples using tostring const array1 = [1, 2, 'a', '1a']; console.log(array1.tostring()); // expected output: "1,2,a,1a" specifications specification ecmascript (ecma-262)the definition of 'array.prototype.tostring' in that specification.
Array - JavaScript
, , , , , , p,p,p,p, ,p,p,p r,n,b,q,k,b,n,r using an array to tabulate a set of values values = [] for (let x = 0; x < 10; x++){ values.push([ 2 ** x, 2 * x ** 2 ]) } console.table(values) results in // the first column is the index 0 1 0 1 2 2 2 4 8 3 8 18 4 16 32 5 32 50 6 64 72 7 128 98 8 256 128 9 512 162 specifications specification initial publication ecmascript (ecma-262)the definition of 'array' in that specification.
... ecmascript 1 ...
ArrayBuffer() constructor - JavaScript
compatibility notes starting with ecmascript 2015, arraybuffer constructors require to be constructed with a new operator.
... var dv = arraybuffer(10); // typeerror: calling a builtin arraybuffer constructor // without new is forbidden var dv = new arraybuffer(10); examples creating an arraybuffer in this example, we create a 8-byte buffer with a int32array view referring to the buffer: var buffer = new arraybuffer(8); var view = new int32array(buffer); specifications specification ecmascript (ecma-262)the definition of 'arraybuffer' in that specification.
BigInt.prototype.toLocaleString() - JavaScript
�� 123.456.789.123.456.789,00 € // the japanese yen doesn't use a minor unit console.log(bigint.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' })) // → ¥123,456,789,123,456,789 // limit to three significant digits console.log(bigint.tolocalestring('en-in', { maximumsignificantdigits: 3 })); // → 1,23,00,00,00,00,00,00,000 specifications specification ecmascript (ecma-262)the definition of 'bigint.prototype.tolocalestring()' in that specification.
... ecmascript internationalization api (ecma-402)the definition of 'bigint.prototype.tolocalestring()' in that specification.
Date() constructor - JavaScript
time value or timestamp number value an integer value representing the number of milliseconds since january 1, 1970, 00:00:00 utc (the ecmascript epoch, equivalent to the unix epoch), with leap seconds ignored.
... let today = new date() let birthday = new date('december 17, 1995 03:24:00') let birthday = new date('1995-12-17t03:24:00') let birthday = new date(1995, 11, 17) // the month is 0-indexed let birthday = new date(1995, 11, 17, 3, 24, 0) specifications specification ecmascript (ecma-262)the definition of 'date' in that specification.
Date.now() - JavaScript
polyfill this method was standardized in ecma-262 5th edition.
... specifications specification ecmascript (ecma-262)the definition of 'date.now' in that specification.
Date.prototype.setUTCFullYear() - JavaScript
description if you do not specify the monthvalue and dayvalue parameters, the values returned from the getutcmonth() and getutcdate() methods are used.
... examples using setutcfullyear() var thebigday = new date(); thebigday.setutcfullyear(1997); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutcfullyear' in that specification.
Date.prototype.setUTCHours() - JavaScript
description if you do not specify the minutesvalue, secondsvalue, and msvalue parameters, the values returned from the getutcminutes(), getutcseconds(), and getutcmilliseconds() methods are used.
... examples using setutchours() var thebigday = new date(); thebigday.setutchours(8); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutchours' in that specification.
Date.prototype.setUTCSeconds() - JavaScript
description if you do not specify the msvalue parameter, the value returned from the getutcmilliseconds() method is used.
... examples using setutcseconds() var thebigday = new date(); thebigday.setutcseconds(20); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutcseconds' in that specification.
Date.prototype.toDateString() - JavaScript
the todatestring() method is especially useful because compliant engines implementing ecma-262 may differ in the string obtained from tostring() for date objects, as the format is implementation-dependent and simple string slicing approaches may not produce consistent results across multiple engines.
... specifications specification ecmascript (ecma-262)the definition of 'date.prototype.todatestring' in that specification.
Date.prototype.toLocaleDateString() - JavaScript
dezember 2012" // an application may want to use utc and make that visible options.timezone = 'utc'; options.timezonename = 'short'; console.log(date.tolocaledatestring('en-us', options)); // → "thursday, december 20, 2012, gmt" specifications specification ecmascript (ecma-262)the definition of 'date.prototype.tolocaledatestring' in that specification.
... ecmascript internationalization api (ecma-402)the definition of 'date.prototype.tolocaledatestring' in that specification.
Date.prototype.toLocaleString() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'date.prototype.tolocalestring' in that specification.
... ecmascript internationalization api (ecma-402)the definition of 'date.prototype.tolocalestring' in that specification.
Date.prototype.toLocaleTimeString() - JavaScript
)); // → "3:00:00 am gmt" // sometimes even the us needs 24-hour time console.log(date.tolocaletimestring('en-us', { hour12: false })); // → "19:00:00" // show only hours and minutes, use options with the default locale - use an empty array console.log(date.tolocaletimestring([], { hour: '2-digit', minute: '2-digit' })); // → "20:01" specifications specification ecmascript (ecma-262)the definition of 'date.prototype.tolocaletimestring' in that specification.
... ecmascript internationalization api (ecma-402)the definition of 'date.prototype.tolocaletimestring' in that specification.
Date.prototype.toTimeString() - JavaScript
the totimestring() method is especially useful because compliant engines implementing ecma-262 may differ in the string obtained from tostring() for date objects, as the format is implementation-dependent; simple string slicing approaches may not produce consistent results across multiple engines.
... examples a basic usage of totimestring() var d = new date(1993, 6, 28, 14, 39, 7); console.log(d.tostring()); // wed jul 28 1993 14:39:07 gmt-0600 (pdt) console.log(d.totimestring()); // 14:39:07 gmt-0600 (pdt) specifications specification ecmascript (ecma-262)the definition of 'date.prototype.totimestring' in that specification.
EvalError() constructor - JavaScript
the line number of the code that caused the exception examples evalerror is not used in the current ecmascript specification and will thus not be thrown by the runtime.
...(e instanceof evalerror); // true console.log(e.message); // "hello" console.log(e.name); // "evalerror" console.log(e.filename); // "somefile.js" console.log(e.linenumber); // 10 console.log(e.columnnumber); // 0 console.log(e.stack); // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification.
Infinity - JavaScript
as defined by the ecmascript 5 specification, infinity is read-only (implemented in javascript 1.8.5 / firefox 4).
... examples using infinity console.log(infinity ); /* infinity */ console.log(infinity + 1 ); /* infinity */ console.log(math.pow(10, 1000)); /* infinity */ console.log(math.log(0) ); /* -infinity */ console.log(1 / infinity ); /* 0 */ console.log(1 / 0 ); /* infinity */ specifications specification ecmascript (ecma-262)the definition of 'infinity' in that specification.
Intl.NumberFormat() constructor - JavaScript
a subset of units from the full list was selected for use in ecmascript.
...style: "percent", signdisplay: "exceptzero" }).format(0.55); // → '+55%' note that when the currency sign is "accounting", parentheses might be used instead of a minus sign: new intl.numberformat('bn', { style: 'currency', currency: 'usd', currencysign: 'accounting', signdisplay: 'always' }).format(-3500); // → '($3,500.00)' specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.numberformat constructor' in that specification.
Intl - JavaScript
the intl object is the namespace for the ecmascript internationalization api, which provides language sensitive string comparison, number formatting, and date and time formatting.
...ific language and region: const count = 26254.39; const date = new date("2012-05-24"); function log(locale) { console.log( `${new intl.datetimeformat(locale).format(date)} ${new intl.numberformat(locale).format(count)}` ); } log("en-us"); // expected output: 5/24/2012 26,254.39 log("de-de"); // expected output: 24.5.2012 26.254,39 specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl' in that specification.
JSON - JavaScript
...but only in javascript engines that have implemented the proposal to make all json text valid ecma-262.
... examples example json { "browsers": { "firefox": { "name": "firefox", "pref_url": "about:config", "releases": { "1": { "release_date": "2004-11-09", "status": "retired", "engine": "gecko", "engine_version": "1.7" } } } } } specifications specification ecmascript (ecma-262)the definition of 'json' in that specification.
Map.prototype.delete() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'map.prototype.delete' in that specification.
... ecmascript 2015 (6th edition, ecma-262)the definition of 'map.prototype.delete' in that specification.
Number.parseFloat() - JavaScript
polyfill if (number.parsefloat === undefined) { number.parsefloat = parsefloat; } examples number.parsefloat vs parsefloat this method has the same functionality as the global parsefloat() function: number.parsefloat === parsefloat; // true this method is also part of ecmascript 2015.
... specifications specification ecmascript (ecma-262)the definition of 'number.parsefloat' in that specification.
Number.parseInt() - JavaScript
polyfill if (number.parseint === undefined) { number.parseint = window.parseint } examples number.parseint vs parseint this method has the same functionality as the global parseint() function: number.parseint === parseint // true and is part of ecmascript 2015 (its purpose is modularization of globals).
... specifications specification ecmascript (ecma-262)the definition of 'number.parseint' in that specification.
Number.prototype.toPrecision() - JavaScript
ecma-262 only requires a precision of up to 21 significant digits.
...sole.log(numobj.toprecision()) // logs '0.000123' console.log(numobj.toprecision(5)) // logs '0.00012300' console.log(numobj.toprecision(2)) // logs '0.00012' console.log(numobj.toprecision(1)) // logs '0.0001' // note that exponential notation might be returned in some circumstances console.log((1234.5).toprecision(2)) // logs '1.2e+3' specifications specification ecmascript (ecma-262)the definition of 'number.prototype.toprecision' in that specification.
Number - JavaScript
(more details on this are described in the ecmascript standard, chapter 6.1.6 the number type.) const biggestint = number.max_safe_integer // (253 - 1) => 9007199254740991 const smallestint = number.min_safe_integer // -(253 - 1) => -9007199254740991 when parsing data that has been serialized to json, integer values falling outside of this range can be expected to become corrupted when json parser coerces them to number type.
...ull to numbers number('123') // 123 number('123') === 123 /// true number('12.3') // 12.3 number('12.00') // 12 number('123e-1') // 12.3 number('') // 0 number(null) // 0 number('0x11') // 17 number('0b11') // 3 number('0o11') // 9 number('foo') // nan number('100a') // nan number('-infinity') //-infinity specifications specification ecmascript (ecma-262)the definition of 'number' in that specification.
Object.prototype.__defineGetter__() - JavaScript
while this feature is widely implemented, it is only described in the ecmascript specification because of legacy usage.
...five', function() { return 5; }); console.log(o.gimmefive); // 5 standard-compliant ways // using the get operator var o = { get gimmefive() { return 5; } }; console.log(o.gimmefive); // 5 // using object.defineproperty var o = {}; object.defineproperty(o, 'gimmefive', { get: function() { return 5; } }); console.log(o.gimmefive); // 5 specifications specification ecmascript (ecma-262)the definition of 'object.prototype.__definegetter__()' in that specification.
Object.create() - JavaScript
note that while the setting of null as [[prototype]] is supported in the real es5 object.create, this polyfill cannot support it due to a limitation inherent in versions of ecmascript lower than 5.
... o.q = 12; for (var prop in o) { console.log(prop); } // 'q' delete o.p; // false // to specify an es3 property o2 = object.create({}, { p: { value: 42, writable: true, enumerable: true, configurable: true } }); /* is not equivalent to: this will create an object with prototype : {p: 42 } o2 = object.create({p: 42}) */ specifications specification ecmascript (ecma-262)the definition of 'object.create' in that specification.
Object.setPrototypeOf() - JavaScript
object.setprototypeof() is in the ecmascript 2015 specification.
...r key in obj) { object.defineproperty(this, key, { value: obj[key], }); } }; fn.prototype = proto; return new fn(); } } } examples using object.setprototypeof var dict = object.setprototypeof({}, null); specifications specification ecmascript (ecma-262)the definition of 'object.setprototypeof' in that specification.
Object.prototype.toString() - JavaScript
the following code illustrates this: const o = new object(); o.tostring(); // returns [object object] note: starting in javascript 1.8.5, tostring() called on null returns [object null], and undefined returns [object undefined], as defined in the 5th edition of ecmascript and subsequent errata.
...for example: const mydate = new date(); object.prototype.tostring.call(mydate); // [object date] mydate[symbol.tostringtag] = 'mydate'; object.prototype.tostring.call(mydate); // [object mydate] date.prototype[symbol.tostringtag] = 'prototype polluted'; object.prototype.tostring.call(new date()); // [object prototype polluted] specifications specification ecmascript (ecma-262)the definition of 'object.prototype.tostring' in that specification.
Object - JavaScript
object.prototype.propertyisenumerable() returns a boolean indicating if the internal ecmascript [[enumerable]] attribute is set.
...b = new employee('bob', 'builder'); var joe = new customer('joe'); var rg = new employee('red green', 'handyman'); var mike = new customer('mike'); var mime = new mime('mime'); bob.greet(); // hi, i am bob, the builder joe.greet(); // hi, i am joe rg.greet(); // hi, i am red green, the handyman mike.greet(); // hi, i am mike mime.greet(); specifications specification ecmascript (ecma-262)the definition of 'object' in that specification.
RangeError - JavaScript
although ecma-262 specifies that rangeerror should provide its own message property, in spidermonkey, it inherits error.prototype.message.
...error (for non-numeric values) function check(value) { if(["apple", "banana", "carrot"].includes(value) === false) { throw new rangeerror('the argument must be an "apple", "banana", or "carrot".') } } try { check("cabbage") } catch(error) { if(error instanceof rangeerror) { // handle the error } } specifications specification ecmascript (ecma-262)the definition of 'rangeerror' in that specification.
ReferenceError - JavaScript
although ecma-262 specifies that referenceerror should provide its own message property, in spidermonkey, it inherits error.prototype.message.
... console.log(e.message) // "hello" console.log(e.name) // "referenceerror" console.log(e.filename) // "somefile.js" console.log(e.linenumber) // 10 console.log(e.columnnumber) // 0 console.log(e.stack) // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'referenceerror' in that specification.
RegExp.prototype.source - JavaScript
empty regular expressions and escaping starting with ecmascript 5, the source property no longer returns an empty string for empty regular expressions.
... new regexp().source; // "(?:)" new regexp('\n').source === '\n'; // true, prior to es5 new regexp('\n').source === '\\n'; // true, starting with es5 specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.source' in that specification.
RegExp - JavaScript
flags in constructor starting with ecmascript 6, new regexp(/ab+c/, 'i') no longer throws a typeerror ("can't supply flags when constructing one regexp from another") when the first argument is a regexp and the second flags argument is present.
... specifications specification ecmascript (ecma-262)the definition of 'regexp' in that specification.
String.prototype.charAt() - JavaScript
high surrogate'; } var prev = str.charcodeat(i - 1); // (could change last hex to 0xdb7f to treat high private // surrogates as single characters) if (0xd800 > prev || prev > 0xdbff) { throw 'low surrogate without preceding high surrogate'; } // we can pass over low surrogates now as the second component // in a pair which we have already processed return false; } in an ecmascript 2016 environment which allows destructured assignment, the following is a more succinct and somewhat more flexible alternative in that it does increment for an incrementing variable automatically (if the character warrants it in being a surrogate pair).
...dx) { idx++ } else { break } } if (idx >= end || idx < 0) { return '' } ret += str.charat(idx) if (/[\ud800-\udbff]/.test(ret) && /[\udc00-\udfff]/.test(str.charat(idx + 1))) { // go one further, since one of the "characters" is part of a surrogate pair ret += str.charat(idx + 1) } return ret } specifications specification ecmascript (ecma-262)the definition of 'string.prototype.charat' in that specification.
String.prototype.codePointAt() - JavaScript
polyfill the following extends strings to include the codepointat() function as specified in ecmascript 2015 for browsers without native support.
...at; } }()); } examples using codepointat() 'abc'.codepointat(1) // 66 '\ud800\udc00'.codepointat(0) // 65536 'xyz'.codepointat(42) // undefined looping with codepointat() for (let codepoint of '\ud83d\udc0e\ud83d\udc71\u2764') { console.log(codepoint.codepointat(0).tostring(16)) } // '1f40e', '1f471', '2764' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.codepointat' in that specification.
String.prototype.endsWith() - JavaScript
polyfill this method has been added to the ecmascript 6 specification and may not be available in all javascript implementations yet.
...ngth) { this_len = this.length; } return this.substring(this_len - search.length, this_len) === search; }; } examples using endswith() let str = 'to be, or not to be, that is the question.' console.log(str.endswith('question.')) // true console.log(str.endswith('to be')) // false console.log(str.endswith('to be', 19)) // true specifications specification ecmascript (ecma-262)the definition of 'string.prototype.endswith' in that specification.
String.fromCodePoint() - JavaScript
polyfill the string.fromcodepoint() method has been added to ecmascript 2015 and may not be supported in all web browsers or environments yet.
... with string.fromcharcode(55356, 57091); // stars" == "\ud83c\udf03" string.fromcodepoint(), on the other hand, can return 4-byte supplementary characters, as well as the more common 2-byte bmp characters, by specifying their code point (which is equivalent to the utf-32 code unit): string.fromcodepoint(0x1f303); // or 127747 in decimal specifications specification ecmascript (ecma-262)the definition of 'string.fromcodepoint' in that specification.
String.prototype.includes() - JavaScript
for example, the following expression returns false: 'blue whale'.includes('blue') // returns false polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet.
...be, or not to be, that is the question.' console.log(str.includes('to be')) // true console.log(str.includes('question')) // true console.log(str.includes('nonexistent')) // false console.log(str.includes('to be', 1)) // false console.log(str.includes('to be')) // false console.log(str.includes('')) // true specifications specification ecmascript (ecma-262)the definition of 'string.prototype.includes' in that specification.
String length - JavaScript
ecmascript 2016 (ed.
...mystring.length = 4; console.log(mystring); // expected output: "bluebells" console.log(mystring.length); // expected output: 9 specifications specification ecmascript (ecma-262) ...
String.prototype.localeCompare() - JavaScript
ecompare('a', 'sv', { sensitivity: 'base' })); // a positive value numeric sorting // by default, "2" > "10" console.log("2".localecompare("10")); // 1 // numeric using options: console.log("2".localecompare("10", undefined, {numeric: true})); // -1 // numeric using locales tag: console.log("2".localecompare("10", "en-u-kn-true")); // -1 specifications specification ecmascript (ecma-262)the definition of 'string.prototype.localecompare' in that specification.
... ecmascript internationalization api (ecma-402)the definition of 'string.prototype.localecompare' in that specification.
String.prototype.repeat() - JavaScript
polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet.
...t 'abc'.repeat(-1) // rangeerror 'abc'.repeat(0) // '' 'abc'.repeat(1) // 'abc' 'abc'.repeat(2) // 'abcabc' 'abc'.repeat(3.5) // 'abcabcabc' (count will be converted to integer) 'abc'.repeat(1/0) // rangeerror ({ tostring: () => 'abc', repeat: string.prototype.repeat }).repeat(2) // 'abcabc' (repeat() is a generic method) specifications specification ecmascript (ecma-262)the definition of 'string.prototype.repeat' in that specification.
String.prototype.startsWith() - JavaScript
polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet.
... examples using startswith() //startswith let str = 'to be, or not to be, that is the question.' console.log(str.startswith('to be')) // true console.log(str.startswith('not to be')) // false console.log(str.startswith('not to be', 10)) // true specifications specification ecmascript (ecma-262)the definition of 'string.prototype.startswith' in that specification.
String.prototype.substring() - JavaScript
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.
... specifications specification ecmascript (ecma-262)the definition of 'string.prototype.substring' in that specification.
String.prototype.toLocaleLowerCase() - JavaScript
examples using tolocalelowercase() 'alphabet'.tolocalelowercase(); // 'alphabet' '\u0130'.tolocalelowercase('tr') === 'i'; // true '\u0130'.tolocalelowercase('en-us') === 'i'; // false let locales = ['tr', 'tr', 'tr-tr', 'tr-u-co-search', 'tr-x-turkish']; '\u0130'.tolocalelowercase(locales) === 'i'; // true specifications specification ecmascript (ecma-262)the definition of 'string.prototype.tolocalelowercase' in that specification.
... ecmascript internationalization api (ecma-402)the definition of 'string.prototype.tolocalelowercase' in that specification.
String.prototype.toLocaleUpperCase() - JavaScript
owercase() === x.tolocaleuppercase().tolocalelowercase() examples using tolocaleuppercase() 'alphabet'.tolocaleuppercase(); // 'alphabet' 'gesäß'.tolocaleuppercase(); // 'gesÄss' 'i\u0307'.tolocaleuppercase('lt-lt'); // 'i' let locales = ['lt', 'lt', 'lt-lt', 'lt-u-co-phonebk', 'lt-x-lietuva']; 'i\u0307'.tolocaleuppercase(locales); // 'i' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.tolocaleuppercase' in that specification.
... ecmascript internationalization api (ecma-402)the definition of 'string.prototype.tolocaleuppercase' in that specification.
Symbol.unscopables - JavaScript
however, in ecmascript 2015 and later, the array.prototype.keys() method was introduced.
... var obj = { foo: 1, bar: 2 }; obj[symbol.unscopables] = { foo: false, bar: true }; with (obj) { console.log(foo); // 1 console.log(bar); // referenceerror: bar is not defined } specifications specification ecmascript (ecma-262)the definition of 'symbol.unscopables' in that specification.
SyntaxError - JavaScript
although ecma-262 specifies that syntaxerror should provide its own message property, in spidermonkey, it inherits error.prototype.message.
...// true console.error(e.message); // hello console.error(e.name); // syntaxerror console.error(e.filename); // somefile.js console.error(e.linenumber); // 10 console.error(e.columnnumber); // 0 console.error(e.stack); // @debugger eval code:3:9 } specifications specification ecmascript (ecma-262)the definition of 'syntaxerror' in that specification.
TypeError - JavaScript
although ecma-262 specifies that typeerror should provide its own message property, in spidermonkey, it inherits error.prototype.message.
...(e instanceof typeerror) // true console.log(e.message) // "hello" console.log(e.name) // "typeerror" console.log(e.filename) // "somefile.js" console.log(e.linenumber) // 10 console.log(e.columnnumber) // 0 console.log(e.stack) // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'typeerror' in that specification.
TypedArray.prototype.fill() - JavaScript
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.fill if (!uint8array.prototype.fill) { uint8array.prototype.fill = array.prototype.fill; } examples using fill new uint8array([1, 2, 3]).fill(4); // uint8array [4, 4, 4] new uint8array([1, 2, 3]).fill(4, 1); // uint8array [1, 4, 4] new uint8array([1, 2, 3]).fill(4, 1, 2); // uint8array [1, 4, 3] new uint8array([1, 2, 3]).fill(4, 1, 1); // uin...
...t8array [1, 2, 3] new uint8array([1, 2, 3]).fill(4, -3, -2); // uint8array [4, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.fill' in that specification.
TypedArray.prototype.join() - JavaScript
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join if (!uint8array.prototype.join) { object.defineproperty(uint8array.prototype, 'join', { value: array.prototype.join }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable.
... examples using join var uint8 = new uint8array([1,2,3]); uint8.join(); // '1,2,3' uint8.join(' / '); // '1 / 2 / 3' uint8.join(''); // '123' specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.join' in that specification.
TypedArray.prototype.some() - JavaScript
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.some if (!uint8array.prototype.some) { object.defineproperty(uint8array.prototype, 'some', { value: array.prototype.some }); } if you need to support truly obsolete javascript engines that don't support object.defineproperty, it's best not to polyfill array.prototype methods at all, as you can't make them non-enumerable.
... new uint8array([2, 5, 8, 1, 4]).some(elem => elem > 10); // false new uint8array([12, 5, 8, 1, 4]).some(elem => elem > 10); // true specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.some' in that specification.
URIError - JavaScript
although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message.
...sole.log(e instanceof urierror) // true console.log(e.message) // "hello" console.log(e.name) // "urierror" console.log(e.filename) // "somefile.js" console.log(e.linenumber) // 10 console.log(e.columnnumber) // 0 console.log(e.stack) // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'urierror' in that specification.
Uint16Array() constructor - JavaScript
starting with ecmascript 2015, uint16array constructors require to be constructed with a new operator.
...31 // from another typedarray var x = new uint16array([21, 31]); var y = new uint16array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint16array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint16 = new uint16array(iterable); // uint16array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
WebAssembly.CompileError - JavaScript
although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message.
... ecmascript (ecma-262)the definition of 'nativeerror' in that specification.
WebAssembly.LinkError - JavaScript
although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message.
... ecmascript (ecma-262)the definition of 'nativeerror' in that specification.
WebAssembly.RuntimeError - JavaScript
although ecma-262 specifies that urierror should provide its own message property, in spidermonkey, it inherits error.prototype.message.
... ecmascript (ecma-262)the definition of 'nativeerror' in that specification.
eval() - JavaScript
var expression = new string('2 + 2'); eval(expression.tostring()); // returns 4 if you use the eval function indirectly, by invoking it via a reference other than eval, as of ecmascript 5 it works in the global scope rather than the local scope.
...turns 2 console.log('b is : ' + b); a = false; b = eval(str); // returns 3 console.log('b is : ' + b); eval as a string defining function requires "(" and ")" as prefix and suffix var fctstr1 = 'function a() {}' var fctstr2 = '(function a() {})' var fct1 = eval(fctstr1) // return undefined var fct2 = eval(fctstr2) // return a function specifications specification ecmascript (ecma-262)the definition of 'eval' in that specification.
undefined - JavaScript
in modern browsers (javascript 1.8.5 / firefox 4+), undefined is a non-configurable, non-writable property, per the ecmascript 5 specification.
... var x; if (x === void 0) { // these statements execute } // y has not been declared before if (y === void 0) { // throws uncaught referenceerror: y is not defined } specifications specification ecmascript (ecma-262)the definition of 'undefined' in that specification.
Iteration protocols - JavaScript
as a couple of additions to ecmascript 2015, iteration protocols aren't new built-ins or syntax, but protocols.
...onsole.log(ageneratorobject[symbol.iterator]() === ageneratorobject); // true, because its @@iterator method returns itself (an iterator), so it's an well-formed iterable console.log([...ageneratorobject]); // [1, 2, 3] console.log(symbol.iterator in ageneratorobject) // true, because @@iterator method is a property of ageneratorobject specifications specification ecmascript (ecma-262)the definition of 'iteration' in that specification.
Destructuring assignment - JavaScript
let key = 'z'; let {[key]: foo} = {z: 'bar'}; console.log(foo); // "bar" rest in object destructuring the rest/spread properties for ecmascript proposal (stage 4) adds the rest syntax to destructuring.
... let obj = {self: '123'}; obj.__proto__.prot = '456'; const {self, prot} = obj; // self "123" // prot "456"(access to the prototype chain) specifications specification ecmascript (ecma-262)the definition of 'destructuring assignment' in that specification.
Property accessors - JavaScript
(in the ecmascript standard, the names of properties are technically "identifiernames", not "identifiers", so reserved words can be used but are not recommended).
...it is better to use bracket notation instead: x = document.forms['form_name'].elements[strformcontrol].value specifications specification ecmascript (ecma-262)the definition of 'property accessors' in that specification.
class expression - JavaScript
the class expression is one way to define a class in ecmascript 2015.
... const foo = class namedfoo { constructor() {} whoisthere() { return namedfoo.name; } } const bar = new foo(); bar.whoisthere(); // "namedfoo" namedfoo.name; // referenceerror: namedfoo is not defined foo.name; // "namedfoo" specifications specification ecmascript (ecma-262)the definition of 'class definitions' in that specification.
delete operator - JavaScript
console.log(delete func); // false cross-browser notes although ecmascript makes iteration order of objects implementation-dependent, it may appear that all major browsers support an iteration order based on the earliest added property coming first (at least for properties not on the prototype).
...in the following example, trees[3] is removed from the array completely using splice(): var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; trees.splice(3,1); console.log(trees); // ["redwood", "bay", "cedar", "maple"] specifications specification ecmascript (ecma-262)the definition of 'the delete operator' in that specification.
this - JavaScript
function bar() { console.log(object.prototype.tostring.call(this)); } bar.call(7); // [object number] bar.call('foo'); // [object string] bar.call(undefined); // [object global] the bind method ecmascript 5 introduced function.prototype.bind().
... specifications specification ecmascript (ecma-262)the definition of 'the this keyword' in that specification.
export - JavaScript
tured assignments with renaming export const { name1, name2: bar } = o; // default exports export default expression; export default function (…) { … } // also class, function* export default function name1(…) { … } // also class, function* export { name1 as default, … }; // aggregating modules export * from …; // does not set the default export export * as name1 from …; // draft ecmascript® 2o21 export { name1, name2, …, namen } from …; export { import1 as name1, import2 as name2, …, namen } from …; export { default } from …; namen identifier to be exported (so that it can be imported via import in another script).
... childmodule2 // to re-export them export { myfunction, myvariable } from 'childmodule1.js'; export { myclass } from 'childmodule2.js'; // in top-level module // we can consume the exports from a single module since parentmodule // "collected"/"bundled" them in a single source import { myfunction, myvariable, myclass } from 'parentmodule.js' specifications specification ecmascript (ecma-262)the definition of 'exports' in that specification.
import - JavaScript
ain = document.queryselector("main"); for (const link of document.queryselectorall("nav > a")) { link.addeventlistener("click", e => { e.preventdefault(); import('/modules/my-module.js') .then(module => { module.loadpageinto(main); }) .catch(err => { main.textcontent = err.message; }); }); } specifications specification ecmascript (ecma-262)the definition of 'imports' in that specification.
... ecmascript (ecma-262)the definition of 'import calls' in that specification.
label - JavaScript
foo: { console.log('face'); break foo; console.log('this will not be executed'); } console.log('swap'); // this will log: // "face" // "swap" labeled function declarations starting with ecmascript 2015, labeled function declarations are now standardized for non-strict code in the web compatibility annex of the specification.
... l: function f() {} in strict mode code, however, this will throw a syntaxerror: 'use strict'; l: function f() {} // syntaxerror: functions cannot be labelled generator functions can neither be labeled in strict code, nor in non-strict code: l: function* f() {} // syntaxerror: generator functions cannot be labelled specifications specification ecmascript (ecma-262)the definition of 'labelled statement' in that specification.
switch - JavaScript
block-scope variables within switch statements with ecmascript 2015 (es6) support made available in most modern browsers, there will be cases where you would want to use let and const statements to declare block-scoped variables.
... specifications specification ecmascript (ecma-262)the definition of 'switch statement' in that specification.
Transitioning to strict mode - JavaScript
ecmascript 5 introduced strict mode which is now implemented in all major browsers (including ie10).
... differences from non-strict to strict syntax errors when adding 'use strict';, the following cases will throw a syntaxerror before the script is executing: octal syntax var n = 023; with statement using delete on a variable name delete myvariable; using eval or arguments as variable or function argument name using one of the newly reserved keywords (in prevision for ecmascript 2015): implements, interface, let, package, private, protected, public, static, and yield declaring function in blocks if (a < b) { function f() {} } obvious errors declaring twice the same name for a property name in an object literal {a: 1, b: 3, a: 7} this is no longer the case in ecmascript 2015 (bug 1041128).
keySplines - SVG: Scalable Vector Graphics
this attribute is ignored unless the calcmode attribute is set to spline.
... four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> html, body, svg { height: 100%; } <svg viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <circle cx="60" cy="10" r="10"> <animate attributename="cx" dur="4s" calcmode="spline" repeatcount="indefinite" values="60 ; 110 ; 60 ; 10 ; 60" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1" keysplines="0.5 0 0.5 1 ; 0.5 0 0.5 1 ; 0.5 0 0.5 1 ; 0.5 0 0.5 1"/> <animate attributename="cy" dur="4s" calcmode="spline" repeatcount="indefinite" values="10 ; 60 ; 110 ; 60 ; 10" keytimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1" keysplines="0.5 0 0.5 1 ; 0.5 0 0.5 1...
SVG Attribute reference - SVG: Scalable Vector Graphics
WebSVGAttribute
svg attributes a to z a accent-height accumulate additive alignment-baseline allowreorder alphabetic amplitude arabic-form ascent attributename attributetype autoreverse azimuth b basefrequency baseline-shift baseprofile bbox begin bias by c calcmode cap-height class clip clippathunits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentscripttype contentstyletype cursor cx cy d d decelerate descent diffuseconstant direction display divisor dominant-baseline dur dx dy e edgemode elevation enable-background end exponent externalresourcesrequi...
...ng-mode filters attributes filter primitive attributes height, result, width, x, y transfer function attributes type, tablevalues, slope, intercept, amplitude, exponent, offset animation attributes animation attribute target attributes attributetype, attributename animation timing attributes begin, dur, end, min, max, restart, repeatcount, repeatdur, fill animation value attributes calcmode, values, keytimes, keysplines, from, to, by, autoreverse, accelerate, decelerate animation addition attributes additive, accumulate event attributes animation event attributes onbegin, onend, onrepeat document event attributes onabort, onerror, onresize, onscroll, onunload global event attributes oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncuechange, ondblclic...
Content type - SVG: Scalable Vector Graphics
when used in a stylesheet, a <length> is defined as follows: length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")?
... when lengths are used in an svg attribute, a <length> is instead defined as follows: length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?
<script> - SVG: Scalable Vector Graphics
WebSVGElementscript
while svg's script element is equivalent to the html <script> element, it has some discrepancies, like it uses the href attribute instead of src and it doesn't support ecmascript modules so far (see browser compatibility below for details) html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <script> // <![cdata[ window.addeventlistener('domcontentloaded', () => { function getcolor () { const r = math.round(math.random() * 255).tostring(16).padstart(2,'0') const g = math.round(math.random() * 255).tostring(16).padstart(2,'0') const b = math.round(math.random() * 255).tostring(16).padstart(2,'0') return `#${r}${g}${b}` } document.query...
... value type: <string>; default value: application/ecmascript; animatable: no xlink:href deprecated since svg 2 the url to the script to load.
SVG documentation index - SVG: Scalable Vector Graphics
WebSVGIndex
37 calcmode needscompattable, needsexample, svg, svg attribute the calcmode attribute specifies the interpolation mode for the animation.
... this attribute is ignored unless the calcmode attribute is set to spline.
Content Scripts - Archive of obsolete content
gemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscript: 'function contextmenualert(href) {' + ' window.alert("the context menu was clicked on url:\\n" + href);' + '};' + 'window.addeventlistener("myaddonid-contextmenu-clicked",' + ' function(event){contextmenualert(event.detail);});' }); let cm = require("sdk/context-menu"); cm.item({ label: "alert url", context: [ cm.urlcontext(["*.mozilla.org"]), cm.selectorcontext("a[href]") ], contentscript: 'self.on("click", function (node, data) {' + ' var event = new customevent("myaddonid-contextmenu-clicked",' + ' {detail:node.href});' ...
Classes and Inheritance - Archive of obsolete content
constructors before the ecmascript 6 standard, a javascript class was defined by creating a constructor function for that class.
Modules - Archive of obsolete content
cuddlefish uses this option to expose the components object as a module called chrome, in a way similar to the code here below: const { classes: cc, constructor: cc, interfaces: ci, utils: cu, results: cr, manager: cm } = components; let loader = loader({ paths: ["./": "http://www.foo.com/"], resolve: function (id, requirer) { // your logic here return id; }, modules: { 'chrome': { components: components, cc: cc, cc: bind(cc, components), ci: ci, cu: cu, cr: cr, cm: cm } } })...
Private Properties - Archive of obsolete content
weakmaps were introduced to javascript in ecmascript 2015 and have recently been implemented in spidermonkey.
Chrome Authority - Archive of obsolete content
cm an alias for components.manager.
Getting Started (jpm) - Archive of obsolete content
you can do this by pressing the ctrl+o key combination (cmd+o on mac) from within firefox, or selecting the "open" item from firefox's "file" menu.
Getting started (cfx) - Archive of obsolete content
you can do this by pressing the ctrl+o key combination (cmd+o on mac) from within firefox, or selecting the "open" item from firefox's "file" menu.
Developing for Firefox Mobile - Archive of obsolete content
then execute jpm-mobile run with some extra options: jpm-mobile run --adb /path/to/adb in the command shell, you should see something like: launching mobile application with intent name org.mozilla.fennec pushing the addon to your device starting: intent { act=android.activity.main cmp=org.mozilla.fennec/.app (has extras) } --------- beginning of /dev/log/main --------- beginning of /dev/log/system could not read chrome manifest 'file:///data/data/org.mozilla.fennec/chrome.manifest'.
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
firefox 3.5 includes a number of extensions to the specification standardized in ecmascript 3rd edition, and can use javascript 1.7 and javascript 1.8.
Signing an extension - Archive of obsolete content
then cert8.db, key3.db and secmod.db will be generated.
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
our engineers also faced a huge archive of content that wasn't entered into our cms with xhtml in mind.
CSS3 - Archive of obsolete content
detection of ecmascript support, using the script media features is also proposed.
Index of archived content - Archive of obsolete content
table layout strategy tamarin abcasm tamarin acceptance testing abc assembler tests actionscript acceptance tests tamarin acceptance test template actionscript performance tests cmdline tests running tamarin acceptance tests running tamarin performance tests tamarin build system documentation tamarin releases tamarin-central rev 703:2cee46be9ce0 tamarin roadmap tamarin build documentation tama...
Bonsai - Archive of obsolete content
checkins to any branch of xfe by ramiro between 26-feb-1998 and 12-may-1998 differences between revisions 3.1 and 3.3 of the file mozilla/cmd/xfe/forms.c that's a small sample, but it should be enough to get you started.
Bookmark Keywords - Archive of obsolete content
to file this bookmark open the "bookmarks" menu in the browser and select "add bookmark," or by of use the keyboard equivalent (e.g., <tt>cmd-d</tt> on macintosh).
importUserCertificates - Archive of obsolete content
"certrepstring" this string is the cmmf certification response from the ca that contains the user's certificate(s).
Java in Firefox Extensions - Archive of obsolete content
var aclass = java.lang.class.forname("org.mozilla.developer.helloworld", true, cl); var astaticmethod = aclass.getmethod("getgreeting", []); var greeting = astaticmethod.invoke(null, []); alert(greeting); another, perhaps simpler approach is as follows: var myclass = loader.loadclass('com.example.myclass'); // use the same loader from above var myobj = myclass.newinstance(); var binval = myobj.mymethod(arg1, arg2); // pass whatever arguments you need (they'll be auto-converted to java form...
jspage - Archive of obsolete content
is));this.xhr.onreadystatechange=$empty;if(this.options.issuccess.call(this,this.status)){this.response={text:this.xhr.responsetext,xml:this.xhr.responsexml}; this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}},issuccess:function(){return((this.status>=200)&&(this.status<300)); },processscripts:function(a){if(this.options.evalresponse||(/(ecma|java)script/).test(this.getheader("content-type"))){return $exec(a);}return a.stripscripts(this.options.evalscripts); },success:function(b,a){this.onsuccess(this.processscripts(b),a);},onsuccess:function(){this.fireevent("complete",arguments).fireevent("success",arguments).callchain(); },failure:function(){this.onfailure();},onfailure:function(){this.fireevent("complete").fireevent("failure",thi...
Mozilla Application Framework in Detail - Archive of obsolete content
rsing files, compositing multiple sources into a single rdf graph, querying and manipulating graphs, and populating xul widgets (trees, menus, etc.) with graph data; an xslt/xpath processor; scalable vector graphics (svg) rendering with support for a usable subset of the standard including all basic shapes, beziers, stroking and filling with opacity, and much of the dom; mathml rendering; an ecma-262 edition 3-compliant javascript engine; java integration with a bridge to xpcom, a java dom api, the open jvm integration (oji) facility, a java webclient api, and java plug-ins; nspr, a runtime engine that provides platform-independence (across over a dozen platforms) for non-gui operating system facilities with support for threads, thread synchronization, normal file and network i/o, inte...
LIR - Archive of obsolete content
105 cmovi integer conditional move int 106 cmovq quad 64 bit conditional move quad 107 cmovd double conditional move double conversions 108 i2q quad 64 bit sign-extend int to quad 109 ui2uq quad 64 bit zero-extend unsigned int to unsigned quad 110 q2i integer 64 bit truncate quad to int (removes the high 32 bits) 111 i2d dou...
Tamarin Acceptance Test Template - Archive of obsolete content
* * ***** end license block ***** */ var section = "test"; // provide a document reference (ie, actionscript section) var version = "as3"; // version of ecmascript or actionscript var title = "test"; // provide ecma section title or a description var bugnumber = ""; starttest(); // leave this alone /** * calls to addtestcase here.
Tamarin Acceptance Testing - Archive of obsolete content
successfully run the following test suites: acceptance test suite [info] self tests [info] submit a sandbox build request to test against platforms that you may not have locally [info] available tamarin acceptance test suites actionscript acceptance tests: actionscript acceptance tests running tamarin acceptance tests abc assembler tests cmdline tests performance tests actionscript performance tests running tamarin performance tests built-in self tests see instructions in doc/selftest.html in the tamarin repository.
Tamarin build documentation - Archive of obsolete content
a prototype self-hosting ecmascript edition 4 compiler, esc, is provided with tamarin but it is not yet capable of bootstrapping itself or building applications.
Tamarin Build System Documentation - Archive of obsolete content
the test phase runs all functional testcases including acceptance tests, cmdline tests, and selftests.
Tamarin - Archive of obsolete content
it currently implements adobe actionscript™ 3 (a superset of ecmascript edition 3) and is embedded within the adobe® flash® player versions 9 and later.
Venkman Introduction - Archive of obsolete content
if you would like to inspect the object's prototype and parent chains, check the "include ecma properties" menu item in the view's context menu.
Example Sticky Notes - Archive of obsolete content
="text/html; charset=iso-8859-1"> <style type="text/css"> body { background-color: #ffffff; color: #000000; font: 1em verdana, sans-serif; } h1 { font-size: 1.5em; } /* binding: */ .sticker { -moz-binding: url(notes.xml#default); } </style> </head> <body> <h1><a href="http://developer.mozilla.org/en/docs/xbl:xbl_1.0_reference">xbl</a> demo : sticky notes</h1> <div class="sticker"><p>acme,&nbsp;inc.
Mozilla E4X - Archive of obsolete content
presentation view online download summary "ecmascript for xml" (ecma-357), a new standard for writing and processing xml directly in javascript (ecma-262, iso-16262).
XTech 2005 Presentations - Archive of obsolete content
web 1.6: a rope of sand - opening keynote, mike shaver mozilla e4x - brendan eich "ecmascript for xml" (ecma-357), a new standard for writing and processing xml directly in javascript (ecma-262, iso-16262).
command - Archive of obsolete content
example <command id="cmd_openhelp" oncommand="alert('help');"/> <button label="help" command="cmd_openhelp"/> <button label="more help" command="cmd_openhelp"/> see also command element, oncommand and commandset ...
reserved - Archive of obsolete content
example here, the command to open a new browser window is reserved: <command id="cmd_newnavigator" oncommand="openbrowserwindow()" reserved="true"/> if the keyboard shortcut for that is accel-t, then this code will not work as expected, as compared to when it is run from web content: document.addeventlistener("keydown", handlekey, true); function handlekey(event) { // listen for the "new tab" shortcut if (event.metakey && (event.key == "t")) { // log a message ...
onFindAgainCommand - Archive of obsolete content
you should specify true as the input parameter to perform a "find previous" operation, or false to perform a "find next." example typically, you'll simply bind this method to your "find next" and "find previous" commands, like this: <command name="cmd_find_previous" oncommand="gfindbar.onfindagaincommand(true);"/> <command name="cmd_find_next" oncommand="gfindbar.onfindagaincommand(false);"/> ...
startFind - Archive of obsolete content
example typically, you'll simply bind this method to your "find" command, like this: <command name="cmd_find" oncommand="gfindbar.startfind(gfindbar.find_normal);"/> ...
MenuItems - Archive of obsolete content
<command id="cmd_delete" disabled="true" oncommand="alert('deleted!');"/> <menuitem label="delete" accesskey="f" command="cmd_deleted"/> as the menuitem is attached to the command, it's automatically disabled when the command is disabled.
controllers - Archive of obsolete content
example <window id="controller-example" title="controller example" onload="init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/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="oce...
The Joy of XUL - Archive of obsolete content
applications written in xul are based on additional w3c standard technologies featuring html 4.0; cascading style sheets (css) 1 and 2; document object model (dom) levels 1 and 2; javascript 1.5, including ecma-262 edition 3 (ecmascript); xml 1.0.
Using Visual Studio as your XUL IDE - Archive of obsolete content
vs just supports ecmascript 3rd edition and thus doesn't know these keywords.
XUL Parser in Python/source - Archive of obsolete content
def strip(snip): t = re.sub('http://.*?\s', '', snip) return t class xulparser(xmllib.xmlparser): def unknown_starttag(self, t, a): name = strip(t) if name not in el_list: el_list[name] = {} for attr,val in a.items(): el_list[name][strip(attr)] = strip(val) def syntax_error(self, message): pass p = xulparser() cmd = 'dir /s /b *.xul' chrome_dir = 'c:\program files\netscape\netscape 6\chrome' os.chdir(chrome_dir) files = os.popen(cmd).readlines() for file in files: file = file.strip() print '** ' + file + ' **' data = open(file).read() p.feed(data) w.write('<html><h3>periodic table of xul elements</h3>') w.write('<table><style>.head {font-weight: bold; background-color: lightgrey;}</style>') elements...
The Implementation of the Application Object Model - Archive of obsolete content
talk to john mcmullen about 5.0 preferences and figure out where localdata will need to be used (likely on every form element control) talk to steve elmer.
XML - Archive of obsolete content
mathml and the chemical markup language (cml) are two of the better-known and more widely-used languages, but there are hundreds.
command - Archive of obsolete content
see also: command attribute, commandset element attributes disabled, label, oncommand,reserved examples the following code will send a paste command (cmd_paste) to the currently focused element: // first include chrome://global/content/globaloverlay.js godocommand("cmd_paste"); example with two buttons <commandset><command id="cmd_openhelp" oncommand="alert('help');"/></commandset> <button label="help" command="cmd_openhelp"/> <button label="more help" command="cmd_openhelp"/> attributes disabled type: boolean indicates whether the ...
commandset - Archive of obsolete content
attributes commandupdater, events, oncommandupdate, targets example <commandset> <command id="cmd_open" oncommand="alert('open!');"/> <command id="cmd_help" oncommand="alert('help!');"/> </commandset> attributes commandupdater type: boolean if true, the commandset is used for updating commands.
MacFAQ - Archive of obsolete content
; var windowmediator = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); var win = windowmediator.getmostrecentwindow(singletonwindowtype); if (win) { window.close(); win.focus(); } } if (window.arguments && window.arguments[0]){ try { var cmdline = window.arguments[0] .queryinterface(components.interfaces.nsicommandline); for (var i = 0; i < cmdline.length; ++i) { debug(cmdline.getargument(i)) } } catch(ex) { debug(window.arguments[0]) // do something with window.arguments[0] //nspreferences.setunicharpref("myxul.cmdlinevalue", window.arguments[0]) ...
XULRunner tips - Archive of obsolete content
save the dom_inspector-*.xpi package to a temporary directory unzip the package copy the following files: chrome/inspector.jar to the chrome directory of your xulrunner application components/inspector-cmdline.js to your components directory defaults/preferences/inspector.js to your preferences directory open your chrome.manifest file and add these lines: content inspector jar:inspector.jar!/content/inspector/ xpcnativewrappers=no locale inspector en-us jar:inspector.jar!/locale/inspector/ skin inspector modern/1.0 jar:inspector.jar!/ski...
Mozprocess - Archive of obsolete content
basic usage: process = processhandler(['command', '-line', 'arguments'], cwd=none, # working directory for cmd; defaults to none env={}, # environment to use for the process; defaults to os.environ ) exit_code = process.waitforfinish(timeout=60) # seconds see an example in https://github.com/mozilla/mozbase/b...profilepath.py processhandler may be subclassed to handle process timeouts (by overriding the ontimeout() method), process completion (by overr...
nsIContentPolicy - Archive of obsolete content
note: acontext is the new tab/window when a user uses the context menu to open a link in a new tab/window or cmd/ctrl + clicks the link (i.e., acontext is not the tab which the link was on in these cases).
Mozilla release FAQ - Archive of obsolete content
regarding shells, i would like to recommend the following: if you are using unix, use bash-family shells for the build because of the better control over redirection (in case you want to log errors and messages) if you are using win32, using the default shell cmd.exe (as opposed to 4dos or 4nt) will probably yield better results.
2006-11-10 - Archive of obsolete content
summary: mozilla.dev.accessibility - oct 28-nov 10, 2006 announcements acm transactions on accessible computing "transactions on accessible computing (taccess) is a quarterly journal that publishes refereed articles addressing issues of computing as it impacts the lives of people with disabilities." read more...
2006-10-26 - Archive of obsolete content
(what it is, how to use it) cross-post-and followup fx2 announcment to support-firefox request for when the announcement about firefox 2's release to be posted on the mozilla.dev.apps.firefox newsgroup.
2006-10-27 - Archive of obsolete content
(what it is, how to use it) cross-post-and followup fx2 announcment to support-firefox request for when the announcement about firefox 2's release to be posted on the mozilla.dev.apps.firefox newsgroup.
2006-11-03 - Archive of obsolete content
announcments mozilla scheduled downtime - 11/2/2006, 7pm - 11pm pdt (0300 - 0700 utc) mozilla scheduled downtime - 11/2/2006, 7pm - 11pm pdt (0300 - 0700 utc) opening l10n repository on mozilla_1_8_branch for approved check-ins opening l10n repository on mozilla_1_8_branch for approved check-ins discussion from 50 to 100 locales a discussion on how to make l10n easier and increase the number of locals with which mozilla products ship.
2006-11-10 - Archive of obsolete content
announcments mike connor announced new 'driving' bugs "we have added a pair of drivers-only flags...o track bugs that are not strictly blockers, but are wanted as soon as possible" benjamin smedberg announced new rules for patches to toolkit from now on unit test must be provided with all patches.
2006-11-24 - Archive of obsolete content
announcments bon echo status mike beltzner posted a small to-do list with regards to bon echo firefox 1.5.0.9/2.0.0.1 jay patel posted an update of bugs for the firefox 1.5.0.9/2.0.0.1 releases discussion non-ascii rendering performance boris zbarsky made some suggestions on how to improve international font rendering cvs commit access changes a large discussion went on about changes to policies surrounding cvs commit access project drivers and technical oversight mike connor suggested ways to better organize project management, policy making, and technical oversight.
2006-10-13 - Archive of obsolete content
summary: mozilla.dev.platform - october 7th to october 13th 2006 announcements no announcments this week other traffic javascript package system for 1.9/ff3 on sun, oct 8 2006 robert sayre inquires about the javascript package system for 1.9 for firefox 3, robert would like to know if there is any chance we'll get this?
2006-10-27 - Archive of obsolete content
summary: mozilla.dev.platform - october 21st to october 27th 2006 announcements no announcments this week.
2006-11-10 - Archive of obsolete content
as the cms for qmo.
External resources for plugin creation - Archive of obsolete content
all platforms rely on cmake for easy cross-platform builds.
Introduction to Public-Key Cryptography - Archive of obsolete content
d:67:e9:46:a8: d:c4 here is the same certificate displayed in the 64-byte-encoded form interpreted by software: -----begin certificate----- miickzccazsgawibagibazanbgkqhkig9w0baqqfada3mqswcqydvqqgewjvuzer ma8ga1uechmitmv0c2nhcguxftatbgnvbastdfn1chjpewencybdqtaefw05nzew mtgwmtm2mjvafw05otewmtgwmtm2mjvamegxczajbgnvbaytalvtmrewdwydvqqk ewhozxrzy2fwztenmasga1uecxmeuhviczexmbuga1ueaxmou3vwcml5ysbtagv0 dhkwgz8wdqyjkozihvcnaqefbqadgy0amigjaogbamr6ezipgfjx3urjgejmkiqg 7sdatyazbcabu1avyd7chrkiq31fbxfogd3wnktbf6hro6eamm5/r1askzz8aw7l iqzbcrxpc0k4du+2q6xju2mpm/8wkumontuvzpo+sgxelmhvcheqoocwfdizywyz nmmrjgaoma2ms6pukfqvagmbaagjnja0mbegcwcgsagg+eibaqqeawiagdafbgnv hsmegdawgbty8gzzkbhhufwjm1oxeuzc+zymytanbgkqhkig9w0baqqfaaobgqbt i6/z07z635dfzx4xbafpjlrl/aywqztsyx8gfcnaqcqcwasdkvsuj/vwbf...
TCP/IP Security - Archive of obsolete content
other commonly used protocols at the network layer are internet control message protocol (icmp) and internet group management protocol (igmp).
Vulnerabilities - Archive of obsolete content
the web security vulnerabilities are prioritized depending on exploitability, detectability and impact on software which can be any cms such as wordpress, joomla, magento, wocommerce and more.
Using SSH to connect to CVS - Archive of obsolete content
ms-dos command prompt cygwin for /f "tokens=1,2,3* delims=; " %%a in ('ssh-agent -c') do if "%%a"=="setenv" set %%b=%%c set home=/cygdrive/c/path/to/your/cygwin/home/directory ssh-add ~/.ssh/id_dsa start /b /wait cmd.exe ssh-agent -k exit essentially both sets of commands do the same thing.
Processing XML with E4X - Archive of obsolete content
a full definition of e4x can be found in the ecma-357 specification.
E4X Tutorial - Archive of obsolete content
this tutorial walks you through the basic syntax of e4x (ecmascript for xml).
Function.prototype.isGenerator() - Archive of obsolete content
it was part of an early harmony proposal, but has not been included in the ecmascript 2015 specification.
Generator comprehensions - Archive of obsolete content
var numbers = [1, 2, 3]; // generator function (function*() { for (let i of numbers) { if (i < 3) { yield i * 1; } } })(); // generator comprehension (for (i of numbers) if (i < 3) i); // result: both return a generator which yields [1, 2] specifications generator comprehensions were initially in the ecmascript 2015 draft, but got removed in revision 27 (august 2014).
Error.description - Archive of obsolete content
the description and message properties provide the same functionality; the descriptionproperty provides backward compatibility; the message property complies with the ecma standard.
New in JavaScript 1.5 - Archive of obsolete content
the corresponding ecma standard is ecma-262 edition 3 (from december 1999).
Number.toInteger() - Archive of obsolete content
number.tointeger() was part of the draft ecmascript 6 specification, but has been removed on august 23, 2013 in draft rev 17.
Object.prototype.__noSuchMethod__ - Archive of obsolete content
while __nosuchmethod__ has been dropped, the ecmascript 2015 specification has the proxy object, with which you can achieve the below (and more).
Reflect.enumerate() - Archive of obsolete content
the static reflect.enumerate() method used to return an iterator with the enumerable own and inherited properties of the target object, but has been removed in ecmascript 2016 and is deprecated in browsers.
for each...in - Archive of obsolete content
the for each...in statement is deprecated as the part of ecma-357 (e4x) standard.
handler.enumerate() - Archive of obsolete content
the handler.enumerate() method used to be a trap for for...in statements, but has been removed from the ecmascript standard in es2016 and is deprecated in browsers.
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
e4x (ecmascript for xml) is an extension of javascript which provides direct support for xml, greatly simplifying the process of consuming xml via javascript.
Reference - Archive of obsolete content
it's not in the ecma docs.
Writing JavaScript for XHTML - Archive of obsolete content
but, standardized by ecma, they neglected to implement an interface to let e4x objects interact with dom objects our document consists of.
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
engineers ) ietf (internet engineering task force ) irtf (internet research task force ) iso (international standards organization ) itu (international telecommunication union ) oasis (organization for the advancement of structured information standards ) oma (open mobile alliance ), uni (unicode consortium ) w3c (world wide web consortium ) iana (internet assigned numbers authority ) ecma international like the processes and standards that accountants and project managers must follow, the above-mentioned standards organizations provide focus and direction for the development engineering community.
Common causes of memory leaks in extensions - Extensions
for example: function implicitdeclarationleak(window) { // implicit variable declaration in the js global, holding a strong ref to the document doc = window.document; } implicitly declared variables can be avoided by using ecmascript 5's strict mode.
Bounding volume collision detection with THREE.js - Game development
by default they are created with a linebasicmaterial material (a three.js material for drawing wireframe-style geometries).
Unconventional controls - Game development
connecting the boards and using them may look like this: var cylon = require('cylon'); cylon.robot({ connections: { arduino: { adaptor: 'firmata', port: '/dev/ttyacm0' } }, devices: { makey: { driver: 'makey-button', pin: 2 } }, work: function(my) { my.makey.on('push', function() { console.log("button pushed!"); }); } }).start(); as the description says: this gpio driver allows you to connect a 10 mohm resistor to a digital pin on your arduino or raspberry pi to control your robots with bananas, clay, or drawable circuitry.
Gecko FAQ - Gecko Redirect 1
xml 1.0: full support, except for processing to manipulate default attributes rdf: full support, except for abouteach, abouteachprefix, and parsetype javascript 1.5, including ecma-262 edition 3 (ecmascript) compliance, except for date.todatestring and date.totimestring, which are not implemented transfer protocols: http 1.1 (including gzip compression), ftp ssl unicode oji (open java interface) image formats png gif jpeg, pjpeg does "full support" mean that gecko has zero bugs today or will have zero bugs at some point in the future?
Block cipher mode of operation - MDN Web Docs Glossary: Definitions of Web-related terms
for example, aes is a cipher, while ctr, cbc, and gcm are all modes.
Cipher suite - MDN Web Docs Glossary: Definitions of Web-related terms
a typical cipher suite looks like ecdhe_rsa_with_aes_128_gcm_sha256 or ecdhe-rsa-aes128-gcm-sha256, indicating: ecdhe (elliptic curve diffie-hellman ephemeral) for key exchange rsa for authentication aes-128 as the cipher, with galois/counter mode (gcm) as the block cipher mode of operation sha-256 as the hash-based message authentication code (hmac) learn more mozilla recommended cipher suite choices for tls ...
DoS attack - MDN Web Docs Glossary: Definitions of Web-related terms
here is a non-exhaustive list of dos attack types: bandwidth attack service request flood syn flooding attack icmp flood attack peer-to-peer attack permanent dos attack application level flood attack learn more denial-of-service attack on wikipedia denial-of-service on owasp ddos ...
Denial of Service - MDN Web Docs Glossary: Definitions of Web-related terms
here is a non-exhaustive list of dos attack types: bandwidth attack service request flood syn flooding attack icmp flood attack peer-to-peer attack permanent dos attack application level flood attack learn more denial-of-service attack on wikipedia denial-of-service on owasp ddos ...
Falsy - MDN Web Docs Glossary: Definitions of Web-related terms
examples examples of falsy values in javascript (which are coerced to false in boolean contexts, and thus bypass the if block): if (false) if (null) if (undefined) if (0) if (-0) if (0n) if (nan) if ("") the logical and operator, && if the first object is falsy, it returns that object false && "dog" // ↪ false 0 && "dog" // ↪ 0 specifications specification ecmascript (ecma-262)the definition of 'toboolean abstract operation' in that specification.
Hoisting - MDN Web Docs Glossary: Definitions of Web-related terms
hoisting is a term you will not find used in any normative specification prose prior to ecmascript® 2015 language specification.
Round Trip Time (RTT) - MDN Web Docs Glossary: Definitions of Web-related terms
$ ping example.com ping example.com (216.58.194.174): 56 data bytes 64 bytes from 216.58.194.174: icmp_seq=0 ttl=55 time=25.050 ms 64 bytes from 216.58.194.174: icmp_seq=1 ttl=55 time=23.781 ms 64 bytes from 216.58.194.174: icmp_seq=2 ttl=55 time=24.287 ms 64 bytes from 216.58.194.174: icmp_seq=3 ttl=55 time=34.904 ms 64 bytes from 216.58.194.174: icmp_seq=4 ttl=55 time=26.119 ms --- google.com ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 23.781/26...
SDP - MDN Web Docs Glossary: Definitions of Web-related terms
here is a typical sdp message: v=0 o=alice 2890844526 2890844526 in ip4 host.anywhere.com s= c=in ip4 host.anywhere.com t=0 0 m=audio 49170 rtp/avp 0 a=rtpmap:0 pcmu/8000 m=video 51372 rtp/avp 31 a=rtpmap:31 h261/90000 m=video 53000 rtp/avp 32 a=rtpmap:32 mpv/90000 sdp is never used alone, but by protocols like rtp and rtsp.
SVN - MDN Web Docs Glossary: Definitions of Web-related terms
apache subversion (svn) is a free source control management (scm) system.
Sloppy mode - MDN Web Docs Glossary: Definitions of Web-related terms
ecmascript 5 and later let scripts opt in to a new strict mode, which alters the semantics of javascript in several ways to improve its resiliency and which make it easier to understand what's going on when there are problems.
Symmetric-key cryptography - MDN Web Docs Glossary: Definitions of Web-related terms
for example, aes is a cipher, while ctr, cbc, and gcm are all modes.
Truthy - MDN Web Docs Glossary: Definitions of Web-related terms
examples of truthy values in javascript (which will be coerced to true in boolean contexts, and thus execute the if block): if (true) if ({}) if ([]) if (42) if ("0") if ("false") if (new date()) if (-42) if (12n) if (3.14) if (-3.14) if (infinity) if (-infinity) specifications specification ecmascript (ecma-262)the definition of 'toboolean abstract operation' in that specification.
Web standards - MDN Web Docs Glossary: Definitions of Web-related terms
ves you an idea of which standards websites and network systems must conform to: ietf (internet engineering task force): internet standards (std), which among other things govern set-up and use of uris, http, and mime w3c: specifications for markup language (e.g., html), style definitions (i.e., css), dom, accessibility iana (internet assigned numbers authority): name and number registries ecma intl.: scripting standards, most prominently for javascript iso (international organization for standardization): standards governing a diverse array of aspects, including character encodings, website management, and user-interface design learn more general knowledge web standards on wikipedia ...
Whitespace - MDN Web Docs Glossary: Definitions of Web-related terms
in javascript ecmascript® 2015 language specification specifies several unicode codepoints as white space: u+0009 character tabulation <tab>, u+000b line tabulation <vt>, u+000c form feed <ff>, u+0020 space <sp>, u+00a0 no-break space <nbsp>, u+feff zero width no-break space <zwnbsp> and other category “zs” any other unicode “separator, space” code point <usp>.
Test your skills: CSS and JavaScript accessibility - Learn web development
we'd like you to assume that the existing ruleset with the a selector is supplied by some cms, and that you can't change it — instead, you need to create new rules to make the links look and behave like links, and for the user to be able to tell where they are in the list.
Cascade and inheritance - Learn web development
one situation in which you may have to use it is when you are working on a cms where you can't edit the core css modules, and you really want to override a style that can't be overridden in any other way.
Debugging CSS - Learn web development
to create a reduced test case: if your markup is dynamically generated — for example via a cms — make a static version of the output that shows the problem.
Combinators - Learn web development
that said, your knowledge of combinators will come in very useful if you need to get to something in your document and are unable to access the html, perhaps due to it being generated by a cms.
Pseudo-classes and pseudo-elements - Learn web development
instead of adding the class, we could use the :first-child pseudo-class selector — this will always target the first child element in the article, and we will no longer need to edit the html (this may not always be possible anyway, maybe due to it being generated by a cms.) all pseudo-classes behave in this same kind of way.
How CSS is structured - Learn web development
for example, perhaps your cms only allows you to edit the html body.
What is CSS? - Learn web development
css specifications all web standards technologies (html, css, javascript, etc.) are defined in giant documents called specifications (or simply "specs"), which are published by standards organizations (such as the w3c, whatwg, ecma, or khronos) and define precisely how those technologies are supposed to behave.
Using CSS generated content - Learn web development
if you specify content in your stylesheet that requires translation, you have to put those parts of your stylesheet in different files and arrange for them to be linked with the appropriate language versions of your doucment.
How do you make sure your website works properly? - Learn web development
ping is a useful shell tool that tests the domain name you provide and tells you if the server's responding or not: $ ping mozilla.org ping mozilla.org (63.245.215.20): 56 data bytes 64 bytes from 63.245.215.20: icmp_seq=0 ttl=44 time=148.741 ms 64 bytes from 63.245.215.20: icmp_seq=1 ttl=44 time=148.541 ms 64 bytes from 63.245.215.20: icmp_seq=2 ttl=44 time=148.734 ms 64 bytes from 63.245.215.20: icmp_seq=3 ttl=44 time=147.857 ms ^c --- mozilla.org ping statistics --- 4 packets transmitted, 4 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 147.857/148.468/148.741/0.362 ms just keep in mi...
What is a web server? - Learn web development
some application servers cater to specific website categories like blogs, wikis, or ecommerce; others, called cmss (content management systems), are more generic.
Other form controls - Learn web development
holding down cmd/ctrl and clicking multiple values on desktop).
The web and web standards - Learn web development
the w3c is the best known web standards body, but there are others such as the whatwg (who were responsible for the modernization of the html language), ecma (who publish the standard for ecmascript, which javascript is based on), khronos (who publish technologies for 3d graphics, such as webgl), and others.
Using data attributes - Learn web development
in firefox 49.0.2 (and perhaps earlier/later versions), the data attributes that exceed 1022 characters will not be read by javascript (ecmascript 4).
Advanced text formatting - Learn web development
l sample file): <pre><code>var para = document.queryselector('p'); para.onclick = function() { alert('owww, stop poking me!'); }</code></pre> <p>you shouldn't use presentational elements like <code>&lt;font&gt;</code> and <code>&lt;center&gt;</code>.</p> <p>in the above javascript example, <var>para</var> represents a paragraph element.</p> <p>select all the text with <kbd>ctrl</kbd>/<kbd>cmd</kbd> + <kbd>a</kbd>.</p> <pre>$ <kbd>ping mozilla.org</kbd> <samp>ping mozilla.org (63.245.215.20): 56 data bytes 64 bytes from 63.245.215.20: icmp_seq=0 ttl=40 time=158.233 ms</samp></pre> the above code will look like so: marking up times and dates html also provides the <time> element for marking up times and dates in a machine-readable format.
Images in HTML - Learn web development
for example on the mac you can use cmd + i to get the info display up for the image file.
Responsive images - Learn web development
this is the image's real size, which can be found by inspecting the image file on your computer (for example, on a mac you can select the image in finder and press cmd + i to bring up the info screen).
Index - Learn web development
55 making asynchronous programming easier with async and await beginner, codingscripting, guide, javascript, learn, promises, async, asynchronous, await more recent additions to the javascript language are async functions and the await keyword, part of the so-called ecmascript 2017 javascript edition (see ecmascript next support in mozilla).
Making asynchronous programming easier with async and await - Learn web development
previous overview: asynchronous next more recent additions to the javascript language are async functions and the await keyword, part of the so-called ecmascript 2017 javascript edition (see ecmascript next support in mozilla).
Basic math in JavaScript — numbers and operators - Learn web development
it was first introduced in ecmascript 2016.
TypeScript support in Svelte - Learn web development
in this case, if you run npm run validate (either in the vs code console or terminal) you will get the following error: even better, if you run it from the vs code integrated terminal (you can open it with the ctrl + ` keyboard shortcut), cmd/ctrl + clicking on the file name will take you to the line containing the error.
Getting started with Svelte - Learn web development
cmder is another very good and complete alternative.
Debugging on Mac OS X
once done, you should be able to open any file quickly by hitting cmd-shift-o and typing in the name of a file.) in the product menu, select scheme > new scheme and name your scheme (for example, "debug").
HTTP logging
type cmd and press enter, a new command prompt window with a black background will appear.
Makefile - variables
host_ variable description host_cmsrcs a list of .m sources to compile host_cmmsrcs a list of .mm sources to compile host_objs host_os_arch arch of real platform a target platform is being built on(building mobile binaries on gnu/linux).
Gecko Logging
set moz_log="example_logger:3" in the windows command prompt (cmd.exe), don't use quotes: set moz_log=example_logger:3 if you want this on geckoview example, use the following adb command to launch process: adb shell am start -n org.mozilla.geckoview_example/.geckoviewactivity --es env0 "moz_log=example_logger:3" there are special module names to change logging behavior.
Message manager
guides message manager overview frame script loading and lifetime communicating with frame scripts performance best practices frame script environment limitations of frame scripts process scripts api reference nsiframescriptloader nsimessagelistenermanager nsimessagebroadcaster nsimessagesender nsisyncmessagesender nsicontentframemessagemanager nsiprocessscriptloader ...
mozbrowseropentab
the mozbrowseropentab event is fired when a new tab is opened within a browser <iframe> as a result of the user issuing a command to open a link target in a new tab (for example ctrl/cmd + click.) general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the browser iframe type read only domstring the type of event.
Browser API
mozbrowseropentab sent when a new tab is opened within a browser <iframe> as a result of the user issuing a command to open a link target in a new tab (for example ctrl/cmd + click.) mozbrowserresize sent when the browser <iframe>'s window size has changed.
Embedding Tips
nscomptr<nsicommandmanager> commandmanager = do_getinterface(iwebbrowser); if (commandmanager) { nscomptr<nsidomwindow> thedomwindow = do_getinterface(iwebbrowser); nscomptr<nsicommandparams> cmdparamsobj = do_createinstance(ns_command_params_contractid,&rv); cmdparamsobj->setisupportsvalue("addhook", reinterpret_cast<nsisupports*>(ichromeimplementation)); commandmanager->docommand("cmd_clipboarddragdrophook", cmdparamsobj, thedomwindow); } ...
IPDL Tutorial
using struct mozilla::void_t from "ipc/ipcmessageutils.h"; union variant { void_t; bool; int; double; nscstring; ppluginscriptableobject; }; this union generates a c++ interface which includes the following: struct variant { enum type { tvoid_t, tbool, tint, tdouble, tnscstring, tpplugionscriptableobject }; type type(); void_t& get_void_t(); bool& get_bool(); int& get_int(); double& get_double(); nscstrin...
JavaScript-DOM Prototypes in Mozilla
alternatively, one can access and modify the prototype of an htmlimageelement through the prototype property of the constructor: htmlimageelement.prototype.foo = bar; modifying the prototype of a host object is not guaranteed by ecmascript specification.
JavaScript Tips
var uniquename = { _privatemember: 3, publicmember: "a string", init: function() { this.dosomething(this.anothermember); }, dosomething: function(aparam) { alert(aparam); } }; xpconnect don't use object methods and properties more than you have to.
Application Translation with Mercurial
by pressing the windows key and r on the keyboard or by calling the "run..." command from the windows "start" button, and then typing cmd and pressing the enter key.
L10n Checks
ab-cd browser chrome/browser browser.dtd +backforwardmenu.tooltip +fullzoomenlargecmd.commandkey3 +fullzoomreducecmd.commandkey2 +fullzoomresetcmd.commandkey2 +organizebookmarks.label -showallbookmarkscmd2.label migration/migration.dtd -importfromfile.accesskey -importfromfile.label +importfromhtmlfile.accesskey +importfromhtmlfile.label you can assume changed strings when you see entities remo...
Localization content best practices
developer tools key shortcuts when translating firefox strings from /devtools/ folder, you may see some keys like this: inspector.searchhtml.key=cmdorctrl+f the first part of the string `cmdorctrl` should not be translated.
Localization prerequisites
let’s try our entry points: $ hg --version mercurial distributed scm (version 1.3.1) copyright (c) 2005-2009 matt mackall <mpm@selenic.com> and others this is free software; see the source for copying conditions.
Fonts for Mozilla's MathML engine
ed distributions, use the following command (stix-math-fonts is often already installed): sudo dnf install texlive-lm-math stix-math-fonts on opensuse and other opensuse-based distributions, use the following command: sudo zypper install texlive-lm-math stix-fonts on other linux distributions, consider installing appropriate texlive packages, which includes latin modern math and xits: sudo pacman -s texlive-core texlive-fontsextra # arch linux sudo urpmi texlive-dist texlive-fontsextra # mageia however, you might need to ensure that the fonts are known by your system.
Mozilla Web Developer FAQ
try asking in the newsgroup relevant to your question in the comp.infosystems.www.authoring.* hierarchy or, if your question is about javascript/ecmascript or the dom, in comp.lang.javascript (after reading the group faqs first, of course).
About NSPR
hoare in monitors: an operating system structuring concept , communications of the acm, 17(10), october 1974 and then formalized by xerox' mesa programming language ("mesa language manual", j.g.
PLHashComparator
pl_comparestrings compare two character strings using strcmp.
PL_CompareStrings
syntax #include <plhash.h> printn pl_comparestrings( const void *v1, const void *v2); description pl_comparestrings compares v1 and v2 as character strings using strcmp.
PR_CEnterMonitor
syntax #include <prcmon.h> prmonitor* pr_centermonitor(void *address); parameter the function has the following parameter: address a reference to the data that is to be protected by the monitor.
PR_CExitMonitor
syntax #include <prcmon.h> prstatus pr_cexitmonitor(void *address); parameters the function has the following parameters: address the address of the protected object--the same address previously passed to pr_centermonitor.
PR_CNotify
syntax #include <prcmon.h> prstatus pr_cnotify(void *address); parameter the function has the following parameter: address the address of the monitored object.
PR_CNotifyAll
syntax #include <prcmon.h> prstatus pr_cnotifyall(void *address); parameter the function has the following parameter: address the address of the monitored object.
PR_CWait
syntax #include <prcmon.h> prstatus pr_cwait( void *address, printervaltime timeout); parameters the function has the following parameters: address the address of the protected object--the same address previously passed to pr_centermonitor.
PR_cnvtf
it conforms to the ecma standard of javascript (ecmascript).
Certificate functions
if you need to verify for multiple usages use cert_verifycertificatenow cert_verifyocspresponsesignature mxr 3.6 and later cert_verifysigneddata mxr 3.4 and later cert_verifysigneddatawithpublickey mxr 3.7 and later cert_verifysigneddatawithpublickeyinfo mxr 3.7 and later nss_cmpcertchainwcanames mxr 3.2 and later nss_findcertkeatype mxr 3.2 and later ...
Getting Started With NSS
you can find them in subdirectory mozilla/security/nss/cmd or have a look at some basic nss sample code.
JSS FAQ
MozillaProjectsNSSJSSJSS FAQ
rg/mozilla/jss/ssl/sslserver.java org/mozilla/jss/ssl/ssltest.java other test code that may prove useful: org/mozilla/jss/asn1/integer.java org/mozilla/jss/asn1/sequence.java org/mozilla/jss/asn1/set.java org/mozilla/jss/pkcs10/certificationrequest.java org/mozilla/jss/pkcs12/pfx.java org/mozilla/jss/pkix/cert/certificate.java org/mozilla/jss/pkix/cmmf/certrepcontent.java org/mozilla/jss/pkix/crmf/certreqmsg.java org/mozilla/jss/pkix/crmf/certtemplate.java org/mozilla/jss/pkix/primitive/name.java org/mozilla/jss/provider/javax/crypto/jsssecretkeyfactoryspi.java org/mozilla/jss/util/utf8converter.java org/mozilla/jss/util/base64inputstream.java jss/samples/pqggen.java jss/samples/pkcs12.java ...
NSS 3.12.9 release notes
bug 609068: implement j-pake in freebl bug 607058: crash [@ nss_cms_decoder_work_data] bug 613394: november/december 2010 batch of nss root ca changes bug 610843: need way to recover softoken in child after fork() bug 617492: add pk11_keygenwithtemplate function to pk11wrap (for firefox sync) bug 610162: sha-512 and sha-384 hashes are incorrect for inputs of 512mb or larger when running under windows and other 32-bit platforms (fx 3.6.12 and 4.0b6) bug...
NSS 3.16 release notes
new functions in cms.h nss_cmssignerinfo_verify - verify the signature of a single signerinfo.
NSS 3.20 release notes
support for the following ciphersuites has been added: tls_dhe_dss_with_aes_128_gcm_sha256 tls_dhe_dss_with_aes_128_cbc_sha256 tls_dhe_dss_with_aes_256_cbc_sha256 by default, the server side tls implementation will use dhe parameters with a size of 2048 bits when using dhe ciphersuites.
NSS 3.22 release notes
in ssl.h ssl_peersignedcerttimestamps - get signed_certificate_timestamp tls extension data ssl_setsignedcerttimestamps - set signed_certificate_timestamp tls extension data new types in secoidt.h the following are added to secoidtag: sec_oid_aes_128_gcm sec_oid_aes_192_gcm sec_oid_aes_256_gcm sec_oid_idea_cbc sec_oid_rc2_40_cbc sec_oid_des_40_cbc sec_oid_rc4_40 sec_oid_rc4_56 sec_oid_null_cipher sec_oid_hmac_md5 sec_oid_tls_rsa sec_oid_tls_dhe_rsa sec_oid_tls_dhe_dss sec_oid_tls_dh_rsa sec_oid_tls_dh_dss sec_oid_tls_dh_anon sec_oid_tls_ecdhe_ecdsa sec_oid_tls_ec...
NSS 3.28.1 release notes
ca generalitat valenciana sha-256 fingerprint: 8c:4e:df:d0:43:48:f3:22:96:9e:7e:29:a4:cd:4d:ca:00:46:55:06:1c:16:e1:b0:76:42:2e:f3:42:ad:63:0e ou = rsa security 2048 v3 sha-256 fingerprint: af:8b:67:62:a1:e5:28:22:81:61:a9:5d:5c:55:9e:e2:66:27:8f:75:d7:9e:83:01:89:a5:03:50:6a:bd:6b:4c the following ca certificates were added ou = ac raiz fnmt-rcm sha-256 fingerprint: eb:c5:57:0c:29:01:8c:4d:67:b1:aa:12:7b:af:12:f7:03:b4:61:1e:bc:17:b7:da:b5:57:38:94:17:9b:93:fa cn = amazon root ca 1 sha-256 fingerprint: 8e:cd:e6:88:4f:3d:87:b1:12:5b:a3:1a:c3:fc:b1:3d:70:16:de:7f:57:cc:90:4f:e1:cb:97:c6:ae:98:19:6e cn = amazon root ca 2 sha-256 fingerprint: 1b:a5:b2:aa:8c:65:40:1a:82:96:01:18:f8:0b:ec:4...
NSS 3.33 release notes
in secport.h nss_securememcmpzero - check if a memory region is all zero in constant time.
NSS 3.35 release notes
nss supports two different database file formats: dbm: the legacy file format, based on berkeley db, using filenames cert8.db, key3.db and secmod.db.
NSS 3.36.7 release notes
bugs fixed in nss 3.36.7 bug 1507135 and bug 1507174 - add additional null checks to several cms functions to fix a rare cms crash.
NSS 3.41.1 release notes
bugs fixed in nss 3.41.1 bug 1507135 and bug 1507174 - add additional null checks to several cms functions to fix a rare cms crash.
NSS 3.41 release notes
bug 1493215 - enabled the following ciphersuites by default: tls_ecdhe_ecdsa_with_aes_256_gcm_sha384 tls_ecdhe_rsa_with_aes_256_gcm_sha384 tls_dhe_rsa_with_aes_256_gcm_sha384 tls_rsa_with_aes_256_gcm_sha384 new functions none notable changes in nss 3.41 the following ca certificates were added: cn = certigna root ca sha-256 fingerprint: d48d3d23eedb50a459e55197601c27774b9d7b18c94d5a059511a10250b93168 cn = gts root r1 sha-256 fingerprint: 2a5754...
NSS 3.42.1 release notes
bugs fixed in nss 3.42.1 bug 1507135 and bug 1507174 - add additional null checks to several cms functions to fix a rare cms crash.
NSS 3.45 release notes
ersioning to openbsd builds to fix link time errors using nss bug 1553443 - send session ticket only after handshake is marked as finished bug 1550708 - fix gyp scripts on solaris sparc so that libfreebl_64fpu_3.so builds bug 1554336 - optimize away unneeded loop in mpi.c bug 1559906 - fipstest: use ckm_tls12_master_key_derive instead of vendor specific mechanism bug 1558126 - tls_aes_256_gcm_sha384 should be marked as fips compatible bug 1555207 - helloretryrequestcallback return code for rejecting 0-rtt bug 1556591 - eliminate races in uses of pk11_setwrapkey bug 1558681 - stop using a global for anti-replay of tls 1.3 early data bug 1561510 - fix a bug where removing -arch xxx args from cc didn't work bug 1561523 - add a string for the new-ish error ssl_error_missing_post_hand...
NSS 3.48 release notes
ition in self-encrypt functions bug 1599545 - fix assertion and add test for early key update bug 1597799 - fix a crash in nssckfwobject_getattributesize bug 1591178 - add entrust root certification authority - g4 certificate to nss bug 1590001 - prevent negotiation of versions lower than 1.3 after helloretryrequest bug 1596450 - added a simplified and unified mac implementation for hmac and cmac behind pkcs#11 bug 1522203 - remove an old pentium pro performance workaround bug 1592557 - fix prng known-answer-test scripts bug 1586176 - encryptupdate should use maxout not block size (cve-2019-11745) bug 1593141 - add `notbefore` or similar "beginning-of-validity-period" parameter to mozilla::pkix::trustdomain::checkrevocation bug 1591363 - fix a pbkdf2 memory leak in nsc_generatekey ...
NSS 3.49 release notes
sts (cve-2019-17023) bug 1600144 - treat clienthello with message_seq of 1 as a second clienthello bug 1603027 - test that esni is regenerated after helloretryrequest bug 1593167 - intermittent mis-reporting potential security risk sec_error_unknown_issuer bug 1535787 - fix automation/release/nss-release-helper.py on macos bug 1594933 - disable building dbm by default bug 1562548 - improve gcm perfomance on aarch32 this bugzilla query returns all the bugs fixed in nss 3.49: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.49 compatibility nss 3.49 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.50 release notes
blems with neon-specific code in freebl bug 1575843 - detect aarch64 cpu features on freebsd bug 1607099 - remove the buildbot configuration bug 1585429 - add more hkdf test vectors bug 1573911 - add more rsa test vectors bug 1605314 - compare all 8 bytes of an mp_digit when clamping in windows assembly/mp_comba bug 1604596 - update wycheproof vectors and add support for cbc, p256-ecdh, and cmac tests bug 1608493 - use aes-ni for non-gcm aes ciphers on platforms with no assembly-optimized implementation, such as macos.
NSS Sample Code Sample1
// bug: xxxxx list = pk11_listprivkeysinslot(slot, mservername, 0); cout << "getprivatekey: list = " << list << endl; if (!list) { rv = 1; goto done; } for(n = privkey_list_head(list); !privkey_list_end(n, list); n = privkey_list_next(n)) { nickname = pk11_getprivatekeynickname(n->key); if (pl_strcmp(nickname, mservername) == 0) break; } if (privkey_list_end(n, list)) { rv = 1; goto done; } *prvkey = seckey_copyprivatekey(n->key); done: if (list) seckey_destroyprivatekeylist(list); return rv; } int server::getpublickey(seckeypublickey **pubkey) { int rv; seckeyprivatekey *prvkey = 0; rv = getprivatekey(&prvkey); if (rv) goto done; *pubkey = seckey_converttopublickey...
NSS Sample Code sample5
e "nss.h" #include "pk11pub.h" #define base64_encoded_subjectpublickeyinfo "mfwwdqyjkozihvcnaqebbqadswawsajbal3f6tic3jeysugo+a2fpu3w+epv/feix21dc86wynpftw4srftz2onuzyluzdhzdb+k//8dct3iaozuui3r2emcaweaaq==" #define base64_encoded_privatekeyinfo "miibvqibadanbgkqhkig9w0baqefaascat8wgge7ageaakeavcxpmhzckriy6cj5rz89tdb4sm/8v4hfbumlzpziekw1biysw3pag1tpittmmdl1v6t//x1xpcga7nrsldhz4widaqabakeajh8+4qncwcmgivnm6ytbpqt+k/jeoexg2bqhjojvnxn3fazgcefxvpuibcjvfaijs9ybcmozzrato0+k2hwnoqihaoc4nvbo8fqhzs4yxm1m86kml47fa9ui//oufbhladw1aiea2dbmixnsbokb+ohver69p0gnewlvcjc9bjdvfdlvslcciqcptv3vgyjv2vdwxqzqahc+yb4gigaqoqbcbmjd3lyflqiga+vtydunoqwtzwve4grf7izk2v5ccnhg3gr5rgwxn58cigccaforruksm66isg0iti04g9v/w+wmx91wjeeb+qbz" int main(int argc, char **argv) { secstatus rv; certcertificate *cert = null...
Utilities for nss samples
/* terminate passphrase */ phrases[i++] = '\0'; /* clean up any eol before the start of the next passphrase */ while ( (i<nb) && (phrases[i] == '\r' || phrases[i] == '\n')) { phrases[i++] = '\0'; } /* now analyze the current passphrase */ phrase = &phrases[startphrase]; if (!tokenname) break; if (port_strncmp(phrase, tokenname, tokenlen)) continue; phraselen = port_strlen(phrase); if (phraselen < (tokenlen+1)) continue; if (phrase[tokenlen] != ':') continue; phrase = &phrase[tokenlen+1]; break; } while (i<nb); phrase = port_strdup((char*)phrase); port_free(phrases); return phrase; } /* * getmodulepassword */ char* getmodulepassword(pk11slot...
NSS sources building testing
nss/cmd contains a set of various tool programs that are built using nss.
nss tech note7
pk11symkey: a symmetric key (often called a session key), defined in "secmodt.h".
PKCS 7 functions
mxr 3.4 and later sec_pkcs7includecertchain mxr 3.2 and later sec_pkcs7iscontentempty mxr 3.2 and later sec_pkcs7setcontent mxr 3.4 and later sec_pkcs7verifydetachedsignature mxr 3.4 and later sec_pkcs7verifysignature mxr 3.2 and later secmime_decryptionallowed mxr 3.4 and later ...
NSS cryptographic module
the nss cryptographic module also exports the function nsc_moduledbfunc for managing the nss module database secmod.db.
NSS Tools Man Pages - work in progress
certutil certutil pk12util pk12util modutil modutil crlutil crlutil cmsutil cmsutil vfychain vfychain vfyserv vfyserv ssltap ssltap this is still a work in progress and in early stages.
OLD SSL Reference
validating certificates cert_verifycertnow cert_verifycertname cert_checkcertvalidtimes nss_cmpcertchainwcanames manipulating certificates cert_dupcertificate cert_destroycertificate getting certificate information cert_findcertbyname cert_getcertnicknames cert_freenicknames cert_getdefaultcertdb ...
sslerr.html
nauthorized_response -8062 "the signer of the ocsp response is not authorized to give status for this certificate." sec_error_ocsp_future_response -8061 "the ocsp response is not yet valid (contains a date in the future)." sec_error_ocsp_old_response -8060 "the ocsp response contains out-of-date information." sec_error_digest_not_found -8059 "the cms or pkcs #7 digest was not found in signed message." sec_error_unsupported_message_type -8058 "the cms or pkcs #7 message type is unsupported." sec_error_module_stuck -8057 "pkcs #11 module could not be removed because it is still in use." sec_error_bad_template -8056 "could not decode asn.1 data.
NSS Tools certutil
ates or a named certificate: validating a certificate: modifying a certificate's trust attribute: displaying a list of the options and arguments used by the certificate database tool: examples creating a new certificate database this example creates a new certificate database (cert8.db file) in the specified directory: certutil -n -d certdir you must generate the associated key3.db and secmod.db files by using the key database tool or other tools.
Rhino optimization
these features have been removed from the language in ecma, so higher optimization levels are now conformant.
The JavaScript Runtime
string java.lang.charsequence (java.lang.string or org.mozilla.javascript.consstring) object org.mozilla.javascript.scriptable in addition, ecma refers to objects that implement [[call]] as functions.
Rhino scopes and contexts
sealed shared scopes the ecmascript standard defines that scripts can add properties to all standard library objects and in many cases it is also possible to change or delete their properties as well.
Scripting Java
note that the ecma standard doesn't cover communication with java (or with any external object system for that matter).
Rhino shell
bad_command: not found js> // passing explicit environment to the system shell js> runcommand("sh", "-c", "echo $env1 $env2", { env: {env1: 100, env2: 200}}) 100 200 0 js> // use args option to provide additional command arguments js> var arg_array = [1, 2, 3, 4]; js> runcommand("echo", { args: arg_array}) 1 2 3 4 0 examples for windows are similar: js> // invoke shell command js> runcommand("cmd", "/c", "date /t") 27.08.2005 0 js> // run sort collectiong the output js> var opt={input: "c\na\nb", output: 'sort output:\n'} js> runcommand("sort", opt) 0 js> print(opt.output) sort output: a b c js> // invoke notepad and wait until it exits js> runcommand("notepad") 0 ...
Exact Stack Rooting
modern c++ compilers are not smart enough to do licm on js::rootedt, so forward declaring a single js::rootedt above the loop and re-using it on every iteration can save some cycles.
Invariants
(taken together, ecma 262-3 §11.13.1 and ecma 262-3 §10.1.4 specify that in an assignment such as x = f(), the name lookup for x occurs before f is called.
JS::ToBoolean
it implements the toboolean operation described in ecma 262 §7.1.2.this function can not fail and the return value is always the boolean conversion of the argument.
JS::ToInt32
it implements the toint32 operator described in ecma 262-3 §9.5.
JS::ToNumber
it implements the tonumber operator described in ecma 262-3 §9.3.
JS::ToPrimitive
description js::toprimitive converts a javascript object, obj, to a primitive value using ecmascript 6 toprimitive.
JS::ToUint16
it implements the toint16 operator described in ecma 262-3 §9.7.
JS::ToUint32
it implements the touint32 operator described in ecma 262-3 §9.5.
JSClass
obsolete since jsapi 44 use null or js_convertstub (spidermonkey 31 or older) for default behavior, which is equivalent to that defined by ecmascript in §8.12.8.
JSConvertOp
description jsconvertop callback specifies conversion behavior for objects having this class, implementing the ecmascript [[defaultvalue]] behavior for them.
JSErrorReport
ucmessage const char16_t * the default unicode error message.
JSExtendedClass.wrappedObject
a wrapper object that wraps an array is considered an array for the purpose of array.prototype.concat and array.concat (which treat array arguments differently from other arguments, per ecma 262-3 §15.4.4.4).
JSObjectOps.getProperty
this reflects the quirky behavior of delete as specified in ecma 262-3 §11.4.1 and ecma 262-3 §8.6.2.5.
JSTraceOp
in that case the embedding can check if the traversal is a part of the marking phase through calling js_isgcmarkingtracer and apply a special code like emptying caches or marking its native structures.
JS_CompareStrings
this function imposes a total order on all javascript strings, the same order imposed by the javascript string comparison operators (<, <=, >, >=), as described in ecma 262-3 § 11.8.5.
JS_ConvertArguments
format can contain one or more instances of the following characters, as appropriate: character c type description b bool boolean c uint16_t ecma uint16_t, unicode character i int32_t ecma int32_t j int32_t ecma int32_t (used to be different, behaves like i now) obsolete since jsapi 28 u uint32_t ecma uint32_t d double ieee double i double integral ieee double s char * (c string) bug 607292 s jsstring * unicode string, accessed by a ...
JS_DefineOwnProperty
description js_defineownproperty implements the ecmascript defined function object.defineproperty.
JS_DeleteElement2
notes per the ecma standard, js_deleteelement2 removes read-only properties from objects as long as they are not also permanent.
JS_DoubleToInt32
this article covers features introduced in spidermonkey 17 convert a c floating-point number of type double to 32-bit integer per ecma spec.
JS_ExecuteScript
in ecmascript terms, the script is executed in a new execution context, but that context is not initialized quite as described in any of the three cases in ecma 262-3 §10.2.
JS_ExecuteScriptVersion
in ecmascript terms, the script is executed in a new execution context, but that context is not initialized quite as described in any of the three cases in ecma 262-3 §10.2.
JS_GetFunctionArity
otherwise fun is implemented in javascript, and the result is the number of identifiers in its formal parameter list (see ecma 262-3 §13).
JS_GetFunctionFlags
see ecma 262-3 §13.
JS_GetGCParameter
jsgc_dynamic_mark_slice / "dynamicmarkslice" if true, high-frequency gcs will use a longer mark slice.
JS_GetGlobalForObject
for function object inputs, the result is "the global object" as referred to in the ecmascript specification.
JS_GetParent
an object created by a script via implicit conversion (the ecmascript toobject operator), an object initializer ({a: 1, b: 2}), or an array initializer ([1, 2, 3]), has the global object as its parent.
JS_GetScopeChain
the ecmascript standard, ecma 262-3 §10, describes execution contexts and scope chains.
JS_InitStandardClasses
these include all the standard ecmascript global properties defined in ecma 262-3 §15.1: array, boolean, date, decodeuri, decodeuricomponent, encodeuri, encodeuricomponent, error, eval, evalerror, function, infinity, isnan, isfinite, math, nan, number, object, parseint, parsefloat, rangeerror, referenceerror, regexp, string, syntaxerror, typeerror, undefined, and urierror as well as a few spidermonkey-specific globals, depen...
JS_LookupElement
the ecmascript standard also specifies this behavior: see ecma 262-3 §11.2.1, step 6.
JS_LooselyEqual
description js_looselyequal determines if v1 is loosely equal to v2 under the javascript == operator, as specified in ecma 262-3 §11.9.3.
JS_New
obsolete since jsapi 32 description js_new creates a new object as though by using the new operator, as described in ecma 262-3 §11.2.2.
JS_NewObject
however, although javascript code can freely redefine constructors, the ecmascript standard requires us in certain cases to use the original constructors' prototypes.
JS_PushArguments
format can contain one or more instances of the following characters, as appropriate: character argument type b jsbool c uint16 (16-bit, unsigned integer) i int32 (32-bit, ecma-compliant signed integer) u uint32 (32-bit, ecma-compliant, unsigned integer) j int32 (32-bit, signed integer) d jsdouble i jsdouble (converted to an integer value) s char * (c string) s jsstring * (unicode string) w jschar * (unicode null-terminated string) o jsobject * f jsfunction * ...
JS_SameValue
this article covers features introduced in spidermonkey 1.8.1 determines if two jsvals are the same, as determined by the samevalue algorithm in ecmascript 262, 5th edition.
JS_SetCallReturnValue2
causes a native to return a reference value (as allowed by ecma 262-3 §11.2.3).
JS_SetGlobalObject
for full ecmascript standard compliance, obj should be of a jsclass that has the jsclass_global_flags flag.
JS_StrictlyEqual
description js_strictlyequal determines if v1 is strictly equal to v2 under the javascript === operator, as specified in ecma 262-3 §11.9.6.
JS_StringToVersion
js_stringtoversion may return any of the following values: string enumeration "1.0" jsversion_1_0 obsolete since jsapi 24 "1.1" jsversion_1_1 obsolete since jsapi 24 "1.2" jsversion_1_2 obsolete since jsapi 24 "1.3" jsversion_1_3 obsolete since jsapi 24 "1.4" jsversion_1_4 obsolete since jsapi 24 "ecmav3" jsversion_ecma_3 "1.5" jsversion_1_5 obsolete since jsapi 24 "1.6" jsversion_1_6 "1.7" jsversion_1_7 "1.8" jsversion_1_8 other jsversion_unknown see also mxr id search for js_stringtoversion jsversion js_getversion js_setversionforcompartment js_versiontostring bug 824312 ...
JS_VersionToString
js_versiontostring may return any of the following values: enumeration string jsversion_1_0 "1.0" obsolete since jsapi 24 jsversion_1_1 "1.1" obsolete since jsapi 24 jsversion_1_2 "1.2" obsolete since jsapi 24 jsversion_1_3 "1.3" obsolete since jsapi 24 jsversion_1_4 "1.4" obsolete since jsapi 24 jsversion_ecma_3 "ecmav3" jsversion_1_5 "1.5" obsolete since jsapi 24 jsversion_1_6 "1.6" jsversion_1_7 "1.7" jsversion_1_8 "1.8" jsversion_ecma_5 "ecmav5" jsversion_default "default" other null see also mxr id search for js_stringtoversion jsversion js_getversion js_setversionforcompartment js_stringtoversion bug 824...
jschar
(see bug 1063962.) as required by the ecmascript standard, ecma 262-3 §4.3.16", javascript strings are arbitrary sequences of 16-bit values.
jsdouble
see ecma 262-3 §8.5.
SpiderMonkey 1.8
the new behavior conforms to the ecmascript standard, ecma 262-3 §11.13.1.
SpiderMonkey 31
vertarguments "j" type deleted apis js_newgrowablestring (can be replaced with js_newucstring) js_isconstructing (can be replaced with callargs::isconstructing or callreceiver::isconstructing) js_valuetoboolean (replaced by js::toboolean) js_valuetonumber (can be replaced with js::tonumber) js_valuetoint64 (replaced by js::toint64) js_valuetouint64 (replaced by js::touint64) js_valuetoecmauint32 (replaced by js::touint32) js_valuetoecmaint32 (replaced by js::toint32) js_valuetoint32 (can be replaced with js::toint32, which has a different behavior!) js_valuetouint16 (replaced by js::touint16) js_valuetostring (replaced by js::tostring) js_definepropertywithtinyid js_defineucpropertywithtinyid js_getobjectid api changes spidermonkey must now be initialized before it can b...
SpiderMonkey 38
this change better aligns with ecmascript's [[preventextensions]] hook, which generally returns true or false to indicate whether subsequent attempts to add a new property will fail, yet also itself may throw in some cases.
SpiderMonkey 45
ing renamed to js_atomizeandpinjsstring (bug 1178581) js_internstringn renamed to js_atomizeandpinstringn (bug 1178581) js_internstring renamed to js_atomizeandpinstring (bug 1178581) js_internucstringn renamed to js_atomizeandpinucstringn (bug 1178581) js_internucstring renamed to js_atomizeandpinucstring (bug 1178581) deleted apis js_getcompartmentstats js_seticumemoryfunctions js_isgcmarkingtracer js_ismarkinggray js_idarraylength js_idarrayget js_destroyidarray js_defaultvalue js_getparent js_setparent js::parsepropertydescriptorobject js_deleteproperty2 js_deletepropertybyid2 js_deleteucproperty2 js_deleteelement2 js_newfunctionbyid js_bindcallable js_decompilefunctionbody js_getlatin1internedstringchars js_gettwobyteinternedstringchars js_newdateobjectmsec ...
Shell global objects
the name is one of: maxbytes maxmallocbytes gcbytes gcnumber mode unusedchunks totalchunks slicetimebudget markstacklimit highfrequencytimelimit highfrequencylowlimit highfrequencyhighlimit highfrequencyheapgrowthmax highfrequencyheapgrowthmin lowfrequencyheapgrowth dynamicheapgrowth dynamicmarkslice allocationthreshold minemptychunkcount maxemptychunkcount compactingenabled refreshframeslicesenabled relazifyfunctions(...) perform a gc and allow relazification of functions.
compare-locales
ab-cd browser chrome/browser browser.dtd +backforwardmenu.tooltip +fullzoomenlargecmd.commandkey3 +fullzoomreducecmd.commandkey2 +fullzoomresetcmd.commandkey2 +organizebookmarks.label -showallbookmarkscmd2.label migration/migration.dtd -importfromfile.accesskey -importfromfile.label +importfromhtmlfile.accesskey +importfromhtmlfile.label you can assume changed strings when you see entities rem...
Secure Development Guidelines
have to be > 512, cut it off there if the input should only be [a-za-z0-9], enforce it cross site scripting (xss) xss is a type of code injection attack typically occurs in web applications injection of arbitrary data into an html document from another site victim’s browser executes those html instructions could be used to steal user credentials think: webmail, online auction, cms, online banking...
Starting WebLock
{ if (strcmp(node->urlstring, url) == 0) { free(node->urlstring); if (prev) prev->next = node->next; free(node); return ns_ok; } prev = node; node = node->next; } return ns_error_failure; } setsites the purpose of setsites is to allow clients to pass an enumeration, or set, of url strings to add to the white list of urls.
Using components
var { cu: utils, ci: interfaces, cc: classes, cr: results, cs: stack, cm: manager, ce: exception, } = components; here is a full breakdown of what is contained in components.
nsDirectoryService
*/ nsresult gettempdir(nsifile **aresult) { nsresult rv; nscomptr<nsiservicemanager> svcmgr; rv = ns_getservicemanager(getter_addrefs(svcmgr)); if (ns_failed(rv)) return rv; nscomptr<nsiproperties> directory; rv = svcmgr->getservicebycontractid("@mozilla.org/file/directory_service;1", ns_get_iid(nsiproperties), getter_addrefs(directory)); if (ns_failed(rv)) return rv; rv = directory->get(...
NS_ShutdownXPCOM
#include "nsxpcom.h" nsresult ns_shutdownxpcom( nsiservicemanager* asvcmanager ); parameters asvcmanager [in] the nsiservicemanager instance that was returned by ns_initxpcom2 (or ns_initxpcom3) or null.
jsdIStackFrame
makes eval() use the last object on its 'obj' param's scope chain as the ecma 'variables object'.
nsICategoryManager
nsresult printallcategories() { nsresult rv; nscomptr<nsiservicemanager> svcmgr; rv = ns_getservicemanager(getter_addrefs(svcmgr)); if (ns_failed(rv)) return rv; nscomptr<nsicategorymanager> catmgr; rv = svcmgr->getservicebycontractid(ns_categorymanager_contractid, ns_get_iid(nsicategorymanager), getter_addrefs(catmgr)); if (ns_failed(rv)) return rv; nscomptr<nsisimpleen...
nsIClipboardDragDropHooks
inherits from: nsisupports last changed in gecko 1.7 embedders who want to have these hooks made available should implement nsiclipboarddragdrophooks and use the command manager to send the appropriate commands with these parameters/settings: command: cmd_clipboarddragdrophook params value type possible values "addhook" isupports nsiclipboarddragdrophooks as nsisupports "removehook" isupports nsiclipboarddragdrophooks as nsisupports note: overrides/hooks need to be added to each window (as appropriate).
getFile
rt" same thing as ns_os_desktop_dir ns_win_desktop_directory "deskp" file sys dir which physically stores objects on desktop ns_win_drives_dir "drivs" ns_win_network_dir "netw" ns_win_nethood_dir "neth" ns_win_fonts_dir "fnts" ns_win_templates_dir "tmpls" ns_win_common_startmenu_dir "cmstrt" ns_win_common_programs_dir "cmprgs" ns_win_common_startup_dir "cmstrt" ns_win_common_desktop_directory "cmdeskp" ns_win_appdata_dir "appdata" ns_win_local_appdata_dir "localappdata" ns_win_printhood "prnthd" ns_win_cookies_dir "cookd" available on unix only these ...
nsIMessageBroadcaster
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.
nsIMessageListenerManager
dom/base/nsimessagemanager.idlscriptable this interface enables clients to listen for messages sent using the nsimessagebroadcaster, nsimessagesender, or nsisyncmessagesender interfaces.
nsIMessageSender
methods void sendasyncmessage([optional] in astring messagename, [optional] in jsval obj, [optional] in jsval objects, [optional] in nsiprincipal principal); sendasyncmessage() send messagename and obj to the "other side" of this message manager.
nsIPromptService
it is equivalent to pressing the escape key (or cmd+.
XPCOM Interface Reference
esnsisupportsarraynsisupportscstringnsisupportscharnsisupportsdoublensisupportsfloatnsisupportsidnsisupportsinterfacepointernsisupportsprboolnsisupportsprint16nsisupportsprint32nsisupportsprint64nsisupportsprtimensisupportspruint8nsisupportspruint16nsisupportspruint32nsisupportspruint64nsisupportsprimitivensisupportsprioritynsisupportsstringnsisupportsvoidnsisupportsweakreferencensisyncjpakensisyncmessagesendernsitxttohtmlconvnsitaggingservicensitaskbarpreviewnsitaskbarpreviewbuttonnsitaskbarpreviewcontrollernsitaskbarprogressnsitaskbartabpreviewnsitaskbarwindowpreviewnsitelemetrynsitextinputprocessornsitextinputprocessorcallbacknsitextinputprocessornotificationnsithreadnsithreadeventfilternsithreadinternalnsithreadmanagernsithreadobservernsithreadpoolnsithreadpoollistenernsitimernsitimercal...
XPCOM Interface Reference by grouping
cessibleeditabletext nsiaccessibleevent nsiaccessiblehyperlink nsiaccessiblehypertext nsiaccessibleimage nsiaccessibleprovider nsiaccessibleretrieval nsiaccessiblerole nsiaccessiblescrolltype nsiaccessibleselectable nsiaccessiblestates nsiaccessibletable nsiaccessibletext nsiaccessibletreecache nsiaccessiblevalue nsiaccessnode nsisyncmessagesender script nsiscriptableunescapehtml nsiscriptableunicodeconverter nsiscripterror nsiscripterror2 stylesheet nsistylesheetservice url nsiuri nsiurl util nsidomserializer nsidomxpathevaluator nsidomxpathexception nsidomxpathexpression nsidomxpathresult xslt nsixsltexception nsixsltprocessor ...
NS_CStringSetDataRange
| with |newval| void replacesubstring(nsacstring& str, const nsacstring& matchval, const nsacstring& newval) { const char* sp, *mp, *np; pruint32 sl, ml, nl; sl = ns_cstringgetdata(str, &sp); ml = ns_cstringgetdata(matchval, &mp); nl = ns_cstringgetdata(newval, &np); for (const char* iter = sp; iter <= sp + sl - ml; ++iter) { if (memcmp(iter, mp, ml) == 0) { pruint32 offset = iter - sp; ns_cstringsetdatarange(str, offset, ml, np, nl); sl = ns_cstringgetdata(str, &sp); iter = sp + offset + nl - 1; } } } history this function was frozen for mozilla 1.7.
NS_StringSetDataRange
acesubstring(nsastring& str, const nsastring& matchval, const nsastring& newval) { const prunichar* sp, *mp, *np; pruint32 sl, ml, nl; sl = ns_stringgetdata(str, &sp); ml = ns_stringgetdata(matchval, &mp); nl = ns_stringgetdata(newval, &np); for (const prunichar* iter = sp; iter <= sp + sl - ml; ++iter) { if (memcmp(iter, mp, ml) == 0) { pruint32 offset = iter - sp; ns_stringsetdatarange(str, offset, ml, np, nl); sl = ns_stringgetdata(str, &sp); iter = sp + offset + nl - 1; } } } history this function was frozen for mozilla 1.7.
nsGetModuleProc
see also nsgetmodule, nsstaticmoduleinfo, nsimodule ...
nsMsgViewCommandType
cmdrequiringmsgbody 20 used with nsimsgdbview.getcommandstatus() to determine if commands requiring the message body (i.e.
XPCOM reference
for example, to request the 'show all threads' view use the constant:nsstaticmoduleinfothis data structure is used by ns_initxpcom3 to specify static xpcom modules.standard xpcom componentsthere are a number of components provided in the standard implementation of xpcom; these are as follows.xpcom glue classesthese "glue" classes are provided to make it easier to use xpcom from c++ code.xpcom interface referencethis is a reference to the xpcom interfaces provided by the moz...
Storage
these are a few simple things you can avoid to help make sure this doesn't happen: open more than one connection to the same file with names that aren't exactly the same as determined by strcmp.
Mozilla
svg is to graphics what xhtml is to text, mathml is to mathematical equations and cml is to the description of chemical molecules.
Introduction to DOM Inspector - Firefox Developer Tools
the dom inspector is a mozilla extension that you can access from the tools > web development menu in seamonkey, or by selecting the dom inspector menu item from the tools menu in firefox and thunderbird, or by using ctrl/cmd+shift+i in either application.
Browser Toolbox - Firefox Developer Tools
you can also open it with the ctrl + alt +shift + i key combination ( cmd + opt +shift + i on a mac).
Open the debugger - Firefox Developer Tools
there are three ways to open the debugger: select "debugger" from the web developer submenu in the firefox menu (or tools menu if you display the menu bar or are on mac os x) press ctrl + shift + z on windows and linux, or cmd + opt + z on macos (starting in firefox 71; prior to firefox 66, the letter in this shortcut was s).
Search - Firefox Developer Tools
press shift + ctrl + f (windows and linux) or shift + cmd + f (macos) and then enter the string you are trying to find.
Debugger.Source - Firefox Developer Tools
the value satisfies the program, functiondeclaration, or functionexpression productions in the ecmascript standard.
Network request list - Firefox Developer Tools
you can focus it by clicking in the filter box, or by pressing ctrl + f (or cmd + f on a mac); then start typing.
Responsive Design Mode - Firefox Developer Tools
from the developer tools toolbox: press the responsive design mode button in the toolbox's toolbar: from the keyboard: press ctrl + shift + m (or cmd + opt + m on macos).
Storage Inspector - Firefox Developer Tools
you can use ctrl + f (cmd + f on a mac) to focus the search box.
View Source - Firefox Developer Tools
to activate view source: context-click in the page and select view page source press ctrl + u on windows and linux, or cmd + u on macos the command opens a new tab with the source for the current page.
Web Console UI Tour - Firefox Developer Tools
note: you can clear the contents of the console by entering the keyboard command ctrl + shift + l (windows, macos, and linux) or cmd + k on macos.
Firefox Developer Tools
the core tools you can open the firefox developer tools from the menu by selecting tools > web developer > toggle tools or use the keyboard shortcut ctrl + shift + i or f12 on windows and linux, or cmd + opt + i on macos.
AudioBuffer.duration - Web APIs
the duration property of the audiobuffer interface returns a double representing the duration, in seconds, of the pcm data stored in the buffer.
AudioBuffer.getChannelData() - Web APIs
the 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).
AudioBuffer.length - Web APIs
the length property of the audiobuffer interface returns an integer representing the length, in sample-frames, of the pcm data stored in the buffer.
AudioBuffer.numberOfChannels - Web APIs
the numberofchannels property of the audiobuffer interface returns an integer representing the number of discrete audio channels described by the pcm data stored in the buffer.
AudioBuffer.sampleRate - Web APIs
the samplerate property of the audiobuffer interface returns a float representing the sample rate, in samples per second, of the pcm data stored in the buffer.
CSS numeric factory functions - Web APIs
syntax css.number(number); css.percent(number); // <length> css.em(number); css.ex(number); css.ch(number); css.ic(number); css.rem(number); css.lh(number); css.rlh(number); css.vw(number); css.vh(number); css.vi(number); css.vb(number); css.vmin(number); css.vmax(number); css.cm(number); css.mm(number); css.q(number); css.in(number); css.pt(number); css.pc(number); css.px(number); // <angle> css.deg(number); css.grad(number); css.rad(number); css.turn(number); // <time> css.s(number); css.ms(number); // <frequency> css.hz(number); css.khz(number); // <resolution> css.dpi(number); css.dpcm(number); css.dppx(number); // <flex> css.fr(number); examples we use the css...
CSSNumericValue.add() - Web APIs
examples let mathsum = css.px("23").add(css.percent("4")).add(css.cm("3")).add(css.in("9")); // prints "calc(23px + 4% + 3cm + 9in)" console.log(mathsum.tostring()); specifications specification status comment css typed om level 1the definition of 'add' in that specification.
CSSNumericValue.equals() - Web APIs
let cssmathsum = new cssmathsum(css.px(1), css.px(2)); let matchingcssmathsum = new cssmathsum(css.px(1), css.px(2)); // prints true console.log(cssmathsum.equals(matchingcssmathsum)); let othercssmathsum = cssmathsum(css.px(2), css.px(1)); // prints false console.log(cssmathsum.equals(othercssmathsum)); // also prints false console.log(css.cm("1").equal(css.in("0.393701"))); specifications specification status comment css typed om level 1the definition of 'equals' in that specification.
CSSNumericValue.max() - Web APIs
// prints "2cm" console.log(css.cm("1").max(css.cm("2")).tostring()); // prints "max(1cm, 0.393701in)" console.log(css.cm("1").max(css.in("0.393701")).tostring()); specifications specification status comment css typed om level 1the definition of 'max' in that specification.
CSSNumericValue.min() - Web APIs
// prints "1cm" console.log(css.cm("1").min(css.cm("2")).tostring()); // prints "max(1cm, 0.393701in)" console.log(css.cm("1").max(css.in("0.393701")).tostring()); specifications specification status comment css typed om level 1the definition of 'min' in that specification.
CSSNumericValue.mul() - Web APIs
examples let mathsum = css.px("23").mul(css.percent("4")).mul(css.cm("3")).mul(css.in("9")); // prints "calc(23px * 4% * 3cm * 9in)" console.log(mathsum.tostring()); specifications specification status comment css typed om level 1the definition of 'mul' in that specification.
CSSNumericValue.sub() - Web APIs
examples let mathsum = css.px("23").sum(css.percent("4")).sum(css.cm("3")).sum(css.in("9")); // prints "calc(23px - 4% - 3cm - 9in)" console.log(mathsum.tostring()); and/or include a list of links to useful code samples that live elsewhere: specifications specification status comment css typed om level 1the definition of 'sub' in that specification.
CSSNumericValue.sum() - Web APIs
examples let mathsum = css.px("23").sum(css.percent("4")).sum(css.cm("3")).sum(css.in("9")); // prints "calc(23px - 4% - 3cm - 9in)" console.log(mathsum.tostring()); and/or include a list of links to useful code samples that live elsewhere: specifications specification status comment css typed om level 1the definition of 'sub' in that specification.
CSSNumericValue.to() - Web APIs
examples // prints "0.608542cm" console.log(css.px("23").to("com").tostring()); specifications specification status comment css typed om level 1the definition of 'to' in that specification.
CSSNumericValue.toSum() - Web APIs
examples let v = css.px("23").add(css.percent("4")).add(css.cm("3")).add(css.in("9")); v.tostring() // => "calc(23px + 4% + 3cm + 9in)" v.tosum("px", "percent").tostring() // => "calc(1000.39px + 4%)" specifications specification status comment css typed om level 1the definition of 'tosum' in that specification.
CSSNumericValue.type - Web APIs
examples let mathsum = css.px("23").sub(css.percent("4")).sub(css.cm("3")).sub(css.in("9")); // returns an object with the structure: {length: 1, percenthint: "length"} let cssnumerictype = mathsum.type(); specifications specification status comment css typed om level 1the definition of 'type' in that specification.
CSSPrimitiveValue.primitiveType - Web APIs
css_cm the value is a <length> in centimeters.
CSSPrimitiveValue.setFloatValue() - Web APIs
valid values are: constant description css_cm the value is a <length> in centimeters.
CSSPrimitiveValue - Web APIs
css_cm the value is a <length> in centimeters.
CSSStyleSheet.insertRule() - Web APIs
* note that an array is needed for declarations and rules since ecmascript does * not guarantee a predictable object iteration order, and since css is * order-dependent.
console - Web APIs
WebAPIConsole
styling console output you can use the %c directive to apply a css style to console output: console.log("this is %cmy stylish message", "color: yellow; font-style: italic; background-color: blue;padding: 2px"); the text before the directive will not be affected, but the text after the directive will be styled using the css declarations in the parameter.
DeviceProximityEvent.max - Web APIs
syntax var value = instanceofdeviceproximityevent.max; value a positive number indicating the maximum distance, in centimeters (cm), that the device's proximity sensor is able to detect and report.
DeviceProximityEvent.min - Web APIs
syntax var value = instanceofdeviceproximityevent.min; value a positive number indicating the minimum distance, in centimeters (cm), the device's proximity sensor can report.
DeviceProximityEvent.value - Web APIs
syntax var distance = instanceofdeviceproximityevent.value; value a positive number representing a distance in centimeters (cm) between the device's proximity sensor and the detected object.
Event.explicitOriginalTarget - Web APIs
function mycommand(ev) { alert(ev.explicitoriginaltarget.nodename); // returns 'menuitem' } <xul:command id="my-cmd-anaction" oncommand="mycommand(event);"/> <xul:menulist> <xul:menupopup> <xul:menuitem label="get my element name!" command="my-cmd-anaction"/> </xul:menupopup> </menulist> specifications this is a mozilla-specific property.
HTMLElement.dir - Web APIs
WebAPIHTMLElementdir
firefox uses ctrl/cmd + shift + x but does not update the dir attribute value.
HTMLImageElement.sizes - Web APIs
it may be specified using font-relative units (such as em or ex), absolute units (such as px or cm), or the vw unit, which lets you specify the width as a percentage of the viewport width (1vw being 1% of the viewport width).
Ajax navigation example - Web APIs
"loop detected", 509: "unassigned", 510: "not extended", 511: "network authentication required" }; var oreq, bisloading = false, bupdateurl = false; oloadingbox.id = "ajax-loader"; ocover.onclick = abortreq; oloadingimg.src = "data:image/gif;base64,r0lgodlheaaqapiaap///waaamlcwkjcqgaaagjiyokcgpkskih/c05fvfndqvbfmi4waweaaaah/hpdcmvhdgvkihdpdgggywphegxvywquaw5mbwah+qqjcgaaacwaaaaaeaaqaaadmwi63p4wyklre2mioggznadomgyjrbexwroumcg2lmdewnhqlvsyod2mbzkydadka+diaaah+qqjcgaaacwaaaaaeaaqaaadnai63p5ojcegg4qmu7dmikrxqlfuydezigbmrvsaqhwctxxf7weyb4ag1xjihkmzsiukkhiaifkecqoaaaasaaaaabaaeaaaazyiujijk8pbyjdmlfyvbovjha70gu7xsujhmktwhpakzlo9hmaokwjz7rf8aypddzkpzbqfvwqaifkecqoaaaasaaaaabaaeaaaazmiumilk8oyhphsnfzfhyumcyuhdaqxridhhbgqrokw0r8dyl...
IDBKeyRange.includes() - Web APIs
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 definitio...
Key Values - Web APIs
appcommand_microphone_volume_mute gdk_key_audiomicmute (0x1008ffb2) qt::key_micmute (0x01000113) keycode_mute (91) "microphonevolumeup" increases the microphone's input volume.
MediaDevices.ondevicechange - Web APIs
this uses destructuring assignment (a new feature of ecmascript 6) to assign the values of the first three items in the array returned by string.match() to the variables kind, type, and direction.
RTCIceCandidate.candidate - Web APIs
this example could be simplified somewhat; you may more often see the code look something like this, taking advantage of more advanced ecmascript 2016 features: let handlenewicecandidate = candidatesdp => mypeerconnection.addicecandidate(new rtcicecandidate(candidatesdp)); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecandidate.candidate' in that specification.
RTCRtpStreamStats - Web APIs
trackid a domstring which uniquely identifies the rtcmediastreamtrackstats object representing the associated mediastreamtrack.
RTCSessionDescription.sdp - Web APIs
syntax var value = sessiondescription.sdp; sessiondescription.sdp = value; value the value is a domstring containing an sdp message like this one: v=0 o=alice 2890844526 2890844526 in ip4 host.anywhere.com s= c=in ip4 host.anywhere.com t=0 0 m=audio 49170 rtp/avp 0 a=rtpmap:0 pcmu/8000 m=video 51372 rtp/avp 31 a=rtpmap:31 h261/90000 m=video 53000 rtp/avp 32 a=rtpmap:32 mpv/90000 example // the remote description has been set previously on pc, an rtcpeerconnection alert(pc.remotedescription.sdp); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsessiondescription.sdp'...
SVGTransformList - Web APIs
<svg id="my-svg" viewbox="0 0 300 280" xmlns="http://www.w3.org/2000/svg" version="1.1"> <desc>example showing how to transform svg elements that using svgtransform objects</desc> <script type="application/ecmascript"> <![cdata[ function transformme(evt) { // svg root element to access the createsvgtransform() function var svgroot = evt.target.parentnode; // svgtransformlist of the element that has been clicked on var tfmlist = evt.target.transform.baseval; // create a seperate transform object for each transform var translate = svgroot.createsvgtransform(); ...
ServiceWorkerGlobalScope.onsync - Web APIs
this is triggered when a call to syncmanager.register is made from a service worker client page.
ServiceWorkerGlobalScope - Web APIs
sync triggered when a call to syncmanager.register is made from a service worker client page.
Service Worker API - Web APIs
syncmanager provides an interface for registering and listing sync registrations.
SubtleCrypto.exportKey() - Web APIs
*/ window.crypto.subtle.generatekey( { name: "aes-gcm", length: 256, }, true, ["encrypt", "decrypt"] ).then((key) => { const exportbutton = document.queryselector(".raw"); exportbutton.addeventlistener("click", () => { exportcryptokey(key); }); }); pkcs #8 export this example exports an rsa private signing key as a pkcs #8 object.
SubtleCrypto - Web APIs
est() derivebits() derivekey() wrapkey() unwrapkey() rsassa-pkcs1-v1_5 ✓ rsa-pss ✓ ecdsa ✓ hmac ✓ rsa-oaep ✓ ✓ aes-ctr ✓ ✓ aes-cbc ✓ ✓ aes-gcm ✓ ✓ sha-1 ✓ sha-256 ✓ sha-384 ✓ sha-512 ✓ ecdh ✓ hkdf ✓ pbkdf2 ✓ aes-kw ✓ specifications specification status comm...
TextDecoder() - Web APIs
, "l3", "latin3" 'iso-8859-3' "csisolatin4", "iso-8859-4", "iso-ir-110", "iso8859-4", "iso88594", "iso_8859-4", "iso_8859-4:1988", "l4", "latin4" 'iso-8859-4' "csisolatincyrillic", "cyrillic", "iso-8859-5", "iso-ir-144", "iso88595", "iso_8859-5", "iso_8859-5:1988" 'iso-8859-5' "arabic", "asmo-708", "csiso88596e", "csiso88596i", "csisolatinarabic", "ecma-114", "iso-8859-6", "iso-8859-6-e", "iso-8859-6-i", "iso-ir-127", "iso8859-6", "iso88596", "iso_8859-6", "iso_8859-6:1987" 'iso-8859-6' "csisolatingreek", "ecma-118", "elot_928", "greek", "greek8", "iso-8859-7", "iso-ir-126", "iso8859-7", "iso88597", "iso_8859-7", "iso_8859-7:1987", "sun_eu_greek" 'iso-8859-7' "csiso88598e", "csisolatinhebrew", "hebrew", "iso-8859...
WebGL model view projection - Web APIs
in the mdn webgl shared code you'll find the mdn.orthographicmatrix().
A simple RTCDataChannel sample - Web APIs
they make it very easy to chain the steps of the connection process together; if you haven't already read up on this functionality of ecmascript 2015, you should read up on them.
Basic concepts behind Web Audio API - Web APIs
created from raw pcm data (the audio context has methods to decode supported audio formats).
Web Authentication API - Web APIs
- service): rp: { name: "acme" }, // user: user: { id: new uint8array(16), name: "john.p.smith@example.com", displayname: "john p.
-webkit-mask-position-x - CSS: Cascading Style Sheets
/* keyword values */ -webkit-mask-position-x: left; -webkit-mask-position-x: center; -webkit-mask-position-x: right; /* <percentage> values */ -webkit-mask-position-x: 100%; -webkit-mask-position-x: -50%; /* <length> values */ -webkit-mask-position-x: 50px; -webkit-mask-position-x: -1cm; /* multiple values values */ -webkit-mask-position-x: 50px, 25%, -3em; /* global values */ -webkit-mask-position-x: inherit; -webkit-mask-position-x: initial; -webkit-mask-position-x: unset; initial value0%applies toall elementsinheritednopercentagesrefer to the size of the box itselfcomputed valuefor <length> the absolute value, otherwise a percentageanimation typediscrete syntax values <len...
-webkit-mask-position-y - CSS: Cascading Style Sheets
/* keyword values */ -webkit-mask-position-y: top; -webkit-mask-position-y: center; -webkit-mask-position-y: bottom; /* <percentage> values */ -webkit-mask-position-y: 100%; -webkit-mask-position-y: -50%; /* <length> values */ -webkit-mask-position-y: 50px; -webkit-mask-position-y: -1cm; /* multiple values values */ -webkit-mask-position-y: 50px, 25%, -3em; /* global values */ -webkit-mask-position-y: inherit; -webkit-mask-position-y: initial; -webkit-mask-position-y: unset; initial value0%applies toall elementsinheritednopercentagesrefer to the size of the box itselfcomputed valuefor <length> the absolute value, otherwise a percentageanimation typediscrete syntax values <lengt...
system - CSS: Cascading Style Sheets
html <ul class="list"> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> </ul> css @counter-style upper-roman { system: additive; range: 1 3999; additive-symbols: 1000 m, 900 cm, 500 d, 400 cd, 100 c, 90 xc, 50 l, 40 xl, 10 x, 9 ix, 5 v, 4 iv, 1 i; } ul { list-style: upper-roman; } result extends example this example will use the algorithm, symbols, and other properties of the lower-alpha counter style, but will remove the period ('.') after the counter representation, and enclose the characters in paranthesis; like (a), (b), etc.
@page - CSS: Cascading Style Sheets
WebCSS@page
syntax @page { margin: 1cm; } @page :first { margin: 2cm; } descriptors size specifies the target size and orientation of the page box’s containing block.
max-height - CSS: Cascading Style Sheets
syntax /* keyword value */ max-height: auto; /* <length> values */ max-height: 400px; max-height: 50em; max-height: 20cm; /* <percentage> value */ max-height: 75%; values auto the used value is calculated from the other css descriptors' values.
max-width - CSS: Cascading Style Sheets
syntax /* keyword value */ max-width: auto; /* <length> values */ max-width: 600px; max-width: 80em; max-width: 15cm; /* <percentage> value */ max-width: 75%; values auto the used value is calculated from the other css descriptors' values.
min-height - CSS: Cascading Style Sheets
syntax /* keyword value */ min-height: auto; /* <length> values */ min-height: 120px; min-height: 20em; min-height: 10cm; /* <percentage> value */ min-height: 25%; values auto the used value is calculated from the other css descriptors' values.
min-width - CSS: Cascading Style Sheets
syntax /* keyword value */ min-width: auto; /* <length> values */ min-width: 320px; min-width: 40em; min-width: 5cm; /* <percentage> value */ min-width: 25%; values auto the used value is calculated from the other css descriptors' values.
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
adding: 10px; } .listing { list-style: none; margin: 2em; display: grid; grid-gap: 20px; grid-auto-flow: dense; grid-template-columns: repeat(auto-fill,minmax(200px, 1fr)); } .listing .wide { grid-column-end: span 2; } this technique of using auto-placement with some rules applied to certain items is very useful, and can help you to deal with content that is being output by a cms for example, where you have repeated items and can perhaps add a class to certain ones as they are rendered into the html.
background-position-x - CSS: Cascading Style Sheets
syntax /* keyword values */ background-position-x: left; background-position-x: center; background-position-x: right; /* <percentage> values */ background-position-x: 25%; /* <length> values */ background-position-x: 0px; background-position-x: 1cm; background-position-x: 8em; /* side-relative values */ background-position-x: right 3px; background-position-x: left 25%; /* multiple values */ background-position-x: 0px, center; /* global values */ background-position-x: inherit; background-position-x: initial; background-position-x: unset; the background-position-x property is specified as one or more values, separated by commas.
background-position-y - CSS: Cascading Style Sheets
syntax /* keyword values */ background-position-y: top; background-position-y: center; background-position-y: bottom; /* <percentage> values */ background-position-y: 25%; /* <length> values */ background-position-y: 0px; background-position-y: 1cm; background-position-y: 8em; /* side-relative values */ background-position-y: bottom 3px; background-position-y: bottom 10%; /* multiple values */ background-position-y: 0px, center; /* global values */ background-position-y: inherit; background-position-y: initial; background-position-y: unset; the background-position-y property is specified as one or more values, separated by commas.
border-spacing - CSS: Cascading Style Sheets
syntax /* <length> */ border-spacing: 2px; /* horizontal <length> | vertical <length> */ border-spacing: 1cm 2em; /* global values */ border-spacing: inherit; border-spacing: initial; border-spacing: unset; the border-spacing property may be specified as either one or two values.
border-width - CSS: Cascading Style Sheets
is a shorthand for the following css properties: border-bottom-width border-left-width border-right-width border-top-width syntax /* keyword values */ border-width: thin; border-width: medium; border-width: thick; /* <length> values */ border-width: 4px; border-width: 1.2rem; /* vertical | horizontal */ border-width: 2px 1.5em; /* top | horizontal | bottom */ border-width: 1px 2em 1.5cm; /* top | right | bottom | left */ border-width: 1px 2em 0 4rem; /* global keywords */ border-width: inherit; border-width: initial; border-width: unset; the border-width property may be specified using one, two, three, or four values.
color - CSS: Cascading Style Sheets
WebCSScolor
adds hwb(), device-cmyk(), and color() functions.
fit-content() - CSS: Cascading Style Sheets
/* <length> values */ fit-content(200px) fit-content(5cm) fit-content(30vw) fit-content(100ch) /* <percentage> value */ fit-content(40%) values <length> an absolute length.
font-stretch - CSS: Cascading Style Sheets
html <div class="container"> <p class="condensed">an elephantine lizard</p> <p class="normal">an elephantine lizard</p> <p class="expanded">an elephantine lizard</p> </div> css /* this example uses the league mono variable font, developed by tyler finck (https://www.tylerfinck.com/) and used here under the terms of the sil open font license, version 1.1: http://scripts.sil.org/cms/scripts/page.php?item_id=ofl_web */ @font-face { src: url('https://mdn.mozillademos.org/files/16014/leaguemonovariable.ttf'); font-family:'leaguemonovariable'; font-style: normal; font-stretch: 1% 500%; /* required by chrome */ } .container { border: 10px solid #f5f9fa; padding: 0 1rem; font: 1.5rem 'leaguemonovariable', sans-serif; } .condensed { font-stretch: 50%; } .normal...
font-variant-numeric - CSS: Cascading Style Sheets
ic-spacing-values> = [ proportional-nums | tabular-nums ]<numeric-fraction-values> = [ diagonal-fractions | stacked-fractions ] examples setting ordinal numeric forms html <p class="ordinal">1st, 2nd, 3rd, 4th, 5th</p> css /* this example uses the source sans pro opentype font, developed by adobe and used here under the terms of the sil open font license, version 1.1: http://scripts.sil.org/cms/scripts/page.php?item_id=ofl_web */ @font-face { font-family: "source sans pro"; font-style: normal; font-weight: 400; src: url("https://mdn.mozillademos.org/files/15757/sourcesanspro-regular.otf") format("opentype"); } .ordinal { font-variant-numeric: ordinal; font-family: "source sans pro"; } result specifications specification status comment css...
gap (grid-gap) - CSS: Cascading Style Sheets
WebCSSgap
syntax /* one <length> value */ gap: 20px; gap: 1em; gap: 3vmin; gap: 0.5cm; /* one <percentage> value */ gap: 16%; gap: 100%; /* two <length> values */ gap: 20px 10px; gap: 1em 0.5em; gap: 3vmin 2vmax; gap: 0.5cm 2mm; /* one or two <percentage> values */ gap: 16% 100%; gap: 21px 82%; /* calc() values */ gap: calc(10% + 20px); gap: calc(20px + 10%) calc(10% - 5px); /* global values */ gap: inherit; gap: initial; gap: unset; this property is specified as a value fo...
grid-auto-rows - CSS: Cascading Style Sheets
syntax /* keyword values */ grid-auto-rows: min-content; grid-auto-rows: max-content; grid-auto-rows: auto; /* <length> values */ grid-auto-rows: 100px; grid-auto-rows: 20cm; grid-auto-rows: 50vmax; /* <percentage> values */ grid-auto-rows: 10%; grid-auto-rows: 33.3%; /* <flex> values */ grid-auto-rows: 0.5fr; grid-auto-rows: 3fr; /* minmax() values */ grid-auto-rows: minmax(100px, auto); grid-auto-rows: minmax(max-content, 2fr); grid-auto-rows: minmax(20%, 80vmax); /* multiple track-size values */ grid-auto-rows: min-content max-content auto; grid-auto-rows: 100...
image-set() - CSS: Cascading Style Sheets
WebCSSimage-set
<resolution> units include x or dppx, for dots per pixel unit, dpi, for dots per inch, and dpcm for dots per centimeter.
mask - CSS: Cascading Style Sheets
WebCSSmask
(if given a <length>), otherwise as a percentage.mask-clip: as specifiedmask-origin: as specifiedmask-size: as specified, but with relative lengths converted into absolute lengthsmask-composite: as specifiedanimation typeas each of the properties of the shorthand:mask-image: discretemask-mode: discretemask-repeat: discretemask-position: repeatable list of simple list of length, percentage, or calcmask-clip: discretemask-origin: discretemask-size: repeatable list of simple list of length, percentage, or calcmask-composite: discretecreates stacking contextyes formal syntax <mask-layer>#where <mask-layer> = <mask-reference> | <position> [ / <bg-size> ]?
offset-anchor - CSS: Cascading Style Sheets
syntax /* keyword values */ offset-anchor: top; offset-anchor: bottom; offset-anchor: left; offset-anchor: right; offset-anchor: center; offset-anchor: auto; /* <percentage> values */ offset-anchor: 25% 75%; /* <length> values */ offset-anchor: 0 0; offset-anchor: 1cm 2cm; offset-anchor: 10ch 8em; /* edge offsets values */ offset-anchor: bottom 10px right 20px; offset-anchor: right 3em bottom 10px; /* global values */ offset-anchor: inherit; offset-anchor: initial; offset-anchor: unset; values auto offset-anchor is given the same value as the element's transform-origin, unless offset-path is none, in which case it takes its value from offset-position.
offset-position - CSS: Cascading Style Sheets
syntax /* keyword values */ offset-position: auto; offset-position: top; offset-position: bottom; offset-position: left; offset-position: right; offset-position: center; /* <percentage> values */ offset-position: 25% 75%; /* <length> values */ offset-position: 0 0; offset-position: 1cm 2cm; offset-position: 10ch 8em; /* edge offsets values */ offset-position: bottom 10px right 20px; offset-position: right 3em bottom 10px; offset-position: bottom 10px right; offset-position: top right 10px; /* global values */ offset-position: inherit; offset-position: initial; offset-position: unset; values auto the initial position is the position of the box specified by the position property.
offset - CSS: Cascading Style Sheets
WebCSSoffset
e; /* offset path */ offset: ray(45deg closest-side); offset: path('m 100 100 l 300 100 l 200 300 z'); offset: url(arc.svg); /* offset path with distance and/or rotation */ offset: url(circle.svg) 100px; offset: url(circle.svg) 40%; offset: url(circle.svg) 30deg; offset: url(circle.svg) 50px 20deg; /* including offset anchor */ offset: ray(45deg closest-side) / 40px 20px; offset: url(arc.svg) 2cm / 0.5cm 3cm; offset: url(arc.svg) 30deg / 50px 100px; formal definition initial valueas each of the properties of the shorthand:offset-position: autooffset-path: noneoffset-distance: 0offset-anchor: autooffset-rotate: autoapplies totransformable elementsinheritednopercentagesas each of the properties of the shorthand:offset-position: refertosizeofcontainingblockoffset-distance: refer to the to...
padding-bottom - CSS: Cascading Style Sheets
syntax /* <length> values */ padding-bottom: 0.5em; padding-bottom: 0; padding-bottom: 2cm; /* <percentage> value */ padding-bottom: 10%; /* global values */ padding-bottom: inherit; padding-bottom: initial; padding-bottom: unset; the padding-bottom property is specified as a single value chosen from the list below.
padding-left - CSS: Cascading Style Sheets
syntax /* <length> values */ padding-left: 0.5em; padding-left: 0; padding-left: 2cm; /* <percentage> value */ padding-left: 10%; /* global values */ padding-left: inherit; padding-left: initial; padding-left: unset; the padding-left property is specified as a single value chosen from the list below.
padding-right - CSS: Cascading Style Sheets
syntax /* <length> values */ padding-right: 0.5em; padding-right: 0; padding-right: 2cm; /* <percentage> value */ padding-right: 10%; /* global values */ padding-right: inherit; padding-right: initial; padding-right: unset; the padding-right property is specified as a single value chosen from the list below.
padding-top - CSS: Cascading Style Sheets
syntax /* <length> values */ padding-top: 0.5em; padding-top: 0; padding-top: 2cm; /* <percentage> value */ padding-top: 10%; /* global values */ padding-top: inherit; padding-top: initial; padding-top: unset; the padding-top property is specified as a single value chosen from the list below.
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
WebCSSrow-gap
syntax /* <length> values */ row-gap: 20px; row-gap: 1em; row-gap: 3vmin; row-gap: 0.5cm; /* <percentage> value */ row-gap: 10%; /* global values */ row-gap: inherit; row-gap: initial; row-gap: unset; values <length-percentage> is the width of the gutter separating the rows.
Event reference
mozbrowseropentab firefox os browser api-specific sent when a new tab is opened within a browser <iframe> as a result of the user issuing a command to open a link target in a new tab (for example ctrl/cmd + click.) mozbrowseropenwindow firefox os browser api-specific sent when window.open() is called within a browser iframe.
Cross-browser audio basics - Developer guides
ernet explorer 9+ opera 10.5+ safari 4+ mobile mobile browser version chrome (android) 32+ firefox (android) 26+ ie mobile 10+ opera mobile 11+ safari (ios) 4+ android browser 2.3+ blackberry 7+ audio codec support browser ogg mp3 aac pcm opus firefox 3.5+ ✓ ✓ *26+ ✓ ✓ *14+ safari 5+ ✓ ✓ chrome 6+ ✓ ✓ ✓ ✓ *9+ opera 10.5+ ✓ internet explorer 9+ ✓ ✓ firefox mobile ✓ ✓ ✓ ✓ ✓ safari ios3+ ✓ ✓ ✓ *4.2+ ...
Constraint validation - Developer guides
validation-related attributes in addition to the type attribute described above, the following attributes are used to describe basic constraints: attribute input types supporting the attribute possible values constraint description associated violation pattern text, search, url, tel, email, password a javascript regular expression (compiled with the ecmascript 5 global, ignorecase, and multiline flags disabled) the value must match the pattern.
Writing forward-compatible websites - Developer guides
to avoid this, fully qualify global variable access using "window.", like so: <script> function localname() { alert('function localname has been called'); } </script> <div onclick="window.localname()">clicking me should show an alert<div> don't concatenate scripts you don't control the "use strict;" directive in ecmascript, when used on the file level, applies to everything in the file.
The HTML autocomplete attribute - HTML: Hypertext Markup Language
"organization" a company or organization name, such as "acme widget company" or "girl scouts of america".
<dl>: The Description List element - HTML: Hypertext Markup Language
WebHTMLElementdl
</dd> <dd> the red panda also known as the lesser panda, wah, bear cat or firefox, is a mostly herbivorous mammal, slightly larger than a domestic cat (60 cm long).
<template>: The Content Template element - HTML: Hypertext Markup Language
WebHTMLElementtemplate
ar clone = template.content.clonenode(true); var td = clone.queryselectorall("td"); td[0].textcontent = "1235646565"; td[1].textcontent = "stuff"; tbody.appendchild(clone); // clone the new row and insert it into the table var clone2 = template.content.clonenode(true); td = clone2.queryselectorall("td"); td[0].textcontent = "0384928528"; td[1].textcontent = "acme kidney beans 2"; tbody.appendchild(clone2); } else { // find another way to add the rows to the table because // the html template element is not supported.
dir - HTML: Hypertext Markup Language
firefox uses ctrl/cmd + shift + x but does not update the dir attribute value.
Data URLs - HTTP
data:text/plain;base64,sgvsbg8sifdvcmxkiq== base64-encoded version of the above data:text/html,%3ch1%3ehello%2c%20world!%3c%2fh1%3e an html document with <h1>hello, world!</h1> data:text/html,<script>alert('hi');</script> an html document that executes a javascript alert.
HTTP conditional requests - HTTP
common web sites, like wikis and other cms, have such a need.
Closures - JavaScript
creating closures in loops: a common mistake prior to the introduction of the let keyword in ecmascript 2015, a common problem with closures occurred when you created them inside a loop.
Details of the object model - JavaScript
note that ecmascript 2015 introduces a class declaration: javascript classes, introduced in ecmascript 2015, are primarily syntactical sugar over javascript's existing prototype-based inheritance.
Assertions - JavaScript
]/gi console.log(orangenotlemon.match(selectnotorangeregex)); // [ ' yes, i do not want to have a lemon!' ] lookbehind assertion let oranges = ['ripe orange a ', 'green orange b', 'ripe orange c',]; let ripe_oranges = oranges.filter( fruit => fruit.match(/(?<=ripe )orange/)); console.log(ripe_oranges); // [ 'ripe orange a ', 'ripe orange c' ] specifications specification ecmascript (ecma-262)the definition of 'regexp: assertions' in that specification.
Regular expression syntax cheatsheet - JavaScript
for example, /\cm/ matches "\r" in "\r\n".
Groups and ranges - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'regexp: ranges' in that specification.
Quantifiers - JavaScript
one or several times console.log(text.match(greedyregexp)[0]); // "i must be getting somewhere near the centre of the earth" // almost all of the text matches (leaves out the dot character) var nongreedyregexp = /[\w ]+?/; // notice the question mark console.log(text.match(nongreedyregexp)); // "i" // the match is the smallest one possible specifications specification ecmascript (ecma-262)the definition of 'regexp: quantifiers' in that specification.
Regular expressions - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'regexp' in that specification.
JavaScript Guide - JavaScript
chapters this guide is divided into several chapters: introduction about this guide about javascript javascript and java ecmascript tools hello world grammar and types basic syntax & comments declarations variable scope variable hoisting data structures and types literals control flow and error handling if...else switch try/catch/throw error objects loops and iteration for while do...while break/continue for..in for..of functions defining functions calling functions function scope closures arguments & pa...
constructor - JavaScript
super(); } } class rectangle {} object.setprototypeof(square.prototype, rectangle.prototype); console.log(object.getprototypeof(square.prototype) === polygon.prototype); //false console.log(object.getprototypeof(square.prototype) === rectangle.prototype); //true let newinstance = new square(); console.log(newinstance.name); //polygon specifications specification ecmascript (ecma-262)the definition of 'constructor method' in that specification.
extends - JavaScript
class mydate extends date { getformatteddate() { var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']; return this.getdate() + '-' + months[this.getmonth()] + '-' + this.getfullyear(); } } specifications specification ecmascript (ecma-262)the definition of 'extends' in that specification.
Deprecated and obsolete features - JavaScript
string.prototype.substr probably won't be removed anytime soon, but it's defined in annex b of the ecma-262 standard, whose introduction states: "… programmers should not use or assume the existence of these features and behaviours when writing new ecmascript code.
TypeError: invalid Array.prototype.sort argument - JavaScript
examples invalid cases [1, 3, 2].sort(5); // typeerror var cmp = { asc: (x, y) => x >= y, dsc: (x, y) => x <= y }; [1, 3, 2].sort(cmp[this.key] || 'asc'); // typeerror valid cases [1, 3, 2].sort(); // [1, 2, 3] var cmp = { asc: (x, y) => x >= y, dsc: (x, y) => x <= y }; [1, 3, 2].sort(cmp[this.key || 'asc']); // [1, 2, 3] ...
Warning: expression closures are deprecated - JavaScript
var x = function() 1; var obj = { count: function() 1 }; standard syntax to convert the non-standard expression closures syntax to standard ecmascript syntax, you can add curly braces and return statements.
SyntaxError: "0"-prefixed octal literals and octal escape seq. are deprecated - JavaScript
with ecmascript 2015 and later, the standardized syntax uses a leading zero followed by a lowercase or uppercase latin letter "o" (0o or 0o).
Warning: Date.prototype.toLocaleFormat is deprecated - JavaScript
märz 2017" alternative standard syntax using the ecmascript intl api the ecma-402 (ecmascript intl api) standard specifies standard objects and methods that enable language sensitive date and time formatting (available in chrome 24+, firefox 29+, ie11+, safari10+).
RangeError: precision is out of range - JavaScript
however, the ecmascript specification allows to extend this range.
SyntaxError: "use strict" not allowed in function with non-simple parameters - JavaScript
a "use strict" directive is written at the top of a function that has one of the following parameters: default parameters rest parameters destructuring parameters a "use strict" directive is not allowed at the top of such functions per the ecmascript specification.
SyntaxError: unterminated string literal - JavaScript
that form looks like this: var longstring = 'this is a very long string which needs \ to wrap across multiple lines because \ otherwise my code is unreadable.'; another possibility is to use template literals, which are supported in ecmascript 2015 environments: var longstring = `this is a very long string which needs to wrap across multiple lines because otherwise my code is unreadable.`; ...
JavaScript error reference - JavaScript
error: cyclic object valuetypeerror: invalid "instanceof" operand "x"typeerror: invalid array.prototype.sort argumenttypeerror: invalid argumentstypeerror: invalid assignment to const "x"typeerror: property "x" is non-configurable and can't be deletedtypeerror: setting getter-only property "x"typeerror: variable "x" redeclares argumenturierror: malformed uri sequencewarning: 08/09 is not a legal ecma-262 octal constantwarning: -file- is being assigned a //# sourcemappingurl, but already has onewarning: date.prototype.tolocaleformat is deprecatedwarning: javascript 1.6's for-each-in loops are deprecatedwarning: string.x is deprecated; use string.prototype.x insteadwarning: expression closures are deprecatedwarning: unreachable code after return statement ...
Default parameters - JavaScript
function f(x = 1, y) { return [x, y] } f() // [1, undefined] f(2) // [2, undefined] destructured parameter with default value assignment you can use default value assignment with the destructuring assignment notation: function f([x, y] = [1, 2], {z: z} = {z: 3}) { return x + y + z } f() // 6 specifications specification ecmascript (ecma-262)the definition of 'function definitions' in that specification.
arguments.length - JavaScript
*/) { base = number(base); for (var i = 1; i < arguments.length; i++) { base += number(arguments[i]); } return base; } note the difference between function.length and arguments.length specifications specification ecmascript (ecma-262)the definition of 'arguments exotic objects' in that specification.
The arguments object - JavaScript
updating arguments[0] does not also update a console.log(a); } func(10); // 10 and also: function func(a = 55) { a = 99; // updating a does not also update arguments[0] console.log(arguments[0]); } func(10); // 10 and also: // an untracked default parameter function func(a = 55) { console.log(arguments[0]); } func(); // undefined specifications specification ecmascript (ecma-262)the definition of 'arguments exotic objects' in that specification.
Rest parameters - JavaScript
function sortarguments() { let args = array.from(arguments) let sortedargs = args.sort() return sortedargs } console.log(sortarguments(5, 3, 7, 1)) // 1, 3, 5, 7 specifications specification ecmascript (ecma-262)the definition of 'function definitions' in that specification.
Array.prototype[@@iterator]() - JavaScript
your browser must support for..of loop // and let-scoped variables in for loops // const and var could also be used for (let letter of iterator) { console.log(letter); } } // array logiterable(['a', 'b', 'c']); // a // b // c // string logiterable('abc'); // a // b // c logiterable(123); // 123 " is not an iterable object..." specifications specification ecmascript (ecma-262)the definition of 'array.prototype[@@iterator]()' in that specification.
get Array[@@species] - JavaScript
however, you might want to overwrite this, in order to return parent array objects in your derived class methods: class myarray extends array { // overwrite myarray species to the parent array constructor static get [symbol.species]() { return array; } } specifications specification ecmascript (ecma-262)the definition of 'get array [ @@species ]' in that specification.
Array() constructor - JavaScript
let fruits = new array('apple', 'banana'); console.log(fruits.length); // 2 console.log(fruits[0]); // "apple" specifications specification ecmascript (ecma-262)the definition of 'array constructor' in that specification.
Array.prototype.concat() - JavaScript
ng nested arrays the following code concatenates nested arrays and demonstrates retention of references: const num1 = [[1]]; const num2 = [2, [3]]; const numbers = num1.concat(num2); console.log(numbers); // results in [[1], 2, [3]] // modify the first element of num1 num1[0].push(4); console.log(numbers); // results in [[1, 4], 2, [3]] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.concat' in that specification.
Array.prototype.copyWithin() - JavaScript
hin.call({length: 5, 3: 1}, 0, 3) // {0: 1, 3: 1, length: 5} // es2015 typed arrays are subclasses of array var i32a = new int32array([1, 2, 3, 4, 5]) i32a.copywithin(0, 2) // int32array [3, 4, 5, 4, 5] // on platforms that are not yet es2015 compliant: [].copywithin.call(new int32array([1, 2, 3, 4, 5]), 0, 3, 4); // int32array [4, 2, 3, 4, 5] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.copywithin' in that specification.
Array.prototype.entries() - JavaScript
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
// [1, 2, 3] [1, 2, 3].fill(4, 3, 5) // [1, 2, 3] array(3).fill(4) // [4, 4, 4] [].fill.call({ length: 3 }, 4) // {0: 4, 1: 4, 2: 4, length: 3} // a single object, referenced by each slot of the array: let arr = array(3).fill({}) // [{}, {}, {}] arr[0].hi = "hi" // [{ hi: "hi" }, { hi: "hi" }, { hi: "hi" }] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.fill' in that specification.
Array.prototype.flat() - JavaScript
// [1, 2, 3, 4, [5, 6]] const arr3 = [1, 2, [3, 4, [5, 6]]]; arr3.flat(2); // [1, 2, 3, 4, 5, 6] const arr4 = [1, 2, [3, 4, [5, 6, [7, 8, [9, 10]]]]]; arr4.flat(infinity); // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] flattening and array holes the flat method removes empty slots in arrays: const arr5 = [1, 2, , 4, 5]; arr5.flat(); // [1, 2, 4, 5] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.flat' in that specification.
Array.prototype.flatMap() - JavaScript
[n] : [n-1, 1] ) // expected output: [4, 1, 4, 20, 16, 1, 18] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.flatmap' in that specification.
Array.prototype.includes() - JavaScript
for more details and discussion, see https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 specifications specification ecmascript (ecma-262)the definition of 'array.prototype.includes' in that specification.
Array.isArray() - JavaScript
var iframe = document.createelement('iframe'); document.body.appendchild(iframe); xarray = window.frames[window.frames.length-1].array; var arr = new xarray(1,2,3); // [1,2,3] // correctly checking for array array.isarray(arr); // true // considered harmful, because doesn't work through iframes arr instanceof array; // false specifications specification ecmascript (ecma-262)the definition of 'array.isarray' in that specification.
Array.prototype.join() - JavaScript
function f(a, b, c) { var s = array.prototype.join.call(arguments); console.log(s); // '1,a,true' } f(1, 'a', true); //expected output: "1,a,true" specifications specification ecmascript (ecma-262)the definition of 'array.prototype.join' in that specification.
Array.prototype.keys() - JavaScript
examples key iterator doesn't ignore holes var arr = ['a', , 'c']; var sparsekeys = object.keys(arr); var densekeys = [...arr.keys()]; console.log(sparsekeys); // ['0', '2'] console.log(densekeys); // [0, 1, 2] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.keys' in that specification.
Array.prototype.length - JavaScript
var numbers = [1, 2, 3, 4, 5]; if (numbers.length > 3) { numbers.length = 3; } console.log(numbers); // [1, 2, 3] console.log(numbers.length); // 3 create empty array of fixed length var numbers = []; numbers.length = 3; console.log(numbers); // [undefined, undefined, undefined] specifications specification ecmascript (ecma-262)the definition of 'array.length' in that specification.
Array.prototype.pop() - JavaScript
var myfish = {0:'angel', 1:'clown', 2:'mandarin', 3:'sturgeon', length: 4}; var popped = array.prototype.pop.call(myfish); //same syntax for using apply( ) console.log(myfish); // {0:'angel', 1:'clown', 2:'mandarin', length: 3} console.log(popped); // 'sturgeon' specifications specification ecmascript (ecma-262)the definition of 'array.prototype.pop' in that specification.
Array.prototype.push() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'array.prototype.push' in that specification.
Array.prototype.reverse() - JavaScript
const a = {0: 1, 1: 2, 2: 3, length: 3}; console.log(a); // {0: 1, 1: 2, 2: 3, length: 3} array.prototype.reverse.call(a); //same syntax for using apply() console.log(a); // {0: 3, 1: 2, 2: 1, length: 3} specifications specification ecmascript (ecma-262)the definition of 'array.prototype.reverse' in that specification.
Array.prototype.shift() - JavaScript
in the following example every iteration will remove the next element from an array, until it is empty: var names = ["andrew", "edward", "paul", "chris" ,"john"]; while( (i = names.shift()) !== undefined ) { console.log(i); } // andrew, edward, paul, chris, john specifications specification ecmascript (ecma-262)the definition of 'array.prototype.shift' in that specification.
Array.prototype.slice() - JavaScript
let unboundslice = array.prototype.slice let slice = function.prototype.call.bind(unboundslice) function list() { return slice(arguments) } let list1 = list(1, 2, 3) // [1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.slice' in that specification.
Array.prototype.splice() - JavaScript
= ['angel', 'clown', 'mandarin', 'sturgeon'] let removed = myfish.splice(-2, 1) // myfish is ["angel", "clown", "sturgeon"] // removed is ["mandarin"] remove all elements from index 2 let myfish = ['angel', 'clown', 'mandarin', 'sturgeon'] let removed = myfish.splice(2) // myfish is ["angel", "clown"] // removed is ["mandarin", "sturgeon"] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.splice' in that specification.
Array.prototype.unshift() - JavaScript
which is the new array length // arr is [0, 1, 2] arr.unshift(-2, -1) // the new array length is 5 // arr is [-2, -1, 0, 1, 2] arr.unshift([-4, -3]) // the new array length is 6 // arr is [[-4, -3], -2, -1, 0, 1, 2] arr.unshift([-7, -6], [-5]) // the new array length is 8 // arr is [ [-7, -6], [-5], [-4, -3], -2, -1, 0, 1, 2 ] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.unshift' in that specification.
Array.prototype.values() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'array.prototype.values' in that specification.
get ArrayBuffer[@@species] - JavaScript
however, you might want to overwrite this, in order to return parent arraybuffer objects in your derived class methods: class myarraybuffer extends arraybuffer { // overwrite myarraybuffer species to the parent arraybuffer constructor static get [symbol.species]() { return arraybuffer; } } specifications specification ecmascript (ecma-262)the definition of 'get arraybuffer [ @@species ]' in that specification.
ArrayBuffer.prototype.byteLength - JavaScript
examples using bytelength var buffer = new arraybuffer(8); buffer.bytelength; // 8 specifications specification ecmascript (ecma-262)the definition of 'arraybuffer.prototype.bytelength' in that specification.
ArrayBuffer.isView() - JavaScript
sview(undefined); // false arraybuffer.isview(new arraybuffer(10)); // false arraybuffer.isview(new uint8array()); // true arraybuffer.isview(new float32array()); // true arraybuffer.isview(new int8array(10).subarray(0, 3)); // true const buffer = new arraybuffer(2); const dv = new dataview(buffer); arraybuffer.isview(dv); // true specifications specification ecmascript (ecma-262)the definition of 'arraybuffer.isview' in that specification.
ArrayBuffer.prototype.slice() - JavaScript
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.
ArrayBuffer - JavaScript
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.
AsyncFunction - JavaScript
esolve(x); }, 2000); }); } let asyncfunction = object.getprototypeof(async function(){}).constructor let a = new asyncfunction('a', 'b', 'return await resolveafter2seconds(a) + await resolveafter2seconds(b);'); a(10, 20).then(v => { console.log(v); // prints 30 after 4 seconds }); specifications specification ecmascript (ecma-262)the definition of 'asyncfunction object' in that specification.
Atomics.add() - JavaScript
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
5 0101 1 0001 ---- 1 0001 examples using and() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 5; atomics.and(ta, 0, 1); // returns 0, the old value atomics.load(ta, 0); // 1 specifications specification ecmascript (ecma-262)the definition of 'atomics.and' in that specification.
Atomics.compareExchange() - JavaScript
examples using compareexchange() const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 7; atomics.compareexchange(ta, 0, 7, 12); // returns 7, the old value atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.compareexchange' in that specification.
Atomics.exchange() - JavaScript
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.isLockFree() - JavaScript
examples using islockfree atomics.islockfree(1); // true atomics.islockfree(2); // true atomics.islockfree(3); // false atomics.islockfree(4); // true atomics.islockfree(5); // false atomics.islockfree(6); // false atomics.islockfree(7); // false atomics.islockfree(8); // true specifications specification ecmascript (ecma-262)the definition of 'atomics.islockfree' in that specification.
Atomics.load() - JavaScript
examples using load const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); atomics.add(ta, 0, 12); atomics.load(ta, 0); // 12 specifications specification ecmascript (ecma-262)the definition of 'atomics.load' in that specification.
Atomics.notify() - JavaScript
atomics.wait(int32, 0, 0); console.log(int32[0]); // 123 a writing thread stores a new value and notifies the waiting thread once it has written: console.log(int32[0]); // 0; atomics.store(int32, 0, 123); atomics.notify(int32, 0, 1); specifications specification ecmascript (ecma-262)the definition of 'atomics.notify' in that specification.
Atomics.or() - JavaScript
5 0101 1 0001 ---- 5 0101 examples using or const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 2; atomics.or(ta, 0, 1); // returns 2, the old value atomics.load(ta, 0); // 3 specifications specification ecmascript (ecma-262)the definition of 'atomics.or' in that specification.
Atomics.store() - JavaScript
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
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
atomics.wait(int32, 0, 0); console.log(int32[0]); // 123 a writing thread stores a new value and notifies the waiting thread once it has written: console.log(int32[0]); // 0; atomics.store(int32, 0, 123); atomics.notify(int32, 0, 1); specifications specification ecmascript (ecma-262)the definition of 'atomics.wait' in that specification.
Atomics.xor() - JavaScript
5 0101 1 0001 ---- 4 0100 examples using xor const sab = new sharedarraybuffer(1024); const ta = new uint8array(sab); ta[0] = 5; atomics.xor(ta, 0, 1); // returns 5, the old value atomics.load(ta, 0); // 4 specifications specification ecmascript (ecma-262)the definition of 'atomics.xor' in that specification.
Atomics - JavaScript
atomics.wait(int32, 0, 0); console.log(int32[0]); // 123 a writing thread stores a new value and notifies the waiting thread once it has written: console.log(int32[0]); // 0; atomics.store(int32, 0, 123); atomics.notify(int32, 0, 1); specifications specification ecmascript (ecma-262)the definition of 'atomics' in that specification.
BigInt() constructor - JavaScript
examples creating a new bigint bigint(123); // 123n specifications specification ecmascript (ecma-262)the definition of 'bigint constructor' in that specification.
BigInt.asIntN() - JavaScript
const max = 2n ** (64n - 1n) - 1n; bigint.asintn(64, max); // ↪ 9223372036854775807n bigint.asintn(64, max + 1n); // ↪ -9223372036854775807n // negative because of overflow specifications specification ecmascript (ecma-262)the definition of 'bigint.asintn()' in that specification.
BigInt.asUintN() - JavaScript
const max = 2n ** 64n - 1n; bigint.asuintn(64, max); // ↪ 18446744073709551615n bigint.asuintn(64, max + 1n); // ↪ 0n // zero because of overflow specifications specification ecmascript (ecma-262)the definition of 'bigint.asuintn()' in that specification.
BigInt.prototype.toString() - JavaScript
(-0n).tostring(); // '0' bigint(-0).tostring(); // '0' specifications specification ecmascript (ecma-262)the definition of 'bigint.prototype.tostring()' in that specification.
BigInt.prototype.valueOf() - JavaScript
examples using valueof typeof object(1n); // object typeof object(1n).valueof(); // bigint specifications specification ecmascript (ecma-262)the definition of 'bigint.prototype.valueof()' in that specification.
BigInt - JavaScript
(p % i === 0n) return false; } return true } // takes a bigint as an argument, returns nth prime number as bigint function nthprime(nth) { let maybeprime = 2n let prime = 0n while (nth >= 0n) { if (isprime(maybeprime)) { nth-- prime = maybeprime } maybeprime++ } return prime } nthprime(20n) // ↪ 73n specifications specification ecmascript (ecma-262)the definition of 'bigint objects' in that specification.
BigInt64Array() constructor - JavaScript
ay var x = new bigint64array([21n, 31n]); var y = new bigint64array(x); console.log(y[0]); // 21n // from an arraybuffer var buffer = new arraybuffer(32); var z = new bigint64array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1n, 2n, 3n]; }(); var bigint64 = new bigint64array(iterable); // bigint64array[1n, 2n, 3n] specifications specification ecmascript (ecma-262)the definition of 'bigint64array' in that specification.
BigInt64Array - JavaScript
ay var x = new bigint64array([21n, 31n]); var y = new bigint64array(x); console.log(y[0]); // 21n // from an arraybuffer var buffer = new arraybuffer(32); var z = new bigint64array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1n, 2n, 3n]; }(); var bigint64 = new bigint64array(iterable); // bigint64array[1n, 2n, 3n] specifications specification ecmascript (ecma-262)the definition of 'bigint64array' in that specification.
BigUint64Array() constructor - JavaScript
x = new biguint64array([21n, 31n]); var y = new biguint64array(x); console.log(y[0]); // 21n // from an arraybuffer var buffer = new arraybuffer(32); var z = new biguint64array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1n, 2n, 3n]; }(); var biguint64 = new biguint64array(iterable); // biguint64array[1n, 2n, 3n] specifications specification ecmascript (ecma-262)the definition of 'biguint64array' in that specification.
BigUint64Array - JavaScript
x = new biguint64array([21n, 31n]); var y = new biguint64array(x); console.log(y[0]); // 21n // from an arraybuffer var buffer = new arraybuffer(32); var z = new biguint64array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1n, 2n, 3n]; }(); var biguint64 = new biguint64array(iterable); // biguint64array[1n, 2n, 3n] specifications specification ecmascript (ecma-262)the definition of 'biguint64array' in that specification.
Boolean() constructor - JavaScript
(null); var bemptystring = new boolean(''); var bfalse = new boolean(false); creating boolean objects with an initial value of true var btrue = new boolean(true); var btruestring = new boolean('true'); var bfalsestring = new boolean('false'); var bsulin = new boolean('su lin'); var barrayproto = new boolean([]); var bobjproto = new boolean({}); specifications specification ecmascript (ecma-262)the definition of 'boolean constructor' in that specification.
Boolean.prototype.toString() - JavaScript
examples using tostring() in the following code, flag.tostring() returns "true": var flag = new boolean(true); var myvar = flag.tostring(); specifications specification ecmascript (ecma-262)the definition of 'boolean.prototype.tostring' in that specification.
Boolean.prototype.valueOf() - JavaScript
examples using valueof() x = new boolean(); myvar = x.valueof(); // assigns false to myvar specifications specification ecmascript (ecma-262)the definition of 'boolean.prototype.valueof' in that specification.
Boolean - JavaScript
); var bemptystring = new boolean(''); var bfalse = new boolean(false); creating boolean objects with an initial value of true var btrue = new boolean(true); var btruestring = new boolean('true'); var bfalsestring = new boolean('false'); var bsulin = new boolean('su lin'); var barrayproto = new boolean([]); var bobjproto = new boolean({}); specifications specification ecmascript (ecma-262)the definition of 'boolean' in that specification.
DataView() constructor - JavaScript
examples using dataview var buffer = new arraybuffer(16); var view = new dataview(buffer, 0); view.setint16(1, 42); view.getint16(1); // 42 specifications specification ecmascript (ecma-262)the definition of 'dataview constructor' in that specification.
DataView.prototype.buffer - JavaScript
examples using the buffer property var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.buffer; // arraybuffer { bytelength: 8 } specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.buffer' in that specification.
DataView.prototype.byteLength - JavaScript
ybuffer(8); var dataview = new dataview(buffer); dataview.bytelength; // 8 (matches the bytelength of the buffer) var dataview2 = new dataview(buffer, 1, 5); dataview2.bytelength; // 5 (as specified when constructing the dataview) var dataview3 = new dataview(buffer, 2); dataview3.bytelength; // 6 (due to the offset of the constructed dataview) specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.bytelength' in that specification.
DataView.prototype.byteOffset - JavaScript
examples using the byteoffset property var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.byteoffset; // 0 (no offset specified) var dataview2 = new dataview(buffer, 3); dataview2.byteoffset; // 3 (as specified when constructing the dataview) specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.byteoffset' in that specification.
DataView.prototype.getBigInt64() - JavaScript
examples using the getbigint64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getbigint64(0); // 0n specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getbigint64()' in that specification.
DataView.prototype.getBigUint64() - JavaScript
examples using the getbiguint64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getbiguint64(0); // 0n specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getbiguint64()' in that specification.
DataView.prototype.getFloat32() - JavaScript
examples using the getfloat32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getfloat32(1); // 0 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getfloat32' in that specification.
DataView.prototype.getFloat64() - JavaScript
examples using the getfloat64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getfloat64(0); // 0 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getfloat64' in that specification.
DataView.prototype.getInt16() - JavaScript
examples using the getint16 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getint16(1); // 0 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getint16' in that specification.
DataView.prototype.getInt32() - JavaScript
examples using the getint32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getint32(1); // 0 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getint32' in that specification.
DataView.prototype.getInt8() - JavaScript
examples using the getint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getint8(1); // 0 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getint8' in that specification.
DataView.prototype.getUint16() - JavaScript
examples using the getuint16 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getuint16(1); // 0 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getuint16' in that specification.
DataView.prototype.getUint32() - JavaScript
examples using the getuint32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getuint32(1); // 0 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getuint32' in that specification.
DataView.prototype.getUint8() - JavaScript
examples using the getuint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.getuint8(1); // 0 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.getuint8' in that specification.
DataView.prototype.setBigInt64() - JavaScript
examples using the setbigint64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setbigint64(0, 3n); dataview.getbigint64(0); // 3n specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setbigint64()' in that specification.
DataView.prototype.setBigUint64() - JavaScript
examples using the setbiguint64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setbiguint64(0, 3n); dataview.getbiguint64(0); // 3n specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setbiguint64()' in that specification.
DataView.prototype.setFloat32() - JavaScript
examples using the setfloat32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setfloat32(1, 3); dataview.getfloat32(1); // 3 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setfloat32' in that specification.
DataView.prototype.setFloat64() - JavaScript
examples using the setfloat64 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setfloat64(0, 3); dataview.getfloat64(0); // 3 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setfloat64' in that specification.
DataView.prototype.setInt16() - JavaScript
examples using the setint16 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setint16(1, 3); dataview.getint16(1); // 3 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setint16' in that specification.
DataView.prototype.setInt32() - JavaScript
examples using the setint32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setint32(1, 3); dataview.getint32(1); // 3 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setint32' in that specification.
DataView.prototype.setInt8() - JavaScript
examples using the setint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setint8(1, 3); dataview.getint8(1); // 3 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setint8' in that specification.
DataView.prototype.setUint16() - JavaScript
examples using the setuint16 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setuint16(1, 3); dataview.getuint16(1); // 3 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setuint16' in that specification.
DataView.prototype.setUint32() - JavaScript
examples using the setuint32 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setuint32(1, 3); dataview.getuint32(1); // 3 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setuint32' in that specification.
DataView.prototype.setUint8() - JavaScript
examples using the setuint8 method var buffer = new arraybuffer(8); var dataview = new dataview(buffer); dataview.setuint8(1, 3); dataview.getuint8(1); // 3 specifications specification ecmascript (ecma-262)the definition of 'dataview.prototype.setuint8' in that specification.
DataView - JavaScript
examples using dataview var buffer = new arraybuffer(16); var view = new dataview(buffer, 0); view.setint16(1, 42); view.getint16(1); // 42 specifications specification ecmascript (ecma-262)the definition of 'dataview' in that specification.
Date.prototype[@@toPrimitive] - JavaScript
y 29 2020 14:05:17 gmt+0100 (british summer time)" testdate[symbol.toprimitive]('string'); // returns "date fri may 29 2020 14:05:17 gmt+0100 (british summer time)" testdate[symbol.toprimitive]('number'); // returns "1590757517834" testdate[symbol.toprimitive]('default'); // returns "date fri may 29 2020 14:05:17 gmt+0100 (british summer time)" specifications specification ecmascript (ecma-262)the definition of 'date.prototype.@@toprimitive' in that specification.
Date.prototype.getDate() - JavaScript
var xmas95 = new date('december 25, 1995 23:15:30'); var day = xmas95.getdate(); console.log(day); // 25 specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getdate' in that specification.
Date.prototype.getDay() - JavaScript
using this method, the internationalization is made easier: var options = { weekday: 'long'}; console.log(new intl.datetimeformat('en-us', options).format(xmas95)); // monday console.log(new intl.datetimeformat('de-de', options).format(xmas95)); // montag specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getday' in that specification.
Date.prototype.getFullYear() - JavaScript
var today = new date(); var year = today.getfullyear(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getfullyear' in that specification.
Date.prototype.getHours() - JavaScript
let xmas95 = new date('december 25, 1995 23:15:30'); let hours = xmas95.gethours(); console.log(hours); // 23 specifications specification ecmascript (ecma-262)the definition of 'date.prototype.gethours' in that specification.
Date.prototype.getMilliseconds() - JavaScript
examples using getmilliseconds() the following example assigns the milliseconds portion of the current time to the variable milliseconds: var today = new date(); var milliseconds = today.getmilliseconds(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getmilliseconds' in that specification.
Date.prototype.getMinutes() - JavaScript
var xmas95 = new date('december 25, 1995 23:15:30'); var minutes = xmas95.getminutes(); console.log(minutes); // 15 specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getminutes' in that specification.
Date.prototype.getMonth() - JavaScript
using this method, internationalization is made easier: var options = { month: 'long'}; console.log(new intl.datetimeformat('en-us', options).format(xmas95)); // december console.log(new intl.datetimeformat('de-de', options).format(xmas95)); // dezember specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getmonth' in that specification.
Date.prototype.getSeconds() - JavaScript
var xmas95 = new date('december 25, 1995 23:15:30'); var seconds = xmas95.getseconds(); console.log(seconds); // 30 specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getseconds' in that specification.
Date.prototype.getTime() - JavaScript
var end, start; start = new date(); for (var i = 0; i < 1000; i++) { math.sqrt(i); } end = new date(); console.log('operation took ' + (end.gettime() - start.gettime()) + ' msec'); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.gettime' in that specification.
Date.prototype.getTimezoneOffset() - JavaScript
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.getUTCDate() - JavaScript
var today = new date(); var day = today.getutcdate(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutcdate' in that specification.
Date.prototype.getUTCDay() - JavaScript
var today = new date(); var weekday = today.getutcday(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutcday' in that specification.
Date.prototype.getUTCFullYear() - JavaScript
var today = new date(); var year = today.getutcfullyear(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutcfullyear' in that specification.
Date.prototype.getUTCHours() - JavaScript
var today = new date(); var hours = today.getutchours(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutchours' in that specification.
Date.prototype.getUTCSeconds() - JavaScript
var today = new date(); var seconds = today.getutcseconds(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getutcseconds' in that specification.
Date.prototype.getYear() - JavaScript
var xmas = new date('december 25, 2015 23:15:00'); xmas.setyear(95); var year = xmas.getyear(); // returns 95 specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getyear' in that specification.
Date.prototype.setDate() - JavaScript
day.setdate(24); // 1962-07-24 (24th of july 1962) thebigday.setdate(32); // 1962-08-01 (1st of august 1962) thebigday.setdate(22); // 1962-08-22 (22th of august 1962) thebigday.setdate(0); // 1962-07-31 (31th of july 1962) thebigday.setdate(98); // 1962-10-06 (6th of october 1962) thebigday.setdate(-50); // 1962-08-11 (11th of august 1962) specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setdate' in that specification.
Date.prototype.setFullYear() - JavaScript
examples using setfullyear() var thebigday = new date(); thebigday.setfullyear(1997); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setfullyear' in that specification.
Date.prototype.setHours() - JavaScript
examples using sethours() var thebigday = new date(); thebigday.sethours(7); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.sethours' in that specification.
Date.prototype.setMilliseconds() - JavaScript
examples using setmilliseconds() var thebigday = new date(); thebigday.setmilliseconds(100); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setmilliseconds' in that specification.
Date.prototype.setMinutes() - JavaScript
examples using setminutes() var thebigday = new date(); thebigday.setminutes(45); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setminutes' in that specification.
Date.prototype.setMonth() - JavaScript
examples using setmonth() var thebigday = new date(); thebigday.setmonth(6); //watch out for end of month transitions var endofmonth = new date(2016, 7, 31); endofmonth.setmonth(1); console.log(endofmonth); //wed mar 02 2016 00:00:00 specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setmonth' in that specification.
Date.prototype.setSeconds() - JavaScript
examples using setseconds() var thebigday = new date(); thebigday.setseconds(30); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setseconds' in that specification.
Date.prototype.setTime() - JavaScript
examples using settime() var thebigday = new date('july 1, 1999'); var sameasbigday = new date(); sameasbigday.settime(thebigday.gettime()); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.settime' in that specification.
Date.prototype.setUTCDate() - JavaScript
examples using setutcdate() var thebigday = new date(); thebigday.setutcdate(20); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setutcdate' in that specification.
Date.prototype.setYear() - JavaScript
var thebigday = new date(); thebigday.setyear(96); thebigday.setyear(1996); thebigday.setyear(2000); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.setyear' in that specification.
Date.prototype.toGMTString() - JavaScript
use toutcstring() console.log(str); // mon, 18 dec 1995 17:28:35 gmt specifications specification ecmascript (ecma-262)the definition of 'date.prototype.togmtstring' in that specification.
Date.prototype.toJSON() - JavaScript
examples using tojson() var jsondate = (new date()).tojson(); var backtodate = new date(jsondate); console.log(jsondate); //2015-10-26t07:46:36.611z specifications specification ecmascript (ecma-262)the definition of 'date.prototype.tojson' in that specification.
Date.prototype.valueOf() - JavaScript
examples using valueof() var x = new date(56, 6, 17); var myvar = x.valueof(); // assigns -424713600000 to myvar specifications specification ecmascript (ecma-262)the definition of 'date.prototype.valueof' in that specification.
Error() constructor - JavaScript
const y = new error('i was constructed via the "new" keyword!') specifications specification ecmascript (ecma-262)the definition of 'error constructor' in that specification.
Error.prototype.message - JavaScript
examples throwing a custom error var e = new error('could not parse input'); // e.message is 'could not parse input' throw e; specifications specification ecmascript (ecma-262)the definition of 'error.prototype.message' in that specification.
Error.prototype.name - JavaScript
examples throwing a custom error var e = new error('malformed input'); // e.name is 'error' e.name = 'parseerror'; throw e; // e.tostring() would return 'parseerror: malformed input' specifications specification ecmascript (ecma-262)the definition of 'error.prototype.name' in that specification.
Error.prototype.toString() - JavaScript
ing tostring() var e = new error('fatal error'); console.log(e.tostring()); // 'error: fatal error' e.name = undefined; console.log(e.tostring()); // 'error: fatal error' e.name = ''; console.log(e.tostring()); // 'fatal error' e.message = undefined; console.log(e.tostring()); // '' e.name = 'hello'; console.log(e.tostring()); // 'hello' specifications specification ecmascript (ecma-262)the definition of 'error.prototype.tostring' in that specification.
Error - JavaScript
writable: true, configurable: true } }); if (object.setprototypeof){ object.setprototypeof(customerror, error); } else { customerror.__proto__ = error; } try { throw new customerror('baz', 'bazmessage'); } catch(e){ console.error(e.name); //customerror console.error(e.foo); //baz console.error(e.message); //bazmessage } specifications specification ecmascript (ecma-262)the definition of 'error' in that specification.
Float32Array() constructor - JavaScript
another typedarray var x = new float32array([21, 31]); var y = new float32array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(16); var z = new float32array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var float32 = new float32array(iterable); // float32array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Float32Array - JavaScript
from another typedarray var x = new float32array([21, 31]); var y = new float32array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(16); var z = new float32array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var float32 = new float32array(iterable); // float32array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Float64Array() constructor - JavaScript
another typedarray var x = new float64array([21, 31]); var y = new float64array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(32); var z = new float64array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var float64 = new float64array(iterable); // float64array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Float64Array - JavaScript
from another typedarray var x = new float64array([21, 31]); var y = new float64array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(32); var z = new float64array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var float64 = new float64array(iterable); // float64array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Function() constructor - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'function constructor' in that specification.
Function.arguments - JavaScript
deprecated in favor of arguments in ecmascript 3.
Function.prototype.call() - JavaScript
'use strict'; var sdata = 'wisen'; function display() { console.log('sdata value is %s ', this.sdata); } display.call(); // cannot read the property of 'sdata' of undefined specifications specification ecmascript (ecma-262)the definition of 'function.prototype.call' in that specification.
Function.length - JavaScript
*/ console.log((function(...args) {}).length); // 0, rest parameter is not counted console.log((function(a, b = 1, c) {}).length); // 1, only parameters before the first one with // a default value is counted specifications specification ecmascript (ecma-262)the definition of 'function.length' in that specification.
Function.prototype.toString() - JavaScript
descriptor({ set a(x){} }, "a").set "set a(x){}" function.prototype.tostring "function tostring() { [native code] }" (function f(){}.bind(0)) "function () { [native code] }" function("a", "b") "function anonymous(a\n) {\nb\n}" specifications specification ecmascript (ecma-262)the definition of 'function.prototype.tostring' in that specification.
Function - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'function' in that specification.
Generator.prototype.next() - JavaScript
function* gen() { while (true) { let value = yield null; console.log(value); } } const g = gen(); g.next(1); // "{ value: null, done: false }" g.next(2); // 2 // "{ value: null, done: false }" specifications specification ecmascript (ecma-262)the definition of 'generator.prototype.next' in that specification.
Generator.prototype.return() - JavaScript
function* gen() { yield 1; yield 2; yield 3; } const g = gen(); g.next(); // { value: 1, done: false } g.next(); // { value: 2, done: false } g.next(); // { value: 3, done: false } g.next(); // { value: undefined, done: true } g.return(); // { value: undefined, done: true } g.return(1); // { value: 1, done: true } specifications specification ecmascript (ecma-262)the definition of 'generator.prototype.return' in that specification.
Generator.prototype.throw() - JavaScript
function* gen() { while(true) { try { yield 42; } catch(e) { console.log('error caught!'); } } } const g = gen(); g.next(); // { value: 42, done: false } g.throw(new error('something went wrong')); // "error caught!" // { value: 42, done: false } specifications specification ecmascript (ecma-262)the definition of 'generator.prototype.throw' in that specification.
Generator - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'generator objects' in that specification.
GeneratorFunction - JavaScript
examples creating a generator function from a generatorfunction() constructor var generatorfunction = object.getprototypeof(function*(){}).constructor var g = new generatorfunction('a', 'yield a * 2'); var iterator = g(10); console.log(iterator.next().value); // 20 specifications specification ecmascript (ecma-262)the definition of 'generatorfunction' in that specification.
Int16Array() constructor - JavaScript
); // 31 // from another typedarray var x = new int16array([21, 31]); var y = new int16array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new int16array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var int16 = new int16array(iterable); // int16array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Int16Array - JavaScript
); // 31 // from another typedarray var x = new int16array([21, 31]); var y = new int16array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new int16array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var int16 = new int16array(iterable); // int16array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Int32Array() constructor - JavaScript
; // 31 // from another typedarray var x = new int32array([21, 31]); var y = new int32array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(16); var z = new int32array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var int32 = new int32array(iterable); // int32array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Int32Array - JavaScript
; // 31 // from another typedarray var x = new int32array([21, 31]); var y = new int32array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(16); var z = new int32array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var int32 = new int32array(iterable); // int32array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Int8Array() constructor - JavaScript
arr[1]); // 31 // from another typedarray var x = new int8array([21, 31]); var y = new int8array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new int8array(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var int8 = new int8array(iterable); // int8array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Int8Array - JavaScript
arr[1]); // 31 // from another typedarray var x = new int8array([21, 31]); var y = new int8array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new int8array(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var int8 = new int8array(iterable); // int8array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Intl.Collator() constructor - JavaScript
specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.collator constructor' in that specification.
Intl.Collator.prototype.compare() - JavaScript
e the compare getter function for finding matching strings in arrays: var a = ['congrès', 'congres', 'assemblée', 'poisson']; var collator = new intl.collator('fr', { usage: 'search', sensitivity: 'base' }); var s = 'congres'; var matches = a.filter(v => collator.compare(v, s) === 0); console.log(matches.join(', ')); // → "congrès, congres" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.collator.prototype.compare' in that specification.
Intl.Collator.prototype.resolvedOptions() - JavaScript
hod var de = new intl.collator('de', { sensitivity: 'base' }) var usedoptions = de.resolvedoptions(); usedoptions.locale; // "de" usedoptions.usage; // "sort" usedoptions.sensitivity; // "base" usedoptions.ignorepunctuation; // false usedoptions.collation; // "default" usedoptions.numeric; // false specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.collator.prototype.resolvedoptions' in that specification.
Intl.Collator.supportedLocalesOf() - JavaScript
var locales = ['ban', 'id-u-co-pinyin', 'de-id']; var options = { localematcher: 'lookup' }; console.log(intl.collator.supportedlocalesof(locales, options).join(', ')); // → "id-u-co-pinyin, de-id" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.collator.supportedlocalesof' in that specification.
Intl.Collator - JavaScript
e.compare() can be customized using the options argument: // in german, ä has a as the base letter console.log(new intl.collator('de', { sensitivity: 'base' }).compare('ä', 'a')); // → 0 // in swedish, ä and a are separate base letters console.log(new intl.collator('sv', { sensitivity: 'base' }).compare('ä', 'a')); // → a positive value specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.collator' in that specification.
Intl.DateTimeFormat() constructor - JavaScript
, { timestyle: "short" }); console.log(o.format(date.now())); // "13:31 am" let o = new intl.datetimeformat("en" , { datestyle: "short" }); console.log(o.format(date.now())); // "07/07/20" let o = new intl.datetimeformat("en" , { timestyle: "medium", datestyle: "short" }); console.log(o.format(date.now())); // "07/07/20, 13:31:55 am" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.datetimeformat' in that specification.
Intl.DateTimeFormat.prototype.format() - JavaScript
specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.datetimeformat.format' in that specification.
Intl.DateTimeFormat.prototype.formatToParts() - JavaScript
: 'numeric', year: "numeric"}; let df = new intl.datetimeformat("en-u-ca-chinese", opts); let date = date.utc(2012, 11, 17, 3); df.formattoparts(date) // return value [ { type: 'month', value: '11' }, { type: 'literal', value: '/' }, { type: 'day', value: '4' }, { type: 'literal', value: '/' }, { type: 'relatedyear', value: '2012' } ] specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.datetimeformat.prototype.formattoparts' in that specification.
Intl.DateTimeFormat.prototype.resolvedOptions() - JavaScript
edoptions method var germanfakeregion = new intl.datetimeformat('de-xx', { timezone: 'utc' }); var usedoptions = germanfakeregion.resolvedoptions(); usedoptions.locale; // "de" usedoptions.calendar; // "gregory" usedoptions.numberingsystem; // "latn" usedoptions.timezone; // "utc" usedoptions.month; // "numeric" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.datetimeformat.prototype.resolvedoptions' in that specification.
Intl.DateTimeFormat.supportedLocalesOf() - JavaScript
var locales = ['ban', 'id-u-co-pinyin', 'de-id']; var options = { localematcher: 'lookup' }; console.log(intl.datetimeformat.supportedlocalesof(locales, options).join(', ')); // → "id-u-co-pinyin, de-id" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.datetimeformat.supportedlocalesof' in that specification.
Intl.DateTimeFormat - JavaScript
inese', numberingsystem: 'arab'}; var dateformat = new intl.datetimeformat('default', options); var usedoptions = dateformat.resolvedoptions(); console.log(usedoptions.calendar); // → "chinese" console.log(usedoptions.numberingsystem); // → "arab" console.log(usedoptions.timezone); // → "america/new_york" (the users default timezone) specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.datetimeformat' in that specification.
Intl.Locale() constructor - JavaScript
for example, set the hourcycle property of the configuration object to your desired hour cycle type, and then pass it into the constructor: let us12hour = new intl.locale("en-us", {hourcycle: "h12"}); console.log(us12hour.hourcycle); // prints "h12" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.baseName - JavaScript
apan.basename); // prints out "ja-jp" example with options that override input string // input string indicates language as dutch and region as belgium, // but options object overrides the region and sets it to the netherlands let dutch = new intl.locale("nl-latn-be", {region: "nl"}); console.log(dutch.basename); // prints out "nl-latn-nl" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.calendar - JavaScript
let frbuddhist = new intl.locale("fr-fr", {calendar: "buddhist"}); console.log(frbuddhist.calendar); // prints "buddhist" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.caseFirst - JavaScript
let casefirstobj= new intl.locale("en-latn-us", {casefirst: "lower"}); console.log(us12hour.casefirst); // prints "lower" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.collation - JavaScript
let configcoll = new intl.locale("en-latn-us", {collation: "emoji"}); console.log(configcoll.collation); // prints "emoji" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.hourCycle - JavaScript
let us12hour = new intl.locale("en-us", {hourcycle: "h12"}); console.log(us12hour.hourcycle); // prints "h12" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.language - JavaScript
let langobj = new intl.locale("en-latn-us", {language: "es"}); console.log(langobj.language); // prints "es" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.numberingSystem - JavaScript
let numberingsystemviaobj= new intl.locale("en-latn-us", {numberingsystem: "latn"}); console.log(us12hour.numberingsystem); // prints "latn" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.numeric - JavaScript
let numericviaobj= new intl.locale("en-latn-us", {numeric: true}); console.log(us12hour.numeric); // prints "true" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.region - JavaScript
let regionobj = new intl.locale("fr-latn", {region: "fr"}); console.log(regionobj.region); // prints "fr" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.script - JavaScript
let scriptobj = new intl.locale("fr-fr", {script: "latn"}); console.log(scriptobj.script); // prints "latn" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale.prototype.toString() - JavaScript
examples using tostring let mylocale = new intl.locale("fr-latn-fr", {hourcycle: "h24", calendar: "gregory"}); console.log(mylocale.basename); // prints "fr-latn-fr" console.log(mylocale.tostring()); // prints "fr-latn-fr-u-ca-gregory-hc-h24" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.Locale - JavaScript
for example, set the hourcycle property of the configuration object to your desired hour cycle type, and then pass it into the constructor: let us12hour = new intl.locale("en-us", {hourcycle: "h12"}); console.log(us12hour.hourcycle); // prints "h12" specifications specification ecmascript internationalization api (ecma-402) ...
Intl.NumberFormat.prototype.format() - JavaScript
var a = [123456.789, 987654.321, 456789.123]; var numberformat = new intl.numberformat('es-es'); var formatted = a.map(n => numberformat.format(n)); console.log(formatted.join('; ')); // → "123.456,789; 987.654,321; 456.789,123" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.numberformat.prototype.format' in that specification.
Intl.NumberFormat.prototype.formatToParts() - JavaScript
console.log(numberstring); // "3.500,00 <strong>€</strong>" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.numberformat.prototype.formattoparts' in that specification.
Intl.NumberFormat.prototype.resolvedOptions() - JavaScript
sedoptions.numberingsystem; // "latn" usedoptions.notation; // "standard" usedoptions.signdisplay; // "auto" usedoption.style; // "decimal" usedoptions.minimumintegerdigits; // 1 usedoptions.minimumfractiondigits; // 0 usedoptions.maximumfractiondigits; // 3 usedoptions.usegrouping; // true specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.numberformat.prototype.resolvedoptions' in that specification.
Intl.NumberFormat.supportedLocalesOf() - JavaScript
var locales = ['ban', 'id-u-co-pinyin', 'de-id']; var options = { localematcher: 'lookup' }; console.log(intl.numberformat.supportedlocalesof(locales, options).join(', ')); // → "id-u-co-pinyin, de-id" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.numberformat.supportedlocalesof' in that specification.
Intl.NumberFormat - JavaScript
in', { maximumsignificantdigits: 3 }).format(number)); // → 1,23,000 using style and unit console.log(new intl.numberformat("pt-pt", { style: 'unit', unit: "mile-per-hour" }).format(50)); // → 50 mi/h console.log((16).tolocalestring('en-gb', { style: "unit", unit: "liter", unitdisplay: "long" })); // → 16 litres specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.numberformat' in that specification.
Intl.PluralRules() constructor - JavaScript
var pr = new intl.pluralrules('en-us', { type: 'ordinal' }); pr.select(0); // → 'other' pr.select(1); // → 'one' pr.select(2); // → 'two' pr.select(3); // → 'few' pr.select(4); // → 'other' pr.select(42); // → 'two' specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.pluralrules() constructor' in that specification.
Intl.PluralRules.prototype.resolvedOptions() - JavaScript
ew intl.pluralrules('de-de'); var usedoptions = de.resolvedoptions(); usedoptions.locale; // "de-de" usedoptions.maximumfractiondigits; // 3 usedoptions.minimumfractiondigits; // 0 usedoptions.minimumintegerdigits; // 1 usedoptions.pluralcategories; // array [ "one", "other" ] usedoptions.type; // "cardinal" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.pluralrules.prototype.resolvedoptions' in that specification.
Intl.PluralRules.select() - JavaScript
examples using select() new intl.pluralrules('ar-eg').select(0); // → 'zero' new intl.pluralrules('ar-eg').select(1); // → 'one' new intl.pluralrules('ar-eg').select(2); // → 'two' new intl.pluralrules('ar-eg').select(6); // → 'few' new intl.pluralrules('ar-eg').select(18); // → 'many' specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.pluralrules.select()' in that specification.
Intl.PluralRules.supportedLocalesOf() - JavaScript
var locales = ['ban', 'id-u-co-pinyin', 'de-id']; var options = { localematcher: 'lookup' }; console.log(intl.pluralrules.supportedlocalesof(locales, options).join(', ')); // → "id-u-co-pinyin, de-id" specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.pluralrules.supportedlocalesof' in that specification.
Intl.PluralRules - JavaScript
nguages) using the locales argument: // arabic has different plural rules new intl.pluralrules('ar-eg').select(0); // → 'zero' new intl.pluralrules('ar-eg').select(1); // → 'one' new intl.pluralrules('ar-eg').select(2); // → 'two' new intl.pluralrules('ar-eg').select(6); // → 'few' new intl.pluralrules('ar-eg').select(18); // → 'many' specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.pluralrules' in that specification.
Intl.RelativeTimeFormat() constructor - JavaScript
rtf.format(1, "day"); // > "tomorrow" specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat()' in that specification.
Intl.RelativeTimeFormat.prototype.format() - JavaScript
rtf.format(1, "day"); // > "tomorrow" specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat.format()' in that specification.
Intl.RelativeTimeFormat.prototype.formatToParts() - JavaScript
timeformat("en", { numeric: "auto" }); // format relative time using the day unit rtf.formattoparts(-1, "day"); // > [{ type: "literal", value: "yesterday"}] rtf.formattoparts(100, "day"); // > [{ type: "literal", value: "in " }, // > { type: "integer", value: "100", unit: "day" }, // > { type: "literal", value: " days" }] specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat.formattoparts()' in that specification.
Intl.RelativeTimeFormat.prototype.resolvedOptions() - JavaScript
examples using the resolvedoptions method var de = new intl.relativetimeformat('de-de'); var usedoptions = de.resolvedoptions(); usedoptions.locale; // "de-de" usedoptions.style; // "long" usedoptions.numeric; // "always" usedoptions.numberingsystem; // "latn" specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat.resolvedoptions()' in that specification.
Intl.RelativeTimeFormat.supportedLocalesOf() - JavaScript
const locales = ['ban', 'id-u-co-pinyin', 'de-id']; const options = { localematcher: 'lookup' }; console.log(intl.relativetimeformat.supportedlocalesof(locales, options).join(', ')); // → "id-u-co-pinyin, de-id" specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat.supportedlocalesof()' in that specification.
Intl.RelativeTimeFormat - JavaScript
rtf.formattoparts(-1, "day"); // > [{ type: "literal", value: "yesterday"}] rtf.formattoparts(100, "day"); // > [{ type: "literal", value: "in " }, // > { type: "integer", value: "100", unit: "day" }, // > { type: "literal", value: " days" }] specifications specification status comment ecmascript internationalization api (ecma-402)the definition of 'relativetimeformat' in that specification.
Intl.getCanonicalLocales() - JavaScript
examples using getcanonicallocales intl.getcanonicallocales('en-us'); // ["en-us"] intl.getcanonicallocales(['en-us', 'fr']); // ["en-us", "fr"] intl.getcanonicallocales('en_us'); // rangeerror:'en_us' is not a structurally valid language tag specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.getcanonicallocales' in that specification.
JSON.parse() - JavaScript
}); // 1 // 2 // 4 // 6 // 5 // 3 // "" json.parse() does not allow trailing commas // both will throw a syntaxerror json.parse('[1, 2, 3, 4, ]'); json.parse('{"foo" : 1, }'); json.parse() does not allow single quotes // will throw a syntaxerror json.parse("{'foo': 1}"); specifications specification ecmascript (ecma-262)the definition of 'json.parse' in that specification.
JSON.stringify() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'json.stringify' in that specification.
Map.prototype[@@iterator]() - JavaScript
[object, "baz"] using [@@iterator]() with for..of const mymap = new map() mymap.set('0', 'foo') mymap.set(1, 'bar') mymap.set({}, 'baz') for (const entry of mymap) { console.log(entry) } // ["0", "foo"] // [1, "bar"] // [{}, "baz"] for (const [key, value] of mymap) { console.log(`${key}: ${value}`) } // 0: foo // 1: bar // [object]: baz specifications specification ecmascript (ecma-262)the definition of 'map.prototype[@@iterator]()' in that specification.
get Map[@@species] - JavaScript
however, you might want to overwrite this, in order to return parent map objects in your derived class methods: class mymap extends map { // overwrite mymap species to the parent map constructor static get [symbol.species]() { return map; } } specifications specification ecmascript (ecma-262)the definition of 'get map [ @@species ]' in that specification.
Map.prototype[@@toStringTag] - JavaScript
property attributes of map.prototype[@@tostringtag] writable no enumerable no configurable yes syntax map[symbol.tostringtag] examples using tostringtag object.prototype.tostring.call(new map()) // "[object map]" specifications specification ecmascript (ecma-262)the definition of 'map.prototype[@@tostringtag]' in that specification.
Map() constructor - JavaScript
examples creating a new map let mymap = new map([ [1, 'one'], [2, 'two'], [3, 'three'], ]) specifications specification ecmascript (ecma-262)the definition of 'map constructor' in that specification.
Map.prototype.clear() - JavaScript
examples using clear() var mymap = new map(); mymap.set('bar', 'baz'); mymap.set(1, 'foo'); mymap.size; // 2 mymap.has('bar'); // true mymap.clear(); mymap.size; // 0 mymap.has('bar') // false specifications specification ecmascript (ecma-262)the definition of 'map.prototype.clear' in that specification.
Map.prototype.entries() - JavaScript
examples using entries() let mymap = new map() mymap.set('0', 'foo') mymap.set(1, 'bar') mymap.set({}, 'baz') let mapiter = mymap.entries() console.log(mapiter.next().value) // ["0", "foo"] console.log(mapiter.next().value) // [1, "bar"] console.log(mapiter.next().value) // [object, "baz"] specifications specification ecmascript (ecma-262)the definition of 'map.prototype.entries' in that specification.
Map.prototype.forEach() - JavaScript
t the following code logs a line for each element in an map object: function logmapelements(value, key, map) { console.log(`map.get('${key}') = ${value}`) } new map([['foo', 3], ['bar', {}], ['baz', undefined]]).foreach(logmapelements) // logs: // "map.get('foo') = 3" // "map.get('bar') = [object object]" // "map.get('baz') = undefined" specifications specification ecmascript (ecma-262)the definition of 'map.prototype.foreach' in that specification.
Map.prototype.get() - JavaScript
examples using get() let mymap = new map(); mymap.set('bar', 'foo'); mymap.get('bar'); // returns "foo" mymap.get('baz'); // returns undefined specifications specification ecmascript (ecma-262)the definition of 'map.prototype.get' in that specification.
Map.prototype.has() - JavaScript
examples using has() let mymap = new map() mymap.set('bar', "foo") mymap.has('bar') // returns true mymap.has('baz') // returns false specifications specification ecmascript (ecma-262)the definition of 'map.prototype.has' in that specification.
Map.prototype.keys() - JavaScript
examples using keys() var mymap = new map(); mymap.set('0', 'foo'); mymap.set(1, 'bar'); mymap.set({}, 'baz'); var mapiter = mymap.keys(); console.log(mapiter.next().value); // "0" console.log(mapiter.next().value); // 1 console.log(mapiter.next().value); // object specifications specification ecmascript (ecma-262)the definition of 'map.prototype.keys' in that specification.
Map.prototype.set() - JavaScript
mymap.set('bar', 'foo') .set(1, 'foobar') .set(2, 'baz'); specifications specification ecmascript (ecma-262)the definition of 'map.prototype.set' in that specification.
Map.prototype.size - JavaScript
examples using size var mymap = new map(); mymap.set('a', 'alpha'); mymap.set('b', 'beta'); mymap.set('g', 'gamma'); mymap.size // 3 specifications specification ecmascript (ecma-262)the definition of 'map.prototype.size' in that specification.
Map.prototype.values() - JavaScript
examples using values() var mymap = new map(); mymap.set('0', 'foo'); mymap.set(1, 'bar'); mymap.set({}, 'baz'); var mapiter = mymap.values(); console.log(mapiter.next().value); // "foo" console.log(mapiter.next().value); // "bar" console.log(mapiter.next().value); // "baz" specifications specification ecmascript (ecma-262)the definition of 'map.prototype.values' in that specification.
Math.E - JavaScript
examples using math.e the following function returns e: function getnapier() { return math.e; } getnapier(); // 2.718281828459045 specifications specification ecmascript (ecma-262)the definition of 'math.e' in that specification.
Math.LN10 - JavaScript
examples using math.ln10 the following function returns the natural log of 10: function getnatlog10() { return math.ln10; } getnatlog10(); // 2.302585092994046 specifications specification ecmascript (ecma-262)the definition of 'math.ln10' in that specification.
Math.LN2 - JavaScript
examples using math.ln2 the following function returns the natural log of 2: function getnatlog2() { return math.ln2; } getnatlog2(); // 0.6931471805599453 specifications specification ecmascript (ecma-262)the definition of 'math.ln2' in that specification.
Math.LOG10E - JavaScript
examples using math.log10e the following function returns the base 10 logarithm of e: function getlog10e() { return math.log10e; } getlog10e(); // 0.4342944819032518 specifications specification ecmascript (ecma-262)the definition of 'math.log10e' in that specification.
Math.LOG2E - JavaScript
examples using math.log2e the following function returns the base 2 logarithm of e: function getlog2e() { return math.log2e; } getlog2e(); // 1.4426950408889634 specifications specification ecmascript (ecma-262)the definition of 'math.log2e' in that specification.
Math.PI - JavaScript
function calculatecircumference(radius) { return math.pi * (radius + radius); } calculatecircumference(1); // 6.283185307179586 specifications specification ecmascript (ecma-262)the definition of 'math.pi' in that specification.
Math.SQRT1_2 - JavaScript
examples using math.sqrt1_2 the following function returns 1 over the square root of 2: function getroot1_2() { return math.sqrt1_2; } getroot1_2(); // 0.7071067811865476 specifications specification ecmascript (ecma-262)the definition of 'math.sqrt1_2' in that specification.
Math.SQRT2 - JavaScript
examples using math.sqrt2 the following function returns the square root of 2: function getroot2() { return math.sqrt2; } getroot2(); // 1.4142135623730951 specifications specification ecmascript (ecma-262)the definition of 'math.sqrt2' in that specification.
Math.abs() - JavaScript
math.abs('-1'); // 1 math.abs(-2); // 2 math.abs(null); // 0 math.abs(''); // 0 math.abs([]); // 0 math.abs([2]); // 2 math.abs([1,2]); // nan math.abs({}); // nan math.abs('string'); // nan math.abs(); // nan specifications specification ecmascript (ecma-262)the definition of 'math.abs' in that specification.
Math.acos() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.acos' in that specification.
Math.acosh() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.acosh' in that specification.
Math.asin() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.asin' in that specification.
Math.asinh() - JavaScript
examples using math.asinh() math.asinh(1); // 0.881373587019543 math.asinh(0); // 0 specifications specification ecmascript (ecma-262)the definition of 'math.asinh' in that specification.
Math.atan() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.atan' in that specification.
Math.atan2() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.atan2' in that specification.
Math.atanh() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.atanh' in that specification.
Math.cbrt() - JavaScript
pow(x, 1/3); }; })(math.pow); // localize math.pow to increase efficiency } examples using math.cbrt() math.cbrt(nan); // nan math.cbrt(-1); // -1 math.cbrt(-0); // -0 math.cbrt(-infinity); // -infinity math.cbrt(0); // 0 math.cbrt(1); // 1 math.cbrt(infinity); // infinity math.cbrt(null); // 0 math.cbrt(2); // 1.2599210498948732 specifications specification ecmascript (ecma-262)the definition of 'math.cbrt' in that specification.
Math.ceil() - JavaScript
, 1); // -50 math.round10(-55.1, 1); // -60 // floor math.floor10(55.59, -1); // 55.5 math.floor10(59, 1); // 50 math.floor10(-55.51, -1); // -55.6 math.floor10(-51, 1); // -60 // ceil math.ceil10(55.51, -1); // 55.6 math.ceil10(51, 1); // 60 math.ceil10(-55.59, -1); // -55.5 math.ceil10(-59, 1); // -50 specifications specification ecmascript (ecma-262)the definition of 'math.ceil' in that specification.
Math.clz32() - JavaScript
)(math.log, math.ln2); examples using math.clz32() math.clz32(1); // 31 math.clz32(1000); // 22 math.clz32(); // 32 var stuff = [nan, infinity, -infinity, 0, -0, false, null, undefined, 'foo', {}, []]; stuff.every(n => math.clz32(n) == 32); // true math.clz32(true); // 31 math.clz32(3.5); // 30 specifications specification ecmascript (ecma-262)the definition of 'math.clz32' in that specification.
Math.cos() - JavaScript
examples using math.cos() math.cos(0); // 1 math.cos(1); // 0.5403023058681398 math.cos(math.pi); // -1 math.cos(2 * math.pi); // 1 specifications specification ecmascript (ecma-262)the definition of 'math.cos' in that specification.
Math.cosh() - JavaScript
sh = math.cosh || function(x) { return (math.exp(x) + math.exp(-x)) / 2; } or using only one call to the math.exp() function: math.cosh = math.cosh || function(x) { var y = math.exp(x); return (y + 1 / y) / 2; }; examples using math.cosh() math.cosh(0); // 1 math.cosh(1); // 1.5430806348152437 math.cosh(-1); // 1.5430806348152437 specifications specification ecmascript (ecma-262)the definition of 'math.cosh' in that specification.
Math.exp() - JavaScript
examples using math.exp() math.exp(-1); // 0.36787944117144233 math.exp(0); // 1 math.exp(1); // 2.718281828459045 specifications specification ecmascript (ecma-262)the definition of 'math.exp' in that specification.
Math.expm1() - JavaScript
polyfill this can be emulated with the help of the math.exp() function: math.expm1 = math.expm1 || function(x) { return math.exp(x) - 1; }; examples using math.expm1() math.expm1(-1); // -0.6321205588285577 math.expm1(0); // 0 math.expm1(1); // 1.718281828459045 specifications specification ecmascript (ecma-262)the definition of 'math.expm1' in that specification.
Math.floor() - JavaScript
-55.5 round10(-55.551, -1); // -55.6 round10(-55, 1); // -50 round10(-55.1, 1); // -60 // floor floor10(55.59, -1); // 55.5 floor10(59, 1); // 50 floor10(-55.51, -1); // -55.6 floor10(-51, 1); // -60 // ceil ceil10(55.51, -1); // 55.6 ceil10(51, 1); // 60 ceil10(-55.59, -1); // -55.5 ceil10(-59, 1); // -50 specifications specification ecmascript (ecma-262)the definition of 'math.floor' in that specification.
Math.fround() - JavaScript
977661 math.fround(1.337) === 1.337; // false 21502^150 is too big for a 32-bit float, so infinity is returned: 2 ** 150; // 1.42724769270596e+45 math.fround(2 ** 150); // infinity if the parameter cannot be converted to a number, or it is not-a-number (nan), math.fround() will return nan: math.fround('abc'); // nan math.fround(nan); // nan specifications specification ecmascript (ecma-262)the definition of 'math.fround' in that specification.
Math.hypot() - JavaScript
(3, 4); // 5 math.hypot(3, 4, 5); // 7.0710678118654755 math.hypot(); // 0 math.hypot(nan); // nan math.hypot(nan, infinity); // infinity math.hypot(3, 4, 'foo'); // nan, since +'foo' => nan math.hypot(3, 4, '5'); // 7.0710678118654755, +'5' => 5 math.hypot(-3); // 3, the same as math.abs(-3) specifications specification ecmascript (ecma-262)the definition of 'math.hypot' in that specification.
Math.imul() - JavaScript
x1fffffff800001 < number.max_safe_integer /*0x1fffffffffffff*/ if (opa & 0xffc00000 /*!== 0*/) result += (opa & 0xffc00000) * opb |0; return result |0; }; examples using math.imul() math.imul(2, 4); // 8 math.imul(-1, 8); // -8 math.imul(-2, -2); // 4 math.imul(0xffffffff, 5); // -5 math.imul(0xfffffffe, 5); // -10 specifications specification ecmascript (ecma-262)the definition of 'math.imul' in that specification.
Math.log() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.log' in that specification.
Math.log10() - JavaScript
examples using math.log10() math.log10(2); // 0.3010299956639812 math.log10(1); // 0 math.log10(0); // -infinity math.log10(-2); // nan math.log10(100000); // 5 polyfill this can be emulated with the following function: math.log10 = math.log10 || function(x) { return math.log(x) * math.log10e; }; specifications specification ecmascript (ecma-262)the definition of 'math.log10' in that specification.
Math.log1p() - JavaScript
x : x * (math.log(x + 1) / nearx); }; examples using math.log1p() math.log1p(1); // 0.6931471805599453 math.log1p(0); // 0 math.log1p(-1); // -infinity math.log1p(-2); // nan specifications specification ecmascript (ecma-262)the definition of 'math.log1p' in that specification.
Math.log2() - JavaScript
if (!math.log2) math.log2 = function(x) { return math.log(x) * math.log2e; }; examples using math.log2() math.log2(3); // 1.584962500721156 math.log2(2); // 1 math.log2(1); // 0 math.log2(0); // -infinity math.log2(-2); // nan math.log2(1024); // 10 specifications specification ecmascript (ecma-262)the definition of 'math.log2' in that specification.
Math.max() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.max' in that specification.
Math.min() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.min' in that specification.
Math.pow() - JavaScript
49 (squares are positive) math.pow(-7, 3); // -343 (cubes can be negative) math.pow(-7, 0.5); // nan (negative numbers don't have a real square root) // due to "even" and "odd" roots laying close to each other, // and limits in the floating number precision, // negative bases with fractional exponents always return nan math.pow(-7, 1/3); // nan specifications specification ecmascript (ecma-262)the definition of 'math.pow' in that specification.
Math.random() - JavaScript
function getrandomintinclusive(min, max) { min = math.ceil(min); max = math.floor(max); return math.floor(math.random() * (max - min + 1) + min); //the maximum is inclusive and the minimum is inclusive } specifications specification ecmascript (ecma-262)the definition of 'math.random' in that specification.
Math.random() - JavaScript
function getrandomintinclusive(min, max) { min = math.ceil(min); max = math.floor(max); return math.floor(math.random() * (max - min + 1) + min); //the maximum is inclusive and the minimum is inclusive } specifications specification ecmascript (ecma-262)the definition of 'math.random' in that specification.
Math.round() - JavaScript
examples using round math.round( 20.49); // 20 math.round( 20.5 ); // 21 math.round( 42 ); // 42 math.round(-20.5 ); // -20 math.round(-20.51); // -21 specifications specification ecmascript (ecma-262)the definition of 'math.round' in that specification.
Math.sign() - JavaScript
examples using math.sign() math.sign(3); // 1 math.sign(-3); // -1 math.sign('-3'); // -1 math.sign(0); // 0 math.sign(-0); // -0 math.sign(nan); // nan math.sign('foo'); // nan math.sign(); // nan specifications specification ecmascript (ecma-262)the definition of 'math.sign' in that specification.
Math.sin() - JavaScript
examples using math.sin() math.sin(0); // 0 math.sin(1); // 0.8414709848078965 math.sin(math.pi / 2); // 1 specifications specification ecmascript (ecma-262)the definition of 'math.sin' in that specification.
Math.sinh() - JavaScript
help of the math.exp() function: math.sinh = math.sinh || function(x) { return (math.exp(x) - math.exp(-x)) / 2; } or using only one call to the math.exp() function: math.sinh = math.sinh || function(x) { var y = math.exp(x); return (y - 1 / y) / 2; } examples using math.sinh() math.sinh(0); // 0 math.sinh(1); // 1.1752011936438014 specifications specification ecmascript (ecma-262)the definition of 'math.sinh' in that specification.
Math.sqrt() - JavaScript
examples using math.sqrt() math.sqrt(9); // 3 math.sqrt(2); // 1.414213562373095 math.sqrt(1); // 1 math.sqrt(0); // 0 math.sqrt(-1); // nan math.sqrt(-0); // -0 specifications specification ecmascript (ecma-262)the definition of 'math.sqrt' in that specification.
Math.tan() - JavaScript
function gettandeg(deg) { var rad = deg * math.pi/180; return math.tan(rad); } specifications specification ecmascript (ecma-262)the definition of 'math.tan' in that specification.
Math.tanh() - JavaScript
-1 : (a - b) / (a + b); } examples using math.tanh() math.tanh(0); // 0 math.tanh(infinity); // 1 math.tanh(1); // 0.7615941559557649 specifications specification ecmascript (ecma-262)the definition of 'math.tanh' in that specification.
Math.trunc() - JavaScript
math.ceil(v) : math.floor(v); }; } examples using math.trunc() math.trunc(13.37); // 13 math.trunc(42.84); // 42 math.trunc(0.123); // 0 math.trunc(-0.123); // -0 math.trunc('-1.123'); // -1 math.trunc(nan); // nan math.trunc('foo'); // nan math.trunc(); // nan specifications specification ecmascript (ecma-262)the definition of 'math.trunc' in that specification.
Math - JavaScript
returning a random integer between two bounds this can be achieved with a combination of math.random() and math.floor(): function random(min, max) { const num = math.floor(math.random() * (max - min + 1)) + min; return num; } random(1, 10); specifications specification ecmascript (ecma-262)the definition of 'math' in that specification.
NaN - JavaScript
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.
Number.EPSILON - JavaScript
polyfill if (number.epsilon === undefined) { number.epsilon = math.pow(2, -52); } examples testing equality x = 0.2; y = 0.3; z = 0.1; equal = (math.abs(x - y + z) < number.epsilon); specifications specification ecmascript (ecma-262)the definition of 'number.epsilon' in that specification.
Number.MAX_SAFE_INTEGER - JavaScript
number.max_safe_integer * number.epsilon; // 2 specifications specification ecmascript (ecma-262)the definition of 'number.max_safe_integer' in that specification.
Number.MAX_VALUE - JavaScript
if (num1 * num2 <= number.max_value) { func1(); } else { func2(); } specifications specification ecmascript (ecma-262)the definition of 'number.max_value' in that specification.
Number.MIN_SAFE_INTEGER - JavaScript
examples using min_safe_integer number.min_safe_integer // -9007199254740991 -(math.pow(2, 53) - 1) // -9007199254740991 specifications specification ecmascript (ecma-262)the definition of 'number.min_safe_integer' in that specification.
Number.MIN_VALUE - JavaScript
if (num1 / num2 >= number.min_value) { func1(); } else { func2(); } specifications specification ecmascript (ecma-262)the definition of 'number.min_value' in that specification.
Number.NEGATIVE_INFINITY - JavaScript
var smallnumber = (-number.max_value) * 2; if (smallnumber === number.negative_infinity) { smallnumber = returnfinite(); } specifications specification ecmascript (ecma-262)the definition of 'number.negative_infinity' in that specification.
Number.NaN - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'number.nan' in that specification.
Number() constructor - JavaScript
examples creating number objects const a = new number('123'); // a === 123 is false const b = number('123'); // b === 123 is true a instanceof number; // is true b instanceof number; // is false specifications specification ecmascript (ecma-262)the definition of 'number constructor' in that specification.
Number.POSITIVE_INFINITY - JavaScript
var bignumber = number.max_value * 2; if (bignumber == number.positive_infinity) { bignumber = returnfinite(); } specifications specification ecmascript (ecma-262)the definition of 'number.positive_infinity' in that specification.
Number.isFinite() - JavaScript
// false number.isfinite(-infinity); // false number.isfinite(0); // true number.isfinite(2e64); // true number.isfinite('0'); // false, would've been true with // global isfinite('0') number.isfinite(null); // false, would've been true with // global isfinite(null) specifications specification ecmascript (ecma-262)the definition of 'number.isinteger' in that specification.
Number.isInteger() - JavaScript
nteger(infinity); // false number.isinteger(-infinity); // false number.isinteger('10'); // false number.isinteger(true); // false number.isinteger(false); // false number.isinteger([1]); // false number.isinteger(5.0); // true number.isinteger(5.000000000000001); // false number.isinteger(5.0000000000000001); // true specifications specification ecmascript (ecma-262)the definition of 'number.isinteger' in that specification.
Number.isNaN() - JavaScript
ld have been true with global isnan() number.isnan('nan'); // false number.isnan(undefined); // false number.isnan({}); // false number.isnan('blabla'); // false // these all return false number.isnan(true); number.isnan(null); number.isnan(37); number.isnan('37'); number.isnan('37.37'); number.isnan(''); number.isnan(' '); specifications specification ecmascript (ecma-262)the definition of 'number.isnan' in that specification.
Number.isSafeInteger() - JavaScript
h.pow(2, 53)); // false number.issafeinteger(math.pow(2, 53) - 1); // true number.issafeinteger(nan); // false number.issafeinteger(infinity); // false number.issafeinteger('3'); // false number.issafeinteger(3.1); // false number.issafeinteger(3.0); // true specifications specification ecmascript (ecma-262)the definition of 'number.issafeinteger' in that specification.
Number.prototype.toExponential() - JavaScript
examples using toexponential var numobj = 77.1234; console.log(numobj.toexponential()); // logs 7.71234e+1 console.log(numobj.toexponential(4)); // logs 7.7123e+1 console.log(numobj.toexponential(2)); // logs 7.71e+1 console.log(77.1234.toexponential()); // logs 7.71234e+1 console.log(77 .toexponential()); // logs 7.7e+1 specifications specification ecmascript (ecma-262)the definition of 'number.prototype.toexponential' in that specification.
Number.prototype.toFixed() - JavaScript
note it rounds down - see warning above -2.34.tofixed(1) // returns -2.3 (due to operator precedence, negative number literals don't return a string...) (-2.34).tofixed(1) // returns '-2.3' specifications specification ecmascript (ecma-262)the definition of 'number.prototype.tofixed' in that specification.
Number.prototype.toString() - JavaScript
)) // displays '10' console.log((17).tostring()) // displays '17' console.log((17.2).tostring()) // displays '17.2' let x = 6 console.log(x.tostring(2)) // displays '110' console.log((254).tostring(16)) // displays 'fe' console.log((-10).tostring(2)) // displays '-1010' console.log((-0xff).tostring(2)) // displays '-11111111' specifications specification ecmascript (ecma-262)the definition of 'number.prototype.tostring' in that specification.
Number.prototype.valueOf() - JavaScript
examples using valueof let numobj = new number(10) console.log(typeof numobj) // object let num = numobj.valueof() console.log(num) // 10 console.log(typeof num) // number specifications specification ecmascript (ecma-262)the definition of 'number.prototype.valueof' in that specification.
Object() constructor - JavaScript
examples creating a new object let o = new object() o.foo = 42 console.log(o) // object { foo: 42 } using object given undefined and null types the following examples store an empty object object in o: let o = new object() let o = new object(undefined) let o = new object(null) specifications specification ecmascript (ecma-262)the definition of 'object constructor' in that specification.
Object.prototype.__defineSetter__() - JavaScript
t value(val) { this.anothervalue = val; } }; o.value = 5; console.log(o.value); // undefined console.log(o.anothervalue); // 5 // using object.defineproperty var o = {}; object.defineproperty(o, 'value', { set: function(val) { this.anothervalue = val; } }); o.value = 5; console.log(o.value); // undefined console.log(o.anothervalue); // 5 specifications specification ecmascript (ecma-262)the definition of 'object.prototype.__definesetter__()' in that specification.
Object.prototype.__lookupGetter__() - JavaScript
'foo' : 'bar'; }) specifications specification ecmascript (ecma-262)the definition of 'object.prototype.__lookupgetter__()' in that specification.
Object.prototype.__lookupSetter__() - JavaScript
rd-compliant and non-standard ways to get a property setter var obj = { set foo(value) { this.bar = value; } }; // non-standard and deprecated way obj.__lookupsetter__('foo') // (function(value) { this.bar = value; }) // standard-compliant way object.getownpropertydescriptor(obj, 'foo').set; // (function(value) { this.bar = value; }) specifications specification ecmascript (ecma-262)the definition of 'object.prototype.__lookupsetter__()' in that specification.
Object.assign() - JavaScript
rce).foreach(sym => { let descriptor = object.getownpropertydescriptor(source, sym); if (descriptor.enumerable) { descriptors[sym] = descriptor; } }); object.defineproperties(target, descriptors); }); return target; } copy = completeassign({}, obj); console.log(copy); // { foo:1, get bar() { return 2 } } specifications specification ecmascript (ecma-262)the definition of 'object.assign' in that specification.
Object.prototype.constructor - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'object.prototype.constructor' in that specification.
Object.defineProperties() - JavaScript
}); specifications specification ecmascript (ecma-262)the definition of 'object.defineproperties' in that specification.
Object.defineProperty() - JavaScript
function myclass() { } myclass.prototype.x = 1; object.defineproperty(myclass.prototype, "y", { writable: false, value: 1 }); var a = new myclass(); a.x = 2; console.log(a.x); // 2 console.log(myclass.prototype.x); // 1 a.y = 2; // ignored, throws in strict mode console.log(a.y); // 1 console.log(myclass.prototype.y); // 1 specifications specification ecmascript (ecma-262)the definition of 'object.defineproperty' in that specification.
Object.entries() - JavaScript
const obj = { foo: 'bar', baz: 42 }; object.entries(obj).foreach(([key, value]) => console.log(`${key}: ${value}`)); // "foo: bar", "baz: 42" specifications specification ecmascript (ecma-262)the definition of 'object.entries' in that specification.
Object.freeze() - JavaScript
f for (let name of propnames) { let value = object[name]; if(value && typeof value === "object") { deepfreeze(value); } } return object.freeze(object); } var obj2 = { internal: { a: null } }; deepfreeze(obj2); obj2.internal.a = 'anothervalue'; // fails silently in non-strict mode obj2.internal.a; // null specifications specification ecmascript (ecma-262)the definition of 'object.freeze' in that specification.
Object.fromEntries() - JavaScript
for more details, refer to: https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 specifications specification ecmascript (ecma-262)the definition of 'object.fromentries' in that specification.
Object.getOwnPropertyDescriptor() - JavaScript
object.getownpropertydescriptor('foo', 0); // typeerror: "foo" is not an object // es5 code object.getownpropertydescriptor('foo', 0); // object returned by es2015 code: { // configurable: false, // enumerable: true, // value: "f", // writable: false // } specifications specification ecmascript (ecma-262)the definition of 'object.getownpropertydescriptor' in that specification.
Object.getOwnPropertyDescriptors() - JavaScript
instead, you can use this code to set the prototype: function superclass() {} superclass.prototype = { // define your methods and properties here }; function subclass() {} subclass.prototype = object.create( superclass.prototype, { // define your methods and properties here } ); specifications specification ecmascript (ecma-262)the definition of 'object.getownpropertydescriptors' in that specification.
Object.getOwnPropertyNames() - JavaScript
r 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.
Object.getOwnPropertySymbols() - JavaScript
es using getownpropertysymbols var obj = {}; var a = symbol('a'); var b = symbol.for('b'); obj[a] = 'localsymbol'; obj[b] = 'globalsymbol'; var objectsymbols = object.getownpropertysymbols(obj); console.log(objectsymbols.length); // 2 console.log(objectsymbols); // [symbol(a), symbol(b)] console.log(objectsymbols[0]); // symbol(a) specifications specification ecmascript (ecma-262)the definition of 'object.getownpropertysymbols' in that specification.
Object.getPrototypeOf() - JavaScript
object.getprototypeof('foo'); // typeerror: "foo" is not an object (es5 code) object.getprototypeof('foo'); // string.prototype (es2015 code) specifications specification ecmascript (ecma-262)the definition of 'object.getprototypeof' in that specification.
Object.prototype.hasOwnProperty() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'object.prototype.hasownproperty' in that specification.
Object.is() - JavaScript
'bar'); // false object.is([], []); // false var foo = { a: 1 }; var bar = { a: 1 }; object.is(foo, foo); // true object.is(foo, bar); // false object.is(null, null); // true // special cases object.is(0, -0); // false object.is(-0, -0); // true object.is(nan, 0/0); // true specifications specification ecmascript (ecma-262)the definition of 'object.is' in that specification.
Object.isExtensible() - JavaScript
object.isextensible(1); // typeerror: 1 is not an object (es5 code) object.isextensible(1); // false (es2015 code) specifications specification ecmascript (ecma-262)the definition of 'object.isextensible' in that specification.
Object.isFrozen() - JavaScript
object.isfrozen(1); // typeerror: 1 is not an object (es5 code) object.isfrozen(1); // true (es2015 code) specifications specification ecmascript (ecma-262)the definition of 'object.isfrozen' in that specification.
Object.prototype.isPrototypeOf() - JavaScript
for example, check if baz object descends from foo.prototype: if (foo.prototype.isprototypeof(baz)) { // do something safe } specifications specification ecmascript (ecma-262)the definition of 'object.prototype.isprototypeof' in that specification.
Object.isSealed() - JavaScript
object.issealed(1); // typeerror: 1 is not an object (es5 code) object.issealed(1); // true (es2015 code) specifications specification ecmascript (ecma-262)the definition of 'object.issealed' in that specification.
Object.keys() - JavaScript
// in es5 object.keys('foo'); // typeerror: "foo" is not an object // in es2015+ object.keys('foo'); // ["0", "1", "2"] specifications specification ecmascript (ecma-262)the definition of 'object.keys' in that specification.
Object.preventExtensions() - JavaScript
object.preventextensions(1); // typeerror: 1 is not an object (es5 code) object.preventextensions(1); // 1 (es2015 code) specifications specification ecmascript (ecma-262)the definition of 'object.preventextensions' in that specification.
Object.prototype.propertyIsEnumerable() - JavaScript
these return false as they are on the prototype which // propertyisenumerable does not consider (even though the last two // are iteratable with for-in) o.propertyisenumerable('prototype'); // returns false (as of js 1.8.1/ff3.6) o.propertyisenumerable('constructor'); // returns false o.propertyisenumerable('firstmethod'); // returns false specifications specification ecmascript (ecma-262)the definition of 'object.prototype.propertyisenumerable' in that specification.
Object.seal() - JavaScript
object.seal(1); // typeerror: 1 is not an object (es5 code) object.seal(1); // 1 (es2015 code) specifications specification ecmascript (ecma-262)the definition of 'object.seal' in that specification.
Object.prototype.toLocaleString() - JavaScript
with the correct separators: for example: const testnumber = 2901234564; // "2901234564" let denumber = testnumber.tolocalestring('de'); // "2.901.234.564" let frnumber = testnumber.tolocalestring('fr'); // "2 901 234 564" specifications specification ecmascript (ecma-262)the definition of 'object.prototype.tolocalestring' in that specification.
Object.prototype.valueOf() - JavaScript
+ 2" // nan (doesn't evaluate) +new date() // same as (new date()).gettime() +"foo" // nan (string to number) +{} // nan +[] // 0 (tostring() returns an empty string list) +[1] // 1 +[1,2] // nan +new set([1]) // nan +bigint(1) // uncaught typeerror: cannot convert a bigint value to a number +undefined // nan +null // 0 +true // 1 +false // 0 specifications specification ecmascript (ecma-262)the definition of 'object.prototype.valueof' in that specification.
Object.values() - JavaScript
aylikeobj2 )); // ['b', 'c', 'a'] // getfoo is property which isn't enumerable const my_obj = object.create({}, { getfoo: { value: function() { return this.foo; } } }); my_obj.foo = 'bar'; console.log(object.values(my_obj)); // ['bar'] // non-object argument will be coerced to an object console.log(object.values('foo')); // ['f', 'o', 'o'] specifications specification ecmascript (ecma-262)the definition of 'object.values' in that specification.
Promise() constructor - JavaScript
turn a promise to provide a function with promise functionality, have it return a promise: function myasyncfunction(url) { return new promise((resolve, reject) => { const xhr = new xmlhttprequest() xhr.open("get", url) xhr.onload = () => resolve(xhr.responsetext) xhr.onerror = () => reject(xhr.statustext) xhr.send() }); } specifications specification ecmascript (ecma-262)the definition of 'promise constructor' in that specification.
Promise.all() - JavaScript
solution'), 1000); }); var p2 = new promise((resolve, reject) => { reject(new error('p2_immediate_rejection')); }); promise.all([ p1.catch(error => { return error }), p2.catch(error => { return error }), ]).then(values => { console.log(values[0]) // "p1_delayed_resolution" console.error(values[1]) // "error: p2_immediate_rejection" }) specifications specification ecmascript (ecma-262)the definition of 'promise.all' in that specification.
Promise.allSettled() - JavaScript
mise.resolve(33), new promise(resolve => settimeout(() => resolve(66), 0)), 99, promise.reject(new error('an error')) ]) .then(values => console.log(values)); // [ // {status: "fulfilled", value: 33}, // {status: "fulfilled", value: 66}, // {status: "fulfilled", value: 99}, // {status: "rejected", reason: error: an error} // ] specifications specification ecmascript (ecma-262)the definition of 'promise.allsettled' in that specification.
Promise.prototype.catch() - JavaScript
son) { //this is never called console.error("catch p1!"); console.error(reason); }); p2.then(function (value) { console.log("next promise's onfulfilled"); /* next promise's onfulfilled */ console.log(value); /* calling next */ }, function (reason) { console.log("next promise's onrejected"); console.log(reason); }); specifications specification ecmascript (ecma-262)the definition of 'promise.prototype.catch' in that specification.
Promise.prototype.finally() - JavaScript
for more details, refer to: https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 specifications specification ecmascript (ecma-262)the definition of 'promise.prototype.finally' in that specification.
Promise.race() - JavaScript
e(function(resolve, reject) { settimeout(() => resolve('five'), 500); }); var p6 = new promise(function(resolve, reject) { settimeout(() => reject(new error('six')), 100); }); promise.race([p5, p6]) .then(function(value) { // not called }, function(error) { console.log(error.message); // "six" // p6 is faster, so it rejects }); specifications specification ecmascript (ecma-262)the definition of 'promise.race' in that specification.
Promise.reject() - JavaScript
examples using the static promise.reject() method promise.reject(new error('fail')).then(function() { // not called }, function(error) { console.error(error); // stacktrace }); specifications specification ecmascript (ecma-262)the definition of 'promise.reject' in that specification.
Promise.resolve() - JavaScript
nction(e) { console.error(e); // typeerror: throwing }); // thenable throws after callback // promise resolves var thenable = { then: function(resolve) { resolve('resolving'); throw new typeerror('throwing'); }}; var p3 = promise.resolve(thenable); p3.then(function(v) { console.log(v); // "resolving" }, function(e) { // not called }); specifications specification ecmascript (ecma-262)the definition of 'promise.resolve' in that specification.
Promise.prototype.then() - JavaScript
promise.resolve(args).then(rfab(null, fn, null)) : nexttickpromise(), undefined ); nexttick.ntp = nexttickpromise; return nexttick; })(); specifications specification ecmascript (ecma-262)the definition of 'promise.prototype.then' in that specification.
Promise - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'promise' in that specification.
handler.apply() - JavaScript
const p = new proxy(function() {}, { apply: function(target, thisarg, argumentslist) { console.log('called: ' + argumentslist.join(', ')); return argumentslist[0] + argumentslist[1] + argumentslist[2]; } }); console.log(p(1, 2, 3)); // "called: 1, 2, 3" // 6 specifications specification ecmascript (ecma-262)the definition of '[[call]]' in that specification.
handler.construct() - JavaScript
const p = new proxy({}, { construct: function(target, argumentslist, newtarget) { return {}; } }); new p(); // typeerror is thrown, "p" is not a constructor specifications specification ecmascript (ecma-262)the definition of '[[construct]]' in that specification.
handler.defineProperty() - JavaScript
es will be ignored): enumerable configurable writable value get set const p = new proxy({}, { defineproperty(target, prop, descriptor) { console.log(descriptor); return reflect.defineproperty(target, prop, descriptor); } }); object.defineproperty(p, 'name', { value: 'proxy', type: 'custom' }); // { value: 'proxy' } specifications specification ecmascript (ecma-262)the definition of '[[defineownproperty]]' in that specification.
handler.deleteProperty() - JavaScript
} else { console.log('property not found: ' + prop) return false } } }) let result p.a = 10 console.log('a' in p) // true result = delete p.a // "property removed: a" console.log(result) // true console.log('a' in p) // false result = delete p.a // "property not found: a" console.log(result) // false specifications specification ecmascript (ecma-262)the definition of '[[delete]]' in that specification.
handler.get() - JavaScript
const obj = {}; object.defineproperty(obj, 'a', { configurable: false, enumerable: false, value: 10, writable: false }); const p = new proxy(obj, { get: function(target, property) { return 20; } }); p.a; // typeerror is thrown specifications specification ecmascript (ecma-262)the definition of '[[get]]' in that specification.
handler.getOwnPropertyDescriptor() - JavaScript
const obj = { a: 10 }; object.preventextensions(obj); const p = new proxy(obj, { getownpropertydescriptor: function(target, prop) { return undefined; } }); object.getownpropertydescriptor(p, 'a'); // typeerror is thrown specifications specification ecmascript (ecma-262)the definition of '[[getownproperty]]' in that specification.
handler.getPrototypeOf() - JavaScript
w proxy(obj, { getprototypeof(target) { return 'foo'; } }); object.getprototypeof(p); // typeerror: "foo" is not an object or null const obj = object.preventextensions({}); const p = new proxy(obj, { getprototypeof(target) { return {}; } }); object.getprototypeof(p); // typeerror: expected same prototype value specifications specification ecmascript (ecma-262)the definition of '[[getprototypeof]]' in that specification.
handler.has() - JavaScript
const obj = { a: 10 }; object.preventextensions(obj); const p = new proxy(obj, { has: function(target, prop) { return false; } }); 'a' in p; // typeerror is thrown specifications specification ecmascript (ecma-262)the definition of '[[hasproperty]]' in that specification.
handler.isExtensible() - JavaScript
const p = new proxy({}, { isextensible: function(target) { return false; } }); object.isextensible(p); // typeerror is thrown specifications specification ecmascript (ecma-262)the definition of '[[isextensible]]' in that specification.
handler.ownKeys() - JavaScript
j, 'a', { configurable: false, enumerable: true, value: 10 } ); const p = new proxy(obj, { ownkeys: function(target) { return [123, 12.5, true, false, undefined, null, {}, []]; } }); console.log(object.getownpropertynames(p)); // typeerror: proxy [[ownpropertykeys]] must return an array // with only string and symbol elements specifications specification ecmascript (ecma-262)the definition of '[[ownpropertykeys]]' in that specification.
handler.preventExtensions() - JavaScript
const p = new proxy({}, { preventextensions: function(target) { return true; } }); object.preventextensions(p); // typeerror is thrown specifications specification ecmascript (ecma-262)the definition of '[[preventextensions]]' in that specification.
handler.set() - JavaScript
const p = new proxy({}, { set: function(target, prop, value, receiver) { target[prop] = value; console.log('property set: ' + prop + ' = ' + value); return true; } }) console.log('a' in p); // false p.a = 10; // "property set: a = 10" console.log('a' in p); // true console.log(p.a); // 10 specifications specification ecmascript (ecma-262)the definition of '[[set]]' in that specification.
handler.setPrototypeOf() - JavaScript
const handlerthrows = { setprototypeof(target, newproto) { throw new error('custom error'); } }; const newproto = {}, target = {}; const p2 = new proxy(target, handlerthrows); object.setprototypeof(p2, newproto); // throws new error("custom error") reflect.setprototypeof(p2, newproto); // throws new error("custom error") specifications specification ecmascript (ecma-262)the definition of '[[setprototypeof]]' in that specification.
Proxy() constructor - JavaScript
oxied: "original value" }; const handler = { get: function(target, prop, receiver) { if (prop === "proxied") { return "replaced value"; } return reflect.get(...arguments); } }; const proxy = new proxy(target, handler); console.log(proxy.notproxied); // "original value" console.log(proxy.proxied); // "replaced value" specifications specification ecmascript (ecma-262)the definition of 'proxy constructor' in that specification.
Proxy.revocable() - JavaScript
target, name) { return "[[" + name + "]]"; } }); var proxy = revocable.proxy; console.log(proxy.foo); // "[[foo]]" revocable.revoke(); console.log(proxy.foo); // typeerror is thrown proxy.foo = 1 // typeerror again delete proxy.foo; // still typeerror typeof proxy // "object", typeof doesn't trigger any trap specifications specification ecmascript (ecma-262)the definition of 'proxy revocation functions' in that specification.
Proxy - JavaScript
{ value: vvalue, writable: true, enumerable: true, configurable: false } : undefined; }, }); /* cookies test */ console.log(doccookies.my_cookie1 = 'first value'); console.log(doccookies.getitem('my_cookie1')); doccookies.setitem('my_cookie1', 'changed value'); console.log(doccookies.my_cookie1); specifications specification ecmascript (ecma-262)the definition of 'proxy' in that specification.
RangeError() constructor - JavaScript
error (for non-numeric values) function check(value) { if(["apple", "banana", "carrot"].includes(value) === false) { throw new rangeerror('the argument must be an "apple", "banana", or "carrot".') } } try { check("cabbage") } catch(error) { if(error instanceof rangeerror) { // handle the error } } specifications specification ecmascript (ecma-262)the definition of 'nativeerror constructors' in that specification.
ReferenceError() constructor - JavaScript
console.log(e.message) // "hello" console.log(e.name) // "referenceerror" console.log(e.filename) // "somefile.js" console.log(e.linenumber) // 10 console.log(e.columnnumber) // 0 console.log(e.stack) // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification.
Reflect.apply() - JavaScript
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.construct() - JavaScript
} let obj3 = object.create(otherclass.prototype); oneclass.apply(obj3, args) // output: // oneclass // undefined examples using reflect.construct() let d = reflect.construct(date, [1776, 6, 4]) d instanceof date // true d.getfullyear() // 1776 specifications specification ecmascript (ecma-262)the definition of 'reflect.construct' in that specification.
Reflect.defineProperty() - JavaScript
] because reflect.defineproperty returns a boolean success status, you can just use an if...else block here: if (reflect.defineproperty(target, property, attributes)) { // success } else { // failure } specifications specification ecmascript (ecma-262)the definition of 'reflect.defineproperty' in that specification.
Reflect.deleteProperty() - JavaScript
// { y: 2 } let arr = [1, 2, 3, 4, 5] reflect.deleteproperty(arr, '3') // true arr // [1, 2, 3, undefined, 5] // returns true if no such property exists reflect.deleteproperty({}, 'foo') // true // returns false if a property is unconfigurable reflect.deleteproperty(object.freeze({foo: 1}), 'foo') // false specifications specification ecmascript (ecma-262)the definition of 'reflect.deleteproperty' in that specification.
Reflect.get() - JavaScript
dler let x = {p: 1}; let obj = new proxy(x, { get(t, k, r) { return k + 'bar' } }) reflect.get(obj, 'foo') // "foobar" //proxy with get handler and receiver let x = {p: 1, foo: 2}; let y = {foo: 3}; let obj = new proxy(x, { get(t, prop, receiver) { return receiver[prop] + 'bar' } }) reflect.get(obj, 'foo', y) // "3bar" specifications specification ecmascript (ecma-262)the definition of 'reflect.get' in that specification.
Reflect.getOwnPropertyDescriptor() - JavaScript
reflect.getownpropertydescriptor('foo', 0) // typeerror: "foo" is not non-null object object.getownpropertydescriptor('foo', 0) // { value: "f", writable: false, enumerable: true, configurable: false } specifications specification ecmascript (ecma-262)the definition of 'reflect.getownpropertydescriptor' in that specification.
Reflect.getPrototypeOf() - JavaScript
hrows typeerror reflect.getprototypeof('foo') // throws typeerror // in es2015 only reflect throws, object coerces non-objects object.getprototypeof('foo') // string.prototype reflect.getprototypeof('foo') // throws typeerror // to mimic the object es2015 behavior you need to coerce reflect.getprototypeof(object('foo')) // string.prototype specifications specification ecmascript (ecma-262)the definition of 'reflect.getprototypeof' in that specification.
Reflect.has() - JavaScript
{ has(t, k) { return k.startswith('door') } }); reflect.has(obj, 'doorbell') // true reflect.has(obj, 'dormitory') // false reflect.has returns true for any inherited properties, like the in operator: const a = {foo: 123} const b = {__proto__: a} const c = {__proto__: b} // the prototype chain is: c -> b -> a reflect.has(c, 'foo') // true specifications specification ecmascript (ecma-262)the definition of 'reflect.has' in that specification.
Reflect.isExtensible() - JavaScript
reflect.isextensible(1) // typeerror: 1 is not an object object.isextensible(1) // false specifications specification ecmascript (ecma-262)the definition of 'reflect.isextensible' in that specification.
Reflect.ownKeys() - JavaScript
symbol.for('comet') let sym2 = symbol.for('meteor') let obj = {[sym]: 0, 'str': 0, '773': 0, '0': 0, [sym2]: 0, '-1': 0, '8': 0, 'second str': 0} reflect.ownkeys(obj) // [ "0", "8", "773", "str", "-1", "second str", symbol(comet), symbol(meteor) ] // indexes in numeric order, // strings in insertion order, // symbols in insertion order specifications specification ecmascript (ecma-262)the definition of 'reflect.ownkeys' in that specification.
Reflect.preventExtensions() - JavaScript
reflect.preventextensions(1) // typeerror: 1 is not an object object.preventextensions(1) // 1 specifications specification ecmascript (ecma-262)the definition of 'reflect.preventextensions' in that specification.
Reflect.set() - JavaScript
let obj = {} reflect.set(obj) // true reflect.getownpropertydescriptor(obj, 'undefined') // { value: undefined, writable: true, enumerable: true, configurable: true } specifications specification ecmascript (ecma-262)the definition of 'reflect.set' in that specification.
Reflect.setPrototypeOf() - JavaScript
let target = {} let proto = object.create(target) reflect.setprototypeof(target, proto) // false specifications specification ecmascript (ecma-262)the definition of 'reflect.setprototypeof' in that specification.
Reflect - JavaScript
s ${this.name}`); } } reflect.has(duck, 'color'); // true reflect.has(duck, 'haircut'); // false returning the object's own keys reflect.ownkeys(duck); // [ "name", "color", "greeting" ] adding a new property to the object reflect.set(duck, 'eyes', 'black'); // returns "true" if successful // "duck" now contains the property "eyes: 'black'" specifications specification ecmascript (ecma-262)the definition of 'reflect' in that specification.
RegExp.prototype[@@match]() - JavaScript
console.log(result.group(1)); // 2016 console.log(result.group(2)); // 01 console.log(result.group(3)); // 02 specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype[@@match]' in that specification.
RegExp.prototype[@@matchAll]() - JavaScript
esult) { return null; } else { return array.from(result); } } } const re = new myregexp('([0-9]+)-([0-9]+)-([0-9]+)', 'g'); const str = '2016-01-02|2019-03-07'; const result = str.matchall(re); console.log(result[0]); // [ "2016-01-02", "2016", "01", "02" ] console.log(result[1]); // [ "2019-03-07", "2019", "03", "07" ] specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype[@@matchall]' in that specification.
RegExp.prototype[@@replace]() - JavaScript
console.log(newstr); // ###34567 specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype[@@replace]' in that specification.
RegExp.prototype[@@search]() - JavaScript
console.log(result); // 3 specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype[@@search]' in that specification.
get RegExp[@@species] - JavaScript
however, you might want to overwrite this, in order to return parent regexp objects in your derived class methods: class myregexp extends regexp { // overwrite myregexp species to the parent regexp constructor static get [symbol.species]() { return regexp; } } specifications specification ecmascript (ecma-262)the definition of 'get regexp [ @@species ]' in that specification.
RegExp.prototype[@@split]() - JavaScript
console.log(result); // ["(2016)", "(01)", "(02)"] specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype[@@split]' in that specification.
RegExp() constructor - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'regexp constructor' in that specification.
RegExp.prototype.compile() - JavaScript
var regexobj = new regexp('foo', 'gi'); regexobj.compile('new foo', 'g'); specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.compile' in that specification.
RegExp.prototype.dotAll - JavaScript
e.log(regex1.dotall); // output: true console.log(str1.replace(regex1,'')); // output: foo example var str2 = 'bar\nexample foo example'; var regex2 = new regexp('bar.example'); console.log(regex2.dotall); // output: false console.log(str2.replace(regex2,'')); // output: bar // example foo example specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.dotall' in that specification.
RegExp.prototype.exec() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'regexp.exec' in that specification.
RegExp.prototype.flags - JavaScript
polyfill if (regexp.prototype.flags === undefined) { object.defineproperty(regexp.prototype, 'flags', { configurable: true, get: function() { return this.tostring().match(/[gimsuy]*$/)[0]; } }); } examples using flags /foo/ig.flags; // "gi" /bar/myu.flags; // "muy" specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.flags' in that specification.
RegExp.prototype.global - JavaScript
examples using global var regex = new regexp('foo', 'g'); console.log(regex.global); // true var str = 'fooexamplefoo'; var str1 = str.replace(regex, ''); console.log(str1); // output: example var regex1 = new regexp('foo'); var str2 = str.replace(regex1, ''); console.log(str2); // output: examplefoo specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.global' in that specification.
RegExp.prototype.ignoreCase - JavaScript
examples using ignorecase var regex = new regexp('foo', 'i'); console.log(regex.ignorecase); // true specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.ignorecase' in that specification.
RegExpInstance.lastIndex - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'regexp.lastindex' in that specification.
RegExp.prototype.multiline - JavaScript
examples using multiline var regex = new regexp('foo', 'm'); console.log(regex.multiline); // true specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.multiline' in that specification.
RegExp.prototype.sticky - JavaScript
havior: var regex = /^foo/y; regex.lastindex = 2; regex.test('..foo'); // false - index 2 is not the beginning of the string var regex2 = /^foo/my; regex2.lastindex = 2; regex2.test('..foo'); // false - index 2 is not the beginning of the string or line regex2.lastindex = 2; regex2.test('.\nfoo'); // true - index 2 is the beginning of a line specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.sticky' in that specification.
RegExp.prototype.test() - JavaScript
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.
RegExp.prototype.toString() - JavaScript
examples using tostring() the following example displays the string value of a regexp object: var myexp = new regexp('a+b+c'); console.log(myexp.tostring()); // logs '/a+b+c/' var foo = new regexp('bar', 'g'); console.log(foo.tostring()); // logs '/bar/g' empty regular expressions and escaping starting with ecmascript 5, an empty regular expression returns the string "/(?:)/" and line terminators such as "\n" are escaped: new regexp().tostring(); // "/(?:)/" new regexp('\n').tostring() === '/\n/'; // true, prior to es5 new regexp('\n').tostring() === '/\\n/'; // true, starting with es5 specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.tostring'...
RegExp.prototype.unicode - JavaScript
examples using the unicode property var regex = new regexp('\u{61}', 'u'); console.log(regex.unicode); // true specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.unicode' in that specification.
Set.prototype[@@iterator]() - JavaScript
t.add(1); myset.add({}); const setiter = myset[symbol.iterator](); console.log(setiter.next().value); // "0" console.log(setiter.next().value); // 1 console.log(setiter.next().value); // object using [@@iterator]() with for..of const myset = new set(); myset.add('0'); myset.add(1); myset.add({}); for (const v of myset) { console.log(v); } specifications specification ecmascript (ecma-262)the definition of 'set.prototype[@@iterator]' in that specification.
get Set[@@species] - JavaScript
however, you might want to overwrite this, in order to return parent set objects in your derived class methods: class myset extends set { // overwrite myset species to the parent set constructor static get [symbol.species]() { return set; } } specifications specification ecmascript (ecma-262)the definition of 'get set [ @@species ]' in that specification.
Set() constructor - JavaScript
examples using the set object let myset = new set() myset.add(1) // set [ 1 ] myset.add(5) // set [ 1, 5 ] myset.add(5) // set [ 1, 5 ] myset.add('some text') // set [ 1, 5, 'some text' ] let o = {a: 1, b: 2} myset.add(o) specifications specification ecmascript (ecma-262)the definition of 'set constructor' in that specification.
Set.prototype.add() - JavaScript
examples using the add method var myset = new set(); myset.add(1); myset.add(5).add('some text'); // chainable console.log(myset); // set [1, 5, "some text"] specifications specification ecmascript (ecma-262)the definition of 'set.prototype.add' in that specification.
Set.prototype.clear() - JavaScript
examples using the clear method var myset = new set(); myset.add(1); myset.add('foo'); myset.size; // 2 myset.has('foo'); // true myset.clear(); myset.size; // 0 myset.has('bar') // false specifications specification ecmascript (ecma-262)the definition of 'set.prototype.clear' in that specification.
Set.prototype.delete() - JavaScript
setobj.foreach(function(point){ if (point.x > 10){ setobj.delete(point) } }) specifications specification ecmascript (ecma-262)the definition of 'set.prototype.delete' in that specification.
Set.prototype.entries() - JavaScript
examples using entries() var myset = new set(); myset.add('foobar'); myset.add(1); myset.add('baz'); var setiter = myset.entries(); console.log(setiter.next().value); // ["foobar", "foobar"] console.log(setiter.next().value); // [1, 1] console.log(setiter.next().value); // ["baz", "baz"] specifications specification ecmascript (ecma-262)the definition of 'set.prototype.entries' in that specification.
Set.prototype.forEach() - JavaScript
xamples logging the contents of a set object the following code logs a line for each element in a set object: function logsetelements(value1, value2, set) { console.log('s[' + value1 + '] = ' + value2); } new set(['foo', 'bar', undefined]).foreach(logsetelements); // logs: // "s[foo] = foo" // "s[bar] = bar" // "s[undefined] = undefined" specifications specification ecmascript (ecma-262)the definition of 'set.prototype.foreach' in that specification.
Set.prototype.has() - JavaScript
set = new set(); myset.add('foo'); myset.has('foo'); // returns true myset.has('bar'); // returns false var set1 = new set(); var obj1 = {'key1': 1}; set1.add(obj1); set1.has(obj1); // returns true set1.has({'key1': 1}); // returns false because they are different object references set1.add({'key1': 1}); // now set1 contains 2 entries specifications specification ecmascript (ecma-262)the definition of 'set.prototype.has' in that specification.
Set.prototype.size - JavaScript
examples using size var myset = new set(); myset.add(1); myset.add(5); myset.add('some text') myset.size; // 3 specifications specification ecmascript (ecma-262)the definition of 'set.prototype.size' in that specification.
Set.prototype.values() - JavaScript
examples using values() var myset = new set(); myset.add('foo'); myset.add('bar'); myset.add('baz'); var setiter = myset.values(); console.log(setiter.next().value); // "foo" console.log(setiter.next().value); // "bar" console.log(setiter.next().value); // "baz" specifications specification ecmascript (ecma-262)the definition of 'set.prototype.values' in that specification.
SharedArrayBuffer() constructor - JavaScript
var sab = sharedarraybuffer(1024); // typeerror: calling a builtin sharedarraybuffer constructor // without new is forbidden var sab = new sharedarraybuffer(1024); specifications specification ecmascript (ecma-262)the definition of 'sharedarraybuffer constructor' in that specification.
SharedArrayBuffer.prototype.byteLength - JavaScript
examples using bytelength var sab = new sharedarraybuffer(1024); sab.bytelength; // 1024 specifications specification ecmascript (ecma-262)the definition of 'sharedarraybuffer.prototype.bytelength' in that specification.
SharedArrayBuffer.prototype.slice() - JavaScript
examples using slice var sab = new sharedarraybuffer(1024); sab.slice(); // sharedarraybuffer { bytelength: 1024 } sab.slice(2); // sharedarraybuffer { bytelength: 1022 } sab.slice(-2); // sharedarraybuffer { bytelength: 2 } sab.slice(0, 1); // sharedarraybuffer { bytelength: 1 } specifications specification ecmascript (ecma-262)the definition of 'sharedarraybuffer.prototype.slice' in that specification.
SharedArrayBuffer - JavaScript
lice(-2); // sharedarraybuffer { bytelength: 2 } sab.slice(0, 1); // sharedarraybuffer { bytelength: 1 } using it in a webgl buffer const canvas = document.queryselector('canvas'); const gl = canvas.getcontext('webgl'); const buffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, buffer); gl.bufferdata(gl.array_buffer, sab, gl.static_draw); specifications specification ecmascript (ecma-262)the definition of 'sharedarraybuffer' in that specification.
String.prototype[@@iterator]() - JavaScript
dc68'; var striter = str[symbol.iterator](); console.log(striter.next().value); // "a" console.log(striter.next().value); // "\ud835\udc68" using [@@iterator]() with for..of var str = 'a\ud835\udc68b\ud835\udc69c\ud835\udc6a'; for (var v of str) { console.log(v); } // "a" // "\ud835\udc68" // "b" // "\ud835\udc69" // "c" // "\ud835\udc6a" specifications specification ecmascript (ecma-262)the definition of 'string.prototype[@@iterator]()' in that specification.
String() constructor - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'string constructor' in that specification.
String.prototype.anchor() - JavaScript
examples using anchor() var mystring = 'table of contents'; document.body.innerhtml = mystring.anchor('contents_anchor'); will output the following html: <a name="contents_anchor">table of contents</a> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.anchor' in that specification.
String.prototype.big() - JavaScript
hello, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <fontsize=7>hello, world</fontsize> with the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getelementbyid('yourelemid').style.fontsize = '2em'; specifications specification ecmascript (ecma-262)the definition of 'string.prototype.big' in that specification.
String.prototype.blink() - JavaScript
e uses string methods to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.blink()); // <blink>hello, world</blink> console.log(worldstring.bold()); // <b>hello, world</b> console.log(worldstring.italics()); // <i>hello, world</i> console.log(worldstring.strike()); // <strike>hello, world</strike> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.blink' in that specification.
String.prototype.bold() - JavaScript
e uses string methods to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.blink()); // <blink>hello, world</blink> console.log(worldstring.bold()); // <b>hello, world</b> console.log(worldstring.italics()); // <i>hello, world</i> console.log(worldstring.strike()); // <strike>hello, world</strike> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.bold' in that specification.
String.prototype.charCodeAt() - JavaScript
idx < 0) { return nan; } code = str.charcodeat(idx); var hi, low; if (0xd800 <= code && code <= 0xdbff) { hi = code; low = str.charcodeat(idx + 1); // go one further, since one of the "characters" // is part of a surrogate pair return ((hi - 0xd800) * 0x400) + (low - 0xdc00) + 0x10000; } return code; } specifications specification ecmascript (ecma-262)the definition of 'string.prototype.charcodeat' in that specification.
String.prototype.concat() - JavaScript
let greetlist = ['hello', ' ', 'venkat', '!'] "".concat(...greetlist) // "hello venkat!" "".concat({}) // [object object] "".concat([]) // "" "".concat(null) // "null" "".concat(true) // "true" "".concat(4, 5) // "45" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.concat' in that specification.
String.prototype.fixed() - JavaScript
examples using fixed() the following example uses the fixed method to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.fixed()); // "<tt>hello, world</tt>" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.fixed' in that specification.
String.prototype.fontcolor() - JavaScript
' console.log(worldstring.fontcolor('ff00') + ' is red in hexadecimal in this line'); // '<font color="ff00">hello, world</font> is red in hexadecimal in this line' with the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getelementbyid('yourelemid').style.color = 'red'; specifications specification ecmascript (ecma-262)the definition of 'string.prototype.fontcolor' in that specification.
String.prototype.fontsize() - JavaScript
, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <font size="7">hello, world</fontsize> with the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getelementbyid('yourelemid').style.fontsize = '0.7em'; specifications specification ecmascript (ecma-262)the definition of 'string.prototype.fontsize' in that specification.
String.fromCharCode() - JavaScript
a surrogate pair): string.fromcharcode(0xd83c, 0xdf03); // code point u+1f303 "night with string.fromcharcode(55356, 57091); // stars" == "\ud83c\udf03" string.fromcharcode(0xd834, 0xdf06, 0x61, 0xd834, 0xdf07); // "\ud834\udf06a\ud834\udf07" specifications specification ecmascript (ecma-262)the definition of 'string.fromcharcode' in that specification.
String.prototype.indexOf() - JavaScript
of a letter in a string the following example sets count to the number of occurrences of the letter e in the string str: const str = 'to be, or not to be, that is the question.' let count = 0 let position = str.indexof('e') while (position !== -1) { count++ position = str.indexof('e', position + 1) } console.log(count) // displays 4 specifications specification ecmascript (ecma-262)the definition of 'string.prototype.indexof' in that specification.
String.prototype.italics() - JavaScript
mple uses string methods to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.blink()); // <blink>hello, world</blink> console.log(worldstring.bold()); // <b>hello, world</b> console.log(worldstring.italics()); // <i>hello, world</i> console.log(worldstring.strike()); // <strike>hello, world</strike> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.italics' in that specification.
String.prototype.lastIndexOf() - JavaScript
om the beginning is ' + anystring.indexof('w')); // logs 8 console.log('the index of the first w from the end is ' + anystring.lastindexof('w')); // logs 10 console.log('the index of "new" from the beginning is ' + anystring.indexof('new')); // logs 6 console.log('the index of "new" from the end is ' + anystring.lastindexof('new')); // logs 6 specifications specification ecmascript (ecma-262)the definition of 'string.prototype.lastindexof' in that specification.
String.prototype.link() - JavaScript
var hottext = 'mdn'; var url = 'https://developer.mozilla.org/'; console.log('click to return to ' + hottext.link(url)); // click to return to <a href="https://developer.mozilla.org/">mdn</a> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.link' in that specification.
String.prototype.match() - JavaScript
returns ["65"] str3.match(null); // returns ["null"] specifications specification ecmascript (ecma-262)the definition of 'string.prototype.match' in that specification.
String.prototype.matchAll() - JavaScript
(st(\d?))/g; let str = 'test1test2'; str.match(regexp); // array ['test1', 'test2'] using matchall, you can access capture groups easily: let array = [...str.matchall(regexp)]; array[0]; // ['test1', 'e', 'st1', '1', index: 0, input: 'test1test2', length: 4] array[1]; // ['test2', 'e', 'st2', '2', index: 5, input: 'test1test2', length: 4] specifications specification ecmascript (ecma-262)the definition of 'string.prototype.matchall' in that specification.
String.prototype.normalize() - JavaScript
rmalize('nfd'); // '\u017f\u0323\u0307' // compatibly-composed (nfkc) // u+1e69: latin small letter s with dot below and dot above str.normalize('nfkc'); // '\u1e69' // compatibly-decomposed (nfkd) // u+0073: latin small letter s // u+0323: combining dot below // u+0307: combining dot above str.normalize('nfkd'); // '\u0073\u0323\u0307' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.normalize' in that specification.
String.prototype.padEnd() - JavaScript
examples using padend 'abc'.padend(10); // "abc " 'abc'.padend(10, "foo"); // "abcfoofoof" 'abc'.padend(6, "123456"); // "abc123" 'abc'.padend(1); // "abc" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.padend' in that specification.
String.prototype.padStart() - JavaScript
8, "0"); // "00000abc" 'abc'.padstart(1); // "abc" fixed width string number conversion // javascript version of: (unsigned) // printf "%0*d" width num function leftfillnum(num, targetlength) { return num.tostring().padstart(targetlength, 0); } const num = 123; console.log(leftfillnum(num, 5)); // expected output: "00123" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.padstart' in that specification.
String.raw() - JavaScript
// the following is equivalent to // `t${0}e${1}s${2}t`: string.raw({ raw: 'test' }, 0, 1, 2); // 't0e1s2t' specifications specification ecmascript (ecma-262)the definition of 'string.raw' in that specification.
String.prototype.replace() - JavaScript
function f2c(x) { function convert(str, p1, offset, s) { return ((p1 - 32) * 5/9) + 'c'; } let s = string(x); let test = /(-?\d+(?:\.\d*)?)f\b/g; return s.replace(test, convert); } specifications specification ecmascript (ecma-262)the definition of 'string.prototype.replace' in that specification.
String.prototype.replaceAll() - JavaScript
this won't work: 'aabbcc'.replaceall(/b/, '.'); typeerror: replaceall must be called with a global regexp this will work: 'aabbcc'.replaceall(/b/g, '.'); "aa..cc" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.replaceall' in that specification.
String.prototype.search() - JavaScript
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.
String.prototype.slice() - JavaScript
console.log(str.slice(-5, -1)) // => "n us" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.slice' in that specification.
String.prototype.small() - JavaScript
, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <font size="7">hello, world</fontsize> with the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getelementbyid('yourelemid').style.fontsize = '0.7em'; specifications specification ecmascript (ecma-262)the definition of 'string.prototype.small' in that specification.
String.prototype.split() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'string.prototype.split' in that specification.
String.prototype.strike() - JavaScript
xample uses string methods to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.blink()); // <blink>hello, world</blink> console.log(worldstring.bold()); // <b>hello, world</b> console.log(worldstring.italics()); // <i>hello, world</i> console.log(worldstring.strike()); // <strike>hello, world</strike> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.strike' in that specification.
String.prototype.sub() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'string.prototype.sub' in that specification.
String.prototype.substr() - JavaScript
astring.substr(0, 1)); // 'm' console.log(astring.substr(1, 0)); // '' console.log(astring.substr(-1, 1)); // 'a' console.log(astring.substr(1, -1)); // '' console.log(astring.substr(-3)); // 'lla' console.log(astring.substr(1)); // 'ozilla' console.log(astring.substr(-20, 2)); // 'mo' console.log(astring.substr(20, 2)); // '' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.substr' in that specification.
String.prototype.sup() - JavaScript
the sub() and sup() methods to format a string: var supertext = 'superscript'; var subtext = 'subscript'; console.log('this is what a ' + supertext.sup() + ' looks like.'); // "this is what a <sup>superscript</sup> looks like." console.log('this is what a ' + subtext.sub() + ' looks like.'); // "this is what a <sub>subscript</sub> looks like." specifications specification ecmascript (ecma-262)the definition of 'string.prototype.sup' in that specification.
String.prototype.toLowerCase() - JavaScript
examples using tolowercase() console.log('alphabet'.tolowercase()); // 'alphabet' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.tolowercase' in that specification.
String.prototype.toString() - JavaScript
examples using tostring() the following example displays the string value of a string object: var x = new string('hello world'); console.log(x.tostring()); // logs 'hello world' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.tostring' in that specification.
String.prototype.toUpperCase() - JavaScript
console.log(a, b); specifications specification ecmascript (ecma-262)the definition of 'string.prototype.touppercase' in that specification.
String.prototype.trim() - JavaScript
var orig = 'foo '; console.log(orig.trim()); // 'foo' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.trim' in that specification.
String.prototype.trimEnd() - JavaScript
in some engines this means: string.prototype.trimright.name === "trimend"; examples using trimend() the following example displays the lowercase string ' foo': var str = ' foo '; console.log(str.length); // 8 str = str.trimend(); console.log(str.length); // 6 console.log(str); // ' foo' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.trimend' in that specification.
String.prototype.trimStart() - JavaScript
return this.replace(r,'') } } })(proto,'trimstart'); })(window); */ examples using trimstart() the following example displays the lowercase string 'foo ': var str = ' foo '; console.log(str.length); // 8 str = str.trimstart(); console.log(str.length); // 5 console.log(str); // 'foo ' specifications specification ecmascript (ecma-262)the definition of ' string.prototype.trimstart' in that specification.
String.prototype.valueOf() - JavaScript
examples using valueof() var x = new string('hello world'); console.log(x.valueof()); // displays 'hello world' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.valueof' in that specification.
Symbol.prototype[@@toPrimitive] - JavaScript
examples using @@toprimitive const sym = symbol("example"); sym === sym[symbol.toprimitive](); // true specifications specification ecmascript (ecma-262)the definition of 'symbol.prototype.@@toprimitive' in that specification.
Symbol() constructor - JavaScript
if you really want to create a symbol wrapper object, you can use the object() function: let sym = symbol('foo'); let symobj = object(sym); typeof sym // => "symbol" typeof symobj // => "object" specifications specification ecmascript (ecma-262)the definition of 'symbol constructor' in that specification.
Symbol.asyncIterator - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'symbol.asynciterator' in that specification.
Symbol.prototype.description - JavaScript
('desc').description; // "desc" symbol('').description; // "" symbol().description; // undefined // well-known symbols symbol.iterator.tostring(); // "symbol(symbol.iterator)" symbol.iterator.description; // "symbol.iterator" // global symbols symbol.for('foo').tostring(); // "symbol(foo)" symbol.for('foo').description; // "foo" specifications specification ecmascript (ecma-262)the definition of 'get symbol.prototype.description' in that specification.
Symbol.for() - JavaScript
// true symbol('bar') === symbol('bar'); // false // the key is also used as the description var sym = symbol.for('mario'); sym.tostring(); // "symbol(mario)" to avoid name clashes with your global symbol keys and other (library code) global symbols, it might be a good idea to prefix your symbols: symbol.for('mdn.foo'); symbol.for('mdn.bar'); specifications specification ecmascript (ecma-262)the definition of 'symbol.for' in that specification.
Symbol.hasInstance - JavaScript
or example: class myarray { static [symbol.hasinstance](instance) { return array.isarray(instance) } } console.log([] instanceof myarray); // true function myarray() { } object.defineproperty(myarray, symbol.hasinstance, { value: function(instance) { return array.isarray(instance); } }); console.log([] instanceof myarray); // true specifications specification ecmascript (ecma-262)the definition of 'symbol.hasinstance' in that specification.
Symbol.isConcatSpreadable - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'symbol.isconcatspreadable' in that specification.
Symbol.iterator - JavaScript
using it as such is likely to result in runtime exceptions or buggy behavior: var nonwellformediterable = {} nonwellformediterable[symbol.iterator] = () => 1 [...nonwellformediterable] // typeerror: [] is not a function specifications specification ecmascript (ecma-262)the definition of 'symbol.iterator' in that specification.
Symbol.keyFor() - JavaScript
examples using keyfor var globalsym = symbol.for('foo'); // create a new global symbol symbol.keyfor(globalsym); // "foo" var localsym = symbol(); symbol.keyfor(localsym); // undefined // well-known symbols are not symbols registered // in the global symbol registry symbol.keyfor(symbol.iterator) // undefined specifications specification ecmascript (ecma-262)the definition of 'symbol.keyfor' in that specification.
Symbol.match - JavaScript
var re = /foo/; re[symbol.match] = false; '/foo/'.startswith(re); // true '/baz/'.endswith(re); // false specifications specification ecmascript (ecma-262)the definition of 'symbol.match' in that specification.
Symbol.matchAll - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'symbol.matchall' in that specification.
Symbol.replace - JavaScript
enumerable no configurable no examples using symbol.replace class customreplacer { constructor(value) { this.value = value; } [symbol.replace](string) { return string.replace(this.value, '#!@?'); } } console.log('football'.replace(new customreplacer('foo'))); // expected output: "#!@?tball" specifications specification ecmascript (ecma-262)the definition of 'symbol.replace' in that specification.
Symbol.search - JavaScript
configurable no examples custom string search class caseinsensitivesearch { constructor(value) { this.value = value.tolowercase(); } [symbol.search](string) { return string.tolowercase().indexof(this.value); } } console.log('foobar'.search(new caseinsensitivesearch('bar'))); // expected output: 3 specifications specification ecmascript (ecma-262)the definition of 'symbol.search' in that specification.
Symbol.species - JavaScript
the species symbol lets you do this: class myarray extends array { // overwrite species to the parent array constructor static get [symbol.species]() { return array; } } let a = new myarray(1,2,3); let mapped = a.map(x => x * x); console.log(mapped instanceof myarray); // false console.log(mapped instanceof array); // true specifications specification ecmascript (ecma-262)the definition of 'symbol.species' in that specification.
Symbol.split - JavaScript
le no configurable no examples custom reverse split class reversesplit { [symbol.split](string) { const array = string.split(' '); return array.reverse(); } } console.log('another one bites the dust'.split(new reversesplit())); // expected output: [ "dust", "the", "bites", "one", "another" ] specifications specification ecmascript (ecma-262)the definition of 'symbol.split' in that specification.
Symbol.toPrimitive - JavaScript
var obj2 = { [symbol.toprimitive](hint) { if (hint == 'number') { return 10; } if (hint == 'string') { return 'hello'; } return true; } }; console.log(+obj2); // 10 -- hint is "number" console.log(`${obj2}`); // "hello" -- hint is "string" console.log(obj2 + ''); // "true" -- hint is "default" specifications specification ecmascript (ecma-262)the definition of 'symbol.toprimitive' in that specification.
Symbol.prototype.toString() - JavaScript
ymbols, you cannot use string concatenation with them: symbol('foo') + 'bar' // typeerror: can't convert symbol to string examples using tostring symbol('desc').tostring() // "symbol(desc)" // well-known symbols symbol.iterator.tostring() // "symbol(symbol.iterator) // global symbols symbol.for('foo').tostring() // "symbol(foo)" specifications specification ecmascript (ecma-262)the definition of 'symbol.prototype.tostring' in that specification.
Symbol.toStringTag - JavaScript
for example, to acccess the symbol.tostringtag property on htmlbuttonelement: let test = document.createelement('button'); test.tostring(); // returns [object htmlbuttonelement] test[symbol.tostringtag]; // returns htmlbuttonelement specifications specification ecmascript (ecma-262)the definition of 'symbol.tostringtag' in that specification.
Symbol.prototype.valueOf() - JavaScript
examples using valueof const sym = symbol("example"); sym === sym.valueof(); // true specifications specification ecmascript (ecma-262)the definition of 'symbol.prototype.valueof' in that specification.
Symbol - JavaScript
symbol wrapper objects as property keys when a symbol wrapper object is used as a property key, this object will be coerced to its wrapped symbol: let sym = symbol('foo') let obj = {[sym]: 1} obj[sym] // 1 obj[object(sym)] // still 1 specifications specification ecmascript (ecma-262)the definition of 'symbol' in that specification.
SyntaxError() constructor - JavaScript
// true console.error(e.message); // hello console.error(e.name); // syntaxerror console.error(e.filename); // somefile.js console.error(e.linenumber); // 10 console.error(e.columnnumber); // 0 console.error(e.stack); // @debugger eval code:3:9 } specifications specification ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification.
TypeError() constructor - JavaScript
(e instanceof typeerror) // true console.log(e.message) // "hello" console.log(e.name) // "typeerror" console.log(e.filename) // "somefile.js" console.log(e.linenumber) // 10 console.log(e.columnnumber) // 0 console.log(e.stack) // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification.
TypedArray.prototype[@@iterator]() - JavaScript
for loops for (let n of arr) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr[symbol.iterator](); console.log(earr.next().value); // 10 console.log(earr.next().value); // 20 console.log(earr.next().value); // 30 console.log(earr.next().value); // 40 console.log(earr.next().value); // 50 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype[@@iterator]()' in that specification.
get TypedArray[@@species] - JavaScript
however, you might want to overwrite this, in order to return a parent typed array object in your derived class methods: class mytypedarray extends uint8array { // overwrite mytypedarray species to the parent uint8array constructor static get [symbol.species]() { return uint8array; } } specifications specification ecmascript (ecma-262)the definition of 'get %typedarray% [ @@species ]' in that specification.
TypedArray.BYTES_PER_ELEMENT - JavaScript
// 1 uint8array.bytes_per_element; // 1 uint8clampedarray.bytes_per_element; // 1 int16array.bytes_per_element; // 2 uint16array.bytes_per_element; // 2 int32array.bytes_per_element; // 4 uint32array.bytes_per_element; // 4 float32array.bytes_per_element; // 4 float64array.bytes_per_element; // 8 specifications specification ecmascript (ecma-262)the definition of 'typedarray.bytes_per_element' in that specification.
TypedArray.prototype.buffer - JavaScript
examples using the buffer property var buffer = new arraybuffer(8); var uint16 = new uint16array(buffer); uint16.buffer; // arraybuffer { bytelength: 8 } specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.buffer' in that specification.
TypedArray.prototype.byteLength - JavaScript
= new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.bytelength; // 8 (matches the bytelength of the buffer) var uint8 = new uint8array(buffer, 1, 5); uint8.bytelength; // 5 (as specified when constructing the uint8array) var uint8 = new uint8array(buffer, 2); uint8.bytelength; // 6 (due to the offset of the constructed uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.bytelength' in that specification.
TypedArray.prototype.byteOffset - JavaScript
examples using the byteoffset property var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.byteoffset; // 0 (no offset specified) var uint8 = new uint8array(buffer, 3); uint8.byteoffset; // 3 (as specified when constructing uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.byteoffset' in that specification.
TypedArray.prototype.copyWithin() - JavaScript
examples using copywithin var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1,2,3]); console.log(uint8); // uint8array [ 1, 2, 3, 0, 0, 0, 0, 0 ] uint8.copywithin(3,0,3); console.log(uint8); // uint8array [ 1, 2, 3, 1, 2, 3, 0, 0 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.copywithin' in that specification.
TypedArray.prototype.entries() - JavaScript
earray) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr.entries(); console.log(earr.next().value); // [0, 10] console.log(earr.next().value); // [1, 20] console.log(earr.next().value); // [2, 30] console.log(earr.next().value); // [3, 40] console.log(earr.next().value); // [4, 50] specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.entries()' in that specification.
TypedArray.prototype.every() - JavaScript
new uint8array([12, 5, 8, 130, 44]).every(elem => elem >= 10); // false new uint8array([12, 54, 18, 130, 44]).every(elem => elem >= 10); // true specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.every' in that specification.
TypedArray.prototype.filter() - JavaScript
new uint8array([12, 5, 8, 130, 44]).filter(elem => elem >= 10); // uint8array [ 12, 130, 44 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.filter' in that specification.
TypedArray.prototype.find() - JavaScript
function isprime(element, index, array) { var start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } var uint8 = new uint8array([4, 5, 8, 12]); console.log(uint8.find(isprime)); // 5 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.find' in that specification.
TypedArray.prototype.findIndex() - JavaScript
ex, array) { var start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } var uint8 = new uint8array([4, 6, 8, 12]); var uint16 = new uint16array([4, 6, 7, 12]); console.log(uint8.findindex(isprime)); // -1, not found console.log(uint16.findindex(isprime)); // 2 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.findindex' in that specification.
TypedArray.prototype.forEach() - JavaScript
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.
TypedArray.from() - JavaScript
string int16array.from('123'); // int16array [ 1, 2, 3 ] use with arrow function and map using an arrow function as the map function to manipulate the elements float32array.from([1, 2, 3], x => x + x); // float32array [ 2, 4, 6 ] generate a sequence of numbers uint8array.from({length: 5}, (v, k) => k); // uint8array [ 0, 1, 2, 3, 4 ] specifications specification ecmascript (ecma-262)the definition of '%typedarray%.from' in that specification.
TypedArray.prototype.includes() - JavaScript
includes(2); // true uint8.includes(4); // false uint8.includes(3, 3); // false // nan handling (only true for float32 and float64) new uint8array([nan]).includes(nan); // false, since the nan passed to the constructor gets converted to 0 new float32array([nan]).includes(nan); // true; new float64array([nan]).includes(nan); // true; specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.includes' in that specification.
TypedArray.prototype.indexOf() - JavaScript
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.
TypedArray.prototype.keys() - JavaScript
variables in for loops for (let n of earray) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr.keys(); console.log(earr.next().value); // 0 console.log(earr.next().value); // 1 console.log(earr.next().value); // 2 console.log(earr.next().value); // 3 console.log(earr.next().value); // 4 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.keys()' in that specification.
TypedArray.prototype.lastIndexOf() - JavaScript
examples using lastindexof var uint8 = new uint8array([2, 5, 9, 2]); uint8.lastindexof(2); // 3 uint8.lastindexof(7); // -1 uint8.lastindexof(2, 3); // 3 uint8.lastindexof(2, 2); // 0 uint8.lastindexof(2, -2); // 0 uint8.lastindexof(2, -1); // 3 specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.lastindexof' in that specification.
TypedArray.prototype.length - JavaScript
erty var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.length; // 8 (matches the length of the buffer) var uint8 = new uint8array(buffer, 1, 5); uint8.length; // 5 (as specified when constructing the uint8array) var uint8 = new uint8array(buffer, 2); uint8.length; // 6 (due to the offset of the constructed uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.length' in that specification.
TypedArray.prototype.map() - JavaScript
const numbers = new uint8array([1, 4, 9]); const doubles = numbers.map(function(num) { return num * 2; }); // doubles is now uint8array [2, 8, 18] // numbers is still uint8array [1, 4, 9] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.map' in that specification.
TypedArray.name - JavaScript
"int8array" uint8array.name; // "uint8array" uint8clampedarray.name; // "uint8clampedarray" int16array.name; // "int16array" uint16array.name; // "uint16array" int32array.name; // "int32array" uint32array.name; // "uint32array" float32array.name; // "float32array" float64array.name; // "float64array" specifications specification ecmascript (ecma-262)the definition of 'typedarray.name' in that specification.
TypedArray.of() - JavaScript
examples using of uint8array.of(1); // uint8array [ 1 ] int8array.of('1', '2', '3'); // int8array [ 1, 2, 3 ] float32array.of(1, 2, 3); // float32array [ 1, 2, 3 ] int16array.of(undefined); // int16array [ 0 ] specifications specification ecmascript (ecma-262)the definition of '%typedarray%.of' in that specification.
TypedArray.prototype.reduce() - JavaScript
examples sum up all values within an array var total = new uint8array([0, 1, 2, 3]).reduce(function(a, b) { return a + b; }); // total == 6 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.reduce' in that specification.
TypedArray.prototype.reduceRight() - JavaScript
examples sum up all values within an array var total = new uint8array([0, 1, 2, 3]).reduceright(function(a, b) { return a + b; }); // total == 6 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.reduceright' in that specification.
TypedArray.prototype.reverse() - JavaScript
examples using reverse var uint8 = new uint8array([1, 2, 3]); uint8.reverse(); console.log(uint8); // uint8array [3, 2, 1] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.reverse' in that specification.
TypedArray.prototype.set() - JavaScript
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.prototype.set' in that specification.
TypedArray.prototype.slice() - JavaScript
examples return a portion of an existing typed array const uint8 = new uint8array([1,2,3]); uint8.slice(1); // uint8array [ 2, 3 ] uint8.slice(2); // uint8array [ 3 ] uint8.slice(-2); // uint8array [ 2, 3 ] uint8.slice(0,1); // uint8array [ 1 ] specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.slice' in that specification.
TypedArray.prototype.sort() - JavaScript
// regular arrays require a compare function to sort numerically: numbers = [40, 1, 5, 200]; numbers.sort(); // [1, 200, 40, 5] numbers.sort((a, b) => a - b); // compare numbers // [ 1, 5, 40, 200 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.sort' in that specification.
TypedArray.prototype.subarray() - JavaScript
examples using the subarray method var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1,2,3]); console.log(uint8); // uint8array [ 1, 2, 3, 0, 0, 0, 0, 0 ] var sub = uint8.subarray(0,4); console.log(sub); // uint8array [ 1, 2, 3, 0 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.subarray' in that specification.
TypedArray.prototype.toLocaleString() - JavaScript
examples using tolocalestring var uint = new uint32array([2000, 500, 8123, 12, 4212]); uint.tolocalestring(); // if run in a de-de locale // "2.000,500,8.123,12,4.212" uint.tolocalestring('en-us'); // "2,000,500,8,123,12,4,212" uint.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' }); // "¥2,000,¥500,¥8,123,¥12,¥4,212" specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.tolocalestring' in that specification.
TypedArray.prototype.toString() - JavaScript
compatibility if a browser doesn't support the typedarray.prototype.tostring() method yet, javascript will call the tostring method of object: var numbers = new uint8array([2, 5, 8, 1, 4]) numbers.tostring(); // "[object uint8array]" specifications specification ecmascript (ecma-262)the definition of 'array.prototype.tostring' in that specification.
TypedArray.prototype.values() - JavaScript
les in for loops for (let n of earray) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr.values(); console.log(earr.next().value); // 10 console.log(earr.next().value); // 20 console.log(earr.next().value); // 30 console.log(earr.next().value); // 40 console.log(earr.next().value); // 50 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.values()' in that specification.
URIError() constructor - JavaScript
sole.log(e instanceof urierror) // true console.log(e.message) // "hello" console.log(e.name) // "urierror" console.log(e.filename) // "somefile.js" console.log(e.linenumber) // 10 console.log(e.columnnumber) // 0 console.log(e.stack) // "@scratchpad/2:2:9\n" } specifications specification ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification.
Uint16Array - JavaScript
31 // from another typedarray var x = new uint16array([21, 31]); var y = new uint16array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint16array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint16 = new uint16array(iterable); // uint16array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Uint32Array() constructor - JavaScript
1 // from another typedarray var x = new uint32array([21, 31]); var y = new uint32array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(16); var z = new uint32array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint32 = new uint32array(iterable); // uint32array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Uint32Array - JavaScript
1 // from another typedarray var x = new uint32array([21, 31]); var y = new uint32array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(16); var z = new uint32array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint32 = new uint32array(iterable); // uint32array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Uint8Array() constructor - JavaScript
); // 31 // from another typedarray var x = new uint8array([21, 31]); var y = new uint8array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint8array(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint8 = new uint8array(iterable); // uint8array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Uint8Array - JavaScript
); // 31 // from another typedarray var x = new uint8array([21, 31]); var y = new uint8array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint8array(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint8 = new uint8array(iterable); // uint8array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Uint8ClampedArray() constructor - JavaScript
var x = new uint8clampedarray([21, 31]); var y = new uint8clampedarray(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint8clampedarray(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uintc8 = new uint8clampedarray(iterable); // uint8clampedarray[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
Uint8ClampedArray - JavaScript
var x = new uint8clampedarray([21, 31]); var y = new uint8clampedarray(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint8clampedarray(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uintc8 = new uint8clampedarray(iterable); // uint8clampedarray[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
WeakMap() constructor - JavaScript
t(o2); // "azerty" wm2.get(o2); // undefined, because there is no key for o2 on wm2 wm2.get(o3); // undefined, because that is the set value wm1.has(o2); // true wm2.has(o2); // false wm2.has(o3); // true (even if the value itself is 'undefined') wm3.set(o1, 37); wm3.get(o1); // 37 wm1.has(o1); // true wm1.delete(o1); wm1.has(o1); // false specifications specification ecmascript (ecma-262)the definition of 'weakmap constructor' in that specification.
WeakMap.prototype.clear() - JavaScript
the clear() method used to remove all elements from a weakmap object, but is no longer part of ecmascript and its implementations.
WeakMap.prototype.delete() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'weakmap.prototype.delete' in that specification.
WeakMap.prototype.get() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'weakmap.prototype.get' in that specification.
WeakMap.prototype.has() - JavaScript
examples using the has method var wm = new weakmap(); wm.set(window, 'foo'); wm.has(window); // returns true wm.has('baz'); // returns false specifications specification ecmascript (ecma-262)the definition of 'weakmap.prototype.has' in that specification.
WeakMap.prototype.set() - JavaScript
examples using the set method var wm = new weakmap(); var obj = {}; // add new elements to the weakmap wm.set(obj, 'foo').set(window, 'bar'); // chainable // update an element in the weakmap wm.set(obj, 'baz'); specifications specification ecmascript (ecma-262)the definition of 'weakmap.prototype.set' in that specification.
WeakMap - JavaScript
.clear() method class clearableweakmap { constructor(init) { this._wm = new weakmap(init); } clear() { this._wm = new weakmap(); } delete(k) { return this._wm.delete(k); } get(k) { return this._wm.get(k); } has(k) { return this._wm.has(k); } set(k, v) { this._wm.set(k, v); return this; } } specifications specification ecmascript (ecma-262)the definition of 'weakmap' in that specification.
WeakSet() constructor - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'weakset constructor' in that specification.
WeakSet.prototype.add() - JavaScript
examples using add var ws = new weakset(); ws.add(window); // add the window object to the weakset ws.has(window); // true // weakset only takes objects as arguments ws.add(1); // results in "typeerror: invalid value used in weak set" in chrome // and "typeerror: 1 is not a non-null object" in firefox specifications specification ecmascript (ecma-262)the definition of 'weakset.prototype.add' in that specification.
WeakSet.prototype.clear() - JavaScript
the clear() method used to remove all elements from a weakset object, but is no longer part of ecmascript and its implementations.
WeakSet.prototype.delete() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'weakset.prototype.delete' in that specification.
WeakSet.prototype.has() - JavaScript
examples using the has method var ws = new weakset(); var obj = {}; ws.add(window); myset.has(window); // returns true myset.has(obj); // returns false specifications specification ecmascript (ecma-262)the definition of 'weakset.prototype.has' in that specification.
WeakSet - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'weakset' in that specification.
WebAssembly.CompileError() constructor - JavaScript
ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification.
WebAssembly.LinkError() constructor - JavaScript
ecmascript (ecma-262)the definition of 'nativeerror constructors' in that specification.
WebAssembly.RuntimeError() constructor - JavaScript
ecmascript (ecma-262)the definition of 'nativeerror constructor' in that specification.
decodeURI() - JavaScript
examples decoding a cyrillic url decodeuri('https://developer.mozilla.org/ru/docs/javascript_%d1%88%d0%b5%d0%bb%d0%bb%d1%8b'); // "https://developer.mozilla.org/ru/docs/javascript_шеллы" catching errors try { var a = decodeuri('%e0%a4%a'); } catch(e) { console.error(e); } // urierror: malformed uri sequence specifications specification ecmascript (ecma-262)the definition of 'decodeuri' in that specification.
decodeURIComponent() - JavaScript
function decodequeryparam(p) { return decodeuricomponent(p.replace(/\+/g, ' ')); } decodequeryparam('search+query%20%28correct%29'); // 'search query (correct)' specifications specification ecmascript (ecma-262)the definition of 'decodeuricomponent' in that specification.
encodeURI() - JavaScript
or ipv6 if one wishes to follow the more recent rfc3986 for urls, which makes square brackets reserved (for ipv6) and thus not encoded when forming something which could be part of a url (such as a host), the following code snippet may help: function fixedencodeuri(str) { return encodeuri(str).replace(/%5b/g, '[').replace(/%5d/g, ']'); } specifications specification ecmascript (ecma-262)the definition of 'encodeuri' in that specification.
encodeURIComponent() - JavaScript
// which necessitates calling touppercase() to properly encode) // the following are not required for percent-encoding per rfc5987, // so we can allow for a little better readability over the wire: |`^ replace(/%(7c|60|5e)/g, (str, hex) => string.fromcharcode(parseint(hex, 16))); } specifications specification ecmascript (ecma-262)the definition of 'encodeuricomponent' in that specification.
globalThis - JavaScript
} specifications specification ecmascript (ecma-262)the definition of 'globalthis' in that specification.
isFinite() - JavaScript
(-infinity); // false isfinite(0); // true isfinite(2e64); // true isfinite(910); // true isfinite(null); // true, would've been false with the // more robust number.isfinite(null) isfinite('0'); // true, would've been false with the // more robust number.isfinite("0") specifications specification ecmascript (ecma-262)the definition of 'isfinite' in that specification.
null - JavaScript
typeof null // "object" (not "null" for legacy reasons) typeof undefined // "undefined" null === undefined // false null == undefined // true null === null // true null == null // true !null // true isnan(1 + null) // false isnan(1 + undefined) // true specifications specification ecmascript (ecma-262)the definition of 'null value' in that specification.
parseFloat() - JavaScript
ing: function() { return "3.14" } }); parsefloat returning nan the following example returns nan: parsefloat('ff2'); parsefloat and bigint the following examples both return 900719925474099300, losing precision as the integer is too large to be represented as a float: parsefloat(900719925474099267n); parsefloat('900719925474099267n'); specifications specification ecmascript (ecma-262)the definition of 'parsefloat' in that specification.
Standard built-in objects - JavaScript
promise generator generatorfunction asyncfunction reflection reflect proxy internationalization additions to the ecmascript core for language-sensitive functionalities.
Addition (+) - JavaScript
/ number + number -> addition 1 + 2 // 3 // boolean + number -> addition true + 1 // 2 // boolean + boolean -> addition false + false // 0 string concatenation // string + string -> concatenation 'foo' + 'bar' // "foobar" // number + string -> concatenation 5 + 'foo' // "5foo" // string + boolean -> concatenation 'foo' + false // "foofalse" specifications specification ecmascript (ecma-262)the definition of 'addition operator' in that specification.
Addition assignment (+=) - JavaScript
5 // baz = true // number + number -> addition bar += 2 // 7 // boolean + number -> addition baz += 1 // 2 // boolean + boolean -> addition baz += false // 1 // number + string -> concatenation bar += 'foo' // "5foo" // string + boolean -> concatenation foo += false // "foofalse" // string + string -> concatenation foo += 'bar' // "foobar" specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Assignment (=) - JavaScript
syntax operator: x = y examples simple assignment and chaining // assuming the following variables // x = 5 // y = 10 // z = 25 x = y // x is 10 x = y = z // x, y and z are all 25 specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Bitwise AND (&) - JavaScript
examples using bitwise and // 5: 00000000000000000000000000000101 // 2: 00000000000000000000000000000010 5 & 2; // 0 specifications specification ecmascript (ecma-262)the definition of 'bitwise and expression' in that specification.
Bitwise AND assignment (&=) - JavaScript
syntax operator: x &= y meaning: x = x & y examples using bitwise and assignment let a = 5; // 5: 00000000000000000000000000000101 // 2: 00000000000000000000000000000010 a &= 2; // 0 specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Bitwise NOT (~) - JavaScript
examples using bitwise not ~0; // -1 ~-1; // 0 ~1; // -2 specifications specification ecmascript (ecma-262)the definition of 'unary not expression' in that specification.
Bitwise OR (|) - JavaScript
examples using bitwise or // 9 (00000000000000000000000000001001) // 14 (00000000000000000000000000001110) 14 | 9; // 15 (00000000000000000000000000001111) specifications specification ecmascript (ecma-262)the definition of 'bitwise or expression' in that specification.
Bitwise OR assignment (|=) - JavaScript
syntax operator: x |= y meaning: x = x | y examples using bitwise or assignment let a = 5; a |= 2; // 7 // 5: 00000000000000000000000000000101 // 2: 00000000000000000000000000000010 // ----------------------------------- // 7: 00000000000000000000000000000111 specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Bitwise XOR (^) - JavaScript
examples using bitwise xor // 9 (00000000000000000000000000001001) // 14 (00000000000000000000000000001110) 14 ^ 9; // 7 (00000000000000000000000000000111) specifications specification ecmascript (ecma-262)the definition of 'bitwise xor expression' in that specification.
Bitwise XOR assignment (^=) - JavaScript
wise xor assignment let a = 5; // 00000000000000000000000000000101 a ^= 3; // 00000000000000000000000000000011 console.log(a); // 00000000000000000000000000000110 // 6 let b = 5; // 00000000000000000000000000000101 b ^= 0; // 00000000000000000000000000000000 console.log(b); // 00000000000000000000000000000101 // 5 specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Comma operator (,) - JavaScript
so, one could do: function myfunc() { var x = 0; return (x += 1, x); // the same as return ++x; } specifications specification ecmascript (ecma-262)the definition of 'comma operator' in that specification.
Conditional (ternary) operator - JavaScript
value3 : value4; } // equivalent to: function example(…) { if (condition1) { return value1; } else if (condition2) { return value2; } else if (condition3) { return value3; } else { return value4; } } specifications specification ecmascript (ecma-262)the definition of 'conditional operator' in that specification.
Decrement (--) - JavaScript
examples postfix decrement let x = 3; y = x--; // y = 3 // x = 2 prefix decrement let a = 2; b = --a; // a = 1 // b = 1 specifications specification ecmascript (ecma-262)the definition of 'decrement operator' in that specification.
Division (/) - JavaScript
syntax operator: x / y examples basic division 1 / 2 // 0.5 math.floor(3 / 2) // 1 1.0 / 2.0 // 0.5 division by zero 2.0 / 0 // infinity 2.0 / 0.0 // infinity, because 0.0 === 0 2.0 / -0.0 // -infinity specifications specification ecmascript (ecma-262)the definition of 'division operator' in that specification.
Division assignment (/=) - JavaScript
syntax operator: x /= y meaning: x = x / y examples using division assignment // assuming the following variable // bar = 5 bar /= 2 // 2.5 bar /= 'foo' // nan bar /= 0 // infinity specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Equality (==) - JavaScript
); // true console.log(string2 == string3); // true console.log(string3 == string4); // false console.log(string4 == string4); // true comparing dates and strings const d = new date('december 17, 1995 03:24:00'); const s = d.tostring(); // for example: "sun dec 17 1995 03:24:00 gmt-0800 (pacific standard time)" console.log(d == s); //true specifications specification ecmascript (ecma-262)the definition of 'equality operators' in that specification.
Exponentiation (**) - JavaScript
9 3 ** 2.5 // 15.588457268119896 10 ** -1 // 0.1 nan ** 2 // nan associativity 2 ** 3 ** 2 // 512 2 ** (3 ** 2) // 512 (2 ** 3) ** 2 // 64 usage with unary operators to invert the sign of the result of an exponentiation expression: -(2 ** 2) // -4 to force the base of an exponentiation expression to be a negative number: (-2) ** 2 // 4 specifications specification ecmascript (ecma-262)the definition of 'exponentiation operator' in that specification.
Exponentiation assignment (**=) - JavaScript
syntax operator: x **= y meaning: x = x ** y examples using exponentiation assignment // assuming the following variable // bar = 5 bar **= 2 // 25 bar **= 'foo' // nan specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Greater than (>) - JavaScript
false > true); // false console.log(true > 0); // true console.log(true > 1); // false console.log(null > 0); // false console.log(1 > null); // true console.log(undefined > 3); // false console.log(3 > undefined); // false console.log(3 > nan); // false console.log(nan > 3); // false specifications specification ecmascript (ecma-262)the definition of 'relational operators' in that specification.
Greater than or equal (>=) - JavaScript
// true console.log(false >= true); // false console.log(true >= 0); // true console.log(true >= 1); // true console.log(null >= 0); // true console.log(1 >= null); // true console.log(undefined >= 3); // false console.log(3 >= undefined); // false console.log(3 >= nan); // false console.log(nan >= 3); // false specifications specification ecmascript (ecma-262)the definition of 'relational operators' in that specification.
Grouping operator ( ) - JavaScript
var a = 1; var b = 2; var c = 3; // default precedence a + b * c // 7 // evaluated by default like this a + (b * c) // 7 // now overriding precedence // addition before multiplication (a + b) * c // 9 // which is equivalent to a * c + b * c // 9 specifications specification ecmascript (ecma-262)the definition of 'the grouping operator' in that specification.
Increment (++) - JavaScript
examples postfix increment let x = 3; y = x++; // y = 3 // x = 4 prefix increment let a = 2; b = ++a; // a = 3 // b = 3 specifications specification ecmascript (ecma-262)the definition of 'increment operator' in that specification.
Inequality (!=) - JavaScript
ned; // false, look at logical not operator null != undefined; // false const number1 = new number(3); const number2 = new number(3); number1 != 3; // false number1 != number2; // true comparison of objects const object1 = {"key": "value"} const object2 = {"key": "value"}; object1 != object2 // true object2 != object2 // false specifications specification ecmascript (ecma-262)the definition of 'equality operators' in that specification.
Left shift (<<) - JavaScript
examples using left shift 9 << 3; // 72 // 9 * (2 ** 3) = 9 * (8) = 72 specifications specification ecmascript (ecma-262)the definition of 'bitwise shift operators' in that specification.
Left shift assignment (<<=) - JavaScript
syntax operator: x <<= y meaning: x = x << y examples using left shift assignment let a = 5; // 00000000000000000000000000000101 bar <<= 2; // 20 // 00000000000000000000000000010100 specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Less than (<) - JavaScript
(false < true); // true console.log(0 < true); // true console.log(true < 1); // false console.log(null < 0); // false console.log(null < 1); // true console.log(undefined < 3); // false console.log(3 < undefined); // false console.log(3 < nan); // false console.log(nan < 3); // false specifications specification ecmascript (ecma-262)the definition of 'relational operators' in that specification.
Less than or equal (<=) - JavaScript
ue console.log(false <= true); // true console.log(true <= 0); // false console.log(true <= 1); // true console.log(null <= 0); // true console.log(1 <= null); // false console.log(undefined <= 3); // false console.log(3 <= undefined); // false console.log(3 <= nan); // false console.log(nan <= 3); // false specifications specification ecmascript (ecma-262)the definition of 'relational operators' in that specification.
Logical AND (&&) - JavaScript
the following composite operation involving booleans: bcondition1 || (bcondition2 && bcondition3) is always equal to: bcondition1 || bcondition2 && bcondition3 specifications specification ecmascript (ecma-262)the definition of 'logical and expression' in that specification.
Logical NOT (!) - JavaScript
n4 = !!false // !!falsy returns false n5 = !!"" // !!falsy returns false n6 = !!boolean(false) // !!falsy returns false converting between nots the following operation involving booleans: !!bcondition is always equal to: bcondition specifications specification ecmascript (ecma-262)the definition of 'logical not expression' in that specification.
Logical OR (||) - JavaScript
the following composite operation involving booleans: bcondition1 && (bcondition2 || bcondition3) is always equal to: !(!bcondition1 || !bcondition2 && !bcondition3) specifications specification ecmascript (ecma-262)the definition of 'logical or expression' in that specification.
Multiplication (*) - JavaScript
syntax operator: x * y examples multiplication using numbers 2 * 2 // 4 -2 * 2 // -4 multiplication with infinity infinity * 0 // nan infinity * infinity // infinity multiplication with non-numbers 'foo' * 2 // nan specifications specification ecmascript (ecma-262)the definition of 'multiplication operator' in that specification.
Multiplication assignment (*=) - JavaScript
syntax operator: x *= y meaning: x = x * y examples using multiplication assignment // assuming the following variable // bar = 5 bar *= 2 // 10 bar *= 'foo' // nan specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Nullish coalescing operator (??) - JavaScript
"not available"); // "not available" specifications specification ecmascript (ecma-262)the definition of 'nullish coalescing expression' in that specification.
Optional chaining (?.) - JavaScript
"unknown city"; console.log(customercity); // unknown city specifications specification ecmascript (ecma-262)the definition of 'optional expression' in that specification.
Remainder (%) - JavaScript
syntax operator: var1 % var2 examples remainder with positive dividend 12 % 5 // 2 1 % -2 // 1 1 % 2 // 1 2 % 3 // 2 5.5 % 2 // 1.5 remainder with negative dividend -12 % 5 // -2 -1 % 2 // -1 -4 % 2 // -0 remainder with nan nan % 2 // nan specifications specification ecmascript (ecma-262)the definition of 'remainder operator' in that specification.
Remainder assignment (%=) - JavaScript
syntax operator: x %= y meaning: x = x % y examples using remainder assignment // assuming the following variable // bar = 5 bar %= 2 // 1 bar %= 'foo' // nan bar %= 0 // nan specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Right shift (>>) - JavaScript
-9 (base 10): 11111111111111111111111111110111 (base 2) -------------------------------- -9 >> 2 (base 10): 11111111111111111111111111111101 (base 2) = -3 (base 10) examples using right shift 9 >> 2; // 2 -9 >> 2; // -3 specifications specification ecmascript (ecma-262)the definition of 'bitwise shift operators' in that specification.
Right shift assignment (>>=) - JavaScript
syntax operator: x >>= y meaning: x = x >> y examples using right shift assignment let a = 5; // (00000000000000000000000000000101) a >>= 2; // 1 (00000000000000000000000000000001) let b = -5; // (-00000000000000000000000000000101) b >>= 2; // -2 (-00000000000000000000000000000010) specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Strict equality (===) - JavaScript
ring operands of different types console.log("3" === 3); // false console.log(true === 1); // false console.log(null === undefined); // false comparing objects const object1 = { name: "hello" } const object2 = { name: "hello" } console.log(object1 === object2); // false console.log(object1 === object1); // true specifications specification ecmascript (ecma-262)the definition of 'equality operators' in that specification.
Strict inequality (!==) - JavaScript
mparing operands of different types console.log("3" !== 3); // true console.log(true !== 1); // true console.log(null !== undefined); // true comparing objects const object1 = { name: "hello" } const object2 = { name: "hello" } console.log(object1 !== object2); // true console.log(object1 !== object1); // false specifications specification ecmascript (ecma-262)the definition of 'equality operators' in that specification.
Subtraction (-) - JavaScript
syntax operator: x - y examples subtraction with numbers 5 - 3 // 2 3 - 5 // -2 subtraction with non-numbers 'foo' - 3 // nan specifications specification ecmascript (ecma-262)the definition of 'subtraction operator' in that specification.
Subtraction assignment (-=) - JavaScript
syntax operator: x -= y meaning: x = x - y examples using subtraction assignment // assuming the following variable // bar = 5 bar -= 2 // 3 bar -= 'foo' // nan specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Unary negation (-) - JavaScript
const x = "4"; const y = -x; // y = -4 specifications specification ecmascript (ecma-262)the definition of 'unary negation operator' in that specification.
Unary plus (+) - JavaScript
examples usage with numbers const x = 1; const y = -1; console.log(+x); // 1 console.log(+y); // -1 usage with non-numbers +true // 1 +false // 0 +null // 0 +function(val){ return val } // nan +1n // throws typeerror: cannot convert bigint value to number specifications specification ecmascript (ecma-262)the definition of 'unary plus operator' in that specification.
Unsigned right shift (>>>) - JavaScript
-9 (base 10): 11111111111111111111111111110111 (base 2) -------------------------------- -9 >>> 2 (base 10): 00111111111111111111111111111101 (base 2) = 1073741821 (base 10) examples using unsigned right shift 9 >>> 2; // 2 -9 >>> 2; // 1073741821 specifications specification ecmascript (ecma-262)the definition of 'bitwise shift operators' in that specification.
Unsigned right shift assignment (>>>=) - JavaScript
syntax operator: x >>>= y meaning: x = x >>> y examples using unsigned right shift assignment let a = 5; // (00000000000000000000000000000101) a >>>= 2; // 1 (00000000000000000000000000000001) let b = -5; // (-00000000000000000000000000000101) b >>>= 2; // 1073741822 (00111111111111111111111111111110) specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
async function expression - JavaScript
}); specifications specification ecmascript (ecma-262)the definition of 'async function' in that specification.
await - JavaScript
var response = await promisedfunction().catch((err) => { console.error(err); }); // response will be undefined if the promise is rejected specifications specification ecmascript (ecma-262)the definition of 'async functions' in that specification.
function* expression - JavaScript
the function yields the square of its argument: let x = function*(y) { yield y * y; }; specifications specification ecmascript (ecma-262)the definition of 'function*' in that specification.
Function expression - JavaScript
ion(y) { return y * y; }; using a function as a callback more commonly it is used as a callback: button.addeventlistener('click', function(event) { console.log('button is clicked!') }) using an immediately executed function expression an anonymous function is created and called: (function() { console.log('code runs!') })(); specifications specification ecmascript (ecma-262)the definition of 'function definitions' in that specification.
in operator - JavaScript
(if you want to check for only non-inherited properties, use object.prototype.hasownproperty() instead.) 'tostring' in {} // returns true specifications specification ecmascript (ecma-262)the definition of 'relational operators' in that specification.
instanceof - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'relational operators' in that specification.
new operator - JavaScript
to find out the name of the owner of car2, you can access the following property: car2.owner.name specifications specification ecmascript (ecma-262)the definition of 'the new operator' in that specification.
new.target - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'built-in function objects' in that specification.
super - JavaScript
var obj1 = { method1() { console.log('method 1'); } } var obj2 = { method2() { super.method1(); } } object.setprototypeof(obj2, obj1); obj2.method2(); // logs "method 1" specifications specification ecmascript (ecma-262)the definition of 'super' in that specification.
void operator - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'the void operator' in that specification.
yield* - JavaScript
oo' return g4returnvalue; } const iterator = g5(); console.log(iterator.next()); // {value: 1, done: false} console.log(iterator.next()); // {value: 2, done: false} console.log(iterator.next()); // {value: 3, done: false} done is false because g5 generator isn't finished, only g4 console.log(iterator.next()); // {value: 'foo', done: true} specifications specification ecmascript (ecma-262)the definition of 'yield' in that specification.
yield - JavaScript
+= step; } } } const generatorfunc = counter(0); console.log(generatorfunc.next().value); // 1 console.log(generatorfunc.next().value); // 2 console.log(generatorfunc.next().value); // 3 console.log(generatorfunc.next(10).value); // 14 console.log(generatorfunc.next().value); // 15 console.log(generatorfunc.next(10).value); // 26 specifications specification ecmascript (ecma-262)the definition of 'yield' in that specification.
Expressions and operators - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'ecmascript language: expressions' in that specification.
empty - JavaScript
if (one) doone(); else if (two) dotwo(); else if (three) ; // nothing here else if (four) dofour(); else launchrocket(); specifications specification ecmascript (ecma-262)the definition of 'empty statement' in that specification.
async function - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'async function' in that specification.
block - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'block statement' in that specification.
break - JavaScript
function testbreak(x) { var i = 0; while (i < 6) { if (i == 3) { (function() { break; })(); } i += 1; } return i * x; } testbreak(1); // syntaxerror: illegal break statement block_1: { console.log('1'); ( function() { break block_1; // syntaxerror: undefined label 'block_1' })(); } specifications specification ecmascript (ecma-262)the definition of 'break statement' in that specification.
class - JavaScript
let foo = class {}; class foo {}; // uncaught syntaxerror: identifier 'foo' has already been declared specifications specification ecmascript (ecma-262)the definition of 'class definitions' in that specification.
const - JavaScript
my_array = ['b']; specifications specification ecmascript (ecma-262)the definition of 'let and const declarations' in that specification.
continue - JavaScript
j: 5 // end checkj i = 1 j = 4 i: 1 i = 2 j = 4 i: 2 i = 3 j = 4 i: 3 i = 4 j = 4 specifications specification ecmascript (ecma-262)the definition of 'continue statement' in that specification.
debugger - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'debugger statement' in that specification.
do...while - JavaScript
var result = ''; var i = 0; do { i += 1; result += i + ' '; } while (i > 0 && i < 5); // despite i == 0 this will still loop as it starts off without the test console.log(result); specifications specification ecmascript (ecma-262)the definition of 'do-while statement' in that specification.
for await...of - JavaScript
(async function() { try { for (let numorpromise of generatorwithrejectedpromises()) { console.log(await numorpromise); } } catch (e) { console.log('catched', e) } })() // 0 // 1 // 2 // catched 3 // called finally specifications specification ecmascript (ecma-262)the definition of 'ecmascript language: the for-in, for-of, and for-await-of statements' in that specification.
for...in - JavaScript
var triangle = {a: 1, b: 2, c: 3}; function coloredtriangle() { this.color = 'red'; } coloredtriangle.prototype = triangle; var obj = new coloredtriangle(); for (const prop in obj) { if (obj.hasownproperty(prop)) { console.log(`obj.${prop} = ${obj[prop]}`); } } // output: // "obj.color = red" specifications specification ecmascript (ecma-262)the definition of 'for...in statement' in that specification.
for...of - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'for...of statement' in that specification.
for - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'for statement' in that specification.
function* - JavaScript
e: 10, done: false} generator example function* powers(n){ //endless loop to generate for(let current =n;; current *= n){ yield current; } } for(let power of powers(2)){ //controlling generator if(power > 32) break; console.log(power) //2 //4 //8 //16 //32 } specifications specification ecmascript (ecma-262)the definition of 'function*' in that specification.
function declaration - JavaScript
function calc_sales(units_a, units_b, units_c) { return units_a * 79 + units_b * 129 + units_c * 699; } specifications specification ecmascript (ecma-262)the definition of 'function definitions' in that specification.
if...else - JavaScript
for example: if ((x = y)) { /* do something */ } specifications specification ecmascript (ecma-262)the definition of 'if statement' in that specification.
import.meta - JavaScript
the import.meta object is created by the ecmascript implementation, with a null prototype.
let - JavaScript
let x = 1; { var x = 2; // syntaxerror for re-declaration } specifications specification ecmascript (ecma-262)the definition of 'let and const declarations' in that specification.
return - JavaScript
function magic() { return function calc(x) { return x * 42; }; } var answer = magic(); answer(1337); // 56154 specifications specification ecmascript (ecma-262)the definition of 'return statement' in that specification.
throw - JavaScript
try { throw n; // throws an exception with a numeric value } catch (e) { if (e <= 50) { // statements to handle exceptions 1-50 } else { // cannot handle this exception, so rethrow throw e; } } specifications specification ecmascript (ecma-262)the definition of 'throw statement' in that specification.
try...catch - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'try statement' in that specification.
while - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'while statement' in that specification.
Statements and declarations - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'ecmascript language: statements and declarations' in that specification.
JavaScript shells - JavaScript
es6console.com - an open-source javascript console to test ecmascript 2015 code inside the browser.
JavaScript typed arrays - JavaScript
let typedarray = new uint8array([1, 2, 3, 4]), normalarray = array.prototype.slice.call(typedarray); normalarray.length === 4; normalarray.constructor === array; specifications specification ecmascript (ecma-262)the definition of 'typedarray objects' in that specification.
Values - MathML
(the "x"-height of the element, 1ex ≈ 0.5em in many fonts) px pixels in inches (1 inch = 2.54 centimeters) cm centimeters mm millimeters pt points (1 point = 1/72 inch) pc picas (1 pica = 12 points) % percentage of the default value.
Image file type and format guide - Web media technologies
these include cmyk, ycbcr, and others, making tiff a good choice for storing images intended for print, film, or television media.
Media - Progressive web apps (PWAs)
for print media, you normally use appropriate length units like inches (in) and points (pt = 1/72 inch), or centimeters (cm) and millimeters (mm).
contentScriptType - SVG: Scalable Vector Graphics
usage notes value one of the content types specified in the media types default value application/ecmascript animatable no specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'contentscripttype' in that specification.
keyPoints - SVG: Scalable Vector Graphics
ww.w3.org/1999/xlink"> <path d="m10,110 a120,120 -45 0,1 110 10 a120,120 -45 0,1 10,110" stroke="lightgrey" stroke-width="2" fill="none" id="motionpath"/> <circle cx="10" cy="110" r="3" fill="lightgrey"/> <circle cx="110" cy="10" r="3" fill="lightgrey"/> <circle r="5" fill="red"> <animatemotion dur="3s" repeatcount="indefinite" keypoints="0;0.5;1" keytimes="0;0.15;1" calcmode="linear"> <mpath xlink:href="#motionpath"/> </animatemotion> </circle> </svg> usage notes value <number> [; <number>]* ;?
keyTimes - SVG: Scalable Vector Graphics
if the calcmode attribute is set to paced, the keytimes attribute is ignored.
rendering-intent - SVG: Scalable Vector Graphics
rendering-intent is applicable primarily to color profiles corresponding to cmyk color spaces.
textLength - SVG: Scalable Vector Graphics
<svg width="10cm" height="3cm" viewbox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg"> <rect x="1" y="1" width="998" height="298" fill="none" stroke="green" stroke-width="2"/> <text id="hello" x="10" y="150" font-family="sans-serif" font-size="60" fill="green"> hello world!
<animate> - SVG: Scalable Vector Graphics
WebSVGElementanimate
height:100%; margin:0; padding:0; } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <rect width="10" height="10"> <animate attributename="rx" values="0;5;0" dur="10s" repeatcount="indefinite" /> </rect> </svg> attributes animation attributes animation timing attributes begin, dur, end, min, max, restart, repeatcount, repeatdur, fill animation value attributes calcmode, values, keytimes, keysplines, from, to, by other animation attributes most notably: attributename, additive, accumulate animation event attributes most notably: onbegin, onend, onrepeat global attributes core attributes most notably: id styling attributes class, style event attributes global event attributes, document element event attributes usage notes this element implemen...
<animateMotion> - SVG: Scalable Vector Graphics
value type: <number>|auto|auto-reverse; default value: 0; animatable: no note: for <animatemotion> the default value for the calcmode attribute is paced animation attributes animation timing attributes begin, dur, end, min, max, restart, repeatcount, repeatdur, fill animation value attributes calcmode, values, keytimes, keysplines, from, to, by other animation attributes most notably: attributename, additive, accumulate animation event attributes most notably: onbegin, onend, onrepeat global attributes core ...
<svg> - SVG: Scalable Vector Graphics
WebSVGElementsvg
value type: <string> ; default value: application/ecmascript; animatable: no contentstyletype deprecated since svg 2 the default style sheet language used by the svg fragment.
Namespaces crash course - SVG: Scalable Vector Graphics
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <script xlink:href="cool-script.js" type="text/ecmascript"/> </svg> this example has the rather unusual looking parameter xmlns:xlink.
SVG image element - SVG: Scalable Vector Graphics
in this basic example, a .jpg image referenced by an href attribute will be rendered inside an svg object: <?xml version="1.0" standalone="no"?> <!doctype svg public "-//w3c//dtd svg 1.1//en" "http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd"> <svg width="5cm" height="4cm" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <image href="firefox.jpg" x="0" y="0" height="50px" width="50px"/> </svg> there are some important things to take note of (referenced from the w3 specs): if you do not set the x or y attributes, they will be set to 0.
Features restricted to secure contexts - Web security
api chrome/opera edge safari firefox async clipboard api 66 not supported not supported 63 background sync (see syncmanager, for example) 49 not supported not supported not supported cache-control: immutable not supported 15 11 49 credential management api 51 not supported not supported not supported generic sensor api 67 not supported not supported not supported payment request api (and basic card payment).
Tutorials
exploring es6 reliable and in-depth information on ecmascript 2015.
Web Components
the basic approach for implementing a web component generally looks something like this: create a class in which you specify your web component functionality, using the ecmascript 2015 class syntax (see classes for more information).